cregit-Linux how code gets into the kernel

Release 4.11 drivers/scsi/eata.c

Directory: drivers/scsi
/*
 *      eata.c - Low-level driver for EATA/DMA SCSI host adapters.
 *
 *      03 Jun 2003 Rev. 8.10 for linux-2.5.70
 *        + Update for new IRQ API.
 *        + Use "goto" when appropriate.
 *        + Drop eata.h.
 *        + Update for new module_param API.
 *        + Module parameters  can now be specified only in the
 *          same format as the kernel boot options.
 *
 *             boot option    old module param 
 *             -----------    ------------------
 *             addr,...       io_port=addr,...
 *             lc:[y|n]       linked_comm=[1|0]
 *             mq:xx          max_queue_depth=xx
 *             tm:[0|1|2]     tag_mode=[0|1|2]
 *             et:[y|n]       ext_tran=[1|0]
 *             rs:[y|n]       rev_scan=[1|0]
 *             ip:[y|n]       isa_probe=[1|0]
 *             ep:[y|n]       eisa_probe=[1|0]
 *             pp:[y|n]       pci_probe=[1|0]
 *
 *          A valid example using the new parameter format is:
 *          modprobe eata "eata=0x7410,0x230,lc:y,tm:0,mq:4,ep:n"
 *
 *          which is equivalent to the old format:
 *          modprobe eata io_port=0x7410,0x230 linked_comm=1 tag_mode=0 \
 *                        max_queue_depth=4 eisa_probe=0
 *
 *      12 Feb 2003 Rev. 8.04 for linux 2.5.60
 *        + Release irq before calling scsi_register.
 *
 *      12 Nov 2002 Rev. 8.02 for linux 2.5.47
 *        + Release driver_lock before calling scsi_register.
 *
 *      11 Nov 2002 Rev. 8.01 for linux 2.5.47
 *        + Fixed bios_param and scsicam_bios_param calling parameters.
 *
 *      28 Oct 2002 Rev. 8.00 for linux 2.5.44-ac4
 *        + Use new tcq and adjust_queue_depth api.
 *        + New command line option (tm:[0-2]) to choose the type of tags:
 *          0 -> disable tagging ; 1 -> simple tags  ; 2 -> ordered tags.
 *          Default is tm:0 (tagged commands disabled).
 *          For compatibility the "tc:" option is an alias of the "tm:"
 *          option; tc:n is equivalent to tm:0 and tc:y is equivalent to
 *          tm:1.
 *        + The tagged_comm module parameter has been removed, use tag_mode
 *          instead, equivalent to the "tm:" boot option.
 *
 *      10 Oct 2002 Rev. 7.70 for linux 2.5.42
 *        + Foreport from revision 6.70.
 *
 *      25 Jun 2002 Rev. 6.70 for linux 2.4.19
 *        + This release is the first one tested on a Big Endian platform:
 *          fixed endian-ness problem due to bitfields;
 *          fixed endian-ness problem in read_pio.
 *        + Added new options for selectively probing ISA, EISA and PCI bus:
 *
 *          Boot option   Parameter name    Default according to
 *
 *          ip:[y|n]      isa_probe=[1|0]   CONFIG_ISA  defined
 *          ep:[y|n]      eisa_probe=[1|0]  CONFIG_EISA defined
 *          pp:[y|n]      pci_probe=[1|0]   CONFIG_PCI  defined
 *
 *          The default action is to perform probing if the corresponding
 *          bus is configured and to skip probing otherwise.
 *
 *        + If pci_probe is in effect and a list of I/O  ports is specified
 *          as parameter or boot option, pci_enable_device() is performed
 *          on all pci devices matching PCI_CLASS_STORAGE_SCSI.
 *
 *      21 Feb 2002 Rev. 6.52 for linux 2.4.18
 *        + Backport from rev. 7.22 (use io_request_lock).
 *
 *      20 Feb 2002 Rev. 7.22 for linux 2.5.5
 *        + Remove any reference to virt_to_bus().
 *        + Fix pio hang while detecting multiple HBAs.
 *        + Fixed a board detection bug: in a system with
 *          multiple ISA/EISA boards, all but the first one
 *          were erroneously detected as PCI.
 *
 *      01 Jan 2002 Rev. 7.20 for linux 2.5.1
 *        + Use the dynamic DMA mapping API.
 *
 *      19 Dec 2001 Rev. 7.02 for linux 2.5.1
 *        + Use SCpnt->sc_data_direction if set.
 *        + Use sglist.page instead of sglist.address.
 *
 *      11 Dec 2001 Rev. 7.00 for linux 2.5.1
 *        + Use host->host_lock instead of io_request_lock.
 *
 *       1 May 2001 Rev. 6.05 for linux 2.4.4
 *        + Clean up all pci related routines.
 *        + Fix data transfer direction for opcode SEND_CUE_SHEET (0x5d)
 *
 *      30 Jan 2001 Rev. 6.04 for linux 2.4.1
 *        + Call pci_resource_start after pci_enable_device.
 *
 *      25 Jan 2001 Rev. 6.03 for linux 2.4.0
 *        + "check_region" call replaced by "request_region".
 *
 *      22 Nov 2000 Rev. 6.02 for linux 2.4.0-test11
 *        + Return code checked when calling pci_enable_device.
 *        + Removed old scsi error handling support.
 *        + The obsolete boot option flag eh:n is silently ignored.
 *        + Removed error messages while a disk drive is powered up at
 *          boot time.
 *        + Improved boot messages: all tagged capable device are
 *          indicated as "tagged" or "soft-tagged" :
 *          - "soft-tagged"  means that the driver is trying to do its
 *            own tagging (i.e. the tc:y option is in effect);
 *          - "tagged" means that the device supports tagged commands,
 *            but the driver lets the HBA be responsible for tagging
 *            support.
 *
 *      16 Sep 1999 Rev. 5.11 for linux 2.2.12 and 2.3.18
 *        + Updated to the new __setup interface for boot command line options.
 *        + When loaded as a module, accepts the new parameter boot_options
 *          which value is a string with the same format of the kernel boot
 *          command line options. A valid example is:
 *          modprobe eata 'boot_options="0x7410,0x230,lc:y,tc:n,mq:4"'
 *
 *       9 Sep 1999 Rev. 5.10 for linux 2.2.12 and 2.3.17
 *        + 64bit cleanup for Linux/Alpha platform support
 *          (contribution from H.J. Lu).
 *
 *      22 Jul 1999 Rev. 5.00 for linux 2.2.10 and 2.3.11
 *        + Removed pre-2.2 source code compatibility.
 *        + Added call to pci_set_master.
 *
 *      26 Jul 1998 Rev. 4.33 for linux 2.0.35 and 2.1.111
 *        + Added command line option (rs:[y|n]) to reverse the scan order
 *          of PCI boards. The default is rs:y, which reverses the BIOS order
 *          while registering PCI boards. The default value rs:y generates
 *          the same order of all previous revisions of this driver.
 *          Pls. note that "BIOS order" might have been reversed itself
 *          after the 2.1.9x PCI modifications in the linux kernel.
 *          The rs value is ignored when the explicit list of addresses
 *          is used by the "eata=port0,port1,..." command line option.
 *        + Added command line option (et:[y|n]) to force use of extended
 *          translation (255 heads, 63 sectors) as disk geometry.
 *          The default is et:n, which uses the disk geometry returned
 *          by scsicam_bios_param. The default value et:n is compatible with
 *          all previous revisions of this driver.
 *
 *      28 May 1998 Rev. 4.32 for linux 2.0.33 and 2.1.104
 *          Increased busy timeout from 10 msec. to 200 msec. while
 *          processing interrupts.
 *
 *      16 May 1998 Rev. 4.31 for linux 2.0.33 and 2.1.102
 *          Improved abort handling during the eh recovery process.
 *
 *      13 May 1998 Rev. 4.30 for linux 2.0.33 and 2.1.101
 *          The driver is now fully SMP safe, including the
 *          abort and reset routines.
 *          Added command line options (eh:[y|n]) to choose between
 *          new_eh_code and the old scsi code.
 *          If linux version >= 2.1.101 the default is eh:y, while the eh
 *          option is ignored for previous releases and the old scsi code
 *          is used.
 *
 *      18 Apr 1998 Rev. 4.20 for linux 2.0.33 and 2.1.97
 *          Reworked interrupt handler.
 *
 *      11 Apr 1998 rev. 4.05 for linux 2.0.33 and 2.1.95
 *          Major reliability improvement: when a batch with overlapping
 *          requests is detected, requests are queued one at a time
 *          eliminating any possible board or drive reordering.
 *
 *      10 Apr 1998 rev. 4.04 for linux 2.0.33 and 2.1.95
 *          Improved SMP support (if linux version >= 2.1.95).
 *
 *       9 Apr 1998 rev. 4.03 for linux 2.0.33 and 2.1.94
 *          Added support for new PCI code and IO-APIC remapping of irqs.
 *          Performance improvement: when sequential i/o is detected,
 *          always use direct sort instead of reverse sort.
 *
 *       4 Apr 1998 rev. 4.02 for linux 2.0.33 and 2.1.92
 *          io_port is now unsigned long.
 *
 *      17 Mar 1998 rev. 4.01 for linux 2.0.33 and 2.1.88
 *          Use new scsi error handling code (if linux version >= 2.1.88).
 *          Use new interrupt code.
 *
 *      12 Sep 1997 rev. 3.11 for linux 2.0.30 and 2.1.55
 *          Use of udelay inside the wait loops to avoid timeout
 *          problems with fast cpus.
 *          Removed check about useless calls to the interrupt service
 *          routine (reported on SMP systems only).
 *          At initialization time "sorted/unsorted" is displayed instead
 *          of "linked/unlinked" to reinforce the fact that "linking" is
 *          nothing but "elevator sorting" in the actual implementation.
 *
 *      17 May 1997 rev. 3.10 for linux 2.0.30 and 2.1.38
 *          Use of serial_number_at_timeout in abort and reset processing.
 *          Use of the __initfunc and __initdata macro in setup code.
 *          Minor cleanups in the list_statistics code.
 *          Increased controller busy timeout in order to better support
 *          slow SCSI devices.
 *
 *      24 Feb 1997 rev. 3.00 for linux 2.0.29 and 2.1.26
 *          When loading as a module, parameter passing is now supported
 *          both in 2.0 and in 2.1 style.
 *          Fixed data transfer direction for some SCSI opcodes.
 *          Immediate acknowledge to request sense commands.
 *          Linked commands to each disk device are now reordered by elevator
 *          sorting. Rare cases in which reordering of write requests could
 *          cause wrong results are managed.
 *          Fixed spurious timeouts caused by long simple queue tag sequences.
 *          New command line option (tm:[0-3]) to choose the type of tags:
 *          0 -> mixed (default); 1 -> simple; 2 -> head; 3 -> ordered.
 *
 *      18 Jan 1997 rev. 2.60 for linux 2.1.21 and 2.0.28
 *          Added command line options to enable/disable linked commands
 *          (lc:[y|n]), tagged commands (tc:[y|n]) and to set the max queue
 *          depth (mq:xx). Default is "eata=lc:n,tc:n,mq:16".
 *          Improved command linking.
 *          Documented how to setup RAID-0 with DPT SmartRAID boards.
 *
 *       8 Jan 1997 rev. 2.50 for linux 2.1.20 and 2.0.27
 *          Added linked command support.
 *          Improved detection of PCI boards using ISA base addresses.
 *
 *       3 Dec 1996 rev. 2.40 for linux 2.1.14 and 2.0.27
 *          Added support for tagged commands and queue depth adjustment.
 *
 *      22 Nov 1996 rev. 2.30 for linux 2.1.12 and 2.0.26
 *          When CONFIG_PCI is defined, BIOS32 is used to include in the
 *          list of i/o ports to be probed all the PCI SCSI controllers.
 *          The list of i/o ports to be probed can be overwritten by the
 *          "eata=port0,port1,...." boot command line option.
 *          Scatter/gather lists are now allocated by a number of kmalloc
 *          calls, in order to avoid the previous size limit of 64Kb.
 *
 *      16 Nov 1996 rev. 2.20 for linux 2.1.10 and 2.0.25
 *          Added support for EATA 2.0C, PCI, multichannel and wide SCSI.
 *
 *      27 Sep 1996 rev. 2.12 for linux 2.1.0
 *          Portability cleanups (virtual/bus addressing, little/big endian
 *          support).
 *
 *      09 Jul 1996 rev. 2.11 for linux 2.0.4
 *          Number of internal retries is now limited.
 *
 *      16 Apr 1996 rev. 2.10 for linux 1.3.90
 *          New argument "reset_flags" to the reset routine.
 *
 *       6 Jul 1995 rev. 2.01 for linux 1.3.7
 *          Update required by the new /proc/scsi support.
 *
 *      11 Mar 1995 rev. 2.00 for linux 1.2.0
 *          Fixed a bug which prevented media change detection for removable
 *          disk drives.
 *
 *      23 Feb 1995 rev. 1.18 for linux 1.1.94
 *          Added a check for scsi_register returning NULL.
 *
 *      11 Feb 1995 rev. 1.17 for linux 1.1.91
 *          Now DEBUG_RESET is disabled by default.
 *          Register a board even if it does not assert DMA protocol support
 *          (DPT SK2011B does not report correctly the dmasup bit).
 *
 *       9 Feb 1995 rev. 1.16 for linux 1.1.90
 *          Use host->wish_block instead of host->block.
 *          New list of Data Out SCSI commands.
 *
 *       8 Feb 1995 rev. 1.15 for linux 1.1.89
 *          Cleared target_time_out counter while performing a reset.
 *          All external symbols renamed to avoid possible name conflicts.
 *
 *      28 Jan 1995 rev. 1.14 for linux 1.1.86
 *          Added module support.
 *          Log and do a retry when a disk drive returns a target status
 *          different from zero on a recovered error.
 *
 *      24 Jan 1995 rev. 1.13 for linux 1.1.85
 *          Use optimized board configuration, with a measured performance
 *          increase in the range 10%-20% on i/o throughput.
 *
 *      16 Jan 1995 rev. 1.12 for linux 1.1.81
 *          Fix mscp structure comments (no functional change).
 *          Display a message if check_region detects a port address
 *          already in use.
 *
 *      17 Dec 1994 rev. 1.11 for linux 1.1.74
 *          Use the scsicam_bios_param routine. This allows an easy
 *          migration path from disk partition tables created using
 *          different SCSI drivers and non optimal disk geometry.
 *
 *      15 Dec 1994 rev. 1.10 for linux 1.1.74
 *          Added support for ISA EATA boards (DPT PM2011, DPT PM2021).
 *          The host->block flag is set for all the detected ISA boards.
 *          The detect routine no longer enforces LEVEL triggering
 *          for EISA boards, it just prints a warning message.
 *
 *      30 Nov 1994 rev. 1.09 for linux 1.1.68
 *          Redo i/o on target status CHECK_CONDITION for TYPE_DISK only.
 *          Added optional support for using a single board at a time.
 *
 *      18 Nov 1994 rev. 1.08 for linux 1.1.64
 *          Forces sg_tablesize = 64 and can_queue = 64 if these
 *          values are not correctly detected (DPT PM2012).
 *
 *      14 Nov 1994 rev. 1.07 for linux 1.1.63  Final BETA release.
 *      04 Aug 1994 rev. 1.00 for linux 1.1.39  First BETA release.
 *
 *
 *          This driver is based on the CAM (Common Access Method Committee)
 *          EATA (Enhanced AT Bus Attachment) rev. 2.0A, using DMA protocol.
 *
 *  Copyright (C) 1994-2003 Dario Ballabio (ballabio_dario@emc.com)
 *
 *  Alternate email: dario.ballabio@inwind.it, dario.ballabio@tiscalinet.it
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that redistributions of source
 *  code retain the above copyright notice and this comment without
 *  modification.
 *
 */

