home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 13 / CDA13.ISO / DOC / HOWTO / OTHER_FO / SGML / PCMCIA_H.GZ / PCMCIA-HOWTO.sgml
Encoding:
SGML Document  |  1996-08-25  |  66.2 KB  |  1,604 lines

  1. <!doctype linuxdoc system>
  2.  
  3. <article>
  4.  
  5. <title>Linux PCMCIA HOWTO
  6. <author>David Hinds, <tt/dhinds@allegro.stanford.edu/
  7. <date>v1.87, 28 July 1996
  8. <abstract>
  9. This document describes how to install and use PCMCIA Card Services
  10. for Linux, and answers some frequently asked questions.
  11. The latest version of this document can always be found at
  12. <tt/hyper.stanford.edu/ in <tt>/pub/pcmcia/doc</tt>.  An HTML
  13. version is at
  14. <tt>http://hyper.stanford.edu/~dhinds/pcmcia/pcmcia.html</tt>
  15. </abstract>
  16.  
  17. <toc>
  18.  
  19. <sect>General information and hardware requirements
  20.  
  21. <sect1>Introduction
  22.  
  23. <p>
  24. Card Services for Linux is a complete PCMCIA support package.  It
  25. includes a set of loadable kernel modules that implement a version of
  26. the PCMCIA Card Services applications program interface, a set of
  27. client drivers for specific cards, and a card manager daemon that can
  28. respond to card insertion and removal events, loading and unloading
  29. drivers on demand.  It supports ``hot swapping'' of PCMCIA cards, so
  30. cards can be inserted and ejected at any time.
  31.  
  32. This software is still under development.  It probably contains bugs,
  33. and should be used with caution.  I'll do my best to fix problems that
  34. are reported to me, but if you don't tell me, I may never know.  If
  35. you use this code, I hope you will send me your experiences, good or
  36. bad!
  37.  
  38. If you have any suggestions for how this document could be improved,
  39. please let me know (<tt/dhinds@allegro.stanford.edu/).
  40.  
  41. <sect1>Copyright notice and disclaimer
  42. <p>
  43. Copyright (c) 1996 David A. Hinds
  44.  
  45. This document may be reproduced or distributed in any form without my
  46. prior permission.  Modified versions of this document, including
  47. translations into other languages, may be freely distributed, provided
  48. that they are clearly identified as such, and this copyright is
  49. included intact.
  50.  
  51. This document may be included in commercial distributions without my
  52. prior consent.  While it is not required, I would like to be informed
  53. of such usage.  If you intend to incorporate this document in a
  54. published work, please contact me to make sure you have the latest
  55. available version.
  56.  
  57. This document is provided ``as is'', with no explicit or implied
  58. warranties.  Use the information in this document at your own risk.
  59.  
  60. <sect1>What is the latest version, and where can I get it?<label id="where">
  61.  
  62. <p>
  63. The current major release of Card Services is version 2.8, and minor
  64. updates or bug fixes are numbered 2.8.1, 2.8.2, and so on.
  65.  
  66. Source code for the latest version is available from
  67. <tt/hyper.stanford.edu/ in the <tt>/pub/pcmcia</tt> directory, as
  68. <tt/pcmcia-cs-2.8.?.tar.gz/.  There will usually be several versions
  69. here.  I generally only keep the latest minor release for a given
  70. major release.  New major releases may contain relatively untested
  71. code, so I also keep the latest version of the previous major release
  72. as a relatively stable fallback; the current fallback is 2.7.6.  It is
  73. up to you to decide which version is more appropriate, but the
  74. <tt/CHANGES/ file will summarize the most important differences.
  75.  
  76. <tt/hyper.stanford.edu/ is mirrored at <tt/sunsite.unc.edu/ in
  77. <tt>/pub/Linux/kernel/pcmcia</tt>.
  78. I'll also try to upload major releases to <tt/tsx-11.mit.edu/ under
  79. <tt>/pub/linux/packages/laptops/pcmcia</tt> now and then.
  80.  
  81. If you do not feel up to compiling the PCMCIA drivers from scratch,
  82. pre-compiled drivers are included with current releases of most of the
  83. major Linux distributions, including Slackware, Red Hat, Caldera, and
  84. Yggdrasil, among others.
  85.  
  86. <sect1>What systems are supported?
  87.  
  88. <p>
  89. This code should run on almost any Linux-capable laptop.  All common
  90. PCMCIA controllers are supported, including Intel, Cirrus, Vadem,
  91. VLSI, Ricoh, and Databook chips.  Custom controllers used in IBM and
  92. Toshiba laptops are also supported.  Several people use the package on
  93. desktop systems with PCMCIA card adapters.
  94.  
  95. The Motorola 6AHC05GA controller used in some Hyundai laptops is not
  96. supported.  The custom PCMCIA controller in the HP Omnibook 600 is
  97. also unsupported.  
  98.  
  99. <sect1>What PCMCIA cards are supported?
  100.  
  101. <p>
  102. The current release includes drivers for a variety of ethernet cards,
  103. a driver for modem and serial port cards, several SCSI adapter
  104. drivers, a driver for ATA/IDE drive cards, and memory card drivers
  105. that should support most SRAM cards and some flash cards.  The
  106. <tt/SUPPORTED.CARDS/ file included with each release of Card Services
  107. lists all cards that are known to work in at least one actual system.
  108.  
  109. The likelihood that a card not on the supported list will work depends
  110. on the type of card.  Essentially all modems should work with the
  111. supplied driver.  Some network cards may work if they are OEM versions
  112. of supported cards.  Other types of IO cards (GPS, frame buffers,
  113. sound cards, etc) will not work until someone writes the appropriate
  114. drivers.
  115.  
  116. <sect1>When will card X be supported?
  117.  
  118. <p>
  119. Unfortunately, they do not pay me to write device drivers, so if you
  120. would like to have a driver for your favorite card, you are probably
  121. going to have to do at least some of the work.  The
  122. <tt/SUPPORTED.CARDS/ file mentions some cards for which driver work is
  123. currently in progress.  I will try to help where I can.
  124.  
  125. <sect1>Mailing list
  126.  
  127. <p>
  128. I maintain a database and mailing list of Linux PCMCIA users.  This is
  129. used to announce new releases of the PCMCIA package.  To be included,
  130. send me the following:
  131.  
  132. <itemize>
  133. <item>Your name and email address
  134. <item>What kind of laptop are you using?
  135. <item>What PCMCIA controller is reported by the <tt/probe/ command?
  136. <item>What PCMCIA cards are you using?
  137. <item>Any special settings you use: compilation options, irq and port
  138. settings, <tt>/etc/pcmcia/config.opts</tt> changes, <tt/insmod/ options,
  139. etc.
  140. </itemize>
  141.  
  142. You can also register via the WWW: see
  143. <tt>http://hyper.stanford.edu/~dhinds/pcmcia/pcmcia.html</tt> for
  144. instructions.
  145.  
  146. There is also a Linux mailing list devoted to laptop issues, the
  147. ``linux-laptop'' list.  For more information, send a message
  148. containing the word ``help'' to <tt/majordomo@vger.rutgers.edu/.
  149.  
  150. <sect>Compilation, installation, and configuration
  151.  
  152. <sect1>Prerequisites and kernel setup<label id="prereq">
  153.  
  154. <p>
  155. The following things should be installed on your system before you
  156. start installing PCMCIA:
  157. <itemize>
  158. <item>
  159. One of the following kernels: 1.2.8 through 1.2.13, 1.3.30, 1.3.37,
  160. 1.3.39 through 1.3.99, 1.99.* (i.e., pre-2.0), or 2.0.*.
  161. <item>
  162. A current set of module utilities.
  163. <item>
  164. (Optional) the ``Forms'' X11 user interface toolkit.
  165. </itemize>
  166.  
  167. The latest version requires a kernel version 1.2.8 or higher, or a
  168. development kernel 1.3.30 or higher.  1.3.38 is definitely broken, and
  169. 1.3.31 to 1.3.36 are untested.  It also requires a relatively recent
  170. set of module utilities.  There are no kernel patches specifically for
  171. PCMCIA.
  172.  
  173. You need to have a complete linux source tree for your kernel, not
  174. just an up-to-date kernel image, to compile the PCMCIA package.  The
  175. PCMCIA modules contain some references to kernel source files.  While
  176. you may want to build a new kernel to remove unnecessary drivers,
  177. installing PCMCIA does not require you to do so.
  178.  
  179. Current ``stable'' kernel sources and patches are available from
  180. <tt/sunsite.unc.edu/ in <tt>/pub/Linux/kernel/v1.2</tt>, or from
  181. <tt/tsx-11.mit.edu/ in <tt>/pub/linux/sources/system/v1.2</tt>.
  182. Current module utilities can be found in the same place, in
  183. <tt/modules-1.2.8.tgz/.  Development kernels can be found in the
  184. corresponding <tt/v1.3/ subdirectories.  Some recent development
  185. kernels and compiler releases interact badly with older sets of module
  186. tools.  The latest versions of the module utilities can be found at
  187. <tt><http://www.pi.se/blox/modules></tt>.
  188.  
  189. When configuring your kernel, if you plan on using a PCMCIA ethernet
  190. card, you should turn on networking support but turn off the normal
  191. Linux network card drivers, including the ``pocket and portable
  192. adapters''.  The PCMCIA network card drivers are all implemented as
  193. loadable modules.  Any drivers compiled into your kernel will only
  194. waste space.
  195.  
  196. If you want to use SLIP, PPP, or PLIP, you do need to either configure
  197. your kernel with these enabled, or use the loadable module versions of
  198. these drivers.  There is an unfortunate deficiency in the kernel
  199. config process in 1.2.X kernels, in that it is not possible to set
  200. configuration options (like SLIP compression) for a loadable module,
  201. so it is probably better to just link SLIP into the kernel if you
  202. need it.
  203.  
  204. If you want to use a PCMCIA token ring adapter, your kernel needs to
  205. be configured with ``Token Ring driver support'' (<tt/CONFIG_TR/)
  206. enabled, though you should leave <tt/CONFIG_IBMTR/ off.
  207.  
  208. If you will be using a PCMCIA SCSI adapter, you should enable
  209. <tt/CONFIG_SCSI/ when configuring your kernel.  Also, enable any top
  210. level drivers (SCSI disk, tape, cdrom, generic) that you expect to
  211. use.  All low-level drivers for particular host adapters should be
  212. disabled, as they will just take up space.
  213.  
  214. If you want to modularize a driver that is needed for a PCMCIA device,
  215. you must modify <tt>/etc/pcmcia/config</tt> to specify what modules
  216. need to be loaded for what card types.  For example, if the serial
  217. driver is modularized, then you could change the serial device
  218. definition to:
  219.  
  220. <tscreen><verb>
  221. device "serial_cs"
  222.   class "serial" module "serial", "serial_cs"
  223. </verb></tscreen>
  224.  
  225. If your kernel is compiled with <tt/CONFIG_MODVERSIONS/ enabled, for
  226. kernel symbol version checking, the configure script will check for
  227. the existence of <tt>/usr/include/linux/modversions.h</tt>, the symbol
  228. version database.  This is created by running ``make dep'' in the
  229. kernel source tree.
  230.  
  231. This package includes an X-based card status utility called
  232. <tt/cardinfo/.  This utility is based on a public domain user
  233. interface toolkit called the Forms Library, which you will need to
  234. install before building <tt/cardinfo/.  A binary distribution is on
  235. <tt/hyper.stanford.edu/ in <tt>/pub/pcmcia/extras</tt>: there are both
  236. a.out and ELF versions of the library.
  237.  
  238. <sect1>Installation
  239.  
  240. <p>
  241.  
  242. Here is a synopsis of the installation process:
  243.  
  244. <itemize>
  245. <item>
  246. Unpack pcmcia-cs-2.8.?.tar.gz in /usr/src.
  247. <item>
  248. Run ``<tt/make config/'' in the new <tt/pcmcia-cs-2.8.?/ directory.
  249. <item>
  250. Run ``<tt/make all/'', then ``<tt/make install/''.
  251. <item>
  252. Customize <tt>/etc/rc.d/rc.pcmcia</tt> and the option files in
  253. <tt>/etc/pcmcia</tt> for your site.
  254. </itemize>
  255.  
  256. Running ``<tt/make config/'' prompts for a few configuration options,
  257. and checks out your system to verify that it satisfies all
  258. prerequisites for installing PCMCIA support.  In most cases, you'll be
  259. able to just accept all the default configuration options.  Be sure to
  260. carefully check the output of this command in case there are problems.
  261.  
  262. If you are compiling the PCMCIA stuff for installation on another
  263. machine, specify an alternate target directory when prompted by the
  264. configure script.  This should be an absolute path.  All the PCMCIA
  265. tools will be installed relative to this directory.  You will then be
  266. able to <tt/tar/ this directory tree and copy to your target machine,
  267. and unpack relative to its root directory to install everything in the
  268. proper places.
  269.  
  270. If you are cross compiling on another machine, you may want to specify
  271. alternate names for the compiler and linker.  This may also be helpful
  272. on mixed a.out and ELF systems.  The script will also prompt for
  273. additional compiler flags for debugging.
  274.  
  275. There are a few kernel configuration options that affect the PCMCIA
  276. tools.  The configuration script can deduce these from the running
  277. kernel (the most common case).  Alternatively, if you are compiling
  278. for installation on another machine, it can read the configuration
  279. from a kernel source tree, or each option can be set interactively.
  280.  
  281. Running ``<tt/make all/'' followed by ``<tt/make install/'' will build
  282. and then install the kernel modules and utility programs.  Kernel
  283. modules are installed under <tt>/lib/modules/<version>/pcmcia</tt>.
  284. The <tt/cardmgr/ and <tt/cardctl/ programs are installed in
  285. <tt>/sbin</tt>.  If <tt/cardinfo/ is built, it is installed in
  286. <tt>/usr/bin/X11</tt>.  
  287.  
  288. Configuration files will be installed in the <tt>/etc/pcmcia</tt>
  289. directory.  If you are installing over an older version, your old
  290. config scripts will be backed up before being replaced.  The saved
  291. scripts will be given extensions like <tt/*.~1~/, <tt/*.~2~/, and so
  292. on.  
  293.  
  294. If you don't know what kind of PCMCIA controller chip you have, you
  295. can use the <tt/probe/ utility in the <tt>cardmgr/</tt> subdirectory to
  296. determine this.  There are two major types: the Databook TCIC-2 type
  297. and the Intel i82365SL-compatible type.
  298.  
  299. A user-level daemon processes card insertion and removal events.  This
  300. is called <tt/cardmgr/.  It is similar in function to Barry Jaspan's
  301. <tt/pcmciad/ in earlier PCMCIA releases.  <tt/Cardmgr/ reads a
  302. configuration file describing known PCMCIA cards from
  303. <tt>/etc/pcmcia/config</tt>.  This file also specifies what resources
  304. can be allocated for use by PCMCIA devices, and may need to be
  305. customized for your system.  See the <tt/pcmcia/ man page for more
  306. information about this file.
  307.  
  308. The script <tt/rc.pcmcia/, installed in <tt>/etc/rc.d</tt>, controls
  309. starting up and shutting down the PCMCIA system.
  310. ``<tt/make install/'' will use the <tt/probe/ command to determine
  311. your controller type and modify <tt/rc.pcmcia/ appropriately.  You
  312. should add a line to your system startup file <tt>/etc/rc.d/rc.M</tt>
  313. to invoke this:
  314.  
  315. <tscreen><verb>
  316. /etc/rc.d/rc.pcmcia start
  317. </verb></tscreen>
  318.  
  319. In a few cases, the <tt/probe/ command will be unable to determine
  320. your controller type automatically.  The Tadpole P1000 and some other
  321. PCI-based laptops have a special Cirrus PCI-to-PCMCIA bridge chip that
  322. can't be detected by <tt/probe/.  If you have one of these systems,
  323. you'll need to edit <tt/rc.pcmcia/ by hand to load the <tt/i82365/
  324. module.  If you have a Halikan NBD 486 system, it has a TCIC-2
  325. controller at an unusual location: you'll need to edit <tt/rc.pcmcia/
  326. to load the <tt/tcic/ module, as well as setting the <tt/PCIC_OPTS/
  327. parameter to ``<tt/tcic_base=0x02c0/''.
  328.  
  329. <sect1>Site-specific configuration options<label id="timing">
  330.  
  331. <p>
  332. Card Services should automatically avoid allocating IO ports and
  333. interrupts already in use by other standard devices.  It will also
  334. attempt to detect conflicts with unknown devices, but this is not
  335. completely reliable.  In some cases, you may need to explicitly
  336. exclude resources for a device in <tt>/etc/pcmcia/config.opts</tt>.
  337.  
  338. Here are some resource settings for specific laptop types.
  339.  
  340. <itemize>
  341. <item>
  342. On the AMS SoundPro, exclude irq 10.
  343. <item>
  344. On some AMS TravelPro 5300 models, use memory 0xc8000-0xcffff.
  345. <item>
  346. On the BMX 486DX2-66, exclude irq 5, irq 9.
  347. <item>
  348. On the Chicony NB5, use memory 0xda000-0xdffff.
  349. <item>
  350. On the HP Omnibook 4000C, exclude port 0x300-0x30f.
  351. <item>
  352. On the NEC Versa M, exclude irq 9, port 0x2e0-2ff.
  353. <item>
  354. On the NEC Versa P/75, exclude irq 5, irq 9.
  355. <item>
  356. On the NEC Versa S, exclude irq 9, irq 12.
  357. <item>
  358. On the ProStar 9200, Altima Virage, and Acquiline Hurricane DX4-100,
  359. exclude irq 5, port 0x330-0x35f.  Maybe use memory 0xd8000-0xdffff.
  360. <item>
  361. On the TI TravelMate 5000, use memory 0xd4000-0xdffff.
  362. <item>
  363. On the Toshiba T4900 CT, exclude irq 5, port 0x2e0-0x2e8, port
  364. 0x330-0x338.
  365. <item>
  366. On the Twinhead 5100, HP 4000, Sharp PC-8700 and PC-8900, exclude
  367. irq 9 (sound), irq 12.
  368. <item>
  369. On an MPC 800 Series, exclude irq 5, port 0x300-0x30f for the CD-ROM.
  370. </itemize>
  371.  
  372. Some PCMCIA controllers have optional features that may or may not be
  373. implemented in a particular system.  It is generally impossible for a
  374. socket driver to detect if these features are implemented.  Check the
  375. man page for your driver to see what optional features may be enabled.
  376.  
  377. The low level socket drivers, <tt/tcic/ and <tt/i82365/, have numerous
  378. bus timing parameters that may need to be adjusted for systems with
  379. particularly fast processors.  Symptoms of timing problems include
  380. card recognition problems, lock-ups under heavy loads, high error
  381. rates, or poor device performance.  Check the corresponding man pages
  382. for more details, but here is a brief summary:
  383.  
  384. <itemize>
  385. <item>
  386. Cirrus controllers have numerous configurable timing parameters.  The
  387. most important is the <tt/freq_bypass/ flag which changes the
  388. multiplier for the PCMCIA bus clock to slow down all operations.
  389. <item>
  390. The Cirrus PD6729 PCI controller has the <tt/fast_pci/ flag, which
  391. should be set if the PCI bus speed is greater than 25 MHz.
  392. <item>
  393. For Vadem VG-468 controllers and Databook TCIC-2 controllers, the
  394. <tt/async_clock/ flag changes the relative clocking of PCMCIA bus and
  395. host bus cycles.  Setting this flag adds extra wait states to some
  396. operations.  However, I have yet to hear of a laptop that needs this.
  397. <item>
  398. The <tt/pcmcia_core/ module has the <tt/cis_speed/ parameter for
  399. changing the memory speed used for accessing a card's Card Information
  400. Structure (CIS).  On some systems with fast bus clocks, increasing
  401. this parameter (i.e., slowing down card accesses) may be beneficial.
  402. <item>
  403. This isn't a timing issue, but if you have more than one PCMCIA
  404. controller in your system or extra sockets in a docking station,
  405. the <tt/i82365/ module should be loaded
  406. with the <tt/extra_sockets/ parameter set to 1.
  407. </itemize>
  408.  
  409. All these options should be configured by modifying the top of
  410. <tt>/etc/rc.d/rc.pcmcia</tt>.  For example:
  411.  
  412. <tscreen><verb>
  413. # Should be either i82365 or tcic
  414. PCIC=i82365
  415. # Put socket driver timing parameters here
  416. PCIC_OPTS="cmd_time=12"
  417. # Put pcmcia_core options here
  418. CORE_OPTS="cis_speed=500"
  419. </verb></tscreen>
  420.  
  421. Here are some timing settings for specific systems:
  422.  
  423. <itemize>
  424. <item>On the ARM Pentium-90 or Midwest Micro Soundbook Plus, use
  425. ``<tt/freq_bypass=1 cmd_time=8/''.
  426. <item>On a Midwest Micro Soundbook Elite, use ``<tt/cmd_time=12/''.
  427. <item>On a Gateway Liberty, try ``<tt/cmd_time=16/''.
  428. </itemize>
  429.  
  430. On some systems using Cirrus controllers, including the NEC Versa M,
  431. the BIOS puts the controller in a special suspended state at system
  432. startup time.  On these systems, the <tt/probe/ command will fail to
  433. find any known PCMCIA controller.  If this happens, edit
  434. <tt>/etc/rc.d/rc.pcmcia</tt> by hand as follows:
  435.  
  436. <tscreen><verb>
  437. # Should be either i82365 or tcic
  438. PCIC=i82365
  439. # Put socket driver timing parameters here
  440. PCIC_OPTS="wakeup=1"
  441. </verb></tscreen>
  442.  
  443. <sect1>Problems loading kernel modules
  444.  
  445. <p>
  446. The configure script will normally ensure that the PCMCIA modules are
  447. compatible with your kernel.  So, module loading problems generally
  448. indicate that the user has interfered with the normal installation
  449. process in some way.  Some module loading errors are sent directly to
  450. the Linux console.  Other errors are recorded in the system log file,
  451. normally <tt>/usr/adm/messages</tt> or <tt>/var/log/messages</tt>.  To
  452. track down a problem, be sure to check both locations, to pin down
  453. which module is actually causing trouble.
  454.  
  455. Some of the PCMCIA modules require kernel services that may or may not
  456. be present, depending on kernel configuration.  For instance, the SCSI
  457. card drivers require that the kernel be configured with SCSI support,
  458. and the network drivers require a networking kernel.  If a kernel
  459. lacks a necessary feature, <tt/insmod/ may report undefined symbols
  460. and refuse to load a module.
  461.  
  462. If <tt/insmod/ reports ``wrong version'' errors, it means that the
  463. module was compiled for a different kernel version than your system is
  464. actually running.  This might occur if modules compiled on one machine
  465. are copied to another machine with a different configuration, or if
  466. the kernel is reconfigured after PCMCIA is installed.
  467.  
  468. Another source of module loading errors is when the modules and kernel
  469. were compiled with different settings of <tt/CONFIG_MODVERSIONS/.  If
  470. a module with version checking is loaded against a kernel without
  471. version checking, <tt/insmod/ will complain about undefined symbols.
  472.  
  473. Finally, relatively recent binutils releases are incompatible with
  474. older versions of the module utilities, and can cause module version
  475. incompatibilities to be reported.  The most common symptom is
  476. complaints about ``<tt/gcc_compiled/'' being undefined.  If you get
  477. these errors, upgrade to the latest module utilities, available from 
  478. <tt><http://www.pi.se/blox/modules></tt>.
  479.  
  480. <sect1>Problems with the card status change interrupt
  481.  
  482. <p>
  483. In most cases, the socket driver (<tt/i82365/ or <tt/tcic/) will
  484. automatically probe and select an appropriate interrupt to signal card
  485. status changes.  The automatic interrupt probe doesn't work on some
  486. Intel-compatible controllers, including Cirrus chips and the chips
  487. used in some IBM ThinkPads.  If a device is inactive at probe time,
  488. its interrupt may also appear to be available.  In these cases, the
  489. socket driver may pick an interrupt that is used by another device.
  490.  
  491. With the <tt/i82365/ and <tt/tcic/ drivers, the <tt/irq_mask/ option
  492. can be used to limit the interrupts that will be tested.  This mask
  493. limits the set of interrupts that can be used by PCMCIA cards as well
  494. as for monitoring card status changes.  The <tt/cs_irq/ option can
  495. also be used to explicitly set the interrupt to be used for monitoring
  496. card status changes.
  497.  
  498. If you can't find an interrupt number that works, there is also a
  499. polled status mode: both <tt/i82365/ and <tt/tcic/ will accept a
  500. <tt/poll_interval=100/ option, to poll for card status changes once
  501. per second.  This option should also be used if your system has a
  502. shortage of interrupts available for use by PCMCIA cards.  Especially
  503. for systems with more than one PCMCIA controller, there is little
  504. point in dedicating interrupts for monitoring card status changes.
  505.  
  506. All these options should be set in the <tt/PCIC_OPTS=/ line in either
  507. <tt>/etc/rc.d/rc.pcmcia</tt> or <tt>/etc/sysconfig/pcmcia</tt>,
  508. depending on your site setup.
  509.  
  510. The most common problem of this type seems to be a conflict with a
  511. PS/2 pointer device on interrupt 12.  In this case, edit
  512. <tt/rc.pcmcia/ so the <tt/PCIC_OPTS=/ line reads:
  513.  
  514. <tscreen><verb>
  515. PCIC_OPTS="irq_mask=0xefff"
  516. </verb></tscreen>
  517.  
  518. <sect1>Memory window configuration problems
  519.  
  520. <p>
  521. By default, the PCMCIA drivers use the address region 0xd0000-0xdffff
  522. to access PCMCIA devices.  This memory window is specified in
  523. <tt>/etc/pcmcia/config.opts</tt>.  If this address region is used by
  524. other devices in your system, cards may not be identified correctly.
  525. With chipsets that support it, conflicts can also result from memory
  526. shadowing in this region.  If you find that all your cards are always
  527. misidentified as memory cards, verify that shadowing is disabled in
  528. your system's hardware setup.  As there is no reliable way to
  529. automatically identify memory window conflicts, finding a good window
  530. may require some experimentation.  Some alternative windows to try are
  531. 0xd8000-0xdffff, 0xc0000-0xcffff, and 0xc8000-0xcffff.
  532.  
  533. If you have DOS PCMCIA drivers, you may be able to deduce what memory
  534. region those drivers use.  Note that DOS memory addresses are often
  535. specified in ``segment'' form, which leaves off the final hex digit
  536. (so an absolute address of 0xd0000 would be given as 0xd000).  Be sure
  537. to add the extra digit back when making changes to
  538. <tt>/etc/pcmcia/config.opts</tt>.  
  539.  
  540. <sect1>What about installation on Red Hat and Caldera?
  541.  
  542. <p>
  543. Red Hat and Caldera have a System V-ish arrangement for system startup
  544. files.  The PCMCIA installation scripts will automatically detect this
  545. and adjust accordingly.  The <tt/rc.pcmcia/ script will be installed as
  546. <tt>/etc/rc.d/init.d/pcmcia</tt>.  There is no need to edit any of the
  547. Caldera startup scripts to enable PCMCIA: it will happen
  548. automatically.
  549.  
  550. A separate configuration file, <tt>/etc/sysconfig/pcmcia</tt>, will
  551. be created for startup options.  If you need to change any module
  552. options (like the <tt/PCIC=/ or <tt/PCIC_OPTS=/ settings), edit this config
  553. file rather than the actual PCMCIA startup script.  This file will not
  554. be overwritten by subsequent installs.
  555.  
  556. Previous releases used the <tt>/etc/sysconfig/pcmcia-scripts</tt>
  557. directory in place of <tt>/etc/pcmcia</tt> on these platforms.  The
  558. current release instead uses <tt>/etc/pcmcia</tt> for all systems, and
  559. will move an existing <tt>/etc/sysconfig/pcmcia-scripts</tt> to
  560. <tt>/etc/pcmcia</tt>.
  561.  
  562. <sect1>Why don't you distribute PCMCIA binaries?
  563.  
  564. <p>
  565. For me, distributing binaries is a significant hassle.  It is
  566. complicated because some features can only be selected at compile
  567. time, and because the PCMCIA modules are somewhat dependent on having
  568. the ``right'' kernel configuration.  So, I would probably need to
  569. distribute precompiled modules along with matching kernels.  Beyond
  570. this, the greatest need for precompiled modules is when installing
  571. Linux on a clean system.  This typically requires setting up PCMCIA so
  572. that it can be used in the installation process for a particular Linux
  573. distribution.  Each Linux distribution has its own procedures, and it
  574. is not feasible for me to provide boot and root disks for even just
  575. the common combinations of drivers and distributions.
  576.  
  577. PCMCIA is now a part of many of the major Linux distributions,
  578. including Red Hat, Caldera, Slackware, Yggdrasil, Craftworks, and
  579. Nascent Technology.
  580.  
  581. <sect1>Why is the PCMCIA package so darned big?
  582.  
  583. <p>
  584. Well, first of all, it isn't actually that large.  All the driver
  585. modules together take up about 200K of disk space.  The utility
  586. programs add up to about 70K, and the stuff in /etc/pcmcia is about
  587. 30K.  When running, the core PCMCIA modules take up 48K of system
  588. memory.  The cardmgr daemon will generally be swapped out except when
  589. cards are inserted or removed.  The total package size is not much
  590. different from DOS Card Services implementations.
  591.  
  592. Compared to DOS ``point enablers'', this may still seem like a lot of
  593. overhead, especially for people that don't plan on using many of the
  594. features of PCMCIA, such as power management or hot swapping.  Point
  595. enablers can be tiny because they generally support only one or a
  596. small set of cards, and also generally support a restricted set of
  597. PCMCIA controllers.  If someone were to write a genuinely ``generic''
  598. modem enabler, it would end up incorporating much of the functionality
  599. of Card Services, to handle cards from different vendors and the full
  600. range of PCMCIA controller variants.
  601.  
  602. <sect>Usage and features
  603.  
  604. <sect1>How do I tell if it is working?
  605.  
  606. <p>
  607. The <tt/cardmgr/ daemon normally beeps when a card is inserted, and
  608. the tone of the beeps indicates the status of the newly inserted card.
  609. Two high beeps indicate the card was identified and configured
  610. successfully.  A high beep followed by a lower beep indicates that the
  611. card was identified, but could not be configured for some reason.  One
  612. low beep indicates that the card could not be identified.
  613.  
  614. If you are running X, the new <tt/cardinfo/ utility produces a slick
  615. graphical display showing the current status of all PCMCIA sockets.
  616.  
  617. If the modules are all loaded correctly, the output of the <tt/lsmod/
  618. command should look like the following, with no cards inserted:
  619.  
  620. <tscreen><verb>
  621. Module:        #pages:  Used by:
  622. ds                 2
  623. i82365             3
  624. pcmcia_core        7    [ds i82365]
  625. </verb></tscreen>
  626.  
  627. All the PCMCIA modules and the <tt/cardmgr/ daemon send status
  628. messages to the system log.  This will usually be
  629. <tt>/var/log/messages</tt> or <tt>/usr/adm/messages</tt>.
  630. This file should be the first place to
  631. look when tracking down a problem.  When submitting a bug report,
  632. always include the contents of this file.  <tt/Cardmgr/ also records
  633. some current device information for each socket in <tt>/var/run/stab</tt>.
  634. Here is a sample <tt>/var/run/stab</tt> listing:
  635.  
  636. <tscreen><verb>
  637. Socket 0: Adaptec APA-1460 SlimSCSI
  638. 0    scsi    aha152x_cs    0    sda    8    0
  639. 0    scsi    aha152x_cs    1    scd0    11    0
  640. Socket 1: Serial or Modem Card
  641. 1    serial    serial_cs    0    cua1    5    65
  642. </verb></tscreen>
  643.  
  644. For the lines describing devices, the first field is the socket, the
  645. second is the device class, the third is the driver name, the fourth
  646. is used to number multiple devices associated with the same driver,
  647. the fifth is the device name, and the final two fields are the major
  648. and minor device numbers for this device.
  649.  
  650. <sect1>Overview of the PCMCIA configuration scripts
  651.  
  652. <p>
  653. Each PCMCIA device has an associated ``class'' that describes how it
  654. should be configured and managed.  Classes are associated with device
  655. drivers in <tt>/etc/pcmcia/config</tt>.  There are currently five IO
  656. device classes (network, SCSI, cdrom, fixed disk, and serial) and
  657. three memory device classes (FTL, memory, and pcmem).  For each class,
  658. there are two
  659. scripts in <tt>/etc/pcmcia/config</tt>: a main configuration script
  660. (i.e., <tt>/etc/pcmcia/scsi</tt> for SCSI devices), and an options
  661. script (i.e., <tt>/etc/pcmcia/scsi.opts</tt>).  The main script for a
  662. device will be invoked to configure that device when a card is
  663. inserted, and to shut down the device when the card is removed.  For
  664. cards with several associated devices, the script will be invoked for
  665. each device.
  666.  
  667. The config scripts start by extracting some information about a device
  668. from <tt>/var/run/stab</tt>.  Each script constructs a ``device address'',
  669. that uniquely describes the device it has been asked to configure, in
  670. the <tt/ADDRESS/ variable.  This is passed to the <tt/*.opts/ script,
  671. which should return information about how a device at this address
  672. should be configured.  For some devices, the device address is just
  673. the socket number.  For others, it includes extra information that may
  674. be useful in deciding how to configure the device.  For example,
  675. network devices pass their hardware ethernet address as part of the
  676. device address, so the <tt/network.opts/ script could use this to
  677. select from several different configurations.
  678.  
  679. The first part of all device addresses is the current PCMCIA
  680. ``scheme''.  This parameter is used to support multiple sets of device
  681. configurations based on a single external user-specified variable.
  682. One use of schemes would be to have a ``home'' scheme, and a ``work''
  683. scheme, which would include different sets of network configuration
  684. parameters.  The current scheme is selected using the <tt/cardctl/
  685. command.  The default if no scheme is set is ``default''.
  686.  
  687. As a general rule, when configuring Linux for a laptop, PCMCIA devices
  688. should only be configured from the PCMCIA device scripts.  Do not try
  689. to configure a PCMCIA device the same way you would configure a
  690. permanently attached device.
  691.  
  692. <sect1>How do I use my PCMCIA network card?
  693.  
  694. <p>
  695. Linux ethernet-type network interfaces normally have names like
  696. <tt/eth0/, <tt/eth1/, and so on.  Token-ring adapters are handled
  697. similarly, however they are named <tt/tr0/, <tt/tr1/, and so on.
  698. The <tt/ifconfig/ command is used to
  699. view or modify the state of a network interface.  A peculiarity of
  700. Linux is that network interfaces do not have corresponding device
  701. files under <tt>/dev</tt>, so don't be surprised when you can't find
  702. them.
  703.  
  704. When a PCMCIA ethernet card is detected, it will be assigned the first
  705. free interface name, which will probably be <tt/eth0/.  <tt/Cardmgr/
  706. will run the <tt>/etc/pcmcia/network</tt> script to configure the
  707. interface.
  708.  
  709. Do not configure your PCMCIA ethernet card in
  710. <tt>/etc/rc.d/rc.inet1</tt>, since the card may not be present when
  711. this script is executed.  Comment out everything except the loopback
  712. stuff in <tt/rc.inet1/.
  713. If your system has an automatic network configuration procedure, you
  714. should indicate that you do not have a network card installed.
  715. Instead, edit the
  716. <tt>/etc/pcmcia/network.opts</tt> file to match your local network setup.
  717. The <tt/network/ and <tt/network.opts/ scripts will be executed only
  718. when your ethernet card is actually present.
  719.  
  720. The device address passed to <tt/network.opts/ consists of three
  721. comma-separated fields: the scheme, the socket number, the device
  722. instance, and the card's hardware ethernet address.  The device
  723. instance is used to 
  724. number devices for cards that have several network interfaces, so it
  725. will usually be 0.  If you have several network cards used for
  726. different purposes, one option would be to configure the cards based
  727. on socket position, as in:
  728.  
  729. <tscreen><verb>
  730. case "$ADDRESS" in
  731. *,0,*,*)
  732.     # definitions for network card in socket 0
  733.     ;;
  734. *,1,*,*)
  735.     # definitions for network card in socket 1
  736.     ;;
  737. esac
  738. </verb></tscreen>
  739.  
  740. Alternatively, they could be configured using their hardware
  741. addresses, as in:
  742.  
  743. <tscreen><verb>
  744. case "$ADDRESS" in
  745. *,*,*,00:80:C8:76:00:B1)
  746.     # definitions for a D-Link card
  747.     ;;
  748. *,*,*,08:00:5A:44:80:01)
  749.     # definitions for an IBM card
  750. esac
  751. </verb></tscreen>
  752.  
  753. To automatically mount and unmount NFS filesystems, first add all
  754. these filesystems to <tt>/etc/fstab</tt>, but include <tt>noauto</tt>
  755. in the mount options.  In <tt>network.opts</tt>, list the filesystem
  756. mount points in the <tt>MOUNTS</tt> variable.  It is especially
  757. important to use either <tt/cardctl/ or <tt/cardinfo/ to shut down a
  758. network card when NFS mounts are configured this way.  It is not
  759. possible to cleanly unmount NFS filesystems if a network card is
  760. simply ejected without warning.
  761.  
  762. <sect1>How do I use my PCMCIA modem card?
  763.  
  764. <p>
  765. Linux serial devices are accessed via the <tt>/dev/cua*</tt> and
  766. <tt>/dev/ttyS*</tt> special device files.  The <tt/ttyS*/ devices are
  767. for incoming connections, such as directly connected terminals.  The
  768. <tt/cua*/ devices are for outgoing connections, such as modems.  The
  769. configuration of a serial device can be examined and modified with the
  770. <tt/setserial/ command.
  771.  
  772. When a PCMCIA serial or modem card is detected, it will be assigned to
  773. the first available serial device slot.  This will usually be
  774. <tt>/dev/cua1</tt> or <tt>/dev/cua2</tt>, depending on the number of
  775. built-in serial ports.  The default serial device option script,
  776. <tt>/etc/pcmcia/serial.opts</tt>, will link the appropriate device
  777. file to <tt>/dev/modem</tt> as a convenience.
  778.  
  779. Do not try to use <tt>/etc/rc.d/rc.serial</tt> to configure a PCMCIA
  780. modem.  This script should only be used to configure non-removable
  781. devices.  Modify <tt>/etc/pcmcia/serial.opts</tt> if you want to do
  782. anything special to set up your modem.
  783.  
  784. The device address passed to <tt/serial.opts/ has three comma-separated
  785. fields: the first is the scheme, the second  is the socket number, and
  786. the third is the device
  787. instance.  The device instance may take several values for cards that
  788. support multiple serial ports, but for single-port cards, it will
  789. always be 0.  If you commonly use more than one PCMCIA modem, you may
  790. want to specify different settings based on socket position, as in:
  791.  
  792. <tscreen><verb>
  793. case "$ADDRESS" in
  794. *,0,*)
  795.     # Options for modem in socket 0
  796.     ;;
  797. *,1,*)
  798.     # Options for modem in socket 1
  799.     ;;
  800. esac
  801. </verb></tscreen>
  802.  
  803. If a PCMCIA modem is already configured when Linux boots, it may be
  804. incorrectly identified as an ordinary built-in serial port.  This is
  805. harmless, however, when the PCMCIA drivers take control of the modem,
  806. it will be assigned a different device slot.  It is best to either
  807. parse <tt>/var/run/stab</tt> or use <tt>/dev/modem</tt>, rather than
  808. expecting a PCMCIA modem to always have the same device assignment.
  809.  
  810. If you configure your kernel to load the basic Linux serial port
  811. driver as a module, you must edit <tt>/etc/pcmcia/config</tt> to
  812. indicate that this module must be loaded.  Edit the serial device
  813. entry to read:
  814.  
  815. <tscreen><verb>
  816. device "serial_cs"
  817.   class "serial" module "char/serial", "serial_cs"
  818. </verb></tscreen>
  819.  
  820. <sect1>How do I use my PCMCIA SCSI card?
  821.  
  822. <p>
  823. All the currently supported PCMCIA SCSI cards are work-alikes of one
  824. of the following ISA bus cards: the Qlogic, the Adaptec AHA-152X, or
  825. the Future Domain TMC-16x0.  The PCMCIA drivers are built by linking
  826. some PCMCIA-specific code (in <tt/qlogic_cs.c/, <tt/toaster_cs.c/, or
  827. <tt/fdomain_cs.c/) with the normal Linux SCSI driver.
  828.  
  829. When a new SCSI host adapter is detected, the SCSI drivers will probe
  830. for devices.  Check the system log to make sure your devices are
  831. detected properly.  New SCSI devices will be assigned to the first
  832. available SCSI device files.  The first SCSI disk will be
  833. <tt>/dev/sda</tt>, the first SCSI tape will be <tt>/dev/st0</tt>, and
  834. the first CD-ROM will be <tt>/dev/scd0</tt>.
  835.  
  836. With 1.3.X kernels, the PCMCIA core drivers are able to find out from
  837. the kernel which SCSI devices are connected to a card.  They will be
  838. listed in <tt>/var/run/stab</tt>, and the SCSI configuration script,
  839. <tt>/etc/pcmcia/scsi</tt>, will be called once for each attached
  840. device, to either configure or shut down that device.  The default
  841. script does not take any actions to configure SCSI devices, but will
  842. properly unmount filesystems on SCSI devices when a card is removed.
  843.  
  844. With 1.2.X kernels, the PCMCIA drivers cannot automatically deduce
  845. which devices are associated with a particular SCSI adapter.  Instead,
  846. if you have one normal SCSI device configuration, you may list these
  847. devices in <tt>/etc/pcmcia/scsi.opts</tt>.  For example, if you
  848. normally have a SCSI disk and a CD-ROM, you would use:
  849.  
  850. <tscreen><verb>
  851. # For 1.2 kernels: list of attached devices
  852. SCSI_DEVICES="sda scd0"
  853. </verb></tscreen>
  854.  
  855. The device addresses passed to <tt/scsi.opts/ are complicated, because
  856. of the variety of things that can be attached to a SCSI adapter.
  857. Addresses consist of either six or seven comma-separated fields: the
  858. current scheme, the
  859. device type, the socket number, the SCSI channel, ID, and logical unit
  860. number, and optionally, the partition number.  The device type will be
  861. ``sd'' for disks, ``st'' for tapes, ``sr'' for CD-ROM devices, and
  862. ``sg'' for generic SCSI devices.  For most setups, the SCSI channel
  863. and logical unit number will be 0.  For disk devices with several
  864. partitions, <tt/scsi.opts/ will first be called for the whole device,
  865. with a five-field address.  The script should set the <tt/PARTS/
  866. variable to a list of partitions.  Then, <tt/scsi.opts/ will be called
  867. for each partition, with the longer seven-field addresses.  For example,
  868. here is a script for configuring a disk device at SCSI ID 3, with two
  869. partitions, and a CD-ROM at SCSI ID 6:
  870.  
  871. <tscreen><verb>
  872. case "$ADDRESS" in
  873. *,sd,*,0,3,0)
  874.     # This device has two partitions...
  875.     PARTS="1 2"
  876.     ;;
  877. *,sd,*,0,3,0,1)
  878.     # Options for partition 1:
  879.     #  update /etc/fstab, and mount an ext2 fs on /usr1
  880.     DO_FSTAB="y" ; DO_FSCK="y" ; DO_MOUNT="y"
  881.     FSTYPE="ext2"
  882.     OPTS=""
  883.     MOUNTPT="/usr1"
  884.     ;;
  885. *,sd,*,0,3,0,2)
  886.     # Options for partition 2:
  887.     #  update /etc/fstab, and mount an MS-DOS fs on /usr2
  888.     DO_FSTAB="y" ; DO_FSCK="y" ; DO_MOUNT="y"
  889.     FSTYPE="msdos"
  890.     OPTS=""
  891.     MOUNTPT="/usr2"
  892.     ;;
  893. *,sr,*,0,6,0)
  894.     # Options for CD-ROM at SCSI ID 6
  895.     PARTS=""
  896.     DO_FSTAB="y" ; DO_FSCK="n" ; DO_MOUNT="y"
  897.     FSTYPE="iso9660"
  898.     OPTS="ro"
  899.     MOUNTPT="/cdrom"
  900.     ;;
  901. esac
  902. </verb></tscreen>
  903.  
  904. If your kernel does not have a top-level driver (disk, tape, etc) for
  905. a particular SCSI device, then the device will not be configured by
  906. the PCMCIA drivers.  As a side effect, the device's name in
  907. <tt>/var/run/stab</tt> will be something like ``sd#nnnn'' where ``nnnn''
  908. is a four-digit hex number.  This happens when <tt/cardmgr/ is unable
  909. to translate a SCSI device ID into a corresponding Linux device name.
  910.  
  911. It is possible to modularize the top-level SCSI drivers so that they
  912. are only loaded when a PCMCIA SCSI adapter is detected.  To do so, you
  913. need to edit <tt>/etc/pcmcia/config</tt> to tell <tt/cardmgr/ which
  914. extra modules need to be loaded when your adapter is configured.
  915. For example:
  916.  
  917. <tscreen><verb>
  918. device "aha152x_cs"
  919.   class "scsi" module "scsi/scsi_mod", "scsi/sd_mod", "aha152x_cs"
  920. </verb></tscreen>
  921.  
  922. would say to load the core SCSI module and the top-level disk driver
  923. module before loading the regular PCMCIA driver module.
  924.  
  925. Always turn on SCSI devices before powering up your laptop, or before
  926. inserting the adapter card, so that the SCSI bus is properly
  927. terminated when the adapter is configured.  Also be very careful about
  928. ejecting a SCSI adapter.  Be sure that all associated SCSI devices are
  929. unmounted and closed before ejecting the card.  The best way to ensure
  930. this is to use either <tt/cardctl/ or <tt/cardinfo/ to request card
  931. removal before physically ejecting the card.  For now, all SCSI
  932. devices should be powered up before plugging in a SCSI adapter, and
  933. should stay connected until after you unplug the adapter and/or power
  934. down your laptop.
  935.  
  936. There is a potential complication when using these cards that does not
  937. arise with ordinary ISA bus adapters.  The SCSI bus carries a
  938. ``termination power'' signal that is necessary for proper operation of
  939. ordinary passive SCSI terminators.  PCMCIA SCSI adapters do not supply
  940. termination power, so if it is required, an external device must
  941. supply it.  Some external SCSI devices may be configured to supply
  942. termination power.  Others, such as the Zip Drive and the Syquest
  943. EZ-Drive, use active terminators that do not depend on it.  In some
  944. cases, it may be necessary to use a special terminator block such as
  945. the APS SCSI Sentry 2, which has an external power supply.  When
  946. configuring your SCSI device chain, be aware of whether or not any of
  947. your devices require or can provide termination power.
  948.  
  949. The Adaptec APA-460 SlimSCSI adapter is not supported.  This card was
  950. originally sold under the Trantor name, and when Adaptec merged with
  951. Trantor, they continued to sell the Trantor card with an Adaptec
  952. label.  The APA-460 is not compatible with any existing Linux driver.
  953. I'm not sure how hard it would be to write a driver; I don't think
  954. anyone has been able to obtain the technical information from Adaptec.
  955.  
  956. The (unsupported) Trantor SlimSCSI can be identified by the following:
  957.  
  958. <tscreen><verb>
  959. Trantor / Adaptec APA-460 SlimSCSI
  960. FCC ID: IE8T460
  961. Shipped with SCSIworks! driver software
  962. </verb></tscreen>
  963.  
  964. The (supported) Adaptec SlimSCSI can be identified by the following:
  965.  
  966. <tscreen><verb>
  967. Adaptec APA-1460 SlimSCSI
  968. FCC ID: FGT1460
  969. P/N: 900100
  970. Shipped with EZ-SCSI driver software
  971. </verb></tscreen>
  972.  
  973. <sect1>How do I use my PCMCIA memory card?
  974.  
  975. <p>
  976. The default memory card startup script will create block and character
  977. devices for accessing each partition on a memory card.  There are two
  978. memory card drivers... <tt/pcmem_cs/, the older driver, works well for
  979. simple static RAM cards.  The newer driver, <tt/memory_cs/, is mostly
  980. for direct access to flash memory cards.  Check the man pages for a
  981. detailed description of how devices are named.  Both block and
  982. character devices are created.  The block device is used for disk-like
  983. access (creating and mounting filesystems, etc).  The character device
  984. is for "raw" reads and writes at arbitrary locations.
  985.  
  986. To use a flash memory card as an ordinary disk-like block device,
  987. first create a ``flash translation layer'' partition on the device
  988. with the <tt/ftl_format/ command:
  989.  
  990. <tscreen><verb>
  991. ftl_format -i /dev/mem0c0c
  992. </verb></tscreen>
  993.  
  994. Note that this command accesses the card through the ``raw'' memory
  995. card interface.  Once formatted, the card can be accessed as an
  996. ordinary block device via the <tt/ftl_cs/ driver.  For example:
  997.  
  998. <tscreen><verb>
  999. mke2fs /dev/ftl0
  1000. mount -t ext2 /dev/ftl0 /mnt
  1001. </verb></tscreen>
  1002.  
  1003. With the FTL and ``new'' memory drivers, the device address passed to
  1004. <tt/ftl.opts/ and <tt/memory.opts/ consists of two fields: the socket
  1005. number, and the partition number.  Common memory partitions are
  1006. numbered before attribute memory partitions.  Generally, the only
  1007. interesting partition is partition 0 (the main common-memory
  1008. partition, where data is stored).  Here is an example of a script that
  1009. will automatically mount flash memory cards based on which socket they
  1010. are inserted into:
  1011.  
  1012. <tscreen><verb>
  1013. case "$ADDRESS" in
  1014. *,0,0)
  1015.     # Mount filesystem, but don't update /etc/fstab
  1016.     DO_FSTAB="n" ; DO_FSCK="y" ; DO_MOUNT="y"
  1017.     FSTYPE="ext2" ; OPTS=""
  1018.     MOUNTPT="/ftl0"
  1019.     ;;
  1020. *,1,0)
  1021.     # Mount filesystem, but don't update /etc/fstab
  1022.     DO_FSTAB="n" ; DO_FSCK="y" ; DO_MOUNT="y"
  1023.     FSTYPE="ext2" ; OPTS=""
  1024.     MOUNTPT="/ftl1"
  1025.     ;;
  1026. esac
  1027. </verb></tscreen>
  1028.  
  1029. There are two major formats for flash memory cards: the ``flash
  1030. translation layer'' style, and the Microsoft Flash File System.  The
  1031. FTL format is generally more flexible because it allows any ordinary
  1032. high-level filesystem (ext2, ms-dos, etc) to be used on a flash card
  1033. as if it were an ordinary disk device.  The FFS is a complete new
  1034. filesystem type.  Linux cannot currently handle cards formated with
  1035. FFS.
  1036.  
  1037. <sect1>How do I use my ATA/IDE card drive?
  1038.  
  1039. <p>
  1040. ATA/IDE drive support requires a 1.3.72 or higher kernel.  The
  1041. PCMCIA-specific part of the driver is <tt/fixed_cs/.  Be sure to use
  1042. <tt/cardctl/ or <tt/cardinfo/ to shut down an ATA/IDE card before
  1043. ejecting it, as the driver has not been made ``hot-swap-proof''.
  1044.  
  1045. The device addresses passed to <tt/fixed.opts/ consist of either two
  1046. or three fields: the current scheme, the socket number, and an
  1047. optional partition number.  As with SCSI devices, <tt/fixed.opts/ is
  1048. first called for the entire device.  If <tt/fixed.opts/ returns a list
  1049. of partitions in the <tt/PARTS/ variable, the script will then be
  1050. called for each partition.
  1051.  
  1052. Here is an example <tt/fixed.opts/ file to mount the first partition
  1053. of any ATA/IDE card on <tt>/mnt</tt>.
  1054.  
  1055. <tscreen><verb>
  1056. case "$ADDRESS" in
  1057. *,*)
  1058.     PARTS="1"
  1059.     ;;
  1060. *,*,1)
  1061.     DO_FSTAB="y" ; DO_FSCK="y" ; DO_MOUNT="y"
  1062.     FSTYPE="msdos"
  1063.     OPTS=""
  1064.     MOUNTPT="/mnt"
  1065.     ;;
  1066. esac
  1067. </verb></tscreen>
  1068.  
  1069. <sect1>How do I tell <tt/cardmgr/ how to identify a new card?<label id="new-card"> 
  1070.  
  1071. <p>
  1072. Assuming that your card is supported by an existing driver, all
  1073. that needs to be done is to add an entry to
  1074. <tt>/etc/pcmcia/config</tt> to tell <tt/cardmgr/ how to identify the card,
  1075. and which driver(s) need to be linked up to this card.  Check the man
  1076. page for <tt/pcmcia/ for more information about the config file format.
  1077. If you insert an unknown card, <tt/cardmgr/ will normally record some
  1078. identification information in the system log that can be
  1079. used to construct the config entry.
  1080.  
  1081. Here is an example of how cardmgr will report an unsupported card in
  1082. <tt>/usr/adm/messages</tt>.
  1083.  
  1084. <tscreen><verb>
  1085. cardmgr[460]: unsupported card in socket 1
  1086. cardmgr[460]: version info: "MEGAHERTZ", "XJ2288", "V.34 PCMCIA MODEM"
  1087. </verb></tscreen>
  1088.  
  1089. The corresponding entry in <tt>/etc/pcmcia/config</tt> would be:
  1090.  
  1091. <tscreen><verb>
  1092. card "Megahertz XJ2288 V.34 Fax Modem"
  1093.   version "MEGAHERTZ", "XJ2288", "V.34 PCMCIA MODEM"
  1094.   bind "serial_cs"
  1095. </verb></tscreen>
  1096.  
  1097. You can use ``*'' to match strings that don't need to match exactly,
  1098. like version numbers.  When making new config entries, be careful
  1099. to copy the strings exactly, preserving case and blank spaces.
  1100. Also be sure that the config entry has the same number of strings as
  1101. are reported in the log file.
  1102.  
  1103. After editing <tt>/etc/pcmcia/config</tt>, you can signal <tt/cardmgr/
  1104. to reload the file with:
  1105.  
  1106. <tscreen><verb>
  1107. kill -HUP `cat /var/run/cardmgr.pid`
  1108. </verb></tscreen>
  1109.  
  1110. If you do set up an entry for a new card, please send me a copy so
  1111. that I can include it in the standard config file.
  1112.  
  1113. <sect1>How do I control which interrupts and ports are used by a device?
  1114.  
  1115. <p>
  1116. In theory, it should not really matter which interrupt is allocated to
  1117. which device, as long as two devices are not configured to use the
  1118. same interrupt.  In <tt>/etc/pcmcia/config.opts</tt> you'll find
  1119. a place for excluding interrupts that are used by non-PCMCIA devices.
  1120.  
  1121. Note that the interrupt used to monitor card status changes is chosen
  1122. by the low-level socket driver module (<tt/i82365/ or <tt/tcic/)
  1123. before <tt/cardmgr/ parses <tt>/etc/pcmcia/config</tt>, so it is not
  1124. affected by changes to this file.  To set this interrupt, use the
  1125. <tt/irq_mask/ or <tt/cs_irq/ options when the socket driver is loaded,
  1126. in <tt>/etc/rc.d/rc.pcmcia</tt>.
  1127.  
  1128. All the client card drivers have a parameter called <tt/irq_mask/ for
  1129. specifying which interrupts they may try to allocate.  Each bit of
  1130. irq_mask corresponds to one irq line: bit 0 is irq 0, bit 1 is irq 1,
  1131. and so on.  So, a mask of 0x1200 would correspond to irq 9 and irq 12.
  1132. To limit a driver to use only one specific interrupt, its irq_mask
  1133. should have only one bit set.  These driver options should be set in
  1134. your <tt>/etc/pcmcia/config</tt> file.  For example:
  1135.  
  1136. <tscreen><verb>
  1137. device "serial_cs"
  1138.   module "serial_cs" opts "irq_mask=0x1100"
  1139.   ...
  1140. </verb></tscreen>
  1141.  
  1142. would specify that the serial driver should only use irq 8 or irq 12.
  1143. Note that Card Services will never allocate an interrupt that is
  1144. already in use by another device, or an interrupt that is excluded
  1145. in the config file.
  1146.  
  1147. There is no way to directly specify the I/O addresses for a PCMCIA
  1148. card to use.  The <tt>/etc/pcmcia/config.opts</tt> file allows you
  1149. to specify ranges of ports available for use by all PCMCIA devices.
  1150.  
  1151. After modifying <tt>/etc/pcmcia/config</tt>, you can restart
  1152. <tt/cardmgr/ with ``<tt/kill -HUP/''.
  1153.  
  1154. <sect1>When is it safe to insert or eject a PCMCIA card?
  1155.  
  1156. <p>
  1157. In theory, you can insert and remove PCMCIA cards at any time.
  1158. However, it is a good idea not to eject a card that is currently being
  1159. used by an application program.  Kernels older than 1.1.77 would often
  1160. lock up when serial/modem cards were ejected, but this should be fixed
  1161. now.
  1162.  
  1163. <sect1>How do I unload PCMCIA drivers?
  1164.  
  1165. <p>
  1166. To unload the entire PCMCIA package, invoke <tt/rc.pcmcia/ with:
  1167.  
  1168. <tscreen><verb>
  1169. /etc/rc.d/rc.pcmcia stop
  1170. </verb></tscreen>
  1171.  
  1172. This script will take several seconds to run, to give all client
  1173. drivers time to shut down gracefully.  If a PCMCIA device is currently
  1174. in use, the shutdown will be incomplete, and some kernel modules may
  1175. not be unloaded.  To avoid this, use ``<tt/cardctl eject/'' to shut
  1176. down all sockets before invoking <tt/rc.pcmcia/.  The exit status of
  1177. the <tt/cardctl/ command will indicate if any sockets could not be
  1178. shut down.
  1179.  
  1180. <sect1>How does Card Services deal with suspend/resume?
  1181.  
  1182. <p>
  1183. Card Services can be compiled with support for APM (Advanced Power
  1184. Management) if you've installed this package on your system.  APM is
  1185. incorporated into 1.3.46 and later kernels.  It is currently being
  1186. maintained by Rick Faith (faith@cs.unc.edu), and APM tools can be
  1187. obtained from <tt/ftp.cs.unc.edu/ in <tt>/pub/users/faith/linux</tt>.
  1188. The PCMCIA modules will automatically be configured
  1189. for APM if a compatible version is detected on your system.
  1190.  
  1191. Without resorting to APM, you can do ``<tt/cardctl suspend/'' before
  1192. suspending your laptop, and ``<tt/cardctl resume/'' after resuming, to
  1193. properly shut down and restart your PCMCIA cards.  This will not work
  1194. with a PCMCIA modem that is in use, because the serial driver isn't
  1195. able to save and restore the modem operating parameters.
  1196.  
  1197. APM seems to be unstable on some systems.  If you experience trouble
  1198. with APM and PCMCIA on your system, try to narrow down the problem to
  1199. one package or the other before reporting a bug.
  1200.  
  1201. <sect1>How do I turn off a PCMCIA card without ejecting it?
  1202.  
  1203. <p>
  1204. Use either the <tt/cardctl/ or <tt/cardinfo/ command.
  1205. ``<tt/cardctl suspend #/'' will suspend one socket, and turn off
  1206. its power.  The corresponding <tt/resume/ command will wake up the
  1207. card in its previous state.
  1208.  
  1209. <sect1>How can I have separate device configurations for home and work?
  1210.  
  1211. <p>
  1212. This is trivial using PCMCIA ``scheme'' support.
  1213. Use two configuration schemes, called ``home'' and ``work''.  Here is
  1214. an example of a <tt/network.opts/ script with scheme-specific
  1215. settings:
  1216.  
  1217. <tscreen><verb>
  1218. case "$ADDRESS" in
  1219. work,*,*,*)
  1220.     # definitions for network card in work scheme
  1221.     ;;
  1222. home,*,*,*|default,*,*,*)
  1223.     # definitions for network card in home scheme
  1224.     ;;
  1225. esac
  1226. </verb></tscreen>
  1227.  
  1228. The first part of a PCMCIA device address is always the configuration
  1229. scheme.  In this example, the second ``case'' clause will select for
  1230. both the ``home'' and ``default'' schemes.  So, if the scheme is unset
  1231. for any reason, it will default to the ``home'' setup.
  1232.  
  1233. Now, to choose between the two sets of settings, run either:
  1234.  
  1235. <tscreen><verb>
  1236. cardctl scheme home
  1237. </verb></tscreen>
  1238.  
  1239. or
  1240.  
  1241. <tscreen><verb>
  1242. cardctl scheme work
  1243. </verb></tscreen>
  1244.  
  1245. The <tt/cardctl/ command does the equivalent of shutting down all your
  1246. cards and restarting them.  The command can be safely executed whether
  1247. or not the PCMCIA system is loaded, but the command may fail if you
  1248. are using other PCMCIA devices at the time (even if their
  1249. configurations are not explicitly dependant on the scheme setting).
  1250.  
  1251. To find out the current PCMCIA scheme setting, run:
  1252.  
  1253. <tscreen><verb>
  1254. cardctl scheme
  1255. </verb></tscreen>
  1256.  
  1257. <sect>Problems with specific cards
  1258.  
  1259. <sect1>Why doesn't my modem work?
  1260.  
  1261. <p>
  1262. That's a broad question, but here's a quick troubleshooting guide.
  1263.  
  1264. <itemize>
  1265. <item>
  1266. Is your card recognized as a modem?  Check the system log and
  1267. make sure that <tt/cardmgr/ identifies the card correctly and starts up the
  1268. <tt/serial_cs/ driver.  If it doesn't, you may need to add a new entry to
  1269. your <tt>/etc/pcmcia/config</tt> file so that it will be identified properly.
  1270. See section <ref id="new-card" name="3.6"> for details.
  1271. <item>
  1272. Is the modem configured successfully by serial_cs?  Again, check
  1273. the system log and look for messages from the serial_cs driver.  If
  1274. you see ``register_serial() failed'', you may have an I/O port conflict
  1275. with another device.  Another
  1276. tip-off of a conflict is if the device is reported to be an 8250; most
  1277. modern PCMCIA modems should be identified as 16550A UART's.  If you
  1278. think you're seeing a port conflict, edit <tt>/etc/pcmcia/config.opts</tt>
  1279. and exclude the port range that was allocated for the modem.  
  1280. <item>
  1281. Is there an interrupt conflict?  If the system log looks good,
  1282. but the modem just doesn't seem to work, try using <tt/setserial/ to
  1283. change the irq to 0, and see if the modem works.  This causes the
  1284. serial driver to use a slower polled mode instead of using interrupts.
  1285. If this seems to fix the problem, it is likely that some other device
  1286. in your system is using the interrupt selected by serial_cs.  You
  1287. should add a line to <tt>/etc/pcmcia/config.opts</tt> to exclude this
  1288. interrupt.
  1289. <item>
  1290. If the modem seems to work only really, really slowly, this is an
  1291. almost certain indicator of an interrupt conflict.
  1292. <item>
  1293. Make sure your problem is really a PCMCIA one.  It may help to see
  1294. if the card works under DOS with the vendor's drivers.  Also, don't
  1295. test the card with something complex like SLIP until you are sure you
  1296. can make simple connections.  If simple things work but SLIP does not,
  1297. your problem is most likely with SLIP, not with PCMCIA.
  1298. </itemize>
  1299.  
  1300. <sect1>Why doesn't my network adapter card work?
  1301.  
  1302. <p>
  1303. Here's another quick troubleshooting guide.
  1304.  
  1305. <itemize>
  1306. <item>
  1307. Is your card recognized as an ethernet card?  Check the system log and
  1308. make sure that <tt/cardmgr/ identifies the card correctly and starts
  1309. up one of the network drivers.  If it doesn't, your card might still
  1310. be usable if it is compatible with a supported card.  This will be
  1311. most easily done if the card claims to be ``NE2000 compatible''.
  1312. <item>
  1313. Is the card configured properly?  If you are using a supported card,
  1314. and it was recognized by <tt/cardmgr/, but still doesn't work, there
  1315. might be an interrupt or port conflict with another device.  Find out
  1316. what resources the card is using (from the system log),
  1317. and try excluding these in <tt>/etc/pcmcia/config.opts</tt> to force
  1318. the card to use something different.
  1319. <item>
  1320. If your card seems to be configured properly, but sometimes locks up,
  1321. particularly under high load, you may need to try changing your socket
  1322. driver timing parameters.  See section <ref id="timing" name="2.3">
  1323. for more information.
  1324. <item>
  1325. If you get messages like ``network unreachable'' when you try to
  1326. access the network, then you have probably set up
  1327. <tt>/etc/pcmcia/network.opts</tt> incorrectly.  On the other hand,
  1328. mis-configured cards will usually fail silently.
  1329. <item>
  1330. To diagnose problems in <tt>/etc/pcmcia/network.opts</tt>, start by
  1331. trying to ping other systems on the same subnet using their IP
  1332. addresses.  Then try to ping your gateway, and then machines on other
  1333. subnets.  Ping machines by name only after trying these simpler tests.
  1334. <item>
  1335. Make sure your problem is really a PCMCIA one.  It may help to see see
  1336. if the card works under DOS with the vendor's drivers.  Double check
  1337. your modifications to the <tt>/etc/pcmcia/network.opts</tt> script.
  1338. Make sure your drop cable, ``T'' jack, terminator, etc are working.
  1339. </itemize>
  1340.  
  1341. Here are some comments about specific cards:
  1342.  
  1343. <itemize>
  1344. <item>
  1345. With IBM CCAE and Socket EA cards, you need
  1346. to pick the transceiver type (10base2, 10baseT, AUI) when the network
  1347. device is configured.  Make sure that the transceiver type reported in
  1348. the system log matches your connection.
  1349. <item>
  1350. The drivers for SMC, Megahertz, Ositech, and 3Com cards should
  1351. autodetect the attached network type (10base2 or 10baseT).  Setting
  1352. the transceiver type when the driver is loaded serves to define the
  1353. card's ``first guess''.
  1354. <item>
  1355. The Farallon EtherWave is actually based on the 3Com 3c589, with a
  1356. special transceiver.  Though the EtherWave uses 10baseT-style
  1357. connections, its transceiver requires that the 3c589 be configured in
  1358. 10base2 mode.
  1359. <item>
  1360. If you have trouble with an IBM CCAE, NE4100, Thomas Conrad, or
  1361. Kingston adapter, try increasing the memory access
  1362. time with the <tt/mem_speed=#/ option to the <tt/pcnet_cs/ module.
  1363. An example of how to do this is given in the standard <tt/config.opts/
  1364. file.  Try speeds of up to 1000 (in nanoseconds).
  1365. <item>
  1366. For the New Media Ethernet adapter, on some systems, it may be
  1367. necessary to increase the IO port access time with the
  1368. <tt/io_speed=#/ option when the <tt/pcmcia_core/ module is loaded.
  1369. Edit <tt/CORE_OPTS/ in <tt>/etc/rc.d/rc.pcmcia</tt> to set this option.
  1370. <item>
  1371. The driver used by the IBM and 3Com token ring adapters
  1372. seems to behave very badly if the cards are not connected to a ring
  1373. when they get initialized.  Always connect these cards to the net
  1374. before they are powered up.
  1375. </itemize>
  1376.  
  1377. <sect1>How do I select the transceiver type for a network card?
  1378.  
  1379. <p>
  1380. The transceiver type can be selected in <tt/network.opts/ using the
  1381. <tt/IF_PORT/ setting.  This can either be a numeric value as in
  1382. previous PCMCIA releases, or a keyword identifying the transceiver
  1383. type.  All the network drivers default to either autodetect the
  1384. interface if possible, or 10baseT otherwise.  The <tt/ifport/ command
  1385. can be used to check or set the current transceiver type.  For
  1386. example:
  1387.  
  1388. <tscreen><verb>
  1389. # ifport eth0 10base2
  1390. # ifport eth0
  1391. eth0    2 (10base2)
  1392. </verb></tscreen>
  1393.  
  1394. Current releases of the 3c589 driver attempt to autodetect the network
  1395. connection, but this doesn't seem to be completely functional yet.
  1396. For autodetection to work, the network cable should be connected to the
  1397. card when the card is configured.  Alternatively, once the network is
  1398. connected, you can force the driver to check the connection with:
  1399.  
  1400. <tscreen><verb>
  1401. ifconfig eth0 down up
  1402. </verb></tscreen>
  1403.  
  1404. <sect1>How do I add support for an NE2000-compatible ethernet card?
  1405.  
  1406. <p>
  1407. First, see if the card is already recognized by <tt/cardmgr/.  Some
  1408. cards not listed in <tt/SUPPORTED.CARDS/ are actually OEM versions of
  1409. cards that are supported.  If you find a card like this, let me know
  1410. so I can add it to the list.
  1411.  
  1412. If your card is not recognized, follow the instructions in section
  1413. <ref id="new-card" name="3.6"> to create a config entry for your card,
  1414. but bind the card to the memory card driver, <tt/pcmem_cs/ for now.
  1415. Restart <tt/cardmgr/ to use the new updated config file.
  1416.  
  1417. You will need to know your card's hardware ethernet address.  This
  1418. address is a series of six two-digit hex numbers, often printed on the
  1419. card itself.  If it is not printed on the card, you may be able to use
  1420. a DOS driver to display the address.  In any case, once you know it,
  1421. run:
  1422.  
  1423. <tscreen><verb>
  1424. dd if=/dev/pcmem0a count=20 | od -Ax -t x1
  1425. </verb></tscreen>
  1426.  
  1427. and search the output for your address.  Record the hex offset of the
  1428. first byte of the address.  Now, edit <tt>modules/pcnet_cs.c</tt> and
  1429. find the <tt/hw_info/ structure.  You'll need to create a new entry
  1430. for your card.  The first field is a descriptive name.  The next field
  1431. is the offset multiplied by two.  The
  1432. next three fields are the first three bytes of the hardware address.
  1433. The final field contains some flags for specific card features; to
  1434. start, try setting it to 0.
  1435.  
  1436. After editing <tt/pcnet_cs.c/, compile and install the new module.
  1437. Edit <tt>/etc/pcmcia/config</tt> again, and change the card binding
  1438. from <tt/pcmem_cs/ to <tt/pcnet_cs/.  Follow the instructions for
  1439. reloading the config file, and you should be all set.  Please send me
  1440. copies of your new <tt/hw_info/ and config entries.
  1441.  
  1442. If you can't find your card's hardware address in the hex dump, as a
  1443. method of last resort, it is possible to ``hardwire'' the address when
  1444. the <tt/pcnet_cs/ module is initialized.  Edit
  1445. <tt>/etc/pcmcia/config</tt> and add a <tt/hw_addr=/ option, like so:
  1446.  
  1447. <tscreen><verb>
  1448. module "pcnet_cs" opts "hw_addr=0x00,0x80,0xc8,0x01,0x02,0x03"
  1449. </verb></tscreen>
  1450.  
  1451. Substitute your own card's hardware address in the appropriate spot,
  1452. of course.
  1453.  
  1454. <sect1>Multifunction cards such as the 3Com 3c562
  1455.  
  1456. <p>
  1457. Starting with the 1.3.73 Linux kernel, a single interrupt can be
  1458. shared by several drivers, such as the serial driver and an ethernet
  1459. driver.  When using a multifunction card under a newer kernel, all
  1460. card functions can be used simultaneously.
  1461.  
  1462. Earlier kernels do not support interrupt sharing between different device
  1463. drivers, so it is not possible for the PCMCIA drivers to configure
  1464. this card for simultaneous ethernet and modem access.  The ethernet
  1465. and serial drivers are both loaded automatically.  However, the
  1466. ethernet driver ``owns'' the card interrupt by default.  To use the
  1467. modem, you can unload the ethernet driver and reconfigure the serial
  1468. port by doing something like:
  1469.  
  1470. <tscreen><verb>
  1471. ifconfig eth0 down
  1472. rmmod 3c589_cs
  1473. setserial /dev/modem autoconfig auto_irq
  1474. setserial /dev/modem
  1475. </verb></tscreen>
  1476.  
  1477. The second <tt/setserial/ should verify that the port has been
  1478. configured to use the interrupt previously used by the ethernet
  1479. driver.
  1480.  
  1481. <sect1>How do I use my PCMCIA floppy interface?
  1482.  
  1483. <p>
  1484. The PCMCIA floppy interface used in the Compaq Aero and a few other
  1485. laptops is not yet supported by this package.  The snag in supporting
  1486. the Aero floppy is that the Aero seems to use a customized
  1487. PCMCIA controller to support DMA to the floppy.  Without
  1488. knowing exactly how this is done, there isn't any way to implement
  1489. support under Linux.
  1490.  
  1491. If the floppy adapter card is present when an Aero is booted, the Aero
  1492. BIOS will configure the card, and Linux will identify it as a normal
  1493. floppy drive.  When the Linux PCMCIA drivers are loaded, they will
  1494. notice that the card is already configured and attached to a Linux
  1495. driver, and this socket will be left alone.  So, the drive can be used
  1496. if it is present at boot time, but the card is not hot swappable.
  1497.  
  1498. <sect1>What's up with support for Xircom cards?
  1499.  
  1500. <p>
  1501. Xircom does not share technical information about its cards without a
  1502. non-disclosure agreement.  This means that it is not really possible
  1503. to develop freely distributable drivers for Xircom cards without doing
  1504. legally dubious things like reverse engineering DOS drivers.
  1505.  
  1506. Recently, Xircom seems to have had a change of heart about their
  1507. non-disclosure policy, and it now seems that this information will be
  1508. more readily available in the future.  However, please do not pester
  1509. me with questions about Xircom cards: drivers will be announced when
  1510. they become available, and I will not try to guess when that will be.
  1511.  
  1512. The Xircom CreditCard Ethernet+Modem II card can be used as a modem
  1513. under Linux, with no special configuration.
  1514.  
  1515. <sect>Debugging tips and programming information
  1516.  
  1517. <sect1>How can I submit a helpful bug report?
  1518.  
  1519. <p>
  1520. Here are some things that should be included in all bug reports:
  1521.  
  1522. <itemize>
  1523. <item>Your system type, and the output of the <tt/probe/ command
  1524. <item>What PCMCIA cards you are using
  1525. <item>Your Linux kernel version, and PCMCIA version
  1526. <item>The contents of the <tt/config.out/ file
  1527. <item>Any changes you've made to the startup files in
  1528. <tt>/etc/pcmcia</tt>, or to <tt/rc.pcmcia/
  1529. <item>All PCMCIA-related stuff in your system log file
  1530. </itemize>
  1531.  
  1532. Before submitting a bug report, please check to make sure that you are
  1533. using an up-to-date copy of the driver package.  While it is somewhat
  1534. gratifying to read bug reports for things I've already fixed, it isn't
  1535. a particularly constructive use of my time.
  1536.  
  1537. If your problem involves a kernel fault, the register dump from the
  1538. fault is only useful if you can track down the fault address, EIP.  If
  1539. it is in the main kernel, look up the address in <tt/System.map/ to
  1540. identify the function at fault.  If the fault is in a loadable module,
  1541. it is a bit harder to trace.  With the current module tools,
  1542. ``<tt/ksyms -m/'' will report the base address of each loadable
  1543. module.  Pick the module that contains the EIP address, and subtract
  1544. its base address from EIP to get an offset inside that module.  Then,
  1545. run <tt/gdb/ on that module, and look up the offset with the <tt/list/
  1546. command.  This will only work if you've compiled that module with
  1547. <tt/-g/ to include debugging information.
  1548.  
  1549. Send bug reports to <tt/dhinds@allegro.stanford.edu/.  I prefer to handle
  1550. bug reports by email -- please avoid calling me at home or at work.
  1551. You can also submit bug reports via the WWW: see
  1552. <tt>http://hyper.stanford.edu/~dhinds/pcmcia/pcmcia.html</tt> for
  1553. details.
  1554.  
  1555. <sect1>Low level PCMCIA debugging aids
  1556.  
  1557. <p>
  1558. The PCMCIA modules contain a lot of conditionally-compiled debugging
  1559. code.  Most of this code is under control of the <tt/PCMCIA_DEBUG/
  1560. preprocessor define.  If this is undefined, debugging code will
  1561. not be compiled.  If set to 0, the code is compiled but inactive.
  1562. Larger numbers specify increasing levels of verbosity.  Each module
  1563. built with <tt/PCMCIA_DEBUG/ defined will have an integer parameter,
  1564. <tt/pc_debug/, that controls the verbosity of its output.  This
  1565. can be adjusted when the module is loaded, so output can be controlled
  1566. on a per-module basis without recompiling.  
  1567.  
  1568. There are a few debugging tools in the <tt>debug_tools/</tt>
  1569. subdirectory of the PCMCIA distribution.  The <tt/dump_tcic/ and
  1570. <tt/dump_i365/ utilities generate complete register dumps of the
  1571. PCMCIA controllers, and decode a lot of the register information.
  1572. They are most useful if you have access to a datasheet for the
  1573. corresponding controller chip.  The <tt/dump_tuples/ utility lists a
  1574. card's CIS (Card Information Structure), and decodes some of the
  1575. important bits.  And the <tt/dump_cisreg/ utility displays a card's
  1576. local configuration registers.
  1577.  
  1578. The <tt/pcmem_cs/ memory card driver is also sometimes useful for
  1579. debugging.  It can be bound to any PCMCIA card, and does not interfere
  1580. with other drivers.  It can be used to directly access any card's
  1581. attribute memory or common memory.
  1582.  
  1583. <sect1>How do I write a Card Services driver for card X?
  1584.  
  1585. <p>
  1586. The Linux PCMCIA Programmer's Guide is the best documentation for the
  1587. Linux PCMCIA interface.  The latest version is always available from
  1588. <tt/cb-iris.stanford.edu/ in <tt>/pub/pcmcia/doc</tt>.
  1589.  
  1590. For devices that are close relatives of normal ISA devices, you'll
  1591. probably be able to use parts of existing Linux drivers.  In some
  1592. cases, the biggest stumbling block will be modifying an existing
  1593. driver so that it can handle adding and removing devices after boot
  1594. time.  Of the current drivers, the memory card driver is the only
  1595. ``self-contained'' driver that does not depend on other parts of the
  1596. Linux kernel to do most of the dirty work.
  1597.  
  1598. I've written a skeleton driver with lots of comments that explains a
  1599. lot of how a driver communicates with Card Services; you'll find this
  1600. in the PCMCIA source distribution in <tt>modules/skeleton.c</tt>.
  1601.  
  1602. </article>
  1603.