home *** CD-ROM | disk | FTP | other *** search
/ Freelog Special Edition 1: Linux / CD1.iso / doc / HOWTO / PCMCIA-HOWTO < prev    next >
Text File  |  1998-10-14  |  118KB  |  3,103 lines

  1.   Linux PCMCIA HOWTO
  2.   David Hinds, dhinds@hyper.stanford.edu.
  3.   v2.21, 13 August 1998
  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 <ftp://hyper.stan¡
  8.   ford.edu/pub/pcmcia/doc>.  An HTML version is at <http://hyper.stan¡
  9.   ford.edu/HyperNews/get/pcmcia/home.html>.
  10.   ______________________________________________________________________
  11.  
  12.   Table of Contents
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.   1. General information and hardware requirements
  68.  
  69.      1.1 Introduction
  70.      1.2 Copyright notice and disclaimer
  71.      1.3 What is the latest version, and where can I get it?
  72.      1.4 What systems are supported?
  73.      1.5 What cards are supported?
  74.      1.6 When will my new card be supported?
  75.      1.7 Mailing lists and other information sources
  76.      1.8 Why don't you distribute binaries?
  77.      1.9 Why is the package so darned big?
  78.  
  79.   2. Compilation and installation
  80.  
  81.      2.1 Prerequisites and kernel setup
  82.      2.2 Installation
  83.      2.3 Startup options
  84.      2.4 System resource settings
  85.      2.5 Notes about specific Linux distributions
  86.         2.5.1 Debian
  87.         2.5.2 Red Hat, and Caldera Open Desktop
  88.         2.5.3 Slackware
  89.         2.5.4 SuSE
  90.  
  91.   3. Resolving installation and configuration problems
  92.  
  93.      3.1 Base PCMCIA kernel modules do not load
  94.      3.2 Some client driver modules do not load
  95.      3.3 Interrupt scan failures
  96.      3.4 IO port scan failures
  97.      3.5 Memory probe failures
  98.      3.6 Failure to detect card insertions and removals
  99.      3.7 System resource starvation
  100.      3.8 Resource conflict between two cards
  101.      3.9 Device configuration does not complete
  102.  
  103.   4. Usage and features
  104.  
  105.      4.1 Tools for configuring and monitoring PCMCIA devices
  106.         4.1.1 The cardmgr configuration daemon
  107.         4.1.2 The cardctl and cardinfo utilities
  108.         4.1.3 Inserting and ejecting cards
  109.         4.1.4 Card Services and Advanced Power Management
  110.         4.1.5 Shutting down the PCMCIA system
  111.      4.2 Overview of the PCMCIA configuration scripts
  112.      4.3 PCMCIA network adapters
  113.         4.3.1 Network device parameters
  114.         4.3.2 Comments about specific cards
  115.         4.3.3 Diagnosing problems with network adapters
  116.      4.4 PCMCIA serial and modem devices
  117.         4.4.1 Serial device parameters
  118.         4.4.2 Diagnosing problems with serial devices
  119.      4.5 PCMCIA SCSI adapters
  120.         4.5.1 SCSI device parameters
  121.         4.5.2 Comments about specific cards
  122.         4.5.3 Diagnosing problems with SCSI adapters
  123.      4.6 PCMCIA memory cards
  124.         4.6.1 Memory device parameters
  125.         4.6.2 Using flash memory cards
  126.      4.7 PCMCIA ATA/IDE card drives
  127.         4.7.1 ATA/IDE fixed-disk device parameters
  128.         4.7.2 Diagnosing problems with ATA/IDE adapters
  129.      4.8 Multifunction cards
  130.  
  131.   5. Advanced topics
  132.  
  133.      5.1 Resource allocation for PCMCIA devices
  134.      5.2 How can I have separate device setups for home and work?
  135.      5.3 Booting from a PCMCIA device
  136.         5.3.1 The pcinitrd helper script
  137.         5.3.2 Creating an initrd boot floppy
  138.         5.3.3 Installing an initrd image on a non-Linux drive
  139.  
  140.   6. Dealing with unsupported cards
  141.  
  142.      6.1 Configuring unrecognized cards
  143.      6.2 Adding support for an NE2000-compatible ethernet card
  144.      6.3 PCMCIA floppy interface cards
  145.      6.4 What's up with support for Xircom cards?
  146.  
  147.   7. Debugging tips and programming information
  148.  
  149.      7.1 Submitting useful bug reports
  150.      7.2 Low level PCMCIA debugging aids
  151.      7.3 /proc/bus/pccard
  152.      7.4 Writing Card Services drivers for new cards
  153.      7.5 Guidelines for PCMCIA client driver authors
  154.      7.6 Guidelines for Linux distribution maintainers
  155.  
  156.  
  157.   ______________________________________________________________________
  158.  
  159.   1.  General information and hardware requirements
  160.  
  161.   1.1.  Introduction
  162.  
  163.   Card Services for Linux is a complete PCMCIA or ``PC Card'' support
  164.   package.  It includes a set of loadable kernel modules that implement
  165.   a version of the Card Services applications program interface, a set
  166.   of client drivers for specific cards, and a card manager daemon that
  167.   can respond to card insertion and removal events, loading and
  168.   unloading drivers on demand.  It supports ``hot swapping'' of most
  169.   card types, so cards can be safely inserted and ejected at any time.
  170.  
  171.   This software is continually under development.  It probably contains
  172.   bugs, and should be used with caution.  I'll do my best to fix
  173.   problems that are reported to me, but if you don't tell me, I may
  174.   never know.  If you use this code, I hope you will send me your
  175.   experiences, good or bad!
  176.  
  177.   If you have any suggestions for how this document could be improved,
  178.   please let me know (dhinds@hyper.stanford.edu).
  179.  
  180.  
  181.   1.2.  Copyright notice and disclaimer
  182.  
  183.   Copyright (c) 1998 David A. Hinds
  184.  
  185.   This document may be reproduced or distributed in any form without my
  186.   prior permission.  Modified versions of this document, including
  187.   translations into other languages, may be freely distributed, provided
  188.   that they are clearly identified as such, and this copyright is
  189.   included intact.
  190.  
  191.   This document may be included in commercial distributions without my
  192.   prior consent.  While it is not required, I would like to be informed
  193.   of such usage.  If you intend to incorporate this document in a
  194.   published work, please contact me to make sure you have the latest
  195.   available version.
  196.  
  197.   This document is provided ``AS IS'', with no express or implied
  198.   warranties.  Use the information in this document at your own risk.
  199.   1.3.  What is the latest version, and where can I get it?
  200.  
  201.   The current major release of Card Services is version 3.0, and minor
  202.   updates or bug fixes are numbered 3.0.1, 3.0.2, and so on.
  203.  
  204.   Source code for the latest version is available from
  205.   hyper.stanford.edu in the /pub/pcmcia directory, as pcmcia-
  206.   cs-3.0.?.tar.gz.  There will usually be several versions here.  I
  207.   generally only keep the latest minor release for a given major
  208.   release.  New major releases may contain relatively untested code, so
  209.   I also keep the latest version of the previous major release as a
  210.   relatively stable fallback; the current fallback is 2.9.12.  It is up
  211.   to you to decide which version is more appropriate, but the CHANGES
  212.   file will summarize the most important differences.
  213.  
  214.   hyper.stanford.edu is mirrored at sunsite.unc.edu (and all sunsite
  215.   mirror sites) in /pub/Linux/kernel/pcmcia.
  216.  
  217.   If you do not feel up to compiling the drivers from scratch, pre-
  218.   compiled drivers are included with current releases of most of the
  219.   major Linux distributions, including Slackware, Debian, Red Hat,
  220.   Caldera, SuSE, and Yggdrasil, among others.
  221.  
  222.  
  223.   1.4.  What systems are supported?
  224.  
  225.   This package should run on almost Intel-based Linux-capable laptop.
  226.   It also runs on Alpha-based platforms (i.e., the DEC Multia).  Work is
  227.   being done to make the package fully dual-endian, so that it will also
  228.   support PowerPC-based platforms (i.e., Apple Powerbooks).  Most common
  229.   socket controllers are supported.  Card docks for desktop systems
  230.   should work as long as they use a supported controller, and are
  231.   plugged directly into the ISA or PCI bus, as opposed to SCSI-to-PCMCIA
  232.   or IDE-to-PCMCIA adapters.  The following controllers are recognized
  233.   by the supplied socket drivers:
  234.  
  235.  
  236.   ╖  Cirrus Logic PD6710, PD6720, PD6722, PD6729, PD6730, PD6732, PD6832
  237.  
  238.   ╖  Intel i82365sl B, C, and DF steps, 82092AA
  239.  
  240.   ╖  O2Micro OZ6729, OZ6730, OZ6832, OZ6836
  241.  
  242.   ╖  Omega Micro 82C092G
  243.  
  244.   ╖  Ricoh RF5C296, RF5C396, RL5C466
  245.  
  246.   ╖  SMC 34C90
  247.  
  248.   ╖  Texas Instruments PCI1130, PCI1131, PCI1220, PCI1250A
  249.  
  250.   ╖  Toshiba ToPIC95, ToPIC97 (experimental)
  251.  
  252.   ╖  Vadem VG465, VG468, VG469
  253.  
  254.   ╖  VLSI Technologies 82C146, VCF94365
  255.  
  256.   ╖  VIA VT83C469
  257.  
  258.   ╖  Databook DB86082, DB86082A, DB86084, DB86084A, DB86072, DB86082B
  259.  
  260.   Other controllers that are register compatible with the Intel i82365sl
  261.   will generally work, as well.
  262.  
  263.   Support for 32-bit CardBus cards is still somewhat experimental.
  264.   Drivers prior to version 3.0 only support 16-bit cards in CardBus
  265.   sockets.  Due to the rapid pace of technological change for laptop
  266.   hardware, new controllers appear frequently, and there may be delays
  267.   between when a new model appears on the market, and when driver
  268.   support becomes available.
  269.  
  270.   Toshiba recently made available specifications for their ToPIC95 and
  271.   ToPIC97 chipsets.  Work has been hindered by the fact that much of the
  272.   documentation exists only in Japanese.  Full support for these
  273.   chipsets is still experimental.
  274.  
  275.   The Motorola 6AHC05GA controller used in some Hyundai laptops is not
  276.   supported.  The custom host controller in the HP Omnibook 600 is also
  277.   unsupported.
  278.  
  279.  
  280.   1.5.  What cards are supported?
  281.  
  282.   The current release includes drivers for a variety of ethernet cards,
  283.   a driver for modem and serial port cards, several SCSI adapter
  284.   drivers, a driver for ATA/IDE drive cards, and memory card drivers
  285.   that should support most SRAM cards and some flash cards.  The
  286.   SUPPORTED.CARDS file included with each release of Card Services lists
  287.   all cards that are known to work in at least one actual system.
  288.  
  289.   The likelihood that a card not on the supported list will work depends
  290.   on the type of card.  Essentially all modems should work with the
  291.   supplied driver.  Some network cards may work if they are OEM versions
  292.   of supported cards.  Other types of IO cards (frame buffers, sound
  293.   cards, etc) will not work until someone writes the appropriate
  294.   drivers.
  295.  
  296.  
  297.   1.6.  When will my new card be supported?
  298.  
  299.   Unfortunately, they usually don't pay me to write device drivers, so
  300.   if you would like to have a driver for your favorite card, you are
  301.   probably going to have to do at least some of the work.  Ideally, I'd
  302.   like to work towards a model like the Linux kernel, where I would be
  303.   responsible mainly for the ``core'' driver code and other authors
  304.   would contribute and maintain client drivers for specific cards.  The
  305.   SUPPORTED.CARDS file mentions some cards for which driver work is
  306.   currently in progress.  I will try to help where I can, but be warned
  307.   that debugging kernel device drivers by email is not particularly
  308.   effective.
  309.  
  310.   Manufacturers interested in helping provide Linux support for their
  311.   products can contact me about consulting arrangements.
  312.  
  313.  
  314.   1.7.  Mailing lists and other information sources
  315.  
  316.   I used to maintain a database and mailing list of Linux PCMCIA users.
  317.   More recently, I've turned my web page for Linux PCMCIA information
  318.   into a ``HyperNews'' site, with a set of message lists for Linux
  319.   PCMCIA issues.  There are lists for installation and configuration
  320.   issues, for different types of cards, and for programming and
  321.   debugging issues.  The Linux PCMCIA information page is at
  322.   <http://hyper.stanford.edu/HyperNews/get/pcmcia/home.html>.  Users can
  323.   request email notification of new responses to particular questions,
  324.   or notification for all new messages in a given category.  I hope that
  325.   this will become a useful repository of information, for questions
  326.   that go beyond the scope of the HOWTO.
  327.  
  328.   There is a Linux mailing list devoted to laptop issues, the ``linux-
  329.   laptop'' list.  For more information, send a message containing the
  330.   word ``help'' to majordomo@vger.rutgers.edu.  To subscribe, send a
  331.   message containing ``subscribe linux-laptop'' to the same address.
  332.   This mailing list might be a good forum for discussion of Linux PCMCIA
  333.   issues.
  334.  
  335.   The Linux Laptop Home Page at
  336.   <http://www.cs.utexas.edu/users/kharker/linux-laptop> has links to
  337.   many sites that have information about configuring specific types of
  338.   laptops for Linux.  There is also a searchable database of system
  339.   configuration information.
  340.  
  341.  
  342.   1.8.  Why don't you distribute binaries?
  343.  
  344.   For me, distributing binaries would be a significant hassle.  It is
  345.   complicated because some features can only be selected at compile
  346.   time, and because the modules are somewhat dependent on having the
  347.   ``right'' kernel configuration.  So, I would probably need to
  348.   distribute precompiled modules along with matching kernels.  Beyond
  349.   this, the greatest need for precompiled modules is when installing
  350.   Linux on a clean system.  This typically requires setting up drivers
  351.   so they can be used in the installation process for a particular Linux
  352.   distribution.  Each Linux distribution has its own ideosyncracies, and
  353.   it is not feasible for me to provide boot and root disks for even just
  354.   the common combinations of drivers and distributions.
  355.  
  356.   PCMCIA is now a part of many of the major Linux distributions,
  357.   including Red Hat, Caldera, Slackware, Yggdrasil, Craftworks, and
  358.   Nascent Technology.
  359.  
  360.  
  361.   1.9.  Why is the package so darned big?
  362.  
  363.   Well, first of all, it isn't actually that large.  All the driver
  364.   modules together take up about 500K of disk space.  The utility
  365.   programs add up to about 70K, and the scripts in /etc/pcmcia are about
  366.   50K.  The core driver modules take up about 55K of system memory.  The
  367.   cardmgr daemon will generally be swapped out except when cards are
  368.   inserted or removed.  The total package size is comparable to
  369.   DOS/Windows Card Services implementations.
  370.  
  371.   Compared to DOS ``point enablers'', this may still seem like a lot of
  372.   overhead, especially for people that don't plan on using many of the
  373.   features of PCMCIA, such as power management or hot swapping.  Point
  374.   enablers can be tiny because they generally support only one or a
  375.   small set of cards, and also generally support a restricted set of
  376.   host controllers.  If someone were to write a genuinely ``generic''
  377.   modem enabler, it would end up incorporating much of the functionality
  378.   of Card Services, to handle cards from different vendors and the full
  379.   range of host controller variants.
  380.  
  381.  
  382.   2.  Compilation and installation
  383.  
  384.   2.1.  Prerequisites and kernel setup
  385.  
  386.   Before starting, you should think about whether you really need to
  387.   compile the PCMCIA package yourself.  All common Linux distributions
  388.   come with pre-compiled driver packages.  Generally, you only need to
  389.   install the drivers from scratch if you need a new feature of the
  390.   current drivers, or if you've updated and/or reconfigured your kernel
  391.   in a way that is incompatible with the drivers included with your
  392.   Linux distribution.  While compiling the package is not technically
  393.   difficult, it does require some general Linux familiarity.
  394.  
  395.   The following things should be installed on your system before you
  396.   begin:
  397.   ╖  A 2.0.* or 2.1.* series kernel source tree.
  398.  
  399.   ╖  An appropriate set of module utilities.
  400.  
  401.   ╖  (Optional) the ``XForms'' X11 user interface toolkit.
  402.  
  403.   The current driver package actually works with most kernel versions
  404.   back to 1.2.8.  However, use with older kernels is deprecated, and
  405.   backwards compatibility with very old kernels may go away at any time.
  406.  
  407.   You need to have a complete linux source tree for your kernel, not
  408.   just an up-to-date kernel image.  The driver modules contain some
  409.   references to kernel source files.  While you may want to build a new
  410.   kernel to remove unnecessary drivers, installing PCMCIA does not
  411.   require you to do so.
  412.  
  413.   Current ``stable'' kernel sources and patches are available from
  414.   <ftp://sunsite.unc.edu/pub/Linux/kernel/v2.0>, or from
  415.   <ftp://tsx-11.mit.edu/pub/linux/sources/system/v2.0>.  Development
  416.   kernels can be found in the corresponding v2.1 subdirectories.
  417.   Current module utilities can be found in the same locations.
  418.  
  419.   In the Linux source tree for 2.0 and 2.1 kernels, the
  420.   Documentation/Changes file describes the versions of all sorts of
  421.   other system components that are required for that kernel release.
  422.   You may want to check through this and verify that your system is up
  423.   to date, especially if you have updated your kernel.  If you are using
  424.   a 2.1 kernel, be sure that you are using the right combination of
  425.   shared libraries and module tools.
  426.  
  427.   When configuring your kernel, if you plan on using a PCMCIA ethernet
  428.   card, you should turn on networking support but turn off the normal
  429.   Linux network card drivers, including the ``pocket and portable
  430.   adapters''.  The PCMCIA network card drivers are all implemented as
  431.   loadable modules.  Any drivers compiled into your kernel will only
  432.   waste space.
  433.  
  434.   If you want to use SLIP, PPP, or PLIP, you do need to either configure
  435.   your kernel with these enabled, or use the loadable module versions of
  436.   these drivers.  There is an unfortunate deficiency in the kernel
  437.   config process in 1.2.X kernels, in that it is not possible to set
  438.   configuration options (like SLIP compression) for a loadable module,
  439.   so it is probably better to just link SLIP into the kernel if you need
  440.   it.
  441.  
  442.   In order to use a PCMCIA token ring adapter, your kernel should be
  443.   configured with ``Token Ring driver support'' (CONFIG_TR) enabled,
  444.   though you should leave CONFIG_IBMTR off.
  445.  
  446.   If you want to use a PCMCIA IDE adapter, your kernel should be
  447.   configured with CONFIG_BLK_DEV_IDE_PCMCIA enabled, for 1.3.72 through
  448.   2.1.7 kernels.  Older kernels do not support removeable IDE devices;
  449.   newer kernels do not require a special configuration setting.
  450.  
  451.   If you will be using a PCMCIA SCSI adapter, then enable CONFIG_SCSI
  452.   when configuring your kernel.  Also, enable any top level drivers
  453.   (SCSI disk, tape, cdrom, generic) that you expect to use.  All low-
  454.   level drivers for particular host adapters should be disabled, as they
  455.   will just take up space.
  456.  
  457.   If you want to modularize a driver that is needed for a PCMCIA device,
  458.   you must modify /etc/pcmcia/config to specify what modules need to be
  459.   loaded for what card types.  For example, if the serial driver is
  460.   modularized, then the serial device definition should be:
  461.  
  462.  
  463.        device "serial_cs"
  464.          class "serial" module "misc/serial", "serial_cs"
  465.  
  466.  
  467.  
  468.  
  469.   This package includes an X-based card status utility called cardinfo.
  470.   This utility is based on a freely distributed user interface toolkit
  471.   called the XForms Library.  This library is available as a separate
  472.   package with most Linux distributions.  If you would like to build
  473.   cardinfo, you should install XForms and all the normal X header files
  474.   and libraries before configuring the PCMCIA package.
  475.  
  476.  
  477.   2.2.  Installation
  478.  
  479.   Here is a synopsis of the installation process:
  480.  
  481.  
  482.   ╖  Unpack pcmcia-cs-3.0.?.tar.gz in /usr/src.
  483.  
  484.   ╖  Run ``make config'' in the new pcmcia-cs-3.0.? directory.
  485.  
  486.   ╖  Run ``make all'', then ``make install''.
  487.  
  488.   ╖  Customize the startup script and the option files in /etc/pcmcia
  489.      for your site.
  490.  
  491.   If you plan to install any contributed client drivers not included in
  492.   the core PCMCIA distribution, unpack each of them in the top-level
  493.   directory of the PCMCIA source tree.  Then follow the normal build
  494.   instructions.  The extra drivers will be compiled and installed
  495.   automatically.
  496.  
  497.   Running ``make config'' prompts for a few configuration options, and
  498.   checks out your system to verify that it satisfies all prerequisites
  499.   for installing PCMCIA support.  In most cases, you'll be able to just
  500.   accept all the default configuration options.  Be sure to carefully
  501.   check the output of this command in case there are problems.
  502.  
  503.   If you are compiling the package for installation on another machine,
  504.   specify an alternate target directory when prompted by the configure
  505.   script.  This should be an absolute path.  All filesf will be
  506.   installed relative to this directory.  You will then be able to tar
  507.   this directory tree and copy to your target machine, and unpack
  508.   relative to its root directory to install everything in the proper
  509.   places.
  510.  
  511.   If you are cross compiling on another machine, you may want to specify
  512.   alternate names for the compiler and linker.  This may also be helpful
  513.   on mixed a.out and ELF systems.  The script will also prompt for
  514.   additional compiler flags for debugging.
  515.  
  516.   Some of the support utilities (cardctl and cardinfo) can be compiled
  517.   either in ``safe'' or ``trusting'' forms.  The ``safe'' forms prevent
  518.   non-root users from modifying card configurations.  The ``trusting''
  519.   forms permit ordinary users to issue commands to suspend and resume
  520.   cards, reset cards, and change the current configuration scheme.  The
  521.   configuration script will ask if you want the utilities compiled as
  522.   safe or trusting: the default is to be safe.
  523.  
  524.   There are a few kernel configuration options that affect the PCMCIA
  525.   tools.  The configuration script can deduce these from the running
  526.   kernel (the most common case).  Alternatively, if you are compiling
  527.   for installation on another machine, it can read the configuration
  528.   from a kernel source tree, or each option can be set interactively.
  529.   Running ``make all'' followed by ``make install'' will build and then
  530.   install the kernel modules and utility programs.  Kernel modules are
  531.   installed under /lib/modules/<version>/pcmcia.  The cardmgr and
  532.   cardctl programs are installed in /sbin.  If cardinfo is built, it is
  533.   installed in /usr/bin/X11.
  534.  
  535.   Configuration files will be installed in the /etc/pcmcia directory.
  536.   If you are installing over an older version, your old config scripts
  537.   will be backed up before being replaced.  The saved scripts will be
  538.   given extensions like *.~1~, *.~2~, and so on.
  539.  
  540.   If you don't know what kind of host controller your system uses, you
  541.   can use the probe utility in the cardmgr/ subdirectory to determine
  542.   this.  There are two major types: the Databook TCIC-2 type and the
  543.   Intel i82365SL-compatible type.
  544.  
  545.   In a few cases, the probe command will be unable to determine your
  546.   controller type automatically.  If you have a Halikan NBD 486 system,
  547.   it has a TCIC-2 controller at an unusual location: you'll need to edit
  548.   rc.pcmcia to load the tcic module, and also set the PCIC_OPTS
  549.   parameter to ``tcic_base=0x02c0''.
  550.  
  551.   On some systems using Cirrus controllers, including the NEC Versa M,
  552.   the BIOS puts the controller in a special suspended state at system
  553.   startup time.  On these systems, the probe command will fail to find
  554.   any known host controller.  If this happens, edit rc.pcmcia and set
  555.   PCIC to i82365, and PCIC_OPTS to ``wakeup=1''.
  556.  
  557.  
  558.   2.3.  Startup options
  559.  
  560.   The PCMCIA startup script recognizes several groups of startup
  561.   options, set via environment variables.  Multiple options should be
  562.   separated by spaces and enclosed in quotes.  Placement of startup
  563.   options depends on the Linux distribution used.  They may be placed
  564.   directly in the startup script, or they may be kept in a separate
  565.   option file.  See the ``Notes about specific Linux distributions'' for
  566.   specifics.  The following variables can be set:
  567.  
  568.  
  569.      PCMCIA
  570.         This variable specifies whether PCMCIA support should be started
  571.         up, or not.  If it is set to anything other than ``yes'', then
  572.         the startup script will be disabled.
  573.  
  574.      PCIC
  575.         This identifies the PC Card Interface Controller driver module.
  576.         There are two options: ``tcic'' or ``i82365''.  Virtually all
  577.         current controllers are in the ``i82365'' group.  This is the
  578.         only mandatory option setting.
  579.  
  580.      PCIC_OPTS
  581.         This specifies options for the PCIC module.  Some host
  582.         controllers have optional features that may or may not be
  583.         implemented in a particular system.  In some cases, it is
  584.         impossible for the socket driver to detect if these features are
  585.         implemented.  See the corresponding man page for a complete
  586.         description of the available options.
  587.  
  588.      CORE_OPTS
  589.         This specifies options for the pcmcia_core module, which
  590.         implements the core PC Card driver services.  See ``man
  591.         pcmcia_core'' for more information.
  592.  
  593.      CARDMGR_OPTS
  594.         This specifies options to be passed to the cardmgr daemon.  See
  595.         ``man cardmgr'' for more information.
  596.  
  597.      SCHEME
  598.         If set, then the PC Card configuration scheme will be
  599.         initialized to this at driver startup time.  See the ``Overview
  600.         of the PCMCIA configuration scripts'' for a discussion of
  601.         schemes.
  602.  
  603.   The low level socket drivers, tcic and i82365, have numerous bus
  604.   timing parameters that may need to be adjusted for systems with
  605.   unusual bus clocking.  Symptoms of timing problems include card
  606.   recognition problems, lock-ups under heavy loads, high error rates, or
  607.   poor device performance.  Check the corresponding man pages for more
  608.   details, but here is a brief summary:
  609.  
  610.  
  611.   ╖  Cirrus controllers have numerous configurable timing parameters.
  612.      The most important seems to be the cmd_time flag, which determines
  613.      the length of PCMCIA bus cycles.  Fast 486 systems (i.e., DX4-100)
  614.      seem to often benefit from increasing this from 6 (the default) to
  615.      12 or 16.
  616.  
  617.   ╖  The Cirrus PD6729 PCI controller has the fast_pci flag, which
  618.      should be set if the PCI bus speed is greater than 25 MHz.
  619.  
  620.   ╖  For Vadem VG-468 controllers and Databook TCIC-2 controllers, the
  621.      async_clock flag changes the relative clocking of PCMCIA bus and
  622.      host bus cycles.  Setting this flag adds extra wait states to some
  623.      operations.  However, I have yet to hear of a laptop that needs
  624.      this.
  625.  
  626.   ╖  The pcmcia_core module has the cis_speed parameter for changing the
  627.      memory speed used for accessing a card's Card Information Structure
  628.      (CIS).  On some systems with fast bus clocks, increasing this
  629.      parameter (i.e., slowing down card accesses) may be beneficial for
  630.      card recognition problems.
  631.  
  632.   ╖  This is not a timing issue, but if you have more than one ISA-to-
  633.      PCMCIA controller in your system or extra sockets in a docking
  634.      station, the i82365 module should be loaded with the extra_sockets
  635.      parameter set to 1.  This should not be necessary for detection of
  636.      PCI-to-PCMCIA or PCI-to-CardBus bridges.
  637.  
  638.   Here are some timing settings for specific systems:
  639.  
  640.  
  641.   ╖  On the ARM Pentium-90 or Midwest Micro Soundbook Plus, use
  642.      ``freq_bypass=1 cmd_time=8''.
  643.  
  644.   ╖  On a Midwest Micro Soundbook Elite, use ``cmd_time=12''.
  645.  
  646.   ╖  On a Gateway Liberty, try ``cmd_time=16''.
  647.  
  648.  
  649.   2.4.  System resource settings
  650.  
  651.   Card Services should automatically avoid allocating IO ports and
  652.   interrupts already in use by other standard devices.  It will also
  653.   attempt to detect conflicts with unknown devices, but this is not
  654.   completely reliable.  In some cases, you may need to explicitly
  655.   exclude resources for a device in /etc/pcmcia/config.opts.
  656.  
  657.   Here are some resource settings for specific laptop types.  View this
  658.   list with suspicion: it may give useful hints for solving problems,
  659.   but it is inevitably out of date and certainly contains mistakes.
  660.   Corrections and additions are welcome.
  661.   ╖  On the AMS SoundPro, exclude irq 10.
  662.  
  663.   ╖  On some AMS TravelPro 5300 models, use memory 0xc8000-0xcffff.
  664.  
  665.   ╖  On the BMX 486DX2-66, exclude irq 5, irq 9.
  666.  
  667.   ╖  On the Chicony NB5, use memory 0xda000-0xdffff.
  668.  
  669.   ╖  On the Compaq Presario 1020, exclude port 0x2f8-0x2ff, irq 3, irq
  670.      5.
  671.  
  672.   ╖  On the HP Omnibook 4000C, exclude port 0x300-0x30f.
  673.  
  674.   ╖  On the Micron Millenia Transport, exclude irq 5, irq 9.
  675.  
  676.   ╖  On the NEC Versa M, exclude irq 9, port 0x2e0-2ff.
  677.  
  678.   ╖  On the NEC Versa P/75, exclude irq 5, irq 9.
  679.  
  680.   ╖  On the NEC Versa S, exclude irq 9, irq 12.
  681.  
  682.   ╖  On the NEC Versa 6000 series, exclude port 0x300-0x33f, irq 9, irq
  683.      10.
  684.  
  685.   ╖  On the ProStar 9200, Altima Virage, and Acquiline Hurricane
  686.      DX4-100, exclude irq 5, port 0x330-0x35f.  Maybe use memory
  687.      0xd8000-0xdffff.
  688.  
  689.   ╖  On the Siemens Nixdorf SIMATIC PG 720C, use memory 0xc0000-0xcffff,
  690.      port 0x300-0x3bf.
  691.  
  692.   ╖  On the TI TravelMate 5000, use memory 0xd4000-0xdffff.
  693.  
  694.   ╖  On the Toshiba T4900 CT, exclude irq 5, port 0x2e0-0x2e8, port
  695.      0x330-0x338.
  696.  
  697.   ╖  On the Twinhead 5100, HP 4000, Sharp PC-8700 and PC-8900, exclude
  698.      irq 9 (sound), irq 12.
  699.  
  700.   ╖  On an MPC 800 Series, exclude irq 5, port 0x300-0x30f for the CD-
  701.      ROM.
  702.  
  703.  
  704.   2.5.  Notes about specific Linux distributions
  705.  
  706.   This section is incomplete.  Corrections and additions are welcome.
  707.  
  708.  
  709.   2.5.1.  Debian
  710.  
  711.   Debian uses a System V boot script arrangement.  The PCMCIA startup
  712.   script is installed as /etc/init.d/pcmcia, and startup options are
  713.   specified in /etc/pcmcia.conf.
  714.  
  715.   Debian distributes the PCMCIA system in two packages: the ``pcmcia-
  716.   cs'' package contains cardmgr and other tools, man pages, and
  717.   configuration scripts; and the ``pcmcia-modules'' package contains the
  718.   kernel driver modules.
  719.  
  720.  
  721.   2.5.2.  Red Hat, and Caldera Open Desktop
  722.  
  723.   These distributions use a System V boot script organization.  The
  724.   PCMCIA startup script is installed as /etc/rc.d/init.d/pcmcia, and
  725.   boot options are kept in /etc/sysconfig/pcmcia.  Beware that
  726.   installing the Red Hat package may install a default boot option file
  727.   that has PCMCIA disabled.  To enable PCMCIA, the ``PCMCIA'' variable
  728.   should be set to ``yes''.  Red Hat's default syslogd configuration
  729.   will record all interesting messages in /var/log/messages.
  730.  
  731.   Red Hat's PCMCIA package contains a replacement for the network setup
  732.   script /etc/pcmcia/network, which meshes with the Red Hat network
  733.   control panel.  This is convenient for the case where just one network
  734.   adapter is used, with one set of network parameters, but does not have
  735.   the flexibility of the regular PCMCIA network script.  Compiling and
  736.   installing a clean PCMCIA source distribution will overwrite the
  737.   network script, breaking the link to the network control panel.  If
  738.   you prefer the Red Hat script, either use only Red Hat RPM's, or save
  739.   a copy of the script before installing new driver releases.
  740.  
  741.   Red Hat bundles their slightly modified PCMCIA source distribution in
  742.   their kernel SRPM, rather than as a separate package.
  743.  
  744.  
  745.   2.5.3.  Slackware
  746.  
  747.   Slackware uses a BSD boot script arrangement.  The PCMCIA startup
  748.   script is installed as /etc/rc.d/rc.pcmcia, and boot options are
  749.   specified in rc.pcmcia itself.  The PCMCIA startup script is invoked
  750.   from /etc/rc.d/rc.M.
  751.  
  752.  
  753.   2.5.4.  SuSE
  754.  
  755.   SuSE uses a System V init script arrangement, with init scripts stored
  756.   under /sbin/init.d.  The PCMCIA startup script is installed as
  757.   /sbin/init.d/pcmcia, and startup options are kept in /etc/rc.config.
  758.  
  759.  
  760.   3.  Resolving installation and configuration problems
  761.  
  762.   This section describes some of the most common failure modes for the
  763.   PCMCIA subsystem.  Try to match your symptoms against the examples.
  764.   This section only describes general failures that are not specific to
  765.   a particular client driver or type of card.
  766.  
  767.   Before trying to diagnose a problem, you have to know where your
  768.   system log is kept (see ``Notes about specific Linux distributions'').
  769.   You should also be familiar with basic diagnostic tools like dmesg and
  770.   lsmod.  Also, be aware that most driver components (including all the
  771.   kernel modules) have their own individual man pages.
  772.  
  773.   It is nearly impossible to debug driver problems encountered when
  774.   attempting to install Linux via a PCMCIA device.  Even if you can
  775.   identify the problem based on its symptoms, installation disks are
  776.   difficult to modify, especially without access to a running Linux
  777.   system.  Customization of installation disks is completely dependent
  778.   on the choice of Linux distribution, and is beyond the scope of this
  779.   document.  In general, the best course of action is to install Linux
  780.   using some other means, obtain the latest drivers, and then debug the
  781.   problem if it persists.
  782.  
  783.  
  784.   3.1.  Base PCMCIA kernel modules do not load
  785.  
  786.   Symptoms:
  787.  
  788.   ╖  Kernel version mismatch errors are reported when the PCMCIA startup
  789.      script runs.
  790.  
  791.   ╖  After startup, lsmod does not show any PCMCIA modules.
  792.  
  793.   ╖  cardmgr reports ``no pcmcia driver in /proc/devices'' in the system
  794.      log.
  795.  
  796.   Kernel modules contain version information that is checked against the
  797.   current kernel when a module is loaded.  The type of checking depends
  798.   on the setting of the CONFIG_MODVERSIONS kernel option.  If this is
  799.   false, then the kernel version number is compiled into each module,
  800.   and insmod checks this for a match with the running kernel.  If
  801.   CONFIG_MODVERSIONS is true, then each symbol exported by the kernel is
  802.   given a sort of checksum.  These codes are all compared against the
  803.   corresponding codes compiled into a module.  The intent was for this
  804.   to make modules less version-dependent, because the checksums would
  805.   only change if a kernel interface changed, and would generally stay
  806.   the same across minor kernel updates.  In practice, the checksums have
  807.   turned out to be even more restrictive, because many kernel interfaces
  808.   depend on compile-time kernel option settings.  Also, the checksums
  809.   turned out to be an excessively pessimistic judge of compatibility.
  810.  
  811.   The practical upshot of this is that kernel modules are closely tied
  812.   to both the kernel version, and the setting of many kernel
  813.   configuration options.  Generally, a set of modules compiled for one
  814.   2.0.31 kernel will not load against some other 2.0.31 kernel unless
  815.   special care is taken to ensure that the two were built with similar
  816.   configurations.  This makes distribution of precompiled kernel modules
  817.   a tricky business.
  818.  
  819.   You have several options:
  820.  
  821.  
  822.   ╖  If you obtained precompiled drivers as part of a Linux
  823.      distribution, verify that you are using an unmodified kernel as
  824.      supplied with that distribution.  If you intend to use precompiled
  825.      modules, you generally must stick with the corresponding kernel.
  826.  
  827.   ╖  If you have reconfigured or upgraded your kernel, you will probably
  828.      need to compile and install the PCMCIA package from scratch.  This
  829.      is easily done if you already have the kernel source tree
  830.      installed.  See the PCMCIA-HOWTO for detailed instructions.
  831.  
  832.   ╖  In some cases, incompatibilities in other system components can
  833.      prevent correct loading of kernel modules.  If you have upgraded
  834.      your own kernel, pay attention to the ``minimal requirements'' for
  835.      module utilities and binutils listed in the Documentation/Changes
  836.      file in the kernel source code tree.
  837.  
  838.  
  839.   3.2.  Some client driver modules do not load
  840.  
  841.  
  842.   Symptoms:
  843.  
  844.   ╖  The base modules (pcmcia_core, ds, i82365) load correctly.
  845.  
  846.   ╖  Inserting a card gives a high beep + low beep pattern.
  847.  
  848.   ╖  cardmgr reports version mismatch errors in the system log.
  849.  
  850.   Some of the driver modules require kernel services that may or may not
  851.   be present, depending on kernel configuration.  For instance, the SCSI
  852.   card drivers require that the kernel be configured with SCSI support,
  853.   and the network drivers require a networking kernel.  If a kernel
  854.   lacks a necessary feature, insmod may report undefined symbols and
  855.   refuse to load a particular module. Note that insmod error messages do
  856.   not distinguish between version mismatch errors and missing symbol
  857.   errors.
  858.  
  859.   Specifically:
  860.  
  861.   ╖  The serial client driver serial_cs requires the kernel serial
  862.      driver to be enabled with CONFIG_SERIAL.  This driver may be built
  863.      as a module.
  864.  
  865.   ╖  The SCSI client drivers require that CONFIG_SCSI be enabled, along
  866.      with the appropriate top level driver options (CONFIG_BLK_DEV_SD,
  867.      CONFIG_BLK_DEV_SR, etc for 2.1 kernels).  These may be built as
  868.      modules.
  869.  
  870.   ╖  The network client drivers require that CONFIG_INET is enabled.
  871.      Kernel networking support cannot be compiled as a module.
  872.  
  873.   ╖  The token-ring client requires that the kernel be compiled with
  874.      CONFIG_TR enabled.
  875.  
  876.   There are two ways to proceed:
  877.  
  878.   ╖  Rebuild your kernel with the necessary features enabled.
  879.  
  880.   ╖  If the features have been compiled as modules, then modify
  881.      /etc/pcmcia/config to preload these modules.
  882.  
  883.   The /etc/pcmcia/config file can specify that additional modules need
  884.   to be loaded for a particular client.  For example, for the serial
  885.   driver, one would use:
  886.  
  887.  
  888.  
  889.        device "serial_cs"
  890.          class "serial" module "misc/serial", "serial_cs"
  891.  
  892.  
  893.  
  894.  
  895.   Module paths are specified relative to the top-level module directory
  896.   for the current kernel version; if no relative path is given, then the
  897.   path defaults to the pcmcia subdirectory.
  898.  
  899.  
  900.   3.3.  Interrupt scan failures
  901.  
  902.  
  903.   Symptoms:
  904.  
  905.   ╖  The system locks up when the PCMCIA drivers are loaded, even with
  906.      no cards present.
  907.  
  908.   ╖  The system log shows a successful host controller probe just before
  909.      the lock-up, but does not show interrupt probe results.
  910.  
  911.   After identifying the host controller type, the socket driver probes
  912.   for free interrupts.  The probe involves programming the controller
  913.   for each apparently free interrupt, then generating a ``soft''
  914.   interrupt, to see if the interrupt can be detected correctly.  In some
  915.   cases, probing a particular interrupt can interfere with another
  916.   system device.
  917.  
  918.   The reason for the probe is to identify interrupts which appear to be
  919.   free (i.e., are not reserved by any other Linux device driver), yet
  920.   are either not physically wired to the host controller, or are
  921.   connected to another device that does not have a driver.
  922.  
  923.   In the system log, a successful probe might look like:
  924.  
  925.        Intel PCIC probe:
  926.          TI 1130 CardBus at mem 0x10211000, 2 sockets
  927.          ...
  928.          ISA irqs (scanned) = 5,7,9,10 status change on irq 10
  929.  
  930.  
  931.  
  932.  
  933.   There are two ways to proceed:
  934.  
  935.   ╖  The interrupt probe can be restricted to a list of interrupts using
  936.      the irq_list parameter for the socket drivers.  For example,
  937.      ``irq_list=5,9,10'' would limit the scan to three interrupts.  All
  938.      PCMCIA devices will be restricted to using these interrupts
  939.      (assuming they pass the probe).  You may need to use trial and
  940.      error to find out which interrupts can be safely probed.
  941.  
  942.   ╖  The interrupt probe can be disabled entirely by loading the socket
  943.      driver with the ``do_scan=0'' option.  In this case, a default
  944.      interrupt list will be used, which avoids interrupts already
  945.      allocated for other devices.
  946.  
  947.   In either case, the probe options can be specified using the PCIC_OPTS
  948.   definition in the PCMCIA startup script, for example:
  949.  
  950.  
  951.  
  952.        PCIC_OPTS="irq_list=5,9,10"
  953.  
  954.  
  955.  
  956.  
  957.  
  958.   3.4.  IO port scan failures
  959.  
  960.  
  961.   Symptoms:
  962.  
  963.   ╖  The system locks up when cardmgr is first started, even with no
  964.      cards present.
  965.  
  966.   ╖  The system log shows a successful host controller probe, including
  967.      interrupt probe results, but does not show IO probe results.
  968.  
  969.   ╖  In some cases, the IO probe will succeed, but report large numbers
  970.      of random exclusions.
  971.  
  972.   When cardmgr processes IO port ranges listed in
  973.   /etc/pcmcia/config.opts, the kernel probes these ranges to detect
  974.   latent devices that occupy IO space but are not associated with a
  975.   Linux driver.  The probe is read-only, but in rare cases, reading from
  976.   a device may interfere with an important system function, resulting in
  977.   a lock-up.
  978.  
  979.   Your system user's guide may include a map of system devices, showing
  980.   their IO and memory ranges.  These can be explicitly excluded in
  981.   config.opts.
  982.  
  983.   Alternatively, if the probe is unreliable on your system, it can be
  984.   disabled by setting CORE_OPTS to ``probe_io=0''.  In this case, you
  985.   should be very careful to specify only genuinely available ranges of
  986.   ports in config.opts, instead of using the default settings.
  987.  
  988.  
  989.  
  990.  
  991.   3.5.  Memory probe failures
  992.  
  993.  
  994.   Symptoms:
  995.  
  996.   ╖  The core drivers load correctly when no cards are present, with no
  997.      errors in the system log.
  998.  
  999.   ╖  The system freezes and/or reboots as soon as any card is inserted,
  1000.      before any beeps are heard.
  1001.  
  1002.   Or alternately:
  1003.  
  1004.   ╖  All card insertions generate a high beep followed by a low beep.
  1005.  
  1006.   ╖  All cards are identified as ``anonymous memory cards''.
  1007.  
  1008.   ╖  The system log reports that various memory ranges have been
  1009.      excluded.
  1010.  
  1011.   The core modules perform a memory scan at the time of first 16-bit
  1012.   card insertion.  This scan can potentially interfere with other memory
  1013.   mapped devices.  Also, pre-3.0.0 driver packages perform a more
  1014.   aggressive scan than more recent drivers.  The memory window is
  1015.   defined in /etc/pcmcia/config.opts.  The default window is large, so
  1016.   it may help to restrict the scan to a narrower range.  Reasonable
  1017.   ranges to try include 0xd0000-0xdffff, 0xc0000-0xcffff,
  1018.   0xc8000-0xcffff, or 0xd8000-0xdffff.
  1019.  
  1020.   If you have DOS or Windows PCMCIA drivers, you may be able to deduce
  1021.   what memory region those drivers use.  Note that DOS memory addresses
  1022.   are often specified in ``segment'' form, which leaves off the final
  1023.   hex digit (so an absolute address of 0xd0000 might be given as
  1024.   0xd000).  Be sure to add the extra digit back when making changes to
  1025.   config.opts.
  1026.  
  1027.   In unusual cases, a memory probe failure can indicate a timing
  1028.   register setup problem with the host controller.  See the ``Startup
  1029.   options'' section for information about dealing with common timing
  1030.   problems.
  1031.  
  1032.   CardBus bridges can allocate memory windows outside of the 640KB-1MB
  1033.   ``memory hole'' in the ISA bus architecture.  It is generally a good
  1034.   idea to configure CardBus bridges to use high memory windows, because
  1035.   these are unlikely to conflict with other devices.  Also, CardBus
  1036.   cards may require large memory windows, which may be difficult or
  1037.   impossible to fit into low memory.  Card Services will preferentially
  1038.   allocate windows in high memory for CardBus bridges, if both low and
  1039.   high memory windows are defined in config.opts.  The default
  1040.   config.opts now includes a high memory window of
  1041.   0xa0000000-0xa0ffffff.  If you have a CardBus bridge and have upgraded
  1042.   from an older PCMCIA driver release, add this memory window if it is
  1043.   not already defined.
  1044.  
  1045.  
  1046.   3.6.  Failure to detect card insertions and removals
  1047.  
  1048.   Symptoms:
  1049.  
  1050.   ╖  Cards are detected and configured properly if present at boot time.
  1051.  
  1052.   ╖  The drivers do not respond to insertion and removal events, either
  1053.      by recording events in the system log, or by beeping.
  1054.  
  1055.   In most cases, the socket driver (i82365 or tcic) will automatically
  1056.   probe and select an appropriate interrupt to signal card status
  1057.   changes.  The automatic interrupt probe doesn't work on some Intel-
  1058.   compatible controllers, including Cirrus chips and the chips used in
  1059.   some IBM ThinkPads.  If a device is inactive at probe time, its
  1060.   interrupt may also appear to be available.  In these cases, the socket
  1061.   driver may pick an interrupt that is used by another device.
  1062.  
  1063.   With the i82365 and tcic drivers, the irq_list option can be used to
  1064.   limit the interrupts that will be tested.  This list limits the set of
  1065.   interrupts that can be used by PCMCIA cards as well as for monitoring
  1066.   card status changes.  The cs_irq option can also be used to explicitly
  1067.   set the interrupt to be used for monitoring card status changes.
  1068.  
  1069.   If you can't find an interrupt number that works, there is also a
  1070.   polled status mode: both i82365 and tcic will accept a
  1071.   poll_interval=100 option, to poll for card status changes once per
  1072.   second.  This option should also be used if your system has a shortage
  1073.   of interrupts available for use by PCMCIA cards.  Especially for
  1074.   systems with more than one host controller, there is little point in
  1075.   dedicating interrupts for monitoring card status changes.
  1076.  
  1077.   All these options should be set in the PCIC_OPTS= line in either
  1078.   /etc/rc.d/rc.pcmcia or /etc/sysconfig/pcmcia, depending on your site
  1079.   setup.
  1080.  
  1081.  
  1082.   3.7.  System resource starvation
  1083.  
  1084.  
  1085.   Symptoms:
  1086.  
  1087.  
  1088.   ╖  When a card is inserted, it is identified correctly but cannot be
  1089.      configured (high/low beep pattern).
  1090.  
  1091.   ╖  One of the following messages will appear in the system log:
  1092.  
  1093.  
  1094.        RequestIRQ: Resource in use
  1095.        RequestWindow: Resource in use
  1096.        GetNextTuple: No more items
  1097.        could not allocate nn IO ports for CardBus socket n
  1098.        could not allocate nnK memory for CardBus socket n
  1099.  
  1100.  
  1101.  
  1102.  
  1103.   Interrupt starvation often indicates a problem with the interrupt
  1104.   probe (see ``Interrupt probe failures'').  In some cases, the probe
  1105.   will seem to work, but only report one or two available interrupts.
  1106.   Check your system log to see if the scan results look sensible.
  1107.   Disabling the probe and selecting interrupts manually should help.
  1108.  
  1109.   If the interrupt probe is not working properly, the socket driver may
  1110.   allocate an interrupt for monitoring card insertions, even when
  1111.   interrupts are too scarce for this to be a good idea.  In that case,
  1112.   you can switch the controller to polled mode by setting PCIC_OPTS to
  1113.   ``poll_interval=100'.  Or, if you have a CardBus controller, try
  1114.   ``pci_csc=1'', which selects a PCI interrupt (if available) for card
  1115.   status changes.
  1116.  
  1117.   IO port starvation is fairly uncommon, but sometimes happens with
  1118.   cards that require large, contiguous, aligned regions of IO port
  1119.   space, or that only recognize a few specific IO port positions.  The
  1120.   default IO port ranges in /etc/pcmcia/config.opts are normally
  1121.   sufficient, but may be extended.  In rare cases, starvation may
  1122.   indicate that the IO port probe failed (see ``IO port scan
  1123.   failures'').
  1124.  
  1125.   Memory starvation is also uncommon with the default memory window
  1126.   settings in config.opts.  CardBus cards may require larger memory
  1127.   regions than typical 16-bit cards.  Since CardBus memory windows can
  1128.   be mapped anywhere in the host's PCI address space (rather than just
  1129.   in the 640K-1MB ``hole'' in PC systems), it is helpful to specify
  1130.   large memory windows in high memory, such as 0xa0000000-0xa0ffffff.
  1131.  
  1132.  
  1133.   3.8.  Resource conflict between two cards
  1134.  
  1135.  
  1136.   Symptoms:
  1137.  
  1138.   ╖  Two cards each work fine when used separately.
  1139.  
  1140.   ╖  When both cards are inserted, only one works.
  1141.  
  1142.   This usually indicates a resource conflict with a system device that
  1143.   Linux does not know about.  PCMCIA devices are dynamically configured,
  1144.   so, for example, interrupts are allocated as needed, rather than
  1145.   specifically assigned to particular cards or sockets.  Given a list of
  1146.   resources that appear to be available, cards are assigned resources in
  1147.   the order they are configured.  In this case, the card configured last
  1148.   is being assigned a resource that in fact is not free.
  1149.  
  1150.   Check the system log to see what resources are used by the non-working
  1151.   card.  Exclude these in /etc/pcmcia/config.opts, and restart the
  1152.   cardmgr daemon to reload the resource database.
  1153.  
  1154.  
  1155.   3.9.  Device configuration does not complete
  1156.  
  1157.  
  1158.   Symptoms:
  1159.  
  1160.   ╖  When a card is inserted, exactly one high beep is heard.
  1161.  
  1162.   ╖  Subsequent card insertions and removals may be ignored.
  1163.  
  1164.   This indicates that the card was identified successfully, however,
  1165.   cardmgr has been unable to complete the configuration process for some
  1166.   reason.  The most likely reason is that a step in the card setup
  1167.   script has blocked.  A good example would be the network script
  1168.   blocking if a network card is inserted with no actual network hookup
  1169.   present.
  1170.  
  1171.   To pinpoint the problem, you can manually run a setup script to see
  1172.   where it is blocking.  The scripts are in the /etc/pcmcia directory.
  1173.   They take two parameters: a device name, and an action.  The cardmgr
  1174.   daemon records the configuration commands in the system log.  For
  1175.   example, if the system log shows that the command ``./network start
  1176.   eth0'' was the last command executed by cardmgr, the following
  1177.   commands would trace the script:
  1178.  
  1179.  
  1180.  
  1181.        cd /etc/pcmcia
  1182.        sh -x ./network start eth0
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.   4.  Usage and features
  1190.  
  1191.   4.1.  Tools for configuring and monitoring PCMCIA devices
  1192.  
  1193.   If the modules are all loaded correctly, the output of the lsmod
  1194.   command should look like the following, when no cards are inserted:
  1195.  
  1196.  
  1197.  
  1198.        Module                  Size  Used by
  1199.        ds                      5640   2
  1200.        i82365                 15452   2
  1201.        pcmcia_core            30012   3  [ds i82365]
  1202.  
  1203.  
  1204.  
  1205.  
  1206.   The system log should also include output from the socket driver
  1207.   describing the host controller(s) found and the number of sockets
  1208.   detected.
  1209.  
  1210.  
  1211.   4.1.1.  The cardmgr configuration daemon
  1212.  
  1213.   The cardmgr daemon is responsible for monitoring PCMCIA sockets,
  1214.   loading client drivers when needed, and running user-level scripts in
  1215.   response to card insertions and removals.  It records its actions in
  1216.   the system log, but also uses beeps to signal card status changes.
  1217.   The tones of the beeps indicate success or failure of particular
  1218.   configuration steps.  Two high beeps indicate that a card was
  1219.   identified and configured successfully.  A high beep followed by a low
  1220.   beep indicates that a card was identified, but could not be configured
  1221.   for some reason.  One low beep indicates that a card could not be
  1222.   identified.
  1223.  
  1224.   Cardmgr records device information for each socket in /var/run/stab.
  1225.   Here is a sample /var/run/stab listing:
  1226.  
  1227.  
  1228.  
  1229.        Socket 0: Adaptec APA-1460 SlimSCSI
  1230.        0       scsi    aha152x_cs      0       sda     8       0
  1231.        0       scsi    aha152x_cs      1       scd0    11      0
  1232.        Socket 1: Serial or Modem Card
  1233.        1       serial  serial_cs       0       ttyS1   5       65
  1234.  
  1235.  
  1236.  
  1237.  
  1238.   For the lines describing devices, the first field is the socket, the
  1239.   second is the device class, the third is the driver name, the fourth
  1240.   is used to number multiple devices associated with the same driver,
  1241.   the fifth is the device name, and the final two fields are the major
  1242.   and minor device numbers for this device (if applicable).
  1243.  
  1244.   The cardmgr daemon configures cards based on a database of known card
  1245.   types kept in /etc/pcmcia/config.  This file describes the various
  1246.   client drivers, then describes how to identify various cards, and
  1247.   which driver(s) belong with which cards.  The format of this file is
  1248.   described in the pcmcia(5) man page.
  1249.  
  1250.  
  1251.   4.1.2.  The cardctl and cardinfo utilities
  1252.  
  1253.  
  1254.  
  1255.   The cardctl command can be used to check the status of a socket, or to
  1256.   see how it is configured.  It can also be used to alter the
  1257.   configuration status of a card.  Here is an example of the output of
  1258.   the ``cardctl config'' command:
  1259.  
  1260.  
  1261.  
  1262.        Socket 0:
  1263.          not configured
  1264.        Socket 1:
  1265.          Vcc = 5.0, Vpp1 = 0.0, Vpp2 = 0.0
  1266.          Card type is memory and I/O
  1267.          IRQ 3 is dynamic shared, level mode, enabled
  1268.          Speaker output is enabled
  1269.          Function 0:
  1270.            Config register base = 0x0800
  1271.              Option = 0x63, status = 0x08
  1272.            I/O window 1: 0x0280 to 0x02bf, auto sized
  1273.            I/O window 2: 0x02f8 to 0x02ff, 8 bit
  1274.  
  1275.  
  1276.  
  1277.  
  1278.   Or ``cardctl ident'', to get card identification information:
  1279.  
  1280.  
  1281.  
  1282.        Socket 0:
  1283.          no product info available
  1284.        Socket 1:
  1285.          product info: "LINKSYS", "PCMLM336", "A", "0040052D6400"
  1286.          manfid: 0x0143, 0xc0ab
  1287.          function: 0 (multifunction)
  1288.  
  1289.  
  1290.  
  1291.  
  1292.   The ``cardctl suspend'' and ``cardctl resume'' commands can be used to
  1293.   shut down a card without unloading its associated drivers.  The
  1294.   ``cardctl reset'' command attempts to reset and reconfigure a card.
  1295.   ``cardctl insert'' and ``cardctl eject'' mimic the actions performed
  1296.   when a card is physically inserted or ejected, including loading or
  1297.   unloading drivers, and configuring or shutting down devices.
  1298.  
  1299.   If you are running X, the cardinfo utility produces a graphical
  1300.   display showing the current status of all PCMCIA sockets, similar in
  1301.   content to ``cardctl config''.  It also provides a graphical interface
  1302.   to most other cardctl functions.
  1303.  
  1304.  
  1305.   4.1.3.  Inserting and ejecting cards
  1306.  
  1307.   In theory, you can insert and remove PCMCIA cards at any time.
  1308.   However, it is a good idea not to eject a card that is currently being
  1309.   used by an application program.  Kernels older than 1.1.77 would often
  1310.   lock up when serial/modem cards were ejected, but this should be fixed
  1311.   now.
  1312.  
  1313.  
  1314.   4.1.4.  Card Services and Advanced Power Management
  1315.  
  1316.   Card Services can be compiled with support for APM (Advanced Power
  1317.   Management) if you've installed this package on your system.  APM is
  1318.   incorporated into 1.3.46 and later kernels.  It is currently being
  1319.   maintained by Rick Faith (faith@cs.unc.edu), and APM tools can be
  1320.   obtained from <ftp://ftp.cs.unc.edu/pub/users/faith/linux>.  The
  1321.   PCMCIA modules will automatically be configured for APM if a
  1322.   compatible version is detected on your system.
  1323.  
  1324.   Without resorting to APM, you can do ``cardctl suspend'' before
  1325.   suspending your laptop, and ``cardctl resume'' after resuming, to
  1326.   properly shut down and restart your PCMCIA cards.  This will not work
  1327.   with a modem that is in use, because the serial driver isn't able to
  1328.   save and restore the modem operating parameters.
  1329.  
  1330.   APM seems to be unstable on some systems.  If you experience trouble
  1331.   with APM and PCMCIA on your system, try to narrow down the problem to
  1332.   one package or the other before reporting a bug.
  1333.  
  1334.   Some drivers, notably the PCMCIA SCSI drivers, cannot recover from a
  1335.   suspend/resume cycle.  When using a PCMCIA SCSI card, always use
  1336.   ``cardctl eject'' prior to suspending the system.
  1337.  
  1338.  
  1339.   4.1.5.  Shutting down the PCMCIA system
  1340.  
  1341.   To unload the entire PCMCIA package, invoke rc.pcmcia with:
  1342.  
  1343.  
  1344.  
  1345.        /etc/rc.d/rc.pcmcia stop
  1346.  
  1347.  
  1348.  
  1349.  
  1350.   This script will take several seconds to run, to give all client
  1351.   drivers time to shut down gracefully.  If a device is currently in
  1352.   use, the shutdown will be incomplete, and some kernel modules may not
  1353.   be unloaded.  To avoid this, use ``cardctl eject'' to shut down all
  1354.   sockets before invoking rc.pcmcia.  The exit status of the cardctl
  1355.   command will indicate if any sockets could not be shut down.
  1356.  
  1357.  
  1358.   4.2.  Overview of the PCMCIA configuration scripts
  1359.  
  1360.   Each PCMCIA device has an associated ``class'' that describes how it
  1361.   should be configured and managed.  Classes are associated with device
  1362.   drivers in /etc/pcmcia/config.  There are currently five IO device
  1363.   classes (network, SCSI, cdrom, fixed disk, and serial) and two memory
  1364.   device classes (memory and FTL).  For each class, there are two
  1365.   scripts in /etc/pcmcia: a main configuration script (i.e.,
  1366.   /etc/pcmcia/scsi for SCSI devices), and an options script (i.e.,
  1367.   /etc/pcmcia/scsi.opts).  The main script for a device will be invoked
  1368.   to configure that device when a card is inserted, and to shut down the
  1369.   device when the card is removed.  For cards with several associated
  1370.   devices, the script will be invoked for each device.
  1371.  
  1372.   The config scripts start by extracting some information about a device
  1373.   from /var/run/stab.  Each script constructs a ``device address'', that
  1374.   uniquely describes the device it has been asked to configure, in the
  1375.   ADDRESS shell variable.  This is passed to the *.opts script, which
  1376.   should return information about how a device at this address should be
  1377.   configured.  For some devices, the device address is just the socket
  1378.   number.  For others, it includes extra information that may be useful
  1379.   in deciding how to configure the device.  For example, network devices
  1380.   pass their hardware ethernet address as part of the device address, so
  1381.   the network.opts script could use this to select from several
  1382.   different configurations.
  1383.  
  1384.   The first part of all device addresses is the current PCMCIA
  1385.   ``scheme''.  This parameter is used to support multiple sets of device
  1386.   configurations based on a single external user-specified variable.
  1387.   One use of schemes would be to have a ``home'' scheme, and a ``work''
  1388.   scheme, which would include different sets of network configuration
  1389.   parameters.  The current scheme is selected using the ``cardctl
  1390.   scheme'' command.  The default if no scheme is set is ``default''.
  1391.  
  1392.   As a general rule, when configuring Linux for a laptop, PCMCIA devices
  1393.   should only be configured from the PCMCIA device scripts.  Do not try
  1394.   to configure a PCMCIA device the same way you would configure a
  1395.   permanently attached device.  However, some Linux distributions
  1396.   provide PCMCIA packages that are hooked into those distributions' own
  1397.   device configuration tools.  In that case, some of the following
  1398.   sections may not apply; ideally, this will be documented by the
  1399.   distribution maintainers.
  1400.  
  1401.  
  1402.   4.3.  PCMCIA network adapters
  1403.  
  1404.   Linux ethernet-type network interfaces normally have names like eth0,
  1405.   eth1, and so on.  Token-ring adapters are handled similarly, however
  1406.   they are named tr0, tr1, and so on.  The ifconfig command is used to
  1407.   view or modify the state of a network interface.  A peculiarity of
  1408.   Linux is that network interfaces do not have corresponding device
  1409.   files under /dev, so do not be surprised when you do not find them.
  1410.  
  1411.   When an ethernet card is detected, it will be assigned the first free
  1412.   interface name, which will normally be eth0.  Cardmgr will run the
  1413.   /etc/pcmcia/network script to configure the interface, which normally
  1414.   reads network settings from /etc/pcmcia/network.opts.  The network and
  1415.   network.opts scripts will be executed only when your ethernet card is
  1416.   actually present.  If your system has an automatic network
  1417.   configuration facility, it may or may not be PCMCIA-aware.  Consult
  1418.   the documentation of your Linux distribution and the ``Notes about
  1419.   specific Linux distributions''  to determine if PCMCIA network devices
  1420.   should be configured with the automatic tools, or by editing
  1421.   network.opts.
  1422.  
  1423.   The device address passed to network.opts consists of four comma-
  1424.   separated fields: the scheme, the socket number, the device instance,
  1425.   and the card's hardware ethernet address.  The device instance is used
  1426.   to number devices for cards that have several network interfaces, so
  1427.   it will usually be 0.  If you have several network cards used for
  1428.   different purposes, one option would be to configure the cards based
  1429.   on socket position, as in:
  1430.  
  1431.  
  1432.  
  1433.        case "$ADDRESS" in
  1434.        *,0,*,*)
  1435.            # definitions for network card in socket 0
  1436.            ;;
  1437.        *,1,*,*)
  1438.            # definitions for network card in socket 1
  1439.            ;;
  1440.        esac
  1441.  
  1442.  
  1443.  
  1444.  
  1445.   Alternatively, they could be configured using their hardware
  1446.   addresses, as in:
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.   case "$ADDRESS" in
  1454.   *,*,*,00:80:C8:76:00:B1)
  1455.       # definitions for a D-Link card
  1456.       ;;
  1457.   *,*,*,08:00:5A:44:80:01)
  1458.       # definitions for an IBM card
  1459.   esac
  1460.  
  1461.  
  1462.  
  1463.  
  1464.  
  1465.   4.3.1.  Network device parameters
  1466.  
  1467.   The following parameters can be defined in network.opts:
  1468.  
  1469.  
  1470.      IF_PORT
  1471.         Specifies the ethernet transceiver type, for cards that do not
  1472.         autodetect.  See ``man ifport'' for transceiver names.
  1473.  
  1474.      BOOTP
  1475.         A boolean (y/n) value: indicates if the host's IP address and
  1476.         routing information should be obtained using the BOOTP protocol.
  1477.  
  1478.      IPADDR
  1479.         The IP address for this interface.
  1480.  
  1481.      NETMASK, BROADCAST, NETWORK
  1482.         Basic network parameters: see the networking HOWTO for more
  1483.         information.
  1484.  
  1485.      GATEWAY
  1486.         The IP address of a gateway for this host's subnet.  Packets
  1487.         with destinations outside this subnet will be routed to this
  1488.         gateway.
  1489.  
  1490.      DOMAIN
  1491.         The local network domain name for this host, to be used in
  1492.         creating /etc/resolv.conf.
  1493.  
  1494.      SEARCH
  1495.         A search list for host name lookup, to be added to
  1496.         /etc/resolv.conf.  DOMAIN and SEARCH are mutually exclusive: see
  1497.         ``man resolver'' for more information.
  1498.  
  1499.      DNS_1, DNS_2, DNS_3
  1500.         Host names or IP addresses for nameservers for this interface,
  1501.         to be added to /etc/resolv.conf
  1502.  
  1503.      MOUNTS
  1504.         A list of NFS mount points to be mounted for this interface.
  1505.  
  1506.      IPX_FRAME, IPX_NETNUM
  1507.         For IPX networks: the frame type and network number, passed to
  1508.         the ipx_interface command.
  1509.  
  1510.   For example:
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.   case "$ADDRESS" in
  1520.   *,*,*,*)
  1521.       IF_PORT="10base2"
  1522.       BOOTP="n"
  1523.       IPADDR="10.0.0.1"
  1524.       NETMASK="255.255.255.0"
  1525.       NETWORK="10.0.0.0"
  1526.       BROADCAST="10.0.0.255"
  1527.       GATEWAY="10.0.0.1"
  1528.       DOMAIN="domain.org"
  1529.       DNS_1="dns1.domain.org"
  1530.       ;;
  1531.   esac
  1532.  
  1533.  
  1534.  
  1535.  
  1536.   To automatically mount and unmount NFS filesystems, first add all
  1537.   these filesystems to /etc/fstab, but include noauto in the mount
  1538.   options.  In network.opts, list the filesystem mount points in the
  1539.   MOUNTS variable.  It is especially important to use either cardctl or
  1540.   cardinfo to shut down a network card when NFS mounts are active.  It
  1541.   is not possible to cleanly unmount NFS filesystems if a network card
  1542.   is simply ejected without warning.
  1543.  
  1544.   In addition to the usual network configuration parameters, the
  1545.   network.opts script can specify extra actions to be taken after an
  1546.   interface is configured, or before an interface is shut down.  If
  1547.   network.opts defines a shell function called start_fn, it will be
  1548.   invoked by the network script after the interface is configured, and
  1549.   the interface name will be passed to the function as its first (and
  1550.   only) argument.  Similarly, if it is defined, stop_fn will be invoked
  1551.   before shutting down an interface.
  1552.  
  1553.   The transceiver type can be selected using the IF_PORT setting.  This
  1554.   can either be a numeric value as in previous PCMCIA releases, or a
  1555.   keyword identifying the transceiver type.  All the network drivers
  1556.   default to either autodetect the interface if possible, or 10baseT
  1557.   otherwise.  The ifport command can be used to check or set the current
  1558.   transceiver type.  For example:
  1559.  
  1560.  
  1561.  
  1562.        # ifport eth0 10base2
  1563.        #
  1564.        # ifport eth0
  1565.        eth0    2 (10base2)
  1566.  
  1567.  
  1568.  
  1569.  
  1570.   Current releases of the 3c589 driver attempt to autodetect the network
  1571.   connection, but this doesn't seem to be completely functional yet.
  1572.   For autodetection to work, the network cable should be connected to
  1573.   the card when the card is configured.  Alternatively, once the network
  1574.   is connected, you can force the driver to check the connection with:
  1575.  
  1576.  
  1577.  
  1578.        ifconfig eth0 down up
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.   4.3.2.  Comments about specific cards
  1586.  
  1587.  
  1588.  
  1589.   ╖  With IBM CCAE and Socket EA cards, the transceiver type (10base2,
  1590.      10baseT, AUI) needs to be set when the network device is
  1591.      configured.  Make sure that the transceiver type reported in the
  1592.      system log matches your connection.
  1593.  
  1594.   ╖  The drivers for SMC, Megahertz, Ositech, and 3Com cards should
  1595.      autodetect the attached network type (10base2 or 10baseT).  Setting
  1596.      the transceiver type when the driver is loaded serves to define the
  1597.      card's ``first guess''.
  1598.  
  1599.   ╖  The Farallon EtherWave is actually based on the 3Com 3c589, with a
  1600.      special transceiver.  Though the EtherWave uses 10baseT-style
  1601.      connections, its transceiver requires that the 3c589 be configured
  1602.      in 10base2 mode.
  1603.  
  1604.   ╖  If you have trouble with an IBM CCAE, NE4100, Thomas Conrad, or
  1605.      Kingston adapter, try increasing the memory access time with the
  1606.      mem_speed=# option to the pcnet_cs module.  An example of how to do
  1607.      this is given in the standard config.opts file.  Try speeds of up
  1608.      to 1000 (in nanoseconds).
  1609.  
  1610.   ╖  For the New Media Ethernet adapter, on some systems, it may be
  1611.      necessary to increase the IO port access time with the io_speed=#
  1612.      option when the pcmcia_core module is loaded.  Edit CORE_OPTS in
  1613.      the startup script  to set this option.
  1614.  
  1615.   ╖  The multicast support in the New Media Ethernet driver is
  1616.      incomplete.  The latest driver will function with multicast
  1617.      kernels, but will ignore multicast packets.  Promiscuous mode
  1618.      should work properly.
  1619.  
  1620.   ╖  The driver used by the IBM and 3Com token ring adapters seems to
  1621.      behave very badly if the cards are not connected to a ring when
  1622.      they get initialized.  Always connect these cards to the net before
  1623.      they are powered up.  This driver also requires free IO ports in
  1624.      the range of 0xa20-0xa27.  On some systems, the automatic IO port
  1625.      conflict checker will incorrectly determine that this port range is
  1626.      unavailable.  In that case, the port check can be disabled by
  1627.      loading the pcmcia_core module with probe_io=0.
  1628.  
  1629.   ╖  Newer Linksys and D-Link cards have a unique way of selecting the
  1630.      transceiver type that isn't handled by the Linux drivers.  One
  1631.      workaround is to boot DOS and use the vendor-supplied utility to
  1632.      select the transceiver, then warm boot Linux.  I am looking for
  1633.      beta testers for a Linux utility to perform this function.
  1634.  
  1635.   ╖  For WaveLAN wireless network adapters, Jean Tourrilhes
  1636.      (jt@hplb.hpl.hp.com) has put together a wireless HOWTO at
  1637.      <http://www-uk.hpl.hp.com/people/jt/Linux/Wavelan.html>.
  1638.  
  1639.  
  1640.   4.3.3.  Diagnosing problems with network adapters
  1641.  
  1642.  
  1643.  
  1644.   ╖  Is your card recognized as an ethernet card?  Check the system log
  1645.      and make sure that cardmgr identifies the card correctly and starts
  1646.      up one of the network drivers.  If it doesn't, your card might
  1647.      still be usable if it is compatible with a supported card.  This
  1648.      will be most easily done if the card claims to be ``NE2000
  1649.      compatible''.
  1650.  
  1651.   ╖  Is the card configured properly?  If you are using a supported
  1652.      card, and it was recognized by cardmgr, but still doesn't work,
  1653.      there might be an interrupt or port conflict with another device.
  1654.      Find out what resources the card is using (from the system log),
  1655.      and try excluding these in /etc/pcmcia/config.opts to force the
  1656.      card to use something different.
  1657.  
  1658.   ╖  If your card seems to be configured properly, but sometimes locks
  1659.      up, particularly under high load, you may need to try changing your
  1660.      socket driver timing parameters.  See the ``Startup options''
  1661.      section for more information.
  1662.  
  1663.   ╖  If you get ``network unreachable'' messages when you try to access
  1664.      the network, then the routing information specified in
  1665.      /etc/pcmcia/network.opts is incorrect.  This message is an
  1666.      absolutely foolproof indication of a routing error.  On the other
  1667.      hand, mis-configured cards will usually fail silently.
  1668.  
  1669.   ╖  To diagnose problems in /etc/pcmcia/network.opts, start by trying
  1670.      to ping other systems on the same subnet using their IP addresses.
  1671.      Then try to ping your gateway, and then machines on other subnets.
  1672.      Ping machines by name only after trying these simpler tests.
  1673.  
  1674.   ╖  Make sure your problem is really a PCMCIA one.  It may help to see
  1675.      see if the card works under DOS with the vendor's drivers.  Double
  1676.      check your modifications to the /etc/pcmcia/network.opts script.
  1677.      Make sure your drop cable, ``T'' jack, terminator, etc are working.
  1678.  
  1679.  
  1680.   4.4.  PCMCIA serial and modem devices
  1681.  
  1682.   Linux serial devices are accessed via the /dev/cua* and /dev/ttyS*
  1683.   special device files.  The ttyS* devices are for incoming connections,
  1684.   such as directly connected terminals.  The cua* devices are for
  1685.   outgoing connections, such as modems.  Each physical serial port has
  1686.   both a ttyS and a cua device file: it is up to you to pick the
  1687.   appropriate device for your application.  The configuration of a
  1688.   serial device can be examined and modified with the setserial command.
  1689.  
  1690.   When a serial or modem card is detected, it will be assigned to the
  1691.   first available serial device slot.  This will usually be /dev/ttyS1
  1692.   (cua1) or /dev/ttyS2 (cua2), depending on the number of built-in
  1693.   serial ports.  The ttyS* device is the one reported in /var/run/stab.
  1694.   The default serial device option script, /etc/pcmcia/serial.opts, will
  1695.   link the corresponding cua* device file to /dev/modem as a
  1696.   convenience.
  1697.  
  1698.   Do not try to use /etc/rc.d/rc.serial to configure a PCMCIA modem.
  1699.   This script should only be used to configure non-removable devices.
  1700.   Modify /etc/pcmcia/serial.opts if you want to do anything special to
  1701.   set up your modem.  Also, do not try to change the IO port and
  1702.   interrupt settings of a serial device using setserial.  This would
  1703.   tell the serial driver to look for the device in a different place,
  1704.   but would not change how the card's hardware is actually configured.
  1705.   The serial configuration script allows you to specify other setserial
  1706.   options, as well as whether a line should be added to /etc/inittab for
  1707.   this port.
  1708.  
  1709.   The device address passed to serial.opts has three comma-separated
  1710.   fields: the first is the scheme, the second  is the socket number, and
  1711.   the third is the device instance.  The device instance may take
  1712.   several values for cards that support multiple serial ports, but for
  1713.   single-port cards, it will always be 0.  If you commonly use more than
  1714.   one modem, you may want to specify different settings based on socket
  1715.   position, as in:
  1716.  
  1717.        case "$ADDRESS" in
  1718.        *,0,*)
  1719.            # Options for modem in socket 0
  1720.            LINK=/dev/modem0
  1721.            ;;
  1722.        *,1,*)
  1723.            # Options for modem in socket 1
  1724.            LINK=/dev/modem1
  1725.            ;;
  1726.        esac
  1727.  
  1728.  
  1729.  
  1730.  
  1731.   If a PCMCIA modem is already configured when Linux boots, it may be
  1732.   incorrectly identified as an ordinary built-in serial port.  This is
  1733.   harmless, however, when the PCMCIA drivers take control of the modem,
  1734.   it will be assigned a different device slot.  It is best to either
  1735.   parse /var/run/stab or use /dev/modem, rather than expecting a PCMCIA
  1736.   modem to always have the same device assignment.
  1737.  
  1738.   If you configure your kernel to load the basic Linux serial port
  1739.   driver as a module, you must edit /etc/pcmcia/config to indicate that
  1740.   this module must be loaded.  Edit the serial device entry to read:
  1741.  
  1742.  
  1743.  
  1744.        device "serial_cs"
  1745.          class "serial" module "misc/serial", "serial_cs"
  1746.  
  1747.  
  1748.  
  1749.  
  1750.  
  1751.   4.4.1.  Serial device parameters
  1752.  
  1753.   The following parameters can be defined in serial.opts:
  1754.  
  1755.      LINK
  1756.         Specifies a path for a symbolic link to be created to the
  1757.         ``dialout'' or /dev/cua* device.
  1758.  
  1759.      SERIAL_OPTS
  1760.         Specifies options to be passed to the setserial command.
  1761.  
  1762.      INITTAB
  1763.         If specified, this will be used to construct an inittab entry
  1764.         for the device.
  1765.  
  1766.   For example:
  1767.  
  1768.  
  1769.  
  1770.        case "$ADDRESS" in
  1771.        *,*,*,*)
  1772.            LINK="/dev/modem"
  1773.            SERIAL_OPTS=""
  1774.            INITTAB="/sbin/getty"
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.   4.4.2.  Diagnosing problems with serial devices
  1784.  
  1785.  
  1786.  
  1787.   ╖  Is your card recognized as a modem?  Check the system log and make
  1788.      sure that cardmgr identifies the card correctly and starts up the
  1789.      serial_cs driver.  If it doesn't, you may need to add a new entry
  1790.      to your /etc/pcmcia/config file so that it will be identified
  1791.      properly.  See the ``Configuring unrecognized cards'' section for
  1792.      details.
  1793.  
  1794.   ╖  Is the modem configured successfully by serial_cs?  Again, check
  1795.      the system log and look for messages from the serial_cs driver.  If
  1796.      you see ``register_serial() failed'', you may have an I/O port
  1797.      conflict with another device.  Another tip-off of a conflict is if
  1798.      the device is reported to be an 8250; most modern modems should be
  1799.      identified as 16550A UART's.  If you think you're seeing a port
  1800.      conflict, edit /etc/pcmcia/config.opts and exclude the port range
  1801.      that was allocated for the modem.
  1802.  
  1803.   ╖  Is there an interrupt conflict?  If the system log looks good, but
  1804.      the modem just doesn't seem to work, try using setserial to change
  1805.      the irq to 0, and see if the modem works.  This causes the serial
  1806.      driver to use a slower polled mode instead of using interrupts.  If
  1807.      this seems to fix the problem, it is likely that some other device
  1808.      in your system is using the interrupt selected by serial_cs.  You
  1809.      should add a line to /etc/pcmcia/config.opts to exclude this
  1810.      interrupt.
  1811.  
  1812.   ╖  If the modem seems to work only very, very slowly, this is an
  1813.      almost certain indicator of an interrupt conflict.
  1814.  
  1815.   ╖  Make sure your problem is really a PCMCIA one.  It may help to see
  1816.      if the card works under DOS with the vendor's drivers.  Also, don't
  1817.      test the card with something complex like SLIP or PPP until you are
  1818.      sure you can make simple connections.  If simple things work but
  1819.      SLIP does not, your problem is most likely with SLIP, not with
  1820.      PCMCIA.
  1821.  
  1822.   ╖  If you get kernel messages indicating that the serial_cs module
  1823.      cannot be loaded, it means that your kernel does not have serial
  1824.      device support.  If you have compiled the serial driver as a
  1825.      module, you must modify /etc/pcmcia/config to indicate that the
  1826.      serial module should be loaded before serial_cs.
  1827.  
  1828.  
  1829.   4.5.  PCMCIA SCSI adapters
  1830.  
  1831.   All the currently supported PCMCIA SCSI cards are work-alikes of one
  1832.   of the following ISA bus cards: the Qlogic, the Adaptec AHA-152X, or
  1833.   the Future Domain TMC-16x0.  The PCMCIA drivers are built by linking
  1834.   some PCMCIA-specific code (in qlogic_cs.c, toaster_cs.c, or
  1835.   fdomain_cs.c) with the normal Linux SCSI driver.  Due to limitations
  1836.   in the Linux SCSI driver model, only one removable card per driver is
  1837.   supported.
  1838.  
  1839.   When a new SCSI host adapter is detected, the SCSI drivers will probe
  1840.   for devices.  Check the system log to make sure your devices are
  1841.   detected properly.  New SCSI devices will be assigned to the first
  1842.   available SCSI device files.  The first SCSI disk will be /dev/sda,
  1843.   the first SCSI tape will be /dev/st0, and the first CD-ROM will be
  1844.   /dev/scd0.
  1845.  
  1846.   With 1.3.X and later kernels, the PCMCIA core drivers are able to find
  1847.   out from the kernel which SCSI devices are connected to a card.  They
  1848.   will be listed in /var/run/stab, and the SCSI configuration script,
  1849.   /etc/pcmcia/scsi, will be called once for each attached device, to
  1850.   either configure or shut down that device.  The default script does
  1851.   not take any actions to configure SCSI devices, but will properly
  1852.   unmount filesystems on SCSI devices when a card is removed.
  1853.  
  1854.   With 1.2.X kernels, the PCMCIA drivers cannot automatically deduce
  1855.   which devices are associated with a particular SCSI adapter.  Instead,
  1856.   if you have one normal SCSI device configuration, you may list these
  1857.   devices in /etc/pcmcia/scsi.opts.  For example, if you normally have a
  1858.   SCSI disk and a CD-ROM, you would use:
  1859.  
  1860.  
  1861.  
  1862.        # For 1.2 kernels: list of attached devices
  1863.        SCSI_DEVICES="sda scd0"
  1864.  
  1865.  
  1866.  
  1867.  
  1868.   The device addresses passed to scsi.opts are complicated, because of
  1869.   the variety of things that can be attached to a SCSI adapter.
  1870.   Addresses consist of either six or seven comma-separated fields: the
  1871.   current scheme, the device type, the socket number, the SCSI channel,
  1872.   ID, and logical unit number, and optionally, the partition number.
  1873.   The device type will be ``sd'' for disks, ``st'' for tapes, ``sr'' for
  1874.   CD-ROM devices, and ``sg'' for generic SCSI devices.  For most setups,
  1875.   the SCSI channel and logical unit number will be 0.  For disk devices
  1876.   with several partitions, scsi.opts will first be called for the whole
  1877.   device, with a five-field address.  The script should set the PARTS
  1878.   variable to a list of partitions.  Then, scsi.opts will be called for
  1879.   each partition, with the longer seven-field addresses.
  1880.  
  1881.   If your kernel does not have a top-level driver (disk, tape, etc) for
  1882.   a particular SCSI device, then the device will not be configured by
  1883.   the PCMCIA drivers.  As a side effect, the device's name in
  1884.   /var/run/stab will be something like ``sd#nnnn'' where ``nnnn'' is a
  1885.   four-digit hex number.  This happens when cardmgr is unable to
  1886.   translate a SCSI device ID into a corresponding Linux device name.
  1887.  
  1888.   It is possible to modularize the top-level SCSI drivers so that they
  1889.   are loaded on demand.  To do so, you need to edit /etc/pcmcia/config
  1890.   to tell cardmgr which extra modules need to be loaded when your
  1891.   adapter is configured.  For example:
  1892.  
  1893.  
  1894.  
  1895.        device "aha152x_cs"
  1896.          class "scsi" module "scsi/scsi_mod", "scsi/sd_mod", "aha152x_cs"
  1897.  
  1898.  
  1899.  
  1900.  
  1901.   would say to load the core SCSI module and the top-level disk driver
  1902.   module before loading the regular PCMCIA driver module.  The PCMCIA
  1903.   Configure script will not automatically detect modularized SCSI
  1904.   modules, so you will need use the manual configure option to enable
  1905.   SCSI support.
  1906.  
  1907.   Always turn on SCSI devices before powering up your laptop, or before
  1908.   inserting the adapter card, so that the SCSI bus is properly
  1909.   terminated when the adapter is configured.  Also be very careful about
  1910.   ejecting a SCSI adapter.  Be sure that all associated SCSI devices are
  1911.   unmounted and closed before ejecting the card.  The best way to ensure
  1912.   this is to use either cardctl or cardinfo to request card removal
  1913.   before physically ejecting the card.  For now, all SCSI devices should
  1914.   be powered up before plugging in a SCSI adapter, and should stay
  1915.   connected until after you unplug the adapter and/or power down your
  1916.   laptop.
  1917.  
  1918.   There is a potential complication when using these cards that does not
  1919.   arise with ordinary ISA bus adapters.  The SCSI bus carries a
  1920.   ``termination power'' signal that is necessary for proper operation of
  1921.   ordinary passive SCSI terminators.  PCMCIA SCSI adapters do not supply
  1922.   termination power, so if it is required, an external device must
  1923.   supply it.  Some external SCSI devices may be configured to supply
  1924.   termination power.  Others, such as the Zip Drive and the Syquest EZ-
  1925.   Drive, use active terminators that do not depend on it.  In some
  1926.   cases, it may be necessary to use a special terminator block such as
  1927.   the APS SCSI Sentry 2, which has an external power supply.  When
  1928.   configuring your SCSI device chain, be aware of whether or not any of
  1929.   your devices require or can provide termination power.
  1930.  
  1931.  
  1932.   4.5.1.  SCSI device parameters
  1933.  
  1934.   The following parameters can be defined in scsi.opts:
  1935.  
  1936.      DO_FSTAB
  1937.         A boolean (y/n) setting: specifies if an entry should be added
  1938.         to /etc/fstab for this device.
  1939.  
  1940.      DO_FSCK
  1941.         A boolean (y/n) setting: specifies if the filesystem should be
  1942.         checked before being mounted, with ``fsck -Ta''.
  1943.  
  1944.      DO_MOUNT
  1945.         A boolean (y/n) setting: specifies if this device should be
  1946.         automatically mounted at card insertion time.
  1947.  
  1948.      FSTYPE, OPTS, MOUNTPT
  1949.         The filesystem type, mount options, and mount point to be used
  1950.         for the fstab entry and/or mounting the device.
  1951.  
  1952.   For example, here is a script for configuring a disk device at SCSI ID
  1953.   3, with two partitions, and a CD-ROM at SCSI ID 6:
  1954.  
  1955.  
  1956.  
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.   case "$ADDRESS" in
  1982.   *,sd,*,0,3,0)
  1983.       # This device has two partitions...
  1984.       PARTS="1 2"
  1985.       ;;
  1986.   *,sd,*,0,3,0,1)
  1987.       # Options for partition 1:
  1988.       #  update /etc/fstab, and mount an ext2 fs on /usr1
  1989.       DO_FSTAB="y" ; DO_FSCK="y" ; DO_MOUNT="y"
  1990.       FSTYPE="ext2"
  1991.       OPTS=""
  1992.       MOUNTPT="/usr1"
  1993.       ;;
  1994.   *,sd,*,0,3,0,2)
  1995.       # Options for partition 2:
  1996.       #  update /etc/fstab, and mount an MS-DOS fs on /usr2
  1997.       DO_FSTAB="y" ; DO_FSCK="y" ; DO_MOUNT="y"
  1998.       FSTYPE="msdos"
  1999.       OPTS=""
  2000.       MOUNTPT="/usr2"
  2001.       ;;
  2002.   *,sr,*,0,6,0)
  2003.       # Options for CD-ROM at SCSI ID 6
  2004.       PARTS=""
  2005.       DO_FSTAB="y" ; DO_FSCK="n" ; DO_MOUNT="y"
  2006.       FSTYPE="iso9660"
  2007.       OPTS="ro"
  2008.       MOUNTPT="/cdrom"
  2009.       ;;
  2010.   esac
  2011.  
  2012.  
  2013.  
  2014.  
  2015.  
  2016.   4.5.2.  Comments about specific cards
  2017.  
  2018.  
  2019.  
  2020.   ╖  The Adaptec APA-1480 CardBus card needs a large IO port window (256
  2021.      contiguous ports aligned on a 256-port boundary).  It may be
  2022.      necessary to expand the IO port regions in /etc/pcmcia/config.opts
  2023.      to guarantee that such a large window can be found.
  2024.  
  2025.   ╖  The Adaptec APA-460 SlimSCSI adapter is not supported.  This card
  2026.      was originally sold under the Trantor name, and when Adaptec merged
  2027.      with Trantor, they continued to sell the Trantor card with an
  2028.      Adaptec label.  The APA-460 is not compatible with any existing
  2029.      Linux driver.
  2030.  
  2031.  
  2032.   4.5.3.  Diagnosing problems with SCSI adapters
  2033.  
  2034.  
  2035.   ╖  With the aha152x_cs driver (used by Adaptec, New Media, and a few
  2036.      others), it seems that SCSI disconnect/reconnect support is a
  2037.      frequent source of trouble with tape drives.  To disable this
  2038.      ``feature,'' add the following to /etc/pcmcia/config.opts:
  2039.  
  2040.  
  2041.        module "aha152x_cs" opts "reconnect=0"
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047.   ╖  If you have compiled SCSI support as modules (CONFIG_SCSI is
  2048.      ``m''), when configuring PCMCIA, you must explicitly specify that
  2049.      you want the SCSI drivers to be built.  You must also modify
  2050.      /etc/pcmcia/config to load the SCSI modules before the appropriate
  2051.      *_cs driver is loaded.
  2052.  
  2053.   ╖  If you get ``aborting command due to timeout'' messages when the
  2054.      SCSI bus is probed, you almost certainly have an interrupt
  2055.      conflict.
  2056.  
  2057.   ╖  If the host driver reports ``no SCSI devices found'', verify that
  2058.      your kernel was compiled with the appropriate top-level SCSI
  2059.      drivers for your devices (i.e., disk, tape, CD-ROM, and/or
  2060.      generic).  If a top-level driver is missing, devices of that type
  2061.      will be ignored.
  2062.  
  2063.  
  2064.   4.6.  PCMCIA memory cards
  2065.  
  2066.   The memory_cs driver handles all types of memory cards, as well as
  2067.   providing direct access to the PCMCIA memory address space for cards
  2068.   that have other functions.  When loaded, it creates a combination of
  2069.   character and block devices.  See the man page for the module for a
  2070.   complete description of the device naming scheme.  Block devices are
  2071.   used for disk-like access (creating and mounting filesystems, etc).
  2072.   The character devices are for "raw" unbuffered reads and writes at
  2073.   arbitrary locations.
  2074.  
  2075.   The device address passed to memory.opts consists of two fields: the
  2076.   scheme, and the socket number.  The options are applied to the first
  2077.   common memory partition on the corresponding memory card.
  2078.  
  2079.   Some older memory cards, and most simple static RAM cards, lack a
  2080.   ``Card Information Structure'' (CIS), which is the scheme PCMCIA cards
  2081.   use to identify themselves.  Normally, cardmgr will assume that any
  2082.   card that lacks a CIS is a simple memory card, and load the memory_cs
  2083.   driver.  Thus, a common side effect of a general card identification
  2084.   problem is that other types of cards may be misdetected as memory
  2085.   cards.
  2086.  
  2087.   The memory_cs driver uses a heuristic to guess the capacity of these
  2088.   cards.  The heuristic does not work for write protected cards, and may
  2089.   make mistakes in some other cases as well.  If a card is misdetected,
  2090.   its size should then be explicitly specified when using commands such
  2091.   as dd or mkfs.
  2092.  
  2093.  
  2094.   4.6.1.  Memory device parameters
  2095.  
  2096.  
  2097.   The following parameters can be specified in memory.opts:
  2098.  
  2099.  
  2100.      DO_FSTAB
  2101.         A boolean (y/n) setting: specifies if an entry should be added
  2102.         to /etc/fstab for this device.
  2103.  
  2104.      DO_FSCK
  2105.         A boolean (y/n) setting: specifies if the filesystem should be
  2106.         checked before being mounted, with ``fsck -Ta''.
  2107.  
  2108.      DO_MOUNT
  2109.         A boolean (y/n) setting: specifies if this device should be
  2110.         automatically mounted at card insertion time.
  2111.  
  2112.  
  2113.      FSTYPE, OPTS, MOUNTPT
  2114.         The filesystem type, mount options, and mount point to be used
  2115.         for the fstab entry and/or mounting the device.
  2116.  
  2117.   Here is an example of a script that will automatically mount memory
  2118.   cards based on which socket they are inserted into:
  2119.  
  2120.  
  2121.  
  2122.        case "$ADDRESS" in
  2123.        *,0,0)
  2124.            # Mount filesystem, but don't update /etc/fstab
  2125.            DO_FSTAB="n" ; DO_FSCK="y" ; DO_MOUNT="y"
  2126.            FSTYPE="ext2" ; OPTS=""
  2127.            MOUNTPT="/mem0"
  2128.            ;;
  2129.        *,1,0)
  2130.            # Mount filesystem, but don't update /etc/fstab
  2131.            DO_FSTAB="n" ; DO_FSCK="y" ; DO_MOUNT="y"
  2132.            FSTYPE="ext2" ; OPTS=""
  2133.            MOUNTPT="/mem1"
  2134.            ;;
  2135.        esac
  2136.  
  2137.  
  2138.  
  2139.  
  2140.  
  2141.   4.6.2.  Using flash memory cards
  2142.  
  2143.   The device address passed to ftl.opts consists of three or four
  2144.   fields: the scheme, the socket number, the region number, and
  2145.   optionally, the partition number.  Most flash cards have just one
  2146.   flash memory region, so the region number will generally always be
  2147.   zero.
  2148.  
  2149.   To use a flash memory card as an ordinary disk-like block device,
  2150.   first create an FTL, or ``flash translation layer'', partition on the
  2151.   device with the ftl_format command.  This layer hides the device-
  2152.   specific details of flash memory programming and make the card look
  2153.   like a simple block device.  For example:
  2154.  
  2155.  
  2156.  
  2157.        ftl_format -i /dev/mem0c0c
  2158.  
  2159.  
  2160.  
  2161.  
  2162.   Note that this command accesses the card through the ``raw'' memory
  2163.   card interface.  Once formatted, the card can be accessed as an
  2164.   ordinary block device via the ftl_cs driver.  For example:
  2165.  
  2166.  
  2167.  
  2168.        mke2fs /dev/ftl0c0
  2169.        mount -t ext2 /dev/ftl0c0 /mnt
  2170.  
  2171.  
  2172.  
  2173.  
  2174.   Device naming for FTL devices is tricky.  Minor device numbers have
  2175.   three parts: the card number, the region number on that card, and
  2176.   optionally, the partition within that region.  A region can either be
  2177.   treated as a single block device with no partition table (like a
  2178.   floppy), or it can be partitioned like a hard disk device.  The
  2179.   ``ftl0c0'' device is card 0, common memory region 0, the entire
  2180.   region.  The ``ftl0c0p1'' through ``ftl0c0p4'' devices are primary
  2181.   partitions 1 through 4 if the region has been partitioned.
  2182.  
  2183.   There are two major formats for flash memory cards: the FTL style, and
  2184.   the Microsoft Flash File System.  The FTL format is generally more
  2185.   flexible because it allows any ordinary high-level filesystem (ext2,
  2186.   ms-dos, etc) to be used on a flash card as if it were an ordinary disk
  2187.   device.  The FFS is a completely different filesystem type.  Linux
  2188.   cannot currently handle cards formated with FFS.
  2189.  
  2190.   Intel Series 100 flash cards use the first 128K flash block to store
  2191.   the cards' configuration information.  To prevent accidental erasure
  2192.   of this information, ftl_format will automatically detect this and
  2193.   skip the first block when creating an FTL partition.
  2194.  
  2195.  
  2196.   4.7.  PCMCIA ATA/IDE card drives
  2197.  
  2198.   ATA/IDE drive support requires a 1.3.72 or higher kernel.  The PCMCIA-
  2199.   specific part of the driver is ide_cs.  Be sure to use cardctl or
  2200.   cardinfo to shut down an ATA/IDE card before ejecting it, as the
  2201.   driver has not been made ``hot-swap-proof''.
  2202.  
  2203.   The device addresses passed to ide.opts consist of either three or
  2204.   four fields: the current scheme, the socket number, the drive's serial
  2205.   number, and an optional partition number.  The ide_info command can be
  2206.   used to obtain an IDE device's serial number.  As with SCSI devices,
  2207.   ide.opts is first called for the entire device.  If ide.opts returns a
  2208.   list of partitions in the PARTS variable, the script will then be
  2209.   called for each partition.
  2210.  
  2211.  
  2212.   4.7.1.  ATA/IDE fixed-disk device parameters
  2213.  
  2214.  
  2215.   The following parameters can be specified in ide.opts:
  2216.  
  2217.  
  2218.      DO_FSTAB
  2219.         A boolean (y/n) setting: specifies if an entry should be added
  2220.         to /etc/fstab for this device.
  2221.  
  2222.      DO_FSCK
  2223.         A boolean (y/n) setting: specifies if the filesystem should be
  2224.         checked before being mounted, with ``fsck -Ta''.
  2225.  
  2226.      DO_MOUNT
  2227.         A boolean (y/n) setting: specifies if this device should be
  2228.         automatically mounted at card insertion time.
  2229.  
  2230.      FSTYPE, OPTS, MOUNTPT
  2231.         The filesystem type, mount options, and mount point to be used
  2232.         for the fstab entry and/or mounting the device.
  2233.  
  2234.   Here is an example ide.opts file to mount the first partition of any
  2235.   ATA/IDE card on /mnt.
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.   case "$ADDRESS" in
  2246.   *,*,*,1)
  2247.       DO_FSTAB="y" ; DO_FSCK="y" ; DO_MOUNT="y"
  2248.       FSTYPE="msdos"
  2249.       OPTS=""
  2250.       MOUNTPT="/mnt"
  2251.       ;;
  2252.   *,*,*)
  2253.       PARTS="1"
  2254.       ;;
  2255.   esac
  2256.  
  2257.  
  2258.  
  2259.  
  2260.  
  2261.   4.7.2.  Diagnosing problems with ATA/IDE adapters
  2262.  
  2263.  
  2264.   ╖  Some IDE drives violate the PCMCIA specification by requiring a
  2265.      longer time to spin up than the maximum allowed card setup time.
  2266.      To use these cards, load the pcmcia_core module with:
  2267.  
  2268.  
  2269.        CORE_OPTS="unreset_delay=400"
  2270.  
  2271.  
  2272.  
  2273.  
  2274.   ╖  To use an ATA/IDE CD-ROM device, your kernel must be compiled with
  2275.      CONFIG_BLK_DEV_IDECD enabled.  This will normally be the case for
  2276.      standard kernels, however it is something to be aware of if you
  2277.      compile a custom kernel.
  2278.  
  2279.  
  2280.   4.8.  Multifunction cards
  2281.  
  2282.   Starting with the 1.3.73 Linux kernel, a single interrupt can be
  2283.   shared by several drivers, such as the serial driver and an ethernet
  2284.   driver.  When using a multifunction card under a newer kernel, all
  2285.   card functions can be used without loading and unloading drivers.
  2286.  
  2287.   Simultaneous use of two card functions is ``tricky'' and various
  2288.   hardware vendors have implemented interrupt sharing in their own
  2289.   incompatible (and sometimes proprietary) ways.  The drivers for some
  2290.   cards (Ositech Jack of Diamonds, 3Com 3c562, Linksys) properly support
  2291.   simultaneous access, but others (Megahertz in particular) do not.
  2292.  
  2293.   Earlier kernels do not support interrupt sharing between different
  2294.   device drivers, so it is not possible for the PCMCIA drivers to
  2295.   configure this card for simultaneous ethernet and modem access.  The
  2296.   ethernet and serial drivers are both loaded automatically.  However,
  2297.   the ethernet driver ``owns'' the card interrupt by default.  To use
  2298.   the modem, you can unload the ethernet driver and reconfigure the
  2299.   serial port by doing something like:
  2300.  
  2301.  
  2302.  
  2303.        ifconfig eth0 down
  2304.        rmmod 3c589_cs
  2305.        setserial /dev/modem autoconfig auto_irq
  2306.        setserial /dev/modem
  2307.  
  2308.  
  2309.  
  2310.  
  2311.   The second setserial should verify that the port has been configured
  2312.   to use the interrupt previously used by the ethernet driver.
  2313.  
  2314.  
  2315.   5.  Advanced topics
  2316.  
  2317.  
  2318.  
  2319.   5.1.  Resource allocation for PCMCIA devices
  2320.  
  2321.   In theory, it should not really matter which interrupt is allocated to
  2322.   which device, as long as two devices are not configured to use the
  2323.   same interrupt.  In /etc/pcmcia/config.opts you'll find a place for
  2324.   excluding interrupts that are used by non-PCMCIA devices.
  2325.  
  2326.   Similarly, there is no way to directly specify the I/O addresses for a
  2327.   card to use.  The /etc/pcmcia/config.opts file allows you to specify
  2328.   ranges of ports available for use by any card, or to exclude ranges
  2329.   that conflict with other devices.
  2330.  
  2331.   After modifying /etc/pcmcia/config.opts, you can restart cardmgr with
  2332.   ``kill -HUP''.
  2333.  
  2334.   The interrupt used to monitor card status changes is chosen by the
  2335.   low-level socket driver module (i82365 or tcic) before cardmgr parses
  2336.   /etc/pcmcia/config, so it is not affected by changes to this file.  To
  2337.   set this interrupt, use the cs_irq= option when the socket driver is
  2338.   loaded, by setting the PCIC_OPTS variable in /etc/rc.d/rc.pcmcia.
  2339.  
  2340.   All the client card drivers have a parameter called irq_list for
  2341.   specifying which interrupts they may try to allocate.  These driver
  2342.   options should be set in your /etc/pcmcia/config file.  For example:
  2343.  
  2344.  
  2345.  
  2346.        device "serial_cs"
  2347.          module "serial_cs" opts "irq_list=8,12"
  2348.          ...
  2349.  
  2350.  
  2351.  
  2352.  
  2353.   would specify that the serial driver should only use irq 8 or irq 12.
  2354.   Regardless of irq_list settings, Card Services will never allocate an
  2355.   interrupt that is already in use by another device, or an interrupt
  2356.   that is excluded in the config file.
  2357.  
  2358.  
  2359.   5.2.  How can I have separate device setups for home and work?
  2360.  
  2361.   This is fairly easy using ``scheme'' support.  Use two configuration
  2362.   schemes, called ``home'' and ``work''.  Here is an example of a
  2363.   network.opts script with scheme-specific settings:
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.  
  2372.  
  2373.  
  2374.  
  2375.  
  2376.  
  2377.   case "$ADDRESS" in
  2378.   work,*,*,*)
  2379.       # definitions for network card in work scheme
  2380.       ...
  2381.       ;;
  2382.   home,*,*,*|default,*,*,*)
  2383.       # definitions for network card in home scheme
  2384.       ...
  2385.       ;;
  2386.   esac
  2387.  
  2388.  
  2389.  
  2390.  
  2391.   The first part of a device address is always the configuration scheme.
  2392.   In this example, the second ``case'' clause will select for both the
  2393.   ``home'' and ``default'' schemes.  So, if the scheme is unset for any
  2394.   reason, it will default to the ``home'' setup.
  2395.  
  2396.   Now, to select between the two sets of settings, run either:
  2397.  
  2398.  
  2399.  
  2400.        cardctl scheme home
  2401.  
  2402.  
  2403.  
  2404.  
  2405.   or
  2406.  
  2407.  
  2408.  
  2409.        cardctl scheme work
  2410.  
  2411.  
  2412.  
  2413.  
  2414.   The cardctl command does the equivalent of shutting down all your
  2415.   cards and restarting them.  The command can be safely executed whether
  2416.   or not the PCMCIA system is loaded, but the command may fail if you
  2417.   are using other PCMCIA devices at the time (even if their
  2418.   configurations are not explicitly dependant on the scheme setting).
  2419.  
  2420.   To find out the current scheme setting, run:
  2421.  
  2422.  
  2423.  
  2424.        cardctl scheme
  2425.  
  2426.  
  2427.  
  2428.  
  2429.   By default, the scheme setting is persistent across boots.  This can
  2430.   have undesirable effects if networking is initialized for the wrong
  2431.   environment.  Optionally, you can set the initial scheme value with
  2432.   the SCHEME startup option (see ``Startup options'' for details).  It
  2433.   is also possible to set the scheme from the lilo boot prompt.  Since
  2434.   lilo passes unrecognized options to init as environment variables, a
  2435.   value for SCHEME (or any other PCMCIA startup option) at the boot
  2436.   prompt will be propagated into the PCMCIA startup script.
  2437.  
  2438.   To save even more keystrokes, schemes can be specified in lilo's
  2439.   configuration file.  For instance, you could have:
  2440.  
  2441.  
  2442.  
  2443.   root = /dev/hda1
  2444.   read-only
  2445.   image = /boot/vmlinuz
  2446.     label  = home
  2447.     append = "SCHEME=home"
  2448.   image = /boot/vmlinuz
  2449.     label  = work
  2450.     append = "SCHEME=work"
  2451.  
  2452.  
  2453.  
  2454.  
  2455.   Typing ``home'' or ``work'' at the boot prompt would then boot into
  2456.   the appropriate scheme.
  2457.  
  2458.  
  2459.   5.3.  Booting from a PCMCIA device
  2460.  
  2461.  
  2462.   Having the root filesystem on a PCMCIA device is tricky because the
  2463.   Linux PCMCIA system is not designed to be linked into the kernel.  Its
  2464.   core components, the loadable kernel modules and the user mode cardmgr
  2465.   daemon, depend on an already running system.  The kernel's ``initrd''
  2466.   facility works around this requirement by allowing Linux to boot using
  2467.   a temporary ram disk as a minimal root image, load drivers, and then
  2468.   re-mount a different root filesystem.  The temporary root can
  2469.   configure PCMCIA devices and then re-mount a PCMCIA device as root.
  2470.  
  2471.   The initrd image absolutely must reside on a bootable device: this
  2472.   generally cannot be put on a PCMCIA device.  This is a BIOS
  2473.   limitation, not a kernel limitation.  It is useful here to distinguish
  2474.   between ``boot-able'' devices (i.e., devices that can be booted), and
  2475.   ``root-able'' devices (i.e., devices that can be mounted as root).
  2476.   ``Boot-able'' devices are determined by the BIOS, and are generally
  2477.   limited to internal floppy and hard disk drives.  ``Root-able''
  2478.   devices are any block devices that the kernel supports once it has
  2479.   been loaded.  The initrd facility makes more devices ``root-able'',
  2480.   not ``boot-able''.
  2481.  
  2482.   Some Linux distributions will allow installation to a device connected
  2483.   to a PCMCIA SCSI adapter, as an unintended side-effect of their
  2484.   support for installs from PCMCIA SCSI CD-ROM devices.  However, at
  2485.   present, no Linux installation tools support configuring an
  2486.   appropriate ``initrd'' to boot Linux with a PCMCIA root filesystem.
  2487.   Setting up a system with a PCMCIA root thus requires that you use
  2488.   another Linux system to create the ``initrd'' image.  If another Linux
  2489.   system is not available, another option would be to temporarily
  2490.   install a minimal Linux setup on a non-PCMCIA drive, create an initrd
  2491.   image, and then reinstall to the PCMCIA target.
  2492.  
  2493.   The Linux Bootdisk-HOWTO has some general information about setting up
  2494.   boot disks but nothing specific to initrd.  The main initrd document
  2495.   is included with recent kernel source code distributions, in
  2496.   linux/Documentation/initrd.txt.  Before beginning, you should read
  2497.   this document.  A familiarity with lilo is also helpful.  Using initrd
  2498.   also requires that you have a kernel compiled with CONFIG_BLK_DEV_RAM
  2499.   and CONFIG_BLK_DEV_INITRD enabled.
  2500.  
  2501.   This is an advanced configuration technique, and requires a high level
  2502.   of familiarity with Linux and the PCMCIA system.  Be sure to read all
  2503.   the relevant documentation before starting.  The following cookbook
  2504.   instructions should work, but deviations from the examples will
  2505.   quickly put you in uncharted and ``unsupported'' territory, and you
  2506.   will be on your own.
  2507.  
  2508.  
  2509.   This method absolutely requires that you use a PCMCIA driver release
  2510.   of 2.9.5 or later.  Older PCMCIA packages or individual components
  2511.   will not work in the initrd context.  Do not mix components from
  2512.   different releases.
  2513.  
  2514.  
  2515.   5.3.1.  The pcinitrd helper script
  2516.  
  2517.   The pcinitrd script creates a basic initrd image for booting with a
  2518.   PCMCIA root partition.  The image includes a minimal directory
  2519.   heirarchy, a handful of device files, a few binaries, shared
  2520.   libraries, and a set of PCMCIA driver modules.  When invoking
  2521.   pcinitrd, you specify the driver modules that you want to be included
  2522.   in the image.  The core PCMCIA components, pcmcia_core and ds, are
  2523.   automatically included.
  2524.  
  2525.   As an example, say that your laptop uses an i82365-compatible host
  2526.   controller, and you want to boot Linux with the root filesystem on a
  2527.   hard drive attached to an Adaptec SlimSCSI adapter.  You could create
  2528.   an appropriate initrd image with:
  2529.  
  2530.  
  2531.  
  2532.        pcinitrd -v initrd pcmcia/i82365.o pcmcia/aha152x_cs.o
  2533.  
  2534.  
  2535.  
  2536.  
  2537.   To customize the initrd startup sequence, you could mount the image
  2538.   using the ``loopback'' device with a command like:
  2539.  
  2540.  
  2541.  
  2542.        mount -o loop -t ext2 initrd /mnt
  2543.  
  2544.  
  2545.  
  2546.  
  2547.   and then edit the linuxrc script.  The configuration files will be
  2548.   installed under /etc in the image, and can also be customized.  See
  2549.   the man page for pcinitrd for more information.
  2550.  
  2551.  
  2552.   5.3.2.  Creating an initrd boot floppy
  2553.  
  2554.  
  2555.   After creating an image with pcinitrd, you can create a boot floppy by
  2556.   copying the kernel, the compressed initrd image, and a few support
  2557.   files for lilo to a clean floppy.  In the following example, we assume
  2558.   that the desired PCMCIA root device is /dev/sda1:
  2559.  
  2560.  
  2561.  
  2562.        mke2fs /dev/fd0
  2563.        mount /dev/fd0 /mnt
  2564.        mkdir /mnt/etc /mnt/boot /mnt/dev
  2565.        cp -a /dev/fd0 /dev/sda1 /mnt/dev
  2566.        cp [kernel-image] /mnt/vmlinuz
  2567.        gzip < [initrd-image] > /mnt/initrd
  2568.  
  2569.  
  2570.  
  2571.  
  2572.   Create /mnt/etc/lilo.conf with the contents:
  2573.  
  2574.  
  2575.        boot=/dev/fd0
  2576.        compact
  2577.        image=/vmlinuz
  2578.            label=linux
  2579.            initrd=/initrd
  2580.            read-only
  2581.            root=/dev/sda1
  2582.  
  2583.  
  2584.  
  2585.  
  2586.   Finally, invoke lilo with:
  2587.  
  2588.  
  2589.  
  2590.        lilo -r /mnt
  2591.  
  2592.  
  2593.  
  2594.  
  2595.   When lilo is invoked with -r, it performs all actions relative to the
  2596.   specified alternate root directory.  The reason for creating the
  2597.   device files under /mnt/dev was that lilo will not be able to use the
  2598.   files in /dev when it is running in this alternate-root mode.
  2599.  
  2600.  
  2601.   5.3.3.  Installing an initrd image on a non-Linux drive
  2602.  
  2603.   One common use of the initrd facility would be on systems where the
  2604.   internal hard drive is dedicated to another operating system.  The
  2605.   Linux kernel and initrd image can be placed in a non-Linux partition,
  2606.   and lilo or LOADLIN can be set up to boot Linux from these images.
  2607.  
  2608.   Assuming that you have a kernel has been configured for the
  2609.   appropriate root device, and an initrd image created on another
  2610.   system, the easiest way to get started is to boot Linux using LOADLIN,
  2611.   as:
  2612.  
  2613.  
  2614.  
  2615.        LOADLIN <kernel> initrd=<initrd-image>
  2616.  
  2617.  
  2618.  
  2619.  
  2620.   Once you can boot Linux on your target machine, you could then install
  2621.   lilo to allow booting Linux directly.  For example, say that /dev/hda1
  2622.   is the non-Linux target partition and /mnt can be used as a mount
  2623.   point.  First, create a subdirectory on the target for the Linux
  2624.   files:
  2625.  
  2626.  
  2627.  
  2628.        mount /dev/hda1 /mnt
  2629.        mkdir /mnt/linux
  2630.        cp [kernel-image] /mnt/linux/vmlinuz
  2631.        cp [initrd-image] /mnt/linux/initrd
  2632.  
  2633.  
  2634.  
  2635.  
  2636.   In this example, say that /dev/sda1 is the desired Linux root
  2637.   partition, a SCSI hard drive mounted via a PCMCIA SCSI adapter.  To
  2638.   install lilo, create a lilo.conf file with the contents:
  2639.  
  2640.  
  2641.        boot=/dev/hda
  2642.        map=/mnt/linux/map
  2643.        compact
  2644.        image=/mnt/linux/vmlinuz
  2645.                label=linux
  2646.                root=/dev/sda1
  2647.                initrd=/mnt/linux/initrd
  2648.                read-only
  2649.        other=/dev/hda1
  2650.                table=/dev/hda
  2651.                label=windows
  2652.  
  2653.  
  2654.  
  2655.  
  2656.   The boot= line says to install the boot loader in the master boot
  2657.   record of the specified device.  The root= line identifies the desired
  2658.   root filesystem to be used after loading the initrd image, and may be
  2659.   unnecessary if the kernel image is already configured this way.  The
  2660.   other= section is used to describe the other operating system
  2661.   installed on /dev/hda1.
  2662.  
  2663.   To install lilo in this case, use:
  2664.  
  2665.  
  2666.  
  2667.        lilo -C lilo.conf
  2668.  
  2669.  
  2670.  
  2671.  
  2672.   Note that in this case, the lilo.conf file uses absolute paths that
  2673.   include /mnt.  I did this in the example because the target filesystem
  2674.   may not support the creation of Linux device files for the boot= and
  2675.   root= options.
  2676.  
  2677.  
  2678.   6.  Dealing with unsupported cards
  2679.  
  2680.  
  2681.  
  2682.   6.1.  Configuring unrecognized cards
  2683.  
  2684.  
  2685.   Assuming that your card is supported by an existing driver, all that
  2686.   needs to be done is to add an entry to /etc/pcmcia/config to tell
  2687.   cardmgr how to identify the card, and which driver(s) need to be
  2688.   linked up to this card.  Check the man page for pcmcia for more
  2689.   information about the config file format.  If you insert an unknown
  2690.   card, cardmgr will normally record some identification information in
  2691.   the system log that can be used to construct the config entry.  This
  2692.   information can also be displayed with the ``cardctl ident'' command.
  2693.  
  2694.   Here is an example of how cardmgr will report an unsupported card in
  2695.   /usr/adm/messages.
  2696.  
  2697.  
  2698.  
  2699.        cardmgr[460]: unsupported card in socket 1
  2700.        cardmgr[460]: product info: "MEGAHERTZ", "XJ2288", "V.34 PCMCIA MODEM"
  2701.        cardmgr[460]: manfid: 0x0101, 0x1234  function: 2 (serial)
  2702.  
  2703.  
  2704.  
  2705.  
  2706.  
  2707.   The corresponding entry in /etc/pcmcia/config would be:
  2708.  
  2709.  
  2710.  
  2711.        card "Megahertz XJ2288 V.34 Fax Modem"
  2712.          version "MEGAHERTZ", "XJ2288", "V.34 PCMCIA MODEM"
  2713.          bind "serial_cs"
  2714.  
  2715.  
  2716.  
  2717.  
  2718.   You can use ``*'' to match strings that don't need to match exactly,
  2719.   like version numbers.  When making new config entries, be careful to
  2720.   copy the strings exactly, preserving case and blank spaces.  Also be
  2721.   sure that the config entry has the same number of strings as are
  2722.   reported in the log file.
  2723.  
  2724.   Beware that you can specify just about any driver for a card, but if
  2725.   you're just shooting in the dark, there is not much reason to expect
  2726.   this to be productive.  You may get lucky and find that your card is
  2727.   supported by an existing driver.  However, the most likely outcome is
  2728.   that the driver won't work, and may have unfortunate side effects like
  2729.   locking up your system.  Unlike most ordinary device drivers, which
  2730.   probe for an appropriate card, the probe for a PCMCIA device is done
  2731.   by cardmgr, and the driver itself may not do much validation before
  2732.   attempting to communicate with the device.
  2733.  
  2734.   After editing /etc/pcmcia/config, you can signal cardmgr to reload the
  2735.   file with:
  2736.  
  2737.  
  2738.  
  2739.        kill -HUP `cat /var/run/cardmgr.pid`
  2740.  
  2741.  
  2742.  
  2743.  
  2744.   If you do set up an entry for a new card, please send me a copy so
  2745.   that I can include it in the standard config file.
  2746.  
  2747.  
  2748.   6.2.  Adding support for an NE2000-compatible ethernet card
  2749.  
  2750.   Before you begin: this procedure will only work for simple ethernet
  2751.   cards.  Multifunction cards (i.e., ethernet/modem combo cards) have an
  2752.   extra layer of complexity regarding how the two functions are
  2753.   integrated, and generally cannot be supported without obtaining some
  2754.   configuration information from the card vendor.  Using the following
  2755.   procedure for a multifunction card will not be productive.
  2756.  
  2757.   First, see if the card is already recognized by cardmgr.  Some cards
  2758.   not listed in SUPPORTED.CARDS are actually OEM versions of cards that
  2759.   are supported.  If you find a card like this, let me know so I can add
  2760.   it to the list.
  2761.  
  2762.   If your card is not recognized, follow the instructions in the
  2763.   ``Configuring unrecognized cards'' section to create a config entry
  2764.   for your card, and bind the card to the pcnet_cs driver.  Restart
  2765.   cardmgr to use the updated config file.
  2766.  
  2767.   If the pcnet_cs driver says that it is unable to determine your card's
  2768.   hardware ethernet address, then edit your new config entry to bind the
  2769.   card to the memory card driver, memory_cs.  Restart cardmgr to use the
  2770.   new updated config file.  You will need to know your card's hardware
  2771.   ethernet address.  This address is a series of six two-digit hex
  2772.   numbers, often printed on the card itself.  If it is not printed on
  2773.   the card, you may be able to use a DOS driver to display the address.
  2774.   In any case, once you know it, run:
  2775.  
  2776.  
  2777.  
  2778.        dd if=/dev/mem0a count=20 | od -Ax -t x1
  2779.  
  2780.  
  2781.  
  2782.  
  2783.   and search the output for your address.  Only the even bytes are
  2784.   defined, so ignore the odd bytes in the dump.  Record the hex offset
  2785.   of the first byte of the address.  Now, edit modules/pcnet_cs.c and
  2786.   find the hw_info structure.  You'll need to create a new entry for
  2787.   your card.  The first field is the memory offset.  The next three
  2788.   fields are the first three bytes of the hardware address.  The final
  2789.   field contains some flags for specific card features; to start, try
  2790.   setting it to 0.
  2791.  
  2792.   After editing pcnet_cs.c, compile and install the new module.  Edit
  2793.   /etc/pcmcia/config again, and change the card binding from memory_cs
  2794.   to pcnet_cs.  Follow the instructions for reloading the config file,
  2795.   and you should be all set.  Please send me copies of your new hw_info
  2796.   and config entries.
  2797.  
  2798.   If you can't find your card's hardware address in the hex dump, as a
  2799.   method of last resort, it is possible to ``hard-wire'' the address
  2800.   when the pcnet_cs module is initialized.  Edit /etc/pcmcia/config.opts
  2801.   and add a hw_addr= option, like so:
  2802.  
  2803.  
  2804.  
  2805.        module "pcnet_cs" opts "hw_addr=0x00,0x80,0xc8,0x01,0x02,0x03"
  2806.  
  2807.  
  2808.  
  2809.  
  2810.   Substitute your own card's hardware address in the appropriate spot,
  2811.   of course.  Beware that if you've gotten this far, it is very unlikely
  2812.   that your card is genuinely NE2000 compatible.  In fact, I'm not sure
  2813.   if there are any cards that are not handled by one of the first two
  2814.   methods.
  2815.  
  2816.  
  2817.   6.3.  PCMCIA floppy interface cards
  2818.  
  2819.   The PCMCIA floppy interface used in the Compaq Aero and a few other
  2820.   laptops is not yet supported by this package.  The snag in supporting
  2821.   the Aero floppy is that the Aero seems to use a customized PCMCIA
  2822.   controller to support DMA to the floppy.  Without knowing exactly how
  2823.   this is done, there isn't any way to implement support under Linux.
  2824.  
  2825.   If the floppy adapter card is present when an Aero is booted, the Aero
  2826.   BIOS will configure the card, and Linux will identify it as a normal
  2827.   floppy drive.  When the Linux PCMCIA drivers are loaded, they will
  2828.   notice that the card is already configured and attached to a Linux
  2829.   driver, and this socket will be left alone.  So, the drive can be used
  2830.   if it is present at boot time, but the card is not hot swappable.
  2831.  
  2832.  
  2833.   6.4.  What's up with support for Xircom cards?
  2834.  
  2835.   A driver for Xircom ethernet and ethernet/modem cards is included in
  2836.   the current PCMCIA package, thanks to the work of Werner Koch.  I've
  2837.   set up a HyperNews forum specifically for discussion of Xircom driver
  2838.   development, at
  2839.   <http://hyper.stanford.edu/HyperNews/get/pcmcia/xircom.html>.
  2840.  
  2841.   For a long time, Xircom cards were not supported because Xircom had a
  2842.   company policy of not disclosing technical information about their
  2843.   cards.  However, they have relaxed their rules, and now, they do
  2844.   distribute driver information.
  2845.  
  2846.  
  2847.   7.  Debugging tips and programming information
  2848.  
  2849.   7.1.  Submitting useful bug reports
  2850.  
  2851.   The best way to submit bug reports is to use the HyperNews message
  2852.   lists on the Linux PCMCIA information site.  That way, other people
  2853.   can see current problems (and fixes or workarounds, if available).
  2854.   Here are some things that should be included in all bug reports:
  2855.  
  2856.  
  2857.   ╖  Your system type, and the output of the probe command.
  2858.  
  2859.   ╖  What PCMCIA cards you are using.
  2860.  
  2861.   ╖  Your Linux kernel version, and PCMCIA driver version.
  2862.  
  2863.   ╖  Any changes you have made to the startup files in /etc/pcmcia, or
  2864.      to the PCMCIA startup script.
  2865.  
  2866.   ╖  All PCMCIA-related messages in your system log file.
  2867.  
  2868.   All the PCMCIA modules and the cardmgr daemon send status messages to
  2869.   the system log.  This will usually be something like /var/log/messages
  2870.   or /usr/adm/messages.  This file should be the first place to look
  2871.   when tracking down a problem.  When submitting a bug report, always
  2872.   include the contents of this file.  If you are having trouble finding
  2873.   your system messages, check /etc/syslogd.conf to see how different
  2874.   classes of messages are handled.
  2875.  
  2876.   Before submitting a bug report, please check to make sure that you are
  2877.   using an up-to-date copy of the driver package.  While it is somewhat
  2878.   gratifying to read bug reports for things I've already fixed, it isn't
  2879.   a particularly constructive use of my time.
  2880.  
  2881.   If your problem involves a kernel fault, the register dump from the
  2882.   fault is only useful if you can track down the fault address, EIP.  If
  2883.   it is in the main kernel, look up the address in System.map to
  2884.   identify the function at fault.  If the fault is in a loadable module,
  2885.   it is a bit harder to trace.  With the current module tools, ``ksyms
  2886.   -m'' will report the base address of each loadable module.  Pick the
  2887.   module that contains the EIP address, and subtract its base address
  2888.   from EIP to get an offset inside that module.  Then, run gdb on that
  2889.   module, and look up the offset with the list command.  This will only
  2890.   work if you've compiled that module with -g to include debugging
  2891.   information.
  2892.  
  2893.   If you do not have web access, bug reports can be sent to me at
  2894.   dhinds@hyper.stanford.edu.  However, I prefer that bug reports be
  2895.   posted to my web site, so that they can be seen by others.
  2896.  
  2897.  
  2898.   7.2.  Low level PCMCIA debugging aids
  2899.  
  2900.   The PCMCIA modules contain a lot of conditionally-compiled debugging
  2901.   code.  Most of this code is under control of the PCMCIA_DEBUG
  2902.   preprocessor define.  If this is undefined, debugging code will not be
  2903.   compiled.  If set to 0, the code is compiled but inactive.  Larger
  2904.   numbers specify increasing levels of verbosity.  Each module built
  2905.   with PCMCIA_DEBUG defined will have an integer parameter, pc_debug,
  2906.   that controls the verbosity of its output.  This can be adjusted when
  2907.   the module is loaded, so output can be controlled on a per-module
  2908.   basis without recompiling.
  2909.  
  2910.   Your default configuration for syslogd may discard kernel debugging
  2911.   messages.  To ensure that they are recorded, edit /etc/syslog.conf to
  2912.   ensure that ``kern.debug'' messages are recorded somewhere.  See ``man
  2913.   syslog.conf'' for details.
  2914.  
  2915.   There are a few debugging tools in the debug_tools/ subdirectory of
  2916.   the PCMCIA distribution.  The dump_tcic and dump_i365 utilities
  2917.   generate complete register dumps of the PCMCIA controllers, and decode
  2918.   a lot of the register information.  They are most useful if you have
  2919.   access to a datasheet for the corresponding controller chip.  The
  2920.   dump_cis utility (dump_tuples in pre-3.0.2 distributions) lists the
  2921.   contents of a card's CIS (Card Information Structure), and decodes
  2922.   some of the important bits.  And the dump_cisreg utility displays a
  2923.   card's local configuration registers.
  2924.  
  2925.   The memory_cs memory card driver is also sometimes useful for
  2926.   debugging problems with 16-bit PC Cards.  It can be bound to any card,
  2927.   and does not interfere with other drivers.  It can be used to directly
  2928.   access any card's attribute memory or common memory.  Similarly for
  2929.   CardBus cards, the memory_cb driver can be bound to any 32-bit card,
  2930.   to give direct access to that card's address spaces.  See the man
  2931.   pages for more information.
  2932.  
  2933.  
  2934.   7.3.  /proc/bus/pccard
  2935.  
  2936.   Starting with 2.1.103 kernels, the PCMCIA package will create a tree
  2937.   of status information under /proc/bus/pccard.  The memory entry shows
  2938.   memory allocations for PC Card devices in a format similar to
  2939.   /proc/ioports.  Each socket also has its own subdirectory of status
  2940.   entries.  The info entry identifies the host controller and describes
  2941.   its capabilities.  The exca entry is a dump of the ``ExCA'' Intel
  2942.   i82365sl-compatible register set for that socket.  For CardBus
  2943.   bridges, the pci entry is a dump of the bridge's PCI configuration
  2944.   space, and the cardbus entry is a dump of the CardBus configuration
  2945.   registers.
  2946.  
  2947.  
  2948.   7.4.  Writing Card Services drivers for new cards
  2949.  
  2950.   The Linux PCMCIA Programmer's Guide is the best documentation for the
  2951.   client driver interface.  The latest version is always available from
  2952.   hyper.stanford.edu in /pub/pcmcia/doc, or on the web at
  2953.   <http://hyper.stanford.edu/HyperNews/get/pcmcia/home.html>.
  2954.  
  2955.   For devices that are close relatives of normal ISA devices, you will
  2956.   probably be able to use parts of existing Linux drivers.  In some
  2957.   cases, the biggest stumbling block will be modifying an existing
  2958.   driver so that it can handle adding and removing devices after boot
  2959.   time.  Of the current drivers, the memory card driver is the only
  2960.   ``self-contained'' driver that does not depend on other parts of the
  2961.   Linux kernel to do most of the dirty work.
  2962.  
  2963.   In many cases, the largest barrier to supporting a new card type is
  2964.   obtaining technical information from the manufacturer.  It may be
  2965.   difficult to figure out who to ask, or to explain exactly what
  2966.   information is needed.  However, with a few exceptions, it is very
  2967.   difficult if not impossible to implement a driver for a card without
  2968.   technical information from the manufacturer.
  2969.  
  2970.  
  2971.   I have written a dummy driver with lots of comments that explains a
  2972.   lot of how a driver communicates with Card Services; you will find
  2973.   this in the PCMCIA source distribution in modules/dummy_cs.c.
  2974.  
  2975.  
  2976.   7.5.  Guidelines for PCMCIA client driver authors
  2977.  
  2978.  
  2979.   I have decided that it is not really feasible for me to distribute all
  2980.   PCMCIA client drivers as part of the PCMCIA package.  Each new driver
  2981.   makes the main package incrementally harder to maintain, and including
  2982.   a driver inevitably transfers some of the maintenance work from the
  2983.   driver author to me.  Instead, I will decide on a case by case basis
  2984.   whether or not to include contributed drivers, based on user demand as
  2985.   well as maintainability.  For drivers not included in the core
  2986.   package, I suggest that driver authors adopt the following scheme for
  2987.   packaging their drivers for distribution.
  2988.  
  2989.   Driver files should be arranged in the same directory scheme used in
  2990.   the PCMCIA source distribution, so that the driver can be unpacked on
  2991.   top of a complete PCMCIA source tree.  A driver should include source
  2992.   files (in ./modules/), a man page (in ./man/), and configuration files
  2993.   (in ./etc/).  The top level directory should also include a README
  2994.   file.
  2995.  
  2996.   The top-level directory should include a makefile, set up so that
  2997.   ``make -f ... all'' and ``make -f ... install'' compile the driver and
  2998.   install all appropriate files.  If this makefile is given an extension
  2999.   of .mk, then it will automatically be invoked by the top-level
  3000.   Makefile for the all and install targets.  Here is an example of how
  3001.   such a makefile could be constructed:
  3002.  
  3003.  
  3004.  
  3005.        # Sample Makefile for contributed client driver
  3006.        FILES = sample_cs.mk README.sample_cs \
  3007.                modules/sample_cs.c modules/sample_cs.h \
  3008.                etc/sample etc/sample.opts man/sample_cs.4
  3009.        all:
  3010.                $(MAKE) -C modules MODULES=sample_cs.o
  3011.        install:
  3012.                $(MAKE) -C modules install-modules MODULES=sample_cs.o
  3013.                $(MAKE) -C etc install-clients CLIENTS=sample
  3014.                $(MAKE) -C man install-man4 MAN4=sample_cs.4
  3015.        dist:
  3016.                tar czvf sample_cs.tar.gz $(FILES)
  3017.  
  3018.  
  3019.  
  3020.  
  3021.   This makefile uses install targets defined in 2.9.10 and later
  3022.   versions of the PCMCIA package.  This makefile also includes a
  3023.   ``dist'' target for the convenience of the driver author.  You would
  3024.   probably want to add a version number to the final package filename
  3025.   (for example, sample_cs-1.5.tar.gz).  A complete distribution could
  3026.   look like:
  3027.  
  3028.  
  3029.  
  3030.  
  3031.  
  3032.  
  3033.  
  3034.  
  3035.  
  3036.  
  3037.   sample_cs.mk
  3038.   README.sample_cs
  3039.   modules/sample_cs.c
  3040.   modules/sample_cs.h
  3041.   etc/sample
  3042.   etc/sample.opts
  3043.   man/sample_cs.4
  3044.  
  3045.  
  3046.  
  3047.  
  3048.   With this arrangement, when the contributed driver is unpacked, it
  3049.   becomes essentially part of the PCMCIA source tree.  It can make use
  3050.   of the PCMCIA header files, as well as the machinery for checking the
  3051.   user's system configuration, and automatic dependency checking, just
  3052.   like a ``normal'' client driver.
  3053.  
  3054.   I will accept client drivers prepared according to this specification
  3055.   and place them in the /pub/pcmcia/contrib directory on my FTP server,
  3056.   hyper.stanford.edu.  The README in this directory will describe how to
  3057.   unpack a contributed driver.
  3058.  
  3059.   The client driver interface has not changed much over time, and has
  3060.   almost always preserved backwards compatibility.  A client driver will
  3061.   not normally need to be updated for minor revisions in the main
  3062.   package.  I will try to notify authors of contributed drivers of
  3063.   changes that require updates to their drivers.
  3064.  
  3065.  
  3066.   7.6.  Guidelines for Linux distribution maintainers
  3067.  
  3068.  
  3069.   If your distribution has system configuration tools that you would
  3070.   like to be PCMCIA-aware, please use the *.opts files in /etc/pcmcia
  3071.   for your ``hooks.''  These files will not be modified if a user
  3072.   compiles and installs a new release of the PCMCIA package.  If you
  3073.   modify the main configuration scripts, then a fresh install will
  3074.   silently overwrite your custom scripts and break the connection with
  3075.   your configuration tools.  Contact me if you are not sure how to write
  3076.   an appropriate option script.
  3077.  
  3078.   It is helpful for users (and for me) if you can document how your
  3079.   distribution deviates from the PCMCIA package as described in this
  3080.   document.  In particular, please document changes to the startup
  3081.   script and configuration scripts.  If you send me the appropriate
  3082.   information, I will include it in the ``Notes about specific Linux
  3083.   distributions''.
  3084.  
  3085.   When building PCMCIA for distribution, consider including contributed
  3086.   drivers that are not part of the main PCMCIA package.  For reasons of
  3087.   maintainability, I am trying to limit the core package size, by only
  3088.   adding new drivers if I think they are of particularly broad interest.
  3089.   Other drivers will be distributed separately, as described in the
  3090.   previous section.  The split between integral and separate drivers is
  3091.   somewhat arbitrary and partly historical, and should not imply a
  3092.   difference in quality.
  3093.  
  3094.  
  3095.  
  3096.  
  3097.  
  3098.  
  3099.  
  3100.  
  3101.  
  3102.  
  3103.