/*
 *
 *  Here is a brief description of the DPT SCSI host adapters.
 *  All these boards provide an EATA/DMA compatible programming interface
 *  and are fully supported by this driver in any configuration, including
 *  multiple SCSI channels:
 *
 *  PM2011B/9X -  Entry Level ISA
 *  PM2021A/9X -  High Performance ISA
 *  PM2012A       Old EISA
 *  PM2012B       Old EISA
 *  PM2022A/9X -  Entry Level EISA
 *  PM2122A/9X -  High Performance EISA
 *  PM2322A/9X -  Extra High Performance EISA
 *  PM3021     -  SmartRAID Adapter for ISA
 *  PM3222     -  SmartRAID Adapter for EISA (PM3222W is 16-bit wide SCSI)
 *  PM3224     -  SmartRAID Adapter for PCI  (PM3224W is 16-bit wide SCSI)
 *  PM33340UW  -  SmartRAID Adapter for PCI  ultra wide multichannel
 *
 *  The above list is just an indication: as a matter of fact all DPT
 *  boards using the EATA/DMA protocol are supported by this driver,
 *  since they use exactely the same programming interface.
 *
 *  The DPT PM2001 provides only the EATA/PIO interface and hence is not
 *  supported by this driver.
 *
 *  This code has been tested with up to 3 Distributed Processing Technology
 *  PM2122A/9X (DPT SCSI BIOS v002.D1, firmware v05E.0) EISA controllers,
 *  in any combination of private and shared IRQ.
 *  PCI support has been tested using up to 2 DPT PM3224W (DPT SCSI BIOS
 *  v003.D0, firmware v07G.0).
 *
 *  DPT SmartRAID boards support "Hardware Array" - a group of disk drives
 *  which are all members of the same RAID-0, RAID-1 or RAID-5 array implemented
 *  in host adapter hardware. Hardware Arrays are fully compatible with this
 *  driver, since they look to it as a single disk drive.
 *
 *  WARNING: to create a RAID-0 "Hardware Array" you must select "Other Unix"
 *  as the current OS in the DPTMGR "Initial System Installation" menu.
 *  Otherwise RAID-0 is generated as an "Array Group" (i.e. software RAID-0),
 *  which is not supported by the actual SCSI subsystem.
 *  To get the "Array Group" functionality, the Linux MD driver must be used
 *  instead of the DPT "Array Group" feature.
 *
 *  Multiple ISA, EISA and PCI boards can be configured in the same system.
 *  It is suggested to put all the EISA boards on the same IRQ level, all
 *  the PCI  boards on another IRQ level, while ISA boards cannot share
 *  interrupts.
 *
 *  If you configure multiple boards on the same IRQ, the interrupt must
 *  be _level_ triggered (not _edge_ triggered).
 *
 *  This driver detects EATA boards by probes at fixed port addresses,
 *  so no BIOS32 or PCI BIOS support is required.
 *  The suggested way to detect a generic EATA PCI board is to force on it
 *  any unused EISA address, even if there are other controllers on the EISA
 *  bus, or even if you system has no EISA bus at all.
 *  Do not force any ISA address on EATA PCI boards.
 *
 *  If PCI bios support is configured into the kernel, BIOS32 is used to
 *  include in the list of i/o ports to be probed all the PCI SCSI controllers.
 *
 *  Due to a DPT BIOS "feature", it might not be possible to force an EISA
 *  address on more than a single DPT PCI board, so in this case you have to
 *  let the PCI BIOS assign the addresses.
 *
 *  The sequence of detection probes is:
 *
 *  - ISA 0x1F0;
 *  - PCI SCSI controllers (only if BIOS32 is available);
 *  - EISA/PCI 0x1C88 through 0xFC88 (corresponding to EISA slots 1 to 15);
 *  - ISA  0x170, 0x230, 0x330.
 *
 *  The above list of detection probes can be totally replaced by the
 *  boot command line option: "eata=port0,port1,port2,...", where the
 *  port0, port1... arguments are ISA/EISA/PCI addresses to be probed.
 *  For example using "eata=0x7410,0x7450,0x230", the driver probes
 *  only the two PCI addresses 0x7410 and 0x7450 and the ISA address 0x230,
 *  in this order; "eata=0" totally disables this driver.
 *
 *  After the optional list of detection probes, other possible command line
 *  options are:
 *
 *  et:y  force use of extended translation (255 heads, 63 sectors);
 *  et:n  use disk geometry detected by scsicam_bios_param;
 *  rs:y  reverse scan order while detecting PCI boards;
 *  rs:n  use BIOS order while detecting PCI boards;
 *  lc:y  enables linked commands;
 *  lc:n  disables linked commands;
 *  tm:0  disables tagged commands (same as tc:n);
 *  tm:1  use simple queue tags (same as tc:y);
 *  tm:2  use ordered queue tags (same as tc:2);
 *  mq:xx set the max queue depth to the value xx (2 <= xx <= 32).
 *
 *  The default value is: "eata=lc:n,mq:16,tm:0,et:n,rs:n".
 *  An example using the list of detection probes could be:
 *  "eata=0x7410,0x230,lc:y,tm:2,mq:4,et:n".
 *
 *  When loading as a module, parameters can be specified as well.
 *  The above example would be (use 1 in place of y and 0 in place of n):
 *
 *  modprobe eata io_port=0x7410,0x230 linked_comm=1 \
 *                max_queue_depth=4 ext_tran=0 tag_mode=2 \
 *                rev_scan=1
 *
 *  ----------------------------------------------------------------------------
 *  In this implementation, linked commands are designed to work with any DISK
 *  or CD-ROM, since this linking has only the intent of clustering (time-wise)
 *  and reordering by elevator sorting commands directed to each device,
 *  without any relation with the actual SCSI protocol between the controller
 *  and the device.
 *  If Q is the queue depth reported at boot time for each device (also named
 *  cmds/lun) and Q > 2, whenever there is already an active command to the
 *  device all other commands to the same device  (up to Q-1) are kept waiting
 *  in the elevator sorting queue. When the active command completes, the
 *  commands in this queue are sorted by sector address. The sort is chosen
 *  between increasing or decreasing by minimizing the seek distance between
 *  the sector of the commands just completed and the sector of the first
 *  command in the list to be sorted.
 *  Trivial math assures that the unsorted average seek distance when doing
 *  random seeks over S sectors is S/3.
 *  When (Q-1) requests are uniformly distributed over S sectors, the average
 *  distance between two adjacent requests is S/((Q-1) + 1), so the sorted
 *  average seek distance for (Q-1) random requests over S sectors is S/Q.
 *  The elevator sorting hence divides the seek distance by a factor Q/3.
 *  The above pure geometric remarks are valid in all cases and the
 *  driver effectively reduces the seek distance by the predicted factor
 *  when there are Q concurrent read i/o operations on the device, but this
 *  does not necessarily results in a noticeable performance improvement:
 *  your mileage may vary....
 *
 *  Note: command reordering inside a batch of queued commands could cause
 *        wrong results only if there is at least one write request and the
 *        intersection (sector-wise) of all requests is not empty.
 *        When the driver detects a batch including overlapping requests
 *        (a really rare event) strict serial (pid) order is enforced.
 *  ----------------------------------------------------------------------------
 *  The extended translation option (et:y) is useful when using large physical
 *  disks/arrays. It could also be useful when switching between Adaptec boards
 *  and DPT boards without reformatting the disk.
 *  When a boot disk is partitioned with extended translation, in order to
 *  be able to boot it with a DPT board is could be necessary to add to
 *  lilo.conf additional commands as in the following example:
 *
 *  fix-table
 *  disk=/dev/sda bios=0x80 sectors=63 heads=128 cylindres=546
 *
 *  where the above geometry should be replaced with the one reported at
 *  power up by the DPT controller.
 *  ----------------------------------------------------------------------------
 *
 *  The boards are named EATA0, EATA1,... according to the detection order.
 *
 *  In order to support multiple ISA boards in a reliable way,
 *  the driver sets host->wish_block = 1 for all ISA boards.
 */

