Linux PCMCIA HOWTO
Linux PCMCIA HOWTO Table of Contents Linux PCMCIA HOWTO..................................................................................................................................1 David Hinds, dhinds@pcmcia.sourceforge.org. .....................................................................................1 1.General information and hardware requirements.................................................................................1 2.Compilation and installation.................................
Linux PCMCIA HOWTO Table of Contents 4.2 Overview of the PCMCIA configuration scripts.............................................................................23 4.3 PCMCIA network adapters..............................................................................................................24 Network device parameters......................................................................................................24 Comments about specific cards...............................................
Linux PCMCIA HOWTO David Hinds, dhinds@pcmcia.sourceforge.org. v2.46, 1 December 1999 This document describes how to install and use PCMCIA Card Services for Linux, and answers some frequently asked questions. The latest version of this document can always be found at ftp://sourceforge.org/pcmcia/doc. An HTML version is at http://pcmcia.sourceforge.org. 1.General information and hardware requirements • 1.1 Introduction • 1.2 Copyright notice and disclaimer • 1.
Linux PCMCIA HOWTO • 3.8 Resource conflict only with two cards inserted • 3.9 Device configuration does not complete 4.Usage and features • 4.1 Tools for configuring and monitoring PCMCIA devices • 4.2 Overview of the PCMCIA configuration scripts • 4.3 PCMCIA network adapters • 4.4 PCMCIA serial and modem devices • 4.5 PCMCIA parallel port devices • 4.6 PCMCIA SCSI adapters • 4.7 PCMCIA memory cards • 4.8 PCMCIA ATA/IDE card drives • 4.9 Multifunction cards 5.Advanced topics • 5.
Linux PCMCIA HOWTO 1. General information and hardware requirements 1.1 Introduction Card Services for Linux is a complete PCMCIA or ``PC Card'' support package. It includes a set of loadable kernel modules that implement a version of the Card Services applications program interface, a set of client drivers for specific cards, and a card manager daemon that can respond to card insertion and removal events, loading and unloading drivers on demand.
Linux PCMCIA HOWTO sourceforge.org is mirrored at sunsite.unc.edu (and all sunsite mirror sites) in /pub/Linux/kernel/pcmcia. If you do not feel up to compiling the drivers from scratch, pre−compiled drivers are included with current releases of most of the major Linux distributions, including Slackware, Debian, Red Hat, Caldera, SuSE, and Yggdrasil, among others. 1.4 What systems are supported? This package should run on almost Intel−based Linux−capable laptop. It also runs on Alpha−based platforms (i.e.
Linux PCMCIA HOWTO 1.5 What cards are supported? The current release includes drivers for a variety of ethernet cards, a driver for modem and serial port cards, several SCSI adapter drivers, a driver for ATA/IDE drive cards, and memory card drivers that should support most SRAM cards and some flash cards. The SUPPORTED.CARDS file included with each release of Card Services lists all cards that are known to work in at least one actual system.
Linux PCMCIA HOWTO 1.8 Why don't you distribute binaries? For me, distributing binaries would be a significant hassle. It is complicated because some features can only be selected at compile time, and because the modules are somewhat dependent on having the ``right'' kernel configuration. So, I would probably need to distribute precompiled modules along with matching kernels. Beyond this, the greatest need for precompiled modules is when installing Linux on a clean system.
Linux PCMCIA HOWTO • A 2.0.*, 2.1.*, or 2.2.* series kernel source tree. • An appropriate set of module utilities. • (Optional) the ``XForms'' X11 user interface toolkit. You need to have a complete linux source tree for your kernel, not just an up−to−date kernel image. The driver modules contain some references to kernel source files. While you may want to build a new kernel to remove unnecessary drivers, installing PCMCIA does not require you to do so.
Linux PCMCIA HOWTO normal X header files and libraries before configuring the PCMCIA package. 2.2 Installation Here is a synopsis of the installation process: • Unpack pcmcia−cs−3.1.?.tar.gz in /usr/src. • Run ``make config'' in the new pcmcia−cs−3.1.? directory. • Run ``make all'', then ``make install''. • Customize the startup script and the option files in /etc/pcmcia for your site, if needed.
Linux PCMCIA HOWTO used to view and manipulate PnP BIOS devices. However, this setting causes problems on some laptops and is not turned on by default. How to set kernel−specific options? There are a few kernel configuration options that affect the PCMCIA tools. The configuration script can deduce these from the running kernel (the default and most common case).
Linux PCMCIA HOWTO anything other than ``yes'', then the startup script will be disabled. PCIC This identifies the PC Card Interface Controller driver module. There are two options: ``tcic'' or ``i82365''. Virtually all current controllers are in the ``i82365'' group. This is the only mandatory option setting. PCIC_OPTS This specifies options for the PCIC module. Some host controllers have optional features that may or may not be implemented in a particular system.
Linux PCMCIA HOWTO extra_sockets parameter set to 1. This should not be necessary for detection of PCI−to−PCMCIA or PCI−to−CardBus bridges. Here are some timing settings for specific systems: • On the ARM Pentium−90 or Midwest Micro Soundbook Plus, use ``freq_bypass=1 cmd_time=8''. • On a Midwest Micro Soundbook Elite, use ``cmd_time=12''. • On a Gateway Liberty, try ``cmd_time=16''. • On a Samsung SENS 810, use ``fast_pci=1''. 2.
Linux PCMCIA HOWTO 2.5 Notes about specific Linux distributions This section is incomplete. Corrections and additions are welcome. Debian Debian uses a System V boot script arrangement. The PCMCIA startup script is installed as /etc/init.d/pcmcia, and startup options are specified in /etc/pcmcia.conf. Debian's syslog configuration will place kernel messages in /var/log/messages and cardmgr messages in /var/log/daemon.log.
Linux PCMCIA HOWTO after the PCMCIA network device is configured. Red Hat bundles their slightly modified PCMCIA source distribution in their kernel SRPM, rather than as a separate source package. Slackware Slackware uses a BSD boot script arrangement. The PCMCIA startup script is installed as /etc/rc.d/rc.pcmcia, and boot options are specified in rc.pcmcia itself. The PCMCIA startup script is invoked from /etc/rc.d/rc.S.
Linux PCMCIA HOWTO 3.1 Base PCMCIA kernel modules do not load Symptoms: • Kernel version mismatch errors are reported when the PCMCIA startup script runs. • After startup, lsmod does not show any PCMCIA modules. • cardmgr reports ``no pcmcia driver in /proc/devices'' in the system log. Kernel modules contain version information that is checked against the current kernel when a module is loaded. The type of checking depends on the setting of the CONFIG_MODVERSIONS kernel option.
Linux PCMCIA HOWTO configuration. For instance, the SCSI card drivers require that the kernel be configured with SCSI support, and the network drivers require a networking kernel. If a kernel lacks a necessary feature, insmod may report undefined symbols and refuse to load a particular module. Note that insmod error messages do not distinguish between version mismatch errors and missing symbol errors.
Linux PCMCIA HOWTO The reason for the probe is to identify interrupts which appear to be free (i.e., are not reserved by any other Linux device driver), yet are either not physically wired to the host controller, or are connected to another device that does not have a driver. In the system log, a successful probe might look like: Intel PCIC probe: TI 1130 CardBus at mem 0x10211000, 2 sockets ...
Linux PCMCIA HOWTO probe is read−only, but in rare cases, reading from a device may interfere with an important system function, resulting in a lock−up. Your system user's guide may include a map of system devices, showing their IO and memory ranges. These can be explicitly excluded in config.opts. Alternatively, if the probe is unreliable on your system, it can be disabled by setting CORE_OPTS to ``probe_io=0''.
Linux PCMCIA HOWTO In some cases, the default high memory window is not usable. On some IBM Thinkpad models, a window of 0x60000000−0x60ffffff will work in place of the default window. 3.6 Failure to detect card insertions and removals Symptoms: • Cards are detected and configured properly if present at boot time. • The drivers do not respond to insertion and removal events, either by recording events in the system log, or by beeping.
Linux PCMCIA HOWTO Interrupt starvation often indicates a problem with the interrupt probe (see Interrupt scan failures). In some cases, the probe will seem to work, but only report one or two available interrupts. Check your system log to see if the scan results look sensible. Disabling the probe and selecting interrupts manually should help.
Linux PCMCIA HOWTO network hookup present. To pinpoint the problem, you can manually run a setup script to see where it is blocking. The scripts are in the /etc/pcmcia directory. They take two parameters: a device name, and an action. The cardmgr daemon records the configuration commands in the system log. For example, if the system log shows that the command ``.
Linux PCMCIA HOWTO /etc/pcmcia/config. This file describes the various client drivers, then describes how to identify various cards, and which driver(s) belong with which cards. The format of this file is described in the pcmcia(5) man page. The socket status file, stab Cardmgr records device information for each socket in /var/state/pcmcia/stab or /var/lib/pcmcia/stab, depending on filesystem layout.
Linux PCMCIA HOWTO Socket 0: no product info available Socket 1: product info: "LINKSYS", "PCMLM336", "A", "0040052D6400" manfid: 0x0143, 0xc0ab function: 0 (multifunction) The ``cardctl suspend'' and ``cardctl resume'' commands can be used to shut down a card without unloading its associated drivers. The ``cardctl reset'' command attempts to reset and reconfigure a card.
Linux PCMCIA HOWTO Shutting down the PCMCIA system To unload the entire PCMCIA package, invoke rc.pcmcia with: /etc/rc.d/rc.pcmcia stop This script will take several seconds to run, to give all client drivers time to shut down gracefully. If a device is currently in use, the shutdown will be incomplete, and some kernel modules may not be unloaded. To avoid this, use ``cardctl eject'' to shut down all sockets before invoking rc.pcmcia.
Linux PCMCIA HOWTO 4.3 PCMCIA network adapters Linux ethernet−type network interfaces normally have names like eth0, eth1, and so on. Token−ring adapters are handled similarly, however they are named tr0, tr1, and so on. The ifconfig command is used to view or modify the state of a network interface. A peculiarity of Linux is that network interfaces do not have corresponding device files under /dev, so do not be surprised when you do not find them.
Linux PCMCIA HOWTO Specifies the ethernet transceiver type, for certain 16−bit cards that do not autodetect. See ``man ifport'' for more information. PUMP A boolean (y/n) value: indicates if the host's IP address and routing information should be obtained using either BOOTP or DHCP, using Red Hat's pump daemon. BOOTP A boolean (y/n) value: indicates if the host's IP address and routing information should be obtained using the BOOTP protocol, with bootpc.
Linux PCMCIA HOWTO For IPX networks: the frame type and network number, passed to the ipx_interface command. For example: case "$ADDRESS" in *,*,*,*) IF_PORT="10base2" BOOTP="n" IPADDR="10.0.0.1" NETMASK="255.255.255.0" NETWORK="10.0.0.0" BROADCAST="10.0.0.255" GATEWAY="10.0.0.1" DOMAIN="domain.org" DNS_1="dns1.domain.org" ;; esac To automatically mount and unmount NFS filesystems, first add all these filesystems to /etc/fstab, but include noauto in the mount options. In network.
Linux PCMCIA HOWTO Comments about specific cards • With IBM CCAE and Socket EA cards, the transceiver type (10base2, 10baseT, AUI) needs to be set when the network device is configured. Make sure that the transceiver type reported in the system log matches your connection. • The Farallon EtherWave is actually based on the 3Com 3c589, with a special transceiver. Though the EtherWave uses 10baseT−style connections, its transceiver requires that the 3c589 be configured in 10base2 mode.
Linux PCMCIA HOWTO • If you are trying to use DHCP to configure your network interface, try testing things with a static IP address instead, to rule out a DHCP configuration problem. • To diagnose problems in /etc/pcmcia/network.opts, start by trying to ping other systems on the same subnet using their IP addresses. Then try to ping your gateway, and then machines on other subnets. Ping machines by name only after trying these simpler tests. • Make sure your problem is really a PCMCIA one.
Linux PCMCIA HOWTO If a PCMCIA modem is already configured when Linux boots, it may be incorrectly identified as an ordinary built−in serial port. This is harmless, however, when the PCMCIA drivers take control of the modem, it will be assigned a different device slot. It is best to either parse stab or use /dev/modem, rather than expecting a PCMCIA modem to always have the same device assignment.
Linux PCMCIA HOWTO Diagnosing problems with serial devices • Is your card recognized as a modem? Check the system log and make sure that cardmgr identifies the card correctly and starts up the serial_cs driver. If it doesn't, you may need to add a new entry to your /etc/pcmcia/config file so that it will be identified properly. See the Configuring unrecognized cards section for details.
Linux PCMCIA HOWTO case "$ADDRESS" in *,0,*) # Options for card in socket 0 LINK=/dev/printer0 ;; *,1,*) # Options for card in socket 1 LINK=/dev/printer1 ;; esac If you configure your kernel to load the basic Linux parallel port driver as a module, you must edit /etc/pcmcia/config to indicate that the appropriate modules must be loaded.
Linux PCMCIA HOWTO interrupt selected by parport_cs. You should add a line to /etc/pcmcia/config.opts to exclude this interrupt. • If you get kernel messages indicating that the parport_cs module cannot be loaded, it means that your kernel does not have parallel device support. If you have compiled the parallel driver as a module, you may need to modify /etc/pcmcia/config to indicate that the parport and parport_pc modules should be loaded before parport_cs. 4.
Linux PCMCIA HOWTO would say to load the core SCSI module and the top−level disk driver module before loading the regular PCMCIA driver module. The PCMCIA Configure script will not automatically detect modularized SCSI modules, so you will need use the manual configure option to enable SCSI support. Always turn on SCSI devices before powering up your laptop, or before inserting the adapter card, so that the SCSI bus is properly terminated when the adapter is configured.
Linux PCMCIA HOWTO *,sd,*,0,3,0) # This device has two partitions...
Linux PCMCIA HOWTO module "aha152x_cs" opts "reconnect=0" • Also with the aha152x_cs driver, certain devices seem to require a longer startup delay, controlled via the reset_delay module parameter. The Yamaha 4416S CDR drive is one such device. The result is the device is identified successfully, then hangs the system. In such cases, try: module "aha152x_cs" opts "reset_delay=500" • Another potential source of SCSI device probe problems is probing of multiple LUN's.
Linux PCMCIA HOWTO A boolean (y/n) setting: specifies if an entry should be added to /etc/fstab for this device. DO_FSCK A boolean (y/n) setting: specifies if the filesystem should be checked before being mounted, with ``fsck −Ta''. DO_MOUNT A boolean (y/n) setting: specifies if this device should be automatically mounted at card insertion time. FSTYPE, OPTS, MOUNTPT The filesystem type, mount options, and mount point to be used for the fstab entry and/or mounting the device.
Linux PCMCIA HOWTO and make the card look like a simple block device. For example: ftl_format −i /dev/mem0c0c Note that this command accesses the card through the ``raw'' memory card interface. Once formatted, the card can be accessed as an ordinary block device via the ftl_cs driver. For example: mke2fs /dev/ftl0c0 mount −t ext2 /dev/ftl0c0 /mnt Device naming for FTL devices is tricky.
Linux PCMCIA HOWTO ATA/IDE fixed−disk device parameters The following parameters can be specified in ide.opts: DO_FSTAB A boolean (y/n) setting: specifies if an entry should be added to /etc/fstab for this device. DO_FSCK A boolean (y/n) setting: specifies if the filesystem should be checked before being mounted, with ``fsck −Ta''. DO_MOUNT A boolean (y/n) setting: specifies if this device should be automatically mounted at card insertion time.
Linux PCMCIA HOWTO retry the device probe to give these drives time to spin up. With older drivers, you may need to load the pcmcia_core module with: CORE_OPTS="unreset_delay=400" • To use an ATA/IDE CD−ROM device, your kernel must be compiled with CONFIG_BLK_DEV_IDECD enabled. This will normally be the case for standard kernels, however it is something to be aware of if you compile a custom kernel. • A common error when using IDE drives is try to mount the wrong device file.
Linux PCMCIA HOWTO The interrupt used to monitor card status changes is chosen by the low−level socket driver module (i82365 or tcic) before cardmgr parses /etc/pcmcia/config, so it is not affected by changes to this file. To set this interrupt, use the cs_irq= option when the socket driver is loaded, by setting the PCIC_OPTS variable in /etc/rc.d/rc.pcmcia. All the client card drivers have a parameter called irq_list for specifying which interrupts they may try to allocate.
Linux PCMCIA HOWTO cardctl scheme work The cardctl command does the equivalent of shutting down all your cards and restarting them. The command can be safely executed whether or not the PCMCIA system is loaded, but the command may fail if you are using other PCMCIA devices at the time (even if their configurations are not explicitly dependant on the scheme setting). To find out the current scheme setting, run: cardctl scheme By default, the scheme setting is persistent across boots.
Linux PCMCIA HOWTO devices (i.e., devices that can be booted), and ``root−able'' devices (i.e., devices that can be mounted as root). ``Boot−able'' devices are determined by the BIOS, and are generally limited to internal floppy and hard disk drives. ``Root−able'' devices are any block devices that the kernel supports once it has been loaded. The initrd facility makes more devices ``root−able'', not ``boot−able''.
Linux PCMCIA HOWTO and then edit the linuxrc script. The configuration files will be installed under /etc in the image, and can also be customized. See the man page for pcinitrd for more information. Creating an initrd boot floppy After creating an image with pcinitrd, you can create a boot floppy by copying the kernel, the compressed initrd image, and a few support files for lilo to a clean floppy.
Linux PCMCIA HOWTO Assuming that you have a kernel has been configured for the appropriate root device, and an initrd image created on another system, the easiest way to get started is to boot Linux using LOADLIN, as: LOADLIN initrd= Once you can boot Linux on your target machine, you could then install lilo to allow booting Linux directly. For example, say that /dev/hda1 is the non−Linux target partition and /mnt can be used as a mount point.
Linux PCMCIA HOWTO NextPreviousContentsNextPreviousContents 6. Dealing with unsupported cards 6.1 Configuring unrecognized cards Assuming that your card is supported by an existing driver, all that needs to be done is to add an entry to /etc/pcmcia/config to tell cardmgr how to identify the card, and which driver(s) need to be linked up to this card. Check the man page for pcmcia for more information about the config file format.
Linux PCMCIA HOWTO Beware that you can specify just about any driver for a card, but if you're just shooting in the dark, there is not much reason to expect this to be productive. You may get lucky and find that your card is supported by an existing driver. However, the most likely outcome is that the driver won't work, and may have unfortunate side effects like locking up your system.
Linux PCMCIA HOWTO After editing pcnet_cs.c, compile and install the new module. Edit /etc/pcmcia/config again, and change the card binding from memory_cs to pcnet_cs. Follow the instructions for reloading the config file, and you should be all set. Please send me copies of your new hw_info and config entries. If you can't find your card's hardware address in the hex dump, as a method of last resort, it is possible to ``hard−wire'' the address when the pcnet_cs module is initialized.
Linux PCMCIA HOWTO • Your Linux kernel version (i.e., ``uname −rv''), and PCMCIA driver version (i.e., ``cardctl −V''). • Any changes you have made to the startup files in /etc/pcmcia, or to the PCMCIA startup script. • All PCMCIA−related messages in your system log file. That includes startup messages, and messages generated when your cards are configured. All the PCMCIA modules and the cardmgr daemon send status messages to the system log.
Linux PCMCIA HOWTO c2026000 c202a000 ... (9k) (4k) [3c574_cs] [serial_cs] So, 0xc2026081 is in the 3c574_cs module, and is at an offset of 0x0081 from the start of the module. We cannot look up this offset in 3c574_cs.o yet: when the kernel loads a module, it inserts a header at the module load address, so the real start of the module is offset from the address shown in ksyms.
Linux PCMCIA HOWTO Documentation/sysrq.txt in the kernel source tree. 7.3 Low level PCMCIA debugging aids The PCMCIA modules contain a lot of conditionally−compiled debugging code. Most of this code is under control of the PCMCIA_DEBUG preprocessor define. If this is undefined, debugging code will not be compiled. If set to 0, the code is compiled but inactive. Larger numbers specify increasing levels of verbosity.
Linux PCMCIA HOWTO /proc/bus/pccard/*/info For each socket, describes that socket's host controller and its capabilities. /proc/bus/pccard/*/exca This contains a dump of a controller's ``ExCA'' Intel i82365sl−compatible register set. /proc/bus/pccard/*/{pci,cardbus} For CardBus bridges, a dump of the bridge's PCI configuration space, and a dump of the bridge's CardBus configuration registers. 7.
Linux PCMCIA HOWTO The top−level directory should include a makefile, set up so that ``make −f ... all'' and ``make −f ... install'' compile the driver and install all appropriate files. If this makefile is given an extension of .mk, then it will automatically be invoked by the top−level Makefile for the all and install targets. Here is an example of how such a makefile could be constructed: # Sample Makefile for contributed client driver FILES = sample_cs.mk README.sample_cs \ modules/sample_cs.
Linux PCMCIA HOWTO 7.7 Guidelines for Linux distribution maintainers If your distribution has system configuration tools that you would like to be PCMCIA−aware, please use the *.opts files in /etc/pcmcia for your ``hooks.'' These files will not be modified if a user compiles and installs a new release of the PCMCIA package. If you modify the main configuration scripts, then a fresh install will silently overwrite your custom scripts and break the connection with your configuration tools.