mca.txt 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. i386 Micro Channel Architecture Support
  2. =======================================
  3. MCA support is enabled using the CONFIG_MCA define. A machine with a MCA
  4. bus will have the kernel variable MCA_bus set, assuming the BIOS feature
  5. bits are set properly (see arch/i386/boot/setup.S for information on
  6. how this detection is done).
  7. Adapter Detection
  8. =================
  9. The ideal MCA adapter detection is done through the use of the
  10. Programmable Option Select registers. Generic functions for doing
  11. this have been added in include/linux/mca.h and arch/i386/kernel/mca.c.
  12. Everything needed to detect adapters and read (and write) configuration
  13. information is there. A number of MCA-specific drivers already use
  14. this. The typical probe code looks like the following:
  15. #include <linux/mca.h>
  16. unsigned char pos2, pos3, pos4, pos5;
  17. struct net_device* dev;
  18. int slot;
  19. if( MCA_bus ) {
  20. slot = mca_find_adapter( ADAPTER_ID, 0 );
  21. if( slot == MCA_NOTFOUND ) {
  22. return -ENODEV;
  23. }
  24. /* optional - see below */
  25. mca_set_adapter_name( slot, "adapter name & description" );
  26. mca_set_adapter_procfn( slot, dev_getinfo, dev );
  27. /* read the POS registers. Most devices only use 2 and 3 */
  28. pos2 = mca_read_stored_pos( slot, 2 );
  29. pos3 = mca_read_stored_pos( slot, 3 );
  30. pos4 = mca_read_stored_pos( slot, 4 );
  31. pos5 = mca_read_stored_pos( slot, 5 );
  32. } else {
  33. return -ENODEV;
  34. }
  35. /* extract configuration from pos[2345] and set everything up */
  36. Loadable modules should modify this to test that the specified IRQ and
  37. IO ports (plus whatever other stuff) match. See 3c523.c for example
  38. code (actually, smc-mca.c has a slightly more complex example that can
  39. handle a list of adapter ids).
  40. Keep in mind that devices should never directly access the POS registers
  41. (via inb(), outb(), etc). While it's generally safe, there is a small
  42. potential for blowing up hardware when it's done at the wrong time.
  43. Furthermore, accessing a POS register disables a device temporarily.
  44. This is usually okay during startup, but do _you_ want to rely on it?
  45. During initial configuration, mca_init() reads all the POS registers
  46. into memory. mca_read_stored_pos() accesses that data. mca_read_pos()
  47. and mca_write_pos() are also available for (safer) direct POS access,
  48. but their use is _highly_ discouraged. mca_write_pos() is particularly
  49. dangerous, as it is possible for adapters to be put in inconsistent
  50. states (i.e. sharing IO address, etc) and may result in crashes, toasted
  51. hardware, and blindness.
  52. User level drivers (such as the AGX X server) can use /proc/mca/pos to
  53. find adapters (see below).
  54. Some MCA adapters can also be detected via the usual ISA-style device
  55. probing (many SCSI adapters, for example). This sort of thing is highly
  56. discouraged. Perfectly good information is available telling you what's
  57. there, so there's no excuse for messing with random IO ports. However,
  58. we MCA people still appreciate any ISA-style driver that will work with
  59. our hardware. You take what you can get...
  60. Level-Triggered Interrupts
  61. ==========================
  62. Because MCA uses level-triggered interrupts, a few problems arise with
  63. what might best be described as the ISA mindset and its effects on
  64. drivers. These sorts of problems are expected to become less common as
  65. more people use shared IRQs on PCI machines.
  66. In general, an interrupt must be acknowledged not only at the ICU (which
  67. is done automagically by the kernel), but at the device level. In
  68. particular, IRQ 0 must be reset after a timer interrupt (now done in
  69. arch/i386/kernel/time.c) or the first timer interrupt hangs the system.
  70. There were also problems with the 1.3.x floppy drivers, but that seems
  71. to have been fixed.
  72. IRQs are also shareable, and most MCA-specific devices should be coded
  73. with shared IRQs in mind.
  74. /proc/mca
  75. =========
  76. /proc/mca is a directory containing various files for adapters and
  77. other stuff.
  78. /proc/mca/pos Straight listing of POS registers
  79. /proc/mca/slot[1-8] Information on adapter in specific slot
  80. /proc/mca/video Same for integrated video
  81. /proc/mca/scsi Same for integrated SCSI
  82. /proc/mca/machine Machine information
  83. See Appendix A for a sample.
  84. Device drivers can easily add their own information function for
  85. specific slots (including integrated ones) via the
  86. mca_set_adapter_procfn() call. Drivers that support this are ESDI, IBM
  87. SCSI, and 3c523. If a device is also a module, make sure that the proc
  88. function is removed in the module cleanup. This will require storing
  89. the slot information in a private structure somewhere. See the 3c523
  90. driver for details.
  91. Your typical proc function will look something like this:
  92. static int
  93. dev_getinfo( char* buf, int slot, void* d ) {
  94. struct net_device* dev = (struct net_device*) d;
  95. int len = 0;
  96. len += sprintf( buf+len, "Device: %s\n", dev->name );
  97. len += sprintf( buf+len, "IRQ: %d\n", dev->irq );
  98. len += sprintf( buf+len, "IO Port: %#lx-%#lx\n", ... );
  99. ...
  100. return len;
  101. }
  102. Some of the standard MCA information will already be printed, so don't
  103. bother repeating it. Don't try putting in more than 3K of information.
  104. Enable this function with:
  105. mca_set_adapter_procfn( slot, dev_getinfo, dev );
  106. Disable it with:
  107. mca_set_adapter_procfn( slot, NULL, NULL );
  108. It is also recommended that, even if you don't write a proc function, to
  109. set the name of the adapter (i.e. "PS/2 ESDI Controller") via
  110. mca_set_adapter_name( int slot, char* name ).
  111. MCA Device Drivers
  112. ==================
  113. Currently, there are a number of MCA-specific device drivers.
  114. 1) PS/2 ESDI
  115. drivers/block/ps2esdi.c
  116. include/linux/ps2esdi.h
  117. Uses major number 36, and should use /dev files /dev/eda, /dev/edb.
  118. Supports two drives, but only one controller. May use the
  119. command-line args "ed=cyl,head,sec" and "tp720".
  120. 2) PS/2 SCSI
  121. drivers/scsi/ibmmca.c
  122. drivers/scsi/ibmmca.h
  123. The driver for the IBM SCSI subsystem. Includes both integrated
  124. controllers and adapter cards. May require command-line arg
  125. "ibmmcascsi=io_port" to force detection of an adapter. If you have a
  126. machine with a front-panel display (i.e. model 95), you can use
  127. "ibmmcascsi=display" to enable a drive activity indicator.
  128. 3) 3c523
  129. drivers/net/3c523.c
  130. drivers/net/3c523.h
  131. 3Com 3c523 Etherlink/MC ethernet driver.
  132. 4) SMC Ultra/MCA and IBM Adapter/A
  133. drivers/net/smc-mca.c
  134. drivers/net/smc-mca.h
  135. Driver for the MCA version of the SMC Ultra and various other
  136. OEM'ed and work-alike cards (Elite, Adapter/A, etc).
  137. 5) NE/2
  138. driver/net/ne2.c
  139. driver/net/ne2.h
  140. The NE/2 is the MCA version of the NE2000. This may not work
  141. with clones that have a different adapter id than the original
  142. NE/2.
  143. 6) Future Domain MCS-600/700, OEM'd IBM Fast SCSI Adapter/A and
  144. Reply Sound Blaster/SCSI (SCSI part)
  145. Better support for these cards than the driver for ISA.
  146. Supports multiple cards with IRQ sharing.
  147. Also added boot time option of scsi-probe, which can do reordering of
  148. SCSI host adapters. This will direct the kernel on the order which
  149. SCSI adapter should be detected. Example:
  150. scsi-probe=ibmmca,fd_mcs,adaptec1542,buslogic
  151. The serial drivers were modified to support the extended IO port range
  152. of the typical MCA system (also #ifdef CONFIG_MCA).
  153. The following devices work with existing drivers:
  154. 1) Token-ring
  155. 2) Future Domain SCSI (MCS-600, MCS-700, not MCS-350, OEM'ed IBM SCSI)
  156. 3) Adaptec 1640 SCSI (using the aha1542 driver)
  157. 4) Bustek/Buslogic SCSI (various)
  158. 5) Probably all Arcnet cards.
  159. 6) Some, possibly all, MCA IDE controllers.
  160. 7) 3Com 3c529 (MCA version of 3c509) (patched)
  161. 8) Intel EtherExpressMC (patched version)
  162. You need to have CONFIG_MCA defined to have EtherExpressMC support.
  163. 9) Reply Sound Blaster/SCSI (SB part) (patched version)
  164. Bugs & Other Weirdness
  165. ======================
  166. NMIs tend to occur with MCA machines because of various hardware
  167. weirdness, bus timeouts, and many other non-critical things. Some basic
  168. code to handle them (inspired by the NetBSD MCA code) has been added to
  169. detect the guilty device, but it's pretty incomplete. If NMIs are a
  170. persistent problem (on some model 70 or 80s, they occur every couple
  171. shell commands), the CONFIG_IGNORE_NMI flag will take care of that.
  172. Various Pentium machines have had serious problems with the FPU test in
  173. bugs.h. Basically, the machine hangs after the HLT test. This occurs,
  174. as far as we know, on the Pentium-equipped 85s, 95s, and some PC Servers.
  175. The PCI/MCA PC 750s are fine as far as I can tell. The ``mca-pentium''
  176. boot-prompt flag will disable the FPU bug check if this is a problem
  177. with your machine.
  178. The model 80 has a raft of problems that are just too weird and unique
  179. to get into here. Some people have no trouble while others have nothing
  180. but problems. I'd suspect some problems are related to the age of the
  181. average 80 and accompanying hardware deterioration, although others
  182. are definitely design problems with the hardware. Among the problems
  183. include SCSI controller problems, ESDI controller problems, and serious
  184. screw-ups in the floppy controller. Oh, and the parallel port is also
  185. pretty flaky. There were about 5 or 6 different model 80 motherboards
  186. produced to fix various obscure problems. As far as I know, it's pretty
  187. much impossible to tell which bugs a particular model 80 has (other than
  188. triggering them, that is).
  189. Drivers are required for some MCA memory adapters. If you're suddenly
  190. short a few megs of RAM, this might be the reason. The (I think) Enhanced
  191. Memory Adapter commonly found on the model 70 is one. There's a very
  192. alpha driver floating around, but it's pretty ugly (disassembled from
  193. the DOS driver, actually). See the MCA Linux web page (URL below)
  194. for more current memory info.
  195. The Thinkpad 700 and 720 will work, but various components are either
  196. non-functional, flaky, or we don't know anything about them. The
  197. graphics controller is supposed to be some WD, but we can't get things
  198. working properly. The PCMCIA slots don't seem to work. Ditto for APM.
  199. The serial ports work, but detection seems to be flaky.
  200. Credits
  201. =======
  202. A whole pile of people have contributed to the MCA code. I'd include
  203. their names here, but I don't have a list handy. Check the MCA Linux
  204. home page (URL below) for a perpetually out-of-date list.
  205. =====================================================================
  206. MCA Linux Home Page: http://www.dgmicro.com/mca/
  207. Christophe Beauregard
  208. chrisb@truespectra.com
  209. cpbeaure@calum.csclub.uwaterloo.ca
  210. =====================================================================
  211. Appendix A: Sample /proc/mca
  212. This is from my model 8595. Slot 1 contains the standard IBM SCSI
  213. adapter, slot 3 is an Adaptec AHA-1640, slot 5 is a XGA-1 video adapter,
  214. and slot 7 is the 3c523 Etherlink/MC.
  215. /proc/mca/machine:
  216. Model Id: 0xf8
  217. Submodel Id: 0x14
  218. BIOS Revision: 0x5
  219. /proc/mca/pos:
  220. Slot 1: ff 8e f1 fc a0 ff ff ff IBM SCSI Adapter w/Cache
  221. Slot 2: ff ff ff ff ff ff ff ff
  222. Slot 3: 1f 0f 81 3b bf b6 ff ff
  223. Slot 4: ff ff ff ff ff ff ff ff
  224. Slot 5: db 8f 1d 5e fd c0 00 00
  225. Slot 6: ff ff ff ff ff ff ff ff
  226. Slot 7: 42 60 ff 08 ff ff ff ff 3Com 3c523 Etherlink/MC
  227. Slot 8: ff ff ff ff ff ff ff ff
  228. Video : ff ff ff ff ff ff ff ff
  229. SCSI : ff ff ff ff ff ff ff ff
  230. /proc/mca/slot1:
  231. Slot: 1
  232. Adapter Name: IBM SCSI Adapter w/Cache
  233. Id: 8eff
  234. Enabled: Yes
  235. POS: ff 8e f1 fc a0 ff ff ff
  236. Subsystem PUN: 7
  237. Detected at boot: Yes
  238. /proc/mca/slot3:
  239. Slot: 3
  240. Adapter Name: Unknown
  241. Id: 0f1f
  242. Enabled: Yes
  243. POS: 1f 0f 81 3b bf b6 ff ff
  244. /proc/mca/slot5:
  245. Slot: 5
  246. Adapter Name: Unknown
  247. Id: 8fdb
  248. Enabled: Yes
  249. POS: db 8f 1d 5e fd c0 00 00
  250. /proc/mca/slot7:
  251. Slot: 7
  252. Adapter Name: 3Com 3c523 Etherlink/MC
  253. Id: 6042
  254. Enabled: Yes
  255. POS: 42 60 ff 08 ff ff ff ff
  256. Revision: 0xe
  257. IRQ: 9
  258. IO Address: 0x3300-0x3308
  259. Memory: 0xd8000-0xdbfff
  260. Transceiver: External
  261. Device: eth0
  262. Hardware Address: 02 60 8c 45 c4 2a