#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/ioport.h>
#include <linux/delay.h>
#include <linux/proc_fs.h>
#include <linux/blkdev.h>
#include <linux/interrupt.h>
#include <linux/stat.h>
#include <linux/pci.h>
#include <linux/init.h>
#include <linux/ctype.h>
#include <linux/spinlock.h>
#include <linux/dma-mapping.h>
#include <linux/slab.h>
#include <asm/byteorder.h>
#include <asm/dma.h>
#include <asm/io.h>
#include <asm/irq.h>

#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_tcq.h>
#include <scsi/scsicam.h>

static int eata2x_detect(struct scsi_host_template *);
static int eata2x_release(struct Scsi_Host *);
static int eata2x_queuecommand(struct Scsi_Host *, struct scsi_cmnd *);
static int eata2x_eh_abort(struct scsi_cmnd *);
static int eata2x_eh_host_reset(struct scsi_cmnd *);
static int eata2x_bios_param(struct scsi_device *, struct block_device *,
			     sector_t, int *);
static int eata2x_slave_configure(struct scsi_device *);


static struct scsi_host_template driver_template = {
	.name = "EATA/DMA 2.0x rev. 8.10.00 ",
	.detect = eata2x_detect,
	.release = eata2x_release,
	.queuecommand = eata2x_queuecommand,
	.eh_abort_handler = eata2x_eh_abort,
	.eh_host_reset_handler = eata2x_eh_host_reset,
	.bios_param = eata2x_bios_param,
	.slave_configure = eata2x_slave_configure,
	.this_id = 7,
	.unchecked_isa_dma = 1,
	.use_clustering = ENABLE_CLUSTERING,
};

#if !defined(__BIG_ENDIAN_BITFIELD) && !defined(__LITTLE_ENDIAN_BITFIELD)
#error "Adjust your <asm/byteorder.h> defines"
#endif

/* Subversion values */

#define ISA  0

#define ESA 1


#undef  FORCE_CONFIG


#undef  DEBUG_LINKED_COMMANDS

#undef  DEBUG_DETECT

#undef  DEBUG_PCI_DETECT

#undef  DEBUG_INTERRUPT

#undef  DEBUG_RESET

#undef  DEBUG_GENERATE_ERRORS

#undef  DEBUG_GENERATE_ABORTS

#undef  DEBUG_GEOMETRY


#define MAX_ISA 4

#define MAX_VESA 0

#define MAX_EISA 15

#define MAX_PCI 16

#define MAX_BOARDS (MAX_ISA + MAX_VESA + MAX_EISA + MAX_PCI)

#define MAX_CHANNEL 4

#define MAX_LUN 32

#define MAX_TARGET 32

#define MAX_MAILBOXES 64

#define MAX_SGLIST 64

#define MAX_LARGE_SGLIST 122

#define MAX_INTERNAL_RETRIES 64

#define MAX_CMD_PER_LUN 2

#define MAX_TAGGED_CMD_PER_LUN (MAX_MAILBOXES - MAX_CMD_PER_LUN)


#define SKIP ULONG_MAX

#define FREE 0

#define IN_USE   1

#define LOCKED   2

#define IN_RESET 3

#define IGNORE   4

#define READY    5

#define ABORTING 6

#define NO_DMA  0xff

#define MAXLOOP  10000

#define TAG_DISABLED 0

#define TAG_SIMPLE   1

#define TAG_ORDERED  2


#define REG_CMD         7

#define REG_STATUS      7

#define REG_AUX_STATUS  8

#define REG_DATA        0

#define REG_DATA2       1

#define REG_SEE         6

#define REG_LOW         2

#define REG_LM          3

#define REG_MID         4

#define REG_MSB         5

#define REGION_SIZE     9UL

#define MAX_ISA_ADDR    0x03ff

#define MIN_EISA_ADDR   0x1c88

#define MAX_EISA_ADDR   0xfc88

#define BSY_ASSERTED      0x80

#define DRQ_ASSERTED      0x08

#define ABSY_ASSERTED     0x01

#define IRQ_ASSERTED      0x02

#define READ_CONFIG_PIO   0xf0

#define SET_CONFIG_PIO    0xf1

#define SEND_CP_PIO       0xf2

#define RECEIVE_SP_PIO    0xf3

#define TRUNCATE_XFR_PIO  0xf4

#define RESET_PIO         0xf9

#define READ_CONFIG_DMA   0xfd

#define SET_CONFIG_DMA    0xfe

#define SEND_CP_DMA       0xff

#define ASOK              0x00

#define ASST              0x01


#define YESNO(a) ((a) ? 'y' : 'n')

#define TLDEV(type) ((type) == TYPE_DISK || (type) == TYPE_ROM)

/* "EATA", in Big Endian format */

#define EATA_SIG_BE 0x45415441

/* Number of valid bytes in the board config structure for EATA 2.0x */

#define EATA_2_0A_SIZE 28

#define EATA_2_0B_SIZE 30

#define EATA_2_0C_SIZE 34

/* Board info structure */

struct eata_info {
	
u_int32_t data_len;	/* Number of valid bytes after this field */
	
u_int32_t sign;		/* ASCII "EATA" signature */

#if defined(__BIG_ENDIAN_BITFIELD)
	
unchar version	: 4,
	       		: 4;
	
unchar haaval	: 1,
	       
ata	: 1,
	       
drqvld	: 1,
	       
dmasup	: 1,
	       
morsup	: 1,
	       
trnxfr	: 1,
	       
tarsup	: 1,
	       
ocsena	: 1;
#else
	
unchar		: 4,	/* unused low nibble */
	 	
version	: 4;	/* EATA version, should be 0x1 */
	
unchar ocsena	: 1,	/* Overlap Command Support Enabled */
	       
tarsup	: 1,	/* Target Mode Supported */
	       
trnxfr	: 1,	/* Truncate Transfer Cmd NOT Necessary */
	       
morsup	: 1,	/* More Supported */
	       
dmasup	: 1,	/* DMA Supported */
	       
drqvld	: 1,	/* DRQ Index (DRQX) is valid */
	       
ata	: 1,	/* This is an ATA device */
	       
haaval	: 1;	/* Host Adapter Address Valid */
#endif

	
ushort cp_pad_len;	/* Number of pad bytes after cp_len */
	
unchar host_addr[4];	/* Host Adapter SCSI ID for channels 3, 2, 1, 0 */
	
u_int32_t cp_len;	/* Number of valid bytes in cp */
	
u_int32_t sp_len;	/* Number of valid bytes in sp */
	
ushort queue_size;	/* Max number of cp that can be queued */
	
ushort unused;
	
ushort scatt_size;	/* Max number of entries in scatter/gather table */

#if defined(__BIG_ENDIAN_BITFIELD)
	
unchar drqx	: 2,
	       
second	: 1,
	       
irq_tr	: 1,
	       
irq	: 4;
	
unchar sync;
	
unchar		: 4,
	       
res1	: 1,
	       
large_sg	: 1,
	       
forcaddr	: 1,
	       
isaena	: 1;
	
unchar max_chan	: 3,
	       
max_id	: 5;
	
unchar max_lun;
	
unchar eisa	: 1,
	       
pci	: 1,
	       
idquest	: 1,
	       
m1	: 1,
	       		: 4;
#else
	
unchar irq	: 4,	/* Interrupt Request assigned to this controller */
	       
irq_tr	: 1,	/* 0 for edge triggered, 1 for level triggered */
	       
second	: 1,	/* 1 if this is a secondary (not primary) controller */
	       
drqx	: 2;	/* DRQ Index (0=DMA0, 1=DMA7, 2=DMA6, 3=DMA5) */
	
unchar sync;		/* 1 if scsi target id 7...0 is running sync scsi */

	/* Structure extension defined in EATA 2.0B */
	
unchar isaena	: 1,	/* ISA i/o addressing is disabled/enabled */
	       
forcaddr	: 1,	/* Port address has been forced */
	       
large_sg	: 1,	/* 1 if large SG lists are supported */
	       
res1	: 1,
	       		: 4;
	
unchar max_id	: 5,	/* Max SCSI target ID number */
	       
max_chan	: 3;	/* Max SCSI channel number on this board */

	/* Structure extension defined in EATA 2.0C */
	
unchar max_lun;		/* Max SCSI LUN number */
	
unchar
			: 4,
	       
m1	: 1,	/* This is a PCI with an M1 chip installed */
	       
idquest	: 1,	/* RAIDNUM returned is questionable */
	       
pci	: 1,	/* This board is PCI */
	       
eisa	: 1;	/* This board is EISA */
#endif

	
unchar raidnum;		/* Uniquely identifies this HBA in a system */
	
unchar notused;

	
ushort ipad[247];
};

/* Board config structure */

struct eata_config {
	
ushort len;		/* Number of bytes following this field */

#if defined(__BIG_ENDIAN_BITFIELD)
	
unchar		: 4,
	       
tarena	: 1,
	       
mdpena	: 1,
	       
ocena	: 1,
	       
edis	: 1;
#else
	
unchar edis	: 1,	/* Disable EATA interface after config command */
	       
ocena	: 1,	/* Overlapped Commands Enabled */
	       
mdpena	: 1,	/* Transfer all Modified Data Pointer Messages */
	       
tarena	: 1,	/* Target Mode Enabled for this controller */
	       		: 4;
#endif
	
unchar cpad[511];
};

/* Returned status packet structure */

struct mssp {
#if defined(__BIG_ENDIAN_BITFIELD)
	
unchar eoc	: 1,
	       
adapter_status : 7;
#else
	unchar adapter_status : 7,	/* State related to current command */
	       eoc	: 1;		/* End Of Command (1 = command completed) */
#endif
	
unchar target_status;	/* SCSI status received after data transfer */
	
unchar unused[2];
	
u_int32_t inv_res_len;	/* Number of bytes not transferred */
	
u_int32_t cpp_index;	/* Index of address set in cp */
	
char mess[12];
};


struct sg_list {
	
unsigned int address;	/* Segment Address */
	
unsigned int num_bytes;	/* Segment Length */
};

/* MailBox SCSI Command Packet */

struct mscp {
#if defined(__BIG_ENDIAN_BITFIELD)
	
unchar din	: 1,
	       
dout	: 1,
	       
interp	: 1,
	       		: 1,
		
sg	: 1,
		
reqsen	:1,
		
init	: 1,
		
sreset	: 1;
	
unchar sense_len;
	
unchar unused[3];
	
unchar		: 7,
	       
fwnest	: 1;
	
unchar		: 5,
	       
hbaci	: 1,
	       
iat	: 1,
	       
phsunit	: 1;
	
unchar channel	: 3,
	       
target	: 5;
	
unchar one	: 1,
	       
dispri	: 1,
	       
luntar	: 1,
	       
lun	: 5;
#else
	unchar sreset	:1,	/* SCSI Bus Reset Signal should be asserted */
	       init	:1,	/* Re-initialize controller and self test */
	       reqsen	:1,	/* Transfer Request Sense Data to addr using DMA */
	       sg	:1,	/* Use Scatter/Gather */
	       		:1,
	       interp	:1,	/* The controller interprets cp, not the target */
	       dout	:1,	/* Direction of Transfer is Out (Host to Target) */
	       din	:1;	/* Direction of Transfer is In (Target to Host) */
	unchar sense_len;	/* Request Sense Length */
	unchar unused[3];
	unchar fwnest	: 1,	/* Send command to a component of an Array Group */
			: 7;
	unchar phsunit	: 1,	/* Send to Target Physical Unit (bypass RAID) */
	       iat	: 1,	/* Inhibit Address Translation */
	       hbaci	: 1,	/* Inhibit HBA Caching for this command */
	       		: 5;
	unchar target	: 5,	/* SCSI target ID */
	       channel	: 3;	/* SCSI channel number */
	unchar lun	: 5,	/* SCSI logical unit number */
	       luntar	: 1,	/* This cp is for Target (not LUN) */
	       dispri	: 1,	/* Disconnect Privilege granted */
	       one	: 1;	/* 1 */
#endif

	
unchar mess[3];		/* Massage to/from Target */
	
unchar cdb[12];		/* Command Descriptor Block */
	
u_int32_t data_len;	/* If sg=0 Data Length, if sg=1 sglist length */
	
u_int32_t cpp_index;	/* Index of address to be returned in sp */
	
u_int32_t data_address;	/* If sg=0 Data Address, if sg=1 sglist address */
	
u_int32_t sp_dma_addr;	/* Address where sp is DMA'ed when cp completes */
	
u_int32_t sense_addr;	/* Address where Sense Data is DMA'ed on error */

	/* Additional fields begin here. */
	
struct scsi_cmnd *SCpnt;

	/* All the cp structure is zero filled by queuecommand except the
           following CP_TAIL_SIZE bytes, initialized by detect */
	
dma_addr_t cp_dma_addr;	/* dma handle for this cp structure */
	
struct sg_list *sglist;	/* pointer to the allocated SG list */
};


#define CP_TAIL_SIZE (sizeof(struct sglist *) + sizeof(dma_addr_t))


struct hostdata {
	
struct mscp cp[MAX_MAILBOXES];	/* Mailboxes for this board */
	
unsigned int cp_stat[MAX_MAILBOXES];	/* FREE, IN_USE, LOCKED, IN_RESET */
	
unsigned int last_cp_used;	/* Index of last mailbox used */
	
unsigned int iocount;	/* Total i/o done for this board */
	
int board_number;	/* Number of this board */
	
char board_name[16];	/* Name of this board */
	
int in_reset;		/* True if board is doing a reset */
	
int target_to[MAX_TARGET][MAX_CHANNEL];	/* N. of timeout errors on target */
	
int target_redo[MAX_TARGET][MAX_CHANNEL];	/* If 1 redo i/o on target */
	
unsigned int retries;	/* Number of internal retries */
	
unsigned long last_retried_pid;	/* Pid of last retried command */
	
unsigned char subversion;	/* Bus type, either ISA or EISA/PCI */
	
unsigned char protocol_rev;	/* EATA 2.0 rev., 'A' or 'B' or 'C' */
	
unsigned char is_pci;	/* 1 is bus type is PCI */
	
struct pci_dev *pdev;	/* pdev for PCI bus, NULL otherwise */
	
struct mssp *sp_cpu_addr;	/* cpu addr for DMA buffer sp */
	
dma_addr_t sp_dma_addr;	/* dma handle for DMA buffer sp */
	
struct mssp sp;		/* Local copy of sp buffer */
};


static struct Scsi_Host *sh[MAX_BOARDS];

static const char *driver_name = "EATA";

static char sha[MAX_BOARDS];

/* Initialize num_boards so that ihdlr can work while detect is in progress */

static unsigned int num_boards = MAX_BOARDS;


static unsigned long io_port[] = {

	/* Space for MAX_INT_PARAM ports usable while loading as a module */
	SKIP, SKIP, SKIP, SKIP, SKIP, SKIP, SKIP, SKIP,
	SKIP, SKIP,

	/* First ISA */
	0x1f0,

	/* Space for MAX_PCI ports possibly reported by PCI_BIOS */
	SKIP, SKIP, SKIP, SKIP, SKIP, SKIP, SKIP, SKIP,
	SKIP, SKIP, SKIP, SKIP, SKIP, SKIP, SKIP, SKIP,

	/* MAX_EISA ports */
	0x1c88, 0x2c88, 0x3c88, 0x4c88, 0x5c88, 0x6c88, 0x7c88, 0x8c88,
	0x9c88, 0xac88, 0xbc88, 0xcc88, 0xdc88, 0xec88, 0xfc88,

	/* Other (MAX_ISA - 1) ports */
	0x170, 0x230, 0x330,

	/* End of list */
	0x0
};

/* Device is Big Endian */

#define H2DEV(x)   cpu_to_be32(x)

#define DEV2H(x)   be32_to_cpu(x)

#define H2DEV16(x) cpu_to_be16(x)

#define DEV2H16(x) be16_to_cpu(x)

/* But transfer orientation from the 16 bit data register is Little Endian */

#define REG2H(x)   le16_to_cpu(x)

static irqreturn_t do_interrupt_handler(int, void *);
static void flush_dev(struct scsi_device *, unsigned long, struct hostdata *,
		      unsigned int);

static int do_trace = 0;

static int setup_done = 0;

static int link_statistics;

static int ext_tran = 0;

static int rev_scan = 1;

#if defined(CONFIG_SCSI_EATA_TAGGED_QUEUE)

static int tag_mode = TAG_SIMPLE;
#else

static int tag_mode = TAG_DISABLED;
#endif

#if defined(CONFIG_SCSI_EATA_LINKED_COMMANDS)

static int linked_comm = 1;
#else

static int linked_comm = 0;
#endif

#if defined(CONFIG_SCSI_EATA_MAX_TAGS)

static int max_queue_depth = CONFIG_SCSI_EATA_MAX_TAGS;
#else

static int max_queue_depth = MAX_CMD_PER_LUN;
#endif

#if defined(CONFIG_ISA)

static int isa_probe = 1;
#else

static int isa_probe = 0;
#endif

#if defined(CONFIG_EISA)

static int eisa_probe = 1;
#else

static int eisa_probe = 0;
#endif

#if defined(CONFIG_PCI)

static int pci_probe = 1;
#else

static int pci_probe = 0;
#endif


#define MAX_INT_PARAM 10

#define MAX_BOOT_OPTIONS_SIZE 256

static char boot_options[MAX_BOOT_OPTIONS_SIZE];

#if defined(MODULE)
#include <linux/module.h>
#include <linux/moduleparam.h>

module_param_string(eata, boot_options, MAX_BOOT_OPTIONS_SIZE, 0);
MODULE_PARM_DESC(eata, " equivalent to the \"eata=...\" kernel boot option."
		 "            Example: modprobe eata \"eata=0x7410,0x230,lc:y,tm:0,mq:4,ep:n\"");
MODULE_AUTHOR("Dario Ballabio");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("EATA/DMA SCSI Driver");

#endif


static int eata2x_slave_configure(struct scsi_device *dev) { int tqd, utqd; char *tag_suffix, *link_suffix; utqd = MAX_CMD_PER_LUN; tqd = max_queue_depth; if (TLDEV(dev->type) && dev->tagged_supported) { if (tag_mode == TAG_SIMPLE) { tag_suffix = ", simple tags"; } else if (tag_mode == TAG_ORDERED) { tag_suffix = ", ordered tags"; } else { tag_suffix = ", no tags"; } scsi_change_queue_depth(dev, tqd); } else if (TLDEV(dev->type) && linked_comm) { scsi_change_queue_depth(dev, tqd); tag_suffix = ", untagged"; } else { scsi_change_queue_depth(dev, utqd); tag_suffix = ""; } if (TLDEV(dev->type) && linked_comm && dev->queue_depth > 2) link_suffix = ", sorted"; else if (TLDEV(dev->type)) link_suffix = ", unsorted"; else link_suffix = ""; sdev_printk(KERN_INFO, dev, "cmds/lun %d%s%s.\n", dev->queue_depth, link_suffix, tag_suffix); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)7138.59%218.18%
Alan Cox7138.59%19.09%
Doug Ledford2413.04%218.18%
Christoph Hellwig158.15%545.45%
Jeff Garzik31.63%19.09%
Total184100.00%11100.00%


static int wait_on_busy(unsigned long iobase, unsigned int loop) { while (inb(iobase + REG_AUX_STATUS) & ABSY_ASSERTED) { udelay(1L); if (--loop == 0) return 1; } return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)4395.56%583.33%
Christoph Hellwig24.44%116.67%
Total45100.00%6100.00%


static int do_dma(unsigned long iobase, unsigned long addr, unchar cmd) { unsigned char *byaddr; unsigned long devaddr; if (wait_on_busy(iobase, (addr ? MAXLOOP * 100 : MAXLOOP))) return 1; if (addr) { devaddr = H2DEV(addr); byaddr = (unsigned char *)&devaddr; outb(byaddr[3], iobase + REG_LOW); outb(byaddr[2], iobase + REG_LM); outb(byaddr[1], iobase + REG_MID); outb(byaddr[0], iobase + REG_MSB); } outb(cmd, iobase + REG_CMD); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)8868.22%666.67%
Alan Cox3829.46%111.11%
Christoph Hellwig21.55%111.11%
Dario Ballabio10.78%111.11%
Total129100.00%9100.00%


static int read_pio(unsigned long iobase, ushort * start, ushort * end) { unsigned int loop = MAXLOOP; ushort *p; for (p = start; p <= end; p++) { while (!(inb(iobase + REG_STATUS) & DRQ_ASSERTED)) { udelay(1L); if (--loop == 0) return 1; } loop = MAXLOOP; *p = REG2H(inw(iobase)); } return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)8794.57%466.67%
Dario Ballabio33.26%116.67%
Christoph Hellwig22.17%116.67%
Total92100.00%6100.00%


static struct pci_dev *get_pci_dev(unsigned long port_base) { #if defined(CONFIG_PCI) unsigned int addr; struct pci_dev *dev = NULL; while ((dev = pci_get_class(PCI_CLASS_STORAGE_SCSI << 8, dev))) { addr = pci_resource_start(dev, 0); #if defined(DEBUG_PCI_DETECT) printk("%s: get_pci_dev, bus %d, devfn 0x%x, addr 0x%x.\n", driver_name, dev->bus->number, dev->devfn, addr); #endif /* we are in so much trouble for a pci hotplug system with this driver * anyway, so doing this at least lets people unload the driver and not * cause memory problems, but in general this is a bad thing to do (this * driver needs to be converted to the proper PCI api someday... */ pci_dev_put(dev); if (addr + PCI_BASE_ADDRESS_0 == port_base) return dev; } #endif /* end CONFIG_PCI */ return NULL; }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)8984.76%350.00%
Linus Torvalds98.57%116.67%
Greg Kroah-Hartman65.71%116.67%
Christoph Hellwig10.95%116.67%
Total105100.00%6100.00%


static void enable_pci_ports(void) { #if defined(CONFIG_PCI) struct pci_dev *dev = NULL; while ((dev = pci_get_class(PCI_CLASS_STORAGE_SCSI << 8, dev))) { #if defined(DEBUG_PCI_DETECT) printk("%s: enable_pci_ports, bus %d, devfn 0x%x.\n", driver_name, dev->bus->number, dev->devfn); #endif if (pci_enable_device(dev)) printk ("%s: warning, pci_enable_device failed, bus %d devfn 0x%x.\n", driver_name, dev->bus->number, dev->devfn); } #endif /* end CONFIG_PCI */ }

Contributors

PersonTokensPropCommitsCommitProp
Alan Cox8998.89%150.00%
Greg Kroah-Hartman11.11%150.00%
Total90100.00%2100.00%


static int port_detect(unsigned long port_base, unsigned int j, struct scsi_host_template *tpnt) { unsigned char irq, dma_channel, subversion, i, is_pci = 0; unsigned char protocol_rev; struct eata_info info; char *bus_type, dma_name[16]; struct pci_dev *pdev; /* Allowed DMA channels for ISA (0 indicates reserved) */ unsigned char dma_channel_table[4] = { 5, 6, 7, 0 }; struct Scsi_Host *shost; struct hostdata *ha; char name[16]; sprintf(name, "%s%d", driver_name, j); if (!request_region(port_base, REGION_SIZE, driver_name)) { #if defined(DEBUG_DETECT) printk("%s: address 0x%03lx in use, skipping probe.\n", name, port_base); #endif goto fail; } if (do_dma(port_base, 0, READ_CONFIG_PIO)) { #if defined(DEBUG_DETECT) printk("%s: detect, do_dma failed at 0x%03lx.\n", name, port_base); #endif goto freelock; } /* Read the info structure */ if (read_pio(port_base, (ushort *) & info, (ushort *) & info.ipad[0])) { #if defined(DEBUG_DETECT) printk("%s: detect, read_pio failed at 0x%03lx.\n", name, port_base); #endif goto freelock; } info.data_len = DEV2H(info.data_len); info.sign = DEV2H(info.sign); info.cp_pad_len = DEV2H16(info.cp_pad_len); info.cp_len = DEV2H(info.cp_len); info.sp_len = DEV2H(info.sp_len); info.scatt_size = DEV2H16(info.scatt_size); info.queue_size = DEV2H16(info.queue_size); /* Check the controller "EATA" signature */ if (info.sign != EATA_SIG_BE) { #if defined(DEBUG_DETECT) printk("%s: signature 0x%04x discarded.\n", name, info.sign); #endif goto freelock; } if (info.data_len < EATA_2_0A_SIZE) { printk ("%s: config structure size (%d bytes) too short, detaching.\n", name, info.data_len); goto freelock; } else if (info.data_len == EATA_2_0A_SIZE) protocol_rev = 'A'; else if (info.data_len == EATA_2_0B_SIZE) protocol_rev = 'B'; else protocol_rev = 'C'; if (protocol_rev != 'A' && info.forcaddr) { printk("%s: warning, port address has been forced.\n", name); bus_type = "PCI"; is_pci = 1; subversion = ESA; } else if (port_base > MAX_EISA_ADDR || (protocol_rev == 'C' && info.pci)) { bus_type = "PCI"; is_pci = 1; subversion = ESA; } else if (port_base >= MIN_EISA_ADDR || (protocol_rev == 'C' && info.eisa)) { bus_type = "EISA"; subversion = ESA; } else if (protocol_rev == 'C' && !info.eisa && !info.pci) { bus_type = "ISA"; subversion = ISA; } else if (port_base > MAX_ISA_ADDR) { bus_type = "PCI"; is_pci = 1