aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-23 20:12:06 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-23 20:12:06 -0400
commitd5b4bb4d103cd601d8009f2d3a7e44586c9ae7cc (patch)
tree0f3b6da2b66fc7a4278764982279c2815c913010
parentc80ddb526331a72c9e9d1480f85f6fd7c74e3d2d (diff)
parentbb8187d35f820671d6dd76700d77a6b55f95e2c5 (diff)
Merge branch 'delete-mca' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux
Pull the MCA deletion branch from Paul Gortmaker: "It was good that we could support MCA machines back in the day, but realistically, nobody is using them anymore. They were mostly limited to 386-sx 16MHz CPU and some 486 class machines and never more than 64MB of RAM. Even the enthusiast hobbyist community seems to have dried up close to ten years ago, based on what you can find searching various websites dedicated to the relatively short lived hardware. So lets remove the support relating to CONFIG_MCA. There is no point carrying this forward, wasting cycles doing routine maintenance on it; wasting allyesconfig build time on validating it, wasting I/O on git grep'ping over it, and so on." Let's see if anybody screams. It generally has compiled, and James Bottomley pointed out that there was a MCA extension from NCR that allowed for up to 4GB of memory and PPro-class machines. So in *theory* there may be users out there. But even James (technically listed as a maintainer) doesn't actually have a system, and while Alan Cox claims to have a machine in his cellar that he offered to anybody who wants to take it off his hands, he didn't argue for keeping MCA support either. So we could bring it back. But somebody had better speak up and talk about how they have actually been using said MCA hardware with modern kernels for us to do that. And David already took the patch to delete all the networking driver code (commit a5e371f61ad3: "drivers/net: delete all code/drivers depending on CONFIG_MCA"). * 'delete-mca' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux: MCA: delete all remaining traces of microchannel bus support. scsi: delete the MCA specific drivers and driver code serial: delete the MCA specific 8250 support. arm: remove ability to select CONFIG_MCA
-rw-r--r--Documentation/00-INDEX2
-rw-r--r--Documentation/DocBook/Makefile2
-rw-r--r--Documentation/DocBook/kernel-api.tmpl13
-rw-r--r--Documentation/DocBook/mcabook.tmpl107
-rw-r--r--Documentation/devices.txt8
-rw-r--r--Documentation/eisa.txt2
-rw-r--r--Documentation/kernel-parameters.txt1
-rw-r--r--Documentation/mca.txt313
-rw-r--r--Documentation/scsi/00-INDEX2
-rw-r--r--Documentation/scsi/ibmmca.txt1402
-rw-r--r--Documentation/scsi/scsi-parameters.txt6
-rw-r--r--Documentation/scsi/scsi_mid_low_api.txt2
-rw-r--r--Documentation/serial/stallion.txt22
-rw-r--r--MAINTAINERS13
-rw-r--r--arch/arm/Kconfig8
-rw-r--r--arch/frv/include/asm/processor.h1
-rw-r--r--arch/x86/Kconfig10
-rw-r--r--arch/x86/include/asm/mca.h43
-rw-r--r--arch/x86/include/asm/mca_dma.h201
-rw-r--r--arch/x86/include/asm/mpspec.h2
-rw-r--r--arch/x86/include/asm/mpspec_def.h3
-rw-r--r--arch/x86/kernel/Makefile1
-rw-r--r--arch/x86/kernel/acpi/boot.c2
-rw-r--r--arch/x86/kernel/apic/io_apic.c17
-rw-r--r--arch/x86/kernel/mca_32.c476
-rw-r--r--arch/x86/kernel/mpparse.c11
-rw-r--r--arch/x86/kernel/nmi.c12
-rw-r--r--arch/x86/kernel/setup.c8
-rw-r--r--arch/x86/kernel/time.c6
-rw-r--r--arch/x86/kernel/traps.c4
-rw-r--r--drivers/Makefile1
-rw-r--r--drivers/mca/Kconfig14
-rw-r--r--drivers/mca/Makefile7
-rw-r--r--drivers/mca/mca-bus.c169
-rw-r--r--drivers/mca/mca-device.c218
-rw-r--r--drivers/mca/mca-driver.c63
-rw-r--r--drivers/mca/mca-legacy.c329
-rw-r--r--drivers/mca/mca-proc.c249
-rw-r--r--drivers/message/i2o/i2o_proc.c13
-rw-r--r--drivers/scsi/Kconfig83
-rw-r--r--drivers/scsi/Makefile2
-rw-r--r--drivers/scsi/aha1542.c66
-rw-r--r--drivers/scsi/fd_mcs.c1354
-rw-r--r--drivers/scsi/ibmmca.c2379
-rw-r--r--drivers/scsi/sim710.c124
-rw-r--r--drivers/tty/serial/8250/8250_mca.c61
-rw-r--r--drivers/tty/serial/8250/Kconfig9
-rw-r--r--drivers/tty/serial/8250/Makefile1
-rw-r--r--include/linux/i2o-dev.h2
-rw-r--r--include/linux/mca-legacy.h66
-rw-r--r--include/linux/mca.h148
-rw-r--r--include/linux/serial.h2
-rw-r--r--include/linux/serial_8250.h1
-rw-r--r--scripts/kconfig/mconf.c2
-rw-r--r--scripts/kconfig/nconf.c2
55 files changed, 32 insertions, 8033 deletions
diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX
index 2214f123a976..49c051380daf 100644
--- a/Documentation/00-INDEX
+++ b/Documentation/00-INDEX
@@ -218,8 +218,6 @@ m68k/
218 - directory with info about Linux on Motorola 68k architecture. 218 - directory with info about Linux on Motorola 68k architecture.
219magic-number.txt 219magic-number.txt
220 - list of magic numbers used to mark/protect kernel data structures. 220 - list of magic numbers used to mark/protect kernel data structures.
221mca.txt
222 - info on supporting Micro Channel Architecture (e.g. PS/2) systems.
223md.txt 221md.txt
224 - info on boot arguments for the multiple devices driver. 222 - info on boot arguments for the multiple devices driver.
225memory-barriers.txt 223memory-barriers.txt
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
index 66725a3d30dc..bc3d9f8c0a90 100644
--- a/Documentation/DocBook/Makefile
+++ b/Documentation/DocBook/Makefile
@@ -6,7 +6,7 @@
6# To add a new book the only step required is to add the book to the 6# To add a new book the only step required is to add the book to the
7# list of DOCBOOKS. 7# list of DOCBOOKS.
8 8
9DOCBOOKS := z8530book.xml mcabook.xml device-drivers.xml \ 9DOCBOOKS := z8530book.xml device-drivers.xml \
10 kernel-hacking.xml kernel-locking.xml deviceiobook.xml \ 10 kernel-hacking.xml kernel-locking.xml deviceiobook.xml \
11 writing_usb_driver.xml networking.xml \ 11 writing_usb_driver.xml networking.xml \
12 kernel-api.xml filesystems.xml lsm.xml usb.xml kgdb.xml \ 12 kernel-api.xml filesystems.xml lsm.xml usb.xml kgdb.xml \
diff --git a/Documentation/DocBook/kernel-api.tmpl b/Documentation/DocBook/kernel-api.tmpl
index 7160652a8736..00687ee9d363 100644
--- a/Documentation/DocBook/kernel-api.tmpl
+++ b/Documentation/DocBook/kernel-api.tmpl
@@ -212,19 +212,6 @@ X!Edrivers/pci/hotplug.c
212 <sect1><title>PCI Hotplug Support Library</title> 212 <sect1><title>PCI Hotplug Support Library</title>
213!Edrivers/pci/hotplug/pci_hotplug_core.c 213!Edrivers/pci/hotplug/pci_hotplug_core.c
214 </sect1> 214 </sect1>
215 <sect1><title>MCA Architecture</title>
216 <sect2><title>MCA Device Functions</title>
217 <para>
218 Refer to the file arch/x86/kernel/mca_32.c for more information.
219 </para>
220<!-- FIXME: Removed for now since no structured comments in source
221X!Earch/x86/kernel/mca_32.c
222-->
223 </sect2>
224 <sect2><title>MCA Bus DMA</title>
225!Iarch/x86/include/asm/mca_dma.h
226 </sect2>
227 </sect1>
228 </chapter> 215 </chapter>
229 216
230 <chapter id="firmware"> 217 <chapter id="firmware">
diff --git a/Documentation/DocBook/mcabook.tmpl b/Documentation/DocBook/mcabook.tmpl
deleted file mode 100644
index 467ccac6ec50..000000000000
--- a/Documentation/DocBook/mcabook.tmpl
+++ /dev/null
@@ -1,107 +0,0 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
4
5<book id="MCAGuide">
6 <bookinfo>
7 <title>MCA Driver Programming Interface</title>
8
9 <authorgroup>
10 <author>
11 <firstname>Alan</firstname>
12 <surname>Cox</surname>
13 <affiliation>
14 <address>
15 <email>alan@lxorguk.ukuu.org.uk</email>
16 </address>
17 </affiliation>
18 </author>
19 <author>
20 <firstname>David</firstname>
21 <surname>Weinehall</surname>
22 </author>
23 <author>
24 <firstname>Chris</firstname>
25 <surname>Beauregard</surname>
26 </author>
27 </authorgroup>
28
29 <copyright>
30 <year>2000</year>
31 <holder>Alan Cox</holder>
32 <holder>David Weinehall</holder>
33 <holder>Chris Beauregard</holder>
34 </copyright>
35
36 <legalnotice>
37 <para>
38 This documentation is free software; you can redistribute
39 it and/or modify it under the terms of the GNU General Public
40 License as published by the Free Software Foundation; either
41 version 2 of the License, or (at your option) any later
42 version.
43 </para>
44
45 <para>
46 This program is distributed in the hope that it will be
47 useful, but WITHOUT ANY WARRANTY; without even the implied
48 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
49 See the GNU General Public License for more details.
50 </para>
51
52 <para>
53 You should have received a copy of the GNU General Public
54 License along with this program; if not, write to the Free
55 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
56 MA 02111-1307 USA
57 </para>
58
59 <para>
60 For more details see the file COPYING in the source
61 distribution of Linux.
62 </para>
63 </legalnotice>
64 </bookinfo>
65
66<toc></toc>
67
68 <chapter id="intro">
69 <title>Introduction</title>
70 <para>
71 The MCA bus functions provide a generalised interface to find MCA
72 bus cards, to claim them for a driver, and to read and manipulate POS
73 registers without being aware of the motherboard internals or
74 certain deep magic specific to onboard devices.
75 </para>
76 <para>
77 The basic interface to the MCA bus devices is the slot. Each slot
78 is numbered and virtual slot numbers are assigned to the internal
79 devices. Using a pci_dev as other busses do does not really make
80 sense in the MCA context as the MCA bus resources require card
81 specific interpretation.
82 </para>
83 <para>
84 Finally the MCA bus functions provide a parallel set of DMA
85 functions mimicing the ISA bus DMA functions as closely as possible,
86 although also supporting the additional DMA functionality on the
87 MCA bus controllers.
88 </para>
89 </chapter>
90 <chapter id="bugs">
91 <title>Known Bugs And Assumptions</title>
92 <para>
93 None.
94 </para>
95 </chapter>
96
97 <chapter id="pubfunctions">
98 <title>Public Functions Provided</title>
99!Edrivers/mca/mca-legacy.c
100 </chapter>
101
102 <chapter id="dmafunctions">
103 <title>DMA Functions Provided</title>
104!Iarch/x86/include/asm/mca_dma.h
105 </chapter>
106
107</book>
diff --git a/Documentation/devices.txt b/Documentation/devices.txt
index 5941f5136c6b..47a154f30290 100644
--- a/Documentation/devices.txt
+++ b/Documentation/devices.txt
@@ -847,13 +847,7 @@ Your cooperation is appreciated.
847 ... 847 ...
848 31 = /dev/tap15 16th Ethertap device 848 31 = /dev/tap15 16th Ethertap device
849 849
850 36 block MCA ESDI hard disk 850 36 block OBSOLETE (was MCA ESDI hard disk)
851 0 = /dev/eda First ESDI disk whole disk
852 64 = /dev/edb Second ESDI disk whole disk
853 ...
854
855 Partitions are handled in the same way as IDE disks
856 (see major number 3).
857 851
858 37 char IDE tape 852 37 char IDE tape
859 0 = /dev/ht0 First IDE tape 853 0 = /dev/ht0 First IDE tape
diff --git a/Documentation/eisa.txt b/Documentation/eisa.txt
index 38cf0c7b559f..a55e4910924e 100644
--- a/Documentation/eisa.txt
+++ b/Documentation/eisa.txt
@@ -179,7 +179,7 @@ CONFIG_ALPHA_JENSEN or CONFIG_EISA_VLB_PRIMING are set.
179 179
180Converting an EISA driver to the new API mostly involves *deleting* 180Converting an EISA driver to the new API mostly involves *deleting*
181code (since probing is now in the core EISA code). Unfortunately, most 181code (since probing is now in the core EISA code). Unfortunately, most
182drivers share their probing routine between ISA, MCA and EISA. Special 182drivers share their probing routine between ISA, and EISA. Special
183care must be taken when ripping out the EISA code, so other busses 183care must be taken when ripping out the EISA code, so other busses
184won't suffer from these surgical strikes... 184won't suffer from these surgical strikes...
185 185
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 8cb10f77c723..5b6e58492229 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -70,7 +70,6 @@ parameter is applicable:
70 M68k M68k architecture is enabled. 70 M68k M68k architecture is enabled.
71 These options have more detailed description inside of 71 These options have more detailed description inside of
72 Documentation/m68k/kernel-options.txt. 72 Documentation/m68k/kernel-options.txt.
73 MCA MCA bus support is enabled.
74 MDA MDA console support is enabled. 73 MDA MDA console support is enabled.
75 MIPS MIPS architecture is enabled. 74 MIPS MIPS architecture is enabled.
76 MOUSE Appropriate mouse support is enabled. 75 MOUSE Appropriate mouse support is enabled.
diff --git a/Documentation/mca.txt b/Documentation/mca.txt
deleted file mode 100644
index dfd130c2207d..000000000000
--- a/Documentation/mca.txt
+++ /dev/null
@@ -1,313 +0,0 @@
1i386 Micro Channel Architecture Support
2=======================================
3
4MCA support is enabled using the CONFIG_MCA define. A machine with a MCA
5bus will have the kernel variable MCA_bus set, assuming the BIOS feature
6bits are set properly (see arch/i386/boot/setup.S for information on
7how this detection is done).
8
9Adapter Detection
10=================
11
12The ideal MCA adapter detection is done through the use of the
13Programmable Option Select registers. Generic functions for doing
14this have been added in include/linux/mca.h and arch/x86/kernel/mca_32.c.
15Everything needed to detect adapters and read (and write) configuration
16information is there. A number of MCA-specific drivers already use
17this. The typical probe code looks like the following:
18
19 #include <linux/mca.h>
20
21 unsigned char pos2, pos3, pos4, pos5;
22 struct net_device* dev;
23 int slot;
24
25 if( MCA_bus ) {
26 slot = mca_find_adapter( ADAPTER_ID, 0 );
27 if( slot == MCA_NOTFOUND ) {
28 return -ENODEV;
29 }
30 /* optional - see below */
31 mca_set_adapter_name( slot, "adapter name & description" );
32 mca_set_adapter_procfn( slot, dev_getinfo, dev );
33
34 /* read the POS registers. Most devices only use 2 and 3 */
35 pos2 = mca_read_stored_pos( slot, 2 );
36 pos3 = mca_read_stored_pos( slot, 3 );
37 pos4 = mca_read_stored_pos( slot, 4 );
38 pos5 = mca_read_stored_pos( slot, 5 );
39 } else {
40 return -ENODEV;
41 }
42
43 /* extract configuration from pos[2345] and set everything up */
44
45Loadable modules should modify this to test that the specified IRQ and
46IO ports (plus whatever other stuff) match. See 3c523.c for example
47code (actually, smc-mca.c has a slightly more complex example that can
48handle a list of adapter ids).
49
50Keep in mind that devices should never directly access the POS registers
51(via inb(), outb(), etc). While it's generally safe, there is a small
52potential for blowing up hardware when it's done at the wrong time.
53Furthermore, accessing a POS register disables a device temporarily.
54This is usually okay during startup, but do _you_ want to rely on it?
55During initial configuration, mca_init() reads all the POS registers
56into memory. mca_read_stored_pos() accesses that data. mca_read_pos()
57and mca_write_pos() are also available for (safer) direct POS access,
58but their use is _highly_ discouraged. mca_write_pos() is particularly
59dangerous, as it is possible for adapters to be put in inconsistent
60states (i.e. sharing IO address, etc) and may result in crashes, toasted
61hardware, and blindness.
62
63User level drivers (such as the AGX X server) can use /proc/mca/pos to
64find adapters (see below).
65
66Some MCA adapters can also be detected via the usual ISA-style device
67probing (many SCSI adapters, for example). This sort of thing is highly
68discouraged. Perfectly good information is available telling you what's
69there, so there's no excuse for messing with random IO ports. However,
70we MCA people still appreciate any ISA-style driver that will work with
71our hardware. You take what you can get...
72
73Level-Triggered Interrupts
74==========================
75
76Because MCA uses level-triggered interrupts, a few problems arise with
77what might best be described as the ISA mindset and its effects on
78drivers. These sorts of problems are expected to become less common as
79more people use shared IRQs on PCI machines.
80
81In general, an interrupt must be acknowledged not only at the ICU (which
82is done automagically by the kernel), but at the device level. In
83particular, IRQ 0 must be reset after a timer interrupt (now done in
84arch/x86/kernel/time.c) or the first timer interrupt hangs the system.
85There were also problems with the 1.3.x floppy drivers, but that seems
86to have been fixed.
87
88IRQs are also shareable, and most MCA-specific devices should be coded
89with shared IRQs in mind.
90
91/proc/mca
92=========
93
94/proc/mca is a directory containing various files for adapters and
95other stuff.
96
97 /proc/mca/pos Straight listing of POS registers
98 /proc/mca/slot[1-8] Information on adapter in specific slot
99 /proc/mca/video Same for integrated video
100 /proc/mca/scsi Same for integrated SCSI
101 /proc/mca/machine Machine information
102
103See Appendix A for a sample.
104
105Device drivers can easily add their own information function for
106specific slots (including integrated ones) via the
107mca_set_adapter_procfn() call. Drivers that support this are ESDI, IBM
108SCSI, and 3c523. If a device is also a module, make sure that the proc
109function is removed in the module cleanup. This will require storing
110the slot information in a private structure somewhere. See the 3c523
111driver for details.
112
113Your typical proc function will look something like this:
114
115 static int
116 dev_getinfo( char* buf, int slot, void* d ) {
117 struct net_device* dev = (struct net_device*) d;
118 int len = 0;
119
120 len += sprintf( buf+len, "Device: %s\n", dev->name );
121 len += sprintf( buf+len, "IRQ: %d\n", dev->irq );
122 len += sprintf( buf+len, "IO Port: %#lx-%#lx\n", ... );
123 ...
124
125 return len;
126 }
127
128Some of the standard MCA information will already be printed, so don't
129bother repeating it. Don't try putting in more than 3K of information.
130
131Enable this function with:
132 mca_set_adapter_procfn( slot, dev_getinfo, dev );
133
134Disable it with:
135 mca_set_adapter_procfn( slot, NULL, NULL );
136
137It is also recommended that, even if you don't write a proc function, to
138set the name of the adapter (i.e. "PS/2 ESDI Controller") via
139mca_set_adapter_name( int slot, char* name ).
140
141MCA Device Drivers
142==================
143
144Currently, there are a number of MCA-specific device drivers.
145
1461) PS/2 SCSI
147 drivers/scsi/ibmmca.c
148 drivers/scsi/ibmmca.h
149 The driver for the IBM SCSI subsystem. Includes both integrated
150 controllers and adapter cards. May require command-line arg
151 "ibmmcascsi=io_port" to force detection of an adapter. If you have a
152 machine with a front-panel display (i.e. model 95), you can use
153 "ibmmcascsi=display" to enable a drive activity indicator.
154
1552) 3c523
156 drivers/net/3c523.c
157 drivers/net/3c523.h
158 3Com 3c523 Etherlink/MC ethernet driver.
159
1603) SMC Ultra/MCA and IBM Adapter/A
161 drivers/net/smc-mca.c
162 drivers/net/smc-mca.h
163 Driver for the MCA version of the SMC Ultra and various other
164 OEM'ed and work-alike cards (Elite, Adapter/A, etc).
165
1664) NE/2
167 driver/net/ne2.c
168 driver/net/ne2.h
169 The NE/2 is the MCA version of the NE2000. This may not work
170 with clones that have a different adapter id than the original
171 NE/2.
172
1735) Future Domain MCS-600/700, OEM'd IBM Fast SCSI Adapter/A and
174 Reply Sound Blaster/SCSI (SCSI part)
175 Better support for these cards than the driver for ISA.
176 Supports multiple cards with IRQ sharing.
177
178Also added boot time option of scsi-probe, which can do reordering of
179SCSI host adapters. This will direct the kernel on the order which
180SCSI adapter should be detected. Example:
181 scsi-probe=ibmmca,fd_mcs,adaptec1542,buslogic
182
183The serial drivers were modified to support the extended IO port range
184of the typical MCA system (also #ifdef CONFIG_MCA).
185
186The following devices work with existing drivers:
1871) Token-ring
1882) Future Domain SCSI (MCS-600, MCS-700, not MCS-350, OEM'ed IBM SCSI)
1893) Adaptec 1640 SCSI (using the aha1542 driver)
1904) Bustek/Buslogic SCSI (various)
1915) Probably all Arcnet cards.
1926) Some, possibly all, MCA IDE controllers.
1937) 3Com 3c529 (MCA version of 3c509) (patched)
194
1958) Intel EtherExpressMC (patched version)
196 You need to have CONFIG_MCA defined to have EtherExpressMC support.
1979) Reply Sound Blaster/SCSI (SB part) (patched version)
198
199Bugs & Other Weirdness
200======================
201
202NMIs tend to occur with MCA machines because of various hardware
203weirdness, bus timeouts, and many other non-critical things. Some basic
204code to handle them (inspired by the NetBSD MCA code) has been added to
205detect the guilty device, but it's pretty incomplete. If NMIs are a
206persistent problem (on some model 70 or 80s, they occur every couple
207shell commands), the CONFIG_IGNORE_NMI flag will take care of that.
208
209Various Pentium machines have had serious problems with the FPU test in
210bugs.h. Basically, the machine hangs after the HLT test. This occurs,
211as far as we know, on the Pentium-equipped 85s, 95s, and some PC Servers.
212The PCI/MCA PC 750s are fine as far as I can tell. The ``mca-pentium''
213boot-prompt flag will disable the FPU bug check if this is a problem
214with your machine.
215
216The model 80 has a raft of problems that are just too weird and unique
217to get into here. Some people have no trouble while others have nothing
218but problems. I'd suspect some problems are related to the age of the
219average 80 and accompanying hardware deterioration, although others
220are definitely design problems with the hardware. Among the problems
221include SCSI controller problems, ESDI controller problems, and serious
222screw-ups in the floppy controller. Oh, and the parallel port is also
223pretty flaky. There were about 5 or 6 different model 80 motherboards
224produced to fix various obscure problems. As far as I know, it's pretty
225much impossible to tell which bugs a particular model 80 has (other than
226triggering them, that is).
227
228Drivers are required for some MCA memory adapters. If you're suddenly
229short a few megs of RAM, this might be the reason. The (I think) Enhanced
230Memory Adapter commonly found on the model 70 is one. There's a very
231alpha driver floating around, but it's pretty ugly (disassembled from
232the DOS driver, actually). See the MCA Linux web page (URL below)
233for more current memory info.
234
235The Thinkpad 700 and 720 will work, but various components are either
236non-functional, flaky, or we don't know anything about them. The
237graphics controller is supposed to be some WD, but we can't get things
238working properly. The PCMCIA slots don't seem to work. Ditto for APM.
239The serial ports work, but detection seems to be flaky.
240
241Credits
242=======
243A whole pile of people have contributed to the MCA code. I'd include
244their names here, but I don't have a list handy. Check the MCA Linux
245home page (URL below) for a perpetually out-of-date list.
246
247=====================================================================
248MCA Linux Home Page: http://www.dgmicro.com/mca/
249
250Christophe Beauregard
251chrisb@truespectra.com
252cpbeaure@calum.csclub.uwaterloo.ca
253
254=====================================================================
255Appendix A: Sample /proc/mca
256
257This is from my model 8595. Slot 1 contains the standard IBM SCSI
258adapter, slot 3 is an Adaptec AHA-1640, slot 5 is a XGA-1 video adapter,
259and slot 7 is the 3c523 Etherlink/MC.
260
261/proc/mca/machine:
262Model Id: 0xf8
263Submodel Id: 0x14
264BIOS Revision: 0x5
265
266/proc/mca/pos:
267Slot 1: ff 8e f1 fc a0 ff ff ff IBM SCSI Adapter w/Cache
268Slot 2: ff ff ff ff ff ff ff ff
269Slot 3: 1f 0f 81 3b bf b6 ff ff
270Slot 4: ff ff ff ff ff ff ff ff
271Slot 5: db 8f 1d 5e fd c0 00 00
272Slot 6: ff ff ff ff ff ff ff ff
273Slot 7: 42 60 ff 08 ff ff ff ff 3Com 3c523 Etherlink/MC
274Slot 8: ff ff ff ff ff ff ff ff
275Video : ff ff ff ff ff ff ff ff
276SCSI : ff ff ff ff ff ff ff ff
277
278/proc/mca/slot1:
279Slot: 1
280Adapter Name: IBM SCSI Adapter w/Cache
281Id: 8eff
282Enabled: Yes
283POS: ff 8e f1 fc a0 ff ff ff
284Subsystem PUN: 7
285Detected at boot: Yes
286
287/proc/mca/slot3:
288Slot: 3
289Adapter Name: Unknown
290Id: 0f1f
291Enabled: Yes
292POS: 1f 0f 81 3b bf b6 ff ff
293
294/proc/mca/slot5:
295Slot: 5
296Adapter Name: Unknown
297Id: 8fdb
298Enabled: Yes
299POS: db 8f 1d 5e fd c0 00 00
300
301/proc/mca/slot7:
302Slot: 7
303Adapter Name: 3Com 3c523 Etherlink/MC
304Id: 6042
305Enabled: Yes
306POS: 42 60 ff 08 ff ff ff ff
307Revision: 0xe
308IRQ: 9
309IO Address: 0x3300-0x3308
310Memory: 0xd8000-0xdbfff
311Transceiver: External
312Device: eth0
313Hardware Address: 02 60 8c 45 c4 2a
diff --git a/Documentation/scsi/00-INDEX b/Documentation/scsi/00-INDEX
index b7dd6502bec5..9b0787f965e9 100644
--- a/Documentation/scsi/00-INDEX
+++ b/Documentation/scsi/00-INDEX
@@ -56,8 +56,6 @@ g_NCR5380.txt
56 - info on driver for NCR5380 and NCR53c400 based adapters 56 - info on driver for NCR5380 and NCR53c400 based adapters
57hptiop.txt 57hptiop.txt
58 - HIGHPOINT ROCKETRAID 3xxx RAID DRIVER 58 - HIGHPOINT ROCKETRAID 3xxx RAID DRIVER
59ibmmca.txt
60 - info on driver for IBM adapters with MCA bus
61in2000.txt 59in2000.txt
62 - info on in2000 driver 60 - info on in2000 driver
63libsas.txt 61libsas.txt
diff --git a/Documentation/scsi/ibmmca.txt b/Documentation/scsi/ibmmca.txt
deleted file mode 100644
index ac41a9fcac77..000000000000
--- a/Documentation/scsi/ibmmca.txt
+++ /dev/null
@@ -1,1402 +0,0 @@
1
2 -=< The IBM Microchannel SCSI-Subsystem >=-
3
4 for the IBM PS/2 series
5
6 Low Level Software-Driver for Linux
7
8 Copyright (c) 1995 Strom Systems, Inc. under the terms of the GNU
9 General Public License. Originally written by Martin Kolinek, December 1995.
10 Officially modified and maintained by Michael Lang since January 1999.
11
12 Version 4.0a
13
14 Last update: January 3, 2001
15
16 Before you Start
17 ----------------
18 This is the common README.ibmmca file for all driver releases of the
19 IBM MCA SCSI driver for Linux. Please note, that driver releases 4.0
20 or newer do not work with kernel versions older than 2.4.0, while driver
21 versions older than 4.0 do not work with kernels 2.4.0 or later! If you
22 try to compile your kernel with the wrong driver source, the
23 compilation is aborted and you get a corresponding error message. This is
24 no bug in the driver; it prevents you from using the wrong source code
25 with the wrong kernel version.
26
27 Authors of this Driver
28 ----------------------
29 - Chris Beauregard (improvement of the SCSI-device mapping by the driver)
30 - Martin Kolinek (origin, first release of this driver)
31 - Klaus Kudielka (multiple SCSI-host management/detection, adaption to
32 Linux Kernel 2.1.x, module support)
33 - Michael Lang (assigning original pun/lun mapping, dynamical ldn
34 assignment, rewritten adapter detection, this file,
35 patches, official driver maintenance and subsequent
36 debugging, related with the driver)
37
38 Table of Contents
39 -----------------
40 1 Abstract
41 2 Driver Description
42 2.1 IBM SCSI-Subsystem Detection
43 2.2 Physical Units, Logical Units, and Logical Devices
44 2.3 SCSI-Device Recognition and dynamical ldn Assignment
45 2.4 SCSI-Device Order
46 2.5 Regular SCSI-Command-Processing
47 2.6 Abort & Reset Commands
48 2.7 Disk Geometry
49 2.8 Kernel Boot Option
50 2.9 Driver Module Support
51 2.10 Multiple Hostadapter Support
52 2.11 /proc/scsi-Filesystem Information
53 2.12 /proc/mca-Filesystem Information
54 2.13 Supported IBM SCSI-Subsystems
55 2.14 Linux Kernel Versions
56 3 Code History
57 4 To do
58 5 Users' Manual
59 5.1 Commandline Parameters
60 5.2 Troubleshooting
61 5.3 Bug reports
62 5.4 Support WWW-page
63 6 References
64 7 Credits to
65 7.1 People
66 7.2 Sponsors & Supporters
67 8 Trademarks
68 9 Disclaimer
69
70 * * *
71
72 1 Abstract
73 ----------
74 This README-file describes the IBM SCSI-subsystem low level driver for
75 Linux. The descriptions which were formerly kept in the source code have
76 been taken out of this file to simplify the codes readability. The driver
77 description has been updated, as most of the former description was already
78 quite outdated. The history of the driver development is also kept inside
79 here. Multiple historical developments have been summarized to shorten the
80 text size a bit. At the end of this file you can find a small manual for
81 this driver and hints to get it running on your machine.
82
83 2 Driver Description
84 --------------------
85 2.1 IBM SCSI-Subsystem Detection
86 --------------------------------
87 This is done in the ibmmca_detect() function. It first checks, if the
88 Microchannel-bus support is enabled, as the IBM SCSI-subsystem needs the
89 Microchannel. In a next step, a free interrupt is chosen and the main
90 interrupt handler is connected to it to handle answers of the SCSI-
91 subsystem(s). If the F/W SCSI-adapter is forced by the BIOS to use IRQ11
92 instead of IRQ14, IRQ11 is used for the IBM SCSI-2 F/W adapter. In a
93 further step it is checked, if the adapter gets detected by force from
94 the kernel commandline, where the I/O port and the SCSI-subsystem id can
95 be specified. The next step checks if there is an integrated SCSI-subsystem
96 installed. This register area is fixed through all IBM PS/2 MCA-machines
97 and appears as something like a virtual slot 10 of the MCA-bus. On most
98 PS/2 machines, the POS registers of slot 10 are set to 0xff or 0x00 if not
99 integrated SCSI-controller is available. But on certain PS/2s, like model
100 9595, this slot 10 is used to store other information which at earlier
101 stage confused the driver and resulted in the detection of some ghost-SCSI.
102 If POS-register 2 and 3 are not 0x00 and not 0xff, but all other POS
103 registers are either 0xff or 0x00, there must be an integrated SCSI-
104 subsystem present and it will be registered as IBM Integrated SCSI-
105 Subsystem. The next step checks, if there is a slot-adapter installed on
106 the MCA-bus. To get this, the first two POS-registers, that represent the
107 adapter ID are checked. If they fit to one of the ids, stored in the
108 adapter list, a SCSI-subsystem is assumed to be found in a slot and will be
109 registered. This check is done through all possible MCA-bus slots to allow
110 more than one SCSI-adapter to be present in the PS/2-system and this is
111 already the first point of problems. Looking into the technical reference
112 manual for the IBM PS/2 common interfaces, the POS2 register must have
113 different interpretation of its single bits to avoid overlapping I/O
114 regions. While one can assume, that the integrated subsystem has a fix
115 I/O-address at 0x3540 - 0x3547, further installed IBM SCSI-adapters must
116 use a different I/O-address. This is expressed by bit 1 to 3 of POS2
117 (multiplied by 8 + 0x3540). Bits 2 and 3 are reserved for the integrated
118 subsystem, but not for the adapters! The following list shows, how the
119 bits of POS2 and POS3 should be interpreted.
120
121 The POS2-register of all PS/2 models' integrated SCSI-subsystems has the
122 following interpretation of bits:
123 Bit 7 - 4 : Chip Revision ID (Release)
124 Bit 3 - 2 : Reserved
125 Bit 1 : 8k NVRAM Disabled
126 Bit 0 : Chip Enable (EN-Signal)
127 The POS3-register is interpreted as follows (for most IBM SCSI-subsys.):
128 Bit 7 - 5 : SCSI ID
129 Bit 4 - 0 : Reserved = 0
130 The slot-adapters have different interpretation of these bits. The IBM SCSI
131 adapter (w/Cache) and the IBM SCSI-2 F/W adapter use the following
132 interpretation of the POS2 register:
133 Bit 7 - 4 : ROM Segment Address Select
134 Bit 3 - 1 : Adapter I/O Address Select (*8+0x3540)
135 Bit 0 : Adapter Enable (EN-Signal)
136 and for the POS3 register:
137 Bit 7 - 5 : SCSI ID
138 Bit 4 : Fairness Enable (SCSI ID3 f. F/W)
139 Bit 3 - 0 : Arbitration Level
140 The most modern product of the series is the IBM SCSI-2 F/W adapter, it
141 allows dual-bus SCSI and SCSI-wide addressing, which means, PUNs may be
142 between 0 and 15. Here, Bit 4 is the high-order bit of the 4-bit wide
143 adapter PUN expression. In short words, this means, that IBM PS/2 machines
144 can only support 1 single integrated subsystem by default. Additional
145 slot-adapters get ports assigned by the automatic configuration tool.
146
147 One day I found a patch in ibmmca_detect(), forcing the I/O-address to be
148 0x3540 for integrated SCSI-subsystems, there was a remark placed, that on
149 integrated IBM SCSI-subsystems of model 56, the POS2 register was showing 5.
150 This means, that really for these models, POS2 has to be interpreted
151 sticking to the technical reference guide. In this case, the bit 2 (4) is
152 a reserved bit and may not be interpreted. These differences between the
153 adapters and the integrated controllers are taken into account by the
154 detection routine of the driver on from version >3.0g.
155
156 Every time, a SCSI-subsystem is discovered, the ibmmca_register() function
157 is called. This function checks first, if the requested area for the I/O-
158 address of this SCSI-subsystem is still available and assigns this I/O-
159 area to the SCSI-subsystem. There are always 8 sequential I/O-addresses
160 taken for each individual SCSI-subsystem found, which are:
161
162 Offset Type Permissions
163 0 Command Interface Register 1 Read/Write
164 1 Command Interface Register 2 Read/Write
165 2 Command Interface Register 3 Read/Write
166 3 Command Interface Register 4 Read/Write
167 4 Attention Register Read/Write
168 5 Basic Control Register Read/Write
169 6 Interrupt Status Register Read
170 7 Basic Status Register Read
171
172 After the I/O-address range is assigned, the host-adapter is assigned
173 to a local structure which keeps all adapter information needed for the
174 driver itself and the mid- and higher-level SCSI-drivers. The SCSI pun/lun
175 and the adapters' ldn tables are initialized and get probed afterwards by
176 the check_devices() function. If no further adapters are found,
177 ibmmca_detect() quits.
178
179 2.2 Physical Units, Logical Units, and Logical Devices
180 ------------------------------------------------------
181 There can be up to 56 devices on the SCSI bus (besides the adapter):
182 there are up to 7 "physical units" (each identified by physical unit
183 number or pun, also called the scsi id, this is the number you select
184 with hardware jumpers), and each physical unit can have up to 8
185 "logical units" (each identified by logical unit number, or lun,
186 between 0 and 7). The IBM SCSI-2 F/W adapter offers this on up to two
187 busses and provides support for 30 logical devices at the same time, where
188 in wide-addressing mode you can have 16 puns with 32 luns on each device.
189 This section describes the handling of devices on non-F/W adapters.
190 Just imagine, that you can have 16 * 32 = 512 devices on a F/W adapter
191 which means a lot of possible devices for such a small machine.
192
193 Typically the adapter has pun=7, so puns of other physical units
194 are between 0 and 6(15). On a wide-adapter a pun higher than 7 is
195 possible, but is normally not used. Almost all physical units have only
196 one logical unit, with lun=0. A CD-ROM jukebox would be an example of a
197 physical unit with more than one logical unit.
198
199 The embedded microprocessor of the IBM SCSI-subsystem hides the complex
200 two-dimensional (pun,lun) organization from the operating system.
201 When the machine is powered-up (or rebooted), the embedded microprocessor
202 checks, on its own, all 56 possible (pun,lun) combinations, and the first
203 15 devices found are assigned into a one-dimensional array of so-called
204 "logical devices", identified by "logical device numbers" or ldn. The last
205 ldn=15 is reserved for the subsystem itself. Wide adapters may have
206 to check up to 15 * 8 = 120 pun/lun combinations.
207
208 2.3 SCSI-Device Recognition and Dynamical ldn Assignment
209 --------------------------------------------------------
210 One consequence of information hiding is that the real (pun,lun)
211 numbers are also hidden. The two possibilities to get around this problem
212 are to offer fake pun/lun combinations to the operating system or to
213 delete the whole mapping of the adapter and to reassign the ldns, using
214 the immediate assign command of the SCSI-subsystem for probing through
215 all possible pun/lun combinations. An ldn is a "logical device number"
216 which is used by IBM SCSI-subsystems to access some valid SCSI-device.
217 At the beginning of the development of this driver, the following approach
218 was used:
219
220 First, the driver checked the ldn's (0 to 6) to find out which ldn's
221 have devices assigned. This was done by the functions check_devices() and
222 device_exists(). The interrupt handler has a special paragraph of code
223 (see local_checking_phase_flag) to assist in the checking. Assume, for
224 example, that three logical devices were found assigned at ldn 0, 1, 2.
225 These are presented to the upper layer of Linux SCSI driver
226 as devices with bogus (pun, lun) equal to (0,0), (1,0), (2,0).
227 On the other hand, if the upper layer issues a command to device
228 say (4,0), this driver returns DID_NO_CONNECT error.
229
230 In a second step of the driver development, the following improvement has
231 been applied: The first approach limited the number of devices to 7, far
232 fewer than the 15 that it could use, then it just mapped ldn ->
233 (ldn/8,ldn%8) for pun,lun. We ended up with a real mishmash of puns
234 and luns, but it all seemed to work.
235
236 The latest development, which is implemented from the driver version 3.0
237 and later, realizes the device recognition in the following way:
238 The physical SCSI-devices on the SCSI-bus are probed via immediate_assign-
239 and device_inquiry-commands, that is all implemented in a completely new
240 made check_devices() subroutine. This delivers an exact map of the physical
241 SCSI-world that is now stored in the get_scsi[][]-array. This means,
242 that the once hidden pun,lun assignment is now known to this driver.
243 It no longer believes in default-settings of the subsystem and maps all
244 ldns to existing pun,lun "by foot". This assures full control of the ldn
245 mapping and allows dynamical remapping of ldns to different pun,lun, if
246 there are more SCSI-devices installed than ldns available (n>15). The
247 ldns from 0 to 6 get 'hardwired' by this driver to puns 0 to 7 at lun=0,
248 excluding the pun of the subsystem. This assures, that at least simple
249 SCSI-installations have optimum access-speed and are not touched by
250 dynamical remapping. The ldns 7 to 14 are put to existing devices with
251 lun>0 or to non-existing devices, in order to satisfy the subsystem, if
252 there are less than 15 SCSI-devices connected. In the case of more than 15
253 devices, the dynamical mapping goes active. If the get_scsi[][] reports a
254 device to be existent, but it has no ldn assigned, it gets an ldn out of 7
255 to 14. The numbers are assigned in cyclic order, therefore it takes 8
256 dynamical reassignments on the SCSI-devices until a certain device
257 loses its ldn again. This assures that dynamical remapping is avoided
258 during intense I/O between up to 15 SCSI-devices (means pun,lun
259 combinations). A further advantage of this method is that people who
260 build their kernel without probing on all luns will get what they expect,
261 because the driver just won't assign everything with lun>0 when
262 multiple lun probing is inactive.
263
264 2.4 SCSI-Device Order
265 ---------------------
266 Because of the now correct recognition of physical pun,lun, and
267 their report to mid-level- and higher-level-drivers, the new reported puns
268 can be different from the old, faked puns. Therefore, Linux will eventually
269 change /dev/sdXXX assignments and prompt you for corrupted superblock
270 repair on boottime. In this case DO NOT PANIC, YOUR DISKS ARE STILL OK!!!
271 You have to reboot (CTRL-D) with an old kernel and set the /etc/fstab-file
272 entries right. After that, the system should come up as errorfree as before.
273 If your boot-partition is not coming up, also edit the /etc/lilo.conf-file
274 in a Linux session booted on old kernel and run lilo before reboot. Check
275 lilo.conf anyway to get boot on other partitions with foreign OSes right
276 again. But there exists a feature of this driver that allows you to change
277 the assignment order of the SCSI-devices by flipping the PUN-assignment.
278 See the next paragraph for a description.
279
280 The problem for this is, that Linux does not assign the SCSI-devices in the
281 way as described in the ANSI-SCSI-standard. Linux assigns /dev/sda to
282 the device with at minimum id 0. But the first drive should be at id 6,
283 because for historical reasons, drive at id 6 has, by hardware, the highest
284 priority and a drive at id 0 the lowest. IBM was one of the rare producers,
285 where the BIOS assigns drives belonging to the ANSI-SCSI-standard. Most
286 other producers' BIOS does not (I think even Adaptec-BIOS). The
287 IBMMCA_SCSI_ORDER_STANDARD flag, which you set while configuring the
288 kernel enables to choose the preferred way of SCSI-device-assignment.
289 Defining this flag would result in Linux determining the devices in the
290 same order as DOS and OS/2 does on your MCA-machine. This is also standard
291 on most industrial computers and OSes, like e.g. OS-9. Leaving this flag
292 undefined will get your devices ordered in the default way of Linux. See
293 also the remarks of Chris Beauregard from Dec 15, 1997 and the followups
294 in section 3.
295
296 2.5 Regular SCSI-Command-Processing
297 -----------------------------------
298 Only three functions get involved: ibmmca_queuecommand(), issue_cmd(),
299 and interrupt_handler().
300
301 The upper layer issues a scsi command by calling function
302 ibmmca_queuecommand(). This function fills a "subsystem control block"
303 (scb) and calls a local function issue_cmd(), which writes a scb
304 command into subsystem I/O ports. Once the scb command is carried out,
305 the interrupt_handler() is invoked. If a device is determined to be
306 existent and it has not assigned any ldn, it gets one dynamically.
307 For this, the whole stuff is done in ibmmca_queuecommand().
308
309 2.6 Abort & Reset Commands
310 --------------------------
311 These are implemented with busy waiting for interrupt to arrive.
312 ibmmca_reset() and ibmmca_abort() do not work sufficiently well
313 up to now and need still a lot of development work. This seems
314 to be a problem with other low-level SCSI drivers too, however
315 this should be no excuse.
316
317 2.7 Disk Geometry
318 -----------------
319 The ibmmca_biosparams() function should return the same disk geometry
320 as the bios. This is needed for fdisk, etc. The returned geometry is
321 certainly correct for disks smaller than 1 gigabyte. In the meantime,
322 it has been proved, that this works fine even with disks larger than
323 1 gigabyte.
324
325 2.8 Kernel Boot Option
326 ----------------------
327 The function ibmmca_scsi_setup() is called if option ibmmcascsi=n
328 is passed to the kernel. See file linux/init/main.c for details.
329
330 2.9 Driver Module Support
331 -------------------------
332 Is implemented and tested by K. Kudielka. This could probably not work
333 on kernels <2.1.0.
334
335 2.10 Multiple Hostadapter Support
336 ---------------------------------
337 This driver supports up to eight interfaces of type IBM-SCSI-Subsystem.
338 Integrated-, and MCA-adapters are automatically recognized. Unrecognizable
339 IBM-SCSI-Subsystem interfaces can be specified as kernel-parameters.
340
341 2.11 /proc/scsi-Filesystem Information
342 --------------------------------------
343 Information about the driver condition is given in
344 /proc/scsi/ibmmca/<host_no>. ibmmca_proc_info() provides this information.
345
346 This table is quite informative for interested users. It shows the load
347 of commands on the subsystem and whether you are running the bypassed
348 (software) or integrated (hardware) SCSI-command set (see below). The
349 amount of accesses is shown. Read, write, modeselect is shown separately
350 in order to help debugging problems with CD-ROMs or tapedrives.
351
352 The following table shows the list of 15 logical device numbers, that are
353 used by the SCSI-subsystem. The load on each ldn is shown in the table,
354 again, read and write commands are split. The last column shows the amount
355 of reassignments, that have been applied to the ldns, if you have more than
356 15 pun/lun combinations available on the SCSI-bus.
357
358 The last two tables show the pun/lun map and the positions of the ldns
359 on this pun/lun map. This may change during operation, when a ldn is
360 reassigned to another pun/lun combination. If the necessity for dynamical
361 assignments is set to 'no', the ldn structure keeps static.
362
363 2.12 /proc/mca-Filesystem Information
364 -------------------------------------
365 The slot-file contains all default entries and in addition chip and I/O-
366 address information of the SCSI-subsystem. This information is provided
367 by ibmmca_getinfo().
368
369 2.13 Supported IBM SCSI-Subsystems
370 ----------------------------------
371 The following IBM SCSI-subsystems are supported by this driver:
372
373 - IBM Fast/Wide SCSI-2 Adapter
374 - IBM 7568 Industrial Computer SCSI Adapter w/Cache
375 - IBM Expansion Unit SCSI Controller
376 - IBM SCSI Adapter w/Cache
377 - IBM SCSI Adapter
378 - IBM Integrated SCSI Controller
379 - All clones, 100% compatible with the chipset and subsystem command
380 system of IBM SCSI-adapters (forced detection)
381
382 2.14 Linux Kernel Versions
383 --------------------------
384 The IBM SCSI-subsystem low level driver is prepared to be used with
385 all versions of Linux between 2.0.x and 2.4.x. The compatibility checks
386 are fully implemented up from version 3.1e of the driver. This means, that
387 you just need the latest ibmmca.h and ibmmca.c file and copy it in the
388 linux/drivers/scsi directory. The code is automatically adapted during
389 kernel compilation. This is different from kernel 2.4.0! Here version
390 4.0 or later of the driver must be used for kernel 2.4.0 or later. Version
391 4.0 or later does not work together with older kernels! Driver versions
392 older than 4.0 do not work together with kernel 2.4.0 or later. They work
393 on all older kernels.
394
395 3 Code History
396 --------------
397 Jan 15 1996: First public release.
398 - Martin Kolinek
399
400 Jan 23 1996: Scrapped code which reassigned scsi devices to logical
401 device numbers. Instead, the existing assignment (created
402 when the machine is powered-up or rebooted) is used.
403 A side effect is that the upper layer of Linux SCSI
404 device driver gets bogus scsi ids (this is benign),
405 and also the hard disks are ordered under Linux the
406 same way as they are under dos (i.e., C: disk is sda,
407 D: disk is sdb, etc.).
408 - Martin Kolinek
409
410 I think that the CD-ROM is now detected only if a CD is
411 inside CD_ROM while Linux boots. This can be fixed later,
412 once the driver works on all types of PS/2's.
413 - Martin Kolinek
414
415 Feb 7 1996: Modified biosparam function. Fixed the CD-ROM detection.
416 For now, devices other than harddisk and CD_ROM are
417 ignored. Temporarily modified abort() function
418 to behave like reset().
419 - Martin Kolinek
420
421 Mar 31 1996: The integrated scsi subsystem is correctly found
422 in PS/2 models 56,57, but not in model 76. Therefore
423 the ibmmca_scsi_setup() function has been added today.
424 This function allows the user to force detection of
425 scsi subsystem. The kernel option has format
426 ibmmcascsi=n
427 where n is the scsi_id (pun) of the subsystem. Most likely, n is 7.
428 - Martin Kolinek
429
430 Aug 21 1996: Modified the code which maps ldns to (pun,0). It was
431 insufficient for those of us with CD-ROM changers.
432 - Chris Beauregard
433
434 Dec 14 1996: More improvements to the ldn mapping. See check_devices
435 for details. Did more fiddling with the integrated SCSI detection,
436 but I think it's ultimately hopeless without actually testing the
437 model of the machine. The 56, 57, 76 and 95 (ultimedia) all have
438 different integrated SCSI register configurations. However, the 56
439 and 57 are the only ones that have problems with forced detection.
440 - Chris Beauregard
441
442 Mar 8-16 1997: Modified driver to run as a module and to support
443 multiple adapters. A structure, called ibmmca_hostdata, is now
444 present, containing all the variables, that were once only
445 available for one single adapter. The find_subsystem-routine has vanished.
446 The hardware recognition is now done in ibmmca_detect directly.
447 This routine checks for presence of MCA-bus, checks the interrupt
448 level and continues with checking the installed hardware.
449 Certain PS/2-models do not recognize a SCSI-subsystem automatically.
450 Hence, the setup defined by command-line-parameters is checked first.
451 Thereafter, the routine probes for an integrated SCSI-subsystem.
452 Finally, adapters are checked. This method has the advantage to cover all
453 possible combinations of multiple SCSI-subsystems on one MCA-board. Up to
454 eight SCSI-subsystems can be recognized and announced to the upper-level
455 drivers with this improvement. A set of defines made changes to other
456 routines as small as possible.
457 - Klaus Kudielka
458
459 May 30 1997: (v1.5b)
460 1) SCSI-command capability enlarged by the recognition of MODE_SELECT.
461 This needs the RD-Bit to be disabled on IM_OTHER_SCSI_CMD_CMD which
462 allows data to be written from the system to the device. It is a
463 necessary step to be allowed to set blocksize of SCSI-tape-drives and
464 the tape-speed, without confusing the SCSI-Subsystem.
465 2) The recognition of a tape is included in the check_devices routine.
466 This is done by checking for TYPE_TAPE, that is already defined in
467 the kernel-scsi-environment. The markup of a tape is done in the
468 global ldn_is_tape[] array. If the entry on index ldn
469 is 1, there is a tapedrive connected.
470 3) The ldn_is_tape[] array is necessary to distinguish between tape- and
471 other devices. Fixed blocklength devices should not cause a problem
472 with the SCB-command for read and write in the ibmmca_queuecommand
473 subroutine. Therefore, I only derivate the READ_XX, WRITE_XX for
474 the tape-devices, as recommended by IBM in this Technical Reference,
475 mentioned below. (IBM recommends to avoid using the read/write of the
476 subsystem, but the fact was, that read/write causes a command error from
477 the subsystem and this causes kernel-panic.)
478 4) In addition, I propose to use the ldn instead of a fix char for the
479 display of PS2_DISK_LED_ON(). On 95, one can distinguish between the
480 devices that are accessed. It shows activity and easyfies debugging.
481 The tape-support has been tested with a SONY SDT-5200 and a HP DDS-2
482 (I do not know yet the type). Optimization and CD-ROM audio-support,
483 I am working on ...
484 - Michael Lang
485
486 June 19 1997: (v1.6b)
487 1) Submitting the extra-array ldn_is_tape[] -> to the local ld[]
488 device-array.
489 2) CD-ROM Audio-Play seems to work now.
490 3) When using DDS-2 (120M) DAT-Tapes, mtst shows still density-code
491 0x13 for ordinary DDS (61000 BPM) instead 0x24 for DDS-2. This appears
492 also on Adaptec 2940 adaptor in a PCI-System. Therefore, I assume that
493 the problem is independent of the low-level-driver/bus-architecture.
494 4) Hexadecimal ldn on PS/2-95 LED-display.
495 5) Fixing of the PS/2-LED on/off that it works right with tapedrives and
496 does not confuse the disk_rw_in_progress counter.
497 - Michael Lang
498
499 June 21 1997: (v1.7b)
500 1) Adding of a proc_info routine to inform in /proc/scsi/ibmmca/<host> the
501 outer-world about operational load statistics on the different ldns,
502 seen by the driver. Everybody that has more than one IBM-SCSI should
503 test this, because I only have one and cannot see what happens with more
504 than one IBM-SCSI hosts.
505 2) Definition of a driver version-number to have a better recognition of
506 the source when there are existing too much releases that may confuse
507 the user, when reading about release-specific problems. Up to know,
508 I calculated the version-number to be 1.7. Because we are in BETA-test
509 yet, it is today 1.7b.
510 3) Sorry for the heavy bug I programmed on June 19 1997! After that, the
511 CD-ROM did not work any more! The C7-command was a fake impression
512 I got while programming. Now, the READ and WRITE commands for CD-ROM are
513 no longer running over the subsystem, but just over
514 IM_OTHER_SCSI_CMD_CMD. On my observations (PS/2-95), now CD-ROM mounts
515 much faster(!) and hopefully all fancy multimedia-functions, like direct
516 digital recording from audio-CDs also work. (I tried it with cdda2wav
517 from the cdwtools-package and it filled up the harddisk immediately :-).)
518 To easify boolean logics, a further local device-type in ld[], called
519 is_cdrom has been included.
520 4) If one uses a SCSI-device of unsupported type/commands, one
521 immediately runs into a kernel-panic caused by Command Error. To better
522 understand which SCSI-command caused the problem, I extended this
523 specific panic-message slightly.
524 - Michael Lang
525
526 June 25 1997: (v1.8b)
527 1) Some cosmetic changes for the handling of SCSI-device-types.
528 Now, also CD-Burners / WORMs and SCSI-scanners should work. For
529 MO-drives I have no experience, therefore not yet supported.
530 In logical_devices I changed from different type-variables to one
531 called 'device_type' where the values, corresponding to scsi.h,
532 of a SCSI-device are stored.
533 2) There existed a small bug, that maps a device, coming after a SCSI-tape
534 wrong. Therefore, e.g. a CD-ROM changer would have been mapped wrong
535 -> problem removed.
536 3) Extension of the logical_device structure. Now it contains also device,
537 vendor and revision-level of a SCSI-device for internal usage.
538 - Michael Lang
539
540 June 26-29 1997: (v2.0b)
541 1) The release number 2.0b is necessary because of the completely new done
542 recognition and handling of SCSI-devices with the adapter. As I got
543 from Chris the hint, that the subsystem can reassign ldns dynamically,
544 I remembered this immediate_assign-command, I found once in the handbook.
545 Now, the driver first kills all ldn assignments that are set by default
546 on the SCSI-subsystem. After that, it probes on all puns and luns for
547 devices by going through all combinations with immediate_assign and
548 probing for devices, using device_inquiry. The found physical(!) pun,lun
549 structure is stored in get_scsi[][] as device types. This is followed
550 by the assignment of all ldns to existing SCSI-devices. If more ldns
551 than devices are available, they are assigned to non existing pun,lun
552 combinations to satisfy the adapter. With this, the dynamical mapping
553 was possible to implement. (For further info see the text in the
554 source code and in the description below. Read the description
555 below BEFORE installing this driver on your system!)
556 2) Changed the name IBMMCA_DRIVER_VERSION to IBMMCA_SCSI_DRIVER_VERSION.
557 3) The LED-display shows on PS/2-95 no longer the ldn, but the SCSI-ID
558 (pun) of the accessed SCSI-device. This is now senseful, because the
559 pun known within the driver is exactly the pun of the physical device
560 and no longer a fake one.
561 4) The /proc/scsi/ibmmca/<host_no> consists now of the first part, where
562 hit-statistics of ldns is shown and a second part, where the maps of
563 physical and logical SCSI-devices are displayed. This could be very
564 interesting, when one is using more than 15 SCSI-devices in order to
565 follow the dynamical remapping of ldns.
566 - Michael Lang
567
568 June 26-29 1997: (v2.0b-1)
569 1) I forgot to switch the local_checking_phase_flag to 1 and back to 0
570 in the dynamical remapping part in ibmmca_queuecommand for the
571 device_exist routine. Sorry.
572 - Michael Lang
573
574 July 1-13 1997: (v3.0b,c)
575 1) Merging of the driver-developments of Klaus Kudielka and Michael Lang
576 in order to get a optimum and unified driver-release for the
577 IBM-SCSI-Subsystem-Adapter(s).
578 For people, using the Kernel-release >=2.1.0, module-support should
579 be no problem. For users, running under <2.1.0, module-support may not
580 work, because the methods have changed between 2.0.x and 2.1.x.
581 2) Added some more effective statistics for /proc-output.
582 3) Change typecasting at necessary points from (unsigned long) to
583 virt_to_bus().
584 4) Included #if... at special points to have specific adaption of the
585 driver to kernel 2.0.x and 2.1.x. It should therefore also run with
586 later releases.
587 5) Magneto-Optical drives and medium-changers are also recognized, now.
588 Therefore, we have a completely gapfree recognition of all SCSI-
589 device-types, that are known by Linux up to kernel 2.1.31.
590 6) The flag SCSI_IBMMCA_DEV_RESET has been inserted. If it is set within
591 the configuration, each connected SCSI-device will get a reset command
592 during boottime. This can be necessary for some special SCSI-devices.
593 This flag should be included in Config.in.
594 (See also the new Config.in file.)
595 Probable next improvement: bad disk handler.
596 - Michael Lang
597
598 Sept 14 1997: (v3.0c)
599 1) Some debugging and speed optimization applied.
600 - Michael Lang
601
602 Dec 15, 1997
603 - chrisb@truespectra.com
604 - made the front panel display thingy optional, specified from the
605 command-line via ibmmcascsi=display. Along the lines of the /LED
606 option for the OS/2 driver.
607 - fixed small bug in the LED display that would hang some machines.
608 - reversed ordering of the drives (using the
609 IBMMCA_SCSI_ORDER_STANDARD define). This is necessary for two main
610 reasons:
611 - users who've already installed Linux won't be screwed. Keep
612 in mind that not everyone is a kernel hacker.
613 - be consistent with the BIOS ordering of the drives. In the
614 BIOS, id 6 is C:, id 0 might be D:. With this scheme, they'd be
615 backwards. This confuses the crap out of those heathens who've
616 got a impure Linux installation (which, <wince>, I'm one of).
617 This whole problem arises because IBM is actually non-standard with
618 the id to BIOS mappings. You'll find, in fdomain.c, a similar
619 comment about a few FD BIOS revisions. The Linux (and apparently
620 industry) standard is that C: maps to scsi id (0,0). Let's stick
621 with that standard.
622 - Since this is technically a branch of my own, I changed the
623 version number to 3.0e-cpb.
624
625 Jan 17, 1998: (v3.0f)
626 1) Addition of some statistical info for /proc in proc_info.
627 2) Taking care of the SCSI-assignment problem, dealed by Chris at Dec 15
628 1997. In fact, IBM is right, concerning the assignment of SCSI-devices
629 to driveletters. It is conform to the ANSI-definition of the SCSI-
630 standard to assign drive C: to SCSI-id 6, because it is the highest
631 hardware priority after the hostadapter (that has still today by
632 default everywhere id 7). Also realtime-operating systems that I use,
633 like LynxOS and OS9, which are quite industrial systems use top-down
634 numbering of the harddisks, that is also starting at id 6. Now, one
635 sits a bit between two chairs. On one hand side, using the define
636 IBMMCA_SCSI_ORDER_STANDARD makes Linux assigning disks conform to
637 the IBM- and ANSI-SCSI-standard and keeps this driver downward
638 compatible to older releases, on the other hand side, people is quite
639 habituated in believing that C: is assigned to (0,0) and much other
640 SCSI-BIOS do so. Therefore, I moved the IBMMCA_SCSI_ORDER_STANDARD
641 define out of the driver and put it into Config.in as subitem of
642 'IBM SCSI support'. A help, added to Documentation/Configure.help
643 explains the differences between saying 'y' or 'n' to the user, when
644 IBMMCA_SCSI_ORDER_STANDARD prompts, so the ordinary user is enabled to
645 choose the way of assignment, depending on his own situation and gusto.
646 3) Adapted SCSI_IBMMCA_DEV_RESET to the local naming convention, so it is
647 now called IBMMCA_SCSI_DEV_RESET.
648 4) Optimization of proc_info and its subroutines.
649 5) Added more in-source-comments and extended the driver description by
650 some explanation about the SCSI-device-assignment problem.
651 - Michael Lang
652
653 Jan 18, 1998: (v3.0g)
654 1) Correcting names to be absolutely conform to the later 2.1.x releases.
655 This is necessary for
656 IBMMCA_SCSI_DEV_RESET -> CONFIG_IBMMCA_SCSI_DEV_RESET
657 IBMMCA_SCSI_ORDER_STANDARD -> CONFIG_IBMMCA_SCSI_ORDER_STANDARD
658 - Michael Lang
659
660 Jan 18, 1999: (v3.1 MCA-team internal)
661 1) The multiple hosts structure is accessed from every subroutine, so there
662 is no longer the address of the device structure passed from function
663 to function, but only the hostindex. A call by value, nothing more. This
664 should really be understood by the compiler and the subsystem should get
665 the right values and addresses.
666 2) The SCSI-subsystem detection was not complete and quite hugely buggy up
667 to now, compared to the technical manual. The interpretation of the pos2
668 register is not as assumed by people before, therefore, I dropped a note
669 in the ibmmca_detect function to show the registers' interpretation.
670 The pos-registers of integrated SCSI-subsystems do not contain any
671 information concerning the IO-port offset, really. Instead, they contain
672 some info about the adapter, the chip, the NVRAM .... The I/O-port is
673 fixed to 0x3540 - 0x3547. There can be more than one adapters in the
674 slots and they get an offset for the I/O area in order to get their own
675 I/O-address area. See chapter 2 for detailed description. At least, the
676 detection should now work right, even on models other than 95. The 95ers
677 came happily around the bug, as their pos2 register contains always 0
678 in the critical area. Reserved bits are not allowed to be interpreted,
679 therefore, IBM is allowed to set those bits as they like and they may
680 really vary between different PS/2 models. So, now, no interpretation
681 of reserved bits - hopefully no trouble here anymore.
682 3) The command error, which you may get on models 55, 56, 57, 70, 77 and
683 P70 may have been caused by the fact, that adapters of older design do
684 not like sending commands to non-existing SCSI-devices and will react
685 with a command error as a sign of protest. While this error is not
686 present on IBM SCSI Adapter w/cache, it appears on IBM Integrated SCSI
687 Adapters. Therefore, I implemented a workaround to forgive those
688 adapters their protests, but it is marked up in the statistics, so
689 after a successful boot, you can see in /proc/scsi/ibmmca/<host_number>
690 how often the command errors have been forgiven to the SCSI-subsystem.
691 If the number is bigger than 0, you have a SCSI subsystem of older
692 design, what should no longer matter.
693 4) ibmmca_getinfo() has been adapted very carefully, so it shows in the
694 slotn file really, what is senseful to be presented.
695 5) ibmmca_register() has been extended in its parameter list in order to
696 pass the right name of the SCSI-adapter to Linux.
697 - Michael Lang
698
699 Feb 6, 1999: (v3.1)
700 1) Finally, after some 3.1Beta-releases, the 3.1 release. Sorry, for
701 the delayed release, but it was not finished with the release of
702 Kernel 2.2.0.
703 - Michael Lang
704
705 Feb 10, 1999 (v3.1)
706 1) Added a new commandline parameter called 'bypass' in order to bypass
707 every integrated subsystem SCSI-command consequently in case of
708 troubles.
709 2) Concatenated read_capacity requests to the harddisks. It gave a lot
710 of troubles with some controllers and after I wanted to apply some
711 extensions, it jumped out in the same situation, on my w/cache, as like
712 on D. Weinehalls' Model 56, having integrated SCSI. This gave me the
713 decisive hint to move the code-part out and declare it global. Now
714 it seems to work far better and more stable. Let us see what
715 the world thinks of it...
716 3) By the way, only Sony DAT-drives seem to show density code 0x13. A
717 test with a HP drive gave right results, so the problem is vendor-
718 specific and not a problem of the OS or the driver.
719 - Michael Lang
720
721 Feb 18, 1999 (v3.1d)
722 1) The abort command and the reset function have been checked for
723 inconsistencies. From the logical point of thinking, they work
724 at their optimum, now, but as the subsystem does not answer with an
725 interrupt, abort never finishes, sigh...
726 2) Everything, that is accessed by a busmaster request from the adapter
727 is now declared as global variable, even the return-buffer in the
728 local checking phase. This assures, that no accesses to undefined memory
729 areas are performed.
730 3) In ibmmca.h, the line unchecked_isa_dma is added with 1 in order to
731 avoid memory-pointers for the areas higher than 16MByte in order to
732 be sure, it also works on 16-Bit Microchannel bus systems.
733 4) A lot of small things have been found, but nothing that endangered the
734 driver operations. Just it should be more stable, now.
735 - Michael Lang
736
737 Feb 20, 1999 (v3.1e)
738 1) I took the warning from the Linux Kernel Hackers Guide serious and
739 checked the cmd->result return value to the done-function very carefully.
740 It is obvious, that the IBM SCSI only delivers the tsb.dev_status, if
741 some error appeared, else it is undefined. Now, this is fixed. Before
742 any SCB command gets queued, the tsb.dev_status is set to 0, so the
743 cmd->result won't screw up Linux higher level drivers.
744 2) The reset-function has slightly improved. This is still planned for
745 abort. During the abort and the reset function, no interrupts are
746 allowed. This is however quite hard to cope with, so the INT-status
747 register is read. When the interrupt gets queued, one can find its
748 status immediately on that register and is enabled to continue in the
749 reset function. I had no chance to test this really, only in a bogus
750 situation, I got this function running, but the situation was too much
751 worse for Linux :-(, so tests will continue.
752 3) Buffers got now consistent. No open address mapping, as before and
753 therefore no further troubles with the unassigned memory segmentation
754 faults that scrambled probes on 95XX series and even on 85XX series,
755 when the kernel is done in a not so perfectly fitting way.
756 4) Spontaneous interrupts from the subsystem, appearing without any
757 command previously queued are answered with a DID_BAD_INTR result.
758 5) Taken into account ZP Gus' proposals to reverse the SCSI-device
759 scan order. As it does not work on Kernel 2.1.x or 2.2.x, as proposed
760 by him, I implemented it in a slightly derived way, which offers in
761 addition more flexibility.
762 - Michael Lang
763
764 Apr 23, 2000 (v3.2pre1)
765 1) During a very long time, I collected a huge amount of bug reports from
766 various people, trying really quite different things on their SCSI-
767 PS/2s. Today, all these bug reports are taken into account and should be
768 mostly solved. The major topics were:
769 - Driver crashes during boottime by no obvious reason.
770 - Driver panics while the midlevel-SCSI-driver is trying to inquire
771 the SCSI-device properties, even though hardware is in perfect state.
772 - Displayed info for the various slot-cards is interpreted wrong.
773 The main reasons for the crashes were two:
774 1) The commands to check for device information like INQUIRY,
775 TEST_UNIT_READY, REQUEST_SENSE and MODE_SENSE cause the devices
776 to deliver information of up to 255 bytes. Midlevel drivers offer
777 1024 bytes of space for the answer, but the IBM-SCSI-adapters do
778 not accept this, as they stick quite near to ANSI-SCSI and report
779 a COMMAND_ERROR message which causes the driver to panic. The main
780 problem was located around the INQUIRY command. Now, for all the
781 mentioned commands, the buffersize sent to the adapter is at
782 maximum 255 which seems to be a quite reasonable solution.
783 TEST_UNIT_READY gets a buffersize of 0 to make sure that no
784 data is transferred in order to avoid any possible command failure.
785 2) On unsuccessful TEST_UNIT_READY, the mid-level driver has to send
786 a REQUEST_SENSE in order to see where the problem is located. This
787 REQUEST_SENSE may have various length in its answer-buffer. IBM
788 SCSI-subsystems report a command failure if the returned buffersize
789 is different from the sent buffersize, but this can be suppressed by
790 a special bit, which is now done and problems seem to be solved.
791 2) Code adaption to all kernel-releases. Now, the 3.2 code compiles on
792 2.0.x, 2.1.x, 2.2.x and 2.3.x kernel releases without any code-changes.
793 3) Commandline-parameters are recognized again, even under Kernel 2.3.x or
794 higher.
795 - Michael Lang
796
797 April 27, 2000 (v3.2pre2)
798 1) Bypassed commands get read by the adapter by one cycle instead of two.
799 This increases SCSI-performance.
800 2) Synchronous datatransfer is provided for sure to be 5 MHz on older
801 SCSI and 10 MHz on internal F/W SCSI-adapter.
802 3) New commandline parameters allow to force the adapter to slow down while
803 in synchronous transfer. Could be helpful for very old devices.
804 - Michael Lang
805
806 June 2, 2000 (v3.2pre5)
807 1) Added Jim Shorney's contribution to make the activity indicator
808 flashing in addition to the LED-alphanumeric display-panel on
809 models 95A. To be enabled to choose this feature freely, a new
810 commandline parameter is added, called 'activity'.
811 2) Added the READ_CONTROL bit for test_unit_ready SCSI-command.
812 3) Added some suppress_exception bits to read_device_capacity and
813 all device_inquiry occurrences in the driver code.
814 4) Complaints about the various KERNEL_VERSION implementations are
815 taken into account. Every local_LinuxKernelVersion occurrence is
816 now replaced by KERNEL_VERSION, defined in linux/version.h.
817 Corresponding changes were applied to ibmmca.h, too. This was a
818 contribution to all kernel-parts by Philipp Hahn.
819 - Michael Lang
820
821 July 17, 2000 (v3.2pre8)
822 A long period of collecting bug reports from all corners of the world
823 now lead to the following corrections to the code:
824 1) SCSI-2 F/W support crashed with a COMMAND ERROR. The reason for this
825 was that it is possible to disable Fast-SCSI for the external bus.
826 The feature-control command, where this crash appeared regularly, tried
827 to set the maximum speed of 10MHz synchronous transfer speed and that
828 reports a COMMAND ERROR if external bus Fast-SCSI is disabled. Now,
829 the feature-command probes down from maximum speed until the adapter
830 stops to complain, which is at the same time the maximum possible
831 speed selected in the reference program. So, F/W external can run at
832 5 MHz (slow-) or 10 MHz (fast-SCSI). During feature probing, the
833 COMMAND ERROR message is used to detect if the adapter does not complain.
834 2) Up to now, only combined busmode is supported, if you use external
835 SCSI-devices, attached to the F/W-controller. If dual bus is selected,
836 only the internal SCSI-devices get accessed by Linux. For most
837 applications, this should do fine.
838 3) Wide-SCSI-addressing (16-Bit) is now possible for the internal F/W
839 bus on the F/W adapter. If F/W adapter is detected, the driver
840 automatically uses the extended PUN/LUN <-> LDN mapping tables, which
841 are now new from 3.2pre8. This allows PUNs between 0 and 15 and should
842 provide more fun with the F/W adapter.
843 4) Several machines use the SCSI: POS registers for internal/undocumented
844 storage of system relevant info. This confused the driver, mainly on
845 models 9595, as it expected no onboard SCSI only, if all POS in
846 the integrated SCSI-area are set to 0x00 or 0xff. Now, the mechanism
847 to check for integrated SCSI is much more restrictive and these problems
848 should be history.
849 - Michael Lang
850
851 July 18, 2000 (v3.2pre9)
852 This develop rather quickly at the moment. Two major things were still
853 missing in 3.2pre8:
854 1) The adapter PUN for F/W adapters has 4-bits, while all other adapters
855 have 3-bits. This is now taken into account for F/W.
856 2) When you select CONFIG_IBMMCA_SCSI_ORDER_STANDARD, you should
857 normally get the inverse probing order of your devices on the SCSI-bus.
858 The ANSI device order gets scrambled in version 3.2pre8!! Now, a new
859 and tested algorithm inverts the device-order on the SCSI-bus and
860 automatically avoids accidental access to whatever SCSI PUN the adapter
861 is set and works with SCSI- and Wide-SCSI-addressing.
862 - Michael Lang
863
864 July 23, 2000 (v3.2pre10 unpublished)
865 1) LED panel display supports wide-addressing in ibmmca=display mode.
866 2) Adapter-information and autoadaption to address-space is done.
867 3) Auto-probing for maximum synchronous SCSI transfer rate is working.
868 4) Optimization to some embedded function calls is applied.
869 5) Added some comment for the user to wait for SCSI-devices being probed.
870 6) Finished version 3.2 for Kernel 2.4.0. It least, I thought it is but...
871 - Michael Lang
872
873 July 26, 2000 (v3.2pre11)
874 1) I passed a horrible weekend getting mad with NMIs on kernel 2.2.14 and
875 a model 9595. Asking around in the community, nobody except of me has
876 seen such errors. Weird, but I am trying to recompile everything on
877 the model 9595. Maybe, as I use a specially modified gcc, that could
878 cause problems. But, it was not the reason. The true background was,
879 that the kernel was compiled for i386 and the 9595 has a 486DX-2.
880 Normally, no troubles should appear, but for this special machine,
881 only the right processor support is working fine!
882 2) Previous problems with synchronous speed, slowing down from one adapter
883 to the next during probing are corrected. Now, local variables store
884 the synchronous bitmask for every single adapter found on the MCA bus.
885 3) LED alphanumeric panel support for XX95 systems is now showing some
886 alive rotator during boottime. This makes sense, when no monitor is
887 connected to the system. You can get rid of all display activity, if
888 you do not use any parameter or just ibmmcascsi=activity, for the
889 harddrive activity LED, existent on all PS/2, except models 8595-XXX.
890 If no monitor is available, please use ibmmcascsi=display, which works
891 fine together with the linuxinfo utility for the LED-panel.
892 - Michael Lang
893
894 July 29, 2000 (v3.2)
895 1) Submission of this driver for kernel 2.4test-XX and 2.2.17.
896 - Michael Lang
897
898 December 28, 2000 (v3.2d / v4.0)
899 1) The interrupt handler had some wrong statement to wait for. This
900 was done due to experimental reasons during 3.2 development but it
901 has shown that this is not stable enough. Going back to wait for the
902 adapter to be not busy is best.
903 2) Inquiry requests can be shorter than 255 bytes of return buffer. Due
904 to a bug in the ibmmca_queuecommand routine, this buffer was forced
905 to 255 at minimum. If the memory address, this return buffer is pointing
906 to does not offer more space, invalid memory accesses destabilized the
907 kernel.
908 3) version 4.0 is only valid for kernel 2.4.0 or later. This is necessary
909 to remove old kernel version dependent waste from the driver. 3.2d is
910 only distributed with older kernels but keeps compatibility with older
911 kernel versions. 4.0 and higher versions cannot be used with older
912 kernels anymore!! You must have at least kernel 2.4.0!!
913 4) The commandline argument 'bypass' and all its functionality got removed
914 in version 4.0. This was never really necessary, as all troubles were
915 based on non-command related reasons up to now, so bypassing commands
916 did not help to avoid any bugs. It is kept in 3.2X for debugging reasons.
917 5) Dynamic reassignment of ldns was again verified and analyzed to be
918 completely inoperational. This is corrected and should work now.
919 6) All commands that get sent to the SCSI adapter were verified and
920 completed in such a way, that they are now completely conform to the
921 demands in the technical description of IBM. Main candidates were the
922 DEVICE_INQUIRY, REQUEST_SENSE and DEVICE_CAPACITY commands. They must
923 be transferred by bypassing the internal command buffer of the adapter
924 or else the response can be a random result. GET_POS_INFO would be more
925 safe in usage, if one could use the SUPRESS_EXCEPTION_SHORT, but this
926 is not allowed by the technical references of IBM. (Sorry, folks, the
927 model 80 problem is still a task to be solved in a different way.)
928 7) v3.2d is still hold back for some days for testing, while 4.0 is
929 released.
930 - Michael Lang
931
932 January 3, 2001 (v4.0a)
933 1) A lot of complains after the 2.4.0-prerelease kernel came in about
934 the impossibility to compile the driver as a module. This problem is
935 solved. In combination with that problem, some unprecise declaration
936 of the function option_setup() gave some warnings during compilation.
937 This is solved, too by a forward declaration in ibmmca.c.
938 2) #ifdef argument concerning CONFIG_SCSI_IBMMCA is no longer needed and
939 was entirely removed.
940 3) Some switch statements got optimized in code, as some minor variables
941 in internal SCSI-command handlers.
942 - Michael Lang
943
944 4 To do
945 -------
946 - IBM SCSI-2 F/W external SCSI bus support in separate mode!
947 - It seems that the handling of bad disks is really bad -
948 non-existent, in fact. However, a low-level driver cannot help
949 much, if such things happen.
950
951 5 Users' Manual
952 ---------------
953 5.1 Commandline Parameters
954 --------------------------
955 There exist several features for the IBM SCSI-subsystem driver.
956 The commandline parameter format is:
957
958 ibmmcascsi=<command1>,<command2>,<command3>,...
959
960 where commandN can be one of the following:
961
962 display Owners of a model 95 or other PS/2 systems with an
963 alphanumeric LED display may set this to have their
964 display showing the following output of the 8 digits:
965
966 ------DA
967
968 where '-' stays dark, 'D' shows the SCSI-device id
969 and 'A' shows the SCSI hostindex, being currently
970 accessed. During boottime, this will give the message
971
972 SCSIini*
973
974 on the LED-panel, where the * represents a rotator,
975 showing the activity during the probing phase of the
976 driver which can take up to two minutes per SCSI-adapter.
977 adisplay This works like display, but gives more optical overview
978 of the activities on the SCSI-bus. The display will have
979 the following output:
980
981 6543210A
982
983 where the numbers 0 to 6 light up at the shown position,
984 when the SCSI-device is accessed. 'A' shows again the SCSI
985 hostindex. If display nor adisplay is set, the internal
986 PS/2 harddisk LED is used for media-activities. So, if
987 you really do not have a system with a LED-display, you
988 should not set display or adisplay. Keep in mind, that
989 display and adisplay can only be used alternatively. It
990 is not recommended to use this option, if you have some
991 wide-addressed devices e.g. at the SCSI-2 F/W adapter in
992 your system. In addition, the usage of the display for
993 other tasks in parallel, like the linuxinfo-utility makes
994 no sense with this option.
995 activity This enables the PS/2 harddisk LED activity indicator.
996 Most PS/2 have no alphanumeric LED display, but some
997 indicator. So you should use this parameter to activate it.
998 If you own model 9595 (Server95), you can have both, the
999 LED panel and the activity indicator in parallel. However,
1000 some PS/2s, like the 8595 do not have any harddisk LED
1001 activity indicator, which means, that you must use the
1002 alphanumeric LED display if you want to monitor SCSI-
1003 activity.
1004 bypass This is obsolete from driver version 4.0, as the adapters
1005 got that far understood, that the selection between
1006 integrated and bypassed commands should now work completely
1007 correct! For historical reasons, the old description is
1008 kept here:
1009 This commandline parameter forces the driver never to use
1010 SCSI-subsystems' integrated SCSI-command set. Except of
1011 the immediate assign, which is of vital importance for
1012 every IBM SCSI-subsystem to set its ldns right. Instead,
1013 the ordinary ANSI-SCSI-commands are used and passed by the
1014 controller to the SCSI-devices, therefore 'bypass'. The
1015 effort, done by the subsystem is quite bogus and at a
1016 minimum and therefore it should work everywhere. This
1017 could maybe solve troubles with old or integrated SCSI-
1018 controllers and nasty harddisks. Keep in mind, that using
1019 this flag will slow-down SCSI-accesses slightly, as the
1020 software generated commands are always slower than the
1021 hardware. Non-harddisk devices always get read/write-
1022 commands in bypass mode. On the most recent releases of
1023 the Linux IBM-SCSI-driver, the bypass command should be
1024 no longer a necessary thing, if you are sure about your
1025 SCSI-hardware!
1026 normal This is the parameter, introduced on the 2.0.x development
1027 rail by ZP Gu. This parameter defines the SCSI-device
1028 scan order in the new industry standard. This means, that
1029 the first SCSI-device is the one with the lowest pun.
1030 E.g. harddisk at pun=0 is scanned before harddisk at
1031 pun=6, which means, that harddisk at pun=0 gets sda
1032 and the one at pun=6 gets sdb.
1033 ansi The ANSI-standard for the right scan order, as done by
1034 IBM, Microware and Microsoft, scans SCSI-devices starting
1035 at the highest pun, which means, that e.g. harddisk at
1036 pun=6 gets sda and a harddisk at pun=0 gets sdb. If you
1037 like to have the same SCSI-device order, as in DOS, OS-9
1038 or OS/2, just use this parameter.
1039 fast SCSI-I/O in synchronous mode is done at 5 MHz for IBM-
1040 SCSI-devices. SCSI-2 Fast/Wide Adapter/A external bus
1041 should then run at 10 MHz if Fast-SCSI is enabled,
1042 and at 5 MHz if Fast-SCSI is disabled on the external
1043 bus. This is the default setting when nothing is
1044 specified here.
1045 medium Synchronous rate is at 50% approximately, which means
1046 2.5 MHz for IBM SCSI-adapters and 5.0 MHz for F/W ext.
1047 SCSI-bus (when Fast-SCSI speed enabled on external bus).
1048 slow The slowest possible synchronous transfer rate is set.
1049 This means 1.82 MHz for IBM SCSI-adapters and 2.0 MHz
1050 for F/W external bus at Fast-SCSI speed on the external
1051 bus.
1052
1053 A further option is that you can force the SCSI-driver to accept a SCSI-
1054 subsystem at a certain I/O-address with a predefined adapter PUN. This
1055 is done by entering
1056
1057 commandN = I/O-base
1058 commandN+1 = adapter PUN
1059
1060 e.g. ibmmcascsi=0x3540,7 will force the driver to detect a SCSI-subsystem
1061 at I/O-address 0x3540 with adapter PUN 7. Please only use this method, if
1062 the driver does really not recognize your SCSI-adapter! With driver version
1063 3.2, this recognition of various adapters was hugely improved and you
1064 should try first to remove your commandline arguments of such type with a
1065 newer driver. I bet, it will be recognized correctly. Even multiple and
1066 different types of IBM SCSI-adapters should be recognized correctly, too.
1067 Use the forced detection method only as last solution!
1068
1069 Examples:
1070
1071 ibmmcascsi=adisplay
1072
1073 This will use the advanced display mode for the model 95 LED alphanumeric
1074 display.
1075
1076 ibmmcascsi=display,0x3558,7
1077
1078 This will activate the default display mode for the model 95 LED display
1079 and will force the driver to accept a SCSI-subsystem at I/O-base 0x3558
1080 with adapter PUN 7.
1081
1082 5.2 Troubleshooting
1083 -------------------
1084 The following FAQs should help you to solve some major problems with this
1085 driver.
1086
1087 Q: "Reset SCSI-devices at boottime" halts the system at boottime, why?
1088 A: This is only tested with the IBM SCSI Adapter w/cache. It is not
1089 yet proven to run on other adapters, however you may be lucky.
1090 In version 3.1d this has been hugely improved and should work better,
1091 now. Normally you really won't need to activate this flag in the
1092 kernel configuration, as all post 1989 SCSI-devices should accept
1093 the reset-signal, when the computer is switched on. The SCSI-
1094 subsystem generates this reset while being initialized. This flag
1095 is really reserved for users with very old, very strange or self-made
1096 SCSI-devices.
1097 Q: Why is the SCSI-order of my drives mirrored to the device-order
1098 seen from OS/2 or DOS ?
1099 A: It depends on the operating system, if it looks at the devices in
1100 ANSI-SCSI-standard (starting from pun 6 and going down to pun 0) or
1101 if it just starts at pun 0 and counts up. If you want to be conform
1102 with OS/2 and DOS, you have to activate this flag in the kernel
1103 configuration or you should set 'ansi' as parameter for the kernel.
1104 The parameter 'normal' sets the new industry standard, starting
1105 from pun 0, scanning up to pun 6. This allows you to change your
1106 opinion still after having already compiled the kernel.
1107 Q: Why can't I find IBM MCA SCSI support in the config menu?
1108 A: You have to activate MCA bus support, first.
1109 Q: Where can I find the latest info about this driver?
1110 A: See the file MAINTAINERS for the current WWW-address, which offers
1111 updates, info and Q/A lists. At this file's origin, the webaddress
1112 was: http://www.staff.uni-mainz.de/mlang/linux.html
1113 Q: My SCSI-adapter is not recognized by the driver, what can I do?
1114 A: Just force it to be recognized by kernel parameters. See section 5.1.
1115 If this really happens, do also send e-mail to the maintainer, as
1116 forced detection should be never necessary. Forced detection is in
1117 principal some flaw of the driver adapter detection and goes into
1118 bug reports.
1119 Q: The driver screws up, if it starts to probe SCSI-devices, is there
1120 some way out of it?
1121 A: Yes, that was some recognition problem of the correct SCSI-adapter
1122 and its I/O base addresses. Upgrade your driver to the latest release
1123 and it should be fine again.
1124 Q: I get a message: panic IBM MCA SCSI: command error .... , what can
1125 I do against this?
1126 A: Previously, I followed the way by ignoring command errors by using
1127 ibmmcascsi=forgiveall, but this command no longer exists and is
1128 obsolete. If such a problem appears, it is caused by some segmentation
1129 fault of the driver, which maps to some unallowed area. The latest
1130 version of the driver should be ok, as most bugs have been solved.
1131 Q: There are still kernel panics, even after having set
1132 ibmmcascsi=forgiveall. Are there other possibilities to prevent
1133 such panics?
1134 A: No, get just the latest release of the driver and it should work
1135 better and better with increasing version number. Forget about this
1136 ibmmcascsi=forgiveall, as also ignorecmd are obsolete.!
1137 Q: Linux panics or stops without any comment, but it is probable, that my
1138 harddisk(s) have bad blocks.
1139 A: Sorry, the bad-block handling is still a feeble point of this driver,
1140 but is on the schedule for development in the near future.
1141 Q: Linux panics while dynamically assigning SCSI-ids or ldns.
1142 A: If you disconnect a SCSI-device from the machine, while Linux is up
1143 and the driver uses dynamical reassignment of logical device numbers
1144 (ldn), it really gets "angry" if it won't find devices, that were still
1145 present at boottime and stops Linux.
1146 Q: The system does not recover after an abort-command has been generated.
1147 A: This is regrettably true, as it is not yet understood, why the
1148 SCSI-adapter does really NOT generate any interrupt at the end of
1149 the abort-command. As no interrupt is generated, the abort command
1150 cannot get finished and the system hangs, sorry, but checks are
1151 running to hunt down this problem. If there is a real pending command,
1152 the interrupt MUST get generated after abort. In this case, it
1153 should finish well.
1154 Q: The system gets in bad shape after a SCSI-reset, is this known?
1155 A: Yes, as there are a lot of prescriptions (see the Linux Hackers'
1156 Guide) what has to be done for reset, we still share the bad shape of
1157 the reset functions with all other low level SCSI-drivers.
1158 Astonishingly, reset works in most cases quite ok, but the harddisks
1159 won't run in synchronous mode anymore after a reset, until you reboot.
1160 Q: Why does my XXX w/Cache adapter not use read-prefetch?
1161 A: Ok, that is not completely possible. If a cache is present, the
1162 adapter tries to use it internally. Explicitly, one can use the cache
1163 with a read prefetch command, maybe in future, but this requires
1164 some major overhead of SCSI-commands that risks the performance to
1165 go down more than it gets improved. Tests with that are running.
1166 Q: I have a IBM SCSI-2 Fast/Wide adapter, it boots in some way and hangs.
1167 A: Yes, that is understood, as for sure, your SCSI-2 Fast/Wide adapter
1168 was in such a case recognized as integrated SCSI-adapter or something
1169 else, but not as the correct adapter. As the I/O-ports get assigned
1170 wrongly by that reason, the system should crash in most cases. You
1171 should upgrade to the latest release of the SCSI-driver. The
1172 recommended version is 3.2 or later. Here, the F/W support is in
1173 a stable and reliable condition. Wide-addressing is in addition
1174 supported.
1175 Q: I get an Oops message and something like "killing interrupt".
1176 A: The reason for this is that the IBM SCSI-subsystem only sends a
1177 termination status back, if some error appeared. In former releases
1178 of the driver, it was not checked, if the termination status block
1179 is NULL. From version 3.2, it is taken care of this.
1180 Q: I have a F/W adapter and the driver sees my internal SCSI-devices,
1181 but ignores the external ones.
1182 A: Select combined busmode in the IBM config-program and check for that
1183 no SCSI-id on the external devices appears on internal devices.
1184 Reboot afterwards. Dual busmode is supported, but works only for the
1185 internal bus, yet. External bus is still ignored. Take care for your
1186 SCSI-ids. If combined bus-mode is activated, on some adapters,
1187 the wide-addressing is not possible, so devices with ids between 8
1188 and 15 get ignored by the driver & adapter!
1189 Q: I have a 9595 and I get a NMI during heavy SCSI I/O e.g. during fsck.
1190 A COMMAND ERROR is reported and characters on the screen are missing.
1191 Warm reboot is not possible. Things look like quite weird.
1192 A: Check the processor type of your 9595. If you have an 80486 or 486DX-2
1193 processor complex on your mainboard and you compiled a kernel that
1194 supports 80386 processors, it is possible, that the kernel cannot
1195 keep track of the PS/2 interrupt handling and stops on an NMI. Just
1196 compile a kernel for the correct processor type of your PS/2 and
1197 everything should be fine. This is necessary even if one assumes,
1198 that some 80486 system should be downward compatible to 80386
1199 software.
1200 Q: Some commands hang and interrupts block the machine. After some
1201 timeout, the syslog reports that it tries to call abort, but the
1202 machine is frozen.
1203 A: This can be a busy wait bug in the interrupt handler of driver
1204 version 3.2. You should at least upgrade to 3.2c if you use
1205 kernel < 2.4.0 and driver version 4.0 if you use kernel 2.4.0 or
1206 later (including all test releases).
1207 Q: I have a PS/2 model 80 and more than 16 MBytes of RAM. The driver
1208 completely refuses to work, reports NMIs, COMMAND ERRORs or other
1209 ambiguous stuff. When reducing the RAM size down below 16 MB,
1210 everything is running smoothly.
1211 A: No real answer, yet. In any case, one should force the kernel to
1212 present SCBs only below the 16 MBytes barrier. Maybe this solves the
1213 problem. Not yet tried, but guessing that it could work. To get this,
1214 set unchecked_isa_dma argument of ibmmca.h from 0 to 1.
1215
1216 5.3 Bug reports
1217 --------------
1218 If you really find bugs in the source code or the driver will successfully
1219 refuse to work on your machine, you should send a bug report to me. The
1220 best for this is to follow the instructions on the WWW-page for this
1221 driver. Fill out the bug-report form, placed on the WWW-page and ship it,
1222 so the bugs can be taken into account with maximum efforts. But, please
1223 do not send bug reports about this driver to Linus Torvalds or Leonard
1224 Zubkoff, as Linus is buried in E-Mail and Leonard is supervising all
1225 SCSI-drivers and won't have the time left to look inside every single
1226 driver to fix a bug and especially DO NOT send modified code to Linus
1227 Torvalds or Alan J. Cox which has not been checked here!!! They are both
1228 quite buried in E-mail (as me, sometimes, too) and one should first check
1229 for problems on my local teststand. Recently, I got a lot of
1230 bug reports for errors in the ibmmca.c code, which I could not imagine, but
1231 a look inside some Linux-distribution showed me quite often some modified
1232 code, which did no longer work on most other machines than the one of the
1233 modifier. Ok, so now that there is maintenance service available for this
1234 driver, please use this address first in order to keep the level of
1235 confusion low. Thank you!
1236
1237 When you get a SCSI-error message that panics your system, a list of
1238 register-entries of the SCSI-subsystem is shown (from Version 3.1d). With
1239 this list, it is very easy for the maintainer to localize the problem in
1240 the driver or in the configuration of the user. Please write down all the
1241 values from this report and send them to the maintainer. This would really
1242 help a lot and makes life easier concerning misunderstandings.
1243
1244 Use the bug-report form (see 5.4 for its address) to send all the bug-
1245 stuff to the maintainer or write e-mail with the values from the table.
1246
1247 5.4 Support WWW-page
1248 --------------------
1249 The address of the IBM SCSI-subsystem supporting WWW-page is:
1250
1251 http://www.staff.uni-mainz.de/mlang/linux.html
1252
1253 Here you can find info about the background of this driver, patches,
1254 troubleshooting support, news and a bugreport form. Please check that
1255 WWW-page regularly for latest hints. If ever this URL changes, please
1256 refer to the MAINTAINERS file in order to get the latest address.
1257
1258 For the bugreport, please fill out the formular on the corresponding
1259 WWW-page. Read the dedicated instructions and write as much as you
1260 know about your problem. If you do not like such formulars, please send
1261 some e-mail directly, but at least with the same information as required by
1262 the formular.
1263
1264 If you have extensive bug reports, including Oops messages and
1265 screen-shots, please feel free to send it directly to the address
1266 of the maintainer, too. The current address of the maintainer is:
1267
1268 Michael Lang <langa2@kph.uni-mainz.de>
1269
1270 6 References
1271 ------------
1272 IBM Corp., "Update for the PS/2 Hardware Interface Technical Reference,
1273 Common Interfaces", Armonk, September 1991, PN 04G3281,
1274 (available in the U.S. for $21.75 at 1-800-IBM-PCTB or in Germany for
1275 around 40,-DM at "Hallo IBM").
1276
1277 IBM Corp., "Personal System/2 Micro Channel SCSI
1278 Adapter with Cache Technical Reference", Armonk, March 1990, PN 68X2365.
1279
1280 IBM Corp., "Personal System/2 Micro Channel SCSI
1281 Adapter Technical Reference", Armonk, March 1990, PN 68X2397.
1282
1283 IBM Corp., "SCSI-2 Fast/Wide Adapter/A Technical Reference - Dual Bus",
1284 Armonk, March 1994, PN 83G7545.
1285
1286 Friedhelm Schmidt, "SCSI-Bus und IDE-Schnittstelle - Moderne Peripherie-
1287 Schnittstellen: Hardware, Protokollbeschreibung und Anwendung", 2. Aufl.
1288 Addison Wesley, 1996.
1289
1290 Michael K. Johnson, "The Linux Kernel Hackers' Guide", Version 0.6, Chapel
1291 Hill - North Carolina, 1995
1292
1293 Andreas Kaiser, "SCSI TAPE BACKUP for OS/2 2.0", Version 2.12, Stuttgart
1294 1993
1295
1296 Helmut Rompel, "IBM Computerwelt GUIDE", What is what bei IBM., Systeme *
1297 Programme * Begriffe, IWT-Verlag GmbH - Muenchen, 1988
1298
1299 7 Credits to
1300 ------------
1301 7.1 People
1302 ----------
1303 Klaus Grimm
1304 who already a long time ago gave me the old code from the
1305 SCSI-driver in order to get it running for some old machine
1306 in our institute.
1307 Martin Kolinek
1308 who wrote the first release of the IBM SCSI-subsystem driver.
1309 Chris Beauregard
1310 who for a long time maintained MCA-Linux and the SCSI-driver
1311 in the beginning. Chris, wherever you are: Cheers to you!
1312 Klaus Kudielka
1313 with whom in the 2.1.x times, I had a quite fruitful
1314 cooperation to get the driver running as a module and to get
1315 it running with multiple SCSI-adapters.
1316 David Weinehall
1317 for his excellent maintenance of the MCA-stuff and the quite
1318 detailed bug reports and ideas for this driver (and his
1319 patience ;-)).
1320 Alan J. Cox
1321 for his bug reports and his bold activities in cross-checking
1322 the driver-code with his teststand.
1323
1324 7.2 Sponsors & Supporters
1325 -------------------------
1326 "Hallo IBM",
1327 IBM-Deutschland GmbH
1328 the service of IBM-Deutschland for customers. Their E-Mail
1329 service is unbeatable. Whatever old stuff I asked for, I
1330 always got some helpful answers.
1331 Karl-Otto Reimers,
1332 IBM Klub - Sparte IBM Geschichte, Sindelfingen
1333 for sending me a copy of the w/Cache manual from the
1334 IBM-Deutschland archives.
1335 Harald Staiger
1336 for his extensive hardware donations which allows me today
1337 still to test the driver in various constellations.
1338 Erich Fritscher
1339 for his very kind sponsoring.
1340 Louis Ohland,
1341 Charles Lasitter
1342 for support by shipping me an IBM SCSI-2 Fast/Wide manual.
1343 In addition, the contribution of various hardware is quite
1344 decessive and will make it possible to add FWSR (RAID)
1345 adapter support to the driver in the near future! So,
1346 complaints about no RAID support won't remain forever.
1347 Yes, folks, that is no joke, RAID support is going to rise!
1348 Erik Weber
1349 for the great deal we made about a model 9595 and the nice
1350 surrounding equipment and the cool trip to Mannheim
1351 second-hand computer market. In addition, I would like
1352 to thank him for his exhaustive SCSI-driver testing on his
1353 95er PS/2 park.
1354 Anthony Hogbin
1355 for his direct shipment of a SCSI F/W adapter, which allowed
1356 me immediately on the first stage to try it on model 8557
1357 together with onboard SCSI adapter and some SCSI w/Cache.
1358 Andreas Hotz
1359 for his support by memory and an IBM SCSI-adapter. Collecting
1360 all this together now allows me to try really things with
1361 the driver at maximum load and variety on various models in
1362 a very quick and efficient way.
1363 Peter Jennewein
1364 for his model 30, which serves me as part of my teststand
1365 and his cool remark about how you make an ordinary diskette
1366 drive working and how to connect it to an IBM-diskette port.
1367 Johannes Gutenberg-Universitaet, Mainz &
1368 Institut fuer Kernphysik, Mainz Microtron (MAMI)
1369 for the offered space, the link, placed on the central
1370 homepage and the space to store and offer the driver and
1371 related material and the free working times, which allow
1372 me to answer all your e-mail.
1373
1374 8 Trademarks
1375 ------------
1376 IBM, PS/2, OS/2, Microchannel are registered trademarks of International
1377 Business Machines Corporation
1378
1379 MS-DOS is a registered trademark of Microsoft Corporation
1380
1381 Microware, OS-9 are registered trademarks of Microware Systems
1382
1383 9 Disclaimer
1384 ------------
1385 Beside the GNU General Public License and the dependent disclaimers and disclaimers
1386 concerning the Linux-kernel in special, this SCSI-driver comes without any
1387 warranty. Its functionality is tested as good as possible on certain
1388 machines and combinations of computer hardware, which does not exclude,
1389 that data loss or severe damage of hardware is possible while using this
1390 part of software on some arbitrary computer hardware or in combination
1391 with other software packages. It is highly recommended to make backup
1392 copies of your data before using this software. Furthermore, personal
1393 injuries by hardware defects, that could be caused by this SCSI-driver are
1394 not excluded and it is highly recommended to handle this driver with a
1395 maximum of carefulness.
1396
1397 This driver supports hardware, produced by International Business Machines
1398 Corporation (IBM).
1399
1400------
1401Michael Lang
1402(langa2@kph.uni-mainz.de)
diff --git a/Documentation/scsi/scsi-parameters.txt b/Documentation/scsi/scsi-parameters.txt
index 21e5798526ee..2bfd6f6d2d3d 100644
--- a/Documentation/scsi/scsi-parameters.txt
+++ b/Documentation/scsi/scsi-parameters.txt
@@ -37,9 +37,6 @@ parameters may be changed at runtime by the command
37 37
38 eata= [HW,SCSI] 38 eata= [HW,SCSI]
39 39
40 fd_mcs= [HW,SCSI]
41 See header of drivers/scsi/fd_mcs.c.
42
43 fdomain= [HW,SCSI] 40 fdomain= [HW,SCSI]
44 See header of drivers/scsi/fdomain.c. 41 See header of drivers/scsi/fdomain.c.
45 42
@@ -48,9 +45,6 @@ parameters may be changed at runtime by the command
48 45
49 gvp11= [HW,SCSI] 46 gvp11= [HW,SCSI]
50 47
51 ibmmcascsi= [HW,MCA,SCSI] IBM MicroChannel SCSI adapter
52 See Documentation/mca.txt.
53
54 in2000= [HW,SCSI] 48 in2000= [HW,SCSI]
55 See header of drivers/scsi/in2000.c. 49 See header of drivers/scsi/in2000.c.
56 50
diff --git a/Documentation/scsi/scsi_mid_low_api.txt b/Documentation/scsi/scsi_mid_low_api.txt
index a340b18cd4eb..2b06aba4fa0f 100644
--- a/Documentation/scsi/scsi_mid_low_api.txt
+++ b/Documentation/scsi/scsi_mid_low_api.txt
@@ -30,7 +30,7 @@ the motherboard (or both). Some aic7xxx based HBAs are dual controllers
30and thus represent two hosts. Like most modern HBAs, each aic7xxx host 30and thus represent two hosts. Like most modern HBAs, each aic7xxx host
31has its own PCI device address. [The one-to-one correspondence between 31has its own PCI device address. [The one-to-one correspondence between
32a SCSI host and a PCI device is common but not required (e.g. with 32a SCSI host and a PCI device is common but not required (e.g. with
33ISA or MCA adapters).] 33ISA adapters).]
34 34
35The SCSI mid level isolates an LLD from other layers such as the SCSI 35The SCSI mid level isolates an LLD from other layers such as the SCSI
36upper layer drivers and the block layer. 36upper layer drivers and the block layer.
diff --git a/Documentation/serial/stallion.txt b/Documentation/serial/stallion.txt
index 55090914a9c5..4d798c0cb5cb 100644
--- a/Documentation/serial/stallion.txt
+++ b/Documentation/serial/stallion.txt
@@ -20,10 +20,10 @@ There are two drivers that work with the different families of Stallion
20multiport serial boards. One is for the Stallion smart boards - that is 20multiport serial boards. One is for the Stallion smart boards - that is
21EasyIO, EasyConnection 8/32 and EasyConnection 8/64-PCI, the other for 21EasyIO, EasyConnection 8/32 and EasyConnection 8/64-PCI, the other for
22the true Stallion intelligent multiport boards - EasyConnection 8/64 22the true Stallion intelligent multiport boards - EasyConnection 8/64
23(ISA, EISA, MCA), EasyConnection/RA-PCI, ONboard and Brumby. 23(ISA, EISA), EasyConnection/RA-PCI, ONboard and Brumby.
24 24
25If you are using any of the Stallion intelligent multiport boards (Brumby, 25If you are using any of the Stallion intelligent multiport boards (Brumby,
26ONboard, EasyConnection 8/64 (ISA, EISA, MCA), EasyConnection/RA-PCI) with 26ONboard, EasyConnection 8/64 (ISA, EISA), EasyConnection/RA-PCI) with
27Linux you will need to get the driver utility package. This contains a 27Linux you will need to get the driver utility package. This contains a
28firmware loader and the firmware images necessary to make the devices operate. 28firmware loader and the firmware images necessary to make the devices operate.
29 29
@@ -40,7 +40,7 @@ If you are using the EasyIO, EasyConnection 8/32 or EasyConnection 8/64-PCI
40boards then you don't need this package, although it does have a serial stats 40boards then you don't need this package, although it does have a serial stats
41display program. 41display program.
42 42
43If you require DIP switch settings, EISA or MCA configuration files, or any 43If you require DIP switch settings, or EISA configuration files, or any
44other information related to Stallion boards then have a look at Stallion's 44other information related to Stallion boards then have a look at Stallion's
45web pages at http://www.stallion.com. 45web pages at http://www.stallion.com.
46 46
@@ -51,13 +51,13 @@ web pages at http://www.stallion.com.
51The drivers can be used as loadable modules or compiled into the kernel. 51The drivers can be used as loadable modules or compiled into the kernel.
52You can choose which when doing a "config" on the kernel. 52You can choose which when doing a "config" on the kernel.
53 53
54All ISA, EISA and MCA boards that you want to use need to be configured into 54All ISA, and EISA boards that you want to use need to be configured into
55the driver(s). All PCI boards will be automatically detected when you load 55the driver(s). All PCI boards will be automatically detected when you load
56the driver - so they do not need to be entered into the driver(s) 56the driver - so they do not need to be entered into the driver(s)
57configuration structure. Note that kernel PCI support is required to use PCI 57configuration structure. Note that kernel PCI support is required to use PCI
58boards. 58boards.
59 59
60There are two methods of configuring ISA, EISA and MCA boards into the drivers. 60There are two methods of configuring ISA and EISA boards into the drivers.
61If using the driver as a loadable module then the simplest method is to pass 61If using the driver as a loadable module then the simplest method is to pass
62the driver configuration as module arguments. The other method is to modify 62the driver configuration as module arguments. The other method is to modify
63the driver source to add configuration lines for each board in use. 63the driver source to add configuration lines for each board in use.
@@ -71,12 +71,12 @@ That makes things pretty simple to get going.
712.1 MODULE DRIVER CONFIGURATION: 712.1 MODULE DRIVER CONFIGURATION:
72 72
73The simplest configuration for modules is to use the module load arguments 73The simplest configuration for modules is to use the module load arguments
74to configure any ISA, EISA or MCA boards. PCI boards are automatically 74to configure any ISA or EISA boards. PCI boards are automatically
75detected, so do not need any additional configuration at all. 75detected, so do not need any additional configuration at all.
76 76
77If using EasyIO, EasyConnection 8/32 ISA or MCA, or EasyConnection 8/63-PCI 77If using EasyIO, EasyConnection 8/32 ISA, or EasyConnection 8/63-PCI
78boards then use the "stallion" driver module, Otherwise if you are using 78boards then use the "stallion" driver module, Otherwise if you are using
79an EasyConnection 8/64 ISA, EISA or MCA, EasyConnection/RA-PCI, ONboard, 79an EasyConnection 8/64 ISA or EISA, EasyConnection/RA-PCI, ONboard,
80Brumby or original Stallion board then use the "istallion" driver module. 80Brumby or original Stallion board then use the "istallion" driver module.
81 81
82Typically to load up the smart board driver use: 82Typically to load up the smart board driver use:
@@ -146,7 +146,7 @@ on each system boot. Typically configuration files are put in the
1462.2 STATIC DRIVER CONFIGURATION: 1462.2 STATIC DRIVER CONFIGURATION:
147 147
148For static driver configuration you need to modify the driver source code. 148For static driver configuration you need to modify the driver source code.
149Entering ISA, EISA and MCA boards into the driver(s) configuration structure 149Entering ISA and EISA boards into the driver(s) configuration structure
150involves editing the driver(s) source file. It's pretty easy if you follow 150involves editing the driver(s) source file. It's pretty easy if you follow
151the instructions below. Both drivers can support up to 4 boards. The smart 151the instructions below. Both drivers can support up to 4 boards. The smart
152card driver (the stallion.c driver) supports any combination of EasyIO and 152card driver (the stallion.c driver) supports any combination of EasyIO and
@@ -157,7 +157,7 @@ supports any combination of ONboards, Brumbys, Stallions and EasyConnection
157To set up the driver(s) for the boards that you want to use you need to 157To set up the driver(s) for the boards that you want to use you need to
158edit the appropriate driver file and add configuration entries. 158edit the appropriate driver file and add configuration entries.
159 159
160If using EasyIO or EasyConnection 8/32 ISA or MCA boards, 160If using EasyIO or EasyConnection 8/32 ISA boards,
161 In drivers/char/stallion.c: 161 In drivers/char/stallion.c:
162 - find the definition of the stl_brdconf array (of structures) 162 - find the definition of the stl_brdconf array (of structures)
163 near the top of the file 163 near the top of the file
@@ -243,7 +243,7 @@ change it on the board.
243On EasyIO and EasyConnection 8/32 boards the IRQ is software programmable, so 243On EasyIO and EasyConnection 8/32 boards the IRQ is software programmable, so
244if there is a conflict you may need to change the IRQ used for a board. There 244if there is a conflict you may need to change the IRQ used for a board. There
245are no interrupts to worry about for ONboard, Brumby or EasyConnection 8/64 245are no interrupts to worry about for ONboard, Brumby or EasyConnection 8/64
246(ISA, EISA and MCA) boards. The memory region on EasyConnection 8/64 and 246(ISA and EISA) boards. The memory region on EasyConnection 8/64 and
247ONboard boards is software programmable, but not on the Brumby boards. 247ONboard boards is software programmable, but not on the Brumby boards.
248 248
249 249
diff --git a/MAINTAINERS b/MAINTAINERS
index 96ec7b2e2522..27a1d3c6eec8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3347,12 +3347,6 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux.git
3347S: Maintained 3347S: Maintained
3348F: arch/ia64/ 3348F: arch/ia64/
3349 3349
3350IBM MCA SCSI SUBSYSTEM DRIVER
3351M: Michael Lang <langa2@kph.uni-mainz.de>
3352W: http://www.uni-mainz.de/~langm000/linux.html
3353S: Maintained
3354F: drivers/scsi/ibmmca.c
3355
3356IBM Power Linux RAID adapter 3350IBM Power Linux RAID adapter
3357M: Brian King <brking@us.ibm.com> 3351M: Brian King <brking@us.ibm.com>
3358S: Supported 3352S: Supported
@@ -4458,13 +4452,6 @@ T: git git://git.monstr.eu/linux-2.6-microblaze.git
4458S: Supported 4452S: Supported
4459F: arch/microblaze/ 4453F: arch/microblaze/
4460 4454
4461MICROCHANNEL ARCHITECTURE (MCA)
4462M: James Bottomley <James.Bottomley@HansenPartnership.com>
4463S: Maintained
4464F: Documentation/mca.txt
4465F: drivers/mca/
4466F: include/linux/mca*
4467
4468MICROTEK X6 SCANNER 4455MICROTEK X6 SCANNER
4469M: Oliver Neukum <oliver@neukum.name> 4456M: Oliver Neukum <oliver@neukum.name>
4470S: Maintained 4457S: Maintained
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 76edcfe8b56f..4f4c8115d79b 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -107,14 +107,6 @@ config EISA
107config SBUS 107config SBUS
108 bool 108 bool
109 109
110config MCA
111 bool
112 help
113 MicroChannel Architecture is found in some IBM PS/2 machines and
114 laptops. It is a bus system similar to PCI or ISA. See
115 <file:Documentation/mca.txt> (and especially the web page given
116 there) before attempting to build an MCA bus kernel.
117
118config STACKTRACE_SUPPORT 110config STACKTRACE_SUPPORT
119 bool 111 bool
120 default y 112 default y
diff --git a/arch/frv/include/asm/processor.h b/arch/frv/include/asm/processor.h
index a8311d364e2a..dccb9d162318 100644
--- a/arch/frv/include/asm/processor.h
+++ b/arch/frv/include/asm/processor.h
@@ -54,7 +54,6 @@ extern struct cpuinfo_frv __nongprelbss boot_cpu_data;
54 * Bus types 54 * Bus types
55 */ 55 */
56#define EISA_bus 0 56#define EISA_bus 0
57#define MCA_bus 0
58 57
59struct thread_struct { 58struct thread_struct {
60 struct pt_regs *frame; /* [GR28] exception frame ptr for this thread */ 59 struct pt_regs *frame; /* [GR28] exception frame ptr for this thread */
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 4d37072c498a..d6168994e115 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2037,16 +2037,6 @@ config EISA
2037 2037
2038source "drivers/eisa/Kconfig" 2038source "drivers/eisa/Kconfig"
2039 2039
2040config MCA
2041 bool "MCA support"
2042 ---help---
2043 MicroChannel Architecture is found in some IBM PS/2 machines and
2044 laptops. It is a bus system similar to PCI or ISA. See
2045 <file:Documentation/mca.txt> (and especially the web page given
2046 there) before attempting to build an MCA bus kernel.
2047
2048source "drivers/mca/Kconfig"
2049
2050config SCx200 2040config SCx200
2051 tristate "NatSemi SCx200 support" 2041 tristate "NatSemi SCx200 support"
2052 ---help--- 2042 ---help---
diff --git a/arch/x86/include/asm/mca.h b/arch/x86/include/asm/mca.h
deleted file mode 100644
index eedbb6cc1efb..000000000000
--- a/arch/x86/include/asm/mca.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/* -*- mode: c; c-basic-offset: 8 -*- */
2
3/* Platform specific MCA defines */
4#ifndef _ASM_X86_MCA_H
5#define _ASM_X86_MCA_H
6
7/* Maximal number of MCA slots - actually, some machines have less, but
8 * they all have sufficient number of POS registers to cover 8.
9 */
10#define MCA_MAX_SLOT_NR 8
11
12/* Most machines have only one MCA bus. The only multiple bus machines
13 * I know have at most two */
14#define MAX_MCA_BUSSES 2
15
16#define MCA_PRIMARY_BUS 0
17#define MCA_SECONDARY_BUS 1
18
19/* Dummy slot numbers on primary MCA for integrated functions */
20#define MCA_INTEGSCSI (MCA_MAX_SLOT_NR)
21#define MCA_INTEGVIDEO (MCA_MAX_SLOT_NR+1)
22#define MCA_MOTHERBOARD (MCA_MAX_SLOT_NR+2)
23
24/* Dummy POS values for integrated functions */
25#define MCA_DUMMY_POS_START 0x10000
26#define MCA_INTEGSCSI_POS (MCA_DUMMY_POS_START+1)
27#define MCA_INTEGVIDEO_POS (MCA_DUMMY_POS_START+2)
28#define MCA_MOTHERBOARD_POS (MCA_DUMMY_POS_START+3)
29
30/* MCA registers */
31
32#define MCA_MOTHERBOARD_SETUP_REG 0x94
33#define MCA_ADAPTER_SETUP_REG 0x96
34#define MCA_POS_REG(n) (0x100+(n))
35
36#define MCA_ENABLED 0x01 /* POS 2, set if adapter enabled */
37
38/* Max number of adapters, including both slots and various integrated
39 * things.
40 */
41#define MCA_NUMADAPTERS (MCA_MAX_SLOT_NR+3)
42
43#endif /* _ASM_X86_MCA_H */
diff --git a/arch/x86/include/asm/mca_dma.h b/arch/x86/include/asm/mca_dma.h
deleted file mode 100644
index 45271aef82dd..000000000000
--- a/arch/x86/include/asm/mca_dma.h
+++ /dev/null
@@ -1,201 +0,0 @@
1#ifndef _ASM_X86_MCA_DMA_H
2#define _ASM_X86_MCA_DMA_H
3
4#include <asm/io.h>
5#include <linux/ioport.h>
6
7/*
8 * Microchannel specific DMA stuff. DMA on an MCA machine is fairly similar to
9 * standard PC dma, but it certainly has its quirks. DMA register addresses
10 * are in a different place and there are some added functions. Most of this
11 * should be pretty obvious on inspection. Note that the user must divide
12 * count by 2 when using 16-bit dma; that is not handled by these functions.
13 *
14 * Ramen Noodles are yummy.
15 *
16 * 1998 Tymm Twillman <tymm@computer.org>
17 */
18
19/*
20 * Registers that are used by the DMA controller; FN is the function register
21 * (tell the controller what to do) and EXE is the execution register (how
22 * to do it)
23 */
24
25#define MCA_DMA_REG_FN 0x18
26#define MCA_DMA_REG_EXE 0x1A
27
28/*
29 * Functions that the DMA controller can do
30 */
31
32#define MCA_DMA_FN_SET_IO 0x00
33#define MCA_DMA_FN_SET_ADDR 0x20
34#define MCA_DMA_FN_GET_ADDR 0x30
35#define MCA_DMA_FN_SET_COUNT 0x40
36#define MCA_DMA_FN_GET_COUNT 0x50
37#define MCA_DMA_FN_GET_STATUS 0x60
38#define MCA_DMA_FN_SET_MODE 0x70
39#define MCA_DMA_FN_SET_ARBUS 0x80
40#define MCA_DMA_FN_MASK 0x90
41#define MCA_DMA_FN_RESET_MASK 0xA0
42#define MCA_DMA_FN_MASTER_CLEAR 0xD0
43
44/*
45 * Modes (used by setting MCA_DMA_FN_MODE in the function register)
46 *
47 * Note that the MODE_READ is read from memory (write to device), and
48 * MODE_WRITE is vice-versa.
49 */
50
51#define MCA_DMA_MODE_XFER 0x04 /* read by default */
52#define MCA_DMA_MODE_READ 0x04 /* same as XFER */
53#define MCA_DMA_MODE_WRITE 0x08 /* OR with MODE_XFER to use */
54#define MCA_DMA_MODE_IO 0x01 /* DMA from IO register */
55#define MCA_DMA_MODE_16 0x40 /* 16 bit xfers */
56
57
58/**
59 * mca_enable_dma - channel to enable DMA on
60 * @dmanr: DMA channel
61 *
62 * Enable the MCA bus DMA on a channel. This can be called from
63 * IRQ context.
64 */
65
66static inline void mca_enable_dma(unsigned int dmanr)
67{
68 outb(MCA_DMA_FN_RESET_MASK | dmanr, MCA_DMA_REG_FN);
69}
70
71/**
72 * mca_disble_dma - channel to disable DMA on
73 * @dmanr: DMA channel
74 *
75 * Enable the MCA bus DMA on a channel. This can be called from
76 * IRQ context.
77 */
78
79static inline void mca_disable_dma(unsigned int dmanr)
80{
81 outb(MCA_DMA_FN_MASK | dmanr, MCA_DMA_REG_FN);
82}
83
84/**
85 * mca_set_dma_addr - load a 24bit DMA address
86 * @dmanr: DMA channel
87 * @a: 24bit bus address
88 *
89 * Load the address register in the DMA controller. This has a 24bit
90 * limitation (16Mb).
91 */
92
93static inline void mca_set_dma_addr(unsigned int dmanr, unsigned int a)
94{
95 outb(MCA_DMA_FN_SET_ADDR | dmanr, MCA_DMA_REG_FN);
96 outb(a & 0xff, MCA_DMA_REG_EXE);
97 outb((a >> 8) & 0xff, MCA_DMA_REG_EXE);
98 outb((a >> 16) & 0xff, MCA_DMA_REG_EXE);
99}
100
101/**
102 * mca_get_dma_addr - load a 24bit DMA address
103 * @dmanr: DMA channel
104 *
105 * Read the address register in the DMA controller. This has a 24bit
106 * limitation (16Mb). The return is a bus address.
107 */
108
109static inline unsigned int mca_get_dma_addr(unsigned int dmanr)
110{
111 unsigned int addr;
112
113 outb(MCA_DMA_FN_GET_ADDR | dmanr, MCA_DMA_REG_FN);
114 addr = inb(MCA_DMA_REG_EXE);
115 addr |= inb(MCA_DMA_REG_EXE) << 8;
116 addr |= inb(MCA_DMA_REG_EXE) << 16;
117
118 return addr;
119}
120
121/**
122 * mca_set_dma_count - load a 16bit transfer count
123 * @dmanr: DMA channel
124 * @count: count
125 *
126 * Set the DMA count for this channel. This can be up to 64Kbytes.
127 * Setting a count of zero will not do what you expect.
128 */
129
130static inline void mca_set_dma_count(unsigned int dmanr, unsigned int count)
131{
132 count--; /* transfers one more than count -- correct for this */
133
134 outb(MCA_DMA_FN_SET_COUNT | dmanr, MCA_DMA_REG_FN);
135 outb(count & 0xff, MCA_DMA_REG_EXE);
136 outb((count >> 8) & 0xff, MCA_DMA_REG_EXE);
137}
138
139/**
140 * mca_get_dma_residue - get the remaining bytes to transfer
141 * @dmanr: DMA channel
142 *
143 * This function returns the number of bytes left to transfer
144 * on this DMA channel.
145 */
146
147static inline unsigned int mca_get_dma_residue(unsigned int dmanr)
148{
149 unsigned short count;
150
151 outb(MCA_DMA_FN_GET_COUNT | dmanr, MCA_DMA_REG_FN);
152 count = 1 + inb(MCA_DMA_REG_EXE);
153 count += inb(MCA_DMA_REG_EXE) << 8;
154
155 return count;
156}
157
158/**
159 * mca_set_dma_io - set the port for an I/O transfer
160 * @dmanr: DMA channel
161 * @io_addr: an I/O port number
162 *
163 * Unlike the ISA bus DMA controllers the DMA on MCA bus can transfer
164 * with an I/O port target.
165 */
166
167static inline void mca_set_dma_io(unsigned int dmanr, unsigned int io_addr)
168{
169 /*
170 * DMA from a port address -- set the io address
171 */
172
173 outb(MCA_DMA_FN_SET_IO | dmanr, MCA_DMA_REG_FN);
174 outb(io_addr & 0xff, MCA_DMA_REG_EXE);
175 outb((io_addr >> 8) & 0xff, MCA_DMA_REG_EXE);
176}
177
178/**
179 * mca_set_dma_mode - set the DMA mode
180 * @dmanr: DMA channel
181 * @mode: mode to set
182 *
183 * The DMA controller supports several modes. The mode values you can
184 * set are-
185 *
186 * %MCA_DMA_MODE_READ when reading from the DMA device.
187 *
188 * %MCA_DMA_MODE_WRITE to writing to the DMA device.
189 *
190 * %MCA_DMA_MODE_IO to do DMA to or from an I/O port.
191 *
192 * %MCA_DMA_MODE_16 to do 16bit transfers.
193 */
194
195static inline void mca_set_dma_mode(unsigned int dmanr, unsigned int mode)
196{
197 outb(MCA_DMA_FN_SET_MODE | dmanr, MCA_DMA_REG_FN);
198 outb(mode, MCA_DMA_REG_EXE);
199}
200
201#endif /* _ASM_X86_MCA_DMA_H */
diff --git a/arch/x86/include/asm/mpspec.h b/arch/x86/include/asm/mpspec.h
index 9c7d95f6174b..3e2f42a4b872 100644
--- a/arch/x86/include/asm/mpspec.h
+++ b/arch/x86/include/asm/mpspec.h
@@ -40,7 +40,7 @@ extern int quad_local_to_mp_bus_id [NR_CPUS/4][4];
40 40
41#endif /* CONFIG_X86_64 */ 41#endif /* CONFIG_X86_64 */
42 42
43#if defined(CONFIG_MCA) || defined(CONFIG_EISA) 43#ifdef CONFIG_EISA
44extern int mp_bus_id_to_type[MAX_MP_BUSSES]; 44extern int mp_bus_id_to_type[MAX_MP_BUSSES];
45#endif 45#endif
46 46
diff --git a/arch/x86/include/asm/mpspec_def.h b/arch/x86/include/asm/mpspec_def.h
index c0a955a9a087..b31f8c098271 100644
--- a/arch/x86/include/asm/mpspec_def.h
+++ b/arch/x86/include/asm/mpspec_def.h
@@ -84,7 +84,7 @@ struct mpc_bus {
84#define BUSTYPE_EISA "EISA" 84#define BUSTYPE_EISA "EISA"
85#define BUSTYPE_ISA "ISA" 85#define BUSTYPE_ISA "ISA"
86#define BUSTYPE_INTERN "INTERN" /* Internal BUS */ 86#define BUSTYPE_INTERN "INTERN" /* Internal BUS */
87#define BUSTYPE_MCA "MCA" 87#define BUSTYPE_MCA "MCA" /* Obsolete */
88#define BUSTYPE_VL "VL" /* Local bus */ 88#define BUSTYPE_VL "VL" /* Local bus */
89#define BUSTYPE_PCI "PCI" 89#define BUSTYPE_PCI "PCI"
90#define BUSTYPE_PCMCIA "PCMCIA" 90#define BUSTYPE_PCMCIA "PCMCIA"
@@ -169,6 +169,5 @@ enum mp_bustype {
169 MP_BUS_ISA = 1, 169 MP_BUS_ISA = 1,
170 MP_BUS_EISA, 170 MP_BUS_EISA,
171 MP_BUS_PCI, 171 MP_BUS_PCI,
172 MP_BUS_MCA,
173}; 172};
174#endif /* _ASM_X86_MPSPEC_DEF_H */ 173#endif /* _ASM_X86_MPSPEC_DEF_H */
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 56ebd1f98447..bb8529275aab 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -49,7 +49,6 @@ obj-y += cpu/
49obj-y += acpi/ 49obj-y += acpi/
50obj-y += reboot.o 50obj-y += reboot.o
51obj-$(CONFIG_X86_32) += reboot_32.o 51obj-$(CONFIG_X86_32) += reboot_32.o
52obj-$(CONFIG_MCA) += mca_32.o
53obj-$(CONFIG_X86_MSR) += msr.o 52obj-$(CONFIG_X86_MSR) += msr.o
54obj-$(CONFIG_X86_CPUID) += cpuid.o 53obj-$(CONFIG_X86_CPUID) += cpuid.o
55obj-$(CONFIG_PCI) += early-quirks.o 54obj-$(CONFIG_PCI) += early-quirks.o
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 7c439fe4941b..8afb69319815 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -990,7 +990,7 @@ void __init mp_config_acpi_legacy_irqs(void)
990 int i; 990 int i;
991 struct mpc_intsrc mp_irq; 991 struct mpc_intsrc mp_irq;
992 992
993#if defined (CONFIG_MCA) || defined (CONFIG_EISA) 993#ifdef CONFIG_EISA
994 /* 994 /*
995 * Fabricate the legacy ISA bus (bus #31). 995 * Fabricate the legacy ISA bus (bus #31).
996 */ 996 */
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index ffdc152e507d..ac96561d1a99 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -140,7 +140,7 @@ int mp_irq_entries;
140/* GSI interrupts */ 140/* GSI interrupts */
141static int nr_irqs_gsi = NR_IRQS_LEGACY; 141static int nr_irqs_gsi = NR_IRQS_LEGACY;
142 142
143#if defined (CONFIG_MCA) || defined (CONFIG_EISA) 143#ifdef CONFIG_EISA
144int mp_bus_id_to_type[MAX_MP_BUSSES]; 144int mp_bus_id_to_type[MAX_MP_BUSSES];
145#endif 145#endif
146 146
@@ -835,7 +835,7 @@ static int __init find_isa_irq_apic(int irq, int type)
835 return -1; 835 return -1;
836} 836}
837 837
838#if defined(CONFIG_EISA) || defined(CONFIG_MCA) 838#ifdef CONFIG_EISA
839/* 839/*
840 * EISA Edge/Level control register, ELCR 840 * EISA Edge/Level control register, ELCR
841 */ 841 */
@@ -872,12 +872,6 @@ static int EISA_ELCR(unsigned int irq)
872#define default_PCI_trigger(idx) (1) 872#define default_PCI_trigger(idx) (1)
873#define default_PCI_polarity(idx) (1) 873#define default_PCI_polarity(idx) (1)
874 874
875/* MCA interrupts are always polarity zero level triggered,
876 * when listed as conforming in the MP table. */
877
878#define default_MCA_trigger(idx) (1)
879#define default_MCA_polarity(idx) default_ISA_polarity(idx)
880
881static int irq_polarity(int idx) 875static int irq_polarity(int idx)
882{ 876{
883 int bus = mp_irqs[idx].srcbus; 877 int bus = mp_irqs[idx].srcbus;
@@ -935,7 +929,7 @@ static int irq_trigger(int idx)
935 trigger = default_ISA_trigger(idx); 929 trigger = default_ISA_trigger(idx);
936 else 930 else
937 trigger = default_PCI_trigger(idx); 931 trigger = default_PCI_trigger(idx);
938#if defined(CONFIG_EISA) || defined(CONFIG_MCA) 932#ifdef CONFIG_EISA
939 switch (mp_bus_id_to_type[bus]) { 933 switch (mp_bus_id_to_type[bus]) {
940 case MP_BUS_ISA: /* ISA pin */ 934 case MP_BUS_ISA: /* ISA pin */
941 { 935 {
@@ -952,11 +946,6 @@ static int irq_trigger(int idx)
952 /* set before the switch */ 946 /* set before the switch */
953 break; 947 break;
954 } 948 }
955 case MP_BUS_MCA: /* MCA pin */
956 {
957 trigger = default_MCA_trigger(idx);
958 break;
959 }
960 default: 949 default:
961 { 950 {
962 printk(KERN_WARNING "broken BIOS!!\n"); 951 printk(KERN_WARNING "broken BIOS!!\n");
diff --git a/arch/x86/kernel/mca_32.c b/arch/x86/kernel/mca_32.c
deleted file mode 100644
index 7eb1e2b97827..000000000000
--- a/arch/x86/kernel/mca_32.c
+++ /dev/null
@@ -1,476 +0,0 @@
1/*
2 * Written by Martin Kolinek, February 1996
3 *
4 * Changes:
5 *
6 * Chris Beauregard July 28th, 1996
7 * - Fixed up integrated SCSI detection
8 *
9 * Chris Beauregard August 3rd, 1996
10 * - Made mca_info local
11 * - Made integrated registers accessible through standard function calls
12 * - Added name field
13 * - More sanity checking
14 *
15 * Chris Beauregard August 9th, 1996
16 * - Rewrote /proc/mca
17 *
18 * Chris Beauregard January 7th, 1997
19 * - Added basic NMI-processing
20 * - Added more information to mca_info structure
21 *
22 * David Weinehall October 12th, 1998
23 * - Made a lot of cleaning up in the source
24 * - Added use of save_flags / restore_flags
25 * - Added the 'driver_loaded' flag in MCA_adapter
26 * - Added an alternative implemention of ZP Gu's mca_find_unused_adapter
27 *
28 * David Weinehall March 24th, 1999
29 * - Fixed the output of 'Driver Installed' in /proc/mca/pos
30 * - Made the Integrated Video & SCSI show up even if they have id 0000
31 *
32 * Alexander Viro November 9th, 1999
33 * - Switched to regular procfs methods
34 *
35 * Alfred Arnold & David Weinehall August 23rd, 2000
36 * - Added support for Planar POS-registers
37 */
38
39#include <linux/module.h>
40#include <linux/types.h>
41#include <linux/errno.h>
42#include <linux/kernel.h>
43#include <linux/mca.h>
44#include <linux/kprobes.h>
45#include <linux/slab.h>
46#include <asm/io.h>
47#include <linux/proc_fs.h>
48#include <linux/mman.h>
49#include <linux/mm.h>
50#include <linux/pagemap.h>
51#include <linux/ioport.h>
52#include <asm/uaccess.h>
53#include <linux/init.h>
54
55static unsigned char which_scsi;
56
57int MCA_bus;
58EXPORT_SYMBOL(MCA_bus);
59
60/*
61 * Motherboard register spinlock. Untested on SMP at the moment, but
62 * are there any MCA SMP boxes?
63 *
64 * Yes - Alan
65 */
66static DEFINE_SPINLOCK(mca_lock);
67
68/* Build the status info for the adapter */
69
70static void mca_configure_adapter_status(struct mca_device *mca_dev)
71{
72 mca_dev->status = MCA_ADAPTER_NONE;
73
74 mca_dev->pos_id = mca_dev->pos[0]
75 + (mca_dev->pos[1] << 8);
76
77 if (!mca_dev->pos_id && mca_dev->slot < MCA_MAX_SLOT_NR) {
78
79 /*
80 * id = 0x0000 usually indicates hardware failure,
81 * however, ZP Gu (zpg@castle.net> reports that his 9556
82 * has 0x0000 as id and everything still works. There
83 * also seem to be an adapter with id = 0x0000; the
84 * NCR Parallel Bus Memory Card. Until this is confirmed,
85 * however, this code will stay.
86 */
87
88 mca_dev->status = MCA_ADAPTER_ERROR;
89
90 return;
91 } else if (mca_dev->pos_id != 0xffff) {
92
93 /*
94 * 0xffff usually indicates that there's no adapter,
95 * however, some integrated adapters may have 0xffff as
96 * their id and still be valid. Examples are on-board
97 * VGA of the 55sx, the integrated SCSI of the 56 & 57,
98 * and possibly also the 95 ULTIMEDIA.
99 */
100
101 mca_dev->status = MCA_ADAPTER_NORMAL;
102 }
103
104 if ((mca_dev->pos_id == 0xffff ||
105 mca_dev->pos_id == 0x0000) && mca_dev->slot >= MCA_MAX_SLOT_NR) {
106 int j;
107
108 for (j = 2; j < 8; j++) {
109 if (mca_dev->pos[j] != 0xff) {
110 mca_dev->status = MCA_ADAPTER_NORMAL;
111 break;
112 }
113 }
114 }
115
116 if (!(mca_dev->pos[2] & MCA_ENABLED)) {
117
118 /* enabled bit is in POS 2 */
119
120 mca_dev->status = MCA_ADAPTER_DISABLED;
121 }
122} /* mca_configure_adapter_status */
123
124/*--------------------------------------------------------------------*/
125
126static struct resource mca_standard_resources[] = {
127 { .start = 0x60, .end = 0x60, .name = "system control port B (MCA)" },
128 { .start = 0x90, .end = 0x90, .name = "arbitration (MCA)" },
129 { .start = 0x91, .end = 0x91, .name = "card Select Feedback (MCA)" },
130 { .start = 0x92, .end = 0x92, .name = "system Control port A (MCA)" },
131 { .start = 0x94, .end = 0x94, .name = "system board setup (MCA)" },
132 { .start = 0x96, .end = 0x97, .name = "POS (MCA)" },
133 { .start = 0x100, .end = 0x107, .name = "POS (MCA)" }
134};
135
136#define MCA_STANDARD_RESOURCES ARRAY_SIZE(mca_standard_resources)
137
138/*
139 * mca_read_and_store_pos - read the POS registers into a memory buffer
140 * @pos: a char pointer to 8 bytes, contains the POS register value on
141 * successful return
142 *
143 * Returns 1 if a card actually exists (i.e. the pos isn't
144 * all 0xff) or 0 otherwise
145 */
146static int mca_read_and_store_pos(unsigned char *pos)
147{
148 int j;
149 int found = 0;
150
151 for (j = 0; j < 8; j++) {
152 pos[j] = inb_p(MCA_POS_REG(j));
153 if (pos[j] != 0xff) {
154 /* 0xff all across means no device. 0x00 means
155 * something's broken, but a device is
156 * probably there. However, if you get 0x00
157 * from a motherboard register it won't matter
158 * what we find. For the record, on the
159 * 57SLC, the integrated SCSI adapter has
160 * 0xffff for the adapter ID, but nonzero for
161 * other registers. */
162
163 found = 1;
164 }
165 }
166 return found;
167}
168
169static unsigned char mca_pc_read_pos(struct mca_device *mca_dev, int reg)
170{
171 unsigned char byte;
172 unsigned long flags;
173
174 if (reg < 0 || reg >= 8)
175 return 0;
176
177 spin_lock_irqsave(&mca_lock, flags);
178 if (mca_dev->pos_register) {
179 /* Disable adapter setup, enable motherboard setup */
180
181 outb_p(0, MCA_ADAPTER_SETUP_REG);
182 outb_p(mca_dev->pos_register, MCA_MOTHERBOARD_SETUP_REG);
183
184 byte = inb_p(MCA_POS_REG(reg));
185 outb_p(0xff, MCA_MOTHERBOARD_SETUP_REG);
186 } else {
187
188 /* Make sure motherboard setup is off */
189
190 outb_p(0xff, MCA_MOTHERBOARD_SETUP_REG);
191
192 /* Read the appropriate register */
193
194 outb_p(0x8|(mca_dev->slot & 0xf), MCA_ADAPTER_SETUP_REG);
195 byte = inb_p(MCA_POS_REG(reg));
196 outb_p(0, MCA_ADAPTER_SETUP_REG);
197 }
198 spin_unlock_irqrestore(&mca_lock, flags);
199
200 mca_dev->pos[reg] = byte;
201
202 return byte;
203}
204
205static void mca_pc_write_pos(struct mca_device *mca_dev, int reg,
206 unsigned char byte)
207{
208 unsigned long flags;
209
210 if (reg < 0 || reg >= 8)
211 return;
212
213 spin_lock_irqsave(&mca_lock, flags);
214
215 /* Make sure motherboard setup is off */
216
217 outb_p(0xff, MCA_MOTHERBOARD_SETUP_REG);
218
219 /* Read in the appropriate register */
220
221 outb_p(0x8|(mca_dev->slot&0xf), MCA_ADAPTER_SETUP_REG);
222 outb_p(byte, MCA_POS_REG(reg));
223 outb_p(0, MCA_ADAPTER_SETUP_REG);
224
225 spin_unlock_irqrestore(&mca_lock, flags);
226
227 /* Update the global register list, while we have the byte */
228
229 mca_dev->pos[reg] = byte;
230
231}
232
233/* for the primary MCA bus, we have identity transforms */
234static int mca_dummy_transform_irq(struct mca_device *mca_dev, int irq)
235{
236 return irq;
237}
238
239static int mca_dummy_transform_ioport(struct mca_device *mca_dev, int port)
240{
241 return port;
242}
243
244static void *mca_dummy_transform_memory(struct mca_device *mca_dev, void *mem)
245{
246 return mem;
247}
248
249
250static int __init mca_init(void)
251{
252 unsigned int i, j;
253 struct mca_device *mca_dev;
254 unsigned char pos[8];
255 short mca_builtin_scsi_ports[] = {0xf7, 0xfd, 0x00};
256 struct mca_bus *bus;
257
258 /*
259 * WARNING: Be careful when making changes here. Putting an adapter
260 * and the motherboard simultaneously into setup mode may result in
261 * damage to chips (according to The Indispensable PC Hardware Book
262 * by Hans-Peter Messmer). Also, we disable system interrupts (so
263 * that we are not disturbed in the middle of this).
264 */
265
266 /* Make sure the MCA bus is present */
267
268 if (mca_system_init()) {
269 printk(KERN_ERR "MCA bus system initialisation failed\n");
270 return -ENODEV;
271 }
272
273 if (!MCA_bus)
274 return -ENODEV;
275
276 printk(KERN_INFO "Micro Channel bus detected.\n");
277
278 /* All MCA systems have at least a primary bus */
279 bus = mca_attach_bus(MCA_PRIMARY_BUS);
280 if (!bus)
281 goto out_nomem;
282 bus->default_dma_mask = 0xffffffffLL;
283 bus->f.mca_write_pos = mca_pc_write_pos;
284 bus->f.mca_read_pos = mca_pc_read_pos;
285 bus->f.mca_transform_irq = mca_dummy_transform_irq;
286 bus->f.mca_transform_ioport = mca_dummy_transform_ioport;
287 bus->f.mca_transform_memory = mca_dummy_transform_memory;
288
289 /* get the motherboard device */
290 mca_dev = kzalloc(sizeof(struct mca_device), GFP_KERNEL);
291 if (unlikely(!mca_dev))
292 goto out_nomem;
293
294 /*
295 * We do not expect many MCA interrupts during initialization,
296 * but let us be safe:
297 */
298 spin_lock_irq(&mca_lock);
299
300 /* Make sure adapter setup is off */
301
302 outb_p(0, MCA_ADAPTER_SETUP_REG);
303
304 /* Read motherboard POS registers */
305
306 mca_dev->pos_register = 0x7f;
307 outb_p(mca_dev->pos_register, MCA_MOTHERBOARD_SETUP_REG);
308 mca_dev->name[0] = 0;
309 mca_read_and_store_pos(mca_dev->pos);
310 mca_configure_adapter_status(mca_dev);
311 /* fake POS and slot for a motherboard */
312 mca_dev->pos_id = MCA_MOTHERBOARD_POS;
313 mca_dev->slot = MCA_MOTHERBOARD;
314 mca_register_device(MCA_PRIMARY_BUS, mca_dev);
315
316 mca_dev = kzalloc(sizeof(struct mca_device), GFP_ATOMIC);
317 if (unlikely(!mca_dev))
318 goto out_unlock_nomem;
319
320 /* Put motherboard into video setup mode, read integrated video
321 * POS registers, and turn motherboard setup off.
322 */
323
324 mca_dev->pos_register = 0xdf;
325 outb_p(mca_dev->pos_register, MCA_MOTHERBOARD_SETUP_REG);
326 mca_dev->name[0] = 0;
327 mca_read_and_store_pos(mca_dev->pos);
328 mca_configure_adapter_status(mca_dev);
329 /* fake POS and slot for the integrated video */
330 mca_dev->pos_id = MCA_INTEGVIDEO_POS;
331 mca_dev->slot = MCA_INTEGVIDEO;
332 mca_register_device(MCA_PRIMARY_BUS, mca_dev);
333
334 /*
335 * Put motherboard into scsi setup mode, read integrated scsi
336 * POS registers, and turn motherboard setup off.
337 *
338 * It seems there are two possible SCSI registers. Martin says that
339 * for the 56,57, 0xf7 is the one, but fails on the 76.
340 * Alfredo (apena@vnet.ibm.com) says
341 * 0xfd works on his machine. We'll try both of them. I figure it's
342 * a good bet that only one could be valid at a time. This could
343 * screw up though if one is used for something else on the other
344 * machine.
345 */
346
347 for (i = 0; (which_scsi = mca_builtin_scsi_ports[i]) != 0; i++) {
348 outb_p(which_scsi, MCA_MOTHERBOARD_SETUP_REG);
349 if (mca_read_and_store_pos(pos))
350 break;
351 }
352 if (which_scsi) {
353 /* found a scsi card */
354 mca_dev = kzalloc(sizeof(struct mca_device), GFP_ATOMIC);
355 if (unlikely(!mca_dev))
356 goto out_unlock_nomem;
357
358 for (j = 0; j < 8; j++)
359 mca_dev->pos[j] = pos[j];
360
361 mca_configure_adapter_status(mca_dev);
362 /* fake POS and slot for integrated SCSI controller */
363 mca_dev->pos_id = MCA_INTEGSCSI_POS;
364 mca_dev->slot = MCA_INTEGSCSI;
365 mca_dev->pos_register = which_scsi;
366 mca_register_device(MCA_PRIMARY_BUS, mca_dev);
367 }
368
369 /* Turn off motherboard setup */
370
371 outb_p(0xff, MCA_MOTHERBOARD_SETUP_REG);
372
373 /*
374 * Now loop over MCA slots: put each adapter into setup mode, and
375 * read its POS registers. Then put adapter setup off.
376 */
377
378 for (i = 0; i < MCA_MAX_SLOT_NR; i++) {
379 outb_p(0x8|(i&0xf), MCA_ADAPTER_SETUP_REG);
380 if (!mca_read_and_store_pos(pos))
381 continue;
382
383 mca_dev = kzalloc(sizeof(struct mca_device), GFP_ATOMIC);
384 if (unlikely(!mca_dev))
385 goto out_unlock_nomem;
386
387 for (j = 0; j < 8; j++)
388 mca_dev->pos[j] = pos[j];
389
390 mca_dev->driver_loaded = 0;
391 mca_dev->slot = i;
392 mca_dev->pos_register = 0;
393 mca_configure_adapter_status(mca_dev);
394 mca_register_device(MCA_PRIMARY_BUS, mca_dev);
395 }
396 outb_p(0, MCA_ADAPTER_SETUP_REG);
397
398 /* Enable interrupts and return memory start */
399 spin_unlock_irq(&mca_lock);
400
401 for (i = 0; i < MCA_STANDARD_RESOURCES; i++)
402 request_resource(&ioport_resource, mca_standard_resources + i);
403
404 mca_do_proc_init();
405
406 return 0;
407
408 out_unlock_nomem:
409 spin_unlock_irq(&mca_lock);
410 out_nomem:
411 printk(KERN_EMERG "Failed memory allocation in MCA setup!\n");
412 return -ENOMEM;
413}
414
415subsys_initcall(mca_init);
416
417/*--------------------------------------------------------------------*/
418
419static __kprobes void
420mca_handle_nmi_device(struct mca_device *mca_dev, int check_flag)
421{
422 int slot = mca_dev->slot;
423
424 if (slot == MCA_INTEGSCSI) {
425 printk(KERN_CRIT "NMI: caused by MCA integrated SCSI adapter (%s)\n",
426 mca_dev->name);
427 } else if (slot == MCA_INTEGVIDEO) {
428 printk(KERN_CRIT "NMI: caused by MCA integrated video adapter (%s)\n",
429 mca_dev->name);
430 } else if (slot == MCA_MOTHERBOARD) {
431 printk(KERN_CRIT "NMI: caused by motherboard (%s)\n",
432 mca_dev->name);
433 }
434
435 /* More info available in POS 6 and 7? */
436
437 if (check_flag) {
438 unsigned char pos6, pos7;
439
440 pos6 = mca_device_read_pos(mca_dev, 6);
441 pos7 = mca_device_read_pos(mca_dev, 7);
442
443 printk(KERN_CRIT "NMI: POS 6 = 0x%x, POS 7 = 0x%x\n", pos6, pos7);
444 }
445
446} /* mca_handle_nmi_slot */
447
448/*--------------------------------------------------------------------*/
449
450static int __kprobes mca_handle_nmi_callback(struct device *dev, void *data)
451{
452 struct mca_device *mca_dev = to_mca_device(dev);
453 unsigned char pos5;
454
455 pos5 = mca_device_read_pos(mca_dev, 5);
456
457 if (!(pos5 & 0x80)) {
458 /*
459 * Bit 7 of POS 5 is reset when this adapter has a hardware
460 * error. Bit 7 it reset if there's error information
461 * available in POS 6 and 7.
462 */
463 mca_handle_nmi_device(mca_dev, !(pos5 & 0x40));
464 return 1;
465 }
466 return 0;
467}
468
469void __kprobes mca_handle_nmi(void)
470{
471 /*
472 * First try - scan the various adapters and see if a specific
473 * adapter was responsible for the error.
474 */
475 bus_for_each_dev(&mca_bus_type, NULL, NULL, mca_handle_nmi_callback);
476}
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c
index ca470e4c92dc..b02d4dd6b8a3 100644
--- a/arch/x86/kernel/mpparse.c
+++ b/arch/x86/kernel/mpparse.c
@@ -97,7 +97,7 @@ static void __init MP_bus_info(struct mpc_bus *m)
97 97
98 set_bit(m->busid, mp_bus_not_pci); 98 set_bit(m->busid, mp_bus_not_pci);
99 if (strncmp(str, BUSTYPE_ISA, sizeof(BUSTYPE_ISA) - 1) == 0) { 99 if (strncmp(str, BUSTYPE_ISA, sizeof(BUSTYPE_ISA) - 1) == 0) {
100#if defined(CONFIG_EISA) || defined(CONFIG_MCA) 100#ifdef CONFIG_EISA
101 mp_bus_id_to_type[m->busid] = MP_BUS_ISA; 101 mp_bus_id_to_type[m->busid] = MP_BUS_ISA;
102#endif 102#endif
103 } else if (strncmp(str, BUSTYPE_PCI, sizeof(BUSTYPE_PCI) - 1) == 0) { 103 } else if (strncmp(str, BUSTYPE_PCI, sizeof(BUSTYPE_PCI) - 1) == 0) {
@@ -105,12 +105,10 @@ static void __init MP_bus_info(struct mpc_bus *m)
105 x86_init.mpparse.mpc_oem_pci_bus(m); 105 x86_init.mpparse.mpc_oem_pci_bus(m);
106 106
107 clear_bit(m->busid, mp_bus_not_pci); 107 clear_bit(m->busid, mp_bus_not_pci);
108#if defined(CONFIG_EISA) || defined(CONFIG_MCA) 108#ifdef CONFIG_EISA
109 mp_bus_id_to_type[m->busid] = MP_BUS_PCI; 109 mp_bus_id_to_type[m->busid] = MP_BUS_PCI;
110 } else if (strncmp(str, BUSTYPE_EISA, sizeof(BUSTYPE_EISA) - 1) == 0) { 110 } else if (strncmp(str, BUSTYPE_EISA, sizeof(BUSTYPE_EISA) - 1) == 0) {
111 mp_bus_id_to_type[m->busid] = MP_BUS_EISA; 111 mp_bus_id_to_type[m->busid] = MP_BUS_EISA;
112 } else if (strncmp(str, BUSTYPE_MCA, sizeof(BUSTYPE_MCA) - 1) == 0) {
113 mp_bus_id_to_type[m->busid] = MP_BUS_MCA;
114#endif 112#endif
115 } else 113 } else
116 printk(KERN_WARNING "Unknown bustype %s - ignoring\n", str); 114 printk(KERN_WARNING "Unknown bustype %s - ignoring\n", str);
@@ -368,9 +366,6 @@ static void __init construct_ioapic_table(int mpc_default_type)
368 case 3: 366 case 3:
369 memcpy(bus.bustype, "EISA ", 6); 367 memcpy(bus.bustype, "EISA ", 6);
370 break; 368 break;
371 case 4:
372 case 7:
373 memcpy(bus.bustype, "MCA ", 6);
374 } 369 }
375 MP_bus_info(&bus); 370 MP_bus_info(&bus);
376 if (mpc_default_type > 4) { 371 if (mpc_default_type > 4) {
@@ -623,7 +618,7 @@ void __init default_find_smp_config(void)
623 return; 618 return;
624 /* 619 /*
625 * If it is an SMP machine we should know now, unless the 620 * If it is an SMP machine we should know now, unless the
626 * configuration is in an EISA/MCA bus machine with an 621 * configuration is in an EISA bus machine with an
627 * extended bios data area. 622 * extended bios data area.
628 * 623 *
629 * there is a real-mode segmented pointer pointing to the 624 * there is a real-mode segmented pointer pointing to the
diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c
index bffdfd48c1f2..90875279ef3d 100644
--- a/arch/x86/kernel/nmi.c
+++ b/arch/x86/kernel/nmi.c
@@ -19,8 +19,6 @@
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/export.h> 20#include <linux/export.h>
21 21
22#include <linux/mca.h>
23
24#if defined(CONFIG_EDAC) 22#if defined(CONFIG_EDAC)
25#include <linux/edac.h> 23#include <linux/edac.h>
26#endif 24#endif
@@ -247,16 +245,6 @@ unknown_nmi_error(unsigned char reason, struct pt_regs *regs)
247 245
248 __this_cpu_add(nmi_stats.unknown, 1); 246 __this_cpu_add(nmi_stats.unknown, 1);
249 247
250#ifdef CONFIG_MCA
251 /*
252 * Might actually be able to figure out what the guilty party
253 * is:
254 */
255 if (MCA_bus) {
256 mca_handle_nmi();
257 return;
258 }
259#endif
260 pr_emerg("Uhhuh. NMI received for unknown reason %02x on CPU %d.\n", 248 pr_emerg("Uhhuh. NMI received for unknown reason %02x on CPU %d.\n",
261 reason, smp_processor_id()); 249 reason, smp_processor_id());
262 250
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 9b4204e06665..366c688d619e 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -34,7 +34,6 @@
34#include <linux/memblock.h> 34#include <linux/memblock.h>
35#include <linux/seq_file.h> 35#include <linux/seq_file.h>
36#include <linux/console.h> 36#include <linux/console.h>
37#include <linux/mca.h>
38#include <linux/root_dev.h> 37#include <linux/root_dev.h>
39#include <linux/highmem.h> 38#include <linux/highmem.h>
40#include <linux/module.h> 39#include <linux/module.h>
@@ -179,12 +178,6 @@ struct cpuinfo_x86 new_cpu_data __cpuinitdata = {0, 0, 0, 0, -1, 1, 0, 0, -1};
179/* common cpu data for all cpus */ 178/* common cpu data for all cpus */
180struct cpuinfo_x86 boot_cpu_data __read_mostly = {0, 0, 0, 0, -1, 1, 0, 0, -1}; 179struct cpuinfo_x86 boot_cpu_data __read_mostly = {0, 0, 0, 0, -1, 1, 0, 0, -1};
181EXPORT_SYMBOL(boot_cpu_data); 180EXPORT_SYMBOL(boot_cpu_data);
182static void set_mca_bus(int x)
183{
184#ifdef CONFIG_MCA
185 MCA_bus = x;
186#endif
187}
188 181
189unsigned int def_to_bigsmp; 182unsigned int def_to_bigsmp;
190 183
@@ -716,7 +709,6 @@ void __init setup_arch(char **cmdline_p)
716 apm_info.bios = boot_params.apm_bios_info; 709 apm_info.bios = boot_params.apm_bios_info;
717 ist_info = boot_params.ist_info; 710 ist_info = boot_params.ist_info;
718 if (boot_params.sys_desc_table.length != 0) { 711 if (boot_params.sys_desc_table.length != 0) {
719 set_mca_bus(boot_params.sys_desc_table.table[3] & 0x2);
720 machine_id = boot_params.sys_desc_table.table[0]; 712 machine_id = boot_params.sys_desc_table.table[0];
721 machine_submodel_id = boot_params.sys_desc_table.table[1]; 713 machine_submodel_id = boot_params.sys_desc_table.table[1];
722 BIOS_revision = boot_params.sys_desc_table.table[2]; 714 BIOS_revision = boot_params.sys_desc_table.table[2];
diff --git a/arch/x86/kernel/time.c b/arch/x86/kernel/time.c
index c6eba2b42673..24d3c91e9812 100644
--- a/arch/x86/kernel/time.c
+++ b/arch/x86/kernel/time.c
@@ -14,7 +14,6 @@
14#include <linux/i8253.h> 14#include <linux/i8253.h>
15#include <linux/time.h> 15#include <linux/time.h>
16#include <linux/export.h> 16#include <linux/export.h>
17#include <linux/mca.h>
18 17
19#include <asm/vsyscall.h> 18#include <asm/vsyscall.h>
20#include <asm/x86_init.h> 19#include <asm/x86_init.h>
@@ -58,11 +57,6 @@ EXPORT_SYMBOL(profile_pc);
58static irqreturn_t timer_interrupt(int irq, void *dev_id) 57static irqreturn_t timer_interrupt(int irq, void *dev_id)
59{ 58{
60 global_clock_event->event_handler(global_clock_event); 59 global_clock_event->event_handler(global_clock_event);
61
62 /* MCA bus quirk: Acknowledge irq0 by setting bit 7 in port 0x61 */
63 if (MCA_bus)
64 outb_p(inb_p(0x61)| 0x80, 0x61);
65
66 return IRQ_HANDLED; 60 return IRQ_HANDLED;
67} 61}
68 62
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 92d5756d85fc..ff08457a025d 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -37,10 +37,6 @@
37#include <linux/eisa.h> 37#include <linux/eisa.h>
38#endif 38#endif
39 39
40#ifdef CONFIG_MCA
41#include <linux/mca.h>
42#endif
43
44#if defined(CONFIG_EDAC) 40#if defined(CONFIG_EDAC)
45#include <linux/edac.h> 41#include <linux/edac.h>
46#endif 42#endif
diff --git a/drivers/Makefile b/drivers/Makefile
index 35d5181c8ef2..0ee98d50f975 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -92,7 +92,6 @@ obj-$(CONFIG_BT) += bluetooth/
92obj-$(CONFIG_ACCESSIBILITY) += accessibility/ 92obj-$(CONFIG_ACCESSIBILITY) += accessibility/
93obj-$(CONFIG_ISDN) += isdn/ 93obj-$(CONFIG_ISDN) += isdn/
94obj-$(CONFIG_EDAC) += edac/ 94obj-$(CONFIG_EDAC) += edac/
95obj-$(CONFIG_MCA) += mca/
96obj-$(CONFIG_EISA) += eisa/ 95obj-$(CONFIG_EISA) += eisa/
97obj-y += lguest/ 96obj-y += lguest/
98obj-$(CONFIG_CPU_FREQ) += cpufreq/ 97obj-$(CONFIG_CPU_FREQ) += cpufreq/
diff --git a/drivers/mca/Kconfig b/drivers/mca/Kconfig
deleted file mode 100644
index a7a0220ab4bd..000000000000
--- a/drivers/mca/Kconfig
+++ /dev/null
@@ -1,14 +0,0 @@
1config MCA_LEGACY
2 bool "Legacy MCA API Support"
3 depends on MCA
4 help
5 This compiles in support for the old slot based MCA API. If you
6 have an unconverted MCA driver, you will need to say Y here. It
7 is safe to say Y anyway.
8
9config MCA_PROC_FS
10 bool "Support for the mca entry in /proc"
11 depends on MCA_LEGACY && PROC_FS
12 help
13 If you want the old style /proc/mca directory in addition to the
14 new style sysfs say Y here.
diff --git a/drivers/mca/Makefile b/drivers/mca/Makefile
deleted file mode 100644
index 0794b122520e..000000000000
--- a/drivers/mca/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
1# Makefile for the Linux MCA bus support
2
3obj-y := mca-bus.o mca-device.o mca-driver.o
4
5obj-$(CONFIG_MCA_PROC_FS) += mca-proc.o
6obj-$(CONFIG_MCA_LEGACY) += mca-legacy.o
7
diff --git a/drivers/mca/mca-bus.c b/drivers/mca/mca-bus.c
deleted file mode 100644
index ada5ebbaa255..000000000000
--- a/drivers/mca/mca-bus.c
+++ /dev/null
@@ -1,169 +0,0 @@
1/* -*- mode: c; c-basic-offset: 8 -*- */
2
3/*
4 * MCA bus support functions for sysfs.
5 *
6 * (C) 2002 James Bottomley <James.Bottomley@HansenPartnership.com>
7 *
8**-----------------------------------------------------------------------------
9**
10** This program is free software; you can redistribute it and/or modify
11** it under the terms of the GNU General Public License as published by
12** the Free Software Foundation; either version 2 of the License, or
13** (at your option) any later version.
14**
15** This program is distributed in the hope that it will be useful,
16** but WITHOUT ANY WARRANTY; without even the implied warranty of
17** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18** GNU General Public License for more details.
19**
20** You should have received a copy of the GNU General Public License
21** along with this program; if not, write to the Free Software
22** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23**
24**-----------------------------------------------------------------------------
25 */
26
27#include <linux/kernel.h>
28#include <linux/device.h>
29#include <linux/mca.h>
30#include <linux/module.h>
31#include <linux/init.h>
32#include <linux/slab.h>
33
34/* Very few machines have more than one MCA bus. However, there are
35 * those that do (Voyager 35xx/5xxx), so we do it this way for future
36 * expansion. None that I know have more than 2 */
37static struct mca_bus *mca_root_busses[MAX_MCA_BUSSES];
38
39#define MCA_DEVINFO(i,s) { .pos = i, .name = s }
40
41struct mca_device_info {
42 short pos_id; /* the 2 byte pos id for this card */
43 char name[50];
44};
45
46static int mca_bus_match (struct device *dev, struct device_driver *drv)
47{
48 struct mca_device *mca_dev = to_mca_device (dev);
49 struct mca_driver *mca_drv = to_mca_driver (drv);
50 const unsigned short *mca_ids = mca_drv->id_table;
51 int i = 0;
52
53 if (mca_ids) {
54 for(i = 0; mca_ids[i]; i++) {
55 if (mca_ids[i] == mca_dev->pos_id) {
56 mca_dev->index = i;
57 return 1;
58 }
59 }
60 }
61 /* If the integrated id is present, treat it as though it were an
62 * additional id in the id_table (it can't be because by definition,
63 * integrated id's overflow a short */
64 if (mca_drv->integrated_id && mca_dev->pos_id ==
65 mca_drv->integrated_id) {
66 mca_dev->index = i;
67 return 1;
68 }
69 return 0;
70}
71
72struct bus_type mca_bus_type = {
73 .name = "MCA",
74 .match = mca_bus_match,
75};
76EXPORT_SYMBOL (mca_bus_type);
77
78static ssize_t mca_show_pos_id(struct device *dev, struct device_attribute *attr, char *buf)
79{
80 /* four digits, \n and trailing \0 */
81 struct mca_device *mca_dev = to_mca_device(dev);
82 int len;
83
84 if(mca_dev->pos_id < MCA_DUMMY_POS_START)
85 len = sprintf(buf, "%04x\n", mca_dev->pos_id);
86 else
87 len = sprintf(buf, "none\n");
88 return len;
89}
90static ssize_t mca_show_pos(struct device *dev, struct device_attribute *attr, char *buf)
91{
92 /* enough for 8 two byte hex chars plus space and new line */
93 int j, len=0;
94 struct mca_device *mca_dev = to_mca_device(dev);
95
96 for(j=0; j<8; j++)
97 len += sprintf(buf+len, "%02x ", mca_dev->pos[j]);
98 /* change last trailing space to new line */
99 buf[len-1] = '\n';
100 return len;
101}
102
103static DEVICE_ATTR(id, S_IRUGO, mca_show_pos_id, NULL);
104static DEVICE_ATTR(pos, S_IRUGO, mca_show_pos, NULL);
105
106int __init mca_register_device(int bus, struct mca_device *mca_dev)
107{
108 struct mca_bus *mca_bus = mca_root_busses[bus];
109 int rc;
110
111 mca_dev->dev.parent = &mca_bus->dev;
112 mca_dev->dev.bus = &mca_bus_type;
113 dev_set_name(&mca_dev->dev, "%02d:%02X", bus, mca_dev->slot);
114 mca_dev->dma_mask = mca_bus->default_dma_mask;
115 mca_dev->dev.dma_mask = &mca_dev->dma_mask;
116 mca_dev->dev.coherent_dma_mask = mca_dev->dma_mask;
117
118 rc = device_register(&mca_dev->dev);
119 if (rc)
120 goto err_out;
121
122 rc = device_create_file(&mca_dev->dev, &dev_attr_id);
123 if (rc) goto err_out_devreg;
124 rc = device_create_file(&mca_dev->dev, &dev_attr_pos);
125 if (rc) goto err_out_id;
126
127 return 1;
128
129err_out_id:
130 device_remove_file(&mca_dev->dev, &dev_attr_id);
131err_out_devreg:
132 device_unregister(&mca_dev->dev);
133err_out:
134 return 0;
135}
136
137/* */
138struct mca_bus * __devinit mca_attach_bus(int bus)
139{
140 struct mca_bus *mca_bus;
141
142 if (unlikely(mca_root_busses[bus] != NULL)) {
143 /* This should never happen, but just in case */
144 printk(KERN_EMERG "MCA tried to add already existing bus %d\n",
145 bus);
146 dump_stack();
147 return NULL;
148 }
149
150 mca_bus = kzalloc(sizeof(struct mca_bus), GFP_KERNEL);
151 if (!mca_bus)
152 return NULL;
153
154 dev_set_name(&mca_bus->dev, "mca%d", bus);
155 sprintf(mca_bus->name,"Host %s MCA Bridge", bus ? "Secondary" : "Primary");
156 if (device_register(&mca_bus->dev)) {
157 kfree(mca_bus);
158 return NULL;
159 }
160
161 mca_root_busses[bus] = mca_bus;
162
163 return mca_bus;
164}
165
166int __init mca_system_init (void)
167{
168 return bus_register(&mca_bus_type);
169}
diff --git a/drivers/mca/mca-device.c b/drivers/mca/mca-device.c
deleted file mode 100644
index e7adf89fae41..000000000000
--- a/drivers/mca/mca-device.c
+++ /dev/null
@@ -1,218 +0,0 @@
1/* -*- mode: c; c-basic-offset: 8 -*- */
2
3/*
4 * MCA device support functions
5 *
6 * These functions support the ongoing device access API.
7 *
8 * (C) 2002 James Bottomley <James.Bottomley@HansenPartnership.com>
9 *
10**-----------------------------------------------------------------------------
11**
12** This program is free software; you can redistribute it and/or modify
13** it under the terms of the GNU General Public License as published by
14** the Free Software Foundation; either version 2 of the License, or
15** (at your option) any later version.
16**
17** This program is distributed in the hope that it will be useful,
18** but WITHOUT ANY WARRANTY; without even the implied warranty of
19** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20** GNU General Public License for more details.
21**
22** You should have received a copy of the GNU General Public License
23** along with this program; if not, write to the Free Software
24** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25**
26**-----------------------------------------------------------------------------
27 */
28
29#include <linux/module.h>
30#include <linux/device.h>
31#include <linux/mca.h>
32#include <linux/string.h>
33
34/**
35 * mca_device_read_stored_pos - read POS register from stored data
36 * @mca_dev: device to read from
37 * @reg: register to read from
38 *
39 * Fetch a POS value that was stored at boot time by the kernel
40 * when it scanned the MCA space. The register value is returned.
41 * Missing or invalid registers report 0.
42 */
43unsigned char mca_device_read_stored_pos(struct mca_device *mca_dev, int reg)
44{
45 if(reg < 0 || reg >= 8)
46 return 0;
47
48 return mca_dev->pos[reg];
49}
50EXPORT_SYMBOL(mca_device_read_stored_pos);
51
52/**
53 * mca_device_read_pos - read POS register from card
54 * @mca_dev: device to read from
55 * @reg: register to read from
56 *
57 * Fetch a POS value directly from the hardware to obtain the
58 * current value. This is much slower than
59 * mca_device_read_stored_pos and may not be invoked from
60 * interrupt context. It handles the deep magic required for
61 * onboard devices transparently.
62 */
63unsigned char mca_device_read_pos(struct mca_device *mca_dev, int reg)
64{
65 struct mca_bus *mca_bus = to_mca_bus(mca_dev->dev.parent);
66
67 return mca_bus->f.mca_read_pos(mca_dev, reg);
68
69 return mca_dev->pos[reg];
70}
71EXPORT_SYMBOL(mca_device_read_pos);
72
73
74/**
75 * mca_device_write_pos - read POS register from card
76 * @mca_dev: device to write pos register to
77 * @reg: register to write to
78 * @byte: byte to write to the POS registers
79 *
80 * Store a POS value directly to the hardware. You should not
81 * normally need to use this function and should have a very good
82 * knowledge of MCA bus before you do so. Doing this wrongly can
83 * damage the hardware.
84 *
85 * This function may not be used from interrupt context.
86 *
87 */
88void mca_device_write_pos(struct mca_device *mca_dev, int reg,
89 unsigned char byte)
90{
91 struct mca_bus *mca_bus = to_mca_bus(mca_dev->dev.parent);
92
93 mca_bus->f.mca_write_pos(mca_dev, reg, byte);
94}
95EXPORT_SYMBOL(mca_device_write_pos);
96
97/**
98 * mca_device_transform_irq - transform the ADF obtained IRQ
99 * @mca_device: device whose irq needs transforming
100 * @irq: input irq from ADF
101 *
102 * MCA Adapter Definition Files (ADF) contain irq, ioport, memory
103 * etc. definitions. In systems with more than one bus, these need
104 * to be transformed through bus mapping functions to get the real
105 * system global quantities.
106 *
107 * This function transforms the interrupt number and returns the
108 * transformed system global interrupt
109 */
110int mca_device_transform_irq(struct mca_device *mca_dev, int irq)
111{
112 struct mca_bus *mca_bus = to_mca_bus(mca_dev->dev.parent);
113
114 return mca_bus->f.mca_transform_irq(mca_dev, irq);
115}
116EXPORT_SYMBOL(mca_device_transform_irq);
117
118/**
119 * mca_device_transform_ioport - transform the ADF obtained I/O port
120 * @mca_device: device whose port needs transforming
121 * @ioport: input I/O port from ADF
122 *
123 * MCA Adapter Definition Files (ADF) contain irq, ioport, memory
124 * etc. definitions. In systems with more than one bus, these need
125 * to be transformed through bus mapping functions to get the real
126 * system global quantities.
127 *
128 * This function transforms the I/O port number and returns the
129 * transformed system global port number.
130 *
131 * This transformation can be assumed to be linear for port ranges.
132 */
133int mca_device_transform_ioport(struct mca_device *mca_dev, int port)
134{
135 struct mca_bus *mca_bus = to_mca_bus(mca_dev->dev.parent);
136
137 return mca_bus->f.mca_transform_ioport(mca_dev, port);
138}
139EXPORT_SYMBOL(mca_device_transform_ioport);
140
141/**
142 * mca_device_transform_memory - transform the ADF obtained memory
143 * @mca_device: device whose memory region needs transforming
144 * @mem: memory region start from ADF
145 *
146 * MCA Adapter Definition Files (ADF) contain irq, ioport, memory
147 * etc. definitions. In systems with more than one bus, these need
148 * to be transformed through bus mapping functions to get the real
149 * system global quantities.
150 *
151 * This function transforms the memory region start and returns the
152 * transformed system global memory region (physical).
153 *
154 * This transformation can be assumed to be linear for region ranges.
155 */
156void *mca_device_transform_memory(struct mca_device *mca_dev, void *mem)
157{
158 struct mca_bus *mca_bus = to_mca_bus(mca_dev->dev.parent);
159
160 return mca_bus->f.mca_transform_memory(mca_dev, mem);
161}
162EXPORT_SYMBOL(mca_device_transform_memory);
163
164
165/**
166 * mca_device_claimed - check if claimed by driver
167 * @mca_dev: device to check
168 *
169 * Returns 1 if the slot has been claimed by a driver
170 */
171
172int mca_device_claimed(struct mca_device *mca_dev)
173{
174 return mca_dev->driver_loaded;
175}
176EXPORT_SYMBOL(mca_device_claimed);
177
178/**
179 * mca_device_set_claim - set the claim value of the driver
180 * @mca_dev: device to set value for
181 * @val: claim value to set (1 claimed, 0 unclaimed)
182 */
183void mca_device_set_claim(struct mca_device *mca_dev, int val)
184{
185 mca_dev->driver_loaded = val;
186}
187EXPORT_SYMBOL(mca_device_set_claim);
188
189/**
190 * mca_device_status - get the status of the device
191 * @mca_device: device to get
192 *
193 * returns an enumeration of the device status:
194 *
195 * MCA_ADAPTER_NORMAL adapter is OK.
196 * MCA_ADAPTER_NONE no adapter at device (should never happen).
197 * MCA_ADAPTER_DISABLED adapter is disabled.
198 * MCA_ADAPTER_ERROR adapter cannot be initialised.
199 */
200enum MCA_AdapterStatus mca_device_status(struct mca_device *mca_dev)
201{
202 return mca_dev->status;
203}
204EXPORT_SYMBOL(mca_device_status);
205
206/**
207 * mca_device_set_name - set the name of the device
208 * @mca_device: device to set the name of
209 * @name: name to set
210 */
211void mca_device_set_name(struct mca_device *mca_dev, const char *name)
212{
213 if(!mca_dev)
214 return;
215
216 strlcpy(mca_dev->name, name, sizeof(mca_dev->name));
217}
218EXPORT_SYMBOL(mca_device_set_name);
diff --git a/drivers/mca/mca-driver.c b/drivers/mca/mca-driver.c
deleted file mode 100644
index 32cd39bcc715..000000000000
--- a/drivers/mca/mca-driver.c
+++ /dev/null
@@ -1,63 +0,0 @@
1/* -*- mode: c; c-basic-offset: 8 -*- */
2
3/*
4 * MCA driver support functions for sysfs.
5 *
6 * (C) 2002 James Bottomley <James.Bottomley@HansenPartnership.com>
7 *
8**-----------------------------------------------------------------------------
9**
10** This program is free software; you can redistribute it and/or modify
11** it under the terms of the GNU General Public License as published by
12** the Free Software Foundation; either version 2 of the License, or
13** (at your option) any later version.
14**
15** This program is distributed in the hope that it will be useful,
16** but WITHOUT ANY WARRANTY; without even the implied warranty of
17** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18** GNU General Public License for more details.
19**
20** You should have received a copy of the GNU General Public License
21** along with this program; if not, write to the Free Software
22** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23**
24**-----------------------------------------------------------------------------
25 */
26
27#include <linux/device.h>
28#include <linux/mca.h>
29#include <linux/module.h>
30
31int mca_register_driver(struct mca_driver *mca_drv)
32{
33 int r;
34
35 if (MCA_bus) {
36 mca_drv->driver.bus = &mca_bus_type;
37 if ((r = driver_register(&mca_drv->driver)) < 0)
38 return r;
39 mca_drv->integrated_id = 0;
40 }
41
42 return 0;
43}
44EXPORT_SYMBOL(mca_register_driver);
45
46int mca_register_driver_integrated(struct mca_driver *mca_driver,
47 int integrated_id)
48{
49 int r = mca_register_driver(mca_driver);
50
51 if (!r)
52 mca_driver->integrated_id = integrated_id;
53
54 return r;
55}
56EXPORT_SYMBOL(mca_register_driver_integrated);
57
58void mca_unregister_driver(struct mca_driver *mca_drv)
59{
60 if (MCA_bus)
61 driver_unregister(&mca_drv->driver);
62}
63EXPORT_SYMBOL(mca_unregister_driver);
diff --git a/drivers/mca/mca-legacy.c b/drivers/mca/mca-legacy.c
deleted file mode 100644
index 494f0c2001f5..000000000000
--- a/drivers/mca/mca-legacy.c
+++ /dev/null
@@ -1,329 +0,0 @@
1/* -*- mode: c; c-basic-offset: 8 -*- */
2
3/*
4 * MCA bus support functions for legacy (2.4) API.
5 *
6 * Legacy API means the API that operates in terms of MCA slot number
7 *
8 * (C) 2002 James Bottomley <James.Bottomley@HansenPartnership.com>
9 *
10**-----------------------------------------------------------------------------
11**
12** This program is free software; you can redistribute it and/or modify
13** it under the terms of the GNU General Public License as published by
14** the Free Software Foundation; either version 2 of the License, or
15** (at your option) any later version.
16**
17** This program is distributed in the hope that it will be useful,
18** but WITHOUT ANY WARRANTY; without even the implied warranty of
19** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20** GNU General Public License for more details.
21**
22** You should have received a copy of the GNU General Public License
23** along with this program; if not, write to the Free Software
24** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25**
26**-----------------------------------------------------------------------------
27 */
28
29#include <linux/module.h>
30#include <linux/device.h>
31#include <linux/mca-legacy.h>
32#include <asm/io.h>
33
34/* NOTE: This structure is stack allocated */
35struct mca_find_adapter_info {
36 int id;
37 int slot;
38 struct mca_device *mca_dev;
39};
40
41/* The purpose of this iterator is to loop over all the devices and
42 * find the one with the smallest slot number that's just greater than
43 * or equal to the required slot with a matching id */
44static int mca_find_adapter_callback(struct device *dev, void *data)
45{
46 struct mca_find_adapter_info *info = data;
47 struct mca_device *mca_dev = to_mca_device(dev);
48
49 if(mca_dev->pos_id != info->id)
50 return 0;
51
52 if(mca_dev->slot < info->slot)
53 return 0;
54
55 if(!info->mca_dev || info->mca_dev->slot >= mca_dev->slot)
56 info->mca_dev = mca_dev;
57
58 return 0;
59}
60
61/**
62 * mca_find_adapter - scan for adapters
63 * @id: MCA identification to search for
64 * @start: starting slot
65 *
66 * Search the MCA configuration for adapters matching the 16bit
67 * ID given. The first time it should be called with start as zero
68 * and then further calls made passing the return value of the
69 * previous call until %MCA_NOTFOUND is returned.
70 *
71 * Disabled adapters are not reported.
72 */
73
74int mca_find_adapter(int id, int start)
75{
76 struct mca_find_adapter_info info;
77
78 if(id == 0xffff)
79 return MCA_NOTFOUND;
80
81 info.slot = start;
82 info.id = id;
83 info.mca_dev = NULL;
84
85 for(;;) {
86 bus_for_each_dev(&mca_bus_type, NULL, &info, mca_find_adapter_callback);
87
88 if(info.mca_dev == NULL)
89 return MCA_NOTFOUND;
90
91 if(info.mca_dev->status != MCA_ADAPTER_DISABLED)
92 break;
93
94 /* OK, found adapter but it was disabled. Go around
95 * again, excluding the slot we just found */
96
97 info.slot = info.mca_dev->slot + 1;
98 info.mca_dev = NULL;
99 }
100
101 return info.mca_dev->slot;
102}
103EXPORT_SYMBOL(mca_find_adapter);
104
105/*--------------------------------------------------------------------*/
106
107/**
108 * mca_find_unused_adapter - scan for unused adapters
109 * @id: MCA identification to search for
110 * @start: starting slot
111 *
112 * Search the MCA configuration for adapters matching the 16bit
113 * ID given. The first time it should be called with start as zero
114 * and then further calls made passing the return value of the
115 * previous call until %MCA_NOTFOUND is returned.
116 *
117 * Adapters that have been claimed by drivers and those that
118 * are disabled are not reported. This function thus allows a driver
119 * to scan for further cards when some may already be driven.
120 */
121
122int mca_find_unused_adapter(int id, int start)
123{
124 struct mca_find_adapter_info info = { 0 };
125
126 if (!MCA_bus || id == 0xffff)
127 return MCA_NOTFOUND;
128
129 info.slot = start;
130 info.id = id;
131 info.mca_dev = NULL;
132
133 for(;;) {
134 bus_for_each_dev(&mca_bus_type, NULL, &info, mca_find_adapter_callback);
135
136 if(info.mca_dev == NULL)
137 return MCA_NOTFOUND;
138
139 if(info.mca_dev->status != MCA_ADAPTER_DISABLED
140 && !info.mca_dev->driver_loaded)
141 break;
142
143 /* OK, found adapter but it was disabled or already in
144 * use. Go around again, excluding the slot we just
145 * found */
146
147 info.slot = info.mca_dev->slot + 1;
148 info.mca_dev = NULL;
149 }
150
151 return info.mca_dev->slot;
152}
153EXPORT_SYMBOL(mca_find_unused_adapter);
154
155/* NOTE: stack allocated structure */
156struct mca_find_device_by_slot_info {
157 int slot;
158 struct mca_device *mca_dev;
159};
160
161static int mca_find_device_by_slot_callback(struct device *dev, void *data)
162{
163 struct mca_find_device_by_slot_info *info = data;
164 struct mca_device *mca_dev = to_mca_device(dev);
165
166 if(mca_dev->slot == info->slot)
167 info->mca_dev = mca_dev;
168
169 return 0;
170}
171
172struct mca_device *mca_find_device_by_slot(int slot)
173{
174 struct mca_find_device_by_slot_info info;
175
176 info.slot = slot;
177 info.mca_dev = NULL;
178
179 bus_for_each_dev(&mca_bus_type, NULL, &info, mca_find_device_by_slot_callback);
180
181 return info.mca_dev;
182}
183
184/**
185 * mca_read_stored_pos - read POS register from boot data
186 * @slot: slot number to read from
187 * @reg: register to read from
188 *
189 * Fetch a POS value that was stored at boot time by the kernel
190 * when it scanned the MCA space. The register value is returned.
191 * Missing or invalid registers report 0.
192 */
193unsigned char mca_read_stored_pos(int slot, int reg)
194{
195 struct mca_device *mca_dev = mca_find_device_by_slot(slot);
196
197 if(!mca_dev)
198 return 0;
199
200 return mca_device_read_stored_pos(mca_dev, reg);
201}
202EXPORT_SYMBOL(mca_read_stored_pos);
203
204
205/**
206 * mca_read_pos - read POS register from card
207 * @slot: slot number to read from
208 * @reg: register to read from
209 *
210 * Fetch a POS value directly from the hardware to obtain the
211 * current value. This is much slower than mca_read_stored_pos and
212 * may not be invoked from interrupt context. It handles the
213 * deep magic required for onboard devices transparently.
214 */
215
216unsigned char mca_read_pos(int slot, int reg)
217{
218 struct mca_device *mca_dev = mca_find_device_by_slot(slot);
219
220 if(!mca_dev)
221 return 0;
222
223 return mca_device_read_pos(mca_dev, reg);
224}
225EXPORT_SYMBOL(mca_read_pos);
226
227
228/**
229 * mca_write_pos - read POS register from card
230 * @slot: slot number to read from
231 * @reg: register to read from
232 * @byte: byte to write to the POS registers
233 *
234 * Store a POS value directly from the hardware. You should not
235 * normally need to use this function and should have a very good
236 * knowledge of MCA bus before you do so. Doing this wrongly can
237 * damage the hardware.
238 *
239 * This function may not be used from interrupt context.
240 *
241 * Note that this a technically a Bad Thing, as IBM tech stuff says
242 * you should only set POS values through their utilities.
243 * However, some devices such as the 3c523 recommend that you write
244 * back some data to make sure the configuration is consistent.
245 * I'd say that IBM is right, but I like my drivers to work.
246 *
247 * This function can't do checks to see if multiple devices end up
248 * with the same resources, so you might see magic smoke if someone
249 * screws up.
250 */
251
252void mca_write_pos(int slot, int reg, unsigned char byte)
253{
254 struct mca_device *mca_dev = mca_find_device_by_slot(slot);
255
256 if(!mca_dev)
257 return;
258
259 mca_device_write_pos(mca_dev, reg, byte);
260}
261EXPORT_SYMBOL(mca_write_pos);
262
263/**
264 * mca_set_adapter_name - Set the description of the card
265 * @slot: slot to name
266 * @name: text string for the namen
267 *
268 * This function sets the name reported via /proc for this
269 * adapter slot. This is for user information only. Setting a
270 * name deletes any previous name.
271 */
272
273void mca_set_adapter_name(int slot, char* name)
274{
275 struct mca_device *mca_dev = mca_find_device_by_slot(slot);
276
277 if(!mca_dev)
278 return;
279
280 mca_device_set_name(mca_dev, name);
281}
282EXPORT_SYMBOL(mca_set_adapter_name);
283
284/**
285 * mca_mark_as_used - claim an MCA device
286 * @slot: slot to claim
287 * FIXME: should we make this threadsafe
288 *
289 * Claim an MCA slot for a device driver. If the
290 * slot is already taken the function returns 1,
291 * if it is not taken it is claimed and 0 is
292 * returned.
293 */
294
295int mca_mark_as_used(int slot)
296{
297 struct mca_device *mca_dev = mca_find_device_by_slot(slot);
298
299 if(!mca_dev)
300 /* FIXME: this is actually a severe error */
301 return 1;
302
303 if(mca_device_claimed(mca_dev))
304 return 1;
305
306 mca_device_set_claim(mca_dev, 1);
307
308 return 0;
309}
310EXPORT_SYMBOL(mca_mark_as_used);
311
312/**
313 * mca_mark_as_unused - release an MCA device
314 * @slot: slot to claim
315 *
316 * Release the slot for other drives to use.
317 */
318
319void mca_mark_as_unused(int slot)
320{
321 struct mca_device *mca_dev = mca_find_device_by_slot(slot);
322
323 if(!mca_dev)
324 return;
325
326 mca_device_set_claim(mca_dev, 0);
327}
328EXPORT_SYMBOL(mca_mark_as_unused);
329
diff --git a/drivers/mca/mca-proc.c b/drivers/mca/mca-proc.c
deleted file mode 100644
index 81ea0d377bf4..000000000000
--- a/drivers/mca/mca-proc.c
+++ /dev/null
@@ -1,249 +0,0 @@
1/* -*- mode: c; c-basic-offset: 8 -*- */
2
3/*
4 * MCA bus support functions for the proc fs.
5 *
6 * NOTE: this code *requires* the legacy MCA api.
7 *
8 * Legacy API means the API that operates in terms of MCA slot number
9 *
10 * (C) 2002 James Bottomley <James.Bottomley@HansenPartnership.com>
11 *
12**-----------------------------------------------------------------------------
13**
14** This program is free software; you can redistribute it and/or modify
15** it under the terms of the GNU General Public License as published by
16** the Free Software Foundation; either version 2 of the License, or
17** (at your option) any later version.
18**
19** This program is distributed in the hope that it will be useful,
20** but WITHOUT ANY WARRANTY; without even the implied warranty of
21** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22** GNU General Public License for more details.
23**
24** You should have received a copy of the GNU General Public License
25** along with this program; if not, write to the Free Software
26** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27**
28**-----------------------------------------------------------------------------
29 */
30#include <linux/module.h>
31#include <linux/init.h>
32#include <linux/proc_fs.h>
33#include <linux/mca.h>
34
35static int get_mca_info_helper(struct mca_device *mca_dev, char *page, int len)
36{
37 int j;
38
39 for(j=0; j<8; j++)
40 len += sprintf(page+len, "%02x ",
41 mca_dev ? mca_dev->pos[j] : 0xff);
42 len += sprintf(page+len, " %s\n", mca_dev ? mca_dev->name : "");
43 return len;
44}
45
46static int get_mca_info(char *page, char **start, off_t off,
47 int count, int *eof, void *data)
48{
49 int i, len = 0;
50
51 if(MCA_bus) {
52 struct mca_device *mca_dev;
53 /* Format POS registers of eight MCA slots */
54
55 for(i=0; i<MCA_MAX_SLOT_NR; i++) {
56 mca_dev = mca_find_device_by_slot(i);
57
58 len += sprintf(page+len, "Slot %d: ", i+1);
59 len = get_mca_info_helper(mca_dev, page, len);
60 }
61
62 /* Format POS registers of integrated video subsystem */
63
64 mca_dev = mca_find_device_by_slot(MCA_INTEGVIDEO);
65 len += sprintf(page+len, "Video : ");
66 len = get_mca_info_helper(mca_dev, page, len);
67
68 /* Format POS registers of integrated SCSI subsystem */
69
70 mca_dev = mca_find_device_by_slot(MCA_INTEGSCSI);
71 len += sprintf(page+len, "SCSI : ");
72 len = get_mca_info_helper(mca_dev, page, len);
73
74 /* Format POS registers of motherboard */
75
76 mca_dev = mca_find_device_by_slot(MCA_MOTHERBOARD);
77 len += sprintf(page+len, "Planar: ");
78 len = get_mca_info_helper(mca_dev, page, len);
79 } else {
80 /* Leave it empty if MCA not detected - this should *never*
81 * happen!
82 */
83 }
84
85 if (len <= off+count) *eof = 1;
86 *start = page + off;
87 len -= off;
88 if (len>count) len = count;
89 if (len<0) len = 0;
90 return len;
91}
92
93/*--------------------------------------------------------------------*/
94
95static int mca_default_procfn(char* buf, struct mca_device *mca_dev)
96{
97 int len = 0, i;
98 int slot = mca_dev->slot;
99
100 /* Print out the basic information */
101
102 if(slot < MCA_MAX_SLOT_NR) {
103 len += sprintf(buf+len, "Slot: %d\n", slot+1);
104 } else if(slot == MCA_INTEGSCSI) {
105 len += sprintf(buf+len, "Integrated SCSI Adapter\n");
106 } else if(slot == MCA_INTEGVIDEO) {
107 len += sprintf(buf+len, "Integrated Video Adapter\n");
108 } else if(slot == MCA_MOTHERBOARD) {
109 len += sprintf(buf+len, "Motherboard\n");
110 }
111 if (mca_dev->name[0]) {
112
113 /* Drivers might register a name without /proc handler... */
114
115 len += sprintf(buf+len, "Adapter Name: %s\n",
116 mca_dev->name);
117 } else {
118 len += sprintf(buf+len, "Adapter Name: Unknown\n");
119 }
120 len += sprintf(buf+len, "Id: %02x%02x\n",
121 mca_dev->pos[1], mca_dev->pos[0]);
122 len += sprintf(buf+len, "Enabled: %s\nPOS: ",
123 mca_device_status(mca_dev) == MCA_ADAPTER_NORMAL ?
124 "Yes" : "No");
125 for(i=0; i<8; i++) {
126 len += sprintf(buf+len, "%02x ", mca_dev->pos[i]);
127 }
128 len += sprintf(buf+len, "\nDriver Installed: %s",
129 mca_device_claimed(mca_dev) ? "Yes" : "No");
130 buf[len++] = '\n';
131 buf[len] = 0;
132
133 return len;
134} /* mca_default_procfn() */
135
136static int get_mca_machine_info(char* page, char **start, off_t off,
137 int count, int *eof, void *data)
138{
139 int len = 0;
140
141 len += sprintf(page+len, "Model Id: 0x%x\n", machine_id);
142 len += sprintf(page+len, "Submodel Id: 0x%x\n", machine_submodel_id);
143 len += sprintf(page+len, "BIOS Revision: 0x%x\n", BIOS_revision);
144
145 if (len <= off+count) *eof = 1;
146 *start = page + off;
147 len -= off;
148 if (len>count) len = count;
149 if (len<0) len = 0;
150 return len;
151}
152
153static int mca_read_proc(char *page, char **start, off_t off,
154 int count, int *eof, void *data)
155{
156 struct mca_device *mca_dev = (struct mca_device *)data;
157 int len = 0;
158
159 /* Get the standard info */
160
161 len = mca_default_procfn(page, mca_dev);
162
163 /* Do any device-specific processing, if there is any */
164
165 if(mca_dev->procfn) {
166 len += mca_dev->procfn(page+len, mca_dev->slot,
167 mca_dev->proc_dev);
168 }
169 if (len <= off+count) *eof = 1;
170 *start = page + off;
171 len -= off;
172 if (len>count) len = count;
173 if (len<0) len = 0;
174 return len;
175} /* mca_read_proc() */
176
177/*--------------------------------------------------------------------*/
178
179void __init mca_do_proc_init(void)
180{
181 int i;
182 struct proc_dir_entry *proc_mca;
183 struct proc_dir_entry* node = NULL;
184 struct mca_device *mca_dev;
185
186 proc_mca = proc_mkdir("mca", NULL);
187 create_proc_read_entry("pos",0,proc_mca,get_mca_info,NULL);
188 create_proc_read_entry("machine",0,proc_mca,get_mca_machine_info,NULL);
189
190 /* Initialize /proc/mca entries for existing adapters */
191
192 for(i = 0; i < MCA_NUMADAPTERS; i++) {
193 enum MCA_AdapterStatus status;
194 mca_dev = mca_find_device_by_slot(i);
195 if(!mca_dev)
196 continue;
197
198 mca_dev->procfn = NULL;
199
200 if(i < MCA_MAX_SLOT_NR) sprintf(mca_dev->procname,"slot%d", i+1);
201 else if(i == MCA_INTEGVIDEO) sprintf(mca_dev->procname,"video");
202 else if(i == MCA_INTEGSCSI) sprintf(mca_dev->procname,"scsi");
203 else if(i == MCA_MOTHERBOARD) sprintf(mca_dev->procname,"planar");
204
205 status = mca_device_status(mca_dev);
206 if (status != MCA_ADAPTER_NORMAL &&
207 status != MCA_ADAPTER_DISABLED)
208 continue;
209
210 node = create_proc_read_entry(mca_dev->procname, 0, proc_mca,
211 mca_read_proc, (void *)mca_dev);
212
213 if(node == NULL) {
214 printk("Failed to allocate memory for MCA proc-entries!");
215 return;
216 }
217 }
218
219} /* mca_do_proc_init() */
220
221/**
222 * mca_set_adapter_procfn - Set the /proc callback
223 * @slot: slot to configure
224 * @procfn: callback function to call for /proc
225 * @dev: device information passed to the callback
226 *
227 * This sets up an information callback for /proc/mca/slot?. The
228 * function is called with the buffer, slot, and device pointer (or
229 * some equally informative context information, or nothing, if you
230 * prefer), and is expected to put useful information into the
231 * buffer. The adapter name, ID, and POS registers get printed
232 * before this is called though, so don't do it again.
233 *
234 * This should be called with a %NULL @procfn when a module
235 * unregisters, thus preventing kernel crashes and other such
236 * nastiness.
237 */
238
239void mca_set_adapter_procfn(int slot, MCA_ProcFn procfn, void* proc_dev)
240{
241 struct mca_device *mca_dev = mca_find_device_by_slot(slot);
242
243 if(!mca_dev)
244 return;
245
246 mca_dev->procfn = procfn;
247 mca_dev->proc_dev = proc_dev;
248}
249EXPORT_SYMBOL(mca_set_adapter_procfn);
diff --git a/drivers/message/i2o/i2o_proc.c b/drivers/message/i2o/i2o_proc.c
index 6d115c7208ab..506c36f6e1db 100644
--- a/drivers/message/i2o/i2o_proc.c
+++ b/drivers/message/i2o/i2o_proc.c
@@ -283,7 +283,6 @@ static char *bus_strings[] = {
283 "Local Bus", 283 "Local Bus",
284 "ISA", 284 "ISA",
285 "EISA", 285 "EISA",
286 "MCA",
287 "PCI", 286 "PCI",
288 "PCMCIA", 287 "PCMCIA",
289 "NUBUS", 288 "NUBUS",
@@ -351,18 +350,6 @@ static int i2o_seq_show_hrt(struct seq_file *seq, void *v)
351 EisaSlotNumber); 350 EisaSlotNumber);
352 break; 351 break;
353 352
354 case I2O_BUS_MCA:
355 seq_printf(seq, " IOBase: %0#6x,",
356 hrt->hrt_entry[i].bus.mca_bus.
357 McaBaseIOPort);
358 seq_printf(seq, " MemoryBase: %0#10x,",
359 hrt->hrt_entry[i].bus.mca_bus.
360 McaBaseMemoryAddress);
361 seq_printf(seq, " Slot: %0#4x,",
362 hrt->hrt_entry[i].bus.mca_bus.
363 McaSlotNumber);
364 break;
365
366 case I2O_BUS_PCI: 353 case I2O_BUS_PCI:
367 seq_printf(seq, " Bus: %0#4x", 354 seq_printf(seq, " Bus: %0#4x",
368 hrt->hrt_entry[i].bus.pci_bus. 355 hrt->hrt_entry[i].bus.pci_bus.
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index bea04e5d3b51..e9559782d3ec 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -808,19 +808,6 @@ config SCSI_FUTURE_DOMAIN
808 To compile this driver as a module, choose M here: the 808 To compile this driver as a module, choose M here: the
809 module will be called fdomain. 809 module will be called fdomain.
810 810
811config SCSI_FD_MCS
812 tristate "Future Domain MCS-600/700 SCSI support"
813 depends on MCA_LEGACY && SCSI
814 ---help---
815 This is support for Future Domain MCS 600/700 MCA SCSI adapters.
816 Some PS/2 computers are equipped with IBM Fast SCSI Adapter/A which
817 is identical to the MCS 700 and hence also supported by this driver.
818 This driver also supports the Reply SB16/SCSI card (the SCSI part).
819 It supports multiple adapters in the same system.
820
821 To compile this driver as a module, choose M here: the
822 module will be called fd_mcs.
823
824config SCSI_GDTH 811config SCSI_GDTH
825 tristate "Intel/ICP (former GDT SCSI Disk Array) RAID Controller support" 812 tristate "Intel/ICP (former GDT SCSI Disk Array) RAID Controller support"
826 depends on (ISA || EISA || PCI) && SCSI && ISA_DMA_API 813 depends on (ISA || EISA || PCI) && SCSI && ISA_DMA_API
@@ -890,76 +877,6 @@ config SCSI_GENERIC_NCR53C400
890 not detect your card. See the file 877 not detect your card. See the file
891 <file:Documentation/scsi/g_NCR5380.txt> for details. 878 <file:Documentation/scsi/g_NCR5380.txt> for details.
892 879
893config SCSI_IBMMCA
894 tristate "IBMMCA SCSI support"
895 depends on MCA && SCSI
896 ---help---
897 This is support for the IBM SCSI adapter found in many of the PS/2
898 series computers. These machines have an MCA bus, so you need to
899 answer Y to "MCA support" as well and read
900 <file:Documentation/mca.txt>.
901
902 If the adapter isn't found during boot (a common problem for models
903 56, 57, 76, and 77) you'll need to use the 'ibmmcascsi=<pun>' kernel
904 option, where <pun> is the id of the SCSI subsystem (usually 7, but
905 if that doesn't work check your reference diskette). Owners of
906 model 95 with a LED-matrix-display can in addition activate some
907 activity info like under OS/2, but more informative, by setting
908 'ibmmcascsi=display' as an additional kernel parameter. Try "man
909 bootparam" or see the documentation of your boot loader about how to
910 pass options to the kernel.
911
912 To compile this driver as a module, choose M here: the
913 module will be called ibmmca.
914
915config IBMMCA_SCSI_ORDER_STANDARD
916 bool "Standard SCSI-order"
917 depends on SCSI_IBMMCA
918 ---help---
919 In the PC-world and in most modern SCSI-BIOS-setups, SCSI-hard disks
920 are assigned to the drive letters, starting with the lowest SCSI-id
921 (physical number -- pun) to be drive C:, as seen from DOS and
922 similar operating systems. When looking into papers describing the
923 ANSI-SCSI-standard, this assignment of drives appears to be wrong.
924 The SCSI-standard follows a hardware-hierarchy which says that id 7
925 has the highest priority and id 0 the lowest. Therefore, the host
926 adapters are still today everywhere placed as SCSI-id 7 by default.
927 In the SCSI-standard, the drive letters express the priority of the
928 disk. C: should be the hard disk, or a partition on it, with the
929 highest priority. This must therefore be the disk with the highest
930 SCSI-id (e.g. 6) and not the one with the lowest! IBM-BIOS kept the
931 original definition of the SCSI-standard as also industrial- and
932 process-control-machines, like VME-CPUs running under realtime-OSes
933 (e.g. LynxOS, OS9) do.
934
935 If you like to run Linux on your MCA-machine with the same
936 assignment of hard disks as seen from e.g. DOS or OS/2 on your
937 machine, which is in addition conformant to the SCSI-standard, you
938 must say Y here. This is also necessary for MCA-Linux users who want
939 to keep downward compatibility to older releases of the
940 IBM-MCA-SCSI-driver (older than driver-release 2.00 and older than
941 June 1997).
942
943 If you like to have the lowest SCSI-id assigned as drive C:, as
944 modern SCSI-BIOSes do, which does not conform to the standard, but
945 is widespread and common in the PC-world of today, you must say N
946 here. If unsure, say Y.
947
948config IBMMCA_SCSI_DEV_RESET
949 bool "Reset SCSI-devices at boottime"
950 depends on SCSI_IBMMCA
951 ---help---
952 By default, SCSI-devices are reset when the machine is powered on.
953 However, some devices exist, like special-control-devices,
954 SCSI-CNC-machines, SCSI-printer or scanners of older type, that do
955 not reset when switched on. If you say Y here, each device connected
956 to your SCSI-bus will be issued a reset-command after it has been
957 probed, while the kernel is booting. This may cause problems with
958 more modern devices, like hard disks, which do not appreciate these
959 reset commands, and can cause your system to hang. So say Y only if
960 you know that one of your older devices needs it; N is the safe
961 answer.
962
963config SCSI_IPS 880config SCSI_IPS
964 tristate "IBM ServeRAID support" 881 tristate "IBM ServeRAID support"
965 depends on PCI && SCSI 882 depends on PCI && SCSI
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index 8deedeaf5608..1a3368b08615 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -75,7 +75,6 @@ obj-$(CONFIG_SCSI_AIC94XX) += aic94xx/
75obj-$(CONFIG_SCSI_PM8001) += pm8001/ 75obj-$(CONFIG_SCSI_PM8001) += pm8001/
76obj-$(CONFIG_SCSI_ISCI) += isci/ 76obj-$(CONFIG_SCSI_ISCI) += isci/
77obj-$(CONFIG_SCSI_IPS) += ips.o 77obj-$(CONFIG_SCSI_IPS) += ips.o
78obj-$(CONFIG_SCSI_FD_MCS) += fd_mcs.o
79obj-$(CONFIG_SCSI_FUTURE_DOMAIN)+= fdomain.o 78obj-$(CONFIG_SCSI_FUTURE_DOMAIN)+= fdomain.o
80obj-$(CONFIG_SCSI_IN2000) += in2000.o 79obj-$(CONFIG_SCSI_IN2000) += in2000.o
81obj-$(CONFIG_SCSI_GENERIC_NCR5380) += g_NCR5380.o 80obj-$(CONFIG_SCSI_GENERIC_NCR5380) += g_NCR5380.o
@@ -100,7 +99,6 @@ obj-$(CONFIG_SCSI_SYM53C8XX_2) += sym53c8xx_2/
100obj-$(CONFIG_SCSI_ZALON) += zalon7xx.o 99obj-$(CONFIG_SCSI_ZALON) += zalon7xx.o
101obj-$(CONFIG_SCSI_EATA_PIO) += eata_pio.o 100obj-$(CONFIG_SCSI_EATA_PIO) += eata_pio.o
102obj-$(CONFIG_SCSI_7000FASST) += wd7000.o 101obj-$(CONFIG_SCSI_7000FASST) += wd7000.o
103obj-$(CONFIG_SCSI_IBMMCA) += ibmmca.o
104obj-$(CONFIG_SCSI_EATA) += eata.o 102obj-$(CONFIG_SCSI_EATA) += eata.o
105obj-$(CONFIG_SCSI_DC395x) += dc395x.o 103obj-$(CONFIG_SCSI_DC395x) += dc395x.o
106obj-$(CONFIG_SCSI_DC390T) += tmscsim.o 104obj-$(CONFIG_SCSI_DC390T) += tmscsim.o
diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c
index ede91f378000..f79c8f9e33a4 100644
--- a/drivers/scsi/aha1542.c
+++ b/drivers/scsi/aha1542.c
@@ -22,7 +22,7 @@
22 * Added module command-line options 22 * Added module command-line options
23 * 19-Jul-99 23 * 19-Jul-99
24 * Modified by Adam Fritzler 24 * Modified by Adam Fritzler
25 * Added proper detection of the AHA-1640 (MCA version of AHA-1540) 25 * Added proper detection of the AHA-1640 (MCA, now deleted)
26 */ 26 */
27 27
28#include <linux/module.h> 28#include <linux/module.h>
@@ -37,8 +37,6 @@
37#include <linux/spinlock.h> 37#include <linux/spinlock.h>
38#include <linux/isapnp.h> 38#include <linux/isapnp.h>
39#include <linux/blkdev.h> 39#include <linux/blkdev.h>
40#include <linux/mca.h>
41#include <linux/mca-legacy.h>
42#include <linux/slab.h> 40#include <linux/slab.h>
43 41
44#include <asm/dma.h> 42#include <asm/dma.h>
@@ -71,7 +69,7 @@
71#define MAXBOARDS 4 /* Increase this and the sizes of the 69#define MAXBOARDS 4 /* Increase this and the sizes of the
72 arrays below, if you need more.. */ 70 arrays below, if you need more.. */
73 71
74/* Boards 3,4 slots are reserved for ISAPnP/MCA scans */ 72/* Boards 3,4 slots are reserved for ISAPnP scans */
75 73
76static unsigned int bases[MAXBOARDS] __initdata = {0x330, 0x334, 0, 0}; 74static unsigned int bases[MAXBOARDS] __initdata = {0x330, 0x334, 0, 0};
77 75
@@ -1009,66 +1007,6 @@ static int __init aha1542_detect(struct scsi_host_template * tpnt)
1009#endif 1007#endif
1010 1008
1011 /* 1009 /*
1012 * Find MicroChannel cards (AHA1640)
1013 */
1014#ifdef CONFIG_MCA_LEGACY
1015 if(MCA_bus) {
1016 int slot = 0;
1017 int pos = 0;
1018
1019 for (indx = 0; (slot != MCA_NOTFOUND) && (indx < ARRAY_SIZE(bases)); indx++) {
1020
1021 if (bases[indx])
1022 continue;
1023
1024 /* Detect only AHA-1640 cards -- MCA ID 0F1F */
1025 slot = mca_find_unused_adapter(0x0f1f, slot);
1026 if (slot == MCA_NOTFOUND)
1027 break;
1028
1029 /* Found one */
1030 pos = mca_read_stored_pos(slot, 3);
1031
1032 /* Decode address */
1033 if (pos & 0x80) {
1034 if (pos & 0x02) {
1035 if (pos & 0x01)
1036 bases[indx] = 0x334;
1037 else
1038 bases[indx] = 0x234;
1039 } else {
1040 if (pos & 0x01)
1041 bases[indx] = 0x134;
1042 }
1043 } else {
1044 if (pos & 0x02) {
1045 if (pos & 0x01)
1046 bases[indx] = 0x330;
1047 else
1048 bases[indx] = 0x230;
1049 } else {
1050 if (pos & 0x01)
1051 bases[indx] = 0x130;
1052 }
1053 }
1054
1055 /* No need to decode IRQ and Arb level -- those are
1056 * read off the card later.
1057 */
1058 printk(KERN_INFO "Found an AHA-1640 in MCA slot %d, I/O 0x%04x\n", slot, bases[indx]);
1059
1060 mca_set_adapter_name(slot, "Adapter AHA-1640");
1061 mca_set_adapter_procfn(slot, NULL, NULL);
1062 mca_mark_as_used(slot);
1063
1064 /* Go on */
1065 slot++;
1066 }
1067
1068 }
1069#endif
1070
1071 /*
1072 * Hunt for ISA Plug'n'Pray Adaptecs (AHA1535) 1010 * Hunt for ISA Plug'n'Pray Adaptecs (AHA1535)
1073 */ 1011 */
1074 1012
diff --git a/drivers/scsi/fd_mcs.c b/drivers/scsi/fd_mcs.c
deleted file mode 100644
index 53bfcaa86f09..000000000000
--- a/drivers/scsi/fd_mcs.c
+++ /dev/null
@@ -1,1354 +0,0 @@
1/* fd_mcs.c -- Future Domain MCS 600/700 (or IBM OEM) driver
2 *
3 * FutureDomain MCS-600/700 v0.2 03/11/1998 by ZP Gu (zpg@castle.net)
4 *
5 * This driver is cloned from fdomain.* to specifically support
6 * the Future Domain MCS 600/700 MCA SCSI adapters. Some PS/2s
7 * also equipped with IBM Fast SCSI Adapter/A which is an OEM
8 * of MCS 700.
9 *
10 * This driver also supports Reply SB16/SCSI card (the SCSI part).
11 *
12 * What makes this driver different is that this driver is MCA only
13 * and it supports multiple adapters in the same system, IRQ
14 * sharing, some driver statistics, and maps highest SCSI id to sda.
15 * All cards are auto-detected.
16 *
17 * Assumptions: TMC-1800/18C50/18C30, BIOS >= 3.4
18 *
19 * LILO command-line options:
20 * fd_mcs=<FIFO_COUNT>[,<FIFO_SIZE>]
21 *
22 * ********************************************************
23 * Please see Copyrights/Comments in fdomain.* for credits.
24 * Following is from fdomain.c for acknowledgement:
25 *
26 * Created: Sun May 3 18:53:19 1992 by faith@cs.unc.edu
27 * Revised: Wed Oct 2 11:10:55 1996 by r.faith@ieee.org
28 * Author: Rickard E. Faith, faith@cs.unc.edu
29 * Copyright 1992, 1993, 1994, 1995, 1996 Rickard E. Faith
30 *
31 * $Id: fdomain.c,v 5.45 1996/10/02 15:13:06 root Exp $
32
33 * This program is free software; you can redistribute it and/or modify it
34 * under the terms of the GNU General Public License as published by the
35 * Free Software Foundation; either version 2, or (at your option) any
36 * later version.
37
38 * This program is distributed in the hope that it will be useful, but
39 * WITHOUT ANY WARRANTY; without even the implied warranty of
40 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41 * General Public License for more details.
42
43 * You should have received a copy of the GNU General Public License along
44 * with this program; if not, write to the Free Software Foundation, Inc.,
45 * 675 Mass Ave, Cambridge, MA 02139, USA.
46
47 **************************************************************************
48
49 NOTES ON USER DEFINABLE OPTIONS:
50
51 DEBUG: This turns on the printing of various debug information.
52
53 ENABLE_PARITY: This turns on SCSI parity checking. With the current
54 driver, all attached devices must support SCSI parity. If none of your
55 devices support parity, then you can probably get the driver to work by
56 turning this option off. I have no way of testing this, however, and it
57 would appear that no one ever uses this option.
58
59 FIFO_COUNT: The host adapter has an 8K cache (host adapters based on the
60 18C30 chip have a 2k cache). When this many 512 byte blocks are filled by
61 the SCSI device, an interrupt will be raised. Therefore, this could be as
62 low as 0, or as high as 16. Note, however, that values which are too high
63 or too low seem to prevent any interrupts from occurring, and thereby lock
64 up the machine. I have found that 2 is a good number, but throughput may
65 be increased by changing this value to values which are close to 2.
66 Please let me know if you try any different values.
67 [*****Now a runtime option*****]
68
69 RESELECTION: This is no longer an option, since I gave up trying to
70 implement it in version 4.x of this driver. It did not improve
71 performance at all and made the driver unstable (because I never found one
72 of the two race conditions which were introduced by the multiple
73 outstanding command code). The instability seems a very high price to pay
74 just so that you don't have to wait for the tape to rewind. If you want
75 this feature implemented, send me patches. I'll be happy to send a copy
76 of my (broken) driver to anyone who would like to see a copy.
77
78 **************************************************************************/
79
80#include <linux/module.h>
81#include <linux/init.h>
82#include <linux/interrupt.h>
83#include <linux/blkdev.h>
84#include <linux/errno.h>
85#include <linux/string.h>
86#include <linux/ioport.h>
87#include <linux/proc_fs.h>
88#include <linux/delay.h>
89#include <linux/mca.h>
90#include <linux/spinlock.h>
91#include <linux/slab.h>
92#include <scsi/scsicam.h>
93#include <linux/mca-legacy.h>
94
95#include <asm/io.h>
96
97#include "scsi.h"
98#include <scsi/scsi_host.h>
99
100#define DRIVER_VERSION "v0.2 by ZP Gu<zpg@castle.net>"
101
102/* START OF USER DEFINABLE OPTIONS */
103
104#define DEBUG 0 /* Enable debugging output */
105#define ENABLE_PARITY 1 /* Enable SCSI Parity */
106
107/* END OF USER DEFINABLE OPTIONS */
108
109#if DEBUG
110#define EVERY_ACCESS 0 /* Write a line on every scsi access */
111#define ERRORS_ONLY 1 /* Only write a line if there is an error */
112#define DEBUG_MESSAGES 1 /* Debug MESSAGE IN phase */
113#define DEBUG_ABORT 1 /* Debug abort() routine */
114#define DEBUG_RESET 1 /* Debug reset() routine */
115#define DEBUG_RACE 1 /* Debug interrupt-driven race condition */
116#else
117#define EVERY_ACCESS 0 /* LEAVE THESE ALONE--CHANGE THE ONES ABOVE */
118#define ERRORS_ONLY 0
119#define DEBUG_MESSAGES 0
120#define DEBUG_ABORT 0
121#define DEBUG_RESET 0
122#define DEBUG_RACE 0
123#endif
124
125/* Errors are reported on the line, so we don't need to report them again */
126#if EVERY_ACCESS
127#undef ERRORS_ONLY
128#define ERRORS_ONLY 0
129#endif
130
131#if ENABLE_PARITY
132#define PARITY_MASK 0x08
133#else
134#define PARITY_MASK 0x00
135#endif
136
137enum chip_type {
138 unknown = 0x00,
139 tmc1800 = 0x01,
140 tmc18c50 = 0x02,
141 tmc18c30 = 0x03,
142};
143
144enum {
145 in_arbitration = 0x02,
146 in_selection = 0x04,
147 in_other = 0x08,
148 disconnect = 0x10,
149 aborted = 0x20,
150 sent_ident = 0x40,
151};
152
153enum in_port_type {
154 Read_SCSI_Data = 0,
155 SCSI_Status = 1,
156 TMC_Status = 2,
157 FIFO_Status = 3, /* tmc18c50/tmc18c30 only */
158 Interrupt_Cond = 4, /* tmc18c50/tmc18c30 only */
159 LSB_ID_Code = 5,
160 MSB_ID_Code = 6,
161 Read_Loopback = 7,
162 SCSI_Data_NoACK = 8,
163 Interrupt_Status = 9,
164 Configuration1 = 10,
165 Configuration2 = 11, /* tmc18c50/tmc18c30 only */
166 Read_FIFO = 12,
167 FIFO_Data_Count = 14
168};
169
170enum out_port_type {
171 Write_SCSI_Data = 0,
172 SCSI_Cntl = 1,
173 Interrupt_Cntl = 2,
174 SCSI_Mode_Cntl = 3,
175 TMC_Cntl = 4,
176 Memory_Cntl = 5, /* tmc18c50/tmc18c30 only */
177 Write_Loopback = 7,
178 IO_Control = 11, /* tmc18c30 only */
179 Write_FIFO = 12
180};
181
182struct fd_hostdata {
183 unsigned long _bios_base;
184 int _bios_major;
185 int _bios_minor;
186 volatile int _in_command;
187 Scsi_Cmnd *_current_SC;
188 enum chip_type _chip;
189 int _adapter_mask;
190 int _fifo_count; /* Number of 512 byte blocks before INTR */
191
192 char _adapter_name[64];
193#if DEBUG_RACE
194 volatile int _in_interrupt_flag;
195#endif
196
197 int _SCSI_Mode_Cntl_port;
198 int _FIFO_Data_Count_port;
199 int _Interrupt_Cntl_port;
200 int _Interrupt_Status_port;
201 int _Interrupt_Cond_port;
202 int _Read_FIFO_port;
203 int _Read_SCSI_Data_port;
204 int _SCSI_Cntl_port;
205 int _SCSI_Data_NoACK_port;
206 int _SCSI_Status_port;
207 int _TMC_Cntl_port;
208 int _TMC_Status_port;
209 int _Write_FIFO_port;
210 int _Write_SCSI_Data_port;
211
212 int _FIFO_Size; /* = 0x2000; 8k FIFO for
213 pre-tmc18c30 chips */
214 /* simple stats */
215 int _Bytes_Read;
216 int _Bytes_Written;
217 int _INTR_Processed;
218};
219
220#define FD_MAX_HOSTS 3 /* enough? */
221
222#define HOSTDATA(shpnt) ((struct fd_hostdata *) shpnt->hostdata)
223#define bios_base (HOSTDATA(shpnt)->_bios_base)
224#define bios_major (HOSTDATA(shpnt)->_bios_major)
225#define bios_minor (HOSTDATA(shpnt)->_bios_minor)
226#define in_command (HOSTDATA(shpnt)->_in_command)
227#define current_SC (HOSTDATA(shpnt)->_current_SC)
228#define chip (HOSTDATA(shpnt)->_chip)
229#define adapter_mask (HOSTDATA(shpnt)->_adapter_mask)
230#define FIFO_COUNT (HOSTDATA(shpnt)->_fifo_count)
231#define adapter_name (HOSTDATA(shpnt)->_adapter_name)
232#if DEBUG_RACE
233#define in_interrupt_flag (HOSTDATA(shpnt)->_in_interrupt_flag)
234#endif
235#define SCSI_Mode_Cntl_port (HOSTDATA(shpnt)->_SCSI_Mode_Cntl_port)
236#define FIFO_Data_Count_port (HOSTDATA(shpnt)->_FIFO_Data_Count_port)
237#define Interrupt_Cntl_port (HOSTDATA(shpnt)->_Interrupt_Cntl_port)
238#define Interrupt_Status_port (HOSTDATA(shpnt)->_Interrupt_Status_port)
239#define Interrupt_Cond_port (HOSTDATA(shpnt)->_Interrupt_Cond_port)
240#define Read_FIFO_port (HOSTDATA(shpnt)->_Read_FIFO_port)
241#define Read_SCSI_Data_port (HOSTDATA(shpnt)->_Read_SCSI_Data_port)
242#define SCSI_Cntl_port (HOSTDATA(shpnt)->_SCSI_Cntl_port)
243#define SCSI_Data_NoACK_port (HOSTDATA(shpnt)->_SCSI_Data_NoACK_port)
244#define SCSI_Status_port (HOSTDATA(shpnt)->_SCSI_Status_port)
245#define TMC_Cntl_port (HOSTDATA(shpnt)->_TMC_Cntl_port)
246#define TMC_Status_port (HOSTDATA(shpnt)->_TMC_Status_port)
247#define Write_FIFO_port (HOSTDATA(shpnt)->_Write_FIFO_port)
248#define Write_SCSI_Data_port (HOSTDATA(shpnt)->_Write_SCSI_Data_port)
249#define FIFO_Size (HOSTDATA(shpnt)->_FIFO_Size)
250#define Bytes_Read (HOSTDATA(shpnt)->_Bytes_Read)
251#define Bytes_Written (HOSTDATA(shpnt)->_Bytes_Written)
252#define INTR_Processed (HOSTDATA(shpnt)->_INTR_Processed)
253
254struct fd_mcs_adapters_struct {
255 char *name;
256 int id;
257 enum chip_type fd_chip;
258 int fifo_size;
259 int fifo_count;
260};
261
262#define REPLY_ID 0x5137
263
264static struct fd_mcs_adapters_struct fd_mcs_adapters[] = {
265 {"Future Domain SCSI Adapter MCS-700(18C50)",
266 0x60e9,
267 tmc18c50,
268 0x2000,
269 4},
270 {"Future Domain SCSI Adapter MCS-600/700(TMC-1800)",
271 0x6127,
272 tmc1800,
273 0x2000,
274 4},
275 {"Reply Sound Blaster/SCSI Adapter",
276 REPLY_ID,
277 tmc18c30,
278 0x800,
279 2},
280};
281
282#define FD_BRDS ARRAY_SIZE(fd_mcs_adapters)
283
284static irqreturn_t fd_mcs_intr(int irq, void *dev_id);
285
286static unsigned long addresses[] = { 0xc8000, 0xca000, 0xce000, 0xde000 };
287static unsigned short ports[] = { 0x140, 0x150, 0x160, 0x170 };
288static unsigned short interrupts[] = { 3, 5, 10, 11, 12, 14, 15, 0 };
289
290/* host information */
291static int found = 0;
292static struct Scsi_Host *hosts[FD_MAX_HOSTS + 1] = { NULL };
293
294static int user_fifo_count = 0;
295static int user_fifo_size = 0;
296
297#ifndef MODULE
298static int __init fd_mcs_setup(char *str)
299{
300 static int done_setup = 0;
301 int ints[3];
302
303 get_options(str, 3, ints);
304 if (done_setup++ || ints[0] < 1 || ints[0] > 2 || ints[1] < 1 || ints[1] > 16) {
305 printk("fd_mcs: usage: fd_mcs=FIFO_COUNT, FIFO_SIZE\n");
306 return 0;
307 }
308
309 user_fifo_count = ints[0] >= 1 ? ints[1] : 0;
310 user_fifo_size = ints[0] >= 2 ? ints[2] : 0;
311 return 1;
312}
313
314__setup("fd_mcs=", fd_mcs_setup);
315#endif /* !MODULE */
316
317static void print_banner(struct Scsi_Host *shpnt)
318{
319 printk("scsi%d <fd_mcs>: ", shpnt->host_no);
320
321 if (bios_base) {
322 printk("BIOS at 0x%lX", bios_base);
323 } else {
324 printk("No BIOS");
325 }
326
327 printk(", HostID %d, %s Chip, IRQ %d, IO 0x%lX\n", shpnt->this_id, chip == tmc18c50 ? "TMC-18C50" : (chip == tmc18c30 ? "TMC-18C30" : (chip == tmc1800 ? "TMC-1800" : "Unknown")), shpnt->irq, shpnt->io_port);
328}
329
330
331static void do_pause(unsigned amount)
332{ /* Pause for amount*10 milliseconds */
333 do {
334 mdelay(10);
335 } while (--amount);
336}
337
338static void fd_mcs_make_bus_idle(struct Scsi_Host *shpnt)
339{
340 outb(0, SCSI_Cntl_port);
341 outb(0, SCSI_Mode_Cntl_port);
342 if (chip == tmc18c50 || chip == tmc18c30)
343 outb(0x21 | PARITY_MASK, TMC_Cntl_port); /* Clear forced intr. */
344 else
345 outb(0x01 | PARITY_MASK, TMC_Cntl_port);
346}
347
348static int fd_mcs_detect(struct scsi_host_template * tpnt)
349{
350 int loop;
351 struct Scsi_Host *shpnt;
352
353 /* get id, port, bios, irq */
354 int slot;
355 u_char pos2, pos3, pos4;
356 int id, port, irq;
357 unsigned long bios;
358
359 /* if not MCA machine, return */
360 if (!MCA_bus)
361 return 0;
362
363 /* changeable? */
364 id = 7;
365
366 for (loop = 0; loop < FD_BRDS; loop++) {
367 slot = 0;
368 while (MCA_NOTFOUND != (slot = mca_find_adapter(fd_mcs_adapters[loop].id, slot))) {
369
370 /* if we get this far, an adapter has been detected and is
371 enabled */
372
373 printk(KERN_INFO "scsi <fd_mcs>: %s at slot %d\n", fd_mcs_adapters[loop].name, slot + 1);
374
375 pos2 = mca_read_stored_pos(slot, 2);
376 pos3 = mca_read_stored_pos(slot, 3);
377 pos4 = mca_read_stored_pos(slot, 4);
378
379 /* ready for next probe */
380 slot++;
381
382 if (fd_mcs_adapters[loop].id == REPLY_ID) { /* reply card */
383 static int reply_irq[] = { 10, 11, 14, 15 };
384
385 bios = 0; /* no bios */
386
387 if (pos2 & 0x2)
388 port = ports[pos4 & 0x3];
389 else
390 continue;
391
392 /* can't really disable it, same as irq=10 */
393 irq = reply_irq[((pos4 >> 2) & 0x1) + 2 * ((pos4 >> 4) & 0x1)];
394 } else {
395 bios = addresses[pos2 >> 6];
396 port = ports[(pos2 >> 4) & 0x03];
397 irq = interrupts[(pos2 >> 1) & 0x07];
398 }
399
400 if (irq) {
401 /* claim the slot */
402 mca_set_adapter_name(slot - 1, fd_mcs_adapters[loop].name);
403
404 /* check irq/region */
405 if (request_irq(irq, fd_mcs_intr, IRQF_SHARED, "fd_mcs", hosts)) {
406 printk(KERN_ERR "fd_mcs: interrupt is not available, skipping...\n");
407 continue;
408 }
409
410 /* request I/O region */
411 if (request_region(port, 0x10, "fd_mcs")) {
412 printk(KERN_ERR "fd_mcs: I/O region is already in use, skipping...\n");
413 continue;
414 }
415 /* register */
416 if (!(shpnt = scsi_register(tpnt, sizeof(struct fd_hostdata)))) {
417 printk(KERN_ERR "fd_mcs: scsi_register() failed\n");
418 release_region(port, 0x10);
419 free_irq(irq, hosts);
420 continue;
421 }
422
423
424 /* save name */
425 strcpy(adapter_name, fd_mcs_adapters[loop].name);
426
427 /* chip/fifo */
428 chip = fd_mcs_adapters[loop].fd_chip;
429 /* use boot time value if available */
430 FIFO_COUNT = user_fifo_count ? user_fifo_count : fd_mcs_adapters[loop].fifo_count;
431 FIFO_Size = user_fifo_size ? user_fifo_size : fd_mcs_adapters[loop].fifo_size;
432
433/* FIXME: Do we need to keep this bit of code inside NOT_USED around at all? */
434#ifdef NOT_USED
435 /* *************************************************** */
436 /* Try to toggle 32-bit mode. This only
437 works on an 18c30 chip. (User reports
438 say this works, so we should switch to
439 it in the near future.) */
440 outb(0x80, port + IO_Control);
441 if ((inb(port + Configuration2) & 0x80) == 0x80) {
442 outb(0x00, port + IO_Control);
443 if ((inb(port + Configuration2) & 0x80) == 0x00) {
444 chip = tmc18c30;
445 FIFO_Size = 0x800; /* 2k FIFO */
446
447 printk("FIRST: chip=%s, fifo_size=0x%x\n", (chip == tmc18c30) ? "tmc18c30" : "tmc18c50", FIFO_Size);
448 }
449 }
450
451 /* That should have worked, but appears to
452 have problems. Let's assume it is an
453 18c30 if the RAM is disabled. */
454
455 if (inb(port + Configuration2) & 0x02) {
456 chip = tmc18c30;
457 FIFO_Size = 0x800; /* 2k FIFO */
458
459 printk("SECOND: chip=%s, fifo_size=0x%x\n", (chip == tmc18c30) ? "tmc18c30" : "tmc18c50", FIFO_Size);
460 }
461 /* *************************************************** */
462#endif
463
464 /* IBM/ANSI scsi scan ordering */
465 /* Stick this back in when the scsi.c changes are there */
466 shpnt->reverse_ordering = 1;
467
468
469 /* saving info */
470 hosts[found++] = shpnt;
471
472 shpnt->this_id = id;
473 shpnt->irq = irq;
474 shpnt->io_port = port;
475 shpnt->n_io_port = 0x10;
476
477 /* save */
478 bios_base = bios;
479 adapter_mask = (1 << id);
480
481 /* save more */
482 SCSI_Mode_Cntl_port = port + SCSI_Mode_Cntl;
483 FIFO_Data_Count_port = port + FIFO_Data_Count;
484 Interrupt_Cntl_port = port + Interrupt_Cntl;
485 Interrupt_Status_port = port + Interrupt_Status;
486 Interrupt_Cond_port = port + Interrupt_Cond;
487 Read_FIFO_port = port + Read_FIFO;
488 Read_SCSI_Data_port = port + Read_SCSI_Data;
489 SCSI_Cntl_port = port + SCSI_Cntl;
490 SCSI_Data_NoACK_port = port + SCSI_Data_NoACK;
491 SCSI_Status_port = port + SCSI_Status;
492 TMC_Cntl_port = port + TMC_Cntl;
493 TMC_Status_port = port + TMC_Status;
494 Write_FIFO_port = port + Write_FIFO;
495 Write_SCSI_Data_port = port + Write_SCSI_Data;
496
497 Bytes_Read = 0;
498 Bytes_Written = 0;
499 INTR_Processed = 0;
500
501 /* say something */
502 print_banner(shpnt);
503
504 /* reset */
505 outb(1, SCSI_Cntl_port);
506 do_pause(2);
507 outb(0, SCSI_Cntl_port);
508 do_pause(115);
509 outb(0, SCSI_Mode_Cntl_port);
510 outb(PARITY_MASK, TMC_Cntl_port);
511 /* done reset */
512 }
513 }
514
515 if (found == FD_MAX_HOSTS) {
516 printk("fd_mcs: detecting reached max=%d host adapters.\n", FD_MAX_HOSTS);
517 break;
518 }
519 }
520
521 return found;
522}
523
524static const char *fd_mcs_info(struct Scsi_Host *shpnt)
525{
526 return adapter_name;
527}
528
529static int TOTAL_INTR = 0;
530
531/*
532 * inout : decides on the direction of the dataflow and the meaning of the
533 * variables
534 * buffer: If inout==FALSE data is being written to it else read from it
535 * *start: If inout==FALSE start of the valid data in the buffer
536 * offset: If inout==FALSE offset from the beginning of the imaginary file
537 * from which we start writing into the buffer
538 * length: If inout==FALSE max number of bytes to be written into the buffer
539 * else number of bytes in the buffer
540 */
541static int fd_mcs_proc_info(struct Scsi_Host *shpnt, char *buffer, char **start, off_t offset, int length, int inout)
542{
543 int len = 0;
544
545 if (inout)
546 return (-ENOSYS);
547
548 *start = buffer + offset;
549
550 len += sprintf(buffer + len, "Future Domain MCS-600/700 Driver %s\n", DRIVER_VERSION);
551 len += sprintf(buffer + len, "HOST #%d: %s\n", shpnt->host_no, adapter_name);
552 len += sprintf(buffer + len, "FIFO Size=0x%x, FIFO Count=%d\n", FIFO_Size, FIFO_COUNT);
553 len += sprintf(buffer + len, "DriverCalls=%d, Interrupts=%d, BytesRead=%d, BytesWrite=%d\n\n", TOTAL_INTR, INTR_Processed, Bytes_Read, Bytes_Written);
554
555 if ((len -= offset) <= 0)
556 return 0;
557 if (len > length)
558 len = length;
559 return len;
560}
561
562static int fd_mcs_select(struct Scsi_Host *shpnt, int target)
563{
564 int status;
565 unsigned long timeout;
566
567 outb(0x82, SCSI_Cntl_port); /* Bus Enable + Select */
568 outb(adapter_mask | (1 << target), SCSI_Data_NoACK_port);
569
570 /* Stop arbitration and enable parity */
571 outb(PARITY_MASK, TMC_Cntl_port);
572
573 timeout = 350; /* 350mS -- because of timeouts
574 (was 250mS) */
575
576 do {
577 status = inb(SCSI_Status_port); /* Read adapter status */
578 if (status & 1) { /* Busy asserted */
579 /* Enable SCSI Bus (on error, should make bus idle with 0) */
580 outb(0x80, SCSI_Cntl_port);
581 return 0;
582 }
583 udelay(1000); /* wait one msec */
584 } while (--timeout);
585
586 /* Make bus idle */
587 fd_mcs_make_bus_idle(shpnt);
588#if EVERY_ACCESS
589 if (!target)
590 printk("Selection failed\n");
591#endif
592#if ERRORS_ONLY
593 if (!target) {
594 static int flag = 0;
595
596 if (!flag) /* Skip first failure for all chips. */
597 ++flag;
598 else
599 printk("fd_mcs: Selection failed\n");
600 }
601#endif
602 return 1;
603}
604
605static void my_done(struct Scsi_Host *shpnt, int error)
606{
607 if (in_command) {
608 in_command = 0;
609 outb(0x00, Interrupt_Cntl_port);
610 fd_mcs_make_bus_idle(shpnt);
611 current_SC->result = error;
612 current_SC->scsi_done(current_SC);
613 } else {
614 panic("fd_mcs: my_done() called outside of command\n");
615 }
616#if DEBUG_RACE
617 in_interrupt_flag = 0;
618#endif
619}
620
621/* only my_done needs to be protected */
622static irqreturn_t fd_mcs_intr(int irq, void *dev_id)
623{
624 unsigned long flags;
625 int status;
626 int done = 0;
627 unsigned data_count, tmp_count;
628
629 int i = 0;
630 struct Scsi_Host *shpnt;
631
632 TOTAL_INTR++;
633
634 /* search for one adapter-response on shared interrupt */
635 while ((shpnt = hosts[i++])) {
636 if ((inb(TMC_Status_port)) & 1)
637 break;
638 }
639
640 /* return if some other device on this IRQ caused the interrupt */
641 if (!shpnt) {
642 return IRQ_NONE;
643 }
644
645 INTR_Processed++;
646
647 outb(0x00, Interrupt_Cntl_port);
648
649 /* Abort calls my_done, so we do nothing here. */
650 if (current_SC->SCp.phase & aborted) {
651#if DEBUG_ABORT
652 printk("Interrupt after abort, ignoring\n");
653#endif
654 /* return IRQ_HANDLED; */
655 }
656#if DEBUG_RACE
657 ++in_interrupt_flag;
658#endif
659
660 if (current_SC->SCp.phase & in_arbitration) {
661 status = inb(TMC_Status_port); /* Read adapter status */
662 if (!(status & 0x02)) {
663#if EVERY_ACCESS
664 printk(" AFAIL ");
665#endif
666 spin_lock_irqsave(shpnt->host_lock, flags);
667 my_done(shpnt, DID_BUS_BUSY << 16);
668 spin_unlock_irqrestore(shpnt->host_lock, flags);
669 return IRQ_HANDLED;
670 }
671 current_SC->SCp.phase = in_selection;
672
673 outb(0x40 | FIFO_COUNT, Interrupt_Cntl_port);
674
675 outb(0x82, SCSI_Cntl_port); /* Bus Enable + Select */
676 outb(adapter_mask | (1 << scmd_id(current_SC)), SCSI_Data_NoACK_port);
677
678 /* Stop arbitration and enable parity */
679 outb(0x10 | PARITY_MASK, TMC_Cntl_port);
680#if DEBUG_RACE
681 in_interrupt_flag = 0;
682#endif
683 return IRQ_HANDLED;
684 } else if (current_SC->SCp.phase & in_selection) {
685 status = inb(SCSI_Status_port);
686 if (!(status & 0x01)) {
687 /* Try again, for slow devices */
688 if (fd_mcs_select(shpnt, scmd_id(current_SC))) {
689#if EVERY_ACCESS
690 printk(" SFAIL ");
691#endif
692 spin_lock_irqsave(shpnt->host_lock, flags);
693 my_done(shpnt, DID_NO_CONNECT << 16);
694 spin_unlock_irqrestore(shpnt->host_lock, flags);
695 return IRQ_HANDLED;
696 } else {
697#if EVERY_ACCESS
698 printk(" AltSel ");
699#endif
700 /* Stop arbitration and enable parity */
701 outb(0x10 | PARITY_MASK, TMC_Cntl_port);
702 }
703 }
704 current_SC->SCp.phase = in_other;
705 outb(0x90 | FIFO_COUNT, Interrupt_Cntl_port);
706 outb(0x80, SCSI_Cntl_port);
707#if DEBUG_RACE
708 in_interrupt_flag = 0;
709#endif
710 return IRQ_HANDLED;
711 }
712
713 /* current_SC->SCp.phase == in_other: this is the body of the routine */
714
715 status = inb(SCSI_Status_port);
716
717 if (status & 0x10) { /* REQ */
718
719 switch (status & 0x0e) {
720
721 case 0x08: /* COMMAND OUT */
722 outb(current_SC->cmnd[current_SC->SCp.sent_command++], Write_SCSI_Data_port);
723#if EVERY_ACCESS
724 printk("CMD = %x,", current_SC->cmnd[current_SC->SCp.sent_command - 1]);
725#endif
726 break;
727 case 0x00: /* DATA OUT -- tmc18c50/tmc18c30 only */
728 if (chip != tmc1800 && !current_SC->SCp.have_data_in) {
729 current_SC->SCp.have_data_in = -1;
730 outb(0xd0 | PARITY_MASK, TMC_Cntl_port);
731 }
732 break;
733 case 0x04: /* DATA IN -- tmc18c50/tmc18c30 only */
734 if (chip != tmc1800 && !current_SC->SCp.have_data_in) {
735 current_SC->SCp.have_data_in = 1;
736 outb(0x90 | PARITY_MASK, TMC_Cntl_port);
737 }
738 break;
739 case 0x0c: /* STATUS IN */
740 current_SC->SCp.Status = inb(Read_SCSI_Data_port);
741#if EVERY_ACCESS
742 printk("Status = %x, ", current_SC->SCp.Status);
743#endif
744#if ERRORS_ONLY
745 if (current_SC->SCp.Status && current_SC->SCp.Status != 2 && current_SC->SCp.Status != 8) {
746 printk("ERROR fd_mcs: target = %d, command = %x, status = %x\n", current_SC->device->id, current_SC->cmnd[0], current_SC->SCp.Status);
747 }
748#endif
749 break;
750 case 0x0a: /* MESSAGE OUT */
751 outb(MESSAGE_REJECT, Write_SCSI_Data_port); /* Reject */
752 break;
753 case 0x0e: /* MESSAGE IN */
754 current_SC->SCp.Message = inb(Read_SCSI_Data_port);
755#if EVERY_ACCESS
756 printk("Message = %x, ", current_SC->SCp.Message);
757#endif
758 if (!current_SC->SCp.Message)
759 ++done;
760#if DEBUG_MESSAGES || EVERY_ACCESS
761 if (current_SC->SCp.Message) {
762 printk("fd_mcs: message = %x\n", current_SC->SCp.Message);
763 }
764#endif
765 break;
766 }
767 }
768
769 if (chip == tmc1800 && !current_SC->SCp.have_data_in && (current_SC->SCp.sent_command >= current_SC->cmd_len)) {
770 /* We have to get the FIFO direction
771 correct, so I've made a table based
772 on the SCSI Standard of which commands
773 appear to require a DATA OUT phase.
774 */
775 /*
776 p. 94: Command for all device types
777 CHANGE DEFINITION 40 DATA OUT
778 COMPARE 39 DATA OUT
779 COPY 18 DATA OUT
780 COPY AND VERIFY 3a DATA OUT
781 INQUIRY 12
782 LOG SELECT 4c DATA OUT
783 LOG SENSE 4d
784 MODE SELECT (6) 15 DATA OUT
785 MODE SELECT (10) 55 DATA OUT
786 MODE SENSE (6) 1a
787 MODE SENSE (10) 5a
788 READ BUFFER 3c
789 RECEIVE DIAGNOSTIC RESULTS 1c
790 REQUEST SENSE 03
791 SEND DIAGNOSTIC 1d DATA OUT
792 TEST UNIT READY 00
793 WRITE BUFFER 3b DATA OUT
794
795 p.178: Commands for direct-access devices (not listed on p. 94)
796 FORMAT UNIT 04 DATA OUT
797 LOCK-UNLOCK CACHE 36
798 PRE-FETCH 34
799 PREVENT-ALLOW MEDIUM REMOVAL 1e
800 READ (6)/RECEIVE 08
801 READ (10) 3c
802 READ CAPACITY 25
803 READ DEFECT DATA (10) 37
804 READ LONG 3e
805 REASSIGN BLOCKS 07 DATA OUT
806 RELEASE 17
807 RESERVE 16 DATA OUT
808 REZERO UNIT/REWIND 01
809 SEARCH DATA EQUAL (10) 31 DATA OUT
810 SEARCH DATA HIGH (10) 30 DATA OUT
811 SEARCH DATA LOW (10) 32 DATA OUT
812 SEEK (6) 0b
813 SEEK (10) 2b
814 SET LIMITS (10) 33
815 START STOP UNIT 1b
816 SYNCHRONIZE CACHE 35
817 VERIFY (10) 2f
818 WRITE (6)/PRINT/SEND 0a DATA OUT
819 WRITE (10)/SEND 2a DATA OUT
820 WRITE AND VERIFY (10) 2e DATA OUT
821 WRITE LONG 3f DATA OUT
822 WRITE SAME 41 DATA OUT ?
823
824 p. 261: Commands for sequential-access devices (not previously listed)
825 ERASE 19
826 LOAD UNLOAD 1b
827 LOCATE 2b
828 READ BLOCK LIMITS 05
829 READ POSITION 34
830 READ REVERSE 0f
831 RECOVER BUFFERED DATA 14
832 SPACE 11
833 WRITE FILEMARKS 10 ?
834
835 p. 298: Commands for printer devices (not previously listed)
836 ****** NOT SUPPORTED BY THIS DRIVER, since 0b is SEEK (6) *****
837 SLEW AND PRINT 0b DATA OUT -- same as seek
838 STOP PRINT 1b
839 SYNCHRONIZE BUFFER 10
840
841 p. 315: Commands for processor devices (not previously listed)
842
843 p. 321: Commands for write-once devices (not previously listed)
844 MEDIUM SCAN 38
845 READ (12) a8
846 SEARCH DATA EQUAL (12) b1 DATA OUT
847 SEARCH DATA HIGH (12) b0 DATA OUT
848 SEARCH DATA LOW (12) b2 DATA OUT
849 SET LIMITS (12) b3
850 VERIFY (12) af
851 WRITE (12) aa DATA OUT
852 WRITE AND VERIFY (12) ae DATA OUT
853
854 p. 332: Commands for CD-ROM devices (not previously listed)
855 PAUSE/RESUME 4b
856 PLAY AUDIO (10) 45
857 PLAY AUDIO (12) a5
858 PLAY AUDIO MSF 47
859 PLAY TRACK RELATIVE (10) 49
860 PLAY TRACK RELATIVE (12) a9
861 READ HEADER 44
862 READ SUB-CHANNEL 42
863 READ TOC 43
864
865 p. 370: Commands for scanner devices (not previously listed)
866 GET DATA BUFFER STATUS 34
867 GET WINDOW 25
868 OBJECT POSITION 31
869 SCAN 1b
870 SET WINDOW 24 DATA OUT
871
872 p. 391: Commands for optical memory devices (not listed)
873 ERASE (10) 2c
874 ERASE (12) ac
875 MEDIUM SCAN 38 DATA OUT
876 READ DEFECT DATA (12) b7
877 READ GENERATION 29
878 READ UPDATED BLOCK 2d
879 UPDATE BLOCK 3d DATA OUT
880
881 p. 419: Commands for medium changer devices (not listed)
882 EXCHANGE MEDIUM 46
883 INITIALIZE ELEMENT STATUS 07
884 MOVE MEDIUM a5
885 POSITION TO ELEMENT 2b
886 READ ELEMENT STATUS b8
887 REQUEST VOL. ELEMENT ADDRESS b5
888 SEND VOLUME TAG b6 DATA OUT
889
890 p. 454: Commands for communications devices (not listed previously)
891 GET MESSAGE (6) 08
892 GET MESSAGE (10) 28
893 GET MESSAGE (12) a8
894 */
895
896 switch (current_SC->cmnd[0]) {
897 case CHANGE_DEFINITION:
898 case COMPARE:
899 case COPY:
900 case COPY_VERIFY:
901 case LOG_SELECT:
902 case MODE_SELECT:
903 case MODE_SELECT_10:
904 case SEND_DIAGNOSTIC:
905 case WRITE_BUFFER:
906
907 case FORMAT_UNIT:
908 case REASSIGN_BLOCKS:
909 case RESERVE:
910 case SEARCH_EQUAL:
911 case SEARCH_HIGH:
912 case SEARCH_LOW:
913 case WRITE_6:
914 case WRITE_10:
915 case WRITE_VERIFY:
916 case 0x3f:
917 case 0x41:
918
919 case 0xb1:
920 case 0xb0:
921 case 0xb2:
922 case 0xaa:
923 case 0xae:
924
925 case 0x24:
926
927 case 0x38:
928 case 0x3d:
929
930 case 0xb6:
931
932 case 0xea: /* alternate number for WRITE LONG */
933
934 current_SC->SCp.have_data_in = -1;
935 outb(0xd0 | PARITY_MASK, TMC_Cntl_port);
936 break;
937
938 case 0x00:
939 default:
940
941 current_SC->SCp.have_data_in = 1;
942 outb(0x90 | PARITY_MASK, TMC_Cntl_port);
943 break;
944 }
945 }
946
947 if (current_SC->SCp.have_data_in == -1) { /* DATA OUT */
948 while ((data_count = FIFO_Size - inw(FIFO_Data_Count_port)) > 512) {
949#if EVERY_ACCESS
950 printk("DC=%d, ", data_count);
951#endif
952 if (data_count > current_SC->SCp.this_residual)
953 data_count = current_SC->SCp.this_residual;
954 if (data_count > 0) {
955#if EVERY_ACCESS
956 printk("%d OUT, ", data_count);
957#endif
958 if (data_count == 1) {
959 Bytes_Written++;
960
961 outb(*current_SC->SCp.ptr++, Write_FIFO_port);
962 --current_SC->SCp.this_residual;
963 } else {
964 data_count >>= 1;
965 tmp_count = data_count << 1;
966 outsw(Write_FIFO_port, current_SC->SCp.ptr, data_count);
967 current_SC->SCp.ptr += tmp_count;
968 Bytes_Written += tmp_count;
969 current_SC->SCp.this_residual -= tmp_count;
970 }
971 }
972 if (!current_SC->SCp.this_residual) {
973 if (current_SC->SCp.buffers_residual) {
974 --current_SC->SCp.buffers_residual;
975 ++current_SC->SCp.buffer;
976 current_SC->SCp.ptr = sg_virt(current_SC->SCp.buffer);
977 current_SC->SCp.this_residual = current_SC->SCp.buffer->length;
978 } else
979 break;
980 }
981 }
982 } else if (current_SC->SCp.have_data_in == 1) { /* DATA IN */
983 while ((data_count = inw(FIFO_Data_Count_port)) > 0) {
984#if EVERY_ACCESS
985 printk("DC=%d, ", data_count);
986#endif
987 if (data_count > current_SC->SCp.this_residual)
988 data_count = current_SC->SCp.this_residual;
989 if (data_count) {
990#if EVERY_ACCESS
991 printk("%d IN, ", data_count);
992#endif
993 if (data_count == 1) {
994 Bytes_Read++;
995 *current_SC->SCp.ptr++ = inb(Read_FIFO_port);
996 --current_SC->SCp.this_residual;
997 } else {
998 data_count >>= 1; /* Number of words */
999 tmp_count = data_count << 1;
1000 insw(Read_FIFO_port, current_SC->SCp.ptr, data_count);
1001 current_SC->SCp.ptr += tmp_count;
1002 Bytes_Read += tmp_count;
1003 current_SC->SCp.this_residual -= tmp_count;
1004 }
1005 }
1006 if (!current_SC->SCp.this_residual && current_SC->SCp.buffers_residual) {
1007 --current_SC->SCp.buffers_residual;
1008 ++current_SC->SCp.buffer;
1009 current_SC->SCp.ptr = sg_virt(current_SC->SCp.buffer);
1010 current_SC->SCp.this_residual = current_SC->SCp.buffer->length;
1011 }
1012 }
1013 }
1014
1015 if (done) {
1016#if EVERY_ACCESS
1017 printk(" ** IN DONE %d ** ", current_SC->SCp.have_data_in);
1018#endif
1019
1020#if EVERY_ACCESS
1021 printk("BEFORE MY_DONE. . .");
1022#endif
1023 spin_lock_irqsave(shpnt->host_lock, flags);
1024 my_done(shpnt, (current_SC->SCp.Status & 0xff)
1025 | ((current_SC->SCp.Message & 0xff) << 8) | (DID_OK << 16));
1026 spin_unlock_irqrestore(shpnt->host_lock, flags);
1027#if EVERY_ACCESS
1028 printk("RETURNING.\n");
1029#endif
1030
1031 } else {
1032 if (current_SC->SCp.phase & disconnect) {
1033 outb(0xd0 | FIFO_COUNT, Interrupt_Cntl_port);
1034 outb(0x00, SCSI_Cntl_port);
1035 } else {
1036 outb(0x90 | FIFO_COUNT, Interrupt_Cntl_port);
1037 }
1038 }
1039#if DEBUG_RACE
1040 in_interrupt_flag = 0;
1041#endif
1042 return IRQ_HANDLED;
1043}
1044
1045static int fd_mcs_release(struct Scsi_Host *shpnt)
1046{
1047 int i, this_host, irq_usage;
1048
1049 release_region(shpnt->io_port, shpnt->n_io_port);
1050
1051 this_host = -1;
1052 irq_usage = 0;
1053 for (i = 0; i < found; i++) {
1054 if (shpnt == hosts[i])
1055 this_host = i;
1056 if (shpnt->irq == hosts[i]->irq)
1057 irq_usage++;
1058 }
1059
1060 /* only for the last one */
1061 if (1 == irq_usage)
1062 free_irq(shpnt->irq, hosts);
1063
1064 found--;
1065
1066 for (i = this_host; i < found; i++)
1067 hosts[i] = hosts[i + 1];
1068
1069 hosts[found] = NULL;
1070
1071 return 0;
1072}
1073
1074static int fd_mcs_queue_lck(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))
1075{
1076 struct Scsi_Host *shpnt = SCpnt->device->host;
1077
1078 if (in_command) {
1079 panic("fd_mcs: fd_mcs_queue() NOT REENTRANT!\n");
1080 }
1081#if EVERY_ACCESS
1082 printk("queue: target = %d cmnd = 0x%02x pieces = %d size = %u\n",
1083 SCpnt->target, *(unsigned char *) SCpnt->cmnd,
1084 scsi_sg_count(SCpnt), scsi_bufflen(SCpnt));
1085#endif
1086
1087 fd_mcs_make_bus_idle(shpnt);
1088
1089 SCpnt->scsi_done = done; /* Save this for the done function */
1090 current_SC = SCpnt;
1091
1092 /* Initialize static data */
1093
1094 if (scsi_bufflen(current_SC)) {
1095 current_SC->SCp.buffer = scsi_sglist(current_SC);
1096 current_SC->SCp.ptr = sg_virt(current_SC->SCp.buffer);
1097 current_SC->SCp.this_residual = current_SC->SCp.buffer->length;
1098 current_SC->SCp.buffers_residual = scsi_sg_count(current_SC) - 1;
1099 } else {
1100 current_SC->SCp.ptr = NULL;
1101 current_SC->SCp.this_residual = 0;
1102 current_SC->SCp.buffer = NULL;
1103 current_SC->SCp.buffers_residual = 0;
1104 }
1105
1106
1107 current_SC->SCp.Status = 0;
1108 current_SC->SCp.Message = 0;
1109 current_SC->SCp.have_data_in = 0;
1110 current_SC->SCp.sent_command = 0;
1111 current_SC->SCp.phase = in_arbitration;
1112
1113 /* Start arbitration */
1114 outb(0x00, Interrupt_Cntl_port);
1115 outb(0x00, SCSI_Cntl_port); /* Disable data drivers */
1116 outb(adapter_mask, SCSI_Data_NoACK_port); /* Set our id bit */
1117 in_command = 1;
1118 outb(0x20, Interrupt_Cntl_port);
1119 outb(0x14 | PARITY_MASK, TMC_Cntl_port); /* Start arbitration */
1120
1121 return 0;
1122}
1123
1124static DEF_SCSI_QCMD(fd_mcs_queue)
1125
1126#if DEBUG_ABORT || DEBUG_RESET
1127static void fd_mcs_print_info(Scsi_Cmnd * SCpnt)
1128{
1129 unsigned int imr;
1130 unsigned int irr;
1131 unsigned int isr;
1132 struct Scsi_Host *shpnt = SCpnt->host;
1133
1134 if (!SCpnt || !SCpnt->host) {
1135 printk("fd_mcs: cannot provide detailed information\n");
1136 }
1137
1138 printk("%s\n", fd_mcs_info(SCpnt->host));
1139 print_banner(SCpnt->host);
1140 switch (SCpnt->SCp.phase) {
1141 case in_arbitration:
1142 printk("arbitration ");
1143 break;
1144 case in_selection:
1145 printk("selection ");
1146 break;
1147 case in_other:
1148 printk("other ");
1149 break;
1150 default:
1151 printk("unknown ");
1152 break;
1153 }
1154
1155 printk("(%d), target = %d cmnd = 0x%02x pieces = %d size = %u\n",
1156 SCpnt->SCp.phase, SCpnt->device->id, *(unsigned char *) SCpnt->cmnd,
1157 scsi_sg_count(SCpnt), scsi_bufflen(SCpnt));
1158 printk("sent_command = %d, have_data_in = %d, timeout = %d\n", SCpnt->SCp.sent_command, SCpnt->SCp.have_data_in, SCpnt->timeout);
1159#if DEBUG_RACE
1160 printk("in_interrupt_flag = %d\n", in_interrupt_flag);
1161#endif
1162
1163 imr = (inb(0x0a1) << 8) + inb(0x21);
1164 outb(0x0a, 0xa0);
1165 irr = inb(0xa0) << 8;
1166 outb(0x0a, 0x20);
1167 irr += inb(0x20);
1168 outb(0x0b, 0xa0);
1169 isr = inb(0xa0) << 8;
1170 outb(0x0b, 0x20);
1171 isr += inb(0x20);
1172
1173 /* Print out interesting information */
1174 printk("IMR = 0x%04x", imr);
1175 if (imr & (1 << shpnt->irq))
1176 printk(" (masked)");
1177 printk(", IRR = 0x%04x, ISR = 0x%04x\n", irr, isr);
1178
1179 printk("SCSI Status = 0x%02x\n", inb(SCSI_Status_port));
1180 printk("TMC Status = 0x%02x", inb(TMC_Status_port));
1181 if (inb(TMC_Status_port) & 1)
1182 printk(" (interrupt)");
1183 printk("\n");
1184 printk("Interrupt Status = 0x%02x", inb(Interrupt_Status_port));
1185 if (inb(Interrupt_Status_port) & 0x08)
1186 printk(" (enabled)");
1187 printk("\n");
1188 if (chip == tmc18c50 || chip == tmc18c30) {
1189 printk("FIFO Status = 0x%02x\n", inb(shpnt->io_port + FIFO_Status));
1190 printk("Int. Condition = 0x%02x\n", inb(shpnt->io_port + Interrupt_Cond));
1191 }
1192 printk("Configuration 1 = 0x%02x\n", inb(shpnt->io_port + Configuration1));
1193 if (chip == tmc18c50 || chip == tmc18c30)
1194 printk("Configuration 2 = 0x%02x\n", inb(shpnt->io_port + Configuration2));
1195}
1196#endif
1197
1198static int fd_mcs_abort(Scsi_Cmnd * SCpnt)
1199{
1200 struct Scsi_Host *shpnt = SCpnt->device->host;
1201
1202 unsigned long flags;
1203#if EVERY_ACCESS || ERRORS_ONLY || DEBUG_ABORT
1204 printk("fd_mcs: abort ");
1205#endif
1206
1207 spin_lock_irqsave(shpnt->host_lock, flags);
1208 if (!in_command) {
1209#if EVERY_ACCESS || ERRORS_ONLY
1210 printk(" (not in command)\n");
1211#endif
1212 spin_unlock_irqrestore(shpnt->host_lock, flags);
1213 return FAILED;
1214 } else
1215 printk("\n");
1216
1217#if DEBUG_ABORT
1218 fd_mcs_print_info(SCpnt);
1219#endif
1220
1221 fd_mcs_make_bus_idle(shpnt);
1222
1223 current_SC->SCp.phase |= aborted;
1224
1225 current_SC->result = DID_ABORT << 16;
1226
1227 /* Aborts are not done well. . . */
1228 my_done(shpnt, DID_ABORT << 16);
1229
1230 spin_unlock_irqrestore(shpnt->host_lock, flags);
1231 return SUCCESS;
1232}
1233
1234static int fd_mcs_bus_reset(Scsi_Cmnd * SCpnt) {
1235 struct Scsi_Host *shpnt = SCpnt->device->host;
1236 unsigned long flags;
1237
1238#if DEBUG_RESET
1239 static int called_once = 0;
1240#endif
1241
1242#if ERRORS_ONLY
1243 if (SCpnt)
1244 printk("fd_mcs: SCSI Bus Reset\n");
1245#endif
1246
1247#if DEBUG_RESET
1248 if (called_once)
1249 fd_mcs_print_info(current_SC);
1250 called_once = 1;
1251#endif
1252
1253 spin_lock_irqsave(shpnt->host_lock, flags);
1254
1255 outb(1, SCSI_Cntl_port);
1256 do_pause(2);
1257 outb(0, SCSI_Cntl_port);
1258 do_pause(115);
1259 outb(0, SCSI_Mode_Cntl_port);
1260 outb(PARITY_MASK, TMC_Cntl_port);
1261
1262 spin_unlock_irqrestore(shpnt->host_lock, flags);
1263
1264 /* Unless this is the very first call (i.e., SCPnt == NULL), everything
1265 is probably hosed at this point. We will, however, try to keep
1266 things going by informing the high-level code that we need help. */
1267 return SUCCESS;
1268}
1269
1270#include <scsi/scsi_ioctl.h>
1271
1272static int fd_mcs_biosparam(struct scsi_device * disk, struct block_device *bdev,
1273 sector_t capacity, int *info_array)
1274{
1275 unsigned char *p = scsi_bios_ptable(bdev);
1276 int size = capacity;
1277
1278 /* BIOS >= 3.4 for MCA cards */
1279 /* This algorithm was provided by Future Domain (much thanks!). */
1280
1281 if (p && p[65] == 0xaa && p[64] == 0x55 /* Partition table valid */
1282 && p[4]) { /* Partition type */
1283 /* The partition table layout is as follows:
1284
1285 Start: 0x1b3h
1286 Offset: 0 = partition status
1287 1 = starting head
1288 2 = starting sector and cylinder (word, encoded)
1289 4 = partition type
1290 5 = ending head
1291 6 = ending sector and cylinder (word, encoded)
1292 8 = starting absolute sector (double word)
1293 c = number of sectors (double word)
1294 Signature: 0x1fe = 0x55aa
1295
1296 So, this algorithm assumes:
1297 1) the first partition table is in use,
1298 2) the data in the first entry is correct, and
1299 3) partitions never divide cylinders
1300
1301 Note that (1) may be FALSE for NetBSD (and other BSD flavors),
1302 as well as for Linux. Note also, that Linux doesn't pay any
1303 attention to the fields that are used by this algorithm -- it
1304 only uses the absolute sector data. Recent versions of Linux's
1305 fdisk(1) will fill this data in correctly, and forthcoming
1306 versions will check for consistency.
1307
1308 Checking for a non-zero partition type is not part of the
1309 Future Domain algorithm, but it seemed to be a reasonable thing
1310 to do, especially in the Linux and BSD worlds. */
1311
1312 info_array[0] = p[5] + 1; /* heads */
1313 info_array[1] = p[6] & 0x3f; /* sectors */
1314 } else {
1315 /* Note that this new method guarantees that there will always be
1316 less than 1024 cylinders on a platter. This is good for drives
1317 up to approximately 7.85GB (where 1GB = 1024 * 1024 kB). */
1318 if ((unsigned int) size >= 0x7e0000U)
1319 {
1320 info_array[0] = 0xff; /* heads = 255 */
1321 info_array[1] = 0x3f; /* sectors = 63 */
1322 } else if ((unsigned int) size >= 0x200000U) {
1323 info_array[0] = 0x80; /* heads = 128 */
1324 info_array[1] = 0x3f; /* sectors = 63 */
1325 } else {
1326 info_array[0] = 0x40; /* heads = 64 */
1327 info_array[1] = 0x20; /* sectors = 32 */
1328 }
1329 }
1330 /* For both methods, compute the cylinders */
1331 info_array[2] = (unsigned int) size / (info_array[0] * info_array[1]);
1332 kfree(p);
1333 return 0;
1334}
1335
1336static struct scsi_host_template driver_template = {
1337 .proc_name = "fd_mcs",
1338 .proc_info = fd_mcs_proc_info,
1339 .detect = fd_mcs_detect,
1340 .release = fd_mcs_release,
1341 .info = fd_mcs_info,
1342 .queuecommand = fd_mcs_queue,
1343 .eh_abort_handler = fd_mcs_abort,
1344 .eh_bus_reset_handler = fd_mcs_bus_reset,
1345 .bios_param = fd_mcs_biosparam,
1346 .can_queue = 1,
1347 .this_id = 7,
1348 .sg_tablesize = 64,
1349 .cmd_per_lun = 1,
1350 .use_clustering = DISABLE_CLUSTERING,
1351};
1352#include "scsi_module.c"
1353
1354MODULE_LICENSE("GPL");
diff --git a/drivers/scsi/ibmmca.c b/drivers/scsi/ibmmca.c
deleted file mode 100644
index cd09132d5d7d..000000000000
--- a/drivers/scsi/ibmmca.c
+++ /dev/null
@@ -1,2379 +0,0 @@
1/*
2 Low Level Linux Driver for the IBM Microchannel SCSI Subsystem for
3 Linux Kernel >= 2.4.0.
4 Copyright (c) 1995 Strom Systems, Inc. under the terms of the GNU
5 General Public License. Written by Martin Kolinek, December 1995.
6 Further development by: Chris Beauregard, Klaus Kudielka, Michael Lang
7 See the file Documentation/scsi/ibmmca.txt for a detailed description
8 of this driver, the commandline arguments and the history of its
9 development.
10 See the WWW-page: http://www.uni-mainz.de/~langm000/linux.html for latest
11 updates, info and ADF-files for adapters supported by this driver.
12
13 Alan Cox <alan@lxorguk.ukuu.org.uk>
14 Updated for Linux 2.5.45 to use the new error handler, cleaned up the
15 lock macros and did a few unavoidable locking tweaks, plus one locking
16 fix in the irq and completion path.
17
18 */
19
20#include <linux/module.h>
21#include <linux/kernel.h>
22#include <linux/types.h>
23#include <linux/ctype.h>
24#include <linux/string.h>
25#include <linux/interrupt.h>
26#include <linux/ioport.h>
27#include <linux/delay.h>
28#include <linux/blkdev.h>
29#include <linux/proc_fs.h>
30#include <linux/stat.h>
31#include <linux/mca.h>
32#include <linux/spinlock.h>
33#include <linux/init.h>
34
35#include <asm/io.h>
36
37#include "scsi.h"
38#include <scsi/scsi_host.h>
39
40/* Common forward declarations for all Linux-versions: */
41static int ibmmca_queuecommand (struct Scsi_Host *, struct scsi_cmnd *);
42static int ibmmca_abort (Scsi_Cmnd *);
43static int ibmmca_host_reset (Scsi_Cmnd *);
44static int ibmmca_biosparam (struct scsi_device *, struct block_device *, sector_t, int *);
45static int ibmmca_proc_info(struct Scsi_Host *shpnt, char *buffer, char **start, off_t offset, int length, int inout);
46
47
48
49/* current version of this driver-source: */
50#define IBMMCA_SCSI_DRIVER_VERSION "4.0b-ac"
51
52/* driver configuration */
53#define IM_MAX_HOSTS 8 /* maximum number of host adapters */
54#define IM_RESET_DELAY 60 /* seconds allowed for a reset */
55
56/* driver debugging - #undef all for normal operation */
57/* if defined: count interrupts and ignore this special one: */
58#undef IM_DEBUG_TIMEOUT //50
59#define TIMEOUT_PUN 0
60#define TIMEOUT_LUN 0
61/* verbose interrupt: */
62#undef IM_DEBUG_INT
63/* verbose queuecommand: */
64#undef IM_DEBUG_CMD
65/* verbose queucommand for specific SCSI-device type: */
66#undef IM_DEBUG_CMD_SPEC_DEV
67/* verbose device probing */
68#undef IM_DEBUG_PROBE
69
70/* device type that shall be displayed on syslog (only during debugging): */
71#define IM_DEBUG_CMD_DEVICE TYPE_TAPE
72
73/* relative addresses of hardware registers on a subsystem */
74#define IM_CMD_REG(h) ((h)->io_port) /*Command Interface, (4 bytes long) */
75#define IM_ATTN_REG(h) ((h)->io_port+4) /*Attention (1 byte) */
76#define IM_CTR_REG(h) ((h)->io_port+5) /*Basic Control (1 byte) */
77#define IM_INTR_REG(h) ((h)->io_port+6) /*Interrupt Status (1 byte, r/o) */
78#define IM_STAT_REG(h) ((h)->io_port+7) /*Basic Status (1 byte, read only) */
79
80/* basic I/O-port of first adapter */
81#define IM_IO_PORT 0x3540
82/* maximum number of hosts that can be found */
83#define IM_N_IO_PORT 8
84
85/*requests going into the upper nibble of the Attention register */
86/*note: the lower nibble specifies the device(0-14), or subsystem(15) */
87#define IM_IMM_CMD 0x10 /*immediate command */
88#define IM_SCB 0x30 /*Subsystem Control Block command */
89#define IM_LONG_SCB 0x40 /*long Subsystem Control Block command */
90#define IM_EOI 0xe0 /*end-of-interrupt request */
91
92/*values for bits 7,1,0 of Basic Control reg. (bits 6-2 reserved) */
93#define IM_HW_RESET 0x80 /*hardware reset */
94#define IM_ENABLE_DMA 0x02 /*enable subsystem's busmaster DMA */
95#define IM_ENABLE_INTR 0x01 /*enable interrupts to the system */
96
97/*to interpret the upper nibble of Interrupt Status register */
98/*note: the lower nibble specifies the device(0-14), or subsystem(15) */
99#define IM_SCB_CMD_COMPLETED 0x10
100#define IM_SCB_CMD_COMPLETED_WITH_RETRIES 0x50
101#define IM_LOOP_SCATTER_BUFFER_FULL 0x60
102#define IM_ADAPTER_HW_FAILURE 0x70
103#define IM_IMMEDIATE_CMD_COMPLETED 0xa0
104#define IM_CMD_COMPLETED_WITH_FAILURE 0xc0
105#define IM_CMD_ERROR 0xe0
106#define IM_SOFTWARE_SEQUENCING_ERROR 0xf0
107
108/*to interpret bits 3-0 of Basic Status register (bits 7-4 reserved) */
109#define IM_CMD_REG_FULL 0x08
110#define IM_CMD_REG_EMPTY 0x04
111#define IM_INTR_REQUEST 0x02
112#define IM_BUSY 0x01
113
114/*immediate commands (word written into low 2 bytes of command reg) */
115#define IM_RESET_IMM_CMD 0x0400
116#define IM_FEATURE_CTR_IMM_CMD 0x040c
117#define IM_DMA_PACING_IMM_CMD 0x040d
118#define IM_ASSIGN_IMM_CMD 0x040e
119#define IM_ABORT_IMM_CMD 0x040f
120#define IM_FORMAT_PREP_IMM_CMD 0x0417
121
122/*SCB (Subsystem Control Block) structure */
123struct im_scb {
124 unsigned short command; /*command word (read, etc.) */
125 unsigned short enable; /*enable word, modifies cmd */
126 union {
127 unsigned long log_blk_adr; /*block address on SCSI device */
128 unsigned char scsi_cmd_length; /*6,10,12, for other scsi cmd */
129 } u1;
130 unsigned long sys_buf_adr; /*physical system memory adr */
131 unsigned long sys_buf_length; /*size of sys mem buffer */
132 unsigned long tsb_adr; /*Termination Status Block adr */
133 unsigned long scb_chain_adr; /*optional SCB chain address */
134 union {
135 struct {
136 unsigned short count; /*block count, on SCSI device */
137 unsigned short length; /*block length, on SCSI device */
138 } blk;
139 unsigned char scsi_command[12]; /*other scsi command */
140 } u2;
141};
142
143/*structure scatter-gather element (for list of system memory areas) */
144struct im_sge {
145 void *address;
146 unsigned long byte_length;
147};
148
149/*structure returned by a get_pos_info command: */
150struct im_pos_info {
151 unsigned short pos_id; /* adapter id */
152 unsigned char pos_3a; /* pos 3 (if pos 6 = 0) */
153 unsigned char pos_2; /* pos 2 */
154 unsigned char int_level; /* interrupt level IRQ 11 or 14 */
155 unsigned char pos_4a; /* pos 4 (if pos 6 = 0) */
156 unsigned short connector_size; /* MCA connector size: 16 or 32 Bit */
157 unsigned char num_luns; /* number of supported luns per device */
158 unsigned char num_puns; /* number of supported puns */
159 unsigned char pacing_factor; /* pacing factor */
160 unsigned char num_ldns; /* number of ldns available */
161 unsigned char eoi_off; /* time EOI and interrupt inactive */
162 unsigned char max_busy; /* time between reset and busy on */
163 unsigned short cache_stat; /* ldn cachestat. Bit=1 = not cached */
164 unsigned short retry_stat; /* retry status of ldns. Bit=1=disabled */
165 unsigned char pos_4b; /* pos 4 (if pos 6 = 1) */
166 unsigned char pos_3b; /* pos 3 (if pos 6 = 1) */
167 unsigned char pos_6; /* pos 6 */
168 unsigned char pos_5; /* pos 5 */
169 unsigned short max_overlap; /* maximum overlapping requests */
170 unsigned short num_bus; /* number of SCSI-busses */
171};
172
173/*values for SCB command word */
174#define IM_NO_SYNCHRONOUS 0x0040 /*flag for any command */
175#define IM_NO_DISCONNECT 0x0080 /*flag for any command */
176#define IM_READ_DATA_CMD 0x1c01
177#define IM_WRITE_DATA_CMD 0x1c02
178#define IM_READ_VERIFY_CMD 0x1c03
179#define IM_WRITE_VERIFY_CMD 0x1c04
180#define IM_REQUEST_SENSE_CMD 0x1c08
181#define IM_READ_CAPACITY_CMD 0x1c09
182#define IM_DEVICE_INQUIRY_CMD 0x1c0b
183#define IM_READ_LOGICAL_CMD 0x1c2a
184#define IM_OTHER_SCSI_CMD_CMD 0x241f
185
186/* unused, but supported, SCB commands */
187#define IM_GET_COMMAND_COMPLETE_STATUS_CMD 0x1c07 /* command status */
188#define IM_GET_POS_INFO_CMD 0x1c0a /* returns neat stuff */
189#define IM_READ_PREFETCH_CMD 0x1c31 /* caching controller only */
190#define IM_FOMAT_UNIT_CMD 0x1c16 /* format unit */
191#define IM_REASSIGN_BLOCK_CMD 0x1c18 /* in case of error */
192
193/*values to set bits in the enable word of SCB */
194#define IM_READ_CONTROL 0x8000
195#define IM_REPORT_TSB_ONLY_ON_ERROR 0x4000
196#define IM_RETRY_ENABLE 0x2000
197#define IM_POINTER_TO_LIST 0x1000
198#define IM_SUPRESS_EXCEPTION_SHORT 0x0400
199#define IM_BYPASS_BUFFER 0x0200
200#define IM_CHAIN_ON_NO_ERROR 0x0001
201
202/*TSB (Termination Status Block) structure */
203struct im_tsb {
204 unsigned short end_status;
205 unsigned short reserved1;
206 unsigned long residual_byte_count;
207 unsigned long sg_list_element_adr;
208 unsigned short status_length;
209 unsigned char dev_status;
210 unsigned char cmd_status;
211 unsigned char dev_error;
212 unsigned char cmd_error;
213 unsigned short reserved2;
214 unsigned short reserved3;
215 unsigned short low_of_last_scb_adr;
216 unsigned short high_of_last_scb_adr;
217};
218
219/*subsystem uses interrupt request level 14 */
220#define IM_IRQ 14
221/*SCSI-2 F/W may evade to interrupt 11 */
222#define IM_IRQ_FW 11
223
224/* Model 95 has an additional alphanumeric display, which can be used
225 to display SCSI-activities. 8595 models do not have any disk led, which
226 makes this feature quite useful.
227 The regular PS/2 disk led is turned on/off by bits 6,7 of system
228 control port. */
229
230/* LED display-port (actually, last LED on display) */
231#define MOD95_LED_PORT 0x108
232/* system-control-register of PS/2s with diskindicator */
233#define PS2_SYS_CTR 0x92
234/* activity displaying methods */
235#define LED_DISP 1
236#define LED_ADISP 2
237#define LED_ACTIVITY 4
238/* failed intr */
239#define CMD_FAIL 255
240
241/* The SCSI-ID(!) of the accessed SCSI-device is shown on PS/2-95 machines' LED
242 displays. ldn is no longer displayed here, because the ldn mapping is now
243 done dynamically and the ldn <-> pun,lun maps can be looked-up at boottime
244 or during uptime in /proc/scsi/ibmmca/<host_no> in case of trouble,
245 interest, debugging or just for having fun. The left number gives the
246 host-adapter number and the right shows the accessed SCSI-ID. */
247
248/* display_mode is set by the ibmmcascsi= command line arg */
249static int display_mode = 0;
250/* set default adapter timeout */
251static unsigned int adapter_timeout = 45;
252/* for probing on feature-command: */
253static unsigned int global_command_error_excuse = 0;
254/* global setting by command line for adapter_speed */
255static int global_adapter_speed = 0; /* full speed by default */
256
257/* Panel / LED on, do it right for F/W addressin, too. adisplay will
258 * just ignore ids>7, as the panel has only 7 digits available */
259#define PS2_DISK_LED_ON(ad,id) { if (display_mode & LED_DISP) { if (id>9) \
260 outw((ad+48)|((id+55)<<8), MOD95_LED_PORT ); else \
261 outw((ad+48)|((id+48)<<8), MOD95_LED_PORT ); } else \
262 if (display_mode & LED_ADISP) { if (id<7) outb((char)(id+48),MOD95_LED_PORT+1+id); \
263 outb((char)(ad+48), MOD95_LED_PORT); } \
264 if ((display_mode & LED_ACTIVITY)||(!display_mode)) \
265 outb(inb(PS2_SYS_CTR) | 0xc0, PS2_SYS_CTR); }
266
267/* Panel / LED off */
268/* bug fixed, Dec 15, 1997, where | was replaced by & here */
269#define PS2_DISK_LED_OFF() { if (display_mode & LED_DISP) \
270 outw(0x2020, MOD95_LED_PORT ); else if (display_mode & LED_ADISP) { \
271 outl(0x20202020,MOD95_LED_PORT); outl(0x20202020,MOD95_LED_PORT+4); } \
272 if ((display_mode & LED_ACTIVITY)||(!display_mode)) \
273 outb(inb(PS2_SYS_CTR) & 0x3f, PS2_SYS_CTR); }
274
275/* types of different supported hardware that goes to hostdata special */
276#define IBM_SCSI2_FW 0
277#define IBM_7568_WCACHE 1
278#define IBM_EXP_UNIT 2
279#define IBM_SCSI_WCACHE 3
280#define IBM_SCSI 4
281#define IBM_INTEGSCSI 5
282
283/* other special flags for hostdata structure */
284#define FORCED_DETECTION 100
285#define INTEGRATED_SCSI 101
286
287/* List of possible IBM-SCSI-adapters */
288static short ibmmca_id_table[] = {
289 0x8efc,
290 0x8efd,
291 0x8ef8,
292 0x8eff,
293 0x8efe,
294 /* No entry for integrated SCSI, that's part of the register */
295 0
296};
297
298static const char *ibmmca_description[] = {
299 "IBM SCSI-2 F/W Adapter", /* special = 0 */
300 "IBM 7568 Industrial Computer SCSI Adapter w/Cache", /* special = 1 */
301 "IBM Expansion Unit SCSI Controller", /* special = 2 */
302 "IBM SCSI Adapter w/Cache", /* special = 3 */
303 "IBM SCSI Adapter", /* special = 4 */
304 "IBM Integrated SCSI Controller", /* special = 5 */
305};
306
307/* Max number of logical devices (can be up from 0 to 14). 15 is the address
308of the adapter itself. */
309#define MAX_LOG_DEV 15
310
311/*local data for a logical device */
312struct logical_device {
313 struct im_scb scb; /* SCSI-subsystem-control-block structure */
314 struct im_tsb tsb; /* SCSI command complete status block structure */
315 struct im_sge sge[16]; /* scatter gather list structure */
316 unsigned char buf[256]; /* SCSI command return data buffer */
317 Scsi_Cmnd *cmd; /* SCSI-command that is currently in progress */
318 int device_type; /* type of the SCSI-device. See include/scsi/scsi.h
319 for interpretation of the possible values */
320 int block_length; /* blocksize of a particular logical SCSI-device */
321 int cache_flag; /* 1 if this is uncached, 0 if cache is present for ldn */
322 int retry_flag; /* 1 if adapter retry is disabled, 0 if enabled */
323};
324
325/* statistics of the driver during operations (for proc_info) */
326struct Driver_Statistics {
327 /* SCSI statistics on the adapter */
328 int ldn_access[MAX_LOG_DEV + 1]; /* total accesses on a ldn */
329 int ldn_read_access[MAX_LOG_DEV + 1]; /* total read-access on a ldn */
330 int ldn_write_access[MAX_LOG_DEV + 1]; /* total write-access on a ldn */
331 int ldn_inquiry_access[MAX_LOG_DEV + 1]; /* total inquiries on a ldn */
332 int ldn_modeselect_access[MAX_LOG_DEV + 1]; /* total mode selects on ldn */
333 int scbs; /* short SCBs queued */
334 int long_scbs; /* long SCBs queued */
335 int total_accesses; /* total accesses on all ldns */
336 int total_interrupts; /* total interrupts (should be
337 same as total_accesses) */
338 int total_errors; /* command completed with error */
339 /* dynamical assignment statistics */
340 int total_scsi_devices; /* number of physical pun,lun */
341 int dyn_flag; /* flag showing dynamical mode */
342 int dynamical_assignments; /* number of remappings of ldns */
343 int ldn_assignments[MAX_LOG_DEV + 1]; /* number of remappings of each
344 ldn */
345};
346
347/* data structure for each host adapter */
348struct ibmmca_hostdata {
349 /* array of logical devices: */
350 struct logical_device _ld[MAX_LOG_DEV + 1];
351 /* array to convert (pun, lun) into logical device number: */
352 unsigned char _get_ldn[16][8];
353 /*array that contains the information about the physical SCSI-devices
354 attached to this host adapter: */
355 unsigned char _get_scsi[16][8];
356 /* used only when checking logical devices: */
357 int _local_checking_phase_flag;
358 /* report received interrupt: */
359 int _got_interrupt;
360 /* report termination-status of SCSI-command: */
361 int _stat_result;
362 /* reset status (used only when doing reset): */
363 int _reset_status;
364 /* code of the last SCSI command (needed for panic info): */
365 int _last_scsi_command[MAX_LOG_DEV + 1];
366 /* identifier of the last SCSI-command type */
367 int _last_scsi_type[MAX_LOG_DEV + 1];
368 /* last blockcount */
369 int _last_scsi_blockcount[MAX_LOG_DEV + 1];
370 /* last locgical block address */
371 unsigned long _last_scsi_logical_block[MAX_LOG_DEV + 1];
372 /* Counter that points on the next reassignable ldn for dynamical
373 remapping. The default value is 7, that is the first reassignable
374 number in the list at boottime: */
375 int _next_ldn;
376 /* Statistics-structure for this IBM-SCSI-host: */
377 struct Driver_Statistics _IBM_DS;
378 /* This hostadapters pos-registers pos2 until pos6 */
379 unsigned int _pos[8];
380 /* assign a special variable, that contains dedicated info about the
381 adaptertype */
382 int _special;
383 /* connector size on the MCA bus */
384 int _connector_size;
385 /* synchronous SCSI transfer rate bitpattern */
386 int _adapter_speed;
387};
388
389/* macros to access host data structure */
390#define subsystem_pun(h) ((h)->this_id)
391#define subsystem_maxid(h) ((h)->max_id)
392#define ld(h) (((struct ibmmca_hostdata *) (h)->hostdata)->_ld)
393#define get_ldn(h) (((struct ibmmca_hostdata *) (h)->hostdata)->_get_ldn)
394#define get_scsi(h) (((struct ibmmca_hostdata *) (h)->hostdata)->_get_scsi)
395#define local_checking_phase_flag(h) (((struct ibmmca_hostdata *) (h)->hostdata)->_local_checking_phase_flag)
396#define got_interrupt(h) (((struct ibmmca_hostdata *) (h)->hostdata)->_got_interrupt)
397#define stat_result(h) (((struct ibmmca_hostdata *) (h)->hostdata)->_stat_result)
398#define reset_status(h) (((struct ibmmca_hostdata *) (h)->hostdata)->_reset_status)
399#define last_scsi_command(h) (((struct ibmmca_hostdata *) (h)->hostdata)->_last_scsi_command)
400#define last_scsi_type(h) (((struct ibmmca_hostdata *) (h)->hostdata)->_last_scsi_type)
401#define last_scsi_blockcount(h) (((struct ibmmca_hostdata *) (h)->hostdata)->_last_scsi_blockcount)
402#define last_scsi_logical_block(h) (((struct ibmmca_hostdata *) (h)->hostdata)->_last_scsi_logical_block)
403#define last_scsi_type(h) (((struct ibmmca_hostdata *) (h)->hostdata)->_last_scsi_type)
404#define next_ldn(h) (((struct ibmmca_hostdata *) (h)->hostdata)->_next_ldn)
405#define IBM_DS(h) (((struct ibmmca_hostdata *) (h)->hostdata)->_IBM_DS)
406#define special(h) (((struct ibmmca_hostdata *) (h)->hostdata)->_special)
407#define subsystem_connector_size(h) (((struct ibmmca_hostdata *) (h)->hostdata)->_connector_size)
408#define adapter_speed(h) (((struct ibmmca_hostdata *) (h)->hostdata)->_adapter_speed)
409#define pos2(h) (((struct ibmmca_hostdata *) (h)->hostdata)->_pos[2])
410#define pos3(h) (((struct ibmmca_hostdata *) (h)->hostdata)->_pos[3])
411#define pos4(h) (((struct ibmmca_hostdata *) (h)->hostdata)->_pos[4])
412#define pos5(h) (((struct ibmmca_hostdata *) (h)->hostdata)->_pos[5])
413#define pos6(h) (((struct ibmmca_hostdata *) (h)->hostdata)->_pos[6])
414
415/* Define a arbitrary number as subsystem-marker-type. This number is, as
416 described in the ANSI-SCSI-standard, not occupied by other device-types. */
417#define TYPE_IBM_SCSI_ADAPTER 0x2F
418
419/* Define 0xFF for no device type, because this type is not defined within
420 the ANSI-SCSI-standard, therefore, it can be used and should not cause any
421 harm. */
422#define TYPE_NO_DEVICE 0xFF
423
424/* define medium-changer. If this is not defined previously, e.g. Linux
425 2.0.x, define this type here. */
426#ifndef TYPE_MEDIUM_CHANGER
427#define TYPE_MEDIUM_CHANGER 0x08
428#endif
429
430/* define possible operations for the immediate_assign command */
431#define SET_LDN 0
432#define REMOVE_LDN 1
433
434/* ldn which is used to probe the SCSI devices */
435#define PROBE_LDN 0
436
437/* reset status flag contents */
438#define IM_RESET_NOT_IN_PROGRESS 0
439#define IM_RESET_IN_PROGRESS 1
440#define IM_RESET_FINISHED_OK 2
441#define IM_RESET_FINISHED_FAIL 3
442#define IM_RESET_NOT_IN_PROGRESS_NO_INT 4
443#define IM_RESET_FINISHED_OK_NO_INT 5
444
445/* define undefined SCSI-command */
446#define NO_SCSI 0xffff
447
448/*-----------------------------------------------------------------------*/
449
450/* if this is nonzero, ibmmcascsi option has been passed to the kernel */
451static int io_port[IM_MAX_HOSTS] = { 0, 0, 0, 0, 0, 0, 0, 0 };
452static int scsi_id[IM_MAX_HOSTS] = { 7, 7, 7, 7, 7, 7, 7, 7 };
453
454/* fill module-parameters only, when this define is present.
455 (that is kernel version 2.1.x) */
456#if defined(MODULE)
457static char *boot_options = NULL;
458module_param(boot_options, charp, 0);
459module_param_array(io_port, int, NULL, 0);
460module_param_array(scsi_id, int, NULL, 0);
461
462MODULE_LICENSE("GPL");
463#endif
464/*counter of concurrent disk read/writes, to turn on/off disk led */
465static int disk_rw_in_progress = 0;
466
467static unsigned int pos[8]; /* whole pos register-line for diagnosis */
468/* Taking into account the additions, made by ZP Gu.
469 * This selects now the preset value from the configfile and
470 * offers the 'normal' commandline option to be accepted */
471#ifdef CONFIG_IBMMCA_SCSI_ORDER_STANDARD
472static char ibm_ansi_order = 1;
473#else
474static char ibm_ansi_order = 0;
475#endif
476
477static void issue_cmd(struct Scsi_Host *, unsigned long, unsigned char);
478static void internal_done(Scsi_Cmnd * cmd);
479static void check_devices(struct Scsi_Host *, int);
480static int immediate_assign(struct Scsi_Host *, unsigned int, unsigned int, unsigned int, unsigned int);
481static int immediate_feature(struct Scsi_Host *, unsigned int, unsigned int);
482#ifdef CONFIG_IBMMCA_SCSI_DEV_RESET
483static int immediate_reset(struct Scsi_Host *, unsigned int);
484#endif
485static int device_inquiry(struct Scsi_Host *, int);
486static int read_capacity(struct Scsi_Host *, int);
487static int get_pos_info(struct Scsi_Host *);
488static char *ti_p(int);
489static char *ti_l(int);
490static char *ibmrate(unsigned int, int);
491static int probe_display(int);
492static int probe_bus_mode(struct Scsi_Host *);
493static int device_exists(struct Scsi_Host *, int, int *, int *);
494static int option_setup(char *);
495/* local functions needed for proc_info */
496static int ldn_access_load(struct Scsi_Host *, int);
497static int ldn_access_total_read_write(struct Scsi_Host *);
498
499static irqreturn_t interrupt_handler(int irq, void *dev_id)
500{
501 unsigned int intr_reg;
502 unsigned int cmd_result;
503 unsigned int ldn;
504 unsigned long flags;
505 Scsi_Cmnd *cmd;
506 int lastSCSI;
507 struct device *dev = dev_id;
508 struct Scsi_Host *shpnt = dev_get_drvdata(dev);
509
510 spin_lock_irqsave(shpnt->host_lock, flags);
511
512 if(!(inb(IM_STAT_REG(shpnt)) & IM_INTR_REQUEST)) {
513 spin_unlock_irqrestore(shpnt->host_lock, flags);
514 return IRQ_NONE;
515 }
516
517 /* the reset-function already did all the job, even ints got
518 renabled on the subsystem, so just return */
519 if ((reset_status(shpnt) == IM_RESET_NOT_IN_PROGRESS_NO_INT) || (reset_status(shpnt) == IM_RESET_FINISHED_OK_NO_INT)) {
520 reset_status(shpnt) = IM_RESET_NOT_IN_PROGRESS;
521 spin_unlock_irqrestore(shpnt->host_lock, flags);
522 return IRQ_HANDLED;
523 }
524
525 /*must wait for attention reg not busy, then send EOI to subsystem */
526 while (1) {
527 if (!(inb(IM_STAT_REG(shpnt)) & IM_BUSY))
528 break;
529 cpu_relax();
530 }
531
532 /*get command result and logical device */
533 intr_reg = (unsigned char) (inb(IM_INTR_REG(shpnt)));
534 cmd_result = intr_reg & 0xf0;
535 ldn = intr_reg & 0x0f;
536 /* get the last_scsi_command here */
537 lastSCSI = last_scsi_command(shpnt)[ldn];
538 outb(IM_EOI | ldn, IM_ATTN_REG(shpnt));
539
540 /*these should never happen (hw fails, or a local programming bug) */
541 if (!global_command_error_excuse) {
542 switch (cmd_result) {
543 /* Prevent from Ooopsing on error to show the real reason */
544 case IM_ADAPTER_HW_FAILURE:
545 case IM_SOFTWARE_SEQUENCING_ERROR:
546 case IM_CMD_ERROR:
547 printk(KERN_ERR "IBM MCA SCSI: Fatal Subsystem ERROR!\n");
548 printk(KERN_ERR " Last cmd=0x%x, ena=%x, len=", lastSCSI, ld(shpnt)[ldn].scb.enable);
549 if (ld(shpnt)[ldn].cmd)
550 printk("%ld/%ld,", (long) (scsi_bufflen(ld(shpnt)[ldn].cmd)), (long) (ld(shpnt)[ldn].scb.sys_buf_length));
551 else
552 printk("none,");
553 if (ld(shpnt)[ldn].cmd)
554 printk("Blocksize=%d", ld(shpnt)[ldn].scb.u2.blk.length);
555 else
556 printk("Blocksize=none");
557 printk(", host=%p, ldn=0x%x\n", shpnt, ldn);
558 if (ld(shpnt)[ldn].cmd) {
559 printk(KERN_ERR "Blockcount=%d/%d\n", last_scsi_blockcount(shpnt)[ldn], ld(shpnt)[ldn].scb.u2.blk.count);
560 printk(KERN_ERR "Logical block=%lx/%lx\n", last_scsi_logical_block(shpnt)[ldn], ld(shpnt)[ldn].scb.u1.log_blk_adr);
561 }
562 printk(KERN_ERR "Reason given: %s\n", (cmd_result == IM_ADAPTER_HW_FAILURE) ? "HARDWARE FAILURE" : (cmd_result == IM_SOFTWARE_SEQUENCING_ERROR) ? "SOFTWARE SEQUENCING ERROR" : (cmd_result == IM_CMD_ERROR) ? "COMMAND ERROR" : "UNKNOWN");
563 /* if errors appear, enter this section to give detailed info */
564 printk(KERN_ERR "IBM MCA SCSI: Subsystem Error-Status follows:\n");
565 printk(KERN_ERR " Command Type................: %x\n", last_scsi_type(shpnt)[ldn]);
566 printk(KERN_ERR " Attention Register..........: %x\n", inb(IM_ATTN_REG(shpnt)));
567 printk(KERN_ERR " Basic Control Register......: %x\n", inb(IM_CTR_REG(shpnt)));
568 printk(KERN_ERR " Interrupt Status Register...: %x\n", intr_reg);
569 printk(KERN_ERR " Basic Status Register.......: %x\n", inb(IM_STAT_REG(shpnt)));
570 if ((last_scsi_type(shpnt)[ldn] == IM_SCB) || (last_scsi_type(shpnt)[ldn] == IM_LONG_SCB)) {
571 printk(KERN_ERR " SCB-Command.................: %x\n", ld(shpnt)[ldn].scb.command);
572 printk(KERN_ERR " SCB-Enable..................: %x\n", ld(shpnt)[ldn].scb.enable);
573 printk(KERN_ERR " SCB-logical block address...: %lx\n", ld(shpnt)[ldn].scb.u1.log_blk_adr);
574 printk(KERN_ERR " SCB-system buffer address...: %lx\n", ld(shpnt)[ldn].scb.sys_buf_adr);
575 printk(KERN_ERR " SCB-system buffer length....: %lx\n", ld(shpnt)[ldn].scb.sys_buf_length);
576 printk(KERN_ERR " SCB-tsb address.............: %lx\n", ld(shpnt)[ldn].scb.tsb_adr);
577 printk(KERN_ERR " SCB-Chain address...........: %lx\n", ld(shpnt)[ldn].scb.scb_chain_adr);
578 printk(KERN_ERR " SCB-block count.............: %x\n", ld(shpnt)[ldn].scb.u2.blk.count);
579 printk(KERN_ERR " SCB-block length............: %x\n", ld(shpnt)[ldn].scb.u2.blk.length);
580 }
581 printk(KERN_ERR " Send this report to the maintainer.\n");
582 panic("IBM MCA SCSI: Fatal error message from the subsystem (0x%X,0x%X)!\n", lastSCSI, cmd_result);
583 break;
584 }
585 } else {
586 /* The command error handling is made silent, but we tell the
587 * calling function, that there is a reported error from the
588 * adapter. */
589 switch (cmd_result) {
590 case IM_ADAPTER_HW_FAILURE:
591 case IM_SOFTWARE_SEQUENCING_ERROR:
592 case IM_CMD_ERROR:
593 global_command_error_excuse = CMD_FAIL;
594 break;
595 default:
596 global_command_error_excuse = 0;
597 break;
598 }
599 }
600 /* if no panic appeared, increase the interrupt-counter */
601 IBM_DS(shpnt).total_interrupts++;
602 /*only for local checking phase */
603 if (local_checking_phase_flag(shpnt)) {
604 stat_result(shpnt) = cmd_result;
605 got_interrupt(shpnt) = 1;
606 reset_status(shpnt) = IM_RESET_FINISHED_OK;
607 last_scsi_command(shpnt)[ldn] = NO_SCSI;
608 spin_unlock_irqrestore(shpnt->host_lock, flags);
609 return IRQ_HANDLED;
610 }
611 /* handling of commands coming from upper level of scsi driver */
612 if (last_scsi_type(shpnt)[ldn] == IM_IMM_CMD) {
613 /* verify ldn, and may handle rare reset immediate command */
614 if ((reset_status(shpnt) == IM_RESET_IN_PROGRESS) && (last_scsi_command(shpnt)[ldn] == IM_RESET_IMM_CMD)) {
615 if (cmd_result == IM_CMD_COMPLETED_WITH_FAILURE) {
616 disk_rw_in_progress = 0;
617 PS2_DISK_LED_OFF();
618 reset_status(shpnt) = IM_RESET_FINISHED_FAIL;
619 } else {
620 /*reset disk led counter, turn off disk led */
621 disk_rw_in_progress = 0;
622 PS2_DISK_LED_OFF();
623 reset_status(shpnt) = IM_RESET_FINISHED_OK;
624 }
625 stat_result(shpnt) = cmd_result;
626 last_scsi_command(shpnt)[ldn] = NO_SCSI;
627 last_scsi_type(shpnt)[ldn] = 0;
628 spin_unlock_irqrestore(shpnt->host_lock, flags);
629 return IRQ_HANDLED;
630 } else if (last_scsi_command(shpnt)[ldn] == IM_ABORT_IMM_CMD) {
631 /* react on SCSI abort command */
632#ifdef IM_DEBUG_PROBE
633 printk("IBM MCA SCSI: Interrupt from SCSI-abort.\n");
634#endif
635 disk_rw_in_progress = 0;
636 PS2_DISK_LED_OFF();
637 cmd = ld(shpnt)[ldn].cmd;
638 ld(shpnt)[ldn].cmd = NULL;
639 if (cmd_result == IM_CMD_COMPLETED_WITH_FAILURE)
640 cmd->result = DID_NO_CONNECT << 16;
641 else
642 cmd->result = DID_ABORT << 16;
643 stat_result(shpnt) = cmd_result;
644 last_scsi_command(shpnt)[ldn] = NO_SCSI;
645 last_scsi_type(shpnt)[ldn] = 0;
646 if (cmd->scsi_done)
647 (cmd->scsi_done) (cmd); /* should be the internal_done */
648 spin_unlock_irqrestore(shpnt->host_lock, flags);
649 return IRQ_HANDLED;
650 } else {
651 disk_rw_in_progress = 0;
652 PS2_DISK_LED_OFF();
653 reset_status(shpnt) = IM_RESET_FINISHED_OK;
654 stat_result(shpnt) = cmd_result;
655 last_scsi_command(shpnt)[ldn] = NO_SCSI;
656 spin_unlock_irqrestore(shpnt->host_lock, flags);
657 return IRQ_HANDLED;
658 }
659 }
660 last_scsi_command(shpnt)[ldn] = NO_SCSI;
661 last_scsi_type(shpnt)[ldn] = 0;
662 cmd = ld(shpnt)[ldn].cmd;
663 ld(shpnt)[ldn].cmd = NULL;
664#ifdef IM_DEBUG_TIMEOUT
665 if (cmd) {
666 if ((cmd->target == TIMEOUT_PUN) && (cmd->device->lun == TIMEOUT_LUN)) {
667 spin_unlock_irqsave(shpnt->host_lock, flags);
668 printk("IBM MCA SCSI: Ignoring interrupt from pun=%x, lun=%x.\n", cmd->target, cmd->device->lun);
669 return IRQ_HANDLED;
670 }
671 }
672#endif
673 /*if no command structure, just return, else clear cmd */
674 if (!cmd)
675 {
676 spin_unlock_irqrestore(shpnt->host_lock, flags);
677 return IRQ_HANDLED;
678 }
679
680#ifdef IM_DEBUG_INT
681 printk("cmd=%02x ireg=%02x ds=%02x cs=%02x de=%02x ce=%02x\n", cmd->cmnd[0], intr_reg, ld(shpnt)[ldn].tsb.dev_status, ld(shpnt)[ldn].tsb.cmd_status, ld(shpnt)[ldn].tsb.dev_error, ld(shpnt)[ldn].tsb.cmd_error);
682#endif
683 /*if this is end of media read/write, may turn off PS/2 disk led */
684 if ((ld(shpnt)[ldn].device_type != TYPE_NO_LUN) && (ld(shpnt)[ldn].device_type != TYPE_NO_DEVICE)) {
685 /* only access this, if there was a valid device addressed */
686 if (--disk_rw_in_progress == 0)
687 PS2_DISK_LED_OFF();
688 }
689
690 /* IBM describes the status-mask to be 0x1e, but this is not conform
691 * with SCSI-definition, I suppose, the reason for it is that IBM
692 * adapters do not support CMD_TERMINATED, TASK_SET_FULL and
693 * ACA_ACTIVE as returning statusbyte information. (ML) */
694 if (cmd_result == IM_CMD_COMPLETED_WITH_FAILURE) {
695 cmd->result = (unsigned char) (ld(shpnt)[ldn].tsb.dev_status & 0x1e);
696 IBM_DS(shpnt).total_errors++;
697 } else
698 cmd->result = 0;
699 /* write device status into cmd->result, and call done function */
700 if (lastSCSI == NO_SCSI) { /* unexpected interrupt :-( */
701 cmd->result |= DID_BAD_INTR << 16;
702 printk("IBM MCA SCSI: WARNING - Interrupt from non-pending SCSI-command!\n");
703 } else /* things went right :-) */
704 cmd->result |= DID_OK << 16;
705 if (cmd->scsi_done)
706 (cmd->scsi_done) (cmd);
707 spin_unlock_irqrestore(shpnt->host_lock, flags);
708 return IRQ_HANDLED;
709}
710
711static void issue_cmd(struct Scsi_Host *shpnt, unsigned long cmd_reg,
712 unsigned char attn_reg)
713{
714 unsigned long flags;
715 /* must wait for attention reg not busy */
716 while (1) {
717 spin_lock_irqsave(shpnt->host_lock, flags);
718 if (!(inb(IM_STAT_REG(shpnt)) & IM_BUSY))
719 break;
720 spin_unlock_irqrestore(shpnt->host_lock, flags);
721 }
722 /* write registers and enable system interrupts */
723 outl(cmd_reg, IM_CMD_REG(shpnt));
724 outb(attn_reg, IM_ATTN_REG(shpnt));
725 spin_unlock_irqrestore(shpnt->host_lock, flags);
726}
727
728static void internal_done(Scsi_Cmnd * cmd)
729{
730 cmd->SCp.Status++;
731 return;
732}
733
734/* SCSI-SCB-command for device_inquiry */
735static int device_inquiry(struct Scsi_Host *shpnt, int ldn)
736{
737 int retr;
738 struct im_scb *scb;
739 struct im_tsb *tsb;
740 unsigned char *buf;
741
742 scb = &(ld(shpnt)[ldn].scb);
743 tsb = &(ld(shpnt)[ldn].tsb);
744 buf = (unsigned char *) (&(ld(shpnt)[ldn].buf));
745 ld(shpnt)[ldn].tsb.dev_status = 0; /* prepare statusblock */
746 for (retr = 0; retr < 3; retr++) {
747 /* fill scb with inquiry command */
748 scb->command = IM_DEVICE_INQUIRY_CMD | IM_NO_DISCONNECT;
749 scb->enable = IM_REPORT_TSB_ONLY_ON_ERROR | IM_READ_CONTROL | IM_SUPRESS_EXCEPTION_SHORT | IM_RETRY_ENABLE | IM_BYPASS_BUFFER;
750 last_scsi_command(shpnt)[ldn] = IM_DEVICE_INQUIRY_CMD;
751 last_scsi_type(shpnt)[ldn] = IM_SCB;
752 scb->sys_buf_adr = isa_virt_to_bus(buf);
753 scb->sys_buf_length = 255; /* maximum bufferlength gives max info */
754 scb->tsb_adr = isa_virt_to_bus(tsb);
755 /* issue scb to passed ldn, and busy wait for interrupt */
756 got_interrupt(shpnt) = 0;
757 issue_cmd(shpnt, isa_virt_to_bus(scb), IM_SCB | ldn);
758 while (!got_interrupt(shpnt))
759 barrier();
760
761 /*if command successful, break */
762 if ((stat_result(shpnt) == IM_SCB_CMD_COMPLETED) || (stat_result(shpnt) == IM_SCB_CMD_COMPLETED_WITH_RETRIES))
763 return 1;
764 }
765 /*if all three retries failed, return "no device at this ldn" */
766 if (retr >= 3)
767 return 0;
768 else
769 return 1;
770}
771
772static int read_capacity(struct Scsi_Host *shpnt, int ldn)
773{
774 int retr;
775 struct im_scb *scb;
776 struct im_tsb *tsb;
777 unsigned char *buf;
778
779 scb = &(ld(shpnt)[ldn].scb);
780 tsb = &(ld(shpnt)[ldn].tsb);
781 buf = (unsigned char *) (&(ld(shpnt)[ldn].buf));
782 ld(shpnt)[ldn].tsb.dev_status = 0;
783 for (retr = 0; retr < 3; retr++) {
784 /*fill scb with read capacity command */
785 scb->command = IM_READ_CAPACITY_CMD;
786 scb->enable = IM_REPORT_TSB_ONLY_ON_ERROR | IM_READ_CONTROL | IM_RETRY_ENABLE | IM_BYPASS_BUFFER;
787 last_scsi_command(shpnt)[ldn] = IM_READ_CAPACITY_CMD;
788 last_scsi_type(shpnt)[ldn] = IM_SCB;
789 scb->sys_buf_adr = isa_virt_to_bus(buf);
790 scb->sys_buf_length = 8;
791 scb->tsb_adr = isa_virt_to_bus(tsb);
792 /*issue scb to passed ldn, and busy wait for interrupt */
793 got_interrupt(shpnt) = 0;
794 issue_cmd(shpnt, isa_virt_to_bus(scb), IM_SCB | ldn);
795 while (!got_interrupt(shpnt))
796 barrier();
797
798 /*if got capacity, get block length and return one device found */
799 if ((stat_result(shpnt) == IM_SCB_CMD_COMPLETED) || (stat_result(shpnt) == IM_SCB_CMD_COMPLETED_WITH_RETRIES))
800 return 1;
801 }
802 /*if all three retries failed, return "no device at this ldn" */
803 if (retr >= 3)
804 return 0;
805 else
806 return 1;
807}
808
809static int get_pos_info(struct Scsi_Host *shpnt)
810{
811 int retr;
812 struct im_scb *scb;
813 struct im_tsb *tsb;
814 unsigned char *buf;
815
816 scb = &(ld(shpnt)[MAX_LOG_DEV].scb);
817 tsb = &(ld(shpnt)[MAX_LOG_DEV].tsb);
818 buf = (unsigned char *) (&(ld(shpnt)[MAX_LOG_DEV].buf));
819 ld(shpnt)[MAX_LOG_DEV].tsb.dev_status = 0;
820 for (retr = 0; retr < 3; retr++) {
821 /*fill scb with get_pos_info command */
822 scb->command = IM_GET_POS_INFO_CMD;
823 scb->enable = IM_READ_CONTROL | IM_REPORT_TSB_ONLY_ON_ERROR | IM_RETRY_ENABLE | IM_BYPASS_BUFFER;
824 last_scsi_command(shpnt)[MAX_LOG_DEV] = IM_GET_POS_INFO_CMD;
825 last_scsi_type(shpnt)[MAX_LOG_DEV] = IM_SCB;
826 scb->sys_buf_adr = isa_virt_to_bus(buf);
827 if (special(shpnt) == IBM_SCSI2_FW)
828 scb->sys_buf_length = 256; /* get all info from F/W adapter */
829 else
830 scb->sys_buf_length = 18; /* get exactly 18 bytes for other SCSI */
831 scb->tsb_adr = isa_virt_to_bus(tsb);
832 /*issue scb to ldn=15, and busy wait for interrupt */
833 got_interrupt(shpnt) = 0;
834 issue_cmd(shpnt, isa_virt_to_bus(scb), IM_SCB | MAX_LOG_DEV);
835
836 /* FIXME: timeout */
837 while (!got_interrupt(shpnt))
838 barrier();
839
840 /*if got POS-stuff, get block length and return one device found */
841 if ((stat_result(shpnt) == IM_SCB_CMD_COMPLETED) || (stat_result(shpnt) == IM_SCB_CMD_COMPLETED_WITH_RETRIES))
842 return 1;
843 }
844 /* if all three retries failed, return "no device at this ldn" */
845 if (retr >= 3)
846 return 0;
847 else
848 return 1;
849}
850
851/* SCSI-immediate-command for assign. This functions maps/unmaps specific
852 ldn-numbers on SCSI (PUN,LUN). It is needed for presetting of the
853 subsystem and for dynamical remapping od ldns. */
854static int immediate_assign(struct Scsi_Host *shpnt, unsigned int pun,
855 unsigned int lun, unsigned int ldn,
856 unsigned int operation)
857{
858 int retr;
859 unsigned long imm_cmd;
860
861 for (retr = 0; retr < 3; retr++) {
862 /* select mutation level of the SCSI-adapter */
863 switch (special(shpnt)) {
864 case IBM_SCSI2_FW:
865 imm_cmd = (unsigned long) (IM_ASSIGN_IMM_CMD);
866 imm_cmd |= (unsigned long) ((lun & 7) << 24);
867 imm_cmd |= (unsigned long) ((operation & 1) << 23);
868 imm_cmd |= (unsigned long) ((pun & 7) << 20) | ((pun & 8) << 24);
869 imm_cmd |= (unsigned long) ((ldn & 15) << 16);
870 break;
871 default:
872 imm_cmd = inl(IM_CMD_REG(shpnt));
873 imm_cmd &= (unsigned long) (0xF8000000); /* keep reserved bits */
874 imm_cmd |= (unsigned long) (IM_ASSIGN_IMM_CMD);
875 imm_cmd |= (unsigned long) ((lun & 7) << 24);
876 imm_cmd |= (unsigned long) ((operation & 1) << 23);
877 imm_cmd |= (unsigned long) ((pun & 7) << 20);
878 imm_cmd |= (unsigned long) ((ldn & 15) << 16);
879 break;
880 }
881 last_scsi_command(shpnt)[MAX_LOG_DEV] = IM_ASSIGN_IMM_CMD;
882 last_scsi_type(shpnt)[MAX_LOG_DEV] = IM_IMM_CMD;
883 got_interrupt(shpnt) = 0;
884 issue_cmd(shpnt, (unsigned long) (imm_cmd), IM_IMM_CMD | MAX_LOG_DEV);
885 while (!got_interrupt(shpnt))
886 barrier();
887
888 /*if command successful, break */
889 if (stat_result(shpnt) == IM_IMMEDIATE_CMD_COMPLETED)
890 return 1;
891 }
892 if (retr >= 3)
893 return 0;
894 else
895 return 1;
896}
897
898static int immediate_feature(struct Scsi_Host *shpnt, unsigned int speed, unsigned int timeout)
899{
900 int retr;
901 unsigned long imm_cmd;
902
903 for (retr = 0; retr < 3; retr++) {
904 /* select mutation level of the SCSI-adapter */
905 imm_cmd = IM_FEATURE_CTR_IMM_CMD;
906 imm_cmd |= (unsigned long) ((speed & 0x7) << 29);
907 imm_cmd |= (unsigned long) ((timeout & 0x1fff) << 16);
908 last_scsi_command(shpnt)[MAX_LOG_DEV] = IM_FEATURE_CTR_IMM_CMD;
909 last_scsi_type(shpnt)[MAX_LOG_DEV] = IM_IMM_CMD;
910 got_interrupt(shpnt) = 0;
911 /* we need to run into command errors in order to probe for the
912 * right speed! */
913 global_command_error_excuse = 1;
914 issue_cmd(shpnt, (unsigned long) (imm_cmd), IM_IMM_CMD | MAX_LOG_DEV);
915
916 /* FIXME: timeout */
917 while (!got_interrupt(shpnt))
918 barrier();
919 if (global_command_error_excuse == CMD_FAIL) {
920 global_command_error_excuse = 0;
921 return 2;
922 } else
923 global_command_error_excuse = 0;
924 /*if command successful, break */
925 if (stat_result(shpnt) == IM_IMMEDIATE_CMD_COMPLETED)
926 return 1;
927 }
928 if (retr >= 3)
929 return 0;
930 else
931 return 1;
932}
933
934#ifdef CONFIG_IBMMCA_SCSI_DEV_RESET
935static int immediate_reset(struct Scsi_Host *shpnt, unsigned int ldn)
936{
937 int retries;
938 int ticks;
939 unsigned long imm_command;
940
941 for (retries = 0; retries < 3; retries++) {
942 imm_command = inl(IM_CMD_REG(shpnt));
943 imm_command &= (unsigned long) (0xFFFF0000); /* keep reserved bits */
944 imm_command |= (unsigned long) (IM_RESET_IMM_CMD);
945 last_scsi_command(shpnt)[ldn] = IM_RESET_IMM_CMD;
946 last_scsi_type(shpnt)[ldn] = IM_IMM_CMD;
947 got_interrupt(shpnt) = 0;
948 reset_status(shpnt) = IM_RESET_IN_PROGRESS;
949 issue_cmd(shpnt, (unsigned long) (imm_command), IM_IMM_CMD | ldn);
950 ticks = IM_RESET_DELAY * HZ;
951 while (reset_status(shpnt) == IM_RESET_IN_PROGRESS && --ticks) {
952 udelay((1 + 999 / HZ) * 1000);
953 barrier();
954 }
955 /* if reset did not complete, just complain */
956 if (!ticks) {
957 printk(KERN_ERR "IBM MCA SCSI: reset did not complete within %d seconds.\n", IM_RESET_DELAY);
958 reset_status(shpnt) = IM_RESET_FINISHED_OK;
959 /* did not work, finish */
960 return 1;
961 }
962 /*if command successful, break */
963 if (stat_result(shpnt) == IM_IMMEDIATE_CMD_COMPLETED)
964 return 1;
965 }
966 if (retries >= 3)
967 return 0;
968 else
969 return 1;
970}
971#endif
972
973/* type-interpreter for physical device numbers */
974static char *ti_p(int dev)
975{
976 switch (dev) {
977 case TYPE_IBM_SCSI_ADAPTER:
978 return ("A");
979 case TYPE_DISK:
980 return ("D");
981 case TYPE_TAPE:
982 return ("T");
983 case TYPE_PROCESSOR:
984 return ("P");
985 case TYPE_WORM:
986 return ("W");
987 case TYPE_ROM:
988 return ("R");
989 case TYPE_SCANNER:
990 return ("S");
991 case TYPE_MOD:
992 return ("M");
993 case TYPE_MEDIUM_CHANGER:
994 return ("C");
995 case TYPE_NO_LUN:
996 return ("+"); /* show NO_LUN */
997 }
998 return ("-"); /* TYPE_NO_DEVICE and others */
999}
1000
1001/* interpreter for logical device numbers (ldn) */
1002static char *ti_l(int val)
1003{
1004 const char hex[16] = "0123456789abcdef";
1005 static char answer[2];
1006
1007 answer[1] = (char) (0x0);
1008 if (val <= MAX_LOG_DEV)
1009 answer[0] = hex[val];
1010 else
1011 answer[0] = '-';
1012 return (char *) &answer;
1013}
1014
1015/* transfers bitpattern of the feature command to values in MHz */
1016static char *ibmrate(unsigned int speed, int i)
1017{
1018 switch (speed) {
1019 case 0:
1020 return i ? "5.00" : "10.00";
1021 case 1:
1022 return i ? "4.00" : "8.00";
1023 case 2:
1024 return i ? "3.33" : "6.66";
1025 case 3:
1026 return i ? "2.86" : "5.00";
1027 case 4:
1028 return i ? "2.50" : "4.00";
1029 case 5:
1030 return i ? "2.22" : "3.10";
1031 case 6:
1032 return i ? "2.00" : "2.50";
1033 case 7:
1034 return i ? "1.82" : "2.00";
1035 }
1036 return "---";
1037}
1038
1039static int probe_display(int what)
1040{
1041 static int rotator = 0;
1042 const char rotor[] = "|/-\\";
1043
1044 if (!(display_mode & LED_DISP))
1045 return 0;
1046 if (!what) {
1047 outl(0x20202020, MOD95_LED_PORT);
1048 outl(0x20202020, MOD95_LED_PORT + 4);
1049 } else {
1050 outb('S', MOD95_LED_PORT + 7);
1051 outb('C', MOD95_LED_PORT + 6);
1052 outb('S', MOD95_LED_PORT + 5);
1053 outb('I', MOD95_LED_PORT + 4);
1054 outb('i', MOD95_LED_PORT + 3);
1055 outb('n', MOD95_LED_PORT + 2);
1056 outb('i', MOD95_LED_PORT + 1);
1057 outb((char) (rotor[rotator]), MOD95_LED_PORT);
1058 rotator++;
1059 if (rotator > 3)
1060 rotator = 0;
1061 }
1062 return 0;
1063}
1064
1065static int probe_bus_mode(struct Scsi_Host *shpnt)
1066{
1067 struct im_pos_info *info;
1068 int num_bus = 0;
1069 int ldn;
1070
1071 info = (struct im_pos_info *) (&(ld(shpnt)[MAX_LOG_DEV].buf));
1072 if (get_pos_info(shpnt)) {
1073 if (info->connector_size & 0xf000)
1074 subsystem_connector_size(shpnt) = 16;
1075 else
1076 subsystem_connector_size(shpnt) = 32;
1077 num_bus |= (info->pos_4b & 8) >> 3;
1078 for (ldn = 0; ldn <= MAX_LOG_DEV; ldn++) {
1079 if ((special(shpnt) == IBM_SCSI_WCACHE) || (special(shpnt) == IBM_7568_WCACHE)) {
1080 if (!((info->cache_stat >> ldn) & 1))
1081 ld(shpnt)[ldn].cache_flag = 0;
1082 }
1083 if (!((info->retry_stat >> ldn) & 1))
1084 ld(shpnt)[ldn].retry_flag = 0;
1085 }
1086#ifdef IM_DEBUG_PROBE
1087 printk("IBM MCA SCSI: SCSI-Cache bits: ");
1088 for (ldn = 0; ldn <= MAX_LOG_DEV; ldn++) {
1089 printk("%d", ld(shpnt)[ldn].cache_flag);
1090 }
1091 printk("\nIBM MCA SCSI: SCSI-Retry bits: ");
1092 for (ldn = 0; ldn <= MAX_LOG_DEV; ldn++) {
1093 printk("%d", ld(shpnt)[ldn].retry_flag);
1094 }
1095 printk("\n");
1096#endif
1097 }
1098 return num_bus;
1099}
1100
1101/* probing scsi devices */
1102static void check_devices(struct Scsi_Host *shpnt, int adaptertype)
1103{
1104 int id, lun, ldn, ticks;
1105 int count_devices; /* local counter for connected device */
1106 int max_pun;
1107 int num_bus;
1108 int speedrun; /* local adapter_speed check variable */
1109
1110 /* assign default values to certain variables */
1111 ticks = 0;
1112 count_devices = 0;
1113 IBM_DS(shpnt).dyn_flag = 0; /* normally no need for dynamical ldn management */
1114 IBM_DS(shpnt).total_errors = 0; /* set errorcounter to 0 */
1115 next_ldn(shpnt) = 7; /* next ldn to be assigned is 7, because 0-6 is 'hardwired' */
1116
1117 /* initialize the very important driver-informational arrays/structs */
1118 memset(ld(shpnt), 0, sizeof(ld(shpnt)));
1119 for (ldn = 0; ldn <= MAX_LOG_DEV; ldn++) {
1120 last_scsi_command(shpnt)[ldn] = NO_SCSI; /* emptify last SCSI-command storage */
1121 last_scsi_type(shpnt)[ldn] = 0;
1122 ld(shpnt)[ldn].cache_flag = 1;
1123 ld(shpnt)[ldn].retry_flag = 1;
1124 }
1125 memset(get_ldn(shpnt), TYPE_NO_DEVICE, sizeof(get_ldn(shpnt))); /* this is essential ! */
1126 memset(get_scsi(shpnt), TYPE_NO_DEVICE, sizeof(get_scsi(shpnt))); /* this is essential ! */
1127 for (lun = 0; lun < 8; lun++) {
1128 /* mark the adapter at its pun on all luns */
1129 get_scsi(shpnt)[subsystem_pun(shpnt)][lun] = TYPE_IBM_SCSI_ADAPTER;
1130 get_ldn(shpnt)[subsystem_pun(shpnt)][lun] = MAX_LOG_DEV; /* make sure, the subsystem
1131 ldn is active for all
1132 luns. */
1133 }
1134 probe_display(0); /* Supercool display usage during SCSI-probing. */
1135 /* This makes sense, when booting without any */
1136 /* monitor connected on model XX95. */
1137
1138 /* STEP 1: */
1139 adapter_speed(shpnt) = global_adapter_speed;
1140 speedrun = adapter_speed(shpnt);
1141 while (immediate_feature(shpnt, speedrun, adapter_timeout) == 2) {
1142 probe_display(1);
1143 if (speedrun == 7)
1144 panic("IBM MCA SCSI: Cannot set Synchronous-Transfer-Rate!\n");
1145 speedrun++;
1146 if (speedrun > 7)
1147 speedrun = 7;
1148 }
1149 adapter_speed(shpnt) = speedrun;
1150 /* Get detailed information about the current adapter, necessary for
1151 * device operations: */
1152 num_bus = probe_bus_mode(shpnt);
1153
1154 /* num_bus contains only valid data for the F/W adapter! */
1155 if (adaptertype == IBM_SCSI2_FW) { /* F/W SCSI adapter: */
1156 /* F/W adapter PUN-space extension evaluation: */
1157 if (num_bus) {
1158 printk(KERN_INFO "IBM MCA SCSI: Separate bus mode (wide-addressing enabled)\n");
1159 subsystem_maxid(shpnt) = 16;
1160 } else {
1161 printk(KERN_INFO "IBM MCA SCSI: Combined bus mode (wide-addressing disabled)\n");
1162 subsystem_maxid(shpnt) = 8;
1163 }
1164 printk(KERN_INFO "IBM MCA SCSI: Sync.-Rate (F/W: 20, Int.: 10, Ext.: %s) MBytes/s\n", ibmrate(speedrun, adaptertype));
1165 } else /* all other IBM SCSI adapters: */
1166 printk(KERN_INFO "IBM MCA SCSI: Synchronous-SCSI-Transfer-Rate: %s MBytes/s\n", ibmrate(speedrun, adaptertype));
1167
1168 /* assign correct PUN device space */
1169 max_pun = subsystem_maxid(shpnt);
1170
1171#ifdef IM_DEBUG_PROBE
1172 printk("IBM MCA SCSI: Current SCSI-host index: %d\n", shpnt);
1173 printk("IBM MCA SCSI: Removing default logical SCSI-device mapping.");
1174#else
1175 printk(KERN_INFO "IBM MCA SCSI: Dev. Order: %s, Mapping (takes <2min): ", (ibm_ansi_order) ? "ANSI" : "New");
1176#endif
1177 for (ldn = 0; ldn < MAX_LOG_DEV; ldn++) {
1178 probe_display(1);
1179#ifdef IM_DEBUG_PROBE
1180 printk(".");
1181#endif
1182 immediate_assign(shpnt, 0, 0, ldn, REMOVE_LDN); /* remove ldn (wherever) */
1183 }
1184 lun = 0; /* default lun is 0 */
1185#ifndef IM_DEBUG_PROBE
1186 printk("cleared,");
1187#endif
1188 /* STEP 2: */
1189#ifdef IM_DEBUG_PROBE
1190 printk("\nIBM MCA SCSI: Scanning SCSI-devices.");
1191#endif
1192 for (id = 0; id < max_pun; id++)
1193#ifdef CONFIG_SCSI_MULTI_LUN
1194 for (lun = 0; lun < 8; lun++)
1195#endif
1196 {
1197 probe_display(1);
1198#ifdef IM_DEBUG_PROBE
1199 printk(".");
1200#endif
1201 if (id != subsystem_pun(shpnt)) {
1202 /* if pun is not the adapter: */
1203 /* set ldn=0 to pun,lun */
1204 immediate_assign(shpnt, id, lun, PROBE_LDN, SET_LDN);
1205 if (device_inquiry(shpnt, PROBE_LDN)) { /* probe device */
1206 get_scsi(shpnt)[id][lun] = (unsigned char) (ld(shpnt)[PROBE_LDN].buf[0]);
1207 /* entry, even for NO_LUN */
1208 if (ld(shpnt)[PROBE_LDN].buf[0] != TYPE_NO_LUN)
1209 count_devices++; /* a existing device is found */
1210 }
1211 /* remove ldn */
1212 immediate_assign(shpnt, id, lun, PROBE_LDN, REMOVE_LDN);
1213 }
1214 }
1215#ifndef IM_DEBUG_PROBE
1216 printk("scanned,");
1217#endif
1218 /* STEP 3: */
1219#ifdef IM_DEBUG_PROBE
1220 printk("\nIBM MCA SCSI: Mapping SCSI-devices.");
1221#endif
1222 ldn = 0;
1223 lun = 0;
1224#ifdef CONFIG_SCSI_MULTI_LUN
1225 for (lun = 0; lun < 8 && ldn < MAX_LOG_DEV; lun++)
1226#endif
1227 for (id = 0; id < max_pun && ldn < MAX_LOG_DEV; id++) {
1228 probe_display(1);
1229#ifdef IM_DEBUG_PROBE
1230 printk(".");
1231#endif
1232 if (id != subsystem_pun(shpnt)) {
1233 if (get_scsi(shpnt)[id][lun] != TYPE_NO_LUN && get_scsi(shpnt)[id][lun] != TYPE_NO_DEVICE) {
1234 /* Only map if accepted type. Always enter for
1235 lun == 0 to get no gaps into ldn-mapping for ldn<7. */
1236 immediate_assign(shpnt, id, lun, ldn, SET_LDN);
1237 get_ldn(shpnt)[id][lun] = ldn; /* map ldn */
1238 if (device_exists(shpnt, ldn, &ld(shpnt)[ldn].block_length, &ld(shpnt)[ldn].device_type)) {
1239#ifdef CONFIG_IBMMCA_SCSI_DEV_RESET
1240 printk("resetting device at ldn=%x ... ", ldn);
1241 immediate_reset(shpnt, ldn);
1242#endif
1243 ldn++;
1244 } else {
1245 /* device vanished, probably because we don't know how to
1246 * handle it or because it has problems */
1247 if (lun > 0) {
1248 /* remove mapping */
1249 get_ldn(shpnt)[id][lun] = TYPE_NO_DEVICE;
1250 immediate_assign(shpnt, 0, 0, ldn, REMOVE_LDN);
1251 } else
1252 ldn++;
1253 }
1254 } else if (lun == 0) {
1255 /* map lun == 0, even if no device exists */
1256 immediate_assign(shpnt, id, lun, ldn, SET_LDN);
1257 get_ldn(shpnt)[id][lun] = ldn; /* map ldn */
1258 ldn++;
1259 }
1260 }
1261 }
1262 /* STEP 4: */
1263
1264 /* map remaining ldns to non-existing devices */
1265 for (lun = 1; lun < 8 && ldn < MAX_LOG_DEV; lun++)
1266 for (id = 0; id < max_pun && ldn < MAX_LOG_DEV; id++) {
1267 if (get_scsi(shpnt)[id][lun] == TYPE_NO_LUN || get_scsi(shpnt)[id][lun] == TYPE_NO_DEVICE) {
1268 probe_display(1);
1269 /* Map remaining ldns only to NON-existing pun,lun
1270 combinations to make sure an inquiry will fail.
1271 For MULTI_LUN, it is needed to avoid adapter autonome
1272 SCSI-remapping. */
1273 immediate_assign(shpnt, id, lun, ldn, SET_LDN);
1274 get_ldn(shpnt)[id][lun] = ldn;
1275 ldn++;
1276 }
1277 }
1278#ifndef IM_DEBUG_PROBE
1279 printk("mapped.");
1280#endif
1281 printk("\n");
1282#ifdef IM_DEBUG_PROBE
1283 if (ibm_ansi_order)
1284 printk("IBM MCA SCSI: Device order: IBM/ANSI (pun=7 is first).\n");
1285 else
1286 printk("IBM MCA SCSI: Device order: New Industry Standard (pun=0 is first).\n");
1287#endif
1288
1289#ifdef IM_DEBUG_PROBE
1290 /* Show the physical and logical mapping during boot. */
1291 printk("IBM MCA SCSI: Determined SCSI-device-mapping:\n");
1292 printk(" Physical SCSI-Device Map Logical SCSI-Device Map\n");
1293 printk("ID\\LUN 0 1 2 3 4 5 6 7 ID\\LUN 0 1 2 3 4 5 6 7\n");
1294 for (id = 0; id < max_pun; id++) {
1295 printk("%2d ", id);
1296 for (lun = 0; lun < 8; lun++)
1297 printk("%2s ", ti_p(get_scsi(shpnt)[id][lun]));
1298 printk(" %2d ", id);
1299 for (lun = 0; lun < 8; lun++)
1300 printk("%2s ", ti_l(get_ldn(shpnt)[id][lun]));
1301 printk("\n");
1302 }
1303#endif
1304
1305 /* assign total number of found SCSI-devices to the statistics struct */
1306 IBM_DS(shpnt).total_scsi_devices = count_devices;
1307
1308 /* decide for output in /proc-filesystem, if the configuration of
1309 SCSI-devices makes dynamical reassignment of devices necessary */
1310 if (count_devices >= MAX_LOG_DEV)
1311 IBM_DS(shpnt).dyn_flag = 1; /* dynamical assignment is necessary */
1312 else
1313 IBM_DS(shpnt).dyn_flag = 0; /* dynamical assignment is not necessary */
1314
1315 /* If no SCSI-devices are assigned, return 1 in order to cause message. */
1316 if (ldn == 0)
1317 printk("IBM MCA SCSI: Warning: No SCSI-devices found/assigned!\n");
1318
1319 /* reset the counters for statistics on the current adapter */
1320 IBM_DS(shpnt).scbs = 0;
1321 IBM_DS(shpnt).long_scbs = 0;
1322 IBM_DS(shpnt).total_accesses = 0;
1323 IBM_DS(shpnt).total_interrupts = 0;
1324 IBM_DS(shpnt).dynamical_assignments = 0;
1325 memset(IBM_DS(shpnt).ldn_access, 0x0, sizeof(IBM_DS(shpnt).ldn_access));
1326 memset(IBM_DS(shpnt).ldn_read_access, 0x0, sizeof(IBM_DS(shpnt).ldn_read_access));
1327 memset(IBM_DS(shpnt).ldn_write_access, 0x0, sizeof(IBM_DS(shpnt).ldn_write_access));
1328 memset(IBM_DS(shpnt).ldn_inquiry_access, 0x0, sizeof(IBM_DS(shpnt).ldn_inquiry_access));
1329 memset(IBM_DS(shpnt).ldn_modeselect_access, 0x0, sizeof(IBM_DS(shpnt).ldn_modeselect_access));
1330 memset(IBM_DS(shpnt).ldn_assignments, 0x0, sizeof(IBM_DS(shpnt).ldn_assignments));
1331 probe_display(0);
1332 return;
1333}
1334
1335static int device_exists(struct Scsi_Host *shpnt, int ldn, int *block_length, int *device_type)
1336{
1337 unsigned char *buf;
1338 /* if no valid device found, return immediately with 0 */
1339 if (!(device_inquiry(shpnt, ldn)))
1340 return 0;
1341 buf = (unsigned char *) (&(ld(shpnt)[ldn].buf));
1342 if (*buf == TYPE_ROM) {
1343 *device_type = TYPE_ROM;
1344 *block_length = 2048; /* (standard blocksize for yellow-/red-book) */
1345 return 1;
1346 }
1347 if (*buf == TYPE_WORM) {
1348 *device_type = TYPE_WORM;
1349 *block_length = 2048;
1350 return 1;
1351 }
1352 if (*buf == TYPE_DISK) {
1353 *device_type = TYPE_DISK;
1354 if (read_capacity(shpnt, ldn)) {
1355 *block_length = *(buf + 7) + (*(buf + 6) << 8) + (*(buf + 5) << 16) + (*(buf + 4) << 24);
1356 return 1;
1357 } else
1358 return 0;
1359 }
1360 if (*buf == TYPE_MOD) {
1361 *device_type = TYPE_MOD;
1362 if (read_capacity(shpnt, ldn)) {
1363 *block_length = *(buf + 7) + (*(buf + 6) << 8) + (*(buf + 5) << 16) + (*(buf + 4) << 24);
1364 return 1;
1365 } else
1366 return 0;
1367 }
1368 if (*buf == TYPE_TAPE) {
1369 *device_type = TYPE_TAPE;
1370 *block_length = 0; /* not in use (setting by mt and mtst in op.) */
1371 return 1;
1372 }
1373 if (*buf == TYPE_PROCESSOR) {
1374 *device_type = TYPE_PROCESSOR;
1375 *block_length = 0; /* they set their stuff on drivers */
1376 return 1;
1377 }
1378 if (*buf == TYPE_SCANNER) {
1379 *device_type = TYPE_SCANNER;
1380 *block_length = 0; /* they set their stuff on drivers */
1381 return 1;
1382 }
1383 if (*buf == TYPE_MEDIUM_CHANGER) {
1384 *device_type = TYPE_MEDIUM_CHANGER;
1385 *block_length = 0; /* One never knows, what to expect on a medium
1386 changer device. */
1387 return 1;
1388 }
1389 return 0;
1390}
1391
1392static void internal_ibmmca_scsi_setup(char *str, int *ints)
1393{
1394 int i, j, io_base, id_base;
1395 char *token;
1396
1397 io_base = 0;
1398 id_base = 0;
1399 if (str) {
1400 j = 0;
1401 while ((token = strsep(&str, ",")) != NULL) {
1402 if (!strcmp(token, "activity"))
1403 display_mode |= LED_ACTIVITY;
1404 if (!strcmp(token, "display"))
1405 display_mode |= LED_DISP;
1406 if (!strcmp(token, "adisplay"))
1407 display_mode |= LED_ADISP;
1408 if (!strcmp(token, "normal"))
1409 ibm_ansi_order = 0;
1410 if (!strcmp(token, "ansi"))
1411 ibm_ansi_order = 1;
1412 if (!strcmp(token, "fast"))
1413 global_adapter_speed = 0;
1414 if (!strcmp(token, "medium"))
1415 global_adapter_speed = 4;
1416 if (!strcmp(token, "slow"))
1417 global_adapter_speed = 7;
1418 if ((*token == '-') || (isdigit(*token))) {
1419 if (!(j % 2) && (io_base < IM_MAX_HOSTS))
1420 io_port[io_base++] = simple_strtoul(token, NULL, 0);
1421 if ((j % 2) && (id_base < IM_MAX_HOSTS))
1422 scsi_id[id_base++] = simple_strtoul(token, NULL, 0);
1423 j++;
1424 }
1425 }
1426 } else if (ints) {
1427 for (i = 0; i < IM_MAX_HOSTS && 2 * i + 2 < ints[0]; i++) {
1428 io_port[i] = ints[2 * i + 2];
1429 scsi_id[i] = ints[2 * i + 2];
1430 }
1431 }
1432 return;
1433}
1434
1435#if 0
1436 FIXME NEED TO MOVE TO SYSFS
1437
1438static int ibmmca_getinfo(char *buf, int slot, void *dev_id)
1439{
1440 struct Scsi_Host *shpnt;
1441 int len, speciale, connectore, k;
1442 unsigned int pos[8];
1443 unsigned long flags;
1444 struct Scsi_Host *dev = dev_id;
1445
1446 spin_lock_irqsave(dev->host_lock, flags);
1447
1448 shpnt = dev; /* assign host-structure to local pointer */
1449 len = 0; /* set filled text-buffer index to 0 */
1450 /* get the _special contents of the hostdata structure */
1451 speciale = ((struct ibmmca_hostdata *) shpnt->hostdata)->_special;
1452 connectore = ((struct ibmmca_hostdata *) shpnt->hostdata)->_connector_size;
1453 for (k = 2; k < 4; k++)
1454 pos[k] = ((struct ibmmca_hostdata *) shpnt->hostdata)->_pos[k];
1455 if (speciale == FORCED_DETECTION) { /* forced detection */
1456 len += sprintf(buf + len,
1457 "Adapter category: forced detected\n" "***************************************\n" "*** Forced detected SCSI Adapter ***\n" "*** No chip-information available ***\n" "***************************************\n");
1458 } else if (speciale == INTEGRATED_SCSI) {
1459 /* if the integrated subsystem has been found automatically: */
1460 len += sprintf(buf + len,
1461 "Adapter category: integrated\n" "Chip revision level: %d\n" "Chip status: %s\n" "8 kByte NVRAM status: %s\n", ((pos[2] & 0xf0) >> 4), (pos[2] & 1) ? "enabled" : "disabled", (pos[2] & 2) ? "locked" : "accessible");
1462 } else if ((speciale >= 0) && (speciale < ARRAY_SIZE(subsys_list))) {
1463 /* if the subsystem is a slot adapter */
1464 len += sprintf(buf + len, "Adapter category: slot-card\n" "ROM Segment Address: ");
1465 if ((pos[2] & 0xf0) == 0xf0)
1466 len += sprintf(buf + len, "off\n");
1467 else
1468 len += sprintf(buf + len, "0x%x\n", ((pos[2] & 0xf0) << 13) + 0xc0000);
1469 len += sprintf(buf + len, "Chip status: %s\n", (pos[2] & 1) ? "enabled" : "disabled");
1470 len += sprintf(buf + len, "Adapter I/O Offset: 0x%x\n", ((pos[2] & 0x0e) << 2));
1471 } else {
1472 len += sprintf(buf + len, "Adapter category: unknown\n");
1473 }
1474 /* common subsystem information to write to the slotn file */
1475 len += sprintf(buf + len, "Subsystem PUN: %d\n", shpnt->this_id);
1476 len += sprintf(buf + len, "I/O base address range: 0x%x-0x%x\n", (unsigned int) (shpnt->io_port), (unsigned int) (shpnt->io_port + 7));
1477 len += sprintf(buf + len, "MCA-slot size: %d bits", connectore);
1478 /* Now make sure, the bufferlength is devidable by 4 to avoid
1479 * paging problems of the buffer. */
1480 while (len % sizeof(int) != (sizeof(int) - 1))
1481 len += sprintf(buf + len, " ");
1482 len += sprintf(buf + len, "\n");
1483
1484 spin_unlock_irqrestore(shpnt->host_lock, flags);
1485
1486 return len;
1487}
1488#endif
1489
1490static struct scsi_host_template ibmmca_driver_template = {
1491 .proc_name = "ibmmca",
1492 .proc_info = ibmmca_proc_info,
1493 .name = "IBM SCSI-Subsystem",
1494 .queuecommand = ibmmca_queuecommand,
1495 .eh_abort_handler = ibmmca_abort,
1496 .eh_host_reset_handler = ibmmca_host_reset,
1497 .bios_param = ibmmca_biosparam,
1498 .can_queue = 16,
1499 .this_id = 7,
1500 .sg_tablesize = 16,
1501 .cmd_per_lun = 1,
1502 .use_clustering = ENABLE_CLUSTERING,
1503};
1504
1505static int ibmmca_probe(struct device *dev)
1506{
1507 struct Scsi_Host *shpnt;
1508 int port, id, i, j, k, irq, enabled, ret = -EINVAL;
1509 struct mca_device *mca_dev = to_mca_device(dev);
1510 const char *description = ibmmca_description[mca_dev->index];
1511
1512 /* First of all, print the version number of the driver. This is
1513 * important to allow better user bugreports in case of already
1514 * having problems with the MCA_bus probing. */
1515 printk(KERN_INFO "IBM MCA SCSI: Version %s\n", IBMMCA_SCSI_DRIVER_VERSION);
1516 /* The POS2-register of all PS/2 model SCSI-subsystems has the following
1517 * interpretation of bits:
1518 * Bit 7 - 4 : Chip Revision ID (Release)
1519 * Bit 3 - 2 : Reserved
1520 * Bit 1 : 8k NVRAM Disabled
1521 * Bit 0 : Chip Enable (EN-Signal)
1522 * The POS3-register is interpreted as follows:
1523 * Bit 7 - 5 : SCSI ID
1524 * Bit 4 : Reserved = 0
1525 * Bit 3 - 0 : Reserved = 0
1526 * (taken from "IBM, PS/2 Hardware Interface Technical Reference, Common
1527 * Interfaces (1991)").
1528 * In short words, this means, that IBM PS/2 machines only support
1529 * 1 single subsystem by default. The slot-adapters must have another
1530 * configuration on pos2. Here, one has to assume the following
1531 * things for POS2-register:
1532 * Bit 7 - 4 : Chip Revision ID (Release)
1533 * Bit 3 - 1 : port offset factor
1534 * Bit 0 : Chip Enable (EN-Signal)
1535 * As I found a patch here, setting the IO-registers to 0x3540 forced,
1536 * as there was a 0x05 in POS2 on a model 56, I assume, that the
1537 * port 0x3540 must be fix for integrated SCSI-controllers.
1538 * Ok, this discovery leads to the following implementation: (M.Lang) */
1539
1540 /* first look for the IBM SCSI integrated subsystem on the motherboard */
1541 for (j = 0; j < 8; j++) /* read the pos-information */
1542 pos[j] = mca_device_read_pos(mca_dev, j);
1543 id = (pos[3] & 0xe0) >> 5; /* this is correct and represents the PUN */
1544 enabled = (pos[2] &0x01);
1545 if (!enabled) {
1546 printk(KERN_WARNING "IBM MCA SCSI: WARNING - Your SCSI-subsystem is disabled!\n");
1547 printk(KERN_WARNING " SCSI-operations may not work.\n");
1548 }
1549
1550 /* pos2 = pos3 = 0xff if there is no integrated SCSI-subsystem present, but
1551 * if we ignore the settings of all surrounding pos registers, it is not
1552 * completely sufficient to only check pos2 and pos3. */
1553 /* Therefore, now the following if statement is used to
1554 * make sure, we see a real integrated onboard SCSI-interface and no
1555 * internal system information, which gets mapped to some pos registers
1556 * on models 95xx. */
1557 if (mca_dev->slot == MCA_INTEGSCSI &&
1558 ((!pos[0] && !pos[1] && pos[2] > 0 &&
1559 pos[3] > 0 && !pos[4] && !pos[5] &&
1560 !pos[6] && !pos[7]) ||
1561 (pos[0] == 0xff && pos[1] == 0xff &&
1562 pos[2] < 0xff && pos[3] < 0xff &&
1563 pos[4] == 0xff && pos[5] == 0xff &&
1564 pos[6] == 0xff && pos[7] == 0xff))) {
1565 irq = IM_IRQ;
1566 port = IM_IO_PORT;
1567 } else {
1568 irq = IM_IRQ;
1569 port = IM_IO_PORT + ((pos[2] &0x0e) << 2);
1570 if ((mca_dev->index == IBM_SCSI2_FW) && (pos[6] != 0)) {
1571 printk(KERN_ERR "IBM MCA SCSI: ERROR - Wrong POS(6)-register setting!\n");
1572 printk(KERN_ERR " Impossible to determine adapter PUN!\n");
1573 printk(KERN_ERR " Guessing adapter PUN = 7.\n");
1574 id = 7;
1575 } else {
1576 id = (pos[3] & 0xe0) >> 5; /* get subsystem PUN */
1577 if (mca_dev->index == IBM_SCSI2_FW) {
1578 id |= (pos[3] & 0x10) >> 1; /* get subsystem PUN high-bit
1579 * for F/W adapters */
1580 }
1581 }
1582 if ((mca_dev->index == IBM_SCSI2_FW) &&
1583 (pos[4] & 0x01) && (pos[6] == 0)) {
1584 /* IRQ11 is used by SCSI-2 F/W Adapter/A */
1585 printk(KERN_DEBUG "IBM MCA SCSI: SCSI-2 F/W adapter needs IRQ 11.\n");
1586 irq = IM_IRQ_FW;
1587 }
1588 }
1589
1590
1591
1592 /* give detailed information on the subsystem. This helps me
1593 * additionally during debugging and analyzing bug-reports. */
1594 printk(KERN_INFO "IBM MCA SCSI: %s found, io=0x%x, scsi id=%d,\n",
1595 description, port, id);
1596 if (mca_dev->slot == MCA_INTEGSCSI)
1597 printk(KERN_INFO " chip rev.=%d, 8K NVRAM=%s, subsystem=%s\n", ((pos[2] & 0xf0) >> 4), (pos[2] & 2) ? "locked" : "accessible", (pos[2] & 1) ? "enabled." : "disabled.");
1598 else {
1599 if ((pos[2] & 0xf0) == 0xf0)
1600 printk(KERN_DEBUG " ROM Addr.=off,");
1601 else
1602 printk(KERN_DEBUG " ROM Addr.=0x%x,", ((pos[2] & 0xf0) << 13) + 0xc0000);
1603
1604 printk(KERN_DEBUG " port-offset=0x%x, subsystem=%s\n", ((pos[2] & 0x0e) << 2), (pos[2] & 1) ? "enabled." : "disabled.");
1605 }
1606
1607 /* check I/O region */
1608 if (!request_region(port, IM_N_IO_PORT, description)) {
1609 printk(KERN_ERR "IBM MCA SCSI: Unable to get I/O region 0x%x-0x%x (%d ports).\n", port, port + IM_N_IO_PORT - 1, IM_N_IO_PORT);
1610 goto out_fail;
1611 }
1612
1613 /* register host */
1614 shpnt = scsi_host_alloc(&ibmmca_driver_template,
1615 sizeof(struct ibmmca_hostdata));
1616 if (!shpnt) {
1617 printk(KERN_ERR "IBM MCA SCSI: Unable to register host.\n");
1618 goto out_release;
1619 }
1620
1621 dev_set_drvdata(dev, shpnt);
1622 if(request_irq(irq, interrupt_handler, IRQF_SHARED, description, dev)) {
1623 printk(KERN_ERR "IBM MCA SCSI: failed to request interrupt %d\n", irq);
1624 goto out_free_host;
1625 }
1626
1627 /* request I/O region */
1628 special(shpnt) = mca_dev->index; /* important assignment or else crash! */
1629 subsystem_connector_size(shpnt) = 0; /* preset slot-size */
1630 shpnt->irq = irq; /* assign necessary stuff for the adapter */
1631 shpnt->io_port = port;
1632 shpnt->n_io_port = IM_N_IO_PORT;
1633 shpnt->this_id = id;
1634 shpnt->max_id = 8; /* 8 PUNs are default */
1635 /* now, the SCSI-subsystem is connected to Linux */
1636
1637#ifdef IM_DEBUG_PROBE
1638 ctrl = (unsigned int) (inb(IM_CTR_REG(found))); /* get control-register status */
1639 printk("IBM MCA SCSI: Control Register contents: %x, status: %x\n", ctrl, inb(IM_STAT_REG(found)));
1640 printk("IBM MCA SCSI: This adapters' POS-registers: ");
1641 for (i = 0; i < 8; i++)
1642 printk("%x ", pos[i]);
1643 printk("\n");
1644#endif
1645 reset_status(shpnt) = IM_RESET_NOT_IN_PROGRESS;
1646
1647 for (i = 0; i < 16; i++) /* reset the tables */
1648 for (j = 0; j < 8; j++)
1649 get_ldn(shpnt)[i][j] = MAX_LOG_DEV;
1650
1651 /* check which logical devices exist */
1652 /* after this line, local interrupting is possible: */
1653 local_checking_phase_flag(shpnt) = 1;
1654 check_devices(shpnt, mca_dev->index); /* call by value, using the global variable hosts */
1655 local_checking_phase_flag(shpnt) = 0;
1656
1657 /* an ibm mca subsystem has been detected */
1658
1659 for (k = 2; k < 7; k++)
1660 ((struct ibmmca_hostdata *) shpnt->hostdata)->_pos[k] = pos[k];
1661 ((struct ibmmca_hostdata *) shpnt->hostdata)->_special = INTEGRATED_SCSI;
1662 mca_device_set_name(mca_dev, description);
1663 /* FIXME: NEED TO REPLUMB TO SYSFS
1664 mca_set_adapter_procfn(MCA_INTEGSCSI, (MCA_ProcFn) ibmmca_getinfo, shpnt);
1665 */
1666 mca_device_set_claim(mca_dev, 1);
1667 if (scsi_add_host(shpnt, dev)) {
1668 dev_printk(KERN_ERR, dev, "IBM MCA SCSI: scsi_add_host failed\n");
1669 goto out_free_host;
1670 }
1671 scsi_scan_host(shpnt);
1672
1673 return 0;
1674 out_free_host:
1675 scsi_host_put(shpnt);
1676 out_release:
1677 release_region(port, IM_N_IO_PORT);
1678 out_fail:
1679 return ret;
1680}
1681
1682static int __devexit ibmmca_remove(struct device *dev)
1683{
1684 struct Scsi_Host *shpnt = dev_get_drvdata(dev);
1685 scsi_remove_host(shpnt);
1686 release_region(shpnt->io_port, shpnt->n_io_port);
1687 free_irq(shpnt->irq, dev);
1688 scsi_host_put(shpnt);
1689 return 0;
1690}
1691
1692/* The following routine is the SCSI command queue for the midlevel driver */
1693static int ibmmca_queuecommand_lck(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
1694{
1695 unsigned int ldn;
1696 unsigned int scsi_cmd;
1697 struct im_scb *scb;
1698 struct Scsi_Host *shpnt;
1699 int current_ldn;
1700 int id, lun;
1701 int target;
1702 int max_pun;
1703 int i;
1704 struct scatterlist *sg;
1705
1706 shpnt = cmd->device->host;
1707
1708 max_pun = subsystem_maxid(shpnt);
1709 if (ibm_ansi_order) {
1710 target = max_pun - 1 - cmd->device->id;
1711 if ((target <= subsystem_pun(shpnt)) && (cmd->device->id <= subsystem_pun(shpnt)))
1712 target--;
1713 else if ((target >= subsystem_pun(shpnt)) && (cmd->device->id >= subsystem_pun(shpnt)))
1714 target++;
1715 } else
1716 target = cmd->device->id;
1717
1718 /* if (target,lun) is NO LUN or not existing at all, return error */
1719 if ((get_scsi(shpnt)[target][cmd->device->lun] == TYPE_NO_LUN) || (get_scsi(shpnt)[target][cmd->device->lun] == TYPE_NO_DEVICE)) {
1720 cmd->result = DID_NO_CONNECT << 16;
1721 if (done)
1722 done(cmd);
1723 return 0;
1724 }
1725
1726 /*if (target,lun) unassigned, do further checks... */
1727 ldn = get_ldn(shpnt)[target][cmd->device->lun];
1728 if (ldn >= MAX_LOG_DEV) { /* on invalid ldn do special stuff */
1729 if (ldn > MAX_LOG_DEV) { /* dynamical remapping if ldn unassigned */
1730 current_ldn = next_ldn(shpnt); /* stop-value for one circle */
1731 while (ld(shpnt)[next_ldn(shpnt)].cmd) { /* search for a occupied, but not in */
1732 /* command-processing ldn. */
1733 next_ldn(shpnt)++;
1734 if (next_ldn(shpnt) >= MAX_LOG_DEV)
1735 next_ldn(shpnt) = 7;
1736 if (current_ldn == next_ldn(shpnt)) { /* One circle done ? */
1737 /* no non-processing ldn found */
1738 scmd_printk(KERN_WARNING, cmd,
1739 "IBM MCA SCSI: Cannot assign SCSI-device dynamically!\n"
1740 " On ldn 7-14 SCSI-commands everywhere in progress.\n"
1741 " Reporting DID_NO_CONNECT for device.\n");
1742 cmd->result = DID_NO_CONNECT << 16; /* return no connect */
1743 if (done)
1744 done(cmd);
1745 return 0;
1746 }
1747 }
1748
1749 /* unmap non-processing ldn */
1750 for (id = 0; id < max_pun; id++)
1751 for (lun = 0; lun < 8; lun++) {
1752 if (get_ldn(shpnt)[id][lun] == next_ldn(shpnt)) {
1753 get_ldn(shpnt)[id][lun] = TYPE_NO_DEVICE;
1754 get_scsi(shpnt)[id][lun] = TYPE_NO_DEVICE;
1755 /* unmap entry */
1756 }
1757 }
1758 /* set reduced interrupt_handler-mode for checking */
1759 local_checking_phase_flag(shpnt) = 1;
1760 /* map found ldn to pun,lun */
1761 get_ldn(shpnt)[target][cmd->device->lun] = next_ldn(shpnt);
1762 /* change ldn to the right value, that is now next_ldn */
1763 ldn = next_ldn(shpnt);
1764 /* unassign all ldns (pun,lun,ldn does not matter for remove) */
1765 immediate_assign(shpnt, 0, 0, 0, REMOVE_LDN);
1766 /* set only LDN for remapped device */
1767 immediate_assign(shpnt, target, cmd->device->lun, ldn, SET_LDN);
1768 /* get device information for ld[ldn] */
1769 if (device_exists(shpnt, ldn, &ld(shpnt)[ldn].block_length, &ld(shpnt)[ldn].device_type)) {
1770 ld(shpnt)[ldn].cmd = NULL; /* To prevent panic set 0, because
1771 devices that were not assigned,
1772 should have nothing in progress. */
1773 get_scsi(shpnt)[target][cmd->device->lun] = ld(shpnt)[ldn].device_type;
1774 /* increase assignment counters for statistics in /proc */
1775 IBM_DS(shpnt).dynamical_assignments++;
1776 IBM_DS(shpnt).ldn_assignments[ldn]++;
1777 } else
1778 /* panic here, because a device, found at boottime has
1779 vanished */
1780 panic("IBM MCA SCSI: ldn=0x%x, SCSI-device on (%d,%d) vanished!\n", ldn, target, cmd->device->lun);
1781 /* unassign again all ldns (pun,lun,ldn does not matter for remove) */
1782 immediate_assign(shpnt, 0, 0, 0, REMOVE_LDN);
1783 /* remap all ldns, as written in the pun/lun table */
1784 lun = 0;
1785#ifdef CONFIG_SCSI_MULTI_LUN
1786 for (lun = 0; lun < 8; lun++)
1787#endif
1788 for (id = 0; id < max_pun; id++) {
1789 if (get_ldn(shpnt)[id][lun] <= MAX_LOG_DEV)
1790 immediate_assign(shpnt, id, lun, get_ldn(shpnt)[id][lun], SET_LDN);
1791 }
1792 /* set back to normal interrupt_handling */
1793 local_checking_phase_flag(shpnt) = 0;
1794#ifdef IM_DEBUG_PROBE
1795 /* Information on syslog terminal */
1796 printk("IBM MCA SCSI: ldn=0x%x dynamically reassigned to (%d,%d).\n", ldn, target, cmd->device->lun);
1797#endif
1798 /* increase next_ldn for next dynamical assignment */
1799 next_ldn(shpnt)++;
1800 if (next_ldn(shpnt) >= MAX_LOG_DEV)
1801 next_ldn(shpnt) = 7;
1802 } else { /* wall against Linux accesses to the subsystem adapter */
1803 cmd->result = DID_BAD_TARGET << 16;
1804 if (done)
1805 done(cmd);
1806 return 0;
1807 }
1808 }
1809
1810 /*verify there is no command already in progress for this log dev */
1811 if (ld(shpnt)[ldn].cmd)
1812 panic("IBM MCA SCSI: cmd already in progress for this ldn.\n");
1813
1814 /*save done in cmd, and save cmd for the interrupt handler */
1815 cmd->scsi_done = done;
1816 ld(shpnt)[ldn].cmd = cmd;
1817
1818 /*fill scb information independent of the scsi command */
1819 scb = &(ld(shpnt)[ldn].scb);
1820 ld(shpnt)[ldn].tsb.dev_status = 0;
1821 scb->enable = IM_REPORT_TSB_ONLY_ON_ERROR | IM_RETRY_ENABLE;
1822 scb->tsb_adr = isa_virt_to_bus(&(ld(shpnt)[ldn].tsb));
1823 scsi_cmd = cmd->cmnd[0];
1824
1825 if (scsi_sg_count(cmd)) {
1826 BUG_ON(scsi_sg_count(cmd) > 16);
1827
1828 scsi_for_each_sg(cmd, sg, scsi_sg_count(cmd), i) {
1829 ld(shpnt)[ldn].sge[i].address = (void *) (isa_page_to_bus(sg_page(sg)) + sg->offset);
1830 ld(shpnt)[ldn].sge[i].byte_length = sg->length;
1831 }
1832 scb->enable |= IM_POINTER_TO_LIST;
1833 scb->sys_buf_adr = isa_virt_to_bus(&(ld(shpnt)[ldn].sge[0]));
1834 scb->sys_buf_length = scsi_sg_count(cmd) * sizeof(struct im_sge);
1835 } else {
1836 scb->sys_buf_adr = isa_virt_to_bus(scsi_sglist(cmd));
1837 /* recent Linux midlevel SCSI places 1024 byte for inquiry
1838 * command. Far too much for old PS/2 hardware. */
1839 switch (scsi_cmd) {
1840 /* avoid command errors by setting bufferlengths to
1841 * ANSI-standard. Beware of forcing it to 255,
1842 * this could SEGV the kernel!!! */
1843 case INQUIRY:
1844 case REQUEST_SENSE:
1845 case MODE_SENSE:
1846 case MODE_SELECT:
1847 if (scsi_bufflen(cmd) > 255)
1848 scb->sys_buf_length = 255;
1849 else
1850 scb->sys_buf_length = scsi_bufflen(cmd);
1851 break;
1852 case TEST_UNIT_READY:
1853 scb->sys_buf_length = 0;
1854 break;
1855 default:
1856 scb->sys_buf_length = scsi_bufflen(cmd);
1857 break;
1858 }
1859 }
1860 /*fill scb information dependent on scsi command */
1861
1862#ifdef IM_DEBUG_CMD
1863 printk("issue scsi cmd=%02x to ldn=%d\n", scsi_cmd, ldn);
1864#endif
1865
1866 /* for specific device-type debugging: */
1867#ifdef IM_DEBUG_CMD_SPEC_DEV
1868 if (ld(shpnt)[ldn].device_type == IM_DEBUG_CMD_DEVICE)
1869 printk("(SCSI-device-type=0x%x) issue scsi cmd=%02x to ldn=%d\n", ld(shpnt)[ldn].device_type, scsi_cmd, ldn);
1870#endif
1871
1872 /* for possible panics store current command */
1873 last_scsi_command(shpnt)[ldn] = scsi_cmd;
1874 last_scsi_type(shpnt)[ldn] = IM_SCB;
1875 /* update statistical info */
1876 IBM_DS(shpnt).total_accesses++;
1877 IBM_DS(shpnt).ldn_access[ldn]++;
1878
1879 switch (scsi_cmd) {
1880 case READ_6:
1881 case WRITE_6:
1882 case READ_10:
1883 case WRITE_10:
1884 case READ_12:
1885 case WRITE_12:
1886 /* Distinguish between disk and other devices. Only disks (that are the
1887 most frequently accessed devices) should be supported by the
1888 IBM-SCSI-Subsystem commands. */
1889 switch (ld(shpnt)[ldn].device_type) {
1890 case TYPE_DISK: /* for harddisks enter here ... */
1891 case TYPE_MOD: /* ... try it also for MO-drives (send flames as */
1892 /* you like, if this won't work.) */
1893 if (scsi_cmd == READ_6 || scsi_cmd == READ_10 || scsi_cmd == READ_12) {
1894 /* read command preparations */
1895 scb->enable |= IM_READ_CONTROL;
1896 IBM_DS(shpnt).ldn_read_access[ldn]++; /* increase READ-access on ldn stat. */
1897 scb->command = IM_READ_DATA_CMD | IM_NO_DISCONNECT;
1898 } else { /* write command preparations */
1899 IBM_DS(shpnt).ldn_write_access[ldn]++; /* increase write-count on ldn stat. */
1900 scb->command = IM_WRITE_DATA_CMD | IM_NO_DISCONNECT;
1901 }
1902 if (scsi_cmd == READ_6 || scsi_cmd == WRITE_6) {
1903 scb->u1.log_blk_adr = (((unsigned) cmd->cmnd[3]) << 0) | (((unsigned) cmd->cmnd[2]) << 8) | ((((unsigned) cmd->cmnd[1]) & 0x1f) << 16);
1904 scb->u2.blk.count = (unsigned) cmd->cmnd[4];
1905 } else {
1906 scb->u1.log_blk_adr = (((unsigned) cmd->cmnd[5]) << 0) | (((unsigned) cmd->cmnd[4]) << 8) | (((unsigned) cmd->cmnd[3]) << 16) | (((unsigned) cmd->cmnd[2]) << 24);
1907 scb->u2.blk.count = (((unsigned) cmd->cmnd[8]) << 0) | (((unsigned) cmd->cmnd[7]) << 8);
1908 }
1909 last_scsi_logical_block(shpnt)[ldn] = scb->u1.log_blk_adr;
1910 last_scsi_blockcount(shpnt)[ldn] = scb->u2.blk.count;
1911 scb->u2.blk.length = ld(shpnt)[ldn].block_length;
1912 break;
1913 /* for other devices, enter here. Other types are not known by
1914 Linux! TYPE_NO_LUN is forbidden as valid device. */
1915 case TYPE_ROM:
1916 case TYPE_TAPE:
1917 case TYPE_PROCESSOR:
1918 case TYPE_WORM:
1919 case TYPE_SCANNER:
1920 case TYPE_MEDIUM_CHANGER:
1921 /* If there is a sequential-device, IBM recommends to use
1922 IM_OTHER_SCSI_CMD_CMD instead of subsystem READ/WRITE.
1923 This includes CD-ROM devices, too, due to the partial sequential
1924 read capabilities. */
1925 scb->command = IM_OTHER_SCSI_CMD_CMD;
1926 if (scsi_cmd == READ_6 || scsi_cmd == READ_10 || scsi_cmd == READ_12)
1927 /* enable READ */
1928 scb->enable |= IM_READ_CONTROL;
1929 scb->enable |= IM_BYPASS_BUFFER;
1930 scb->u1.scsi_cmd_length = cmd->cmd_len;
1931 memcpy(scb->u2.scsi_command, cmd->cmnd, cmd->cmd_len);
1932 last_scsi_type(shpnt)[ldn] = IM_LONG_SCB;
1933 /* Read/write on this non-disk devices is also displayworthy,
1934 so flash-up the LED/display. */
1935 break;
1936 }
1937 break;
1938 case INQUIRY:
1939 IBM_DS(shpnt).ldn_inquiry_access[ldn]++;
1940 scb->command = IM_DEVICE_INQUIRY_CMD;
1941 scb->enable |= IM_READ_CONTROL | IM_SUPRESS_EXCEPTION_SHORT | IM_BYPASS_BUFFER;
1942 scb->u1.log_blk_adr = 0;
1943 break;
1944 case TEST_UNIT_READY:
1945 scb->command = IM_OTHER_SCSI_CMD_CMD;
1946 scb->enable |= IM_READ_CONTROL | IM_SUPRESS_EXCEPTION_SHORT | IM_BYPASS_BUFFER;
1947 scb->u1.log_blk_adr = 0;
1948 scb->u1.scsi_cmd_length = 6;
1949 memcpy(scb->u2.scsi_command, cmd->cmnd, 6);
1950 last_scsi_type(shpnt)[ldn] = IM_LONG_SCB;
1951 break;
1952 case READ_CAPACITY:
1953 /* the length of system memory buffer must be exactly 8 bytes */
1954 scb->command = IM_READ_CAPACITY_CMD;
1955 scb->enable |= IM_READ_CONTROL | IM_BYPASS_BUFFER;
1956 if (scb->sys_buf_length > 8)
1957 scb->sys_buf_length = 8;
1958 break;
1959 /* Commands that need read-only-mode (system <- device): */
1960 case REQUEST_SENSE:
1961 scb->command = IM_REQUEST_SENSE_CMD;
1962 scb->enable |= IM_READ_CONTROL | IM_SUPRESS_EXCEPTION_SHORT | IM_BYPASS_BUFFER;
1963 break;
1964 /* Commands that need write-only-mode (system -> device): */
1965 case MODE_SELECT:
1966 case MODE_SELECT_10:
1967 IBM_DS(shpnt).ldn_modeselect_access[ldn]++;
1968 scb->command = IM_OTHER_SCSI_CMD_CMD;
1969 scb->enable |= IM_SUPRESS_EXCEPTION_SHORT | IM_BYPASS_BUFFER; /*Select needs WRITE-enabled */
1970 scb->u1.scsi_cmd_length = cmd->cmd_len;
1971 memcpy(scb->u2.scsi_command, cmd->cmnd, cmd->cmd_len);
1972 last_scsi_type(shpnt)[ldn] = IM_LONG_SCB;
1973 break;
1974 /* For other commands, read-only is useful. Most other commands are
1975 running without an input-data-block. */
1976 default:
1977 scb->command = IM_OTHER_SCSI_CMD_CMD;
1978 scb->enable |= IM_READ_CONTROL | IM_SUPRESS_EXCEPTION_SHORT | IM_BYPASS_BUFFER;
1979 scb->u1.scsi_cmd_length = cmd->cmd_len;
1980 memcpy(scb->u2.scsi_command, cmd->cmnd, cmd->cmd_len);
1981 last_scsi_type(shpnt)[ldn] = IM_LONG_SCB;
1982 break;
1983 }
1984 /*issue scb command, and return */
1985 if (++disk_rw_in_progress == 1)
1986 PS2_DISK_LED_ON(shpnt->host_no, target);
1987
1988 if (last_scsi_type(shpnt)[ldn] == IM_LONG_SCB) {
1989 issue_cmd(shpnt, isa_virt_to_bus(scb), IM_LONG_SCB | ldn);
1990 IBM_DS(shpnt).long_scbs++;
1991 } else {
1992 issue_cmd(shpnt, isa_virt_to_bus(scb), IM_SCB | ldn);
1993 IBM_DS(shpnt).scbs++;
1994 }
1995 return 0;
1996}
1997
1998static DEF_SCSI_QCMD(ibmmca_queuecommand)
1999
2000static int __ibmmca_abort(Scsi_Cmnd * cmd)
2001{
2002 /* Abort does not work, as the adapter never generates an interrupt on
2003 * whatever situation is simulated, even when really pending commands
2004 * are running on the adapters' hardware ! */
2005
2006 struct Scsi_Host *shpnt;
2007 unsigned int ldn;
2008 void (*saved_done) (Scsi_Cmnd *);
2009 int target;
2010 int max_pun;
2011 unsigned long imm_command;
2012
2013#ifdef IM_DEBUG_PROBE
2014 printk("IBM MCA SCSI: Abort subroutine called...\n");
2015#endif
2016
2017 shpnt = cmd->device->host;
2018
2019 max_pun = subsystem_maxid(shpnt);
2020 if (ibm_ansi_order) {
2021 target = max_pun - 1 - cmd->device->id;
2022 if ((target <= subsystem_pun(shpnt)) && (cmd->device->id <= subsystem_pun(shpnt)))
2023 target--;
2024 else if ((target >= subsystem_pun(shpnt)) && (cmd->device->id >= subsystem_pun(shpnt)))
2025 target++;
2026 } else
2027 target = cmd->device->id;
2028
2029 /* get logical device number, and disable system interrupts */
2030 printk(KERN_WARNING "IBM MCA SCSI: Sending abort to device pun=%d, lun=%d.\n", target, cmd->device->lun);
2031 ldn = get_ldn(shpnt)[target][cmd->device->lun];
2032
2033 /*if cmd for this ldn has already finished, no need to abort */
2034 if (!ld(shpnt)[ldn].cmd) {
2035 return SUCCESS;
2036 }
2037
2038 /* Clear ld.cmd, save done function, install internal done,
2039 * send abort immediate command (this enables sys. interrupts),
2040 * and wait until the interrupt arrives.
2041 */
2042 saved_done = cmd->scsi_done;
2043 cmd->scsi_done = internal_done;
2044 cmd->SCp.Status = 0;
2045 last_scsi_command(shpnt)[ldn] = IM_ABORT_IMM_CMD;
2046 last_scsi_type(shpnt)[ldn] = IM_IMM_CMD;
2047 imm_command = inl(IM_CMD_REG(shpnt));
2048 imm_command &= (unsigned long) (0xffff0000); /* mask reserved stuff */
2049 imm_command |= (unsigned long) (IM_ABORT_IMM_CMD);
2050 /* must wait for attention reg not busy */
2051 /* FIXME - timeout, politeness */
2052 while (1) {
2053 if (!(inb(IM_STAT_REG(shpnt)) & IM_BUSY))
2054 break;
2055 }
2056 /* write registers and enable system interrupts */
2057 outl(imm_command, IM_CMD_REG(shpnt));
2058 outb(IM_IMM_CMD | ldn, IM_ATTN_REG(shpnt));
2059#ifdef IM_DEBUG_PROBE
2060 printk("IBM MCA SCSI: Abort queued to adapter...\n");
2061#endif
2062 spin_unlock_irq(shpnt->host_lock);
2063 while (!cmd->SCp.Status)
2064 yield();
2065 spin_lock_irq(shpnt->host_lock);
2066 cmd->scsi_done = saved_done;
2067#ifdef IM_DEBUG_PROBE
2068 printk("IBM MCA SCSI: Abort returned with adapter response...\n");
2069#endif
2070
2071 /*if abort went well, call saved done, then return success or error */
2072 if (cmd->result == (DID_ABORT << 16))
2073 {
2074 cmd->result |= DID_ABORT << 16;
2075 if (cmd->scsi_done)
2076 (cmd->scsi_done) (cmd);
2077 ld(shpnt)[ldn].cmd = NULL;
2078#ifdef IM_DEBUG_PROBE
2079 printk("IBM MCA SCSI: Abort finished with success.\n");
2080#endif
2081 return SUCCESS;
2082 } else {
2083 cmd->result |= DID_NO_CONNECT << 16;
2084 if (cmd->scsi_done)
2085 (cmd->scsi_done) (cmd);
2086 ld(shpnt)[ldn].cmd = NULL;
2087#ifdef IM_DEBUG_PROBE
2088 printk("IBM MCA SCSI: Abort failed.\n");
2089#endif
2090 return FAILED;
2091 }
2092}
2093
2094static int ibmmca_abort(Scsi_Cmnd * cmd)
2095{
2096 struct Scsi_Host *shpnt = cmd->device->host;
2097 int rc;
2098
2099 spin_lock_irq(shpnt->host_lock);
2100 rc = __ibmmca_abort(cmd);
2101 spin_unlock_irq(shpnt->host_lock);
2102
2103 return rc;
2104}
2105
2106static int __ibmmca_host_reset(Scsi_Cmnd * cmd)
2107{
2108 struct Scsi_Host *shpnt;
2109 Scsi_Cmnd *cmd_aid;
2110 int ticks, i;
2111 unsigned long imm_command;
2112
2113 BUG_ON(cmd == NULL);
2114
2115 ticks = IM_RESET_DELAY * HZ;
2116 shpnt = cmd->device->host;
2117
2118 if (local_checking_phase_flag(shpnt)) {
2119 printk(KERN_WARNING "IBM MCA SCSI: unable to reset while checking devices.\n");
2120 return FAILED;
2121 }
2122
2123 /* issue reset immediate command to subsystem, and wait for interrupt */
2124 printk("IBM MCA SCSI: resetting all devices.\n");
2125 reset_status(shpnt) = IM_RESET_IN_PROGRESS;
2126 last_scsi_command(shpnt)[0xf] = IM_RESET_IMM_CMD;
2127 last_scsi_type(shpnt)[0xf] = IM_IMM_CMD;
2128 imm_command = inl(IM_CMD_REG(shpnt));
2129 imm_command &= (unsigned long) (0xffff0000); /* mask reserved stuff */
2130 imm_command |= (unsigned long) (IM_RESET_IMM_CMD);
2131 /* must wait for attention reg not busy */
2132 while (1) {
2133 if (!(inb(IM_STAT_REG(shpnt)) & IM_BUSY))
2134 break;
2135 spin_unlock_irq(shpnt->host_lock);
2136 yield();
2137 spin_lock_irq(shpnt->host_lock);
2138 }
2139 /*write registers and enable system interrupts */
2140 outl(imm_command, IM_CMD_REG(shpnt));
2141 outb(IM_IMM_CMD | 0xf, IM_ATTN_REG(shpnt));
2142 /* wait for interrupt finished or intr_stat register to be set, as the
2143 * interrupt will not be executed, while we are in here! */
2144
2145 /* FIXME: This is really really icky we so want a sleeping version of this ! */
2146 while (reset_status(shpnt) == IM_RESET_IN_PROGRESS && --ticks && ((inb(IM_INTR_REG(shpnt)) & 0x8f) != 0x8f)) {
2147 udelay((1 + 999 / HZ) * 1000);
2148 barrier();
2149 }
2150 /* if reset did not complete, just return an error */
2151 if (!ticks) {
2152 printk(KERN_ERR "IBM MCA SCSI: reset did not complete within %d seconds.\n", IM_RESET_DELAY);
2153 reset_status(shpnt) = IM_RESET_FINISHED_FAIL;
2154 return FAILED;
2155 }
2156
2157 if ((inb(IM_INTR_REG(shpnt)) & 0x8f) == 0x8f) {
2158 /* analysis done by this routine and not by the intr-routine */
2159 if (inb(IM_INTR_REG(shpnt)) == 0xaf)
2160 reset_status(shpnt) = IM_RESET_FINISHED_OK_NO_INT;
2161 else if (inb(IM_INTR_REG(shpnt)) == 0xcf)
2162 reset_status(shpnt) = IM_RESET_FINISHED_FAIL;
2163 else /* failed, 4get it */
2164 reset_status(shpnt) = IM_RESET_NOT_IN_PROGRESS_NO_INT;
2165 outb(IM_EOI | 0xf, IM_ATTN_REG(shpnt));
2166 }
2167
2168 /* if reset failed, just return an error */
2169 if (reset_status(shpnt) == IM_RESET_FINISHED_FAIL) {
2170 printk(KERN_ERR "IBM MCA SCSI: reset failed.\n");
2171 return FAILED;
2172 }
2173
2174 /* so reset finished ok - call outstanding done's, and return success */
2175 printk(KERN_INFO "IBM MCA SCSI: Reset successfully completed.\n");
2176 for (i = 0; i < MAX_LOG_DEV; i++) {
2177 cmd_aid = ld(shpnt)[i].cmd;
2178 if (cmd_aid && cmd_aid->scsi_done) {
2179 ld(shpnt)[i].cmd = NULL;
2180 cmd_aid->result = DID_RESET << 16;
2181 }
2182 }
2183 return SUCCESS;
2184}
2185
2186static int ibmmca_host_reset(Scsi_Cmnd * cmd)
2187{
2188 struct Scsi_Host *shpnt = cmd->device->host;
2189 int rc;
2190
2191 spin_lock_irq(shpnt->host_lock);
2192 rc = __ibmmca_host_reset(cmd);
2193 spin_unlock_irq(shpnt->host_lock);
2194
2195 return rc;
2196}
2197
2198static int ibmmca_biosparam(struct scsi_device *sdev, struct block_device *bdev, sector_t capacity, int *info)
2199{
2200 int size = capacity;
2201 info[0] = 64;
2202 info[1] = 32;
2203 info[2] = size / (info[0] * info[1]);
2204 if (info[2] >= 1024) {
2205 info[0] = 128;
2206 info[1] = 63;
2207 info[2] = size / (info[0] * info[1]);
2208 if (info[2] >= 1024) {
2209 info[0] = 255;
2210 info[1] = 63;
2211 info[2] = size / (info[0] * info[1]);
2212 if (info[2] >= 1024)
2213 info[2] = 1023;
2214 }
2215 }
2216 return 0;
2217}
2218
2219/* calculate percentage of total accesses on a ldn */
2220static int ldn_access_load(struct Scsi_Host *shpnt, int ldn)
2221{
2222 if (IBM_DS(shpnt).total_accesses == 0)
2223 return (0);
2224 if (IBM_DS(shpnt).ldn_access[ldn] == 0)
2225 return (0);
2226 return (IBM_DS(shpnt).ldn_access[ldn] * 100) / IBM_DS(shpnt).total_accesses;
2227}
2228
2229/* calculate total amount of r/w-accesses */
2230static int ldn_access_total_read_write(struct Scsi_Host *shpnt)
2231{
2232 int a;
2233 int i;
2234
2235 a = 0;
2236 for (i = 0; i <= MAX_LOG_DEV; i++)
2237 a += IBM_DS(shpnt).ldn_read_access[i] + IBM_DS(shpnt).ldn_write_access[i];
2238 return (a);
2239}
2240
2241static int ldn_access_total_inquiry(struct Scsi_Host *shpnt)
2242{
2243 int a;
2244 int i;
2245
2246 a = 0;
2247 for (i = 0; i <= MAX_LOG_DEV; i++)
2248 a += IBM_DS(shpnt).ldn_inquiry_access[i];
2249 return (a);
2250}
2251
2252static int ldn_access_total_modeselect(struct Scsi_Host *shpnt)
2253{
2254 int a;
2255 int i;
2256
2257 a = 0;
2258 for (i = 0; i <= MAX_LOG_DEV; i++)
2259 a += IBM_DS(shpnt).ldn_modeselect_access[i];
2260 return (a);
2261}
2262
2263/* routine to display info in the proc-fs-structure (a deluxe feature) */
2264static int ibmmca_proc_info(struct Scsi_Host *shpnt, char *buffer, char **start, off_t offset, int length, int inout)
2265{
2266 int len = 0;
2267 int i, id, lun;
2268 unsigned long flags;
2269 int max_pun;
2270
2271
2272 spin_lock_irqsave(shpnt->host_lock, flags); /* Check it */
2273
2274 max_pun = subsystem_maxid(shpnt);
2275
2276 len += sprintf(buffer + len, "\n IBM-SCSI-Subsystem-Linux-Driver, Version %s\n\n\n", IBMMCA_SCSI_DRIVER_VERSION);
2277 len += sprintf(buffer + len, " SCSI Access-Statistics:\n");
2278 len += sprintf(buffer + len, " Device Scanning Order....: %s\n", (ibm_ansi_order) ? "IBM/ANSI" : "New Industry Standard");
2279#ifdef CONFIG_SCSI_MULTI_LUN
2280 len += sprintf(buffer + len, " Multiple LUN probing.....: Yes\n");
2281#else
2282 len += sprintf(buffer + len, " Multiple LUN probing.....: No\n");
2283#endif
2284 len += sprintf(buffer + len, " This Hostnumber..........: %d\n", shpnt->host_no);
2285 len += sprintf(buffer + len, " Base I/O-Port............: 0x%x\n", (unsigned int) (IM_CMD_REG(shpnt)));
2286 len += sprintf(buffer + len, " (Shared) IRQ.............: %d\n", IM_IRQ);
2287 len += sprintf(buffer + len, " Total Interrupts.........: %d\n", IBM_DS(shpnt).total_interrupts);
2288 len += sprintf(buffer + len, " Total SCSI Accesses......: %d\n", IBM_DS(shpnt).total_accesses);
2289 len += sprintf(buffer + len, " Total short SCBs.........: %d\n", IBM_DS(shpnt).scbs);
2290 len += sprintf(buffer + len, " Total long SCBs..........: %d\n", IBM_DS(shpnt).long_scbs);
2291 len += sprintf(buffer + len, " Total SCSI READ/WRITE..: %d\n", ldn_access_total_read_write(shpnt));
2292 len += sprintf(buffer + len, " Total SCSI Inquiries...: %d\n", ldn_access_total_inquiry(shpnt));
2293 len += sprintf(buffer + len, " Total SCSI Modeselects.: %d\n", ldn_access_total_modeselect(shpnt));
2294 len += sprintf(buffer + len, " Total SCSI other cmds..: %d\n", IBM_DS(shpnt).total_accesses - ldn_access_total_read_write(shpnt)
2295 - ldn_access_total_modeselect(shpnt)
2296 - ldn_access_total_inquiry(shpnt));
2297 len += sprintf(buffer + len, " Total SCSI command fails.: %d\n\n", IBM_DS(shpnt).total_errors);
2298 len += sprintf(buffer + len, " Logical-Device-Number (LDN) Access-Statistics:\n");
2299 len += sprintf(buffer + len, " LDN | Accesses [%%] | READ | WRITE | ASSIGNMENTS\n");
2300 len += sprintf(buffer + len, " -----|--------------|-----------|-----------|--------------\n");
2301 for (i = 0; i <= MAX_LOG_DEV; i++)
2302 len += sprintf(buffer + len, " %2X | %3d | %8d | %8d | %8d\n", i, ldn_access_load(shpnt, i), IBM_DS(shpnt).ldn_read_access[i], IBM_DS(shpnt).ldn_write_access[i], IBM_DS(shpnt).ldn_assignments[i]);
2303 len += sprintf(buffer + len, " -----------------------------------------------------------\n\n");
2304 len += sprintf(buffer + len, " Dynamical-LDN-Assignment-Statistics:\n");
2305 len += sprintf(buffer + len, " Number of physical SCSI-devices..: %d (+ Adapter)\n", IBM_DS(shpnt).total_scsi_devices);
2306 len += sprintf(buffer + len, " Dynamical Assignment necessary...: %s\n", IBM_DS(shpnt).dyn_flag ? "Yes" : "No ");
2307 len += sprintf(buffer + len, " Next LDN to be assigned..........: 0x%x\n", next_ldn(shpnt));
2308 len += sprintf(buffer + len, " Dynamical assignments done yet...: %d\n", IBM_DS(shpnt).dynamical_assignments);
2309 len += sprintf(buffer + len, "\n Current SCSI-Device-Mapping:\n");
2310 len += sprintf(buffer + len, " Physical SCSI-Device Map Logical SCSI-Device Map\n");
2311 len += sprintf(buffer + len, " ID\\LUN 0 1 2 3 4 5 6 7 ID\\LUN 0 1 2 3 4 5 6 7\n");
2312 for (id = 0; id < max_pun; id++) {
2313 len += sprintf(buffer + len, " %2d ", id);
2314 for (lun = 0; lun < 8; lun++)
2315 len += sprintf(buffer + len, "%2s ", ti_p(get_scsi(shpnt)[id][lun]));
2316 len += sprintf(buffer + len, " %2d ", id);
2317 for (lun = 0; lun < 8; lun++)
2318 len += sprintf(buffer + len, "%2s ", ti_l(get_ldn(shpnt)[id][lun]));
2319 len += sprintf(buffer + len, "\n");
2320 }
2321
2322 len += sprintf(buffer + len, "(A = IBM-Subsystem, D = Harddisk, T = Tapedrive, P = Processor, W = WORM,\n");
2323 len += sprintf(buffer + len, " R = CD-ROM, S = Scanner, M = MO-Drive, C = Medium-Changer, + = unprovided LUN,\n");
2324 len += sprintf(buffer + len, " - = nothing found, nothing assigned or unprobed LUN)\n\n");
2325
2326 *start = buffer + offset;
2327 len -= offset;
2328 if (len > length)
2329 len = length;
2330 spin_unlock_irqrestore(shpnt->host_lock, flags);
2331 return len;
2332}
2333
2334static int option_setup(char *str)
2335{
2336 int ints[IM_MAX_HOSTS];
2337 char *cur = str;
2338 int i = 1;
2339
2340 while (cur && isdigit(*cur) && i < IM_MAX_HOSTS) {
2341 ints[i++] = simple_strtoul(cur, NULL, 0);
2342 if ((cur = strchr(cur, ',')) != NULL)
2343 cur++;
2344 }
2345 ints[0] = i - 1;
2346 internal_ibmmca_scsi_setup(cur, ints);
2347 return 1;
2348}
2349
2350__setup("ibmmcascsi=", option_setup);
2351
2352static struct mca_driver ibmmca_driver = {
2353 .id_table = ibmmca_id_table,
2354 .driver = {
2355 .name = "ibmmca",
2356 .bus = &mca_bus_type,
2357 .probe = ibmmca_probe,
2358 .remove = __devexit_p(ibmmca_remove),
2359 },
2360};
2361
2362static int __init ibmmca_init(void)
2363{
2364#ifdef MODULE
2365 /* If the driver is run as module, read from conf.modules or cmd-line */
2366 if (boot_options)
2367 option_setup(boot_options);
2368#endif
2369
2370 return mca_register_driver_integrated(&ibmmca_driver, MCA_INTEGSCSI);
2371}
2372
2373static void __exit ibmmca_exit(void)
2374{
2375 mca_unregister_driver(&ibmmca_driver);
2376}
2377
2378module_init(ibmmca_init);
2379module_exit(ibmmca_exit);
diff --git a/drivers/scsi/sim710.c b/drivers/scsi/sim710.c
index 8ac6ce792b69..a318264a4ba1 100644
--- a/drivers/scsi/sim710.c
+++ b/drivers/scsi/sim710.c
@@ -17,7 +17,7 @@
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *---------------------------------------------------------------------------- 18 *----------------------------------------------------------------------------
19 * 19 *
20 * MCA card detection code by Trent McNair. 20 * MCA card detection code by Trent McNair. (now deleted)
21 * Fixes to not explicitly nul bss data from Xavier Bestel. 21 * Fixes to not explicitly nul bss data from Xavier Bestel.
22 * Some multiboard fixes from Rolf Eike Beer. 22 * Some multiboard fixes from Rolf Eike Beer.
23 * Auto probing of EISA config space from Trevor Hemsley. 23 * Auto probing of EISA config space from Trevor Hemsley.
@@ -32,7 +32,6 @@
32#include <linux/blkdev.h> 32#include <linux/blkdev.h>
33#include <linux/device.h> 33#include <linux/device.h>
34#include <linux/init.h> 34#include <linux/init.h>
35#include <linux/mca.h>
36#include <linux/eisa.h> 35#include <linux/eisa.h>
37#include <linux/interrupt.h> 36#include <linux/interrupt.h>
38#include <scsi/scsi_host.h> 37#include <scsi/scsi_host.h>
@@ -43,7 +42,7 @@
43#include "53c700.h" 42#include "53c700.h"
44 43
45 44
46/* Must be enough for both EISA and MCA */ 45/* Must be enough for EISA */
47#define MAX_SLOTS 8 46#define MAX_SLOTS 8
48static __u8 __initdata id_array[MAX_SLOTS] = { [0 ... MAX_SLOTS-1] = 7 }; 47static __u8 __initdata id_array[MAX_SLOTS] = { [0 ... MAX_SLOTS-1] = 7 };
49 48
@@ -89,7 +88,7 @@ param_setup(char *str)
89__setup("sim710=", param_setup); 88__setup("sim710=", param_setup);
90 89
91static struct scsi_host_template sim710_driver_template = { 90static struct scsi_host_template sim710_driver_template = {
92 .name = "LSI (Symbios) 710 MCA/EISA", 91 .name = "LSI (Symbios) 710 EISA",
93 .proc_name = "sim710", 92 .proc_name = "sim710",
94 .this_id = 7, 93 .this_id = 7,
95 .module = THIS_MODULE, 94 .module = THIS_MODULE,
@@ -169,114 +168,6 @@ sim710_device_remove(struct device *dev)
169 return 0; 168 return 0;
170} 169}
171 170
172#ifdef CONFIG_MCA
173
174/* CARD ID 01BB and 01BA use the same pos values */
175#define MCA_01BB_IO_PORTS { 0x0000, 0x0000, 0x0800, 0x0C00, 0x1000, 0x1400, \
176 0x1800, 0x1C00, 0x2000, 0x2400, 0x2800, \
177 0x2C00, 0x3000, 0x3400, 0x3800, 0x3C00, \
178 0x4000, 0x4400, 0x4800, 0x4C00, 0x5000 }
179
180#define MCA_01BB_IRQS { 3, 5, 11, 14 }
181
182/* CARD ID 004f */
183#define MCA_004F_IO_PORTS { 0x0000, 0x0200, 0x0300, 0x0400, 0x0500, 0x0600 }
184#define MCA_004F_IRQS { 5, 9, 14 }
185
186static short sim710_mca_id_table[] = { 0x01bb, 0x01ba, 0x004f, 0};
187
188static __init int
189sim710_mca_probe(struct device *dev)
190{
191 struct mca_device *mca_dev = to_mca_device(dev);
192 int slot = mca_dev->slot;
193 int pos[3];
194 unsigned int base;
195 int irq_vector;
196 short id = sim710_mca_id_table[mca_dev->index];
197 static int io_004f_by_pos[] = MCA_004F_IO_PORTS;
198 static int irq_004f_by_pos[] = MCA_004F_IRQS;
199 static int io_01bb_by_pos[] = MCA_01BB_IO_PORTS;
200 static int irq_01bb_by_pos[] = MCA_01BB_IRQS;
201 char *name;
202 int clock;
203
204 pos[0] = mca_device_read_stored_pos(mca_dev, 2);
205 pos[1] = mca_device_read_stored_pos(mca_dev, 3);
206 pos[2] = mca_device_read_stored_pos(mca_dev, 4);
207
208 /*
209 * 01BB & 01BA port base by bits 7,6,5,4,3,2 in pos[2]
210 *
211 * 000000 <disabled> 001010 0x2800
212 * 000001 <invalid> 001011 0x2C00
213 * 000010 0x0800 001100 0x3000
214 * 000011 0x0C00 001101 0x3400
215 * 000100 0x1000 001110 0x3800
216 * 000101 0x1400 001111 0x3C00
217 * 000110 0x1800 010000 0x4000
218 * 000111 0x1C00 010001 0x4400
219 * 001000 0x2000 010010 0x4800
220 * 001001 0x2400 010011 0x4C00
221 * 010100 0x5000
222 *
223 * 00F4 port base by bits 3,2,1 in pos[0]
224 *
225 * 000 <disabled> 001 0x200
226 * 010 0x300 011 0x400
227 * 100 0x500 101 0x600
228 *
229 * 01BB & 01BA IRQ is specified in pos[0] bits 7 and 6:
230 *
231 * 00 3 10 11
232 * 01 5 11 14
233 *
234 * 00F4 IRQ specified by bits 6,5,4 in pos[0]
235 *
236 * 100 5 101 9
237 * 110 14
238 */
239
240 if (id == 0x01bb || id == 0x01ba) {
241 base = io_01bb_by_pos[(pos[2] & 0xFC) >> 2];
242 irq_vector =
243 irq_01bb_by_pos[((pos[0] & 0xC0) >> 6)];
244
245 clock = 50;
246 if (id == 0x01bb)
247 name = "NCR 3360/3430 SCSI SubSystem";
248 else
249 name = "NCR Dual SIOP SCSI Host Adapter Board";
250 } else if ( id == 0x004f ) {
251 base = io_004f_by_pos[((pos[0] & 0x0E) >> 1)];
252 irq_vector =
253 irq_004f_by_pos[((pos[0] & 0x70) >> 4) - 4];
254 clock = 50;
255 name = "NCR 53c710 SCSI Host Adapter Board";
256 } else {
257 return -ENODEV;
258 }
259 mca_device_set_name(mca_dev, name);
260 mca_device_set_claim(mca_dev, 1);
261 base = mca_device_transform_ioport(mca_dev, base);
262 irq_vector = mca_device_transform_irq(mca_dev, irq_vector);
263
264 return sim710_probe_common(dev, base, irq_vector, clock,
265 0, id_array[slot]);
266}
267
268static struct mca_driver sim710_mca_driver = {
269 .id_table = sim710_mca_id_table,
270 .driver = {
271 .name = "sim710",
272 .bus = &mca_bus_type,
273 .probe = sim710_mca_probe,
274 .remove = __devexit_p(sim710_device_remove),
275 },
276};
277
278#endif /* CONFIG_MCA */
279
280#ifdef CONFIG_EISA 171#ifdef CONFIG_EISA
281static struct eisa_device_id sim710_eisa_ids[] = { 172static struct eisa_device_id sim710_eisa_ids[] = {
282 { "CPQ4410" }, 173 { "CPQ4410" },
@@ -344,10 +235,6 @@ static int __init sim710_init(void)
344 param_setup(sim710); 235 param_setup(sim710);
345#endif 236#endif
346 237
347#ifdef CONFIG_MCA
348 err = mca_register_driver(&sim710_mca_driver);
349#endif
350
351#ifdef CONFIG_EISA 238#ifdef CONFIG_EISA
352 err = eisa_driver_register(&sim710_eisa_driver); 239 err = eisa_driver_register(&sim710_eisa_driver);
353#endif 240#endif
@@ -361,11 +248,6 @@ static int __init sim710_init(void)
361 248
362static void __exit sim710_exit(void) 249static void __exit sim710_exit(void)
363{ 250{
364#ifdef CONFIG_MCA
365 if (MCA_bus)
366 mca_unregister_driver(&sim710_mca_driver);
367#endif
368
369#ifdef CONFIG_EISA 251#ifdef CONFIG_EISA
370 eisa_driver_unregister(&sim710_eisa_driver); 252 eisa_driver_unregister(&sim710_eisa_driver);
371#endif 253#endif
diff --git a/drivers/tty/serial/8250/8250_mca.c b/drivers/tty/serial/8250/8250_mca.c
deleted file mode 100644
index d20abf04541e..000000000000
--- a/drivers/tty/serial/8250/8250_mca.c
+++ /dev/null
@@ -1,61 +0,0 @@
1/*
2 * Copyright (C) 2005 Russell King.
3 * Data taken from include/asm-i386/serial.h
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9#include <linux/module.h>
10#include <linux/init.h>
11#include <linux/mca.h>
12#include <linux/serial_8250.h>
13
14/*
15 * FIXME: Should we be doing AUTO_IRQ here?
16 */
17#ifdef CONFIG_SERIAL_8250_DETECT_IRQ
18#define MCA_FLAGS UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ
19#else
20#define MCA_FLAGS UPF_BOOT_AUTOCONF | UPF_SKIP_TEST
21#endif
22
23#define PORT(_base,_irq) \
24 { \
25 .iobase = _base, \
26 .irq = _irq, \
27 .uartclk = 1843200, \
28 .iotype = UPIO_PORT, \
29 .flags = MCA_FLAGS, \
30 }
31
32static struct plat_serial8250_port mca_data[] = {
33 PORT(0x3220, 3),
34 PORT(0x3228, 3),
35 PORT(0x4220, 3),
36 PORT(0x4228, 3),
37 PORT(0x5220, 3),
38 PORT(0x5228, 3),
39 { },
40};
41
42static struct platform_device mca_device = {
43 .name = "serial8250",
44 .id = PLAT8250_DEV_MCA,
45 .dev = {
46 .platform_data = mca_data,
47 },
48};
49
50static int __init mca_init(void)
51{
52 if (!MCA_bus)
53 return -ENODEV;
54 return platform_device_register(&mca_device);
55}
56
57module_init(mca_init);
58
59MODULE_AUTHOR("Russell King");
60MODULE_DESCRIPTION("8250 serial probe module for MCA ports");
61MODULE_LICENSE("GPL");
diff --git a/drivers/tty/serial/8250/Kconfig b/drivers/tty/serial/8250/Kconfig
index 8bc7ecbf6bea..a27dd0569bd7 100644
--- a/drivers/tty/serial/8250/Kconfig
+++ b/drivers/tty/serial/8250/Kconfig
@@ -241,15 +241,6 @@ config SERIAL_8250_RSA
241 help 241 help
242 ::: To be written ::: 242 ::: To be written :::
243 243
244config SERIAL_8250_MCA
245 tristate "Support 8250-type ports on MCA buses"
246 depends on SERIAL_8250 != n && MCA
247 help
248 Say Y here if you have a MCA serial ports.
249
250 To compile this driver as a module, choose M here: the module
251 will be called 8250_mca.
252
253config SERIAL_8250_ACORN 244config SERIAL_8250_ACORN
254 tristate "Acorn expansion card serial port support" 245 tristate "Acorn expansion card serial port support"
255 depends on ARCH_ACORN && SERIAL_8250 246 depends on ARCH_ACORN && SERIAL_8250
diff --git a/drivers/tty/serial/8250/Makefile b/drivers/tty/serial/8250/Makefile
index 3f35eacdf673..d7533c7d2c1a 100644
--- a/drivers/tty/serial/8250/Makefile
+++ b/drivers/tty/serial/8250/Makefile
@@ -15,7 +15,6 @@ obj-$(CONFIG_SERIAL_8250_ACCENT) += 8250_accent.o
15obj-$(CONFIG_SERIAL_8250_BOCA) += 8250_boca.o 15obj-$(CONFIG_SERIAL_8250_BOCA) += 8250_boca.o
16obj-$(CONFIG_SERIAL_8250_EXAR_ST16C554) += 8250_exar_st16c554.o 16obj-$(CONFIG_SERIAL_8250_EXAR_ST16C554) += 8250_exar_st16c554.o
17obj-$(CONFIG_SERIAL_8250_HUB6) += 8250_hub6.o 17obj-$(CONFIG_SERIAL_8250_HUB6) += 8250_hub6.o
18obj-$(CONFIG_SERIAL_8250_MCA) += 8250_mca.o
19obj-$(CONFIG_SERIAL_8250_FSL) += 8250_fsl.o 18obj-$(CONFIG_SERIAL_8250_FSL) += 8250_fsl.o
20obj-$(CONFIG_SERIAL_8250_DW) += 8250_dw.o 19obj-$(CONFIG_SERIAL_8250_DW) += 8250_dw.o
21obj-$(CONFIG_SERIAL_8250_EM) += 8250_em.o 20obj-$(CONFIG_SERIAL_8250_EM) += 8250_em.o
diff --git a/include/linux/i2o-dev.h b/include/linux/i2o-dev.h
index a0b23dd45239..a8093bfec3a6 100644
--- a/include/linux/i2o-dev.h
+++ b/include/linux/i2o-dev.h
@@ -124,7 +124,7 @@ typedef struct i2o_sg_io_hdr {
124#define I2O_BUS_LOCAL 0 124#define I2O_BUS_LOCAL 0
125#define I2O_BUS_ISA 1 125#define I2O_BUS_ISA 1
126#define I2O_BUS_EISA 2 126#define I2O_BUS_EISA 2
127#define I2O_BUS_MCA 3 127/* was I2O_BUS_MCA 3 */
128#define I2O_BUS_PCI 4 128#define I2O_BUS_PCI 4
129#define I2O_BUS_PCMCIA 5 129#define I2O_BUS_PCMCIA 5
130#define I2O_BUS_NUBUS 6 130#define I2O_BUS_NUBUS 6
diff --git a/include/linux/mca-legacy.h b/include/linux/mca-legacy.h
deleted file mode 100644
index 7a3aea845902..000000000000
--- a/include/linux/mca-legacy.h
+++ /dev/null
@@ -1,66 +0,0 @@
1/* -*- mode: c; c-basic-offset: 8 -*- */
2
3/* This is the function prototypes for the old legacy MCA interface
4 *
5 * Please move your driver to the new sysfs based one instead */
6
7#ifndef _LINUX_MCA_LEGACY_H
8#define _LINUX_MCA_LEGACY_H
9
10#include <linux/mca.h>
11
12#warning "MCA legacy - please move your driver to the new sysfs api"
13
14/* MCA_NOTFOUND is an error condition. The other two indicate
15 * motherboard POS registers contain the adapter. They might be
16 * returned by the mca_find_adapter() function, and can be used as
17 * arguments to mca_read_stored_pos(). I'm not going to allow direct
18 * access to the motherboard registers until we run across an adapter
19 * that requires it. We don't know enough about them to know if it's
20 * safe.
21 *
22 * See Documentation/mca.txt or one of the existing drivers for
23 * more information.
24 */
25#define MCA_NOTFOUND (-1)
26
27
28
29/* Returns the slot of the first enabled adapter matching id. User can
30 * specify a starting slot beyond zero, to deal with detecting multiple
31 * devices. Returns MCA_NOTFOUND if id not found. Also checks the
32 * integrated adapters.
33 */
34extern int mca_find_adapter(int id, int start);
35extern int mca_find_unused_adapter(int id, int start);
36
37extern int mca_mark_as_used(int slot);
38extern void mca_mark_as_unused(int slot);
39
40/* gets a byte out of POS register (stored in memory) */
41extern unsigned char mca_read_stored_pos(int slot, int reg);
42
43/* This can be expanded later. Right now, it gives us a way of
44 * getting meaningful information into the MCA_info structure,
45 * so we can have a more interesting /proc/mca.
46 */
47extern void mca_set_adapter_name(int slot, char* name);
48
49/* These routines actually mess with the hardware POS registers. They
50 * temporarily disable the device (and interrupts), so make sure you know
51 * what you're doing if you use them. Furthermore, writing to a POS may
52 * result in two devices trying to share a resource, which in turn can
53 * result in multiple devices sharing memory spaces, IRQs, or even trashing
54 * hardware. YOU HAVE BEEN WARNED.
55 *
56 * You can only access slots with this. Motherboard registers are off
57 * limits.
58 */
59
60/* read a byte from the specified POS register. */
61extern unsigned char mca_read_pos(int slot, int reg);
62
63/* write a byte to the specified POS register. */
64extern void mca_write_pos(int slot, int reg, unsigned char byte);
65
66#endif
diff --git a/include/linux/mca.h b/include/linux/mca.h
deleted file mode 100644
index 37972704617f..000000000000
--- a/include/linux/mca.h
+++ /dev/null
@@ -1,148 +0,0 @@
1/*
2 * Header for Microchannel Architecture Bus
3 * Written by Martin Kolinek, February 1996
4 */
5
6#ifndef _LINUX_MCA_H
7#define _LINUX_MCA_H
8
9#include <linux/device.h>
10
11#ifdef CONFIG_MCA
12#include <asm/mca.h>
13
14extern int MCA_bus;
15#else
16#define MCA_bus 0
17#endif
18
19/* This sets up an information callback for /proc/mca/slot?. The
20 * function is called with the buffer, slot, and device pointer (or
21 * some equally informative context information, or nothing, if you
22 * prefer), and is expected to put useful information into the
23 * buffer. The adapter name, id, and POS registers get printed
24 * before this is called though, so don't do it again.
25 *
26 * This should be called with a NULL procfn when a module
27 * unregisters, thus preventing kernel crashes and other such
28 * nastiness.
29 */
30typedef int (*MCA_ProcFn)(char* buf, int slot, void* dev);
31
32/* Should only be called by the NMI interrupt handler, this will do some
33 * fancy stuff to figure out what might have generated a NMI.
34 */
35extern void mca_handle_nmi(void);
36
37enum MCA_AdapterStatus {
38 MCA_ADAPTER_NORMAL = 0,
39 MCA_ADAPTER_NONE = 1,
40 MCA_ADAPTER_DISABLED = 2,
41 MCA_ADAPTER_ERROR = 3
42};
43
44struct mca_device {
45 u64 dma_mask;
46 int pos_id;
47 int slot;
48
49 /* index into id_table, set by the bus match routine */
50 int index;
51
52 /* is there a driver installed? 0 - No, 1 - Yes */
53 int driver_loaded;
54 /* POS registers */
55 unsigned char pos[8];
56 /* if a pseudo adapter of the motherboard, this is the motherboard
57 * register value to use for setup cycles */
58 short pos_register;
59
60 enum MCA_AdapterStatus status;
61#ifdef CONFIG_MCA_PROC_FS
62 /* name of the proc/mca file */
63 char procname[8];
64 /* /proc info callback */
65 MCA_ProcFn procfn;
66 /* device/context info for proc callback */
67 void *proc_dev;
68#endif
69 struct device dev;
70 char name[32];
71};
72#define to_mca_device(mdev) container_of(mdev, struct mca_device, dev)
73
74struct mca_bus_accessor_functions {
75 unsigned char (*mca_read_pos)(struct mca_device *, int reg);
76 void (*mca_write_pos)(struct mca_device *, int reg,
77 unsigned char byte);
78 int (*mca_transform_irq)(struct mca_device *, int irq);
79 int (*mca_transform_ioport)(struct mca_device *,
80 int region);
81 void * (*mca_transform_memory)(struct mca_device *,
82 void *memory);
83};
84
85struct mca_bus {
86 u64 default_dma_mask;
87 int number;
88 struct mca_bus_accessor_functions f;
89 struct device dev;
90 char name[32];
91};
92#define to_mca_bus(mdev) container_of(mdev, struct mca_bus, dev)
93
94struct mca_driver {
95 const short *id_table;
96 void *driver_data;
97 int integrated_id;
98 struct device_driver driver;
99};
100#define to_mca_driver(mdriver) container_of(mdriver, struct mca_driver, driver)
101
102/* Ongoing supported API functions */
103extern struct mca_device *mca_find_device_by_slot(int slot);
104extern int mca_system_init(void);
105extern struct mca_bus *mca_attach_bus(int);
106
107extern unsigned char mca_device_read_stored_pos(struct mca_device *mca_dev,
108 int reg);
109extern unsigned char mca_device_read_pos(struct mca_device *mca_dev, int reg);
110extern void mca_device_write_pos(struct mca_device *mca_dev, int reg,
111 unsigned char byte);
112extern int mca_device_transform_irq(struct mca_device *mca_dev, int irq);
113extern int mca_device_transform_ioport(struct mca_device *mca_dev, int port);
114extern void *mca_device_transform_memory(struct mca_device *mca_dev,
115 void *mem);
116extern int mca_device_claimed(struct mca_device *mca_dev);
117extern void mca_device_set_claim(struct mca_device *mca_dev, int val);
118extern void mca_device_set_name(struct mca_device *mca_dev, const char *name);
119static inline char *mca_device_get_name(struct mca_device *mca_dev)
120{
121 return mca_dev ? mca_dev->name : NULL;
122}
123
124extern enum MCA_AdapterStatus mca_device_status(struct mca_device *mca_dev);
125
126extern struct bus_type mca_bus_type;
127
128extern int mca_register_driver(struct mca_driver *drv);
129extern int mca_register_driver_integrated(struct mca_driver *, int);
130extern void mca_unregister_driver(struct mca_driver *drv);
131
132/* WARNING: only called by the boot time device setup */
133extern int mca_register_device(int bus, struct mca_device *mca_dev);
134
135#ifdef CONFIG_MCA_PROC_FS
136extern void mca_do_proc_init(void);
137extern void mca_set_adapter_procfn(int slot, MCA_ProcFn, void* dev);
138#else
139static inline void mca_do_proc_init(void)
140{
141}
142
143static inline void mca_set_adapter_procfn(int slot, MCA_ProcFn fn, void* dev)
144{
145}
146#endif
147
148#endif /* _LINUX_MCA_H */
diff --git a/include/linux/serial.h b/include/linux/serial.h
index 441980ecc4e5..90e9f981358a 100644
--- a/include/linux/serial.h
+++ b/include/linux/serial.h
@@ -130,7 +130,6 @@ struct serial_uart_config {
130#define ASYNCB_CHECK_CD 25 /* i.e., CLOCAL */ 130#define ASYNCB_CHECK_CD 25 /* i.e., CLOCAL */
131#define ASYNCB_SHARE_IRQ 24 /* for multifunction cards, no longer used */ 131#define ASYNCB_SHARE_IRQ 24 /* for multifunction cards, no longer used */
132#define ASYNCB_CONS_FLOW 23 /* flow control for console */ 132#define ASYNCB_CONS_FLOW 23 /* flow control for console */
133#define ASYNCB_BOOT_ONLYMCA 22 /* Probe only if MCA bus */
134#define ASYNCB_FIRST_KERNEL 22 133#define ASYNCB_FIRST_KERNEL 22
135 134
136#define ASYNC_HUP_NOTIFY (1U << ASYNCB_HUP_NOTIFY) 135#define ASYNC_HUP_NOTIFY (1U << ASYNCB_HUP_NOTIFY)
@@ -166,7 +165,6 @@ struct serial_uart_config {
166#define ASYNC_CHECK_CD (1U << ASYNCB_CHECK_CD) 165#define ASYNC_CHECK_CD (1U << ASYNCB_CHECK_CD)
167#define ASYNC_SHARE_IRQ (1U << ASYNCB_SHARE_IRQ) 166#define ASYNC_SHARE_IRQ (1U << ASYNCB_SHARE_IRQ)
168#define ASYNC_CONS_FLOW (1U << ASYNCB_CONS_FLOW) 167#define ASYNC_CONS_FLOW (1U << ASYNCB_CONS_FLOW)
169#define ASYNC_BOOT_ONLYMCA (1U << ASYNCB_BOOT_ONLYMCA)
170#define ASYNC_INTERNAL_FLAGS (~((1U << ASYNCB_FIRST_KERNEL) - 1)) 168#define ASYNC_INTERNAL_FLAGS (~((1U << ASYNCB_FIRST_KERNEL) - 1))
171 169
172/* 170/*
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index 10dbce5205af..a416e92012ef 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -55,7 +55,6 @@ enum {
55 PLAT8250_DEV_BOCA, 55 PLAT8250_DEV_BOCA,
56 PLAT8250_DEV_EXAR_ST16C554, 56 PLAT8250_DEV_EXAR_ST16C554,
57 PLAT8250_DEV_HUB6, 57 PLAT8250_DEV_HUB6,
58 PLAT8250_DEV_MCA,
59 PLAT8250_DEV_AU1X00, 58 PLAT8250_DEV_AU1X00,
60 PLAT8250_DEV_SM501, 59 PLAT8250_DEV_SM501,
61}; 60};
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 2c6286c0bc1a..f606738d421d 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -240,7 +240,7 @@ search_help[] = N_(
240 "Defined at drivers/pci/Kconfig:47\n" 240 "Defined at drivers/pci/Kconfig:47\n"
241 "Depends on: X86_LOCAL_APIC && X86_IO_APIC || IA64\n" 241 "Depends on: X86_LOCAL_APIC && X86_IO_APIC || IA64\n"
242 "Location:\n" 242 "Location:\n"
243 " -> Bus options (PCI, PCMCIA, EISA, MCA, ISA)\n" 243 " -> Bus options (PCI, PCMCIA, EISA, ISA)\n"
244 " -> PCI support (PCI [=y])\n" 244 " -> PCI support (PCI [=y])\n"
245 " -> PCI access mode (<choice> [=y])\n" 245 " -> PCI access mode (<choice> [=y])\n"
246 "Selects: LIBCRC32\n" 246 "Selects: LIBCRC32\n"
diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c
index 73070cb0b6de..8c0eb65978c9 100644
--- a/scripts/kconfig/nconf.c
+++ b/scripts/kconfig/nconf.c
@@ -223,7 +223,7 @@ search_help[] = N_(
223"Defined at drivers/pci/Kconfig:47\n" 223"Defined at drivers/pci/Kconfig:47\n"
224"Depends on: X86_LOCAL_APIC && X86_IO_APIC || IA64\n" 224"Depends on: X86_LOCAL_APIC && X86_IO_APIC || IA64\n"
225"Location:\n" 225"Location:\n"
226" -> Bus options (PCI, PCMCIA, EISA, MCA, ISA)\n" 226" -> Bus options (PCI, PCMCIA, EISA, ISA)\n"
227" -> PCI support (PCI [ = y])\n" 227" -> PCI support (PCI [ = y])\n"
228" -> PCI access mode (<choice> [ = y])\n" 228" -> PCI access mode (<choice> [ = y])\n"
229"Selects: LIBCRC32\n" 229"Selects: LIBCRC32\n"