home *** CD-ROM | disk | FTP | other *** search
/ Linux 68k 2000 / Linux 68k 2000.iso / dokus / PCMCIA-HOWTO < prev    next >
Encoding:
Text File  |  1997-11-15  |  88.6 KB  |  1,895 lines

  1.   Linux PCMCIA HOWTO
  2.   David Hinds, dhinds@hyper.stanford.edu
  3.   v1.106, 14 November 1997
  4.  
  5.   This document describes how to install and use PCMCIA Card Services
  6.   for Linux, and answers some frequently asked questions.  The latest
  7.   version of this document can always be found at hyper.stanford.edu in
  8.   /pub/pcmcia/doc.  An HTML version is at
  9.   http://hyper.stanford.edu/HyperNews/get/pcmcia/home.html
  10.  
  11.   1.  General information and hardware requirements
  12.  
  13.   1.1.  Introduction
  14.  
  15.   Card Services for Linux is a complete PCMCIA support package.  It
  16.   includes a set of loadable kernel modules that implement a version of
  17.   the PCMCIA Card Services applications program interface, a set of
  18.   client drivers for specific cards, and a card manager daemon that can
  19.   respond to card insertion and removal events, loading and unloading
  20.   drivers on demand.  It supports ``hot swapping'' of PCMCIA cards, so
  21.   cards can be inserted and ejected at any time.
  22.  
  23.   This software is still under development.  It probably contains bugs,
  24.   and should be used with caution.  I'll do my best to fix problems that
  25.   are reported to me, but if you don't tell me, I may never know.  If
  26.   you use this code, I hope you will send me your experiences, good or
  27.   bad!
  28.  
  29.   If you have any suggestions for how this document could be improved,
  30.   please let me know (dhinds@hyper.stanford.edu).
  31.  
  32.   1.2.  Copyright notice and disclaimer
  33.  
  34.   Copyright (c) 1996, 1997 David A. Hinds
  35.  
  36.   This document may be reproduced or distributed in any form without my
  37.   prior permission.  Modified versions of this document, including
  38.   translations into other languages, may be freely distributed, provided
  39.   that they are clearly identified as such, and this copyright is
  40.   included intact.
  41.  
  42.   This document may be included in commercial distributions without my
  43.   prior consent.  While it is not required, I would like to be informed
  44.   of such usage.  If you intend to incorporate this document in a
  45.   published work, please contact me to make sure you have the latest
  46.   available version.
  47.  
  48.   This document is provided ``as is'', with no explicit or implied
  49.   warranties.  Use the information in this document at your own risk.
  50.  
  51.   1.3.  What is the latest version, and where can I get it?
  52.  
  53.   The current major release of Card Services is version 2.9, and minor
  54.   updates or bug fixes are numbered 2.9.1, 2.9.2, and so on.
  55.  
  56.   Source code for the latest version is available from
  57.   hyper.stanford.edu in the /pub/pcmcia directory, as pcmcia-
  58.   cs-2.9.?.tar.gz.  There will usually be several versions here.  I
  59.   generally only keep the latest minor release for a given major
  60.   release.  New major releases may contain relatively untested code, so
  61.   I also keep the latest version of the previous major release as a
  62.   relatively stable fallback; the current fallback is 2.8.23.  It is up
  63.   to you to decide which version is more appropriate, but the CHANGES
  64.   file will summarize the most important differences.
  65.   hyper.stanford.edu is mirrored at sunsite.unc.edu in
  66.   /pub/Linux/kernel/pcmcia.  I'll also try to upload major releases to
  67.   tsx-11.mit.edu under /pub/linux/packages/laptops/pcmcia now and then.
  68.  
  69.   If you do not feel up to compiling the PCMCIA drivers from scratch,
  70.   pre-compiled drivers are included with current releases of most of the
  71.   major Linux distributions, including Slackware, Red Hat, Caldera, and
  72.   Yggdrasil, among others.
  73.  
  74.   1.4.  What systems are supported?
  75.  
  76.   This code should run on almost any Linux-capable laptop.  All common
  77.   PCMCIA controllers are supported, including Intel, Cirrus, Vadem,
  78.   VLSI, Ricoh, and Databook chips.  Custom controllers used in IBM and
  79.   Toshiba laptops are also supported.  PCMCIA card docks for desktop
  80.   systems should work as long as they are the type that plugs directly
  81.   into the ISA bus, rather than SCSI-to-PCMCIA or IDE-to-PCMCIA
  82.   adapters.
  83.  
  84.   The Motorola 6AHC05GA controller used in some Hyundai laptops is not
  85.   supported.  The custom PCMCIA controller in the HP Omnibook 600 is
  86.   unsupported.  PCI to CardBus bridge controllers (from SMC, Ricoh,
  87.   Cirrus, and TI) are currently supported only in legacy 16-bit mode,
  88.   and this support is still somewhat experimental.
  89.  
  90.   1.5.  What PCMCIA cards are supported?
  91.  
  92.   The current release includes drivers for a variety of ethernet cards,
  93.   a driver for modem and serial port cards, several SCSI adapter
  94.   drivers, a driver for ATA/IDE drive cards, and memory card drivers
  95.   that should support most SRAM cards and some flash cards.  The
  96.   SUPPORTED.CARDS file included with each release of Card Services lists
  97.   all cards that are known to work in at least one actual system.
  98.  
  99.   The likelihood that a card not on the supported list will work depends
  100.   on the type of card.  Essentially all modems should work with the
  101.   supplied driver.  Some network cards may work if they are OEM versions
  102.   of supported cards.  Other types of IO cards (frame buffers, sound
  103.   cards, etc) will not work until someone writes the appropriate
  104.   drivers.
  105.  
  106.   1.6.  When will my new card be supported?
  107.  
  108.   Unfortunately, they usually don't pay me to write device drivers, so
  109.   if you would like to have a driver for your favorite card, you are
  110.   probably going to have to do at least some of the work.  Ideally, I'd
  111.   like to work towards a model like the Linux kernel, where I would be
  112.   responsible mainly for the ``core'' PCMCIA code and other authors
  113.   would contribute and maintain drivers for specific cards.  The
  114.   SUPPORTED.CARDS file mentions some cards for which driver work is
  115.   currently in progress.  I will try to help where I can, but be warned
  116.   that debugging kernel device drivers by email is not particularly
  117.   effective.
  118.  
  119.   Manufacturers interested in helping provide Linux support for their
  120.   products can contact me about consulting arrangements.
  121.  
  122.   1.7.  Mailing lists
  123.  
  124.   I used to maintain a database and mailing list of Linux PCMCIA users.
  125.   More recently, I've turned my web page for Linux PCMCIA information
  126.   into a ``HyperNews'' site, with a set of message lists for Linux
  127.   PCMCIA issues.  There are lists for installation and configuration
  128.   issues, for different types of cards, and for PCMCIA programming and
  129.   debugging.  The Linux PCMCIA information page is at
  130.   http://hyper.stanford.edu/HyperNews/get/pcmcia/home.html.  Users can
  131.   request email notification of new responses to particular questions,
  132.   or notification for all new messages in a given category.  I hope that
  133.   this will become a useful repository of information, for questions
  134.   that go beyond the scope of the HOWTO.
  135.  
  136.   There is a Linux mailing list devoted to laptop issues, the ``linux-
  137.   laptop'' list.  For more information, send a message containing the
  138.   word ``help'' to majordomo@vger.rutgers.edu.  To subscribe, send a
  139.   message containing ``subscribe linux-laptop'' to the same address.
  140.   This mailing list might be a good forum for discussion of Linux PCMCIA
  141.   issues.
  142.  
  143.   The Linux Laptop Home Page at
  144.   http://www.cs.utexas.edu/users/kharker/linux-laptop has links to many
  145.   sites that have information about configuring specific types of
  146.   laptops for Linux (and PCMCIA).  There is also a searchable database
  147.   of system configuration information.
  148.  
  149.   2.  Compilation, installation, and configuration
  150.  
  151.   2.1.  Prerequisites and kernel setup
  152.  
  153.   Before starting, you should think about whether you really need to
  154.   compile the PCMCIA package yourself.  All common Linux distributions
  155.   come with pre-compiled PCMCIA driver packages.  Generally, you only
  156.   need to install the drivers from scratch if you need a new feature of
  157.   the current drivers, or if you've updated and/or reconfigured your
  158.   kernel in a way that is incompatible with the drivers included with
  159.   your Linux distribution.  While compiling the PCMCIA package is not
  160.   technically difficult, it does require some general Linux familiarity.
  161.  
  162.   The following things should be installed on your system before you
  163.   start installing PCMCIA:
  164.  
  165.   ╖  One of the following kernels: 1.2.8 through 1.2.13, 1.3.30, 1.3.37,
  166.      1.3.39 through 1.3.99, 1.99.* (i.e., pre-2.0), 2.0.*, or 2.1.*.
  167.  
  168.   ╖  A current set of module utilities.
  169.  
  170.   ╖  (Optional) the ``Forms'' X11 user interface toolkit.
  171.  
  172.   The latest version requires a kernel version 1.2.8 or higher, or a
  173.   development kernel 1.3.30 or higher.  1.3.38 is definitely broken, and
  174.   1.3.31 to 1.3.36 are untested.  It also requires a relatively recent
  175.   set of module utilities.  There are no kernel patches specifically for
  176.   PCMCIA.
  177.  
  178.   You need to have a complete linux source tree for your kernel, not
  179.   just an up-to-date kernel image, to compile the PCMCIA package.  The
  180.   PCMCIA modules contain some references to kernel source files.  While
  181.   you may want to build a new kernel to remove unnecessary drivers,
  182.   installing PCMCIA does not require you to do so.
  183.  
  184.   Current ``stable'' kernel sources and patches are available from
  185.   sunsite.unc.edu in /pub/Linux/kernel/v2.0, or from tsx-11.mit.edu in
  186.   /pub/linux/sources/system/v2.0.  Current module utilities can be found
  187.   in the same place, in modules-2.0.0.tgz.  Development kernels can be
  188.   found in the corresponding v2.1 subdirectories.
  189.  
  190.   In the Linux source tree for 2.0 and 2.1 kernels, the
  191.   Documentation/Changes file describes the versions of all sorts of
  192.   other system components that are required for that kernel release.
  193.   You may want to check through this and verify that your system is up
  194.   to date, especially if you have updated your kernel.  If you are using
  195.   a 2.1 kernel, be sure that you are using the right combination of
  196.   shared libraries and module tools.  The latest versions of the module
  197.   utilities, as well as versions for older kernels, can be found at
  198.   <http://www.pi.se/blox/modules>.
  199.  
  200.   When configuring your kernel, if you plan on using a PCMCIA ethernet
  201.   card, you should turn on networking support but turn off the normal
  202.   Linux network card drivers, including the ``pocket and portable
  203.   adapters''.  The PCMCIA network card drivers are all implemented as
  204.   loadable modules.  Any drivers compiled into your kernel will only
  205.   waste space.
  206.  
  207.   If you want to use SLIP, PPP, or PLIP, you do need to either configure
  208.   your kernel with these enabled, or use the loadable module versions of
  209.   these drivers.  There is an unfortunate deficiency in the kernel
  210.   config process in 1.2.X kernels, in that it is not possible to set
  211.   configuration options (like SLIP compression) for a loadable module,
  212.   so it is probably better to just link SLIP into the kernel if you need
  213.   it.
  214.  
  215.   If you want to use a PCMCIA token ring adapter, your kernel needs to
  216.   be configured with ``Token Ring driver support'' (CONFIG_TR) enabled,
  217.   though you should leave CONFIG_IBMTR off.
  218.  
  219.   If you want to use a PCMCIA IDE adapter, your kernel should be
  220.   configured with CONFIG_BLK_DEV_IDE_PCMCIA enabled, for 1.3.72 through
  221.   2.1.7 kernels.  Older kernels do not support removeable IDE devices;
  222.   newer kernels do not require a special configuration setting.
  223.  
  224.   If you will be using a PCMCIA SCSI adapter, you should enable
  225.   CONFIG_SCSI when configuring your kernel.  Also, enable any top level
  226.   drivers (SCSI disk, tape, cdrom, generic) that you expect to use.  All
  227.   low-level drivers for particular host adapters should be disabled, as
  228.   they will just take up space.
  229.  
  230.   If you want to modularize a driver that is needed for a PCMCIA device,
  231.   you must modify /etc/pcmcia/config to specify what modules need to be
  232.   loaded for what card types.  For example, if the serial driver is
  233.   modularized, then you could change the serial device definition to:
  234.  
  235.        device "serial_cs"
  236.          class "serial" module "misc/serial", "serial_cs"
  237.  
  238.   This package includes an X-based card status utility called cardinfo.
  239.   This utility is based on a freely distributed user interface toolkit
  240.   called the Forms Library, which you will need to install before
  241.   building cardinfo.  A binary distribution is on hyper.stanford.edu in
  242.   /pub/pcmcia/extras: there are both a.out and ELF versions of the
  243.   library.  You will also need to have all the normal X header files and
  244.   libraries installed.
  245.  
  246.   2.2.  Installation
  247.  
  248.   Here is a synopsis of the installation process:
  249.  
  250.   ╖  Unpack pcmcia-cs-2.9.?.tar.gz in /usr/src.
  251.  
  252.   ╖  Run ``make config'' in the new pcmcia-cs-2.9.? directory.
  253.  
  254.   ╖  Run ``make all'', then ``make install''.
  255.  
  256.   ╖  Customize the PCMCIA startup script and the option files in
  257.      /etc/pcmcia for your site.
  258.  
  259.   If you plan to install any contributed client drivers not included in
  260.   the core PCMCIA distribution, unpack each of them in the top-level
  261.   directory of the PCMCIA source tree.  Then follow the normal build
  262.   instructions.  The extra drivers will be compiled and installed
  263.   automatically.
  264.  
  265.   Running ``make config'' prompts for a few configuration options, and
  266.   checks out your system to verify that it satisfies all prerequisites
  267.   for installing PCMCIA support.  In most cases, you'll be able to just
  268.   accept all the default configuration options.  Be sure to carefully
  269.   check the output of this command in case there are problems.
  270.  
  271.   If you are compiling the PCMCIA package for installation on another
  272.   machine, specify an alternate target directory when prompted by the
  273.   configure script.  This should be an absolute path.  All the PCMCIA
  274.   tools will be installed relative to this directory.  You will then be
  275.   able to tar this directory tree and copy to your target machine, and
  276.   unpack relative to its root directory to install everything in the
  277.   proper places.
  278.  
  279.   If you are cross compiling on another machine, you may want to specify
  280.   alternate names for the compiler and linker.  This may also be helpful
  281.   on mixed a.out and ELF systems.  The script will also prompt for
  282.   additional compiler flags for debugging.
  283.  
  284.   Some of the support utilities (cardctl and cardinfo) can be compiled
  285.   either in ``safe'' or ``trusting'' forms.  The ``safe'' forms prevent
  286.   non-root users from modifying card configurations.  The ``trusting''
  287.   forms permit ordinary users to issue commands to suspend and resume
  288.   cards, reset cards, and change the current configuration scheme.  The
  289.   configuration script will ask if you want the utilities compiled as
  290.   safe or trusting: the default is to be safe.
  291.  
  292.   There are a few kernel configuration options that affect the PCMCIA
  293.   tools.  The configuration script can deduce these from the running
  294.   kernel (the most common case).  Alternatively, if you are compiling
  295.   for installation on another machine, it can read the configuration
  296.   from a kernel source tree, or each option can be set interactively.
  297.  
  298.   Running ``make all'' followed by ``make install'' will build and then
  299.   install the kernel modules and utility programs.  Kernel modules are
  300.   installed under /lib/modules/<version>/pcmcia.  The cardmgr and
  301.   cardctl programs are installed in /sbin.  If cardinfo is built, it is
  302.   installed in /usr/bin/X11.
  303.  
  304.   Configuration files will be installed in the /etc/pcmcia directory.
  305.   If you are installing over an older version, your old config scripts
  306.   will be backed up before being replaced.  The saved scripts will be
  307.   given extensions like *.~1~, *.~2~, and so on.
  308.  
  309.   If you don't know what kind of PCMCIA controller chip you have, you
  310.   can use the probe utility in the cardmgr/ subdirectory to determine
  311.   this.  There are two major types: the Databook TCIC-2 type and the
  312.   Intel i82365SL-compatible type.
  313.  
  314.   A user-level daemon processes card insertion and removal events.  This
  315.   is called cardmgr.  It is similar in function to Barry Jaspan's
  316.   pcmciad in earlier PCMCIA releases.  Cardmgr reads a configuration
  317.   file describing known PCMCIA cards from /etc/pcmcia/config.  This file
  318.   also specifies what resources can be allocated for use by PCMCIA
  319.   devices, and may need to be customized for your system.  See the
  320.   pcmcia man page for more information about this file.
  321.  
  322.   2.3.  Post-installation for systems using BSD init scripts
  323.  
  324.   Some Linux distributions, including Slackware, use a BSD arrangement
  325.   for system startup scripts.  If /etc/rc.d/rc.M exists, your system is
  326.   in this group.  The script rc.pcmcia, installed in /etc/rc.d, controls
  327.   starting up and shutting down the PCMCIA system.  ``make install''
  328.   will use the probe command to determine your controller type and
  329.   modify rc.pcmcia appropriately.  You should add a line to your system
  330.   startup file /etc/rc.d/rc.M to invoke the PCMCIA startup script, like:
  331.  
  332.        /etc/rc.d/rc.pcmcia start
  333.  
  334.   It does not really matter where you insert this line, as long as the
  335.   PCMCIA drivers are started after syslogd.
  336.  
  337.   2.4.  Post-installation for systems using System V init scripts
  338.  
  339.   Red Hat, Caldera, and Debian Linux have a System V-ish arrangement for
  340.   system startup files.  If you have a directory called /etc/init.d or
  341.   /etc/rc.d/init.d, then your system is in this group.  The rc.pcmcia
  342.   script will be installed as /etc/rc.d/init.d/pcmcia, or
  343.   /etc/init.d/pcmcia, as appropriate.  There is no need to edit any of
  344.   the startup scripts to enable PCMCIA: it will happen automatically.
  345.  
  346.   If the /etc/sysconfig directory exists, then a separate configuration
  347.   file, /etc/sysconfig/pcmcia, will be created for startup options.  If
  348.   you need to change any module options (like the PCIC= or PCIC_OPTS=
  349.   settings), edit this config file rather than the actual PCMCIA startup
  350.   script.  This file will not be overwritten by subsequent installs.
  351.  
  352.   Some previous releases used the /etc/sysconfig/pcmcia-scripts
  353.   directory in place of /etc/pcmcia on these platforms.  The current
  354.   release instead uses /etc/pcmcia for all systems, and will move an
  355.   existing /etc/sysconfig/pcmcia-scripts to /etc/pcmcia.
  356.  
  357.   2.5.  Site-specific configuration options
  358.  
  359.   Card Services should automatically avoid allocating IO ports and
  360.   interrupts already in use by other standard devices.  It will also
  361.   attempt to detect conflicts with unknown devices, but this is not
  362.   completely reliable.  In some cases, you may need to explicitly
  363.   exclude resources for a device in /etc/pcmcia/config.opts.
  364.  
  365.   Here are some resource settings for specific laptop types.
  366.  
  367.   ╖  On the AMS SoundPro, exclude irq 10.
  368.  
  369.   ╖  On some AMS TravelPro 5300 models, use memory 0xc8000-0xcffff.
  370.  
  371.   ╖  On the BMX 486DX2-66, exclude irq 5, irq 9.
  372.  
  373.   ╖  On the Chicony NB5, use memory 0xda000-0xdffff.
  374.  
  375.   ╖  On the Compaq Presario 1020, exclude port 0x2f8-0x2ff, irq 3, irq
  376.      5.
  377.  
  378.   ╖  On the HP Omnibook 4000C, exclude port 0x300-0x30f.
  379.  
  380.   ╖  On the Micron Millenia Transport, exclude irq 5, irq 9.
  381.  
  382.   ╖  On the NEC Versa M, exclude irq 9, port 0x2e0-2ff.
  383.  
  384.   ╖  On the NEC Versa P/75, exclude irq 5, irq 9.
  385.  
  386.   ╖  On the NEC Versa S, exclude irq 9, irq 12.
  387.  
  388.   ╖  On the NEC Versa 6000 series, exclude port 0x300-0x33f, irq 9, irq
  389.      10.
  390.  
  391.   ╖  On the ProStar 9200, Altima Virage, and Acquiline Hurricane
  392.      DX4-100, exclude irq 5, port 0x330-0x35f.  Maybe use memory
  393.      0xd8000-0xdffff.
  394.  
  395.   ╖  On the Siemens Nixdorf SIMATIC PG 720C, use memory 0xc0000-0xcffff,
  396.      port 0x300-0x3bf.
  397.  
  398.   ╖  On the TI TravelMate 5000, use memory 0xd4000-0xdffff.
  399.  
  400.   ╖  On the Toshiba T4900 CT, exclude irq 5, port 0x2e0-0x2e8, port
  401.      0x330-0x338.
  402.  
  403.   ╖  On the Twinhead 5100, HP 4000, Sharp PC-8700 and PC-8900, exclude
  404.      irq 9 (sound), irq 12.
  405.  
  406.   ╖  On an MPC 800 Series, exclude irq 5, port 0x300-0x30f for the CD-
  407.      ROM.
  408.  
  409.   Some PCMCIA controllers have optional features that may or may not be
  410.   implemented in a particular system.  It is generally impossible for a
  411.   socket driver to detect if these features are implemented.  Check the
  412.   man page for your driver to see what optional features may be enabled.
  413.  
  414.   In a few cases, the probe command will be unable to determine your
  415.   controller type automatically.  If you have a Halikan NBD 486 system,
  416.   it has a TCIC-2 controller at an unusual location: you'll need to edit
  417.   rc.pcmcia to load the tcic module, as well as setting the PCIC_OPTS
  418.   parameter to ``tcic_base=0x02c0''.
  419.  
  420.   The low level socket drivers, tcic and i82365, have numerous bus
  421.   timing parameters that may need to be adjusted for systems with
  422.   particularly fast processors.  Symptoms of timing problems include
  423.   card recognition problems, lock-ups under heavy loads, high error
  424.   rates, or poor device performance.  Check the corresponding man pages
  425.   for more details, but here is a brief summary:
  426.  
  427.   ╖  Cirrus controllers have numerous configurable timing parameters.
  428.      The most important seems to be the cmd_time flag, which determines
  429.      the length of PCMCIA bus cycles.  Fast 486 systems (i.e., DX4-100)
  430.      seem to often benefit from increasing this from 6 (the default) to
  431.      12 or 16.
  432.  
  433.   ╖  The Cirrus PD6729 PCI controller has the fast_pci flag, which
  434.      should be set if the PCI bus speed is greater than 25 MHz.
  435.  
  436.   ╖  For Vadem VG-468 controllers and Databook TCIC-2 controllers, the
  437.      async_clock flag changes the relative clocking of PCMCIA bus and
  438.      host bus cycles.  Setting this flag adds extra wait states to some
  439.      operations.  However, I have yet to hear of a laptop that needs
  440.      this.
  441.  
  442.   ╖  The pcmcia_core module has the cis_speed parameter for changing the
  443.      memory speed used for accessing a card's Card Information Structure
  444.      (CIS).  On some systems with fast bus clocks, increasing this
  445.      parameter (i.e., slowing down card accesses) may be beneficial for
  446.      card recognition problems.
  447.  
  448.   ╖  This isn't a timing issue, but if you have more than one PCMCIA
  449.      controller in your system or extra sockets in a docking station,
  450.      the i82365 module should be loaded with the extra_sockets parameter
  451.      set to 1.
  452.  
  453.   All these options should be configured by modifying the top of
  454.   /etc/rc.d/rc.pcmcia.  For example:
  455.  
  456.        # Should be either i82365 or tcic
  457.        PCIC=i82365
  458.        # Put socket driver timing parameters here
  459.        PCIC_OPTS="cmd_time=12"
  460.        # Put pcmcia_core options here
  461.        CORE_OPTS="cis_speed=500"
  462.  
  463.   Here are some timing settings for specific systems:
  464.  
  465.   ╖  On the ARM Pentium-90 or Midwest Micro Soundbook Plus, use
  466.      ``freq_bypass=1 cmd_time=8''.
  467.  
  468.   ╖  On a Midwest Micro Soundbook Elite, use ``cmd_time=12''.
  469.  
  470.   ╖  On a Gateway Liberty, try ``cmd_time=16''.
  471.  
  472.   On some systems using Cirrus controllers, including the NEC Versa M,
  473.   the BIOS puts the controller in a special suspended state at system
  474.   startup time.  On these systems, the probe command will fail to find
  475.   any known PCMCIA controller.  If this happens, edit
  476.   /etc/rc.d/rc.pcmcia by hand as follows:
  477.  
  478.        # Should be either i82365 or tcic
  479.        PCIC=i82365
  480.        # Put socket driver timing parameters here
  481.        PCIC_OPTS="wakeup=1"
  482.  
  483.   2.6.  Problems loading kernel modules
  484.  
  485.   The configure script will normally ensure that the PCMCIA modules are
  486.   compatible with your kernel.  So, module loading problems generally
  487.   indicate that the user has interfered with the normal installation
  488.   process in some way.  Some module loading errors are sent directly to
  489.   the Linux console.  Other errors are recorded in the system log file,
  490.   normally /usr/adm/messages or /var/log/messages.  Depending on your
  491.   syslogd configuration, some messages may be written to other files,
  492.   but they will usually still be under /usr/adm or /var/log.  To track
  493.   down a problem, be sure to check both locations, to pin down which
  494.   module is actually causing trouble.
  495.  
  496.   Some of the PCMCIA modules require kernel services that may or may not
  497.   be present, depending on kernel configuration.  For instance, the SCSI
  498.   card drivers require that the kernel be configured with SCSI support,
  499.   and the network drivers require a networking kernel.  If a kernel
  500.   lacks a necessary feature, insmod may report undefined symbols and
  501.   refuse to load a module.
  502.  
  503.   If insmod reports ``wrong version'' errors, it means that the module
  504.   was compiled for a different kernel version than your system is
  505.   actually running.  This might occur if modules compiled on one machine
  506.   are copied to another machine with a different configuration, or if
  507.   the kernel is reconfigured after PCMCIA is installed.
  508.  
  509.   Another source of module loading errors is when the modules and kernel
  510.   were compiled with different settings of CONFIG_MODVERSIONS.  If a
  511.   module with version checking is loaded against a kernel without
  512.   version checking, insmod will complain about undefined symbols.
  513.  
  514.   Finally, relatively recent binutils releases are incompatible with
  515.   older versions of the module utilities, and can cause module version
  516.   incompatibilities to be reported.  The most common symptom is
  517.   complaints about ``gcc_compiled'' being undefined.  If you get these
  518.   errors, upgrade to the latest module utilities, available from
  519.   <http://www.pi.se/blox/modules>.
  520.  
  521.   2.7.  Problems with the card status change interrupt
  522.  
  523.   In most cases, the socket driver (i82365 or tcic) will automatically
  524.   probe and select an appropriate interrupt to signal card status
  525.   changes.  The automatic interrupt probe doesn't work on some Intel-
  526.   compatible controllers, including Cirrus chips and the chips used in
  527.   some IBM ThinkPads.  If a device is inactive at probe time, its
  528.   interrupt may also appear to be available.  In these cases, the socket
  529.   driver may pick an interrupt that is used by another device.
  530.  
  531.   With the i82365 and tcic drivers, the irq_list option can be used to
  532.   limit the interrupts that will be tested.  This list limits the set of
  533.   interrupts that can be used by PCMCIA cards as well as for monitoring
  534.   card status changes.  The cs_irq option can also be used to explicitly
  535.   set the interrupt to be used for monitoring card status changes.
  536.  
  537.   If you can't find an interrupt number that works, there is also a
  538.   polled status mode: both i82365 and tcic will accept a
  539.   poll_interval=100 option, to poll for card status changes once per
  540.   second.  This option should also be used if your system has a shortage
  541.   of interrupts available for use by PCMCIA cards.  Especially for
  542.   systems with more than one PCMCIA controller, there is little point in
  543.   dedicating interrupts for monitoring card status changes.
  544.  
  545.   All these options should be set in the PCIC_OPTS= line in either
  546.   /etc/rc.d/rc.pcmcia or /etc/sysconfig/pcmcia, depending on your site
  547.   setup.
  548.  
  549.   2.8.  Card identification problems
  550.  
  551.   By default, the PCMCIA drivers allocate memory windows in the region
  552.   0xc0000-0xfffff, after probing this region for conflicts with ROM or
  553.   other devices.  This memory window is specified in
  554.   /etc/pcmcia/config.opts.  The probe is done when the drivers first
  555.   attempt to configure a new card.  The probe procedure is not
  556.   foolproof, so it is possible for a conflict to go unrecognized.  If an
  557.   address region that passes the probe is used by other devices in your
  558.   system, cards may not be identified correctly.  With chipsets that
  559.   support it, conflicts can also result from BIOS shadowing in this
  560.   region.
  561.  
  562.   The classic symptom of a memory window configuration problem is that
  563.   all cards will be misidentified as memory cards.  In unusual cases, a
  564.   memory window conflict can interfere with a crucial system service,
  565.   resulting in lock-ups or reboots.  If you suspect a memory window
  566.   problem, first verify that ROM shadowing is disabled in your system's
  567.   hardware setup.  Finding a good window may require some
  568.   experimentation.  Some alternative windows to try are 0xd0000-0xdffff,
  569.   0xc0000-0xc7fff, 0xc8000-0xcffff, or 0xd8000-0xdffff.
  570.  
  571.   If you have DOS PCMCIA drivers, you may be able to deduce what memory
  572.   region those drivers use.  Note that DOS memory addresses are often
  573.   specified in ``segment'' form, which leaves off the final hex digit
  574.   (so an absolute address of 0xd0000 might be given as 0xd000).  Be sure
  575.   to add the extra digit back when making changes to
  576.   /etc/pcmcia/config.opts.
  577.  
  578.   If adjusting the memory window fails to solve a card identification
  579.   problem, then it is likely to be due to a timing problem.
  580.  
  581.   2.9.  Why don't you distribute PCMCIA binaries?
  582.  
  583.   For me, distributing binaries is a significant hassle.  It is
  584.   complicated because some features can only be selected at compile
  585.   time, and because the PCMCIA modules are somewhat dependent on having
  586.   the ``right'' kernel configuration.  So, I would probably need to
  587.   distribute precompiled modules along with matching kernels.  Beyond
  588.   this, the greatest need for precompiled modules is when installing
  589.   Linux on a clean system.  This typically requires setting up PCMCIA so
  590.   that it can be used in the installation process for a particular Linux
  591.   distribution.  Each Linux distribution has its own procedures, and it
  592.   is not feasible for me to provide boot and root disks for even just
  593.   the common combinations of drivers and distributions.
  594.  
  595.   PCMCIA is now a part of many of the major Linux distributions,
  596.   including Red Hat, Caldera, Slackware, Yggdrasil, Craftworks, and
  597.   Nascent Technology.
  598.  
  599.   2.10.  Why is the PCMCIA package so darned big?
  600.  
  601.   Well, first of all, it isn't actually that large.  All the driver
  602.   modules together take up about 200K of disk space.  The utility
  603.   programs add up to about 70K, and the stuff in /etc/pcmcia is about
  604.   30K.  When running, the core PCMCIA modules take up 48K of system
  605.   memory.  The cardmgr daemon will generally be swapped out except when
  606.   cards are inserted or removed.  The total package size is not much
  607.   different from DOS Card Services implementations.
  608.  
  609.   Compared to DOS ``point enablers'', this may still seem like a lot of
  610.   overhead, especially for people that don't plan on using many of the
  611.   features of PCMCIA, such as power management or hot swapping.  Point
  612.   enablers can be tiny because they generally support only one or a
  613.   small set of cards, and also generally support a restricted set of
  614.   PCMCIA controllers.  If someone were to write a genuinely ``generic''
  615.   modem enabler, it would end up incorporating much of the functionality
  616.   of Card Services, to handle cards from different vendors and the full
  617.   range of PCMCIA controller variants.
  618.  
  619.   3.  Usage and features
  620.  
  621.   3.1.  Tools for monitoring PCMCIA devices
  622.  
  623.   The cardmgr daemon normally beeps when a card is inserted, and the
  624.   tone of the beeps indicates the status of the newly inserted card.
  625.   Two high beeps indicate the card was identified and configured
  626.   successfully.  A high beep followed by a lower beep indicates that the
  627.   card was identified, but could not be configured for some reason.  One
  628.   low beep indicates that the card could not be identified.
  629.  
  630.   If the modules are all loaded correctly, the output of the lsmod
  631.   command should look like the following, with no cards inserted:
  632.  
  633.        Module:        #pages:  Used by:
  634.        ds                 2
  635.        i82365             3
  636.        pcmcia_core        7    [ds i82365]
  637.  
  638.   All the PCMCIA modules and the cardmgr daemon send status messages to
  639.   the system log.  This will usually be /var/log/messages or
  640.   /usr/adm/messages.  This file should be the first place to look when
  641.   tracking down a problem.  When submitting a bug report, always include
  642.   the contents of this file.  If you are having trouble finding your
  643.   system messages, check /etc/syslogd.conf to see how different classes
  644.   of messages are handled.
  645.  
  646.   Cardmgr also records some current device information for each socket
  647.   in /var/run/stab.  Here is a sample /var/run/stab listing:
  648.  
  649.        Socket 0: Adaptec APA-1460 SlimSCSI
  650.        0       scsi    aha152x_cs      0       sda     8       0
  651.        0       scsi    aha152x_cs      1       scd0    11      0
  652.        Socket 1: Serial or Modem Card
  653.        1       serial  serial_cs       0       ttyS1   5       65
  654.  
  655.   For the lines describing devices, the first field is the socket, the
  656.   second is the device class, the third is the driver name, the fourth
  657.   is used to number multiple devices associated with the same driver,
  658.   the fifth is the device name, and the final two fields are the major
  659.   and minor device numbers for this device (if applicable).
  660.  
  661.   The cardctl command can be used to check the status of a socket, or to
  662.   see how it is configured.  Here is an example of the output of the
  663.   ``cardctl config'' command:
  664.  
  665.   Socket 0:
  666.   Socket 1:
  667.     Vcc = 5.0, Vpp1 = 0.0, Vpp2 = 0.0
  668.     Card type is memory and I/O
  669.     IRQ 3 is dynamic shared, level mode, enabled
  670.     Speaker output is enabled
  671.     Function 0:
  672.       Config register base = 0x0800
  673.         Option = 0x63, status = 0x08
  674.       I/O window 1: 0x0280 to 0x02bf, auto sized
  675.       I/O window 2: 0x02f8 to 0x02ff, 8 bit
  676.  
  677.   If you are running X, the cardinfo utility produces a graphical
  678.   display showing the current status of all PCMCIA sockets, similar in
  679.   content to ``cardctl config''.
  680.  
  681.   3.2.  Overview of the PCMCIA configuration scripts
  682.  
  683.   Each PCMCIA device has an associated ``class'' that describes how it
  684.   should be configured and managed.  Classes are associated with device
  685.   drivers in /etc/pcmcia/config.  There are currently five IO device
  686.   classes (network, SCSI, cdrom, fixed disk, and serial) and two memory
  687.   device classes (memory and FTL).  For each class, there are two
  688.   scripts in /etc/pcmcia/config: a main configuration script (i.e.,
  689.   /etc/pcmcia/scsi for SCSI devices), and an options script (i.e.,
  690.   /etc/pcmcia/scsi.opts).  The main script for a device will be invoked
  691.   to configure that device when a card is inserted, and to shut down the
  692.   device when the card is removed.  For cards with several associated
  693.   devices, the script will be invoked for each device.
  694.  
  695.   The config scripts start by extracting some information about a device
  696.   from /var/run/stab.  Each script constructs a ``device address'', that
  697.   uniquely describes the device it has been asked to configure, in the
  698.   ADDRESS variable.  This is passed to the *.opts script, which should
  699.   return information about how a device at this address should be
  700.   configured.  For some devices, the device address is just the socket
  701.   number.  For others, it includes extra information that may be useful
  702.   in deciding how to configure the device.  For example, network devices
  703.   pass their hardware ethernet address as part of the device address, so
  704.   the network.opts script could use this to select from several
  705.   different configurations.
  706.  
  707.   The first part of all device addresses is the current PCMCIA
  708.   ``scheme''.  This parameter is used to support multiple sets of device
  709.   configurations based on a single external user-specified variable.
  710.   One use of schemes would be to have a ``home'' scheme, and a ``work''
  711.   scheme, which would include different sets of network configuration
  712.   parameters.  The current scheme is selected using the cardctl command.
  713.   The default if no scheme is set is ``default''.
  714.  
  715.   As a general rule, when configuring Linux for a laptop, PCMCIA devices
  716.   should only be configured from the PCMCIA device scripts.  Do not try
  717.   to configure a PCMCIA device the same way you would configure a
  718.   permanently attached device.
  719.  
  720.   3.3.  PCMCIA network adapters
  721.  
  722.   Linux ethernet-type network interfaces normally have names like eth0,
  723.   eth1, and so on.  Token-ring adapters are handled similarly, however
  724.   they are named tr0, tr1, and so on.  The ifconfig command is used to
  725.   view or modify the state of a network interface.  A peculiarity of
  726.   Linux is that network interfaces do not have corresponding device
  727.   files under /dev, so don't be surprised when you can't find them.
  728.  
  729.   When a PCMCIA ethernet card is detected, it will be assigned the first
  730.   free interface name, which will probably be eth0.  Cardmgr will run
  731.   the /etc/pcmcia/network script to configure the interface.
  732.  
  733.   Do not configure your PCMCIA ethernet card in /etc/rc.d/rc.inet1,
  734.   since the card may not be present when this script is executed.
  735.   Comment out everything except the loopback stuff in rc.inet1.  If your
  736.   system has an automatic network configuration procedure, you should
  737.   generally indicate that you do not have a network card installed.
  738.   Instead, edit the /etc/pcmcia/network.opts file to match your local
  739.   network setup.  The network and network.opts scripts will be executed
  740.   only when your ethernet card is actually present.
  741.  
  742.   The device address passed to network.opts consists of four comma-
  743.   separated fields: the scheme, the socket number, the device instance,
  744.   and the card's hardware ethernet address.  The device instance is used
  745.   to number devices for cards that have several network interfaces, so
  746.   it will usually be 0.  If you have several network cards used for
  747.   different purposes, one option would be to configure the cards based
  748.   on socket position, as in:
  749.  
  750.        case "$ADDRESS" in
  751.        *,0,*,*)
  752.            # definitions for network card in socket 0
  753.            ;;
  754.        *,1,*,*)
  755.            # definitions for network card in socket 1
  756.            ;;
  757.        esac
  758.  
  759.   Alternatively, they could be configured using their hardware
  760.   addresses, as in:
  761.  
  762.        case "$ADDRESS" in
  763.        *,*,*,00:80:C8:76:00:B1)
  764.            # definitions for a D-Link card
  765.            ;;
  766.        *,*,*,08:00:5A:44:80:01)
  767.            # definitions for an IBM card
  768.        esac
  769.  
  770.   To automatically mount and unmount NFS filesystems, first add all
  771.   these filesystems to /etc/fstab, but include noauto in the mount
  772.   options.  In network.opts, list the filesystem mount points in the
  773.   MOUNTS variable.  It is especially important to use either cardctl or
  774.   cardinfo to shut down a network card when NFS mounts are configured
  775.   this way.  It is not possible to cleanly unmount NFS filesystems if a
  776.   network card is simply ejected without warning.
  777.  
  778.   In addition to the usual network configuration parameters, the
  779.   network.opts script can specify extra actions to be taken after an
  780.   interface is configured, or before an interface is shut down.  If
  781.   network.opts defines a shell function called start_fn, it will be
  782.   invoked by the network script after the interface is configured, and
  783.   the interface name will be passed to the function as its first (and
  784.   only) argument.  Similarly, if it is defined, stop_fn will be invoked
  785.   before shutting down an interface.
  786.  
  787.   3.3.1.  Transceiver selection
  788.  
  789.   The transceiver type can be selected in network.opts using the IF_PORT
  790.   setting.  This can either be a numeric value as in previous PCMCIA
  791.   releases, or a keyword identifying the transceiver type.  All the
  792.   network drivers default to either autodetect the interface if
  793.   possible, or 10baseT otherwise.  The ifport command can be used to
  794.   check or set the current transceiver type.  For example:
  795.  
  796.        # ifport eth0 10base2
  797.        #
  798.        # ifport eth0
  799.        eth0    2 (10base2)
  800.  
  801.   Current releases of the 3c589 driver attempt to autodetect the network
  802.   connection, but this doesn't seem to be completely functional yet.
  803.   For autodetection to work, the network cable should be connected to
  804.   the card when the card is configured.  Alternatively, once the network
  805.   is connected, you can force the driver to check the connection with:
  806.  
  807.        ifconfig eth0 down up
  808.  
  809.   3.3.2.  Comments about specific cards
  810.  
  811.   ╖  With IBM CCAE and Socket EA cards, you need to pick the transceiver
  812.      type (10base2, 10baseT, AUI) when the network device is configured.
  813.      Make sure that the transceiver type reported in the system log
  814.      matches your connection.
  815.  
  816.   ╖  The drivers for SMC, Megahertz, Ositech, and 3Com cards should
  817.      autodetect the attached network type (10base2 or 10baseT).  Setting
  818.      the transceiver type when the driver is loaded serves to define the
  819.      card's ``first guess''.
  820.  
  821.   ╖  The Farallon EtherWave is actually based on the 3Com 3c589, with a
  822.      special transceiver.  Though the EtherWave uses 10baseT-style
  823.      connections, its transceiver requires that the 3c589 be configured
  824.      in 10base2 mode.
  825.  
  826.   ╖  If you have trouble with an IBM CCAE, NE4100, Thomas Conrad, or
  827.      Kingston adapter, try increasing the memory access time with the
  828.      mem_speed=# option to the pcnet_cs module.  An example of how to do
  829.      this is given in the standard config.opts file.  Try speeds of up
  830.      to 1000 (in nanoseconds).
  831.  
  832.   ╖  For the New Media Ethernet adapter, on some systems, it may be
  833.      necessary to increase the IO port access time with the io_speed=#
  834.      option when the pcmcia_core module is loaded.  Edit CORE_OPTS in
  835.      the startup script  to set this option.
  836.  
  837.   ╖  The multicast support in the New Media Ethernet driver is
  838.      incomplete.  The latest driver will function with multicast
  839.      kernels, but will ignore multicast packets.  Promiscuous mode
  840.      should work properly.
  841.  
  842.   ╖  The driver used by the IBM and 3Com token ring adapters seems to
  843.      behave very badly if the cards are not connected to a ring when
  844.      they get initialized.  Always connect these cards to the net before
  845.      they are powered up.  This driver also requires free IO ports in
  846.      the range of 0xa20-0xa27.  On some systems, the automatic IO port
  847.      conflict checker will incorrectly determine that this port range is
  848.      unavailable.  In that case, the port check can be disabled by
  849.      loading the pcmcia_core module with probe_io=0.
  850.  
  851.   ╖  Newer Linksys and D-Link cards have a unique way of selecting the
  852.      transceiver type that isn't handled by the Linux drivers.  One
  853.      workaround is to boot DOS and use the vendor-supplied utility to
  854.      select the transceiver, then warm boot Linux.  I am looking for
  855.      beta testers for a Linux utility to perform this function.
  856.  
  857.   ╖  For WaveLAN wireless network adapters, Jean Tourrilhes
  858.      (jt@hplb.hpl.hp.com) has put together a wireless HOWTO at
  859.      http://www-uk.hpl.hp.com/people/jt/Linux/Wavelan.html.
  860.  
  861.   3.3.3.  Diagnosing problems with network adapters
  862.  
  863.   ╖  Is your card recognized as an ethernet card?  Check the system log
  864.      and make sure that cardmgr identifies the card correctly and starts
  865.      up one of the network drivers.  If it doesn't, your card might
  866.      still be usable if it is compatible with a supported card.  This
  867.      will be most easily done if the card claims to be ``NE2000
  868.      compatible''.
  869.  
  870.   ╖  Is the card configured properly?  If you are using a supported
  871.      card, and it was recognized by cardmgr, but still doesn't work,
  872.      there might be an interrupt or port conflict with another device.
  873.      Find out what resources the card is using (from the system log),
  874.      and try excluding these in /etc/pcmcia/config.opts to force the
  875.      card to use something different.
  876.  
  877.   ╖  If your card seems to be configured properly, but sometimes locks
  878.      up, particularly under high load, you may need to try changing your
  879.      socket driver timing parameters.  See section ``2.3'' for more
  880.      information.
  881.  
  882.   ╖  If you get messages like ``network unreachable'' when you try to
  883.      access the network, then you have probably set up
  884.      /etc/pcmcia/network.opts incorrectly.  On the other hand, mis-
  885.      configured cards will usually fail silently.
  886.  
  887.   ╖  To diagnose problems in /etc/pcmcia/network.opts, start by trying
  888.      to ping other systems on the same subnet using their IP addresses.
  889.      Then try to ping your gateway, and then machines on other subnets.
  890.      Ping machines by name only after trying these simpler tests.
  891.  
  892.   ╖  Make sure your problem is really a PCMCIA one.  It may help to see
  893.      see if the card works under DOS with the vendor's drivers.  Double
  894.      check your modifications to the /etc/pcmcia/network.opts script.
  895.      Make sure your drop cable, ``T'' jack, terminator, etc are working.
  896.  
  897.   3.4.  PCMCIA serial and modem devices
  898.  
  899.   Linux serial devices are accessed via the /dev/cua* and /dev/ttyS*
  900.   special device files.  The ttyS* devices are for incoming connections,
  901.   such as directly connected terminals.  The cua* devices are for
  902.   outgoing connections, such as modems.  Each physical serial port has
  903.   both a ttyS and a cua device file: it is up to you to pick the
  904.   appropriate device for your application.  The configuration of a
  905.   serial device can be examined and modified with the setserial command.
  906.  
  907.   When a PCMCIA serial or modem card is detected, it will be assigned to
  908.   the first available serial device slot.  This will usually be
  909.   /dev/ttyS1 (cua1) or /dev/ttyS2 (cua2), depending on the number of
  910.   built-in serial ports.  The ttyS* device is the one reported in
  911.   /var/run/stab.  The default serial device option script,
  912.   /etc/pcmcia/serial.opts, will link the corresponding cua* device file
  913.   to /dev/modem as a convenience.
  914.  
  915.   Do not try to use /etc/rc.d/rc.serial to configure a PCMCIA modem.
  916.   This script should only be used to configure non-removable devices.
  917.   Modify /etc/pcmcia/serial.opts if you want to do anything special to
  918.   set up your modem.  Also, do not try to change the IO port and
  919.   interrupt settings of a PCMCIA serial device using setserial.  This
  920.   would tell the serial driver to look for the device in a different
  921.   place, but would not change how the card hardware is actually
  922.   configured.  The serial configuration script allows you to specify
  923.   other setserial options, as well as whether a line should be added to
  924.   /etc/inittab for this port.
  925.  
  926.   The device address passed to serial.opts has three comma-separated
  927.   fields: the first is the scheme, the second  is the socket number, and
  928.   the third is the device instance.  The device instance may take
  929.   several values for cards that support multiple serial ports, but for
  930.   single-port cards, it will always be 0.  If you commonly use more than
  931.   one PCMCIA modem, you may want to specify different settings based on
  932.   socket position, as in:
  933.  
  934.        case "$ADDRESS" in
  935.        *,0,*)
  936.            # Options for modem in socket 0
  937.            LINK=/dev/modem0
  938.            ;;
  939.        *,1,*)
  940.            # Options for modem in socket 1
  941.            LINK=/dev/modem1
  942.            ;;
  943.        esac
  944.  
  945.   If a PCMCIA modem is already configured when Linux boots, it may be
  946.   incorrectly identified as an ordinary built-in serial port.  This is
  947.   harmless, however, when the PCMCIA drivers take control of the modem,
  948.   it will be assigned a different device slot.  It is best to either
  949.   parse /var/run/stab or use /dev/modem, rather than expecting a PCMCIA
  950.   modem to always have the same device assignment.
  951.  
  952.   If you configure your kernel to load the basic Linux serial port
  953.   driver as a module, you must edit /etc/pcmcia/config to indicate that
  954.   this module must be loaded.  Edit the serial device entry to read:
  955.  
  956.   device "serial_cs"
  957.     class "serial" module "misc/serial", "serial_cs"
  958.  
  959.   3.4.1.  Diagnosing problems with serial devices
  960.  
  961.   ╖  Is your card recognized as a modem?  Check the system log and make
  962.      sure that cardmgr identifies the card correctly and starts up the
  963.      serial_cs driver.  If it doesn't, you may need to add a new entry
  964.      to your /etc/pcmcia/config file so that it will be identified
  965.      properly.  See section ``3.6'' for details.
  966.  
  967.   ╖  Is the modem configured successfully by serial_cs?  Again, check
  968.      the system log and look for messages from the serial_cs driver.  If
  969.      you see ``register_serial() failed'', you may have an I/O port
  970.      conflict with another device.  Another tip-off of a conflict is if
  971.      the device is reported to be an 8250; most modern PCMCIA modems
  972.      should be identified as 16550A UART's.  If you think you're seeing
  973.      a port conflict, edit /etc/pcmcia/config.opts and exclude the port
  974.      range that was allocated for the modem.
  975.  
  976.   ╖  Is there an interrupt conflict?  If the system log looks good, but
  977.      the modem just doesn't seem to work, try using setserial to change
  978.      the irq to 0, and see if the modem works.  This causes the serial
  979.      driver to use a slower polled mode instead of using interrupts.  If
  980.      this seems to fix the problem, it is likely that some other device
  981.      in your system is using the interrupt selected by serial_cs.  You
  982.      should add a line to /etc/pcmcia/config.opts to exclude this
  983.      interrupt.
  984.  
  985.   ╖  If the modem seems to work only very, very slowly, this is an
  986.      almost certain indicator of an interrupt conflict.
  987.  
  988.   ╖  Make sure your problem is really a PCMCIA one.  It may help to see
  989.      if the card works under DOS with the vendor's drivers.  Also, don't
  990.      test the card with something complex like SLIP or PPP until you are
  991.      sure you can make simple connections.  If simple things work but
  992.      SLIP does not, your problem is most likely with SLIP, not with
  993.      PCMCIA.
  994.  
  995.   ╖  If you get kernel messages indicating that the serial_cs module
  996.      cannot be loaded, it means that your kernel does not have serial
  997.      device support.  If you have compiled the serial driver as a
  998.      module, you must modify /etc/pcmcia/config to indicate that the
  999.      serial module should be loaded before serial_cs.
  1000.  
  1001.   3.5.  PCMCIA SCSI adapters
  1002.  
  1003.   All the currently supported PCMCIA SCSI cards are work-alikes of one
  1004.   of the following ISA bus cards: the Qlogic, the Adaptec AHA-152X, or
  1005.   the Future Domain TMC-16x0.  The PCMCIA drivers are built by linking
  1006.   some PCMCIA-specific code (in qlogic_cs.c, toaster_cs.c, or
  1007.   fdomain_cs.c) with the normal Linux SCSI driver.
  1008.  
  1009.   When a new SCSI host adapter is detected, the SCSI drivers will probe
  1010.   for devices.  Check the system log to make sure your devices are
  1011.   detected properly.  New SCSI devices will be assigned to the first
  1012.   available SCSI device files.  The first SCSI disk will be /dev/sda,
  1013.   the first SCSI tape will be /dev/st0, and the first CD-ROM will be
  1014.   /dev/scd0.
  1015.   With 1.3.X and later kernels, the PCMCIA core drivers are able to find
  1016.   out from the kernel which SCSI devices are connected to a card.  They
  1017.   will be listed in /var/run/stab, and the SCSI configuration script,
  1018.   /etc/pcmcia/scsi, will be called once for each attached device, to
  1019.   either configure or shut down that device.  The default script does
  1020.   not take any actions to configure SCSI devices, but will properly
  1021.   unmount filesystems on SCSI devices when a card is removed.
  1022.  
  1023.   With 1.2.X kernels, the PCMCIA drivers cannot automatically deduce
  1024.   which devices are associated with a particular SCSI adapter.  Instead,
  1025.   if you have one normal SCSI device configuration, you may list these
  1026.   devices in /etc/pcmcia/scsi.opts.  For example, if you normally have a
  1027.   SCSI disk and a CD-ROM, you would use:
  1028.  
  1029.        # For 1.2 kernels: list of attached devices
  1030.        SCSI_DEVICES="sda scd0"
  1031.  
  1032.   The device addresses passed to scsi.opts are complicated, because of
  1033.   the variety of things that can be attached to a SCSI adapter.
  1034.   Addresses consist of either six or seven comma-separated fields: the
  1035.   current scheme, the device type, the socket number, the SCSI channel,
  1036.   ID, and logical unit number, and optionally, the partition number.
  1037.   The device type will be ``sd'' for disks, ``st'' for tapes, ``sr'' for
  1038.   CD-ROM devices, and ``sg'' for generic SCSI devices.  For most setups,
  1039.   the SCSI channel and logical unit number will be 0.  For disk devices
  1040.   with several partitions, scsi.opts will first be called for the whole
  1041.   device, with a five-field address.  The script should set the PARTS
  1042.   variable to a list of partitions.  Then, scsi.opts will be called for
  1043.   each partition, with the longer seven-field addresses.  For example,
  1044.   here is a script for configuring a disk device at SCSI ID 3, with two
  1045.   partitions, and a CD-ROM at SCSI ID 6:
  1046.  
  1047.   case "$ADDRESS" in
  1048.   *,sd,*,0,3,0)
  1049.       # This device has two partitions...
  1050.       PARTS="1 2"
  1051.       ;;
  1052.   *,sd,*,0,3,0,1)
  1053.       # Options for partition 1:
  1054.       #  update /etc/fstab, and mount an ext2 fs on /usr1
  1055.       DO_FSTAB="y" ; DO_FSCK="y" ; DO_MOUNT="y"
  1056.       FSTYPE="ext2"
  1057.       OPTS=""
  1058.       MOUNTPT="/usr1"
  1059.       ;;
  1060.   *,sd,*,0,3,0,2)
  1061.       # Options for partition 2:
  1062.       #  update /etc/fstab, and mount an MS-DOS fs on /usr2
  1063.       DO_FSTAB="y" ; DO_FSCK="y" ; DO_MOUNT="y"
  1064.       FSTYPE="msdos"
  1065.       OPTS=""
  1066.       MOUNTPT="/usr2"
  1067.       ;;
  1068.   *,sr,*,0,6,0)
  1069.       # Options for CD-ROM at SCSI ID 6
  1070.       PARTS=""
  1071.       DO_FSTAB="y" ; DO_FSCK="n" ; DO_MOUNT="y"
  1072.       FSTYPE="iso9660"
  1073.       OPTS="ro"
  1074.       MOUNTPT="/cdrom"
  1075.       ;;
  1076.   esac
  1077.  
  1078.   If your kernel does not have a top-level driver (disk, tape, etc) for
  1079.   a particular SCSI device, then the device will not be configured by
  1080.   the PCMCIA drivers.  As a side effect, the device's name in
  1081.   /var/run/stab will be something like ``sd#nnnn'' where ``nnnn'' is a
  1082.   four-digit hex number.  This happens when cardmgr is unable to
  1083.   translate a SCSI device ID into a corresponding Linux device name.
  1084.  
  1085.   It is possible to modularize the top-level SCSI drivers so that they
  1086.   are only loaded when a PCMCIA SCSI adapter is detected.  To do so, you
  1087.   need to edit /etc/pcmcia/config to tell cardmgr which extra modules
  1088.   need to be loaded when your adapter is configured.  For example:
  1089.  
  1090.        device "aha152x_cs"
  1091.          class "scsi" module "scsi/scsi_mod", "scsi/sd_mod", "aha152x_cs"
  1092.  
  1093.   would say to load the core SCSI module and the top-level disk driver
  1094.   module before loading the regular PCMCIA driver module.  The PCMCIA
  1095.   Configure script will not automatically detect modularized SCSI
  1096.   modules, so you will need use the manual configure option to enable
  1097.   SCSI support.
  1098.  
  1099.   Always turn on SCSI devices before powering up your laptop, or before
  1100.   inserting the adapter card, so that the SCSI bus is properly
  1101.   terminated when the adapter is configured.  Also be very careful about
  1102.   ejecting a SCSI adapter.  Be sure that all associated SCSI devices are
  1103.   unmounted and closed before ejecting the card.  The best way to ensure
  1104.   this is to use either cardctl or cardinfo to request card removal
  1105.   before physically ejecting the card.  For now, all SCSI devices should
  1106.   be powered up before plugging in a SCSI adapter, and should stay
  1107.   connected until after you unplug the adapter and/or power down your
  1108.   laptop.
  1109.  
  1110.   There is a potential complication when using these cards that does not
  1111.   arise with ordinary ISA bus adapters.  The SCSI bus carries a
  1112.   ``termination power'' signal that is necessary for proper operation of
  1113.   ordinary passive SCSI terminators.  PCMCIA SCSI adapters do not supply
  1114.   termination power, so if it is required, an external device must
  1115.   supply it.  Some external SCSI devices may be configured to supply
  1116.   termination power.  Others, such as the Zip Drive and the Syquest EZ-
  1117.   Drive, use active terminators that do not depend on it.  In some
  1118.   cases, it may be necessary to use a special terminator block such as
  1119.   the APS SCSI Sentry 2, which has an external power supply.  When
  1120.   configuring your SCSI device chain, be aware of whether or not any of
  1121.   your devices require or can provide termination power.
  1122.  
  1123.   The Adaptec APA-460 SlimSCSI adapter is not supported.  This card was
  1124.   originally sold under the Trantor name, and when Adaptec merged with
  1125.   Trantor, they continued to sell the Trantor card with an Adaptec
  1126.   label.  The APA-460 is not compatible with any existing Linux driver.
  1127.   I'm not sure how hard it would be to write a driver; I don't think
  1128.   anyone has been able to obtain the technical information from Adaptec.
  1129.  
  1130.   The (unsupported) Trantor SlimSCSI can be identified by the following:
  1131.  
  1132.        Trantor / Adaptec APA-460 SlimSCSI
  1133.        FCC ID: IE8T460
  1134.        Shipped with SCSIworks! driver software
  1135.  
  1136.   The (supported) Adaptec SlimSCSI can be identified by the following:
  1137.  
  1138.        Adaptec APA-1460 SlimSCSI
  1139.        FCC ID: FGT1460
  1140.        P/N: 900100
  1141.        Shipped with EZ-SCSI driver software
  1142.  
  1143.   3.5.1.  Diagnosing problems with SCSI adapters
  1144.  
  1145.   ╖  With the aha152x_cs driver (used by Adaptec, New Media, and a few
  1146.      others), it seems that SCSI disconnect/reconnect support is a
  1147.      frequent source of trouble with tape drives.  To disable this
  1148.      ``feature,'' add the following to /etc/pcmcia/config.opts:
  1149.  
  1150.        module "aha152x_cs" opts "reconnect=0"
  1151.  
  1152.   ╖  If you have compiled SCSI support as modules (CONFIG_SCSI is
  1153.      ``m''), when configuring PCMCIA, you must explicitly specify that
  1154.      you want the SCSI drivers to be built.  You must also modify
  1155.      /etc/pcmcia/config to load the SCSI modules before the appropriate
  1156.      *_cs driver is loaded.
  1157.  
  1158.   3.6.  PCMCIA memory cards
  1159.  
  1160.   The memory_cs driver handles all types of memory cards, as well as
  1161.   providing direct access to the PCMCIA memory address space for cards
  1162.   that have other functions.  When loaded, it creates a combination of
  1163.   character and block devices.  See the man page for the module for a
  1164.   complete description of the device naming scheme.  Block devices are
  1165.   used for disk-like access (creating and mounting filesystems, etc).
  1166.   The character devices are for "raw" unbuffered reads and writes at
  1167.   arbitrary locations.
  1168.  
  1169.   The device address passed to memory.opts consists of two fields: the
  1170.   scheme, and the socket number.  The options are applied to the first
  1171.   common memory partition on the corresponding memory card.  Here is an
  1172.   example of a script that will automatically mount memory cards based
  1173.   on which socket they are inserted into:
  1174.  
  1175.        case "$ADDRESS" in
  1176.        *,0,0)
  1177.            # Mount filesystem, but don't update /etc/fstab
  1178.            DO_FSTAB="n" ; DO_FSCK="y" ; DO_MOUNT="y"
  1179.            FSTYPE="ext2" ; OPTS=""
  1180.            MOUNTPT="/mem0"
  1181.            ;;
  1182.        *,1,0)
  1183.            # Mount filesystem, but don't update /etc/fstab
  1184.            DO_FSTAB="n" ; DO_FSCK="y" ; DO_MOUNT="y"
  1185.            FSTYPE="ext2" ; OPTS=""
  1186.            MOUNTPT="/mem1"
  1187.            ;;
  1188.        esac
  1189.  
  1190.   Some older memory cards, and most simple static RAM cards, lack a
  1191.   ``Card Information Structure'' (CIS), which is the scheme PCMCIA cards
  1192.   use to identify themselves.  Normally, cardmgr will assume that any
  1193.   card that lacks a CIS is a simple memory card, and load the memory_cs
  1194.   driver.  Thus, a common side effect of a general card identification
  1195.   problem is that other types of cards may be misdetected as memory
  1196.   cards.
  1197.  
  1198.   The memory_cs driver uses a heuristic to guess the capacity of these
  1199.   cards.  The heuristic does not work for write protected cards, and may
  1200.   make mistakes in some other cases as well.  If a card is misdetected,
  1201.   its size should then be explicitly specified when using commands such
  1202.   as dd or mkfs.
  1203.  
  1204.   3.6.1.  Using flash memory cards
  1205.  
  1206.   The device address passed to ftl.opts consists of three or four
  1207.   fields: the scheme, the socket number, the region number, and
  1208.   optionally, the partition number.  Most flash cards have just one
  1209.   flash memory region, so the region number will generally always be
  1210.   zero.
  1211.  
  1212.   To use a flash memory card as an ordinary disk-like block device,
  1213.   first create a ``flash translation layer'' partition on the device
  1214.   with the ftl_format command:
  1215.  
  1216.        ftl_format -i /dev/mem0c0c
  1217.  
  1218.   Note that this command accesses the card through the ``raw'' memory
  1219.   card interface.  Once formatted, the card can be accessed as an
  1220.   ordinary block device via the ftl_cs driver.  For example:
  1221.  
  1222.        mke2fs /dev/ftl0c0
  1223.        mount -t ext2 /dev/ftl0c0 /mnt
  1224.  
  1225.   Device naming for FTL devices is tricky.  Minor device numbers have
  1226.   three parts: the card number, the region number on that card, and
  1227.   optionally, the partition within that region.  A region can either be
  1228.   treated as a single block device with no partition table (like a
  1229.   floppy), or it can be partitioned like a hard disk device.  The
  1230.   ``ftl0c0'' device is card 0, common memory region 0, the entire
  1231.   region.  The ``ftl0c0p1'' through ``ftl0c0p4'' devices are primary
  1232.   partitions 1 through 4 if the region has been partitioned.
  1233.  
  1234.   There are two major formats for flash memory cards: the ``flash
  1235.   translation layer'' style, and the Microsoft Flash File System.  The
  1236.   FTL format is generally more flexible because it allows any ordinary
  1237.   high-level filesystem (ext2, ms-dos, etc) to be used on a flash card
  1238.   as if it were an ordinary disk device.  The FFS is a completely
  1239.   different filesystem type.  Linux cannot currently handle cards
  1240.   formated with FFS.
  1241.  
  1242.   3.7.  PCMCIA ATA/IDE card drives
  1243.  
  1244.   ATA/IDE drive support requires a 1.3.72 or higher kernel.  The PCMCIA-
  1245.   specific part of the driver is fixed_cs.  Be sure to use cardctl or
  1246.   cardinfo to shut down an ATA/IDE card before ejecting it, as the
  1247.   driver has not been made ``hot-swap-proof''.
  1248.  
  1249.   The device addresses passed to fixed.opts consist of either three or
  1250.   four fields: the current scheme, the socket number, the drive's serial
  1251.   number, and an optional partition number.  As with SCSI devices,
  1252.   fixed.opts is first called for the entire device.  If fixed.opts
  1253.   returns a list of partitions in the PARTS variable, the script will
  1254.   then be called for each partition.
  1255.  
  1256.   Here is an example fixed.opts file to mount the first partition of any
  1257.   ATA/IDE card on /mnt.
  1258.  
  1259.   case "$ADDRESS" in
  1260.   *,*,*)
  1261.       PARTS="1"
  1262.       ;;
  1263.   *,*,*,1)
  1264.       DO_FSTAB="y" ; DO_FSCK="y" ; DO_MOUNT="y"
  1265.       FSTYPE="msdos"
  1266.       OPTS=""
  1267.       MOUNTPT="/mnt"
  1268.       ;;
  1269.   esac
  1270.  
  1271.   Note that the default fixed.opts file has these lines but they are
  1272.   commented out.  If you wish, you can have separate configurations for
  1273.   specific cards based on their serial numbers.  To find out a drive's
  1274.   serial number, use the ide_info utility.  Then, part of fixed.opts
  1275.   might look like:
  1276.  
  1277.        case "$ADDRESS" in
  1278.        *,*,Z4J60542)
  1279.            # This is my DOS stuff
  1280.            PARTS="1"
  1281.            ;;
  1282.        *,*,Z4J60542,1)
  1283.            DO_FSTAB="y" ; DO_FSCK="y" ; DO_MOUNT="y"
  1284.            FSTYPE="msdos"
  1285.            OPTS=""
  1286.            MOUNTPT="/mnt"
  1287.            ;;
  1288.        esac
  1289.  
  1290.   3.7.1.  Diagnosing problems with ATA/IDE adapters
  1291.  
  1292.   ╖  Some IDE drives violate the PCMCIA specification by requiring a
  1293.      longer time to spin up than the maximum allowed card setup time.
  1294.      To use these cards, load the pcmcia_core module with:
  1295.  
  1296.        CORE_OPTS="unreset_delay=400"
  1297.  
  1298.   ╖  To use an ATA/IDE CD-ROM device, your kernel must be compiled with
  1299.      CONFIG_BLK_DEV_IDECD enabled.  This will normally be the case for
  1300.      standard kernels, however it is something to be aware of if you
  1301.      compile a custom kernel.
  1302.  
  1303.   3.8.  Multifunction cards
  1304.  
  1305.   Starting with the 1.3.73 Linux kernel, a single interrupt can be
  1306.   shared by several drivers, such as the serial driver and an ethernet
  1307.   driver.  When using a multifunction card under a newer kernel, all
  1308.   card functions can be used without loading and unloading drivers.
  1309.  
  1310.   Simultaneous use of two card functions is ``tricky'' and various
  1311.   hardware vendors have implemented interrupt sharing in their own
  1312.   incompatible (and sometimes proprietary) ways.  The drivers for some
  1313.   cards (Ositech Jack of Diamonds, 3Com 3c562, Linksys) properly support
  1314.   simultaneous access, but others (Megahertz in particular) do not.
  1315.  
  1316.   Earlier kernels do not support interrupt sharing between different
  1317.   device drivers, so it is not possible for the PCMCIA drivers to
  1318.   configure this card for simultaneous ethernet and modem access.  The
  1319.   ethernet and serial drivers are both loaded automatically.  However,
  1320.   the ethernet driver ``owns'' the card interrupt by default.  To use
  1321.   the modem, you can unload the ethernet driver and reconfigure the
  1322.   serial port by doing something like:
  1323.  
  1324.        ifconfig eth0 down
  1325.        rmmod 3c589_cs
  1326.        setserial /dev/modem autoconfig auto_irq
  1327.        setserial /dev/modem
  1328.  
  1329.   The second setserial should verify that the port has been configured
  1330.   to use the interrupt previously used by the ethernet driver.
  1331.  
  1332.   3.9.  When is it safe to insert or eject a PCMCIA card?
  1333.  
  1334.   In theory, you can insert and remove PCMCIA cards at any time.
  1335.   However, it is a good idea not to eject a card that is currently being
  1336.   used by an application program.  Kernels older than 1.1.77 would often
  1337.   lock up when serial/modem cards were ejected, but this should be fixed
  1338.   now.
  1339.  
  1340.   3.10.  Card Services and Advanced Power Management
  1341.  
  1342.   Card Services can be compiled with support for APM (Advanced Power
  1343.   Management) if you've installed this package on your system.  APM is
  1344.   incorporated into 1.3.46 and later kernels.  It is currently being
  1345.   maintained by Rick Faith (faith@cs.unc.edu), and APM tools can be
  1346.   obtained from ftp.cs.unc.edu in /pub/users/faith/linux.  The PCMCIA
  1347.   modules will automatically be configured for APM if a compatible
  1348.   version is detected on your system.
  1349.  
  1350.   Without resorting to APM, you can do ``cardctl suspend'' before
  1351.   suspending your laptop, and ``cardctl resume'' after resuming, to
  1352.   properly shut down and restart your PCMCIA cards.  This will not work
  1353.   with a PCMCIA modem that is in use, because the serial driver isn't
  1354.   able to save and restore the modem operating parameters.
  1355.  
  1356.   APM seems to be unstable on some systems.  If you experience trouble
  1357.   with APM and PCMCIA on your system, try to narrow down the problem to
  1358.   one package or the other before reporting a bug.
  1359.  
  1360.   Some drivers, notably the PCMCIA SCSI drivers, cannot recover from a
  1361.   suspend/resume cycle.  When using a PCMCIA SCSI card, use ``cardctl
  1362.   eject'' prior to suspending the system.
  1363.  
  1364.   3.11.  How do I turn off a PCMCIA card without ejecting it?
  1365.  
  1366.   Use either the cardctl or cardinfo command.  ``cardctl suspend #''
  1367.   will suspend one socket, and turn off its power.  The corresponding
  1368.   resume command will wake up the card in its previous state.
  1369.  
  1370.   3.12.  How do I unload the PCMCIA drivers?
  1371.  
  1372.   To unload the entire PCMCIA package, invoke rc.pcmcia with:
  1373.  
  1374.        /etc/rc.d/rc.pcmcia stop
  1375.  
  1376.   This script will take several seconds to run, to give all client
  1377.   drivers time to shut down gracefully.  If a PCMCIA device is currently
  1378.   in use, the shutdown will be incomplete, and some kernel modules may
  1379.   not be unloaded.  To avoid this, use ``cardctl eject'' to shut down
  1380.   all sockets before invoking rc.pcmcia.  The exit status of the cardctl
  1381.   command will indicate if any sockets could not be shut down.
  1382.  
  1383.   4.  Advanced topics
  1384.  
  1385.   4.1.  Resource allocation for PCMCIA devices
  1386.  
  1387.   In theory, it should not really matter which interrupt is allocated to
  1388.   which device, as long as two devices are not configured to use the
  1389.   same interrupt.  In /etc/pcmcia/config.opts you'll find a place for
  1390.   excluding interrupts that are used by non-PCMCIA devices.
  1391.  
  1392.   Similarly, there is no way to directly specify the I/O addresses for a
  1393.   PCMCIA card to use.  The /etc/pcmcia/config.opts file allows you to
  1394.   specify ranges of ports available for use by all PCMCIA devices, or to
  1395.   exclude ranges that conflict with other devices.
  1396.  
  1397.   After modifying /etc/pcmcia/config.opts, you can restart cardmgr with
  1398.   ``kill -HUP''.
  1399.  
  1400.   The interrupt used to monitor card status changes is chosen by the
  1401.   low-level socket driver module (i82365 or tcic) before cardmgr parses
  1402.   /etc/pcmcia/config, so it is not affected by changes to this file.  To
  1403.   set this interrupt, use the cs_irq= option when the socket driver is
  1404.   loaded, by setting the PCIC_OPTS variable in /etc/rc.d/rc.pcmcia.
  1405.  
  1406.   All the client card drivers have a parameter called irq_list for
  1407.   specifying which interrupts they may try to allocate.  These driver
  1408.   options should be set in your /etc/pcmcia/config file.  For example:
  1409.  
  1410.        device "serial_cs"
  1411.          module "serial_cs" opts "irq_list=8,12"
  1412.          ...
  1413.  
  1414.   would specify that the serial driver should only use irq 8 or irq 12.
  1415.   Regardless of irq_list settings, Card Services will never allocate an
  1416.   interrupt that is already in use by another device, or an interrupt
  1417.   that is excluded in the config file.
  1418.  
  1419.   4.2.  How can I have separate device setups for home and work?
  1420.  
  1421.   This is fairly easy using PCMCIA ``scheme'' support.  Use two
  1422.   configuration schemes, called ``home'' and ``work''.  Here is an
  1423.   example of a network.opts script with scheme-specific settings:
  1424.  
  1425.        case "$ADDRESS" in
  1426.        work,*,*,*)
  1427.            # definitions for network card in work scheme
  1428.            ...
  1429.            ;;
  1430.        home,*,*,*|default,*,*,*)
  1431.            # definitions for network card in home scheme
  1432.            ...
  1433.            ;;
  1434.        esac
  1435.  
  1436.   The first part of a PCMCIA device address is always the configuration
  1437.   scheme.  In this example, the second ``case'' clause will select for
  1438.   both the ``home'' and ``default'' schemes.  So, if the scheme is unset
  1439.   for any reason, it will default to the ``home'' setup.
  1440.  
  1441.   Now, to choose between the two sets of settings, run either:
  1442.  
  1443.        cardctl scheme home
  1444.  
  1445.   or
  1446.  
  1447.        cardctl scheme work
  1448.  
  1449.   The cardctl command does the equivalent of shutting down all your
  1450.   cards and restarting them.  The command can be safely executed whether
  1451.   or not the PCMCIA system is loaded, but the command may fail if you
  1452.   are using other PCMCIA devices at the time (even if their
  1453.   configurations are not explicitly dependant on the scheme setting).
  1454.  
  1455.   To find out the current PCMCIA scheme setting, run:
  1456.  
  1457.        cardctl scheme
  1458.  
  1459.   4.3.  Booting from a PCMCIA device
  1460.  
  1461.   Having the root filesystem on a PCMCIA device is tricky because the
  1462.   Linux PCMCIA system is not designed to be linked into the kernel.  Its
  1463.   core components, the loadable kernel modules and the user mode cardmgr
  1464.   daemon, depend on an already running system.  The kernel's ``initrd''
  1465.   facility works around this requirement by allowing Linux to boot using
  1466.   a temporary ram disk as a minimal root image, load drivers, and then
  1467.   re-mount a different root filesystem.  The temporary root can
  1468.   configure PCMCIA devices and then re-mount a PCMCIA device as root.
  1469.  
  1470.   Some Linux distributions will allow installation to a device connected
  1471.   to a PCMCIA SCSI adapter, as an unintended side-effect of their
  1472.   support for installs from PCMCIA SCSI CD-ROM devices.  However, at
  1473.   present, no Linux installation tools support configuring an
  1474.   appropriate ``initrd'' to boot Linux with a PCMCIA root filesystem.
  1475.   Setting up a system with a PCMCIA root thus requires that you use
  1476.   another Linux system to create the ``initrd'' image.  If another Linux
  1477.   system is not available, another option would be to temporarily
  1478.   install a minimal Linux setup on a non-PCMCIA drive, create an initrd
  1479.   image, and then reinstall to the PCMCIA target.
  1480.  
  1481.   The Linux Bootdisk-HOWTO has some general information about setting up
  1482.   boot disks but nothing specific to initrd.  The main initrd document
  1483.   is included with recent kernel source code distributions, in
  1484.   linux/Documentation/initrd.txt.  Before beginning, you should read
  1485.   this document.  A familiarity with lilo is also helpful.  Using initrd
  1486.   also requires that you have a kernel compiled with CONFIG_BLK_DEV_RAM
  1487.   and CONFIG_BLK_DEV_INITRD enabled.
  1488.  
  1489.   4.3.1.  The pcinitrd helper script
  1490.  
  1491.   The pcinitrd script creates a basic initrd image for booting with a
  1492.   PCMCIA root partition.  The image includes a minimal directory
  1493.   heirarchy, a handful of device files, a few binaries, shared
  1494.   libraries, and a set of PCMCIA driver modules.  When invoking
  1495.   pcinitrd, you specify the driver modules that you want to be included
  1496.   in the image.  The core PCMCIA components, pcmcia_core and ds, are
  1497.   automatically included.
  1498.  
  1499.   As an example, say that your laptop uses an i82365-compatible PCMCIA
  1500.   host controller, and you want to boot Linux with the root filesystem
  1501.   on a hard drive attached to an Adaptec SlimSCSI adapter.  You could
  1502.   create an appropriate initrd image with:
  1503.  
  1504.        pcinitrd -v initrd pcmcia/i82365.o pcmcia/aha152x_cs.o
  1505.  
  1506.   To customize the initrd startup sequence, you could mount the image
  1507.   using the ``loopback'' device with a command like:
  1508.  
  1509.        mount -o loop -t ext2 initrd /mnt
  1510.  
  1511.   and then edit the linuxrc script.  The PCMCIA configuration files will
  1512.   be installed under /etc in the image, and can also be customized.  See
  1513.   the man page for pcinitrd for more information.
  1514.  
  1515.   4.3.2.  Creating an initrd boot floppy
  1516.  
  1517.   After creating an image with pcinitrd, you can create a boot floppy by
  1518.   copying the kernel, the compressed initrd image, and a few support
  1519.   files for lilo to a clean floppy.  In the following example, we assume
  1520.   that the desired PCMCIA root device is /dev/sda1:
  1521.  
  1522.        mke2fs /dev/fd0
  1523.        mount /dev/fd0 /mnt
  1524.        mkdir /mnt/etc /mnt/boot /mnt/dev
  1525.        cp -a /dev/fd0 /dev/sda1 /mnt/dev
  1526.        cp [kernel-image] /mnt/vmlinuz
  1527.        gzip < [initrd-image] > /mnt/initrd
  1528.  
  1529.   Create /mnt/etc/lilo.conf with the contents:
  1530.  
  1531.        boot=/dev/fd0
  1532.        compact
  1533.        image=/vmlinuz
  1534.            label=linux
  1535.            initrd=/initrd
  1536.            read-only
  1537.            root=/dev/sda1
  1538.  
  1539.   Finally, invoke lilo with:
  1540.  
  1541.        lilo -r /mnt
  1542.  
  1543.   When lilo is invoked with -r, it performs all actions relative to the
  1544.   specified alternate root directory.  The reason for creating the
  1545.   device files under /mnt/dev was that lilo will not be able to use the
  1546.   files in /dev when it is running in this alternate-root mode.
  1547.  
  1548.   4.3.3.  Installing an initrd image on a non-Linux drive
  1549.  
  1550.   One common use of the initrd facility would be on systems where the
  1551.   internal hard drive is dedicated to another operating system.  The
  1552.   Linux kernel and initrd image can be placed in a non-Linux partition,
  1553.   and lilo or LOADLIN can be set up to boot Linux from these images.
  1554.  
  1555.   Assuming that you have a kernel has been configured for the
  1556.   appropriate root device, and an initrd image created on another
  1557.   system, the easiest way to get started is to boot Linux using LOADLIN,
  1558.   as:
  1559.  
  1560.        LOADLIN <kernel> initrd=<initrd-image>
  1561.  
  1562.   Once you can boot Linux on your target machine, you could then install
  1563.   lilo to allow booting Linux directly.  For example, say that /dev/hda1
  1564.   is the non-Linux target partition and /mnt can be used as a mount
  1565.   point.  First, create a subdirectory on the target for the Linux
  1566.   files:
  1567.  
  1568.        mount /dev/hda1 /mnt
  1569.        mkdir /mnt/linux
  1570.        cp [kernel-image] /mnt/linux/vmlinuz
  1571.        cp [initrd-image] /mnt/linux/initrd
  1572.  
  1573.   In this example, say that /dev/sda1 is the desired Linux root
  1574.   partition, a SCSI hard drive mounted via a PCMCIA SCSI adapter.  To
  1575.   install lilo, create a lilo.conf file with the contents:
  1576.  
  1577.        boot=/dev/hda
  1578.        map=/mnt/linux/map
  1579.        compact
  1580.        image=/mnt/linux/vmlinuz
  1581.                label=linux
  1582.                root=/dev/sda1
  1583.                initrd=/mnt/linux/initrd
  1584.                read-only
  1585.        other=/dev/hda1
  1586.                table=/dev/hda
  1587.                label=windows
  1588.  
  1589.   The boot= line says to install the boot loader in the master boot
  1590.   record of the specified device.  The root= line identifies the desired
  1591.   root filesystem to be used after loading the initrd image, and may be
  1592.   unnecessary if the kernel image is already configured this way.  The
  1593.   other= section is used to describe the other operating system
  1594.   installed on /dev/hda1.
  1595.  
  1596.   To install lilo in this case, use:
  1597.  
  1598.        lilo -C lilo.conf
  1599.  
  1600.   Note that in this case, the lilo.conf file uses absolute paths that
  1601.   include /mnt.  I did this in the example because the target filesystem
  1602.   may not support the creation of Linux device files for the boot= and
  1603.   root= options.
  1604.  
  1605.   5.  Dealing with unsupported cards
  1606.  
  1607.   5.1.  Configuring unrecognized cards
  1608.  
  1609.   Assuming that your card is supported by an existing driver, all that
  1610.   needs to be done is to add an entry to /etc/pcmcia/config to tell
  1611.   cardmgr how to identify the card, and which driver(s) need to be
  1612.   linked up to this card.  Check the man page for pcmcia for more
  1613.   information about the config file format.  If you insert an unknown
  1614.   card, cardmgr will normally record some identification information in
  1615.   the system log that can be used to construct the config entry.
  1616.  
  1617.   Here is an example of how cardmgr will report an unsupported card in
  1618.   /usr/adm/messages.
  1619.  
  1620.        cardmgr[460]: unsupported card in socket 1
  1621.        cardmgr[460]: version info: "MEGAHERTZ", "XJ2288", "V.34 PCMCIA MODEM"
  1622.  
  1623.   The corresponding entry in /etc/pcmcia/config would be:
  1624.  
  1625.        card "Megahertz XJ2288 V.34 Fax Modem"
  1626.          version "MEGAHERTZ", "XJ2288", "V.34 PCMCIA MODEM"
  1627.          bind "serial_cs"
  1628.  
  1629.   You can use ``*'' to match strings that don't need to match exactly,
  1630.   like version numbers.  When making new config entries, be careful to
  1631.   copy the strings exactly, preserving case and blank spaces.  Also be
  1632.   sure that the config entry has the same number of strings as are
  1633.   reported in the log file.
  1634.  
  1635.   After editing /etc/pcmcia/config, you can signal cardmgr to reload the
  1636.   file with:
  1637.  
  1638.        kill -HUP `cat /var/run/cardmgr.pid`
  1639.  
  1640.   If you do set up an entry for a new card, please send me a copy so
  1641.   that I can include it in the standard config file.
  1642.  
  1643.   5.2.  Adding support for an NE2000-compatible ethernet card
  1644.  
  1645.   First, see if the card is already recognized by cardmgr.  Some cards
  1646.   not listed in SUPPORTED.CARDS are actually OEM versions of cards that
  1647.   are supported.  If you find a card like this, let me know so I can add
  1648.   it to the list.
  1649.  
  1650.   If your card is not recognized, follow the instructions in section
  1651.   ``3.6'' to create a config entry for your card, and bind the card to
  1652.   the pcnet_cs driver.  Restart cardmgr to use the updated config file.
  1653.  
  1654.   If the pcnet_cs driver says that it is unable to determine your card's
  1655.   hardware ethernet address, then edit your new config entry to bind the
  1656.   card to the memory card driver, memory_cs.  Restart cardmgr to use the
  1657.   new updated config file.  You will need to know your card's hardware
  1658.   ethernet address.  This address is a series of six two-digit hex
  1659.   numbers, often printed on the card itself.  If it is not printed on
  1660.   the card, you may be able to use a DOS driver to display the address.
  1661.   In any case, once you know it, run:
  1662.  
  1663.        dd if=/dev/mem0a count=20 | od -Ax -t x1
  1664.  
  1665.   and search the output for your address.  Only the even bytes are
  1666.   defined, so ignore the odd bytes in the dump.  Record the hex offset
  1667.   of the first byte of the address.  Now, edit modules/pcnet_cs.c and
  1668.   find the hw_info structure.  You'll need to create a new entry for
  1669.   your card.  The first field is the memory offset.  The next three
  1670.   fields are the first three bytes of the hardware address.  The final
  1671.   field contains some flags for specific card features; to start, try
  1672.   setting it to 0.
  1673.  
  1674.   After editing pcnet_cs.c, compile and install the new module.  Edit
  1675.   /etc/pcmcia/config again, and change the card binding from memory_cs
  1676.   to pcnet_cs.  Follow the instructions for reloading the config file,
  1677.   and you should be all set.  Please send me copies of your new hw_info
  1678.   and config entries.
  1679.  
  1680.   If you can't find your card's hardware address in the hex dump, as a
  1681.   method of last resort, it is possible to ``hard-wire'' the address
  1682.   when the pcnet_cs module is initialized.  Edit /etc/pcmcia/config and
  1683.   add a hw_addr= option, like so:
  1684.  
  1685.        module "pcnet_cs" opts "hw_addr=0x00,0x80,0xc8,0x01,0x02,0x03"
  1686.  
  1687.   Substitute your own card's hardware address in the appropriate spot,
  1688.   of course.
  1689.  
  1690.   5.3.  PCMCIA floppy interface cards
  1691.  
  1692.   The PCMCIA floppy interface used in the Compaq Aero and a few other
  1693.   laptops is not yet supported by this package.  The snag in supporting
  1694.   the Aero floppy is that the Aero seems to use a customized PCMCIA
  1695.   controller to support DMA to the floppy.  Without knowing exactly how
  1696.   this is done, there isn't any way to implement support under Linux.
  1697.  
  1698.   If the floppy adapter card is present when an Aero is booted, the Aero
  1699.   BIOS will configure the card, and Linux will identify it as a normal
  1700.   floppy drive.  When the Linux PCMCIA drivers are loaded, they will
  1701.   notice that the card is already configured and attached to a Linux
  1702.   driver, and this socket will be left alone.  So, the drive can be used
  1703.   if it is present at boot time, but the card is not hot swappable.
  1704.  
  1705.   5.4.  What's up with support for Xircom cards?
  1706.  
  1707.   A driver for Xircom ethernet and ethernet/modem cards is included in
  1708.   the current PCMCIA package, thanks to the work of Werner Koch.  I've
  1709.   set up a HyperNews forum specifically for discussion of Xircom driver
  1710.   development, at
  1711.   http://hyper.stanford.edu/HyperNews/get/pcmcia/xircom.html.
  1712.  
  1713.   For a long time, Xircom cards were not supported because Xircom had a
  1714.   company policy of not disclosing technical information about their
  1715.   cards.  However, they have relaxed their rules, and now, they do
  1716.   distribute driver information.
  1717.  
  1718.   6.  Debugging tips and programming information
  1719.  
  1720.   6.1.  How can I submit a helpful bug report?
  1721.  
  1722.   The best way to submit bug reports is to use the HyperNews message
  1723.   lists on the Linux PCMCIA information site.  That way, other people
  1724.   can see current problems (and fixes or workarounds, if available).
  1725.   Here are some things that should be included in all bug reports:
  1726.  
  1727.   ╖  Your system type, and the output of the probe command.
  1728.  
  1729.   ╖  What PCMCIA cards you are using.
  1730.  
  1731.   ╖  Your Linux kernel version, and PCMCIA driver version.
  1732.  
  1733.   ╖  Any changes you've made to the startup files in /etc/pcmcia, or to
  1734.      the PCMCIA startup script.
  1735.  
  1736.   ╖  All PCMCIA-related messages in your system log file.
  1737.  
  1738.   Before submitting a bug report, please check to make sure that you are
  1739.   using an up-to-date copy of the driver package.  While it is somewhat
  1740.   gratifying to read bug reports for things I've already fixed, it isn't
  1741.   a particularly constructive use of my time.
  1742.  
  1743.   If your problem involves a kernel fault, the register dump from the
  1744.   fault is only useful if you can track down the fault address, EIP.  If
  1745.   it is in the main kernel, look up the address in System.map to
  1746.   identify the function at fault.  If the fault is in a loadable module,
  1747.   it is a bit harder to trace.  With the current module tools, ``ksyms
  1748.   -m'' will report the base address of each loadable module.  Pick the
  1749.   module that contains the EIP address, and subtract its base address
  1750.   from EIP to get an offset inside that module.  Then, run gdb on that
  1751.   module, and look up the offset with the list command.  This will only
  1752.   work if you've compiled that module with -g to include debugging
  1753.   information.
  1754.  
  1755.   If you do not have web access, bug reports can be sent to me at
  1756.   dhinds@hyper.stanford.edu.  However, I prefer that bug reports be
  1757.   posted to my web site, so that they can be seen by others.
  1758.  
  1759.   6.2.  Low level PCMCIA debugging aids
  1760.  
  1761.   The PCMCIA modules contain a lot of conditionally-compiled debugging
  1762.   code.  Most of this code is under control of the PCMCIA_DEBUG
  1763.   preprocessor define.  If this is undefined, debugging code will not be
  1764.   compiled.  If set to 0, the code is compiled but inactive.  Larger
  1765.   numbers specify increasing levels of verbosity.  Each module built
  1766.   with PCMCIA_DEBUG defined will have an integer parameter, pc_debug,
  1767.   that controls the verbosity of its output.  This can be adjusted when
  1768.   the module is loaded, so output can be controlled on a per-module
  1769.   basis without recompiling.
  1770.  
  1771.   There are a few debugging tools in the debug_tools/ subdirectory of
  1772.   the PCMCIA distribution.  The dump_tcic and dump_i365 utilities
  1773.   generate complete register dumps of the PCMCIA controllers, and decode
  1774.   a lot of the register information.  They are most useful if you have
  1775.   access to a datasheet for the corresponding controller chip.  The
  1776.   dump_tuples utility lists a card's CIS (Card Information Structure),
  1777.   and decodes some of the important bits.  And the dump_cisreg utility
  1778.   displays a card's local configuration registers.
  1779.  
  1780.   The memory_cs memory card driver is also sometimes useful for
  1781.   debugging.  It can be bound to any PCMCIA card, and does not interfere
  1782.   with other drivers.  It can be used to directly access any card's
  1783.   attribute memory or common memory.
  1784.  
  1785.   6.3.  How do I write a Card Services driver for a new card?
  1786.  
  1787.   The Linux PCMCIA Programmer's Guide is the best documentation for the
  1788.   Linux PCMCIA interface.  The latest version is always available from
  1789.   hyper.stanford.edu in /pub/pcmcia/doc, or on the web at
  1790.   http://hyper.stanford.edu/HyperNews/get/pcmcia/home.html.
  1791.  
  1792.   For devices that are close relatives of normal ISA devices, you'll
  1793.   probably be able to use parts of existing Linux drivers.  In some
  1794.   cases, the biggest stumbling block will be modifying an existing
  1795.   driver so that it can handle adding and removing devices after boot
  1796.   time.  Of the current drivers, the memory card driver is the only
  1797.   ``self-contained'' driver that does not depend on other parts of the
  1798.   Linux kernel to do most of the dirty work.
  1799.  
  1800.   I've written a skeleton driver with lots of comments that explains a
  1801.   lot of how a driver communicates with Card Services; you'll find this
  1802.   in the PCMCIA source distribution in modules/skeleton.c.
  1803.  
  1804.   6.4.  Guidelines for PCMCIA client driver authors
  1805.  
  1806.   I have decided that it is not really feasible for me to distribute all
  1807.   PCMCIA client drivers as part of the PCMCIA package.  Each new driver
  1808.   makes the main package incrementally harder to maintain, and including
  1809.   a driver inevitably transfers some of the maintenance work from the
  1810.   driver author to me.  Instead, I will decide on a case by case basis
  1811.   whether or not to include contributed drivers, based on user demand as
  1812.   well as maintainability.  For drivers not included in the core
  1813.   package, I suggest that driver authors adopt the following scheme for
  1814.   packaging their drivers for distribution.
  1815.  
  1816.   Driver files should be arranged in the same directory scheme used in
  1817.   the PCMCIA source distribution, so that the driver can be unpacked on
  1818.   top of a complete PCMCIA source tree.  A driver should include source
  1819.   files (in ./modules/), a man page (in ./man/), and configuration files
  1820.   (in ./etc/).  The top level directory should also include a README
  1821.   file.
  1822.  
  1823.   The top-level directory should include a makefile, set up so that
  1824.   ``make -f ... all'' and ``make -f ... install'' compile the driver and
  1825.   install all appropriate files.  If this makefile is given an extension
  1826.   of .mk, then it will automatically be invoked by the top-level
  1827.   Makefile for the all and install targets.  Here is an example of how
  1828.   such a makefile could be constructed:
  1829.  
  1830.   # Sample Makefile for contributed client driver
  1831.   FILES = sample_cs.mk README.sample_cs \
  1832.           modules/sample_cs.c modules/sample_cs.h \
  1833.           etc/sample etc/sample.opts man/sample_cs.4
  1834.   all:
  1835.           $(MAKE) -C modules MODULES=sample_cs.o
  1836.   install:
  1837.           $(MAKE) -C modules install-modules MODULES=sample_cs.o
  1838.           $(MAKE) -C etc install-clients CLIENTS=sample
  1839.           $(MAKE) -C man install-man4 MAN4=sample_cs.4
  1840.   dist:
  1841.           tar czvf sample_cs.tar.gz $(FILES)
  1842.  
  1843.   This makefile uses install targets defined in 2.9.10 and later
  1844.   versions of the PCMCIA package.  This makefile also includes a
  1845.   ``dist'' target for the convenience of the driver author.  You would
  1846.   probably want to add a version number to the final package filename
  1847.   (for example, sample_cs-1.5.tar.gz).  A complete distribution could
  1848.   look like:
  1849.  
  1850.        sample_cs.mk
  1851.        README.sample_cs
  1852.        modules/sample_cs.c
  1853.        modules/sample_cs.h
  1854.        etc/sample
  1855.        etc/sample.opts
  1856.        man/sample_cs.4
  1857.  
  1858.   With this arrangement, when the contributed driver is unpacked, it
  1859.   becomes essentially part of the PCMCIA source tree.  It can make use
  1860.   of the PCMCIA header files, as well as the machinery for checking the
  1861.   user's system configuration, and automatic dependency checking, just
  1862.   like a ``normal'' client driver.
  1863.  
  1864.   I will accept client drivers prepared according to this specification
  1865.   and place them in the /pub/pcmcia/contrib directory on my FTP server,
  1866.   hyper.stanford.edu.  The README in this directory will describe how to
  1867.   unpack a contributed driver.
  1868.  
  1869.   The PCMCIA client driver interface has not changed much over time, and
  1870.   has almost always preserved backwards compatibility.  A client driver
  1871.   will not normally need to be updated for minor revisions in the main
  1872.   PCMCIA package.  I will try to notify authors of contributed drivers
  1873.   of changes that require updates to their drivers.
  1874.  
  1875.   6.5.  Guidelines for Linux distribution maintainers
  1876.  
  1877.   If your distribution has system configuration tools that you would
  1878.   like to be PCMCIA-aware, please use the *.opts files in /etc/pcmcia
  1879.   for your ``hooks.''  These files will not be modified if a user
  1880.   compiles and installs a new release of the PCMCIA package.  If you
  1881.   modify the main configuration scripts, then a fresh PCMCIA install
  1882.   will silently overwrite your custom scripts and break the connection
  1883.   with your configuration tools.  Contact me if you are not sure how to
  1884.   write an appropriate option script.
  1885.  
  1886.   When building PCMCIA for distribution, you should consider including
  1887.   contributed drivers that are not part of the main PCMCIA package.  For
  1888.   reasons of maintainability, I am trying to limit the core package
  1889.   size, by only adding new drivers if I think they are of particularly
  1890.   broad interest.  Other drivers will be distributed separately, as
  1891.   described in the previous section.  The split between integral and
  1892.   separate drivers is somewhat arbitrary and partly historical, and
  1893.   should not imply a difference in quality.
  1894.  
  1895.