home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 2 / CD ACTUAL VOL 2.iso / docs / pcmcia-h < prev    next >
Encoding:
Text File  |  1995-09-10  |  40.5 KB  |  1,021 lines

  1.   Linux PCMCIA HOWTO
  2.   David Hinds, dhinds@allegro.stanford.edu
  3.   v1.42, 1 June 1995
  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.6.2.
  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, Ricoh, and Databook chips.  Custom controllers used in IBM and
  72.   Toshiba laptops are also supported.  Several people use the package on
  73.   desktop systems with PCMCIA card adapters.
  74.  
  75.   The Motorola 6AHC05GA controller used in some Hyundai laptops is not
  76.   supported.  The custom PCMCIA controller in the HP Omnibook is also
  77.   unsupported.
  78.  
  79.  
  80.   1.5.  What PCMCIA cards are supported?
  81.  
  82.   The current release includes drivers for a variety of ethernet cards,
  83.   a driver for modem and serial port cards, several SCSI adapter
  84.   drivers, and memory card drivers that should support most SRAM cards
  85.   and some flash cards.  The SUPPORTED.CARDS file included with each
  86.   release of Card Services lists all cards that are known to work in at
  87.   least one actual system.
  88.  
  89.   The likelihood that a card not on the supported list will work depends
  90.   on the type of card.  Essentially all modems should work with the
  91.   supplied driver.  Some network cards may work if they are OEM versions
  92.   of supported cards.  Other types of IO cards (hard drives, sound
  93.   cards, etc) will not work until someone writes the appropriate
  94.   drivers.
  95.  
  96.  
  97.   1.6.  When will card X be supported?
  98.  
  99.   Unfortunately, they don't pay me to write device drivers, so if you'd
  100.   like to have a driver for your favorite card, you're probably going to
  101.   have to do some of the work on your own.  The SUPPORTED.CARDS file
  102.   mentions some cards for which driver work is currently in progress.  I
  103.   will try to help where I can.
  104.  
  105.  
  106.   1.7.  Mailing list
  107.  
  108.   I maintain a database and mailing list of Linux PCMCIA users.  This is
  109.   used to announce new releases of the PCMCIA package.  If you would
  110.   like to be included, send me the following:
  111.  
  112.  
  113.   o  Your name and email address
  114.  
  115.   o  What kind of laptop are you using?
  116.  
  117.   o  What PCMCIA controller is reported by the probe command?
  118.  
  119.   o  What PCMCIA cards are you using?
  120.  
  121.   o  Any special settings you use: compilation options, irq and port
  122.      settings, /etc/pcmcia/config entries, insmod options, etc.
  123.  
  124.  
  125.   2.  Compilation, installation, and configuration
  126.  
  127.   2.1.  Prerequisites and kernel setup
  128.  
  129.   For the latest version, you will need to have kernel version 1.2.8 or
  130.   higher.  There are no kernel patches specifically for PCMCIA support.
  131.   You'll also need to have a relatively recent set of module utilities.
  132.   If your man page for insmod describes the [symbol=value ...] syntax,
  133.   your utilities are current enough.
  134.  
  135.   You need to have a complete linux source tree for your kernel, not
  136.   just an up-to-date kernel image, when you compile the PCMCIA package.
  137.   The PCMCIA modules contain some references to kernel source files.
  138.  
  139.   Current kernel sources and patches are available from sunsite.unc.edu
  140.   in /pub/Linux/kernel/v1.2, or from tsx-11.mit.edu in
  141.   /pub/linux/sources/system/v1.2.  Current module utilities can be found
  142.   in the same places, in the file modules-1.1.87.tgz.
  143.  
  144.   When configuring your kernel, if you plan on using a PCMCIA ethernet
  145.   card, you should turn on networking support but turn off the normal
  146.   Linux network card drivers, including the ``pocket and portable
  147.   adapters''.  The PCMCIA network card drivers are all implemented as
  148.   loadable modules.  All of the PCMCIA net drivers except the 3Com 3c589
  149.   driver depend on the 8390.o driver module which is built as part of
  150.   the Linux kernel.
  151.  
  152.   If you want to use SLIP, PPP, or PLIP, you do need to either configure
  153.   your kernel with these enabled, or use the loadable module versions of
  154.   these drivers.  There is an unfortunate deficiency in the kernel
  155.   config process, in that it is not possible to set configuration
  156.   options (like SLIP compression) for a loadable module, so it is
  157.   probably better to just link SLIP into the kernel if you need it.
  158.  
  159.   If you will be using a PCMCIA SCSI adapter, you should enable
  160.   CONFIG_SCSI when configuring your kernel.  Also, enable any top level
  161.   drivers (SCSI disk, tape, cdrom, generic) that you expect to use.  All
  162.   low-level drivers for particular host adapters should be disabled.
  163.  
  164.   For recent kernels, you must explicitly do ``make modules'' followed
  165.   by ``make modules_install'' in /usr/src/linux to build the loadable
  166.   driver modules.  They will be installed under /lib/modules.
  167.  
  168.   Building the PCMCIA modules requires access to the kernel version file
  169.   versions.h.  This file is normally created at the start of a kernel
  170.   build, and deleted at the end.  It will be recreated in the course of
  171.   doing ``make modules'', or it can be explicitly created by doing
  172.   ``make include/linux/version.h'' at the top of your Linux source tree.
  173.  
  174.  
  175.   2.2.  Installation
  176.  
  177.   Starting with release 2.4.8, this package includes an X-based card
  178.   status utility called cardinfo.  This utility is based on a public
  179.   domain user interface toolkit called the Forms Library, which you will
  180.   need to install before building cardinfo.  A binary distribution is on
  181.   cb-iris.stanford.edu in /pub/pcmcia/extras/bxform-0.61.tgz.  There is
  182.   a small bug in the Makefile: the line that starts with ``ln -s''
  183.   should have ``; fi'' added to the end.
  184.  
  185.   Unpack the pcmcia-cs-2.6.2.tgz package in a convenient location, like
  186.   /usr/src.
  187.  
  188.   Make sure the definitions in make.options are consistent with your
  189.   site setup.  Running ``make prereq'' will check your system
  190.   configuration to verify that it satisfies all prerequisites for
  191.   installing PCMCIA support.
  192.  
  193.   Running ``make all'' followed by ``make install'' will build and then
  194.   install the kernel modules and utility programs.  Kernel modules are
  195.   installed under /lib/modules/<version>/pcmcia.  The cardmgr and
  196.   cardctl programs are installed in /sbin.  If cardinfo is built, it is
  197.   installed in /usr/bin/X11.
  198.  
  199.   Configuration files will be installed in the /etc/pcmcia directory.
  200.   If you are installing over an older version, the new config files will
  201.   be installed with a ``.N'' suffix -- you should replace or update your
  202.   existing files by hand.
  203.  
  204.   If you don't know what kind of PCMCIA controller chip you have, you
  205.   can use the probe utility in the cardmgr/ subdirectory to determine
  206.   this.  There are two major types: the Databook TCIC-2 type and the
  207.   Intel i82365SL-compatible type.
  208.  
  209.   A user-level daemon processes card insertion and removal events.  This
  210.   is called cardmgr.  It is similar in function to Barry Jaspan's
  211.   pcmciad in earlier PCMCIA releases.  Cardmgr reads a configuration
  212.   file describing known PCMCIA cards from /etc/pcmcia/config.  This file
  213.   also specifies what resources can be allocated for use by PCMCIA
  214.   devices, and may need to be customized for your system.  See the
  215.   pcmcia man page for more information about this file.
  216.  
  217.   The script rc.pcmcia, installed in /etc/rc.d, controls starting up and
  218.   shutting down the PCMCIA system.  ``make install-etc'' will use the
  219.   probe command to determine your controller type and modify rc.pcmcia
  220.   appropriately.  You should add a line to your system startup file
  221.   /etc/rc.d/rc.M to invoke this:
  222.  
  223.  
  224.  
  225.        /etc/rc.d/rc.pcmcia start
  226.  
  227.  
  228.  
  229.  
  230.   In a few cases, the probe command will be unable to determine your
  231.   controller type automatically.  The Tadpole P1000 and some other PCI-
  232.   based laptops have a special Cirrus PCI-to-PCMCIA bridge chip that
  233.   can't be detected by probe.  If you have one of these systems, you'll
  234.   need to install rc.pcmcia by hand.
  235.  
  236.  
  237.   2.3.  Site-specific configuration options
  238.  
  239.   Card Services should automatically avoid allocating IO ports and
  240.   interrupts already in use by other standard devices.  This should work
  241.   for any devices that have Linux drivers, like serial and parallel
  242.   ports, IDE drives, and some sound cards.  If a device is unsupported
  243.   by Linux, you may need to explicitly exclude the resources it uses in
  244.   /etc/pcmcia/config.
  245.  
  246.  
  247.   o  On the AMS SoundPro, exclude irq 10.
  248.  
  249.   o  On the BMX 486DX2-66, exclude irq 5, irq 9.
  250.  
  251.   o  On the NEC Versa M, exclude irq 9.
  252.  
  253.   o  On the NEC Versa P/75, exclude irq 5, irq 9.
  254.  
  255.   o  On the NEC Versa S, exclude irq 9, irq 12.
  256.  
  257.   o  On the ProStar 9200, Altima Virage, and Acquiline Hurricane
  258.      DX4-100, exclude irq 5, port 0x330-0x35f.  Maybe use memory
  259.      0xd8000-0xdffff.
  260.  
  261.   o  On the Toshiba T4900 CT, exclude irq 5, port 0x2e0-0x2e8, port
  262.      0x330-0x338.
  263.  
  264.  
  265.   o  On the Twinhead 5100, HP 4000, Sharp PC-8700 and PC-8900, exclude
  266.      irq 9 (sound), irq 12.
  267.  
  268.   o  On an MPC 800 Series, exclude irq 5, port 0x300-0x30f for the CD-
  269.      ROM.
  270.  
  271.   Some PCMCIA controllers have optional features that may or may not be
  272.   implemented in a particular system.  It is generally impossible for a
  273.   socket driver to detect if these features are implemented.  Check the
  274.   man page for your driver to see what optional features may be enabled.
  275.  
  276.   The low level socket drivers, tcic and i82365, have numerous bus
  277.   timing parameters that may need to be adjusted for systems with
  278.   particularly fast processors.  Symptoms of timing problems include
  279.   card recognition problems, lock-ups under heavy loads, high error
  280.   rates, or poor device performance.  Check the corresponding man pages
  281.   for more details, but here is a brief summary:
  282.  
  283.  
  284.   o  Cirrus controllers have numerous configurable timing parameters.
  285.      The most important is the freq_bypass flag which changes the
  286.      multiplier for the PCMCIA bus clock to slow down all operations.
  287.  
  288.   o  The Cirrus PD6729 PCI controller has the fast_pci flag, which
  289.      should be set if the PCI bus speed is greater than 25 MHz.
  290.  
  291.   o  For Vadem VG-468 controllers and Databook TCIC-2 controllers, the
  292.      async_clock flag changes the relative clocking of PCMCIA bus and
  293.      host bus cycles.  Setting this flag adds extra wait states to some
  294.      operations.
  295.  
  296.   o  The pcmcia_core module has the cis_speed parameter for changing the
  297.      memory speed used for accessing a card's Card Information Structure
  298.      (CIS).  On some systems with fast bus clocks, increasing this
  299.      parameter (i.e., slowing down card accesses) may be beneficial.
  300.  
  301.   All these options should be configured by modifying the top of
  302.   /etc/rc.d/rc.pcmcia.  For example:
  303.  
  304.  
  305.  
  306.        # Should be either i82365 or tcic
  307.        PCIC=i82365
  308.        # Put socket driver timing parameters here
  309.        OPTS="async_clock=1"
  310.  
  311.  
  312.  
  313.  
  314.   On some systems using Cirrus controllers, including the NEC Versa M,
  315.   the BIOS puts the controller in a special suspended state at system
  316.   startup time.  On these systems, the probe command will fail to find
  317.   any known PCMCIA controller.  If this happens, edit
  318.   /etc/rc.d/rc.pcmcia by hand as follows:
  319.  
  320.  
  321.  
  322.        # Should be either i82365 or tcic
  323.        PCIC=i82365
  324.        # Put socket driver timing parameters here
  325.        OPTS="wakeup=1"
  326.  
  327.  
  328.  
  329.  
  330.  
  331.   If you have an ARM Pentium-90 or Midwest Micro Soundbook Plus laptop,
  332.   use the combination ``freq_bypass=1 cmd_time=8'' to slow down your
  333.   PCMCIA bus cycles.  This may help on other very fast systems that use
  334.   the non-PCI Cirrus chip (the PD672x).
  335.  
  336.  
  337.   2.4.  Can I install Linux via NFS with a PCMCIA network card?
  338.  
  339.   I've created a set of 1.44MB boot and root disks with PCMCIA support
  340.   for the Slackware 2.2 distribution.  The files are pcboot14.gz and
  341.   pcroot14.gz on cb-iris.stanford.edu and sunsite.unc.edu (see section
  342.   ``1.3'').  The root disk includes cardmgr, the core PCMCIA modules,
  343.   and all the network drivers.  As for how to use these, you should
  344.   familiarize yourself with the Slackware installation instructions,
  345.   available from the usual FTP sites.  The PCMCIA drivers will be loaded
  346.   automatically, and installation will be the same as for a non-PCMCIA
  347.   net card.  Note that Slackware root disks do not include any normal
  348.   user-level network utilities (ftp, telnet, etc).  They only include
  349.   enough network support to establish an NFS mount.
  350.  
  351.   If you use these disks with an IBM Thinkpad, you may need to specify
  352.   ``floppy=thinkpad'' at the lilo prompt when you boot the pcboot disk.
  353.  
  354.   After installation is complete, you'll have a non-PCMCIA setup on your
  355.   root disk.  It is possible to copy things from the boot and root disks
  356.   to your hard disk to get a working network setup, but it is a little
  357.   tricky to put everything in the right places by hand.  Once you have
  358.   booted your newly installed Linux system from your hard disk, mount
  359.   the Slackware boot disk on /mnt, and do:
  360.  
  361.  
  362.  
  363.        cp /mnt/vmlinuz /linuz
  364.        rootflags /vmlinuz 1
  365.        lilo
  366.  
  367.  
  368.  
  369.  
  370.   Then, mount the Slackware root disk on /mnt, and do:
  371.  
  372.  
  373.  
  374.        cp /mnt/sbin/cardmgr /sbin
  375.        (cd /mnt ; tar cf - etc/pcmcia lib/modules) | (cd / ; tar xf -)
  376.  
  377.  
  378.  
  379.  
  380.   Edit /etc/pcmcia/config and un-comment the ``start'' and ``stop''
  381.   commands for the net card drivers.  Rename /etc/pcmcia/network.sample
  382.   to /etc/pcmcia/network and edit to conform to your network setup.  You
  383.   will need to edit /etc/rc.d/rc.M by hand to start up the PCMCIA stuff
  384.   as in /etc/rc.local on the Slackware root disk.
  385.  
  386.   Alternatively, if your install server has a current set of source
  387.   files, you can copy current kernel sources, pcmcia sources, and module
  388.   utilities to your hard disk while it is NFS mounted.  Then, after
  389.   rebooting, build a new kernel and install the PCMCIA software as
  390.   normal.
  391.  
  392.   The Slackware boot/root disk combination is configured to work in many
  393.   systems, but no one configuration can work in all situations.  It is
  394.   difficult to debug PCMCIA setup problems encountered with these disks,
  395.   because of the very limited set of tools available.  When cardmgr is
  396.   running, /etc/stab will show what cards are configured.  At boot time,
  397.   messages from the PCMCIA modules are hard to spot before they scroll
  398.   off the screen, so ``/etc/rc.d/rc.pcmcia restart'' may give some
  399.   useful info.
  400.  
  401.   This disk set is really only meant to be used to install Slackware; I
  402.   do not recommend trying to use it to avoid having to compile the full
  403.   PCMCIA support package.  The disk images are updated infrequently and
  404.   are missing several important PCMCIA components.
  405.  
  406.  
  407.   2.5.  Why doesn't my system respond to card insertions?
  408.  
  409.   In most cases, the socket driver (i82365 or tcic) will automatically
  410.   probe and select an appropriate interrupt to signal card status
  411.   changes.  The automatic interrupt probe doesn't work on some Intel-
  412.   compatible controllers, including Cirrus chips and the chips used in
  413.   some IBM ThinkPads.  In these cases, the i82365 driver may pick an
  414.   interrupt that is used by another device.
  415.  
  416.   With the i82365 driver, the irq_mask option can be used to limit the
  417.   interrupts that will be tested.  This mask limits the set of
  418.   interrupts that can be used by PCMCIA cards as well as for monitoring
  419.   card status changes.  For the tcic driver, the cs_irq option can be
  420.   used to explicitly set the interrupt to be used for monitoring card
  421.   status changes.
  422.  
  423.   If you can't find an interrupt number that works, there is also a
  424.   polled status mode: both i82365 and tcic will accept a
  425.   poll_interval=100 option, to poll once per second.
  426.  
  427.  
  428.   3.  Usage and features
  429.  
  430.   3.1.  How do I tell if it is working?
  431.  
  432.   The cardmgr daemon normally beeps when a card is inserted, and the
  433.   tone of the beeps indicates the status of the newly inserted card.
  434.   Two high beeps indicate the card was identified and configured
  435.   successfully.  A high beep followed by a lower beep indicates that the
  436.   card was identified, but could not be configured for some reason.  One
  437.   low beep indicates that the card could not be identified.
  438.  
  439.   If you are running X, the new cardinfo utility produces a slick
  440.   graphical display showing the current status of all PCMCIA sockets.
  441.  
  442.   If the modules are all loaded correctly, the output of the lsmod
  443.   command should look like the following, with no cards inserted:
  444.  
  445.  
  446.  
  447.        Module:        #pages:  Used by:
  448.        ds                 2
  449.        i82365             2
  450.        pcmcia_core        6    [ds i82365]
  451.  
  452.  
  453.  
  454.  
  455.   All the PCMCIA modules and the cardmgr daemon send status messages to
  456.   the system log.  This will usually be /usr/adm/messages.  This file
  457.   should be the first place to look when tracking down a problem.  When
  458.   submitting a bug report, always include the contents of this file.
  459.   Cardmgr also records some current device information for each socket
  460.   in /etc/stab.
  461.  
  462.  
  463.   3.2.  How do I use my PCMCIA ethernet card?
  464.  
  465.   When an ethernet card is detected, it will be assigned the first free
  466.   interface name, probably ``eth0''.  Cardmgr will run the
  467.   /etc/pcmcia/network script to configure the interface, which should be
  468.   customized for your local network setup.
  469.  
  470.   Do not configure your PCMCIA ethernet card in /etc/rc.d/rc.inet1,
  471.   since the card may not be present when this script is executed.
  472.   Comment out everything except the loopback stuff in rc.inet1 and
  473.   instead edit the /etc/pcmcia/network script to match your local
  474.   network setup.  This script will be executed only when your ethernet
  475.   card is actually present.
  476.  
  477.  
  478.   3.3.  How do I use my PCMCIA modem card?
  479.  
  480.   When a serial or modem card is detected, it will be assigned to the
  481.   first available serial device slot.  This will usually be /dev/cua1 or
  482.   /dev/cua2, depending on how many built-in serial ports you have.  The
  483.   default serial device script, /etc/pcmcia/serial, will link the
  484.   appropriate device file to /dev/modem.
  485.  
  486.   If you are using more than one PCMCIA modem, use /etc/stab or cardinfo
  487.   to find out which device corresponds to each modem.
  488.  
  489.   Do not try to use /etc/rc.d/rc.serial to configure a PCMCIA modem.
  490.   This script should only be used to configure non-removable devices.
  491.   Modify /etc/pcmcia/serial if you want to do anything special to set up
  492.   your modem.
  493.  
  494.  
  495.   3.4.  How do I use my PCMCIA SCSI card?
  496.  
  497.   Always turn on SCSI devices before powering up your laptop, or before
  498.   inserting the adapter card, so that the SCSI bus is properly
  499.   terminated when the adapter is configured.
  500.  
  501.   When a new SCSI host adapter is detected, the SCSI drivers will probe
  502.   for devices.  Check /usr/adm/messages to make sure your devices are
  503.   detected properly.  New SCSI devices will be assigned to the first
  504.   available SCSI device files.  The first SCSI disk will be /dev/sda,
  505.   the first SCSI tape will be /dev/st0, and the first CDROM will be
  506.   /dev/scd0.
  507.  
  508.   Be very careful about ejecting a SCSI adapter.  Be sure that all
  509.   associated SCSI devices are unmounted and closed before ejecting the
  510.   card.  For now, all SCSI devices should be powered up before plugging
  511.   in a SCSI adapter, and should stay connected until after you unplug
  512.   the adapter and/or power down your laptop.
  513.  
  514.   Roger Pao (rpao@paonet.org) adds:
  515.  
  516.   Make sure there is a device capable of supplying termination power
  517.   both to the terminating target device and to the PCMCIA SCSI card.
  518.   This is vitally important as most PCMCIA SCSI cards do not supply
  519.   termination power to its own terminators nor to the SCSI bus.  This is
  520.   usually to save laptop battery power and to isolate the laptop from
  521.   the SCSI bus.
  522.  
  523.   For a recommendation, the APS SCSI Sentry 2 ($100) is an external
  524.   Centronics active terminator block (male on one end, female on the
  525.   other) which uses an external power supply (115/230VAC) to supply
  526.   termination power (5VDC 2.0A) to its own active terminator and to the
  527.   PCMCIA SCSI card's terminators (be it active or passive).  For more
  528.   details, APS Technical Support can be reached at 800-334-7550.
  529.   3.5.  How do I use my PCMCIA memory card?
  530.  
  531.   The default memory card startup script will create block and character
  532.   devices for accessing a card's first common memory and attribute
  533.   memory regions.  Check the man pages for all the details, but the
  534.   devices you'll probably be using will be /dev/mem0c (character device)
  535.   or /dev/mem0b (block device).  The block device is used for disk-like
  536.   access (creating and mounting filesystems, etc).  The character device
  537.   is for "raw" reads and writes at arbitrary locations.
  538.  
  539.   To use a flash memory card as an ordinary disk-like block device,
  540.   first create a ``flash translation layer'' partition on the device
  541.   with the ftl_format command:
  542.  
  543.  
  544.  
  545.        ftl_format -i /dev/mem0c
  546.  
  547.  
  548.  
  549.  
  550.   Note that this command accesses the card through the ``raw'' memory
  551.   card interface.  Once formatted, the card can be accessed as an
  552.   ordinary block device via the ftl_cs driver.  For example:
  553.  
  554.  
  555.  
  556.        mke2fs /dev/ftl0
  557.        mount -t ext2 /dev/ftl0 /mnt
  558.  
  559.  
  560.  
  561.  
  562.  
  563.   3.6.  How do I tell cardmgr how to identify a new card?
  564.  
  565.   Assuming that your card is supported by an existing driver, all that
  566.   needs to be done is to add an entry to /etc/pcmcia/config to tell
  567.   cardmgr how to identify the card, and which driver(s) need to be
  568.   linked up to this card.  Check the man page for pcmcia for more
  569.   information about the config file format.  If you insert an unknown
  570.   card, cardmgr will normally record some identification information in
  571.   /usr/adm/messages that can be used to construct the config entry.
  572.  
  573.   Here is an example of how cardmgr will report an unsupported card in
  574.   /usr/adm/messages.
  575.  
  576.  
  577.  
  578.        cardmgr[460]: unsupported card in socket 1
  579.        cardmgr[460]: version info: "MEGAHERTZ", "XJ2288", "V.34 PCMCIA MODEM"
  580.  
  581.  
  582.  
  583.  
  584.   The corresponding entry in /etc/pcmcia/config would be:
  585.  
  586.  
  587.  
  588.        card "Megahertz XJ2288 V.34 Fax Modem"
  589.          version "MEGAHERTZ", "XJ2288", "V.34 PCMCIA MODEM"
  590.          bind "serial_cs"
  591.  
  592.  
  593.  
  594.  
  595.   You can use ``*'' to match strings that don't need to match exactly,
  596.   like version numbers.  When making new config entries, be careful to
  597.   copy the strings exactly, preserving case and blank spaces.  Also be
  598.   sure that the config entry has the same number of strings as are
  599.   reported in the log file.
  600.  
  601.   After editing /etc/pcmcia/config, you can signal cardmgr to reload the
  602.   file with:
  603.  
  604.  
  605.  
  606.        kill -HUP `cat /var/run/cardmgr.pid`
  607.  
  608.  
  609.  
  610.  
  611.   If you do set up an entry for a new card, please send me a copy so
  612.   that I can include it in the standard config file.
  613.  
  614.  
  615.   3.7.  How do I control which interrupts and ports are used by a
  616.   device?
  617.  
  618.   In theory, it should not really matter which interrupt is allocated to
  619.   which device, as long as two devices are not configured to use the
  620.   same interrupt.  At the top of /etc/pcmcia/config you'll find a place
  621.   for excluding interrupts that are used by non-PCMCIA devices.
  622.  
  623.   The ibmcc_cs, de650_cs, 3c589_cs, and serial_cs drivers each have a
  624.   parameter called irq_mask for specifying which interrupts they may try
  625.   to allocate.  Each bit of irq_mask corresponds to one irq line: bit 0
  626.   is irq 0, bit 1 is irq 1, and so on.  So, a mask of 0x1200 would
  627.   correspond to irq 9 and irq 12.  To limit a driver to use only one
  628.   specific interrupt, its irq_mask should have only one bit set.  These
  629.   driver options should be set in your /etc/pcmcia/config file.  For
  630.   example:
  631.  
  632.  
  633.  
  634.        device "serial_cs"
  635.          module "serial_cs" opts "irq_mask=0x1100"
  636.          ...
  637.  
  638.  
  639.  
  640.  
  641.   would specify that the serial driver should only use irq 8 or irq 12.
  642.   Note that Card Services will never allocate an interrupt that is
  643.   already in use by another device, or an interrupt that is excluded in
  644.   the config file.
  645.  
  646.   There is no way to directly specify the I/O addresses for a PCMCIA
  647.   card to use.  The /etc/pcmcia/config file allows you to specify ranges
  648.   of ports available for use by all PCMCIA devices.
  649.  
  650.   After modifying /etc/pcmcia/config, you can restart cardmgr with
  651.   ``kill -HUP''.
  652.  
  653.  
  654.   3.8.  When is it safe to insert or eject a PCMCIA card?
  655.  
  656.   In theory, you can insert and remove PCMCIA cards at any time.
  657.   However, it is a good idea not to eject a card that is currently being
  658.   used by an application program.  Kernels older than 1.1.77 would often
  659.   lock up when serial/modem cards were ejected, but this should be fixed
  660.   now.
  661.   3.9.  How do I unload PCMCIA drivers?
  662.  
  663.   To unload the entire PCMCIA package, invoke rc.pcmcia with:
  664.  
  665.  
  666.  
  667.        /etc/rc.d/rc.pcmcia stop
  668.  
  669.  
  670.  
  671.  
  672.   This script will take several seconds to run, to give all client
  673.   drivers time to shut down gracefully.  If a PCMCIA device is currently
  674.   in use, the shutdown will fail.
  675.  
  676.  
  677.   3.10.  How does Card Services deal with suspend/resume?
  678.  
  679.   Card Services can be compiled with support for APM (Advanced Power
  680.   Management) if you've installed this package on your system.  The
  681.   current release of Stephen Rothwell's APM support package is version
  682.   0.5.  Unlike the 0.4 release, 0.5 does not require a special patch to
  683.   work with PCMCIA.  The PCMCIA modules will automatically be configured
  684.   for APM if a compatible version is detected on your system.
  685.  
  686.   Without resorting to APM, you can do ``cardctl suspend'' before
  687.   suspending your laptop, and ``cardctl resume'' after resuming, to
  688.   properly shut down and restart your PCMCIA cards.  This will not work
  689.   with a PCMCIA modem that is in use, because the serial driver isn't
  690.   able to save and restore the modem operating parameters.
  691.  
  692.   APM seems to be unstable on some systems.  If you experience trouble
  693.   with APM and PCMCIA on your system, try to narrow down the problem to
  694.   one package or the other before reporting a bug.
  695.  
  696.  
  697.   3.11.  How do I turn off a PCMCIA card without ejecting it?
  698.  
  699.   Use either the cardctl or cardinfo command.  ``cardctl suspend #''
  700.   will suspend one socket, and turn off its power.  The corresponding
  701.   resume command will wake up the card in its previous state.
  702.  
  703.  
  704.   4.  Problems with specific cards
  705.  
  706.   4.1.  Why doesn't my modem work?
  707.  
  708.   That's a broad question, but here's a quick troubleshooting guide.
  709.  
  710.  
  711.   o  Is your card recognized as a modem?  Check /usr/adm/messages and
  712.      make sure that cardmgr identifies the card correctly and starts up
  713.      the serial_cs driver.  If it doesn't, you may need to add a new
  714.      entry to your /etc/pcmcia/config file so that it will be identified
  715.      properly.  See section ``3.6'' for details.
  716.  
  717.   o  Is the modem configured successfully by serial_cs?  Again, check
  718.      /usr/adm/messages and look for messages from the serial_cs driver.
  719.      If you see ``register_serial() failed'', you may have an I/O port
  720.      conflict with another device.  Another tip-off of a conflict is if
  721.      the device is reported to be an 8250; most modern PCMCIA modems
  722.      should be identified as 16550A UART's.  If you think you're seeing
  723.      a port conflict, edit /etc/pcmcia/config and exclude the port range
  724.      that was allocated for the modem.
  725.  
  726.  
  727.   o  Is there an interrupt conflict?  If /usr/adm/messages looks good,
  728.      but the modem just doesn't seem to work, try using setserial to
  729.      change the irq to 0, and see if the modem works.  This causes the
  730.      serial driver to use a slower polled mode instead of using
  731.      interrupts.  If this seems to fix the problem, it is likely that
  732.      some other device in your system is using the interrupt selected by
  733.      serial_cs.  You should add a line to /etc/pcmcia/config to exclude
  734.      this interrupt.
  735.  
  736.   o  If the modem seems to work only really, really slowly, this is an
  737.      almost certain indicator of an interrupt conflict.
  738.  
  739.   o  Make sure your problem is really a PCMCIA one.  It may help to see
  740.      if the card works under DOS with the vendor's drivers.  Also, don't
  741.      test the card with something complex like SLIP until you are sure
  742.      you can make simple connections.  If simple things work but SLIP
  743.      does not, your problem is with SLIP, not with PCMCIA.
  744.  
  745.  
  746.   4.2.  Why does my Megahertz modem sometimes fail to work?
  747.  
  748.   Earlier versions of the PCMCIA drivers often failed to properly
  749.   initialize some Megahertz modems, specifically the 2144 model.  This
  750.   problem should be fixed in current releases.
  751.  
  752.   I've also received one report from someone with a newer Megahertz
  753.   modem that has a 16550-type UART.  He says that he wasn't able to get
  754.   this modem to work under Linux with cu until he configured the modem
  755.   with:
  756.  
  757.  
  758.  
  759.        echo 'ATS=QV1X4&C1&D2S95=2W1&K3S36=7S95=255' > /dev/modem
  760.  
  761.  
  762.  
  763.  
  764.   This initialization string was supplied by Megahertz tech support.
  765.  
  766.  
  767.   4.3.  Why doesn't my ethernet card work?
  768.  
  769.   Here's another quick troubleshooting guide.
  770.  
  771.  
  772.   o  Is your card recognized as an ethernet card?  Check
  773.      /usr/adm/messages and make sure that cardmgr identifies the card
  774.      correctly and starts up one of the network drivers.  If it doesn't,
  775.      your card might still be usable if it is compatible with a
  776.      supported card.  This will be most easily done if the card claims
  777.      to be "NE2000 compatible".
  778.  
  779.   o  Is the card configured properly?  If you are using a supported
  780.      card, and it was recognized by cardmgr, but still doesn't work,
  781.      there might be an interrupt or port conflict with another device.
  782.      Find out what resources the card is using (from /usr/adm/messages),
  783.      and try excluding these in /etc/pcmcia/config to force the card to
  784.      use something different.
  785.  
  786.   o  With Socket EA and 3Com 3c589 cards, you need to pick the
  787.      transceiver type (10base2, 10baseT, AUI) when the driver module is
  788.      loaded.  Make sure that the transceiver type reported in
  789.      /usr/adm/messages matches your connection.
  790.  
  791.   o  The Farallon EtherWave is actually based on the 3Com 3c589, with a
  792.      special transceiver.  Though the EtherWave uses 10baseT-style
  793.      connections, its transceiver requires that the 3c589 be configured
  794.      in 10base2 mode.
  795.  
  796.   o  Make sure your problem is really a PCMCIA one.  It may help to see
  797.      see if the card works under DOS with the vendor's drivers.  Double
  798.      check your modifications to the /etc/pcmcia/network script.  Make
  799.      sure your drop cable, ``T'' jack, terminator, etc are working.
  800.  
  801.   o  If your card seems to be configured properly, but sometimes locks
  802.      up, particularly under high load, you may need to try changing your
  803.      socket driver timing parameters.  See section ``2.3'' for more
  804.      information.
  805.  
  806.  
  807.   4.4.  How do I select the transceiver type for my 3c589 card?
  808.  
  809.   It would be nice if the driver could autodetect the difference between
  810.   a 10baseT and a 10base2 connection, but I don't know how to do that.
  811.   For now, you need to edit /etc/pcmcia/config and add an if_ports=#
  812.   option to the 3c589_cs module definition.  Check the tc589_cs man page
  813.   for more details, but to select 10base2 (also known as BNC, or thin
  814.   net, or coax), change:
  815.  
  816.  
  817.  
  818.        module "3c589_cs"
  819.  
  820.  
  821.  
  822.  
  823.   to:
  824.  
  825.  
  826.  
  827.        module "3c589_cs" opts "if_port=3"
  828.  
  829.  
  830.  
  831.  
  832.  
  833.   4.5.  My network performance stinks.  What can I do?
  834.  
  835.   If you have an NE4100 or IBM CCAE adapter, increase the memory access
  836.   time with the mem_speed=# option to the ibmcc_cs module definition.
  837.   Try speeds of up to 1000 (in nanoseconds).
  838.  
  839.   For other cards, you may need to try changing your socket driver
  840.   timing parameters.  Check the man page for your socket driver (i82365
  841.   or tcic) to see what parameters are available.
  842.  
  843.  
  844.   4.6.  How do I add support for an NE2000-compatible ethernet card?
  845.  
  846.   First, see if the card is already recognized by cardmgr.  Some cards
  847.   not listed in SUPPORTED.CARDS are actually OEM versions of cards that
  848.   are supported.  If you find a card like this, let me know so I can add
  849.   it to the list.
  850.  
  851.   If your card is not recognized, follow the instructions in section
  852.   ``3.6'' to create a config entry for your card, but bind the card to
  853.   the memory card driver, pcmem_cs for now.  Restart cardmgr to use the
  854.   new updated config file.
  855.  
  856.   You will need to know your card's hardware ethernet address.  This
  857.   address is a series of six two-digit hex numbers, often printed on the
  858.   card itself.  If it is not printed on the card, you may be able to use
  859.   a DOS driver to display the address.  In any case, once you know it,
  860.   run:
  861.  
  862.  
  863.  
  864.        dd if=/dev/pcmem0a count=20 | od -Ax -t x1
  865.  
  866.  
  867.  
  868.  
  869.   and search the output for your address.  Record the hex offset of the
  870.   first byte of the address.  Now, edit modules/de650_cs.c and find the
  871.   hw_info structure.  You'll need to create a new entry for your card.
  872.   The first field is the offset multiplied by two.  The next three
  873.   fields are the first three bytes of the hardware address.  The final
  874.   field is just a descriptive name.
  875.  
  876.   After editing de650_cs.c, compile and install the new module.  Edit
  877.   /etc/pcmcia/config again, and change the card binding from pcmem_cs to
  878.   de650_cs.  Follow the instructions for reloading the config file, and
  879.   you should be all set.  Please send me copies of your new hw_info and
  880.   config entries.
  881.  
  882.  
  883.   4.7.  How do I use my PCMCIA floppy interface?
  884.  
  885.   The PCMCIA floppy interface used in the Compaq Aero and a few other
  886.   laptops is not yet supported by this package.  If your laptop can
  887.   initialize this card before Linux boots, you should be able to use it
  888.   by telling Card Services to ignore that socket.  Note that you will
  889.   not be able to hot swap this card.
  890.  
  891.   To configure Card Services to ignore a socket, use the ignore=#
  892.   parameter when you load the i82365 or tcic driver.  See the man pages
  893.   for more details.
  894.  
  895.  
  896.   4.8.  What's up with support for Xircom cards?
  897.  
  898.   Xircom does not share technical information about its cards without a
  899.   non-disclosure agreement.  This means that it is not really possible
  900.   to develop freely distributable drivers for Xircom cards without doing
  901.   legally dubious things like reverse engineering DOS drivers.
  902.  
  903.   There is some indication that Xircom may start supporting Linux
  904.   directly.  Xircom tech support says that future products will include
  905.   Linux drivers.  Their plans for older Xircom products are less clear.
  906.  
  907.   The Xircom CreditCard Ethernet+Modem II card can be used as a modem
  908.   under Linux, with no special configuration.
  909.  
  910.  
  911.   4.9.  What's up with support for SCSI adapters?
  912.  
  913.   The Qlogic FastSCSI, New Media Bus Toaster, and Adaptec APA-1460
  914.   SlimSCSI cards work under Card Services.  The PCMCIA driver modules
  915.   for these cards are built by linking some PCMCIA-specific code (in
  916.   qlogic_cs.c and toaster_cs.c) with a normal Linux SCSI driver.  The
  917.   Qlogic PCMCIA driver links with the normal QLogic driver.  The Bus
  918.   Toaster PCMCIA driver, which also supports the Adaptec SlimSCSI, links
  919.   with the Adaptec 152x driver.  It is important to use a 1.2.8 or later
  920.   kernel if you will be using a SCSI adapter, because there have been
  921.   important changes to the low-level drivers in recent releases.
  922.  
  923.   The Adaptec APA-460 SlimSCSI adapter is not supported.  This card was
  924.   originally sold under the Trantor name, and when Adaptec merged with
  925.   Trantor, they continued to sell the Trantor card with an Adaptec
  926.   label.  The APA-460 is not compatible with any existing Linux driver.
  927.   I'm not sure how hard it would be to write a driver; I don't think
  928.   anyone has been able to obtain the technical information from Adaptec.
  929.  
  930.   The Trantor SlimSCSI can be identified by the following:
  931.  
  932.   Trantor / Adaptec APA-460 SlimSCSI FCC ID: IE8T460 Shipped with
  933.   SCSIworks! driver software
  934.  
  935.   The Adaptec SlimSCSI can be identified by the following:
  936.  
  937.   Adaptec APA-1460 SlimSCSI FCC ID: FGT1460 P/N: 900100 Shipped with EZ-
  938.   SCSI driver software
  939.  
  940.  
  941.   5.  Debugging tips and programming information
  942.  
  943.   5.1.  How can I submit a helpful bug report?
  944.  
  945.   Here are some things that should be included in all bug reports:
  946.  
  947.  
  948.   o  Your system type, and the output of the probe command
  949.  
  950.   o  What PCMCIA cards you are using
  951.  
  952.   o  Your Linux kernel version, and PCMCIA version
  953.  
  954.   o  Any changes you've made to the startup files in /etc/pcmcia
  955.  
  956.   o  Contents of /usr/adm/messages, even if you don't see anything that
  957.      looks interesting.
  958.  
  959.   The make.options file includes a few choices for building the kernel
  960.   modules with various kinds of debugging code turned on.  This may or
  961.   may not be useful, depending on your problem.  It is probably better
  962.   to only turn on the really verbose debugging if I ask you to.
  963.  
  964.   If your problem involves a kernel fault, the register dump from the
  965.   fault is only useful if you can track down the fault address, EIP.  If
  966.   it is in the main kernel, look up the address in zSystem.map to
  967.   identify the function at fault.  If the fault is in a loadable module,
  968.   it is a bit harder to trace.  With the current module tools, ``ksyms
  969.   -m'' will report the base address of each loadable module.  Pick the
  970.   module that contains the EIP address, and subtract its base address
  971.   from EIP to get an offset inside that module.  Then, run gdb on that
  972.   module, and look up the offset with the list command.  This will only
  973.   work if you've compiled that module with -g to include debugging
  974.   information.
  975.  
  976.   Send bug reports to dhinds@allegro.stanford.edu.  I prefer to handle
  977.   bug reports by email -- please avoid calling me at home or at work.
  978.  
  979.  
  980.   5.2.  Low level PCMCIA debugging aids
  981.  
  982.   The PCMCIA modules contain a lot of conditionally-compiled debugging
  983.   code.  The make.options file shows how to enable this code.  A module
  984.   compiled with PCMCIA_DEBUG set will have a parameter, pc_debug, that
  985.   controls the verbosity of debugging output.  This can be adjusted when
  986.   the module is loaded, so output can be controlled on a per-module
  987.   basis without recompiling.
  988.  
  989.   There are a few debugging tools in the debug_tools/ subdirectory of
  990.   the PCMCIA distribution.  The dump_tcic and dump_i365 utilities
  991.   generate complete register dumps of the PCMCIA controllers, and decode
  992.   a lot of the register information.  They are most useful if you have
  993.   access to a datasheet for the corresponding controller chip.  The
  994.   dump_tuples utility lists a card's CIS (Card Information Structure),
  995.   and decodes some of the important bits.  And the dump_cisreg utility
  996.   displays a card's local configuration registers.
  997.  
  998.   The pcmem_cs memory card driver is also sometimes useful for
  999.   debugging.  It can be bound to any PCMCIA card, and does not interfere
  1000.   with other drivers.  It can be used to directly access any card's
  1001.   attribute memory or common memory.
  1002.  
  1003.  
  1004.   5.3.  How do I write a Card Services driver for card X?
  1005.  
  1006.   The Linux PCMCIA Programmer's Guide is the best documentation for the
  1007.   Linux PCMCIA interface.  The latest version is always available from
  1008.   cb-iris.stanford.edu in /pub/pcmcia/doc.
  1009.  
  1010.   For devices that are close relatives of normal ISA devices, you'll
  1011.   probably be able to use parts of existing Linux drivers.  In some
  1012.   cases, the biggest stumbling block will be modifying an existing
  1013.   driver so that it can handle adding and removing devices after boot
  1014.   time.  Of the current drivers, the memory card driver is the only
  1015.   ``self-contained'' driver that does not depend on other parts of the
  1016.   Linux kernel to do most of the dirty work.
  1017.  
  1018.   I've written a skeleton driver with lots of comments that explains a
  1019.   lot of how a driver communicates with Card Services; you'll find this
  1020.   in the PCMCIA source distribution in modules/skeleton.c.
  1021.