home *** CD-ROM | disk | FTP | other *** search
/ Serving the Web / ServingTheWeb1995.disc1of1.iso / linux / howto / pcmcia-h < prev    next >
Encoding:
Text File  |  1995-03-23  |  33.3 KB  |  838 lines

  1.   Linux    PCMCIA HOWTO
  2.   David    Hinds, dhinds@allegro.stanford.edu
  3.   v1.27, 1995/03/06 20:05:31
  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 cb-iris.stanford.edu
  8.   in /pub/pcmcia/doc.
  9.  
  10.   1.  General information and hardware requirements
  11.  
  12.   1.1.    Introduction
  13.  
  14.   Card Services    for Linux is a complete    PCMCIA support package.     It
  15.   includes a set of loadable kernel modules that implement a version of
  16.   the PCMCIA Card Services applications    program    interface, a set of
  17.   client drivers for specific cards, and a card    manager    daemon that can
  18.   respond to card insertion and    removal    events,    loading    and unloading
  19.   drivers on demand.  It supports ``hot    swapping'' of PCMCIA cards, so
  20.   cards    can be inserted    and ejected at any time.
  21.  
  22.   This is beta software.  It probably contains bugs, and should    be used
  23.   with caution.     I'll do my best to fix    problems that are reported to
  24.   me, but if you don't tell me,    I may never know.  If you use this code,
  25.   I hope you will send me your experiences, good or bad!
  26.  
  27.   If you have any suggestions for how this document could be improved,
  28.   please let me    know (dhinds@allegro.stanford.edu).
  29.  
  30.  
  31.  
  32.   1.2.    Copyright notice and disclaimer
  33.  
  34.   Copyright (c)    1995 David A. Hinds
  35.  
  36.   This document    may be reproduced or distributed in any    form without my
  37.   prior    permission.  Parts of this document may    be distributed,    provided
  38.   that this copyright message and a pointer to the complete document are
  39.   included.  Specifically, it may be included in commercial
  40.   distributions    without    my prior consent.  However, I would like to be
  41.   informed of such usage.
  42.  
  43.   This document    may be translated into any language, provided this
  44.   copyright statement is left intact.
  45.  
  46.   This document    is provided ``as is'', with no explicit    or implied
  47.   warranties.  Use the information in this document at your own    risk.
  48.  
  49.  
  50.   1.3.    What is    the latest version, and    where can I get    it?
  51.  
  52.   The current release of Card Services is version 2.4.8.
  53.  
  54.   The latest version is    always available from cb-iris.stanford.edu in
  55.   the /pub/pcmcia directory.  There will sometimes be several versions
  56.   here.     In that case, the oldest version should be more stable, and
  57.   newer    versions generally contain more    experimental code.  It is up to
  58.   you to decide    which version is more appropriate, but the CHANGES file
  59.   will summarize the most important differences.
  60.  
  61.   cb-iris.stanford.edu is mirrored at sunsite.unc.edu in
  62.   /pub/Linux/kernel/pcmcia.  I'll also try to upload major releases to
  63.   tsx-11.mit.edu under /pub/linux/laptops/pcmcia/drivers now and then.
  64.  
  65.  
  66.  
  67.   1.4.    What systems are supported?
  68.  
  69.   This code should run on almost any Linux-capable laptop.  All    common
  70.   PCMCIA controllers are supported, including Intel, Cirrus, Vadem,
  71.   VLSI,    and Databook chips.  Custom controllers    used in    IBM and    Toshiba
  72.   laptops are also supported.  Several people use the package on desktop
  73.   systems with PCMCIA card adapters.
  74.  
  75.   The Motorola 6AHC05GA    controller used    in some    Hyundai    laptops    is not
  76.   supported.
  77.  
  78.  
  79.   1.5.    What PCMCIA cards are supported?
  80.  
  81.   The current release includes drivers for a variety of    ethernet cards,
  82.   a driver for modem and serial    port cards, several SCSI adapter
  83.   drivers, and a simple    memory card driver that    should support most SRAM
  84.   cards    and read-only access to    Flash cards.  The SUPPORTED.CARDS file
  85.   included with    each release of    Card Services lists all    cards that are
  86.   known    to work    in at least one    actual system.
  87.  
  88.  
  89.   1.6.    When will card X be supported?
  90.  
  91.   Unfortunately, they don't pay    me to write device drivers, so if you'd
  92.   like to have a driver    for your favorite card,    you're probably    going to
  93.   have to do some of the work on your own.  The    SUPPORTED.CARDS    file
  94.   mentions some    cards for which    driver work is currently in progress.  I
  95.   will try to help where I can.
  96.  
  97.  
  98.   1.7.    Mailing    list
  99.  
  100.   I maintain a database    and mailing list of Linux PCMCIA users.     This is
  101.   used to announce new releases    of the PCMCIA package.    If you would
  102.   like to be included, send me the following:
  103.  
  104.  
  105.   o  Your name and email address
  106.  
  107.   o  What kind of laptop are you using?
  108.  
  109.   o  What PCMCIA controller is reported    by the probe command?
  110.  
  111.   o  What PCMCIA cards are you using?
  112.  
  113.   o  Any special settings you use: compilation options,    irq and    port
  114.      settings, /etc/pcmcia/config entries, insmod options, etc.
  115.  
  116.  
  117.   2.  Compilation, installation, and configuration
  118.  
  119.   2.1.    Prerequisites and kernel setup
  120.  
  121.   For the latest version, you will need    to have    kernel version 1.1.93 or
  122.   higher.  There are no    kernel patches specifically for    PCMCIA support.
  123.   You'll also need to have a relatively    recent set of module utilities.
  124.   If your man page for insmod describes    the [symbol=value ...]    syntax,
  125.   your utilities are current enough.
  126.  
  127.   You need to have a complete linux source tree    for your kernel, not
  128.   just an up-to-date kernel image, when    you compile the    PCMCIA package.
  129.   The PCMCIA modules contain some references to    kernel source files.
  130.  
  131.   Current kernel sources and patches are available from    sunsite.unc.edu
  132.   in /pub/Linux/kernel/v1.1, or    from tsx-11.mit.edu in
  133.   /pub/linux/sources/system/v1.1.  Current module utilities can    be found
  134.   in the same places, in the file modules-1.1.87.tgz.
  135.  
  136.   When configuring your    kernel,    if you plan on using a PCMCIA ethernet
  137.   card,    you should turn    on networking support but turn off the normal
  138.   Linux    network    card drivers, including    the ``pocket and portable
  139.   adapters''.  The PCMCIA network card drivers are all implemented as
  140.   loadable modules.  All of the    PCMCIA net drivers except the 3Com 3c589
  141.   driver depend    on the 8390.o driver module which is part of the Linux
  142.   kernel.
  143.  
  144.   If you want to use SLIP, PPP,    or PLIP, you do    need to    either configure
  145.   your kernel with these enabled, or use the loadable module versions of
  146.   these    drivers.  There    is an unfortunate deficiency in    the kernel
  147.   config process, in that it is    not possible to    set configuration
  148.   options (like    SLIP compression) for a    loadable module, so it is
  149.   probably better to just link SLIP into the kernel if you need    it.
  150.  
  151.   If you will be using a PCMCIA    SCSI adapter, you should enable
  152.   CONFIG_SCSI when configuring your kernel.  Also, enable any top level
  153.   drivers (SCSI    disk, tape, cdrom, generic) that you expect to use.  All
  154.   low-level drivers for    particular host    adapters should    be disabled.
  155.   There    is currently a bad interaction between the SCSI    modules    and
  156.   CONFIG_MODVERSIONS, so you will need to disable this option if you
  157.   plan to use one of these cards.
  158.  
  159.   For recent kernels, you must explicitly do ``make modules'' followed
  160.   by ``make modules_install'' in /usr/src/linux    to build the loadable
  161.   driver modules.  They    will be    installed under    /lib/modules.
  162.  
  163.  
  164.   2.2.    Installation
  165.  
  166.   Starting with    release    2.4.8, this package includes an    X-based    card
  167.   status utility called    cardinfo.  This    utility    is based on a public
  168.   domain user interface    toolkit    called the Forms Library, which    you will
  169.   need to install before building cardinfo.  A binary distribution is on
  170.   cb-iris.stanford.edu in /pub/pcmcia/extras/bxform-3.1.tgz.
  171.  
  172.   Unpack the pcmcia-cs-2.4.8.tgz package in a convenient location, like
  173.   /usr/src.
  174.  
  175.   Make sure the    definitions in make.options are    consistent with    your
  176.   site setup.  Running ``make prereq'' will check your system
  177.   configuration    to verify that it satisfies all    prerequisites for
  178.   installing PCMCIA support.
  179.  
  180.   Running ``make all'' followed    by ``make install'' will build and then
  181.   install the kernel modules and utility programs.  Kernel modules are
  182.   installed under /lib/modules/<version>/pcmcia.  The cardmgr and
  183.   cardctl programs are installed in /sbin.  If cardinfo    is built, it is
  184.   installed in /usr/bin/X11.
  185.  
  186.   Configuration    files are kept in the /etc/pcmcia directory: do    ``make
  187.   install-etc''    to set up this directory.  If you are installing over an
  188.   older    version, the new config    files will be installed    with a ``.N''
  189.   suffix -- you    should replace or update your existing files by    hand.
  190.   Finally, ``make install-man''    will install man pages for all the
  191.   loadable modules and programs.
  192.  
  193.   If you don't know what kind of PCMCIA    controller chip    you have, you
  194.   can use the probe utility in the cardmgr/ subdirectory to determine
  195.   this.     There are two major types: the    Databook TCIC-2    type and the
  196.   Intel    i82365SL-compatible type.
  197.  
  198.  
  199.   A user-level daemon processes    card insertion and removal events.  This
  200.   is called cardmgr.  It is similar in function    to Barry Jaspan's
  201.   pcmciad in earlier PCMCIA releases.  Cardmgr reads a configuration
  202.   file describing known    PCMCIA cards from /etc/pcmcia/config.  This file
  203.   also specifies what resources    can be allocated for use by PCMCIA
  204.   devices, and may need    to be customized for your system.  See the
  205.   pcmcia man page for more information about this file.
  206.  
  207.   The script rc.pcmcia,    installed in /etc/rc.d,    controls starting up and
  208.   shutting down    the PCMCIA system.  ``make install-etc'' will use the
  209.   probe    command    to determine your controller type and modify rc.pcmcia
  210.   appropriately.  You should add a line    to your    system startup file
  211.   /etc/rc.d/rc.M to invoke this:
  212.  
  213.  
  214.  
  215.            /etc/rc.d/rc.pcmcia start
  216.  
  217.  
  218.  
  219.  
  220.   If you are using a PCMCIA ethernet card, you should not try to
  221.   configure it in /etc/rc.d/rc.inet1, since the    card may not be    present
  222.   when this script is executed.     Comment out everything    except the
  223.   loopback stuff in rc.inet1 and instead edit the /etc/pcmcia/network
  224.   script to match your local network setup.  This script will be
  225.   executed only    when your ethernet card    is actually present.
  226.  
  227.  
  228.   2.3.    Site-specific configuration options
  229.  
  230.   Card Services    should automatically avoid allocating IO ports and
  231.   interrupts already in    use by other standard devices.    This should work
  232.   for any devices that have Linux drivers, like    serial and parallel
  233.   ports, IDE drives, and some sound cards.  If a device    is unsupported
  234.   by Linux, you    may need to explicitly exclude the resources it    uses in
  235.   /etc/pcmcia/config.
  236.  
  237.   Some PCMCIA controllers have optional    features that may or may not be
  238.   implemented in a particular system.  It is generally impossible for a
  239.   socket driver    to detect if these features are    implemented.  Check the
  240.   man page for your driver to see what optional    features may be    enabled.
  241.  
  242.   The low level    socket drivers,    tcic and i82365, have numerous bus
  243.   timing parameters that may need to be    adjusted for systems with
  244.   particularly fast processors.     Symptoms of timing problems include
  245.   lock-ups under heavy loads, high error rates,    or poor    device
  246.   performance.    Check the corresponding    man pages for more details, but
  247.   here is a brief summary:
  248.  
  249.  
  250.   o  Cirrus controllers    have numerous configurable timing parameters.
  251.      The most important    is the freq_bypass flag    which changes the
  252.      multiplier    for the    PCMCIA bus clock to slow down all operations.
  253.  
  254.   o  The Cirrus    CL6729 PCI controller has the fast_pci flag, which
  255.      should be set if the PCI bus speed    is greater than    25 MHz.
  256.  
  257.   o  For Vadem VG-468 controllers and Databook TCIC-2 controllers, the
  258.      async_clock flag changes the relative clocking of PCMCIA bus and
  259.      host bus cycles.  Setting this flag adds extra wait states    to some
  260.      operations.
  261.  
  262.   All these options should be configured by modifying the top of
  263.   /etc/rc.d/rc.pcmcia.    For example:
  264.  
  265.        # Should    be either i82365 or tcic
  266.        PCIC=i82365
  267.        # Put socket driver timing parameters here
  268.        OPTS="async_clock=1"
  269.  
  270.  
  271.  
  272.  
  273.  
  274.   2.4.    Can I install Linux via    NFS with a PCMCIA network card?
  275.  
  276.   I've created a set of    1.44MB boot and    root disks with    PCMCIA support
  277.   for the Slackware 2.1    distribution.  The files are pcboot14.gz and
  278.   pcroot14.gz on cb-iris.stanford.edu and sunsite.unc.edu (see section
  279.   ``1.3'').  The root disk includes cardmgr, the core PCMCIA modules,
  280.   and all the network drivers.    As for how to use these, you should
  281.   familiarize yourself with the    Slackware installation instructions,
  282.   available from the usual FTP sites.  The PCMCIA drivers will be loaded
  283.   automatically, and installation will be the same as for a non-PCMCIA
  284.   net card.  Note that Slackware root disks do not include any normal
  285.   user-level network utilities (ftp, telnet, etc).  They only include
  286.   enough network support to establish an NFS mount.
  287.  
  288.   After    installation is    complete, you'll have a    non-PCMCIA setup on your
  289.   root disk.  It is possible to    copy things from the boot and root disks
  290.   to get a working network setup, but it is tricky to put everything in
  291.   the right places by hand.  First, with the boot disk mounted on /mnt,
  292.   do:
  293.  
  294.  
  295.  
  296.        cp /mnt/vmlinuz /linuz
  297.        rootflags /vmlinuz 1
  298.        lilo
  299.  
  300.  
  301.  
  302.  
  303.   Then,    with the root disk mounted on /mnt, do:
  304.  
  305.  
  306.  
  307.        cp /mnt/sbin/cardmgr /sbin
  308.        (cd /mnt    ; tar cf - etc/pcmcia lib/modules) | (cd / ; tar xf -)
  309.  
  310.  
  311.  
  312.  
  313.   Edit /etc/pcmcia/config and un-comment the ``start'' and ``stop''
  314.   commands for the net cards, and edit /etc/pcmcia/network to conform to
  315.   your network setup.
  316.  
  317.   Alternatively, if your install server    has a current set of source
  318.   files, you can copy current kernel sources, pcmcia sources, and module
  319.   utilities to your hard disk while it is NFS mounted.    Then, after
  320.   rebooting, build a new kernel    and install the    PCMCIA software    as
  321.   normal.
  322.  
  323.  
  324.   2.5.    When I load the    sample drv_hello.o module, I get ``___moddi3
  325.   undefined''.    What's wrong?
  326.  
  327.   Nothing, really.  The    drv_hello module uses a    ``modulo'' operator that
  328.   gcc handles by calling a built-in function normally supplied by the
  329.   libgcc library.  Since the module isn't linked against this library,
  330.   it results in    an unresolved reference.  Your module utilities    are
  331.   fine.
  332.  
  333.  
  334.   2.6.    Why does insmod    complain about undefined symbols?
  335.  
  336.   If pcmcia_core.o loads fine, but loading i82365.o or tcic.o fails with
  337.   undefined symbols like ``_check_resource'' and ``_register_ss_entry'',
  338.   your module utilities    (insmod, lsmod,    etc) are out of    date.  See
  339.   section ``2.1'' for more information.
  340.  
  341.   If you see a message like ``_kernel_version undefined'' or
  342.   ``_init_module undefined'' when loading a module that    is part    of the
  343.   Linux    kernel (like 8390.o), the object file was not compiled as a
  344.   loadable module.  Make sure you followed all the kernel configuration
  345.   instructions in section ``2.1''.
  346.  
  347.  
  348.   2.7.    Why doesn't my system respond to card insertions?
  349.  
  350.   The most likely reason is that there is a conflict on    the interrupt
  351.   line being used to signal card status    changes.  Check
  352.   /usr/adm/messages to see what    interrupt is being used    by the low level
  353.   driver (i82365.o or tcic.o).    Unload the PCMCIA modules and re-load
  354.   this module with a cs_irq=# option to    select a different value.  See
  355.   the man pages    for i82365 and tcic for    the lists of valid choices.  If
  356.   you can't find an interrupt number that works, there is also a polled
  357.   status mode: turn this on with a poll_interval=100 option to insmod,
  358.   to poll once per second.
  359.  
  360.  
  361.   3.  Usage and    features
  362.  
  363.   3.1.    How do I tell if it is working?
  364.  
  365.   The cardmgr daemon normally beeps when a card    is inserted, and the
  366.   tone of the beeps indicates the status of the    newly inserted card.
  367.   Two high beeps indicate the card was identified and configured
  368.   successfully.     A high    beep followed by a lower beep indicates    that the
  369.   card was identified, but could not be    configured for some reason.  One
  370.   low beep indicates that the card could not be    identified.
  371.  
  372.   If you are running X,    the new    cardinfo utility produces a slick
  373.   graphical display showing the    current    status of all PCMCIA sockets.
  374.  
  375.   If the modules are all loaded    correctly, the output of the lsmod
  376.   command should look like the following, with no cards    inserted:
  377.  
  378.  
  379.  
  380.        Module:          #pages:  Used by:
  381.        ds          2
  382.        i82365          2
  383.        pcmcia_core      4    [ds i82365]
  384.  
  385.  
  386.  
  387.  
  388.   All the PCMCIA modules and the cardmgr daemon    send status messages to
  389.   the system log.  This    will usually be    /usr/adm/messages.  This file
  390.   should be the    first place you    look when tracking down    a problem.  When
  391.   submitting a bug report, you should always include the contents of
  392.   this file.  Cardmgr also records some    current    device information for
  393.   each socket in /etc/stab.
  394.  
  395.  
  396.  
  397.   3.2.    How do I tell cardmgr how to identify a    new card?
  398.  
  399.   Assuming that    your card is supported by an existing driver, all that
  400.   needs    to be done is to add an    entry to /etc/pcmcia/config to tell
  401.   cardmgr how to identify the card, and    which driver(s)    need to    be
  402.   linked up to this card.  Check the man page for pcmcia for more
  403.   information about the    config file format.  If    you insert an unknown
  404.   card,    cardmgr    will normally record some identification information in
  405.   /usr/adm/messages that can be    used to    construct the config entry.
  406.  
  407.   Here is an example of    how cardmgr will report    an unsupported card in
  408.   /usr/adm/messages.
  409.  
  410.  
  411.  
  412.        cardmgr[460]: unsupported card in socket    1
  413.        cardmgr[460]: version info: "MEGAHERTZ",    "XJ2288", "V.34    PCMCIA MODEM"
  414.  
  415.  
  416.  
  417.  
  418.   The corresponding entry in /etc/pcmcia/config    would be:
  419.  
  420.  
  421.  
  422.        card "Megahertz XJ2288 V.34 Fax Modem"
  423.      version "MEGAHERTZ", "XJ2288",    "V.34 PCMCIA MODEM"
  424.      bind "serial_cs"
  425.  
  426.  
  427.  
  428.  
  429.   You can use ``*'' to match strings that don't    need to    match exactly,
  430.   like version numbers.     When making new config    entries, be careful to
  431.   copy the strings exactly, preserving case and    blank spaces.  Also be
  432.   sure that the    config entry has the same number of strings as are
  433.   reported in the log file.
  434.  
  435.   After    editing    /etc/pcmcia/config, you    can signal cardmgr to reload the
  436.   file with:
  437.  
  438.  
  439.  
  440.        kill -HUP `cat /var/run/cardmgr.pid`
  441.  
  442.  
  443.  
  444.  
  445.   If you do set    up an entry for    a new card, please send    me a copy so
  446.   that I can include it    in sample.config.
  447.  
  448.  
  449.   3.3.    How do I control which interrupts and ports are    used by    a
  450.   device?
  451.  
  452.   In theory, it    should not really matter which interrupt is allocated to
  453.   which    device,    as long    as two devices are not configured to use the
  454.   same interrupt.  At the top of /etc/pcmcia/config you'll find    a place
  455.   for excluding    interrupts that    are used by non-PCMCIA devices.
  456.  
  457.   The ibmcc_cs,    de650_cs, 3c589_cs, and    serial_cs drivers each have a
  458.   parameter called irq_mask for    specifying which interrupts they may try
  459.   to allocate.    Each bit of irq_mask corresponds to one    irq line: bit 0
  460.   is irq 0, bit    1 is irq 1, and    so on.    So, a mask of 0x1100 would
  461.   correspond to    irq 8 and irq 12.  To limit a driver to    use only one
  462.   specific interrupt, its irq_mask should have only one    bit set.  These
  463.   driver options should    be set in your /etc/pcmcia/config file.     For
  464.   example:
  465.  
  466.  
  467.  
  468.        device "serial_cs"
  469.      module    "serial_cs" opts "irq_mask=0x1100"
  470.      ...
  471.  
  472.  
  473.  
  474.  
  475.   would    specify    that the serial    driver should only use irq 8 or    irq 12.
  476.   Note that Card Services will never allocate an interrupt that    is
  477.   already in use by another device, or an interrupt that is excluded in
  478.   the config file.
  479.  
  480.   There    is no way to directly specify the I/O addresses    for a PCMCIA
  481.   card to use.    The /etc/pcmcia/config file allows you to specify ranges
  482.   of ports available for use by    all PCMCIA devices.
  483.  
  484.   After    modifying /etc/pcmcia/config, you can restart cardmgr with
  485.   ``kill -HUP''.
  486.  
  487.  
  488.   3.4.    When is    it safe    to insert or eject a PCMCIA card?
  489.  
  490.   In theory, you can insert and    remove PCMCIA cards at any time.
  491.   However, it is a good    idea not to eject a card that is currently being
  492.   used by an application program.  Kernels older than 1.1.77 would often
  493.   lock up when serial/modem cards were ejected,    but this should    be fixed
  494.   now.
  495.  
  496.  
  497.   3.5.    How do I unload    PCMCIA drivers?
  498.  
  499.   To unload the    entire PCMCIA package, invoke rc.pcmcia    with:
  500.  
  501.  
  502.  
  503.        /etc/rc.d/rc.pcmcia stop
  504.  
  505.  
  506.  
  507.  
  508.   This script will take    several    seconds    to run,    to give    all client
  509.   drivers time to shut down gracefully.     If a PCMCIA device is currently
  510.   in use, the shutdown will fail.
  511.  
  512.  
  513.   3.6.    How does Card Services deal with suspend/resume?
  514.  
  515.   I've started to integrate APM    (Advanced Power    Management) support into
  516.   Card Services.  This is working with a slightly modified version of
  517.   Stephen Rothwell's APM support package.  Starting with the apm-0.4
  518.   package, replace kernel.patch    with apm-0.4.patch, available from cb-
  519.   iris.stanford.edu in /pub/pcmcia.
  520.  
  521.   Without resorting to APM, you    can do ``cardctl suspend'' before
  522.   suspending your laptop, and ``cardctl    resume'' after resuming, to
  523.   properly shut    down and restart your PCMCIA cards.  This will not work
  524.   with a PCMCIA    modem that is in use, because the serial driver    isn't
  525.   able to save and restore the modem operating parameters.
  526.  
  527.  
  528.  
  529.   3.7.    How do I turn off a PCMCIA card    without    ejecting it?
  530.  
  531.   Use either the cardctl or cardinfo command.  ``cardctl suspend #''
  532.   will suspend one socket, and turn off    its power.  The    corresponding
  533.   resume command will wake up the card in its previous state.
  534.  
  535.  
  536.   4.  Problems with specific cards
  537.  
  538.   4.1.    Why doesn't my modem work?
  539.  
  540.   That's a broad question, but here's a    quick troubleshooting guide.
  541.  
  542.  
  543.   o  Is    your card recognized as    a modem?  Check    /usr/adm/messages and
  544.      make sure that cardmgr identifies the card    correctly and starts up
  545.      the serial_cs driver.  If it doesn't, you may need    to add a new
  546.      entry to your /etc/pcmcia/config file so that it will be identified
  547.      properly.    See section ``3.2'' for    details.
  548.  
  549.   o  Is    the modem configured successfully by serial_cs?     Again,    check
  550.      /usr/adm/messages and look    for messages from the serial_cs    driver.
  551.      If    you see    ``register_serial() failed'', you may have an I/O port
  552.      conflict with another device.  Another tip-off of a conflict is if
  553.      the device    is reported to be an 8250; most    modern PCMCIA modems
  554.      should be identified as 16550A UART's.  If    you think you're seeing
  555.      a port conflict, edit /etc/pcmcia/config and exclude the port range
  556.      that was allocated    for the    modem.
  557.  
  558.   o  Is    there an interrupt conflict?  If /usr/adm/messages looks good,
  559.      but the modem just    doesn't    seem to    work, try using    setserial to
  560.      change the    irq to 0, and see if the modem works.  This causes the
  561.      serial driver to use a slower polled mode instead of using
  562.      interrupts.  If this seems    to fix the problem, it is likely that
  563.      some other    device in your system is using the interrupt selected by
  564.      serial_cs.     You should add    a line to /etc/pcmcia/config to    exclude
  565.      this interrupt.
  566.  
  567.   o  Make sure your problem is really a    PCMCIA one.  It    may help to see
  568.      see if the    card works under DOS with the vendor's drivers.     Also,
  569.      don't test    the card with something    complex    like SLIP until    you are
  570.      sure you can make simple connections.  If simple things work but
  571.      SLIP does not, your problem is with SLIP, not with    PCMCIA.
  572.  
  573.  
  574.   4.2.    Why does my Megahertz modem sometimes fail to work?
  575.  
  576.   This is an old problem that I    still have not been able to track down.
  577.   For some reason, Megahertz modems -- specifically, the 2144 model --
  578.   sometimes fail to get    initialized correctly, and get stuck in    an
  579.   unresponsive state.  A modem may be incorrectly identified as    an
  580.   ``anonymous memory card''.  If this happens, try using ``cardctl reset
  581.   #'' to re-initialize the card.  If this also fails, try using
  582.   ``cardctl suspend #''    followed by ``cardctl resume #'', then use the
  583.   reset    command.
  584.  
  585.   I've also received one report    from someone with a newer Megahertz
  586.   modem    that has a 16550-type UART.  He    says that he wasn't able to get
  587.   this modem to    work under Linux with cu until he configured the modem
  588.   with:
  589.  
  590.  
  591.  
  592.        echo 'ATS=QV1X4&C1&D2S95=2W1&K3S36=7S95=255' > /dev/modem
  593.  
  594.  
  595.   This initialization string was supplied by Megahertz tech support.
  596.  
  597.  
  598.   4.3.    Why doesn't my ethernet    card work?
  599.  
  600.   Here's another quick troubleshooting guide.
  601.  
  602.  
  603.   o  Is    your card recognized as    an ethernet card?  Check
  604.      /usr/adm/messages and make    sure that cardmgr identifies the card
  605.      correctly and starts up one of the    network    drivers.  If it    doesn't,
  606.      your card might still be usable if    it is compatible with a
  607.      supported card.  This will    be most    easily done if the card    claims
  608.      to    be "NE2000 compatible".
  609.  
  610.   o  Is    the card configured properly?  If you are using    a supported
  611.      card, and it was recognized by cardmgr, but still doesn't work,
  612.      there might be an interrupt or port conflict with another device.
  613.      Find out what resources the card is using (from /usr/adm/messages),
  614.      and try excluding these in    /etc/pcmcia/config to force the    card to
  615.      use something different.
  616.  
  617.   o  With Socket EA and    3Com 3c589 cards, you need to pick the
  618.      transceiver type (10base2,    10baseT, AUI) when the driver module is
  619.      loaded.  Make sure    that the transceiver type reported in
  620.      /usr/adm/messages matches your connection.
  621.  
  622.   o  The Farallon EtherWave is actually    based on the 3Com 3c589, with a
  623.      special transceiver.  Though the EtherWave    uses 10baseT-style
  624.      connections, its transceiver requires that    the 3c589 be configured
  625.      in    10base2    mode.
  626.  
  627.   o  Make sure your problem is really a    PCMCIA one.  It    may help to see
  628.      see if the    card works under DOS with the vendor's drivers.     Double
  629.      check your    modifications to the /etc/pcmcia/network script.  Make
  630.      sure your drop cable, ``T'' jack, terminator, etc are working.
  631.  
  632.   o  If    your card seems    to be configured properly, but sometimes locks
  633.      up, particularly under high load, you may need to try changing your
  634.      socket driver timing parameters.  See section ``2.3'' for more
  635.      information.
  636.  
  637.  
  638.   4.4.    How do I select    the transceiver    type for my 3c589 card?
  639.  
  640.   It would be nice if the driver could autodetect the difference between
  641.   a 10baseT and    a 10base2 connection, but I don't know how to do that.
  642.   For now, you need to edit /etc/pcmcia/config and add an if_ports=#
  643.   option to the    3c589_cs module    definition.  Check the tc589_cs    man page
  644.   for more details, but    to select 10base2 (also    known as BNC, or thin
  645.   net, or coax), change:
  646.  
  647.  
  648.  
  649.        module "3c589_cs"
  650.  
  651.  
  652.  
  653.  
  654.   to:
  655.  
  656.  
  657.  
  658.        module "3c589_cs" opts "if_port=3"
  659.  
  660.  
  661.   4.5.    My network performance stinks.    What can I do?
  662.  
  663.   If you have an NE4100    or IBM CCAE adapter, increase the memory access
  664.   time with the    mem_speed=# option to the ibmcc_cs module definition.
  665.   Try speeds of    up to 1000 (in nanoseconds).
  666.  
  667.   For other cards, you may need    to try changing    your socket driver
  668.   timing parameters.  Check the    man page for your socket driver    (i82365
  669.   or tcic) to see what parameters are available.
  670.  
  671.  
  672.   4.6.    How do I add support for an NE2000-compatible ethernet card?
  673.  
  674.   First, see if    the card is already recognized by cardmgr.  Some cards
  675.   not listed in    SUPPORTED_CARDS    are actually OEM versions of cards that
  676.   are supported.  If you find a    card like this,    let me know so I can add
  677.   it to    the list.
  678.  
  679.   If it    is not recognized, cardmgr will    normally bind the ``memory
  680.   card'' driver    to the card.  Check your system    log to verify this,
  681.   because you'll need to use this driver.  You will also need to know
  682.   your card's hardware ethernet    address.  This address is a series of
  683.   six two-digit    hex numbers, often printed on the card itself.    If it is
  684.   not printed on the card, you may be able to use a DOS    driver to
  685.   display the address.    In any case, once you know it, run:
  686.  
  687.  
  688.  
  689.        dd if=/dev/pcmem0a count=20 | od    -Ax -t x1
  690.  
  691.  
  692.  
  693.  
  694.   and search the output    for your address.  Record the hex offset of the
  695.   first    byte of    the address.  Now, edit    modules/de650_cs.c and find the
  696.   hw_info structure.  You'll need to create a new entry    for your card.
  697.   The first field is the offset    multiplied by two.  The    next three
  698.   fields are the first three bytes of the hardware address.  The final
  699.   field    is just    a descriptive name.
  700.  
  701.   After    editing    de650_cs, install the new module.  Edit
  702.   /etc/pcmcia/config and create    an entry for your card.     See section
  703.   ``3.2'' for details.    And please send    me copies of your new hw_info
  704.   and config entries.
  705.  
  706.  
  707.   4.7.    How do I use my    PCMCIA floppy interface?
  708.  
  709.   The PCMCIA floppy interface used in the Compaq Aero and a few    other
  710.   laptops is not yet supported by this package.     If your laptop    can
  711.   initialize this card before Linux boots, you should be able to use it
  712.   by telling Card Services to ignore that socket.  Note    that you will
  713.   not be able to hot swap this card.
  714.  
  715.   To configure Card Services to    ignore a socket, use the ignore=#
  716.   parameter when you load the i82365 or    tcic driver.  See the man pages
  717.   for more details.
  718.  
  719.  
  720.   4.8.    What's up with support for Xircom cards?
  721.  
  722.   Xircom does not share    technical information about its    cards without a
  723.   non-disclosure agreement.  This means    that it    is not really possible
  724.   to develop freely distributable drivers for Xircom cards without doing
  725.   legally dubious things like reverse engineering DOS drivers.    Unless
  726.   their    policy changes,    it is doubtful that Linux drivers for Xircom
  727.   products will    ever become available.
  728.  
  729.  
  730.   4.9.    What's up with support for SCSI    adapters?
  731.  
  732.   The Qlogic FastSCSI and New Media Bus    Toaster    cards now work under
  733.   Card Services.  As of    1.1.81,    the Linux kernel supports loadable SCSI
  734.   driver modules, but you should try to    use the    latest available kernel.
  735.  
  736.   Be very careful about    ejecting a SCSI    adapter.  Be sure that all
  737.   associated SCSI devices are unmounted    and closed before ejecting the
  738.   card.     For now, all SCSI devices should be powered up    before plugging
  739.   in a SCSI adapter, and should    stay connected until after you unplug
  740.   the adapter and/or power down    your laptop.
  741.  
  742.   Roger    Pao (rpao@paonet.org) adds:
  743.  
  744.   Make sure there is a device capable of supplying termination power
  745.   both to the terminating target device    and to the PCMCIA SCSI card.
  746.   This is vitally important as most PCMCIA SCSI    cards do not supply
  747.   termination power to its own terminators nor to the SCSI bus.     This is
  748.   usually to save laptop battery power and to isolate the laptop from
  749.   the SCSI bus.
  750.  
  751.   For a    recommendation,    the APS    SCSI Sentry 2 ($100) is    an external
  752.   Centronics active terminator block (male on one end, female on the
  753.   other) which uses an external    power supply (115/230VAC) to supply
  754.   termination power (5VDC 2.0A)    to its own active terminator and to the
  755.   PCMCIA SCSI card's terminators (be it    active or passive).  For more
  756.   details, APS Technical Support can be    reached    at 800-334-7550.
  757.  
  758.  
  759.   5.  Debugging    tips and programming information
  760.  
  761.   5.1.    How can    I submit a helpful bug report?
  762.  
  763.   Here are some    things that should be included in all bug reports:
  764.  
  765.  
  766.   o  Your system type, and the output of the probe command
  767.  
  768.   o  What PCMCIA cards you are using
  769.  
  770.   o  Your Linux    kernel version,    and PCMCIA version
  771.  
  772.   o  Any changes you've    made to    the startup files in /etc/pcmcia
  773.  
  774.   o  Contents of /usr/adm/messages, even if you    don't see anything that
  775.      looks interesting.
  776.  
  777.   The make.options file    includes a few choices for building the    kernel
  778.   modules with various kinds of    debugging code turned on.  This    may or
  779.   may not be useful, depending on your problem.     It is probably    better
  780.   to only turn on the really verbose debugging if I ask    you to.
  781.  
  782.   If your problem involves a kernel fault, the register    dump from the
  783.   fault    is only    useful if you can track    down the fault address,    EIP.  If
  784.   it is    in the main kernel, look up the    address    in zSystem.map to
  785.   identify the function    at fault.  If the fault    is in a    loadable module,
  786.   it is    a bit harder to    trace.    With the current module    tools, ``ksyms
  787.   -m'' will report the base address of each loadable module.  Pick the
  788.   module that contains the EIP address,    and subtract its base address
  789.   from EIP to get an offset inside that    module.     Then, run gdb on that
  790.   module, and look up the offset with the list command.     This will only
  791.   work if you've compiled that module with -g to include debugging
  792.   information.
  793.   Send bug reports to dhinds@allegro.stanford.edu.  I prefer to    handle
  794.   bug reports by email -- please avoid calling me at home or at    work.
  795.  
  796.  
  797.   5.2.    Low level PCMCIA debugging aids
  798.  
  799.   The PCMCIA modules contain a lot of conditionally-compiled debugging
  800.   code.     The make.options file shows how to enable this    code.  A module
  801.   compiled with    PCMCIA_DEBUG set will have a parameter,    pc_debug, that
  802.   controls the verbosity of debugging output.  This can    be adjusted when
  803.   the module is    loaded,    so output can be controlled on a per-module
  804.   basis    without    recompiling.
  805.  
  806.   There    are a few debugging tools in the debug_tools/ subdirectory of
  807.   the PCMCIA distribution.  The    dump_tcic and dump_i365    utilities
  808.   generate complete register dumps of the PCMCIA controllers, and decode
  809.   a lot    of the register    information.  They are most useful if you have
  810.   access to a datasheet    for the    corresponding controller chip.    The
  811.   dump_tuples utility lists a card's CIS (Card Information Structure),
  812.   and decodes some of the important bits.  And the dump_cisreg utility
  813.   displays a card's local configuration    registers.
  814.  
  815.   The pcmem_cs memory card driver is also sometimes useful for
  816.   debugging.  It can be    bound to any PCMCIA card, and does not interfere
  817.   with other drivers.  It can be used to directly access any card's
  818.   attribute memory or common memory.
  819.  
  820.  
  821.   5.3.    How do I write a Card Services driver for card X?
  822.  
  823.   The Linux PCMCIA Programmer's    Guide is the best documentation    for the
  824.   Linux    PCMCIA interface.  The latest version is always    available from
  825.   cb-iris.stanford.edu in /pub/pcmcia/doc.
  826.  
  827.   For devices that are close relatives of normal ISA devices, you'll
  828.   probably be able to use parts    of existing Linux drivers.  In some
  829.   cases, the biggest stumbling block will be modifying an existing
  830.   driver so that it can    handle adding and removing devices after boot
  831.   time.     Of the    current    drivers, the memory card driver    is the only
  832.   ``self-contained'' driver that does not depend on other parts    of the
  833.   Linux    kernel to do most of the dirty work.
  834.  
  835.   I've written a skeleton driver with lots of comments that explains a
  836.   lot of how a driver communicates with    Card Services; you'll find this
  837.   in the PCMCIA    source distribution in modules/skeleton.c.
  838.