Commit e72fc23c authored by James Bottomley's avatar James Bottomley

Merge raven.il.steeleye.com:/home/jejb/BK/scsi-misc-2.5

into raven.il.steeleye.com:/home/jejb/BK/scsi-for-linus-2.5
parents 5ac8451a c544afb9
### Version 2.00.3
Wed Jan 29 09:13:44 EST 200 - Atul Mukker <atulm@lsil.com>
i. Change the handshake in ISR while acknowledging interrupts. Write the
valid interrupt pattern 0x10001234 as soon as it is read from the
outdoor register. In existing driver and on certain platform, invalid
command ids were being returned.
Also, do not wait on status be become 0xFF, since FW can return this
status in certain circumstances.
Initialize the numstatus field of mailbox to 0xFF so that we can wait
on this wait in next interrupt. Firmware does not change its value
unless there are some status to be posted
ii. Specify the logical drive number while issuing the RESERVATION_STATUS
iii. Reduce the default mailbox busy wait time from 300us to 10us. This is
done to avaoid a possible deadlock in FW because of longer bust waits.
iv. The max outstanding commands are reduced to 126 because that't the
safest value on all FW.
v. Number of sectors per IO are reduced to 128 (64kb), becuase FW needs
resources in special circumstances like check consistency, rebuilds
etc.
vi. max_commands is no longer a module parameter because of iv.
### Version: 2.00.2
i. Intermediate release with kernel specific code
### Version: 2.00.1i
Wed Dec 4 14:34:51 EST 2002 - Atul Mukker <atulm@lsil.com>
i. Making the older IO based controllers to work with this driver
### Version 2.00.1
Fri Nov 15 10:59:44 EST 2002 - Atul Mukker <atulm@lsil.com>
i. Release host lock before issuing internal command to reset
reservations in megaraid_reset() and reacquire after internal command
is completed.
...@@ -16,13 +16,13 @@ For example, the aic7xxx LLD controls Adaptec SCSI parallel interface ...@@ -16,13 +16,13 @@ For example, the aic7xxx LLD controls Adaptec SCSI parallel interface
(SPI) controllers based on that company's 7xxx chip series. The aic7xxx (SPI) controllers based on that company's 7xxx chip series. The aic7xxx
LLD can be built into the kernel or loaded as a module. There can only be LLD can be built into the kernel or loaded as a module. There can only be
one aic7xxx LLD running in a Linux system but it may be controlling many one aic7xxx LLD running in a Linux system but it may be controlling many
HBAs. These HBAs might be either on PCI daughterboards or built into HBAs. These HBAs might be either on PCI daughter-boards or built into
the motherboard (or both). Like most modern HBAs, each aic7xxx host the motherboard (or both). Like most modern HBAs, each aic7xxx host
has its own PCI device address. [The one-to-one correspondance between has its own PCI device address. [The one-to-one correspondence between
a SCSI host and a PCI device is common but not required (e.g. with a SCSI host and a PCI device is common but not required (e.g. with
ISA or MCA adapters).] ISA or MCA adapters).]
This version of the document roughly matches linux kernel version 2.5.63 . This version of the document roughly matches linux kernel version 2.5.67 .
Documentation Documentation
============= =============
...@@ -33,14 +33,15 @@ directory, named scsi_mid_low_api.txt . Many LLDs are documented there ...@@ -33,14 +33,15 @@ directory, named scsi_mid_low_api.txt . Many LLDs are documented there
(e.g. aic7xxx.txt). The SCSI mid-level is briefly described in scsi.txt (e.g. aic7xxx.txt). The SCSI mid-level is briefly described in scsi.txt
(with a url to a document describing the SCSI subsystem in the lk 2.4 (with a url to a document describing the SCSI subsystem in the lk 2.4
series). Two upper level drivers have documents in that directory: series). Two upper level drivers have documents in that directory:
st.txt (SCSI tape driver) and scsi-generic.txt . st.txt (SCSI tape driver) and scsi-generic.txt (for the sg driver).
Some documentation (or urls) for LLDs may be in the C source code or Some documentation (or urls) for LLDs may be in the C source code or
in the same directory. For example to find a url about the USB mass in the same directory as the C source code. For example to find a url
storage driver see the /usr/src/linux/drivers/usb/storage directory. about the USB mass storage driver see the
/usr/src/linux/drivers/usb/storage directory.
The Linux kernel source Documentation/DocBook/scsidrivers.tmpl file The Linux kernel source Documentation/DocBook/scsidrivers.tmpl file
refers to this file. With the appropriate DocBook toolset, this permits refers to this file. With the appropriate DocBook tool-set, this permits
users to generate html, ps and pdf renderings of information within this users to generate html, ps and pdf renderings of information within this
file (e.g. the interface functions). file (e.g. the interface functions).
...@@ -49,17 +50,15 @@ Driver structure ...@@ -49,17 +50,15 @@ Driver structure
Traditionally a LLD for the SCSI subsystem has been at least two files in Traditionally a LLD for the SCSI subsystem has been at least two files in
the drivers/scsi directory. For example, a driver called "xyz" has a header the drivers/scsi directory. For example, a driver called "xyz" has a header
file "xyz.h" and a source file "xyz.c". [Actually there is no good reason file "xyz.h" and a source file "xyz.c". [Actually there is no good reason
why this couldn't all be in one file.] Some drivers that have been ported why this couldn't all be in one file; the header file is superfluous.] Some
to several operating systems have more than two files. For example the drivers that have been ported to several operating systems have more than
aic7xxx driver has separate files for generic and OS-specific code two files. For example the aic7xxx driver has separate files for generic
(e.g. FreeBSD and Linux). Such drivers tend to have their own directory and OS-specific code (e.g. FreeBSD and Linux). Such drivers tend to have
under the drivers/scsi directory. their own directory under the drivers/scsi directory.
When a new LLD is being added to Linux, the following files (found in the When a new LLD is being added to Linux, the following files (found in the
drivers/scsi directory) will need some attention: Makefile, Config.help and drivers/scsi directory) will need some attention: Makefile and Kconfig .
Config.in . SCSI documentation is found in the Documentation/scsi directory It is probably best to study how existing LLDs are organized.
of the kernel source tree. It is probably best to study how existing LLDs
are organized.
As the 2.5 series development kernels evolve, changes are being As the 2.5 series development kernels evolve, changes are being
introduced into this interface. An example of this is driver introduced into this interface. An example of this is driver
...@@ -78,7 +77,8 @@ A LLD interfaces to the SCSI subsystem several ways: ...@@ -78,7 +77,8 @@ A LLD interfaces to the SCSI subsystem several ways:
a) directly invoking functions supplied by the mid level a) directly invoking functions supplied by the mid level
b) passing a set of function pointers to a registration function b) passing a set of function pointers to a registration function
supplied by the mid level. The mid level will then invoke these supplied by the mid level. The mid level will then invoke these
functions at some point in the future functions at some point in the future. The LLD will supply
implementations of these functions.
c) direct access to instances of well known data structures maintained c) direct access to instances of well known data structures maintained
by the mid level by the mid level
...@@ -86,7 +86,7 @@ Those functions in group a) are listed in a section entitled "Mid level ...@@ -86,7 +86,7 @@ Those functions in group a) are listed in a section entitled "Mid level
supplied functions" below. supplied functions" below.
Those functions in group b) are listed in a section entitled "Interface Those functions in group b) are listed in a section entitled "Interface
functions" below. The function pointers are placed in the members of functions" below. Their function pointers are placed in the members of
"struct SHT", an instance of which is passed to scsi_register() [or "struct SHT", an instance of which is passed to scsi_register() [or
scsi_register_host() in the passive initialization model]. Those interface scsi_register_host() in the passive initialization model]. Those interface
functions that are not mandatory and that the LLD does not wish to supply functions that are not mandatory and that the LLD does not wish to supply
...@@ -97,34 +97,42 @@ placed in function pointer members not explicitly initialized.] ...@@ -97,34 +97,42 @@ placed in function pointer members not explicitly initialized.]
Those instances in group c) are slowly being removed as they tend to be Those instances in group c) are slowly being removed as they tend to be
"racy" especially in a hotplug environment. "racy" especially in a hotplug environment.
All functions defined within a LLD and all data defined at file scope
should be static. For example the slave_alloc() function in a LLD
called "xxx" could be defined as
"static int xxx_slave_alloc(struct scsi_device * sdev) { /* code */ }"
Hotplug initialization model Hotplug initialization model
============================ ============================
In this model a LLD controls when SCSI hosts are introduced and removed In this model a LLD controls when SCSI hosts are introduced and removed
from the SCSI subsystem. Hosts can be introduced as early as driver from the SCSI subsystem. Hosts can be introduced as early as driver
initialization and removed as late as driver shutdown. Typically a driver initialization and removed as late as driver shutdown. Typically a driver
will respond to a sysfs probe() callback that indicates a HBA is present will respond to a sysfs probe() callback that indicates a HBA has been
(e.g. a PCI device). After confirming it is a device that it wants to detected. After confirming that the new device is one that the LLD wants
control, it will initialize the HBA and then register a new host with the to control, the LLD will initialize the HBA and then register a new host
SCSI mid level. with the SCSI mid level.
Hot unplugging a HBA that controls a disk which is processing SCSI Hot unplugging a HBA that controls a disk which is processing SCSI
commands on a mounted file system is an ugly situation. Issues with commands on a mounted file system is an ugly situation. Issues with
this scenario are still being worked through. The primary concern is this scenario are still being worked through. The primary concern is
the stability of the kernel (specifically the block and SCSI subsystems) the stability of the kernel (specifically the block and SCSI subsystems)
since the effected disk can be "cleaned up" the next time it is seen. since the effected disk can be "cleaned up" the next time it is seen.
In the sysfs model, a remove() callback indicates a HBA has disappeared.
During LLD initialization the driver should register itself with the During LLD initialization the driver should register itself with the
appropriate IO bus on which it expects to find HBA(s) (e.g. the PCI bus). appropriate IO bus on which it expects to find HBA(s) (e.g. the PCI bus).
This can probably be done via sysfs. Any driver parameters (especially This can probably be done via sysfs. Any driver parameters (especially
those that are writeable after the driver is loaded) could also be those that are writable after the driver is loaded) could also be
registered with sysfs at this point. At the end of driver initialization registered with sysfs at this point. The SCSI mid level first becomes
the SCSI mid level is typically not aware of its presence. aware of a LLD when that LLD registers its first HBA.
At some later time, the LLD becomes aware of a HBA and what follows At some later time, the LLD becomes aware of a HBA and what follows
is a typical sequence of calls between the LLD and the mid level. is a typical sequence of calls between the LLD and the mid level.
This example shows 3 devices being found and 1 device not being found: This example shows the mid level scanning the newly introduced HBA for 3
scsi devices of which only the first 2 respond:
[HBA PROBE]
LLD mid level LLD LLD mid level LLD
--- --------- --- --- --------- ---
scsi_register() --> scsi_register() -->
...@@ -134,9 +142,6 @@ scsi_add_host() --------+ ...@@ -134,9 +142,6 @@ scsi_add_host() --------+
slave_configure() --> scsi_adjust_queue_depth() slave_configure() --> scsi_adjust_queue_depth()
| |
slave_alloc() slave_alloc()
slave_configure() --> scsi_adjust_queue_depth()
|
slave_alloc()
slave_configure() --> scsi_adjust_queue_depth() slave_configure() --> scsi_adjust_queue_depth()
| |
slave_alloc() ** slave_alloc() **
...@@ -150,21 +155,40 @@ if slave_configure() is supplied. ...@@ -150,21 +155,40 @@ if slave_configure() is supplied.
Here is the corresponding sequence when a host (HBA) is being Here is the corresponding sequence when a host (HBA) is being
removed: removed:
LLD mid level [HBA REMOVE]
--- --------- LLD mid level LLD
scsi_remove_host() -----+ --- --------- ---
| scsi_remove_host() ---------+
slave_destroy() |
slave_destroy() slave_destroy()
slave_destroy() slave_destroy()
scsi_unregister() --> release() --> scsi_unregister()
It is practical for a LLD to keep track of struct Scsi_Host instances It is practical for a LLD to keep track of struct Scsi_Host instances
(a pointer is returned by scsi_register() ) and struct scsi_device (a pointer is returned by scsi_register() ) and struct scsi_device
instances (a pointer is passed as the parameter to slave_alloc() and instances (a pointer is passed as the parameter to slave_alloc() and
slave_configure() ). Both classes of instances are "owned" by the slave_configure() ). Both classes of instances are "owned" by the
mid-level. struct scsi_device instances are freed after slave_destroy(). mid-level. struct scsi_device instances are freed after slave_destroy().
struct Scsi_Host instances are freed after scsi_unregister(). struct Scsi_Host instances are freed within scsi_unregister().
TODO:
Descriptions, are the following correct?
[DEVICE hotplug]
LLD mid level LLD
--- --------- ---
scsi_add_device() ------+
|
slave_alloc()
slave_configure() --> scsi_adjust_queue_depth()
[DEVICE unplug]
LLD mid level LLD
--- --------- ---
scsi_set_device_offline()
scsi_remove_device() -------+
|
slave_destroy()
Passive initialization model Passive initialization model
...@@ -226,8 +250,7 @@ scsi_unregister_host() -----+ ...@@ -226,8 +250,7 @@ scsi_unregister_host() -----+
slave_destroy() slave_destroy()
release() --> scsi_unregister() release() --> scsi_unregister()
Both slave_destroy() and release() are optional. If they are not supplied slave_destroy() is optional.
the mid level supplies default actions.
The shortcoming of the "passive initialization model" is that host The shortcoming of the "passive initialization model" is that host
registration and de-registration are (typically) tied to LLD initialization registration and de-registration are (typically) tied to LLD initialization
...@@ -238,39 +261,97 @@ driver shutdown and re-initialization. ...@@ -238,39 +261,97 @@ driver shutdown and re-initialization.
Conventions Conventions
=========== ===========
First Linus's thoughts on C coding found in file Documentation/CodingStyle . First, Linus's thoughts on C coding can be found in the file
Documentation/CodingStyle .
Next there is a movement to "outlaw" typedefs introducing synonyms for Next, there is a movement to "outlaw" typedefs introducing synonyms for
struct tags. Both can be still found in the SCSI subsystem, for example: struct tags. Both can be still found in the SCSI subsystem, for example:
"typedef struct SHT { ...} Scsi_Host_Template;" in hosts.h . In this "typedef struct SHT { ...} Scsi_Host_Template;" in hosts.h . In this
case "struct SHT" is preferred to "Scsi_Host_Template". case "struct SHT" is preferred to "Scsi_Host_Template". [The poor naming
example was chosen with malevolent intent.]
Also C99 additions are encouraged to the extent they are supported Also, C99 enhancements are encouraged to the extent they are supported
by the relevant gcc compilers. So "//" style comments are encouraged by the relevant gcc compilers. So "//" style comments are encouraged
were appropriate as are C99 style structure and array initializers. were appropriate as are C99 style structure and array initializers.
Don't go too far, VLAs are not properly supported yet.
Well written, tested and documented code, need not be re-formatted to
comply with the above conventions. For example, the aic7xxx driver
comes to Linux from FreeBSD and Adaptec's own labs. No doubt FreeBSD
and Adaptec have their own coding conventions.
Mid level supplied functions Mid level supplied functions
============================ ============================
These functions are supplied by the SCSI mid level for use by LLDs. These functions are supplied by the SCSI mid level for use by LLDs.
The names (i.e. entry points) of these functions are exported The names (i.e. entry points) of these functions are exported (in
so a LLD that is a module can access them when the SCSI scsi_syms.c) so a LLD that is a module can access them. The kernel will
mid level is built into the kernel. The kernel will arrange for the arrange for the SCSI mid level to be loaded and initialized before any LLD
SCSI mid level to be loaded and initialized before any LLD
is initialized. The functions below are listed alphabetically and their is initialized. The functions below are listed alphabetically and their
names all start with "scsi_". names all start with "scsi_".
Summary:
scsi_add_device - creates new scsi device (lu) instance
scsi_add_host - perform sysfs registration and SCSI bus scan.
scsi_add_timer - (re-)start timer on a SCSI command.
scsi_adjust_queue_depth - change the queue depth on a SCSI device
scsi_assign_lock - replace default host_lock with given lock
scsi_bios_ptable - return copy of block device's partition table
scsi_block_requests - prevent further commands being queued to given host
scsi_delete_timer - cancel timer on a SCSI command.
scsi_partsize - parse partition table into cylinders, heads + sectors
scsi_register - create and register a scsi host adapter instance.
scsi_register_host - register a low level host driver
scsi_remove_device - detach and remove a SCSI device
scsi_remove_host - detach and remove all SCSI devices owned by host
scsi_report_bus_reset - report scsi _bus_ reset observed
scsi_set_device - place device reference in host structure
scsi_set_device_offline - set device offline then flush its queue
scsi_to_pci_dma_dir - convert SCSI subsystem direction flag to PCI
scsi_to_sbus_dma_dir - convert SCSI subsystem direction flag to SBUS
scsi_track_queue_full - track successive QUEUE_FULL events
scsi_unblock_requests - allow further commands to be queued to given host
scsi_unregister - unregister and free memory used by host instance
scsi_unregister_host - unregister a low level host adapter driver
Details:
/**
* scsi_add_device - creates new scsi device (lu) instance
* @shost: pointer to scsi host instance
* @channel: channel number (rarely other than 0)
* @id: target id number
* @lun: logical unit number
*
* Returns pointer to new struct scsi_device instance or
* ERR_PTR(-ENODEV) (or some other bent pointer) if something is
* wrong (e.g. no lu responds at given address)
*
* Notes: This call is usually performed internally during a scsi
* bus scan when a HBA is added (i.e. scsi_add_host()). So it
* should only be called if the HBA becomes aware of a new scsi
* device (lu) after scsi_add_host() has completed. If successful
* this call we lead to slave_alloc() and slave_configure() callbacks
* into the LLD.
*
* Defined in: drivers/scsi/scsi_scan.c
**/
struct scsi_device * scsi_add_device(struct Scsi_Host *shost,
unsigned int channel,
unsigned int id, unsigned int lun)
/** /**
* scsi_add_host - perform sysfs registration and SCSI bus scan. * scsi_add_host - perform sysfs registration and SCSI bus scan.
* @shost: pointer to scsi host instance * @shost: pointer to scsi host instance
* @dev: pointer to struct device host instance of class type scsi * @dev: pointer to struct device host instance
* (or related)
* *
* Returns 0 on success, negative errno of failure (e.g. -ENOMEM) * Returns 0 on success, negative errno of failure (e.g. -ENOMEM)
* *
* Notes: Only required in "hotplug initialization model" after a * Notes: Only required in "hotplug initialization model" after a
* successful call to scsi_register(). * successful call to scsi_register().
* Defined in drivers/scsi/hosts.c *
* Defined in: drivers/scsi/hosts.c
**/ **/
int scsi_add_host(struct Scsi_Host *shost, struct device * dev) int scsi_add_host(struct Scsi_Host *shost, struct device * dev)
...@@ -283,10 +364,12 @@ int scsi_add_host(struct Scsi_Host *shost, struct device * dev) ...@@ -283,10 +364,12 @@ int scsi_add_host(struct Scsi_Host *shost, struct device * dev)
* *
* Returns nothing * Returns nothing
* *
* Notes: All commands issued by upper levels already have a timeout * Notes: Each scsi command has its own timer, and as it is added
* associated with them. A LLD can use this function to change * to the queue, we set up the timer. When the command completes,
* we cancel the timer. A LLD can use this function to change
* the existing timeout value. * the existing timeout value.
* Defined in drivers/scsi/scsi_error.c *
* Defined in: drivers/scsi/scsi_error.c
**/ **/
void scsi_add_timer(Scsi_Cmnd *scmd, int timeout, void (*complete) void scsi_add_timer(Scsi_Cmnd *scmd, int timeout, void (*complete)
(Scsi_Cmnd *)) (Scsi_Cmnd *))
...@@ -295,10 +378,10 @@ void scsi_add_timer(Scsi_Cmnd *scmd, int timeout, void (*complete) ...@@ -295,10 +378,10 @@ void scsi_add_timer(Scsi_Cmnd *scmd, int timeout, void (*complete)
/** /**
* scsi_adjust_queue_depth - change the queue depth on a SCSI device * scsi_adjust_queue_depth - change the queue depth on a SCSI device
* @SDpnt: pointer to SCSI device to change queue depth on * @SDpnt: pointer to SCSI device to change queue depth on
* @tagged: 0 - no tagged queueing * @tagged: 0 - no tagged queuing
* MSG_SIMPLE_TAG - simple (unordered) tagged queueing * MSG_SIMPLE_TAG - simple (unordered) tagged queuing
* MSG_ORDERED_TAG - ordered tagged queueing * MSG_ORDERED_TAG - ordered tagged queuing
* @tags Number of tags allowed if tagged queueing enabled, * @tags Number of tags allowed if tagged queuing enabled,
* or number of commands the LLD can queue up * or number of commands the LLD can queue up
* in non-tagged mode (as per cmd_per_lun). * in non-tagged mode (as per cmd_per_lun).
* *
...@@ -309,7 +392,8 @@ void scsi_add_timer(Scsi_Cmnd *scmd, int timeout, void (*complete) ...@@ -309,7 +392,8 @@ void scsi_add_timer(Scsi_Cmnd *scmd, int timeout, void (*complete)
* slave_destroy().] Can safely be invoked from interrupt code. Actual * slave_destroy().] Can safely be invoked from interrupt code. Actual
* queue depth change may be delayed until the next command is being * queue depth change may be delayed until the next command is being
* processed. * processed.
* Defined in drivers/scsi/scsi.c [see source code for more notes] *
* Defined in: drivers/scsi/scsi.c [see source code for more notes]
* *
**/ **/
void scsi_adjust_queue_depth(struct scsi_device * SDpnt, int tagged, void scsi_adjust_queue_depth(struct scsi_device * SDpnt, int tagged,
...@@ -323,7 +407,7 @@ void scsi_adjust_queue_depth(struct scsi_device * SDpnt, int tagged, ...@@ -323,7 +407,7 @@ void scsi_adjust_queue_depth(struct scsi_device * SDpnt, int tagged,
* *
* Returns nothing * Returns nothing
* *
* Notes: Defined in drivers/scsi/hosts.h . * Defined in: drivers/scsi/hosts.h .
**/ **/
void scsi_assign_lock(struct Scsi_Host *shost, spinlock_t *lock) void scsi_assign_lock(struct Scsi_Host *shost, spinlock_t *lock)
...@@ -332,10 +416,11 @@ void scsi_assign_lock(struct Scsi_Host *shost, spinlock_t *lock) ...@@ -332,10 +416,11 @@ void scsi_assign_lock(struct Scsi_Host *shost, spinlock_t *lock)
* scsi_bios_ptable - return copy of block device's partition table * scsi_bios_ptable - return copy of block device's partition table
* @dev: pointer to block device * @dev: pointer to block device
* *
* Returns pointer to partition table, or NULL or failure * Returns pointer to partition table, or NULL for failure
* *
* Notes: Caller owns memory returned (free with kfree() ) * Notes: Caller owns memory returned (free with kfree() )
* Defined in drivers/scsi/scsicam.c *
* Defined in: drivers/scsi/scsicam.c
**/ **/
unsigned char *scsi_bios_ptable(struct block_device *dev) unsigned char *scsi_bios_ptable(struct block_device *dev)
...@@ -349,7 +434,8 @@ unsigned char *scsi_bios_ptable(struct block_device *dev) ...@@ -349,7 +434,8 @@ unsigned char *scsi_bios_ptable(struct block_device *dev)
* *
* Notes: There is no timer nor any other means by which the requests * Notes: There is no timer nor any other means by which the requests
* get unblocked other than the LLD calling scsi_unblock_requests(). * get unblocked other than the LLD calling scsi_unblock_requests().
* Defined in drivers/scsi/scsi_lib.c *
* Defined in: drivers/scsi/scsi_lib.c
**/ **/
void scsi_block_requests(struct Scsi_Host * SHpnt) void scsi_block_requests(struct Scsi_Host * SHpnt)
...@@ -364,7 +450,8 @@ void scsi_block_requests(struct Scsi_Host * SHpnt) ...@@ -364,7 +450,8 @@ void scsi_block_requests(struct Scsi_Host * SHpnt)
* Notes: All commands issued by upper levels already have a timeout * Notes: All commands issued by upper levels already have a timeout
* associated with them. A LLD can use this function to cancel the * associated with them. A LLD can use this function to cancel the
* timer. * timer.
* Defined in drivers/scsi/scsi_error.c *
* Defined in: drivers/scsi/scsi_error.c
**/ **/
int scsi_delete_timer(Scsi_Cmnd *scmd) int scsi_delete_timer(Scsi_Cmnd *scmd)
...@@ -380,10 +467,11 @@ int scsi_delete_timer(Scsi_Cmnd *scmd) ...@@ -380,10 +467,11 @@ int scsi_delete_timer(Scsi_Cmnd *scmd)
* Returns 0 on success, -1 on failure * Returns 0 on success, -1 on failure
* *
* Notes: Caller owns memory returned (free with kfree() ) * Notes: Caller owns memory returned (free with kfree() )
* Defined in drivers/scsi/scsicam.c *
* Defined in: drivers/scsi/scsicam.c
**/ **/
int scsi_partsize(unsigned char *buf, unsigned long capacity, int scsi_partsize(unsigned char *buf, unsigned long capacity,
unsigned int *cyls, unsigned int *hds, unsigned int *secs) unsigned int *cyls, unsigned int *hds, unsigned int *secs)
/** /**
...@@ -398,7 +486,8 @@ int scsi_partsize(unsigned char *buf, unsigned long capacity, ...@@ -398,7 +486,8 @@ int scsi_partsize(unsigned char *buf, unsigned long capacity,
* this host has _not_ yet been done. * this host has _not_ yet been done.
* The hostdata array (by default zero length) is a per host scratch * The hostdata array (by default zero length) is a per host scratch
* area for the LLD. * area for the LLD.
* Defined in drivers/scsi/hosts.c . *
* Defined in: drivers/scsi/hosts.c .
**/ **/
struct Scsi_Host * scsi_register(struct SHT *, int xtr_bytes) struct Scsi_Host * scsi_register(struct SHT *, int xtr_bytes)
...@@ -415,11 +504,29 @@ struct Scsi_Host * scsi_register(struct SHT *, int xtr_bytes) ...@@ -415,11 +504,29 @@ struct Scsi_Host * scsi_register(struct SHT *, int xtr_bytes)
* function by including the scsi_module.c file. * function by including the scsi_module.c file.
* This function is deprecated, use the "hotplug initialization * This function is deprecated, use the "hotplug initialization
* model" instead. * model" instead.
* Defined in drivers/scsi/hosts.c . *
* Defined in: drivers/scsi/hosts.c .
**/ **/
int scsi_register_host(Scsi_Host_Template *shost_tp) int scsi_register_host(Scsi_Host_Template *shost_tp)
/**
* scsi_remove_device - detach and remove a SCSI device
* @sdev: a pointer to a scsi device instance
*
* Returns value: 0 on success, -EINVAL if device not attached
*
* Notes: If a LLD becomes aware that a scsi device (lu) has
* been removed but its host is still present then it can request
* the removal of that scsi device. If successful this call will
* lead to the slave_destroy() callback being invoked. sdev is an
* invalid pointer after this call.
*
* Defined in: drivers/scsi/scsi_scan.c .
**/
int scsi_remove_device(struct scsi_device *sdev)
/** /**
* scsi_remove_host - detach and remove all SCSI devices owned by host * scsi_remove_host - detach and remove all SCSI devices owned by host
* @shost: a pointer to a scsi host instance * @shost: a pointer to a scsi host instance
...@@ -429,7 +536,8 @@ int scsi_register_host(Scsi_Host_Template *shost_tp) ...@@ -429,7 +536,8 @@ int scsi_register_host(Scsi_Host_Template *shost_tp)
* Notes: Should only be invoked if the "hotplug initialization * Notes: Should only be invoked if the "hotplug initialization
* model" is being used. It should be called _prior_ to * model" is being used. It should be called _prior_ to
* scsi_unregister(). * scsi_unregister().
* Defined in drivers/scsi/hosts.c . *
* Defined in: drivers/scsi/hosts.c .
**/ **/
int scsi_remove_host(struct Scsi_Host *shost) int scsi_remove_host(struct Scsi_Host *shost)
...@@ -446,7 +554,8 @@ int scsi_remove_host(struct Scsi_Host *shost) ...@@ -446,7 +554,8 @@ int scsi_remove_host(struct Scsi_Host *shost)
* mid level itself don't need to call this, but there should be * mid level itself don't need to call this, but there should be
* no harm. The main purpose of this is to make sure that a * no harm. The main purpose of this is to make sure that a
* CHECK_CONDITION is properly treated. * CHECK_CONDITION is properly treated.
* Defined in drivers/scsi/scsi_lib.c . *
* Defined in: drivers/scsi/scsi_lib.c .
**/ **/
void scsi_report_bus_reset(struct Scsi_Host * shost, int channel) void scsi_report_bus_reset(struct Scsi_Host * shost, int channel)
...@@ -458,11 +567,26 @@ void scsi_report_bus_reset(struct Scsi_Host * shost, int channel) ...@@ -458,11 +567,26 @@ void scsi_report_bus_reset(struct Scsi_Host * shost, int channel)
* *
* Returns nothing * Returns nothing
* *
* Notes: Defined in drivers/scsi/hosts.h . * Defined in: drivers/scsi/hosts.h .
**/ **/
void scsi_set_device(struct Scsi_Host * shost, struct device * dev) void scsi_set_device(struct Scsi_Host * shost, struct device * dev)
/**
* scsi_set_device_offline - set device offline then flush its queue
* @sdev: a pointer to a scsi device instance to be set offline
*
* Returns nothing
*
* Notes: Commands that are currently active on the scsi device have
* their timers cancelled and are transferred to the host's
* "eh" list for cancellation.
* Defined in: drivers/scsi/scsi.c .
**/
void scsi_set_device_offline(struct scsi_device * sdev)
/** /**
* scsi_to_pci_dma_dir - convert SCSI subsystem direction flag to PCI * scsi_to_pci_dma_dir - convert SCSI subsystem direction flag to PCI
* @scsi_data_direction: SCSI subsystem direction flag * @scsi_data_direction: SCSI subsystem direction flag
...@@ -472,11 +596,25 @@ void scsi_set_device(struct Scsi_Host * shost, struct device * dev) ...@@ -472,11 +596,25 @@ void scsi_set_device(struct Scsi_Host * shost, struct device * dev)
* PCI_DMA_BIDIRECTIONAL given SCSI_DATA_UNKNOWN * PCI_DMA_BIDIRECTIONAL given SCSI_DATA_UNKNOWN
* else returns PCI_DMA_NONE * else returns PCI_DMA_NONE
* *
* Notes: Defined in drivers/scsi/scsi.h . * Defined in: drivers/scsi/scsi.h .
**/ **/
int scsi_to_pci_dma_dir(unsigned char scsi_data_direction) int scsi_to_pci_dma_dir(unsigned char scsi_data_direction)
/**
* scsi_to_sbus_dma_dir - convert SCSI subsystem direction flag to SBUS
* @scsi_data_direction: SCSI subsystem direction flag
*
* Returns SBUS_DMA_TODEVICE given SCSI_DATA_WRITE,
* SBUS_DMA_FROMDEVICE given SCSI_DATA_READ
* SBUS_DMA_BIDIRECTIONAL given SCSI_DATA_UNKNOWN
* else returns SBUS_DMA_NONE
*
* Defined in: drivers/scsi/scsi.h .
**/
int scsi_to_sbus_dma_dir(unsigned char scsi_data_direction)
/** /**
* scsi_track_queue_full - track successive QUEUE_FULL events on given * scsi_track_queue_full - track successive QUEUE_FULL events on given
* device to determine if and when there is a need * device to determine if and when there is a need
...@@ -492,7 +630,8 @@ int scsi_to_pci_dma_dir(unsigned char scsi_data_direction) ...@@ -492,7 +630,8 @@ int scsi_to_pci_dma_dir(unsigned char scsi_data_direction)
* *
* Notes: LLDs may call this at any time and we will do "The Right * Notes: LLDs may call this at any time and we will do "The Right
* Thing"; interrupt context safe. * Thing"; interrupt context safe.
* Defined in drivers/scsi/scsi.c . *
* Defined in: drivers/scsi/scsi.c .
**/ **/
int scsi_track_queue_full(Scsi_Device *SDptr, int depth) int scsi_track_queue_full(Scsi_Device *SDptr, int depth)
...@@ -504,22 +643,22 @@ int scsi_track_queue_full(Scsi_Device *SDptr, int depth) ...@@ -504,22 +643,22 @@ int scsi_track_queue_full(Scsi_Device *SDptr, int depth)
* *
* Returns nothing * Returns nothing
* *
* Notes: Defined in drivers/scsi/scsi_lib.c . * Defined in: drivers/scsi/scsi_lib.c .
**/ **/
void scsi_unblock_requests(struct Scsi_Host * SHpnt) void scsi_unblock_requests(struct Scsi_Host * SHpnt)
/** /**
* scsi_unregister - unregister and free host * scsi_unregister - unregister and free memory used by host instance
* @shp: pointer to scsi host instance to unregister. * @shp: pointer to scsi host instance to unregister.
* N.B. shp points to freed memory on return
* *
* Returns nothing * Returns nothing
* *
* Notes: Should only be invoked if the "hotplug initialization * Notes: Should only be invoked if the "hotplug initialization
* model" is being used. It should be called _after_ * model" is being used. It should be called _after_
* scsi_remove_host(). * scsi_remove_host(). The shp pointer is invalid after this call.
* Defined in drivers/scsi/hosts.c . *
* Defined in: drivers/scsi/hosts.c .
**/ **/
void scsi_unregister(struct Scsi_Host * shp) void scsi_unregister(struct Scsi_Host * shp)
...@@ -532,11 +671,13 @@ void scsi_unregister(struct Scsi_Host * shp) ...@@ -532,11 +671,13 @@ void scsi_unregister(struct Scsi_Host * shp)
* *
* Notes: Should only be invoked if the "passive initialization * Notes: Should only be invoked if the "passive initialization
* model" is being used. Notice this is a _driver_ rather than * model" is being used. Notice this is a _driver_ rather than
* HBA deregistration function. Most older drivers call this * HBA deregistration function. So if there are multiple HBAs
* function by including the scsi_module.c file. * associated with the given template, they are each removed. Most
* This function is deprecated, use the "hotplug initialization * older drivers call this function by including the scsi_module.c
* file. This function is deprecated, use the "hotplug initialization
* model" instead. * model" instead.
* Defined in drivers/scsi/hosts.c . *
* Defined in: drivers/scsi/hosts.c .
**/ **/
int scsi_unregister_host(Scsi_Host_Template *shost_tp) int scsi_unregister_host(Scsi_Host_Template *shost_tp)
...@@ -567,6 +708,25 @@ be implemented. ...@@ -567,6 +708,25 @@ be implemented.
The interface functions are listed below in alphabetical order. The interface functions are listed below in alphabetical order.
Summary:
bios_param - fetch head, sector, cylinder info for a disk
command - send scsi command to device, wait for reply
detect - detects HBAs this driver wants to control
eh_abort_handler - abort given command
eh_bus_reset_handler - issue SCSI bus reset
eh_device_reset_handler - issue SCSI device reset
eh_host_reset_handler - reset host (host bus adapter)
eh_strategy_handler - driver supplied alternate to scsi_unjam_host()
info - supply information about given host
ioctl - driver can respond to ioctls
proc_info - supports /proc/scsi/{driver_name}/{host_no}
queuecommand - queue scsi command, invoke 'done' on completion
release - release all resources associated with given host
slave_alloc - prior to any commands being sent to a new device
slave_configure - driver fine tuning for given device after attach
slave_destroy - given device is about to be shut down
Details:
/** /**
* bios_param - fetch head, sector, cylinder info for a disk * bios_param - fetch head, sector, cylinder info for a disk
...@@ -588,6 +748,8 @@ The interface functions are listed below in alphabetical order. ...@@ -588,6 +748,8 @@ The interface functions are listed below in alphabetical order.
* if this function is not provided. The params array is * if this function is not provided. The params array is
* pre-initialized with made up values just in case this function * pre-initialized with made up values just in case this function
* doesn't output anything. * doesn't output anything.
*
* Defined in: LLD
**/ **/
int bios_param(struct scsi_device * sdev, struct block_device *bdev, int bios_param(struct scsi_device * sdev, struct block_device *bdev,
sector_t capacity, int params[3]); sector_t capacity, int params[3]);
...@@ -609,6 +771,8 @@ The interface functions are listed below in alphabetical order. ...@@ -609,6 +771,8 @@ The interface functions are listed below in alphabetical order.
* *
* Notes: Drivers tend to be dropping support for this function and * Notes: Drivers tend to be dropping support for this function and
* supporting queuecommand() instead. * supporting queuecommand() instead.
*
* Defined in: LLD
**/ **/
int command(struct scsi_cmnd * scp); int command(struct scsi_cmnd * scp);
...@@ -629,6 +793,8 @@ The interface functions are listed below in alphabetical order. ...@@ -629,6 +793,8 @@ The interface functions are listed below in alphabetical order.
* driver. Upper level drivers (e.g. sd) may not (yet) be present. * driver. Upper level drivers (e.g. sd) may not (yet) be present.
* For each host found, this method should call scsi_register() * For each host found, this method should call scsi_register()
* [see hosts.c]. * [see hosts.c].
*
* Defined in: LLD
**/ **/
int detect(struct SHT * shtp); int detect(struct SHT * shtp);
...@@ -646,42 +812,48 @@ The interface functions are listed below in alphabetical order. ...@@ -646,42 +812,48 @@ The interface functions are listed below in alphabetical order.
* *
* Notes: Invoked from scsi_eh thread. No other commands will be * Notes: Invoked from scsi_eh thread. No other commands will be
* queued on current host during eh. * queued on current host during eh.
*
* Defined in: LLD
**/ **/
int eh_abort_handler(struct scsi_cmnd * scp); int eh_abort_handler(struct scsi_cmnd * scp);
/** /**
* eh_device_reset_handler - issue SCSI device reset * eh_bus_reset_handler - issue SCSI bus reset
* @scp: identifies SCSI device to be reset * @scp: SCSI bus that contains this device should be reset
* *
* Returns SUCCESS if command aborted else FAILED * Returns SUCCESS if command aborted else FAILED
* *
* Required: no * Required: no
* *
* Locks: struct Scsi_Host::host_lock held (with irqsave) on entry * Locks: struct Scsi_Host::host_lock held (with irqsave) on entry
* and assumed to be held on return. * and assumed to be held on return.
* *
* Notes: Invoked from scsi_eh thread. No other commands will be * Notes: Invoked from scsi_eh thread. No other commands will be
* queued on current host during eh. * queued on current host during eh.
*
* Defined in: LLD
**/ **/
int eh_device_reset_handler(struct scsi_cmnd * scp); int eh_bus_reset_handler(struct scsi_cmnd * scp);
/** /**
* eh_bus_reset_handler - issue SCSI bus reset * eh_device_reset_handler - issue SCSI device reset
* @scp: SCSI bus that contains this device should be reset * @scp: identifies SCSI device to be reset
* *
* Returns SUCCESS if command aborted else FAILED * Returns SUCCESS if command aborted else FAILED
* *
* Required: no * Required: no
* *
* Locks: struct Scsi_Host::host_lock held (with irqsave) on entry * Locks: struct Scsi_Host::host_lock held (with irqsave) on entry
* and assumed to be held on return. * and assumed to be held on return.
* *
* Notes: Invoked from scsi_eh thread. No other commands will be * Notes: Invoked from scsi_eh thread. No other commands will be
* queued on current host during eh. * queued on current host during eh.
*
* Defined in: LLD
**/ **/
int eh_bus_reset_handler(struct scsi_cmnd * scp); int eh_device_reset_handler(struct scsi_cmnd * scp);
/** /**
...@@ -701,6 +873,8 @@ The interface functions are listed below in alphabetical order. ...@@ -701,6 +873,8 @@ The interface functions are listed below in alphabetical order.
* _device_reset_, _bus_reset_ or this eh handler function are * _device_reset_, _bus_reset_ or this eh handler function are
* defined (or they all return FAILED) then the device in question * defined (or they all return FAILED) then the device in question
* will be set offline whenever eh is invoked. * will be set offline whenever eh is invoked.
*
* Defined in: LLD
**/ **/
int eh_host_reset_handler(struct scsi_cmnd * scp); int eh_host_reset_handler(struct scsi_cmnd * scp);
...@@ -717,6 +891,8 @@ The interface functions are listed below in alphabetical order. ...@@ -717,6 +891,8 @@ The interface functions are listed below in alphabetical order.
* *
* Notes: Invoked from scsi_eh thread. Driver supplied alternate to * Notes: Invoked from scsi_eh thread. Driver supplied alternate to
* scsi_unjam_host() found in scsi_error.c * scsi_unjam_host() found in scsi_error.c
*
* Defined in: LLD
**/ **/
int eh_strategy_handler(struct Scsi_Host * shp); int eh_strategy_handler(struct Scsi_Host * shp);
...@@ -745,6 +921,8 @@ The interface functions are listed below in alphabetical order. ...@@ -745,6 +921,8 @@ The interface functions are listed below in alphabetical order.
* each host's "info" (or name) for the driver it is registering. * each host's "info" (or name) for the driver it is registering.
* Also if proc_info() is not supplied, the output of this function * Also if proc_info() is not supplied, the output of this function
* is used instead. * is used instead.
*
* Defined in: LLD
**/ **/
const char * info(struct Scsi_Host * shp); const char * info(struct Scsi_Host * shp);
...@@ -776,6 +954,8 @@ The interface functions are listed below in alphabetical order. ...@@ -776,6 +954,8 @@ The interface functions are listed below in alphabetical order.
* numbers when this function is not supplied by the driver. * numbers when this function is not supplied by the driver.
* Unfortunately some applications expect -EINVAL and react badly * Unfortunately some applications expect -EINVAL and react badly
* when -ENOTTY is returned; stick with -EINVAL. * when -ENOTTY is returned; stick with -EINVAL.
*
* Defined in: LLD
**/ **/
int ioctl(struct scsi_device *sdp, int cmd, void *arg); int ioctl(struct scsi_device *sdp, int cmd, void *arg);
...@@ -803,6 +983,8 @@ The interface functions are listed below in alphabetical order. ...@@ -803,6 +983,8 @@ The interface functions are listed below in alphabetical order.
* Locks: none held * Locks: none held
* *
* Notes: Driven from scsi_proc.c which interfaces to proc_fs * Notes: Driven from scsi_proc.c which interfaces to proc_fs
*
* Defined in: LLD
**/ **/
int proc_info(char * buffer, char ** start, off_t offset, int proc_info(char * buffer, char ** start, off_t offset,
int length, int hostno, int writeto1_read0); int length, int hostno, int writeto1_read0);
...@@ -840,6 +1022,8 @@ int proc_info(char * buffer, char ** start, off_t offset, ...@@ -840,6 +1022,8 @@ int proc_info(char * buffer, char ** start, off_t offset,
* 'done' callback is invoked, then the LLD driver should * 'done' callback is invoked, then the LLD driver should
* perform autosense and fill in the struct scsi_cmnd::sense_buffer * perform autosense and fill in the struct scsi_cmnd::sense_buffer
* array. * array.
*
* Defined in: LLD
**/ **/
int queuecommand(struct scsi_cmnd * scp, int queuecommand(struct scsi_cmnd * scp,
void (*done)(struct scsi_cmnd *)); void (*done)(struct scsi_cmnd *));
...@@ -849,16 +1033,20 @@ int proc_info(char * buffer, char ** start, off_t offset, ...@@ -849,16 +1033,20 @@ int proc_info(char * buffer, char ** start, off_t offset,
* release - release all resources associated with given host * release - release all resources associated with given host
* @shp: host to be released. * @shp: host to be released.
* *
* Return value ignored. * Return value ignored (could soon be a function returning void).
* *
* Required: no * Required: yes (see notes)
* *
* Locks: lock_kernel() active on entry and expected to be active * Locks: none held
* on return.
* *
* Notes: Invoked from mid level's scsi_unregister_host(). * Notes: Invoked from mid level's scsi_unregister_host().
* This function should call scsi_unregister(shp) [found in hosts.c] * LLD's implementation of this function should call
* prior to returning. * scsi_unregister(shp) prior to returning.
* If not supplied mid-level [in hosts.c] supplies its own
* implementation (see scsi_host_legacy_release()) which is for old
* ISA adapters so it is best not to use it.
*
* Defined in: LLD
**/ **/
int release(struct Scsi_Host * shp); int release(struct Scsi_Host * shp);
...@@ -882,12 +1070,14 @@ int proc_info(char * buffer, char ** start, off_t offset, ...@@ -882,12 +1070,14 @@ int proc_info(char * buffer, char ** start, off_t offset,
* slave_configure() will be called while if a device is not found * slave_configure() will be called while if a device is not found
* slave_destroy() is called. * slave_destroy() is called.
* For more details see the hosts.h file. * For more details see the hosts.h file.
*
* Defined in: LLD
**/ **/
int slave_alloc(struct scsi_device *sdp); int slave_alloc(struct scsi_device *sdp);
/** /**
* slave_configure - driver fine tuning for give device just after it * slave_configure - driver fine tuning for given device just after it
* has been first scanned (i.e. it responded to an * has been first scanned (i.e. it responded to an
* INQUIRY) * INQUIRY)
* @sdp: device that has just been attached * @sdp: device that has just been attached
...@@ -908,6 +1098,8 @@ int proc_info(char * buffer, char ** start, off_t offset, ...@@ -908,6 +1098,8 @@ int proc_info(char * buffer, char ** start, off_t offset,
* value on behalf of the given device. If this function is * value on behalf of the given device. If this function is
* supplied then its implementation must call * supplied then its implementation must call
* scsi_adjust_queue_depth(). * scsi_adjust_queue_depth().
*
* Defined in: LLD
**/ **/
int slave_configure(struct scsi_device *sdp); int slave_configure(struct scsi_device *sdp);
...@@ -930,6 +1122,8 @@ int proc_info(char * buffer, char ** start, off_t offset, ...@@ -930,6 +1122,8 @@ int proc_info(char * buffer, char ** start, off_t offset,
* could be re-attached in the future in which case a new instance * could be re-attached in the future in which case a new instance
* of struct scsi_device would be supplied by future slave_alloc() * of struct scsi_device would be supplied by future slave_alloc()
* and slave_configure() calls.] * and slave_configure() calls.]
*
* Defined in: LLD
**/ **/
void slave_destroy(struct scsi_device *sdp); void slave_destroy(struct scsi_device *sdp);
...@@ -943,14 +1137,20 @@ There is one "struct SHT" instance per LLD ***. It is ...@@ -943,14 +1137,20 @@ There is one "struct SHT" instance per LLD ***. It is
typically initialized as a file scope static in a driver's header file. That typically initialized as a file scope static in a driver's header file. That
way members that are not explicitly initialized will be set to 0 or NULL. way members that are not explicitly initialized will be set to 0 or NULL.
Member of interest: Member of interest:
name - name of driver (should only use characters that are name - name of driver (may contain spaces, please limit to
permitted in a unix file name) less than 80 characters)
proc_name - name used in "/proc/scsi/<proc_name>/<host_no>" proc_name - name used in "/proc/scsi/<proc_name>/<host_no>" and
by sysfs in one of its "drivers" directories. Hence
"proc_name" should only contain characters acceptable
to a Unix file name.
(*release)() - should be defined by all LLDs as the default (legacy)
implementation is only appropriate for ISA adapters).
The structure is defined and commented in hosts.h The structure is defined and commented in hosts.h
*** In extreme situations a single driver may have several instances *** In extreme situations a single driver may have several instances
if it controls several different classes of hardware (e.g. the if it controls several different classes of hardware (e.g. the
advansys driver handles both ISA and PCI cards). advansys driver handles both ISA and PCI cards and has a separate
instance of struct SHT for each).
struct Scsi_Host struct Scsi_Host
---------------- ----------------
...@@ -982,24 +1182,29 @@ the driver's struct SHT instance. Members of interest: ...@@ -982,24 +1182,29 @@ the driver's struct SHT instance. Members of interest:
0->use bounce buffers if data is in high memory 0->use bounce buffers if data is in high memory
hostt - pointer to driver's struct SHT from which this hostt - pointer to driver's struct SHT from which this
struct Scsi_Host instance was spawned struct Scsi_Host instance was spawned
host_queue - deceptively named pointer to the start of a double linked sh_list - a double linked list of pointers to all struct Scsi_Host
list of struct scsi_device instances that belong to this instances (currently ordered by ascending host_no)
host. my_devices - a double linked list of pointers to struct scsi_device
instances that belong to this host.
hostdata[0] - area reserved for LLD at end of struct Scsi_Host. Size
is set by the second argument (named 'xtr_bytes') to
scsi_register().
The structure is defined in hosts.h The structure is defined in hosts.h
struct scsi_device struct scsi_device
------------------ ------------------
Generally, there is one instance of this structure for each SCSI logical unit Generally, there is one instance of this structure for each SCSI logical unit
on a host. Scsi devices are uniquely identified within a host by bus number, on a host. Scsi devices are uniquely identified within a host by bus number,
target id and logical unit number (lun). cahnnel number, target id and logical unit number (lun).
The structure is defined in scsi.h The structure is defined in scsi.h
struct scsi_cmnd struct scsi_cmnd
---------------- ----------------
Instances of this structure convey SCSI commands to the LLD. Instances of this structure convey SCSI commands to the LLD and responses
Each SCSI device has a pool of struct scsi_cmnd instances whose size back to the mid level. The SCSI mid level will ensure that no more SCSI
is determined by scsi_adjust_queue_depth() (or struct Scsi_Host::cmd_per_lun). commands become queued against the LLD than are indicated by
There will be at least one instance of struct scsi_cmnd for each SCSI device. scsi_adjust_queue_depth() (or struct Scsi_Host::cmd_per_lun). There will
be at least one instance of struct scsi_cmnd available for each SCSI device.
The structure is defined in scsi.h The structure is defined in scsi.h
...@@ -1033,9 +1238,9 @@ detects a CHECK CONDITION status by either: ...@@ -1033,9 +1238,9 @@ detects a CHECK CONDITION status by either:
Either way, the mid level decides whether the LLD has Either way, the mid level decides whether the LLD has
performed autosense by checking struct scsi_cmnd::sense_buffer[0] . If this performed autosense by checking struct scsi_cmnd::sense_buffer[0] . If this
byte has an upper nibble of 7 then autosense is assumed to have taken byte has an upper nibble of 7 (or 0xf) then autosense is assumed to have
place. If it has another value (and this byte is initialized to 0 before taken place. If it has another value (and this byte is initialized to 0
each command) then the mid level will issue a REQUEST SENSE command. before each command) then the mid level will issue a REQUEST SENSE command.
In the presence of queued commands the "nexus" that maintains sense In the presence of queued commands the "nexus" that maintains sense
buffer data from the command that failed until a following REQUEST SENSE buffer data from the command that failed until a following REQUEST SENSE
...@@ -1076,4 +1281,4 @@ The following people have contributed to this document: ...@@ -1076,4 +1281,4 @@ The following people have contributed to this document:
Douglas Gilbert Douglas Gilbert
dgilbert@interlog.com dgilbert@interlog.com
21st February 2003 19th April 2003
...@@ -226,10 +226,10 @@ static struct notifier_block tw_notifier = { ...@@ -226,10 +226,10 @@ static struct notifier_block tw_notifier = {
/* File operations struct for character device */ /* File operations struct for character device */
static struct file_operations tw_fops = { static struct file_operations tw_fops = {
owner: THIS_MODULE, .owner = THIS_MODULE,
ioctl: tw_chrdev_ioctl, .ioctl = tw_chrdev_ioctl,
open: tw_chrdev_open, .open = tw_chrdev_open,
release: tw_chrdev_release .release = tw_chrdev_release
}; };
/* Globals */ /* Globals */
......
...@@ -133,6 +133,7 @@ ...@@ -133,6 +133,7 @@
#include <linux/blk.h> #include <linux/blk.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/interrupt.h>
#include "scsi.h" #include "scsi.h"
#include "hosts.h" #include "hosts.h"
...@@ -1432,7 +1433,7 @@ NCR_700_start_command(Scsi_Cmnd *SCp) ...@@ -1432,7 +1433,7 @@ NCR_700_start_command(Scsi_Cmnd *SCp)
return 1; return 1;
} }
void irqreturn_t
NCR_700_intr(int irq, void *dev_id, struct pt_regs *regs) NCR_700_intr(int irq, void *dev_id, struct pt_regs *regs)
{ {
struct Scsi_Host *host = (struct Scsi_Host *)dev_id; struct Scsi_Host *host = (struct Scsi_Host *)dev_id;
...@@ -1442,6 +1443,7 @@ NCR_700_intr(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1442,6 +1443,7 @@ NCR_700_intr(int irq, void *dev_id, struct pt_regs *regs)
__u32 resume_offset = 0; __u32 resume_offset = 0;
__u8 pun = 0xff, lun = 0xff; __u8 pun = 0xff, lun = 0xff;
unsigned long flags; unsigned long flags;
irqreturn_t retval = IRQ_NONE;
/* Use the host lock to serialise acess to the 53c700 /* Use the host lock to serialise acess to the 53c700
* hardware. Note: In future, we may need to take the queue * hardware. Note: In future, we may need to take the queue
...@@ -1457,6 +1459,8 @@ NCR_700_intr(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1457,6 +1459,8 @@ NCR_700_intr(int irq, void *dev_id, struct pt_regs *regs)
Scsi_Cmnd *SCp = hostdata->cmd; Scsi_Cmnd *SCp = hostdata->cmd;
enum NCR_700_Host_State state; enum NCR_700_Host_State state;
retval = IRQ_HANDLED;
state = hostdata->state; state = hostdata->state;
SCp = hostdata->cmd; SCp = hostdata->cmd;
...@@ -1697,6 +1701,7 @@ NCR_700_intr(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1697,6 +1701,7 @@ NCR_700_intr(int irq, void *dev_id, struct pt_regs *regs)
} }
out_unlock: out_unlock:
spin_unlock_irqrestore(host->host_lock, flags); spin_unlock_irqrestore(host->host_lock, flags);
return retval;
} }
/* FIXME: Need to put some proc information in and plumb it /* FIXME: Need to put some proc information in and plumb it
......
...@@ -52,7 +52,7 @@ struct NCR_700_Host_Parameters; ...@@ -52,7 +52,7 @@ struct NCR_700_Host_Parameters;
/* These are the externally used routines */ /* These are the externally used routines */
struct Scsi_Host *NCR_700_detect(Scsi_Host_Template *, struct NCR_700_Host_Parameters *); struct Scsi_Host *NCR_700_detect(Scsi_Host_Template *, struct NCR_700_Host_Parameters *);
int NCR_700_release(struct Scsi_Host *host); int NCR_700_release(struct Scsi_Host *host);
void NCR_700_intr(int, void *, struct pt_regs *); irqreturn_t NCR_700_intr(int, void *, struct pt_regs *);
enum NCR_700_Host_State { enum NCR_700_Host_State {
......
...@@ -1379,8 +1379,6 @@ static int aha152x_release(struct Scsi_Host *shpnt) ...@@ -1379,8 +1379,6 @@ static int aha152x_release(struct Scsi_Host *shpnt)
*/ */
static int setup_expected_interrupts(struct Scsi_Host *shpnt) static int setup_expected_interrupts(struct Scsi_Host *shpnt)
{ {
ASSERT_LOCK(&QLOCK,1);
if(CURRENT_SC) { if(CURRENT_SC) {
CURRENT_SC->SCp.phase |= 1 << 16; CURRENT_SC->SCp.phase |= 1 << 16;
......
...@@ -30,26 +30,26 @@ ...@@ -30,26 +30,26 @@
* to do with card config are filled in after the card is detected. * to do with card config are filled in after the card is detected.
*/ */
#define AIC7XXX { \ #define AIC7XXX { \
proc_info: aic7xxx_proc_info, \ .proc_info = aic7xxx_proc_info, \
detect: aic7xxx_detect, \ .detect = aic7xxx_detect, \
release: aic7xxx_release, \ .release = aic7xxx_release, \
info: aic7xxx_info, \ .info = aic7xxx_info, \
queuecommand: aic7xxx_queue, \ .queuecommand = aic7xxx_queue, \
slave_alloc: aic7xxx_slave_alloc, \ .slave_alloc = aic7xxx_slave_alloc, \
slave_configure: aic7xxx_slave_configure, \ .slave_configure = aic7xxx_slave_configure, \
slave_destroy: aic7xxx_slave_destroy, \ .slave_destroy = aic7xxx_slave_destroy, \
bios_param: aic7xxx_biosparam, \ .bios_param = aic7xxx_biosparam, \
eh_abort_handler: aic7xxx_abort, \ .eh_abort_handler = aic7xxx_abort, \
eh_device_reset_handler: aic7xxx_bus_device_reset, \ .eh_device_reset_handler = aic7xxx_bus_device_reset, \
eh_host_reset_handler: aic7xxx_reset, \ .eh_host_reset_handler = aic7xxx_reset, \
can_queue: 255, /* max simultaneous cmds */\ .can_queue = 255, /* max simultaneous cmds */\
this_id: -1, /* scsi id of host adapter */\ .this_id = -1, /* scsi id of host adapter */\
sg_tablesize: 0, /* max scatter-gather cmds */\ .sg_tablesize = 0, /* max scatter-gather cmds */\
max_sectors: 2048, /* max physical sectors in 1 cmd */\ .max_sectors = 2048, /* max physical sectors in 1 cmd */\
cmd_per_lun: 3, /* cmds per lun (linked cmds) */\ .cmd_per_lun = 3, /* cmds per lun (linked cmds) */\
present: 0, /* number of 7xxx's present */\ .present = 0, /* number of 7xxx's present */\
unchecked_isa_dma: 0, /* no memory DMA restrictions */\ .unchecked_isa_dma = 0, /* no memory DMA restrictions */\
use_clustering: ENABLE_CLUSTERING, \ .use_clustering = ENABLE_CLUSTERING, \
} }
extern int aic7xxx_queue(Scsi_Cmnd *, void (*)(Scsi_Cmnd *)); extern int aic7xxx_queue(Scsi_Cmnd *, void (*)(Scsi_Cmnd *));
......
...@@ -747,9 +747,9 @@ MODULE_LICENSE("GPL"); ...@@ -747,9 +747,9 @@ MODULE_LICENSE("GPL");
#ifdef GDTH_IOCTL_CHRDEV #ifdef GDTH_IOCTL_CHRDEV
/* ioctl interface */ /* ioctl interface */
static struct file_operations gdth_fops = { static struct file_operations gdth_fops = {
ioctl:gdth_ioctl, .ioctl = gdth_ioctl,
open:gdth_open, .open = gdth_open,
release:gdth_close, .release = gdth_close,
}; };
#endif #endif
......
This source diff could not be displayed because it is too large. You can view the blob instead.
#ifndef __MEGARAID_H__ #ifndef __MEGARAID_H__
#define __MEGARAID_H__ #define __MEGARAID_H__
#ifndef LINUX_VERSION_CODE
#include <linux/version.h> #include <linux/version.h>
#endif #include <linux/spinlock.h>
#define MEGARAID_VERSION \
"v2.00.3 (Release Date: Wed Feb 19 08:51:30 EST 2003)\n"
/* /*
* For state flag. Do not use LSB(8 bits) which are * Driver features - change the values to enable or disable features in the
* reserved for storing info about channels. * driver.
*/ */
#define IN_ISR 0x80000000L
#define IN_ABORT 0x40000000L
#define IN_RESET 0x20000000L
#define IN_QUEUE 0x10000000L
#define BOARD_QUARTZ 0x08000000L
#define BOARD_40LD 0x04000000L
#define BOARD_64BIT 0x02000000L
#define SCB_FREE 0x0
#define SCB_ACTIVE 0x1
#define SCB_WAITQ 0x2
#define SCB_ISSUED 0x3
#define SCB_COMPLETE 0x4
#define SCB_ABORTED 0x5
#define SCB_RESET 0x6
#define M_RD_CRLFSTR "\n"
#define M_RD_IOCTL_CMD 0x80
#define M_RD_IOCTL_CMD_NEW 0x81
#define M_RD_DRIVER_IOCTL_INTERFACE 0x82
#define MEGARAID_VERSION "v1.18 (Release Date: Thu Oct 11 15:02:53 EDT 2001)\n"
#define MEGARAID_IOCTL_VERSION 114
/* Methods */
#define GET_DRIVER_INFO 0x1
#define MEGA_CMD_TIMEOUT 10
/* Feel free to fiddle with these.. max values are:
SGLIST 0..26
COMMANDS 0..253
CMDPERLUN 0..63
*/
#define MAX_SGLIST 0x1A
#define MAX_COMMANDS 127
#define MAX_CMD_PER_LUN 63
#define MAX_FIRMWARE_STATUS 46
#define MAX_LOGICAL_DRIVES 8
#define MAX_CHANNEL 5
#define MAX_TARGET 15
#define MAX_PHYSICAL_DRIVES MAX_CHANNEL*MAX_TARGET
#define INQUIRY_DATA_SIZE 0x24
#define MAX_CDB_LEN 0x0A
#define MAX_REQ_SENSE_LEN 0x20
#define INTR_VALID 0x40
/* Direction Macros for MBOX Data direction */
#define TO_DEVICE 0x0
#define FROM_DEVICE 0x1
#define FROMTO_DEVICE 0x2
/* Mailbox commands */
#define MEGA_MBOXCMD_LREAD 0x01
#define MEGA_MBOXCMD_LWRITE 0x02
#define MEGA_MBOXCMD_LREAD64 0xA7
#define MEGA_MBOXCMD_LWRITE64 0xA8
#define MEGA_MBOXCMD_PASSTHRU 0x03
#define MEGA_MBOXCMD_EXTPASSTHRU 0xE3
#define MEGA_MBOXCMD_ADAPTERINQ 0x05
/* Offsets into Mailbox */
#define COMMAND_PORT 0x00
#define COMMAND_ID_PORT 0x01
#define SG_LIST_PORT0 0x08
#define SG_LIST_PORT1 0x09
#define SG_LIST_PORT2 0x0a
#define SG_LIST_PORT3 0x0b
#define SG_ELEMENT_PORT 0x0d
#define NO_FIRED_PORT 0x0f
/* I/O Port offsets */ /*
#define I_CMD_PORT 0x00 * Comand coalescing - This feature allows the driver to be able to combine
#define I_ACK_PORT 0x00 * two or more commands and issue as one command in order to boost I/O
#define I_TOGGLE_PORT 0x01 * performance. Useful if the nature of the I/O is sequential. It is not very
#define INTR_PORT 0x0a * useful for random natured I/Os.
*/
#define MEGA_HAVE_COALESCING 0
#define MAILBOX_SIZE (sizeof(mega_mailbox)-16) /*
#define MBOX_BUSY_PORT 0x00 * Clustering support - Set this flag if you are planning to use the
#define MBOX_PORT0 0x04 * clustering services provided by the megaraid controllers and planning to
#define MBOX_PORT1 0x05 * setup a cluster
#define MBOX_PORT2 0x06 */
#define MBOX_PORT3 0x07 #define MEGA_HAVE_CLUSTERING 1
#define ENABLE_MBOX_REGION 0x0B
/* I/O Port Values */ /*
#define ISSUE_BYTE 0x10 * Driver statistics - Set this flag if you are interested in statics about
#define ACK_BYTE 0x08 * number of I/O completed on each logical drive and how many interrupts
#define ENABLE_INTR_BYTE 0xc0 * generated. If enabled, this information is available through /proc
#define DISABLE_INTR_BYTE 0x00 * interface and through the private ioctl. Setting this flag has a
#define VALID_INTR_BYTE 0x40 * performance penalty.
#define MBOX_BUSY_BYTE 0x10 */
#define ENABLE_MBOX_BYTE 0x00 #define MEGA_HAVE_STATS 0
/* Setup some port macros here */ /*
#define WRITE_MAILBOX(base,offset,value) *(base+offset)=value * Enhanced /proc interface - This feature will allow you to have a more
#define READ_MAILBOX(base,offset) *(base+offset) * detailed /proc interface for megaraid driver. E.g., a real time update of
* the status of the logical drives, battery status, physical drives etc.
*/
#define MEGA_HAVE_ENH_PROC 1
#define WRITE_PORT(base,offset,value) outb_p(value,base+offset) #define MAX_DEV_TYPE 32
#define READ_PORT(base,offset) inb_p(base+offset)
#define ISSUE_COMMAND(base) WRITE_PORT(base,I_CMD_PORT,ISSUE_BYTE) #ifndef PCI_VENDOR_ID_LSI_LOGIC
#define CLEAR_INTR(base) WRITE_PORT(base,I_ACK_PORT,ACK_BYTE) #define PCI_VENDOR_ID_LSI_LOGIC 0x1000
#define ENABLE_INTR(base) WRITE_PORT(base,I_TOGGLE_PORT,ENABLE_INTR_BYTE) #endif
#define DISABLE_INTR(base) WRITE_PORT(base,I_TOGGLE_PORT,DISABLE_INTR_BYTE)
/* Define AMI's PCI codes */
#ifndef PCI_VENDOR_ID_AMI #ifndef PCI_VENDOR_ID_AMI
#define PCI_VENDOR_ID_AMI 0x101E #define PCI_VENDOR_ID_AMI 0x101E
#endif #endif
#ifndef PCI_VENDOR_ID_DELL
#define PCI_VENDOR_ID_DELL 0x1028
#endif
#ifndef PCI_VENDOR_ID_INTEL
#define PCI_VENDOR_ID_INTEL 0x8086
#endif
#ifndef PCI_DEVICE_ID_AMI_MEGARAID #ifndef PCI_DEVICE_ID_AMI_MEGARAID
#define PCI_DEVICE_ID_AMI_MEGARAID 0x9010 #define PCI_DEVICE_ID_AMI_MEGARAID 0x9010
#endif #endif
...@@ -138,418 +74,110 @@ ...@@ -138,418 +74,110 @@
#define PCI_DEVICE_ID_AMI_MEGARAID3 0x1960 #define PCI_DEVICE_ID_AMI_MEGARAID3 0x1960
#endif #endif
/* Special Adapter Commands */ #define PCI_DEVICE_ID_DISCOVERY 0x000E
#define FW_FIRE_WRITE 0x2C #define PCI_DEVICE_ID_PERC4_DI 0x000F
#define FW_FIRE_FLASH 0x2D #define PCI_DEVICE_ID_PERC4_QC_VERDE 0x0407
#define FC_NEW_CONFIG 0xA1 /* Sub-System Vendor IDs */
#define DCMD_FC_CMD 0xA1 #define AMI_SUBSYS_VID 0x101E
#define DCMD_FC_PROCEED 0x02 #define DELL_SUBSYS_VID 0x1028
#define DCMD_DELETE_LOGDRV 0x03 #define HP_SUBSYS_VID 0x103C
#define DCMD_FC_READ_NVRAM_CONFIG 0x04 #define LSI_SUBSYS_VID 0x1000
#define DCMD_FC_READ_NVRAM_CONFIG_64 0xC0
#define DCMD_FC_READ_FINAL_CONFIG 0x05 #define HBA_SIGNATURE 0x3344
#define DCMD_GET_DISK_CONFIG 0x06 #define HBA_SIGNATURE_471 0xCCCC
#define DCMD_GET_DISK_CONFIG_64 0xC2 #define HBA_SIGNATURE_64BIT 0x0299
#define DCMD_CHANGE_LDNO 0x07
#define DCMD_COMPACT_CONFIG 0x08 #define MBOX_BUSY_WAIT 10 /* wait for up to 10 usec for
#define DCMD_DELETE_DRIVEGROUP 0x09 mailbox to be free */
#define DCMD_GET_LOOPID_INFO 0x0A #define DEFAULT_INITIATOR_ID 7
#define DCMD_CHANGE_LOOPID 0x0B
#define DCMD_GET_NUM_SCSI_CHANS 0x0C #define MAX_SGLIST 64 /* max supported in f/w */
#define DCMD_WRITE_CONFIG 0x0D #define MIN_SGLIST 26 /* guaranteed to support these many */
#define DCMD_WRITE_CONFIG_64 0xC1 #define MAX_COMMANDS 126
#define CMDID_INT_CMDS MAX_COMMANDS+1 /* make sure CMDID_INT_CMDS
#define NC_SUBOP_PRODUCT_INFO 0x0E is less than max commands
#define NC_SUBOP_ENQUIRY3 0x0F supported by any f/w */
#define ENQ3_GET_SOLICITED_NOTIFY_ONLY 0x01
#define ENQ3_GET_SOLICITED_FULL 0x02 #define MAX_CDB_LEN 10
#define ENQ3_GET_UNSOLICITED 0x03 #define MAX_EXT_CDB_LEN 16 /* we support cdb length up to 16 */
#define PCI_CONF_BASE_ADDR_OFFSET 0x10 #define DEF_CMD_PER_LUN 63
#define PCI_CONF_IRQ_OFFSET 0x3c #define MAX_CMD_PER_LUN MAX_COMMANDS
#define PCI_CONF_AMISIG 0xa0 #define MAX_FIRMWARE_STATUS 46
#define PCI_CONF_AMISIG64 0xa4 #define MAX_XFER_PER_CMD (64*1024)
#define MAX_SECTORS_PER_IO 128
/* Sub-System Vendor ID sorted on alphabetical order*/
#define AMI_SUBSYS_ID 0x101E #define MAX_LOGICAL_DRIVES_40LD 40
#define DELL_SUBSYS_ID 0x1028 #define FC_MAX_PHYSICAL_DEVICES 256
#define HP_SUBSYS_ID 0x103C #define MAX_LOGICAL_DRIVES_8LD 8
#define MAX_CHANNELS 5
#define AMI_SIGNATURE 0x3344 #define MAX_TARGET 15
#define AMI_SIGNATURE_471 0xCCCC #define MAX_PHYSICAL_DRIVES MAX_CHANNELS*MAX_TARGET
#define AMI_64BIT_SIGNATURE 0x0299 #define MAX_ROW_SIZE_40LD 32
#define MAX_ROW_SIZE_8LD 8
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0) /*0x20100 */ #define MAX_SPAN_DEPTH 8
#define MEGARAID \
{ NULL, /* Next */\ #define NVIRT_CHAN 4 /* # of virtual channels to represent
NULL, /* Usage Count Pointer */\ up to 60 logical drives */
NULL, /* proc Directory Entry */\
megaraid_proc_info, /* proc Info Function */\ #define MEGARAID \
"MegaRAID", /* Driver Name */\ { \
megaraid_detect, /* Detect Host Adapter */\ .name = "MegaRAID", \
megaraid_release, /* Release Host Adapter */\ .proc_info = megaraid_proc_info, \
megaraid_info, /* Driver Info Function */\ .detect = megaraid_detect, \
megaraid_command, /* Command Function */\ .release = megaraid_release, \
megaraid_queue, /* Queue Command Function */\ .info = megaraid_info, \
megaraid_abort, /* Abort Command Function */\ .command = megaraid_command, \
megaraid_reset, /* Reset Command Function */\ .queuecommand = megaraid_queue, \
NULL, /* Slave Attach Function */\ .bios_param = megaraid_biosparam, \
megaraid_biosparam, /* Disk BIOS Parameters */\ .max_sectors = MAX_SECTORS_PER_IO, \
MAX_COMMANDS, /* # of cmds that can be\ .can_queue = MAX_COMMANDS, \
outstanding at any time */\ .this_id = DEFAULT_INITIATOR_ID, \
7, /* HBA Target ID */\ .sg_tablesize = MAX_SGLIST, \
MAX_SGLIST, /* Scatter/Gather Table Size */\ .cmd_per_lun = DEF_CMD_PER_LUN, \
MAX_CMD_PER_LUN, /* SCSI Commands per LUN */\ .present = 0, \
0, /* Present */\ .unchecked_isa_dma = 0, \
0, /* Default Unchecked ISA DMA */\ .use_clustering = ENABLE_CLUSTERING, \
ENABLE_CLUSTERING } /* Enable Clustering */ .eh_abort_handler = megaraid_abort, \
#else .eh_device_reset_handler = megaraid_reset, \
#define MEGARAID \ .eh_bus_reset_handler = megaraid_reset, \
{\ .eh_host_reset_handler = megaraid_reset, \
.name = "MegaRAID", /* Driver Name */\ .highmem_io = 1, \
.proc_info = megaraid_proc_info, /* /proc driver info */\ }
.detect = megaraid_detect, /* Detect Host Adapter */\
.release = megaraid_release, /* Release Host Adapter */\
.info = megaraid_info, /* Driver Info Function */\
.command = megaraid_command, /* Command Function */\
.queuecommand = megaraid_queue, /* Queue Command Function */\
.bios_param = megaraid_biosparam, /* Disk BIOS Parameters */\
.can_queue = MAX_COMMANDS, /* Can Queue */\
.this_id = 7, /* HBA Target ID */\
.sg_tablesize = MAX_SGLIST, /* Scatter/Gather Table Size */\
.cmd_per_lun = MAX_CMD_PER_LUN, /* SCSI Commands per LUN */\
.present = 0, /* Present */\
.unchecked_isa_dma = 0, /* Default Unchecked ISA DMA */\
.use_clustering = ENABLE_CLUSTERING, /* Enable Clustering */\
.highmem_io = 1, \
}
#endif
/***********************************************************************
* Structure Declarations for the Firmware supporting 40 Logical Drives
* and 256 Physical Drives.
***********************************************************************/
#define FC_MAX_LOGICAL_DRIVES 40
#define FC_MAX_LOG_DEVICES FC_MAX_LOGICAL_DRIVES
#define FC_MAX_SPAN_DEPTH 8
#define FC_MAX_ROW_SIZE 32
#define FC_MAX_CHANNELS 16
#define FC_MAX_TARGETS_PER_CHANNEL 16
#define FC_MAX_PHYSICAL_DEVICES 256
/********************************************
* PRODUCT_INFO
********************************************/
#define SIG_40LOG_32STR_8SPN 0x00282008
/*
* Utilities declare this strcture size as 1024 bytes. So more fields can
* be added in future.
*/
struct MRaidProductInfo {
u32 DataSize; /* current size in bytes (not including resvd) */
u32 ConfigSignature;
/* Current value is 0x00282008
* 0x28=MAX_LOGICAL_DRIVES,
* 0x20=Number of stripes and
* 0x08=Number of spans */
u8 FwVer[16]; /* printable ASCI string */
u8 BiosVer[16]; /* printable ASCI string */
u8 ProductName[80]; /* printable ASCI string */
u8 MaxConcCmds; /* Max. concurrent commands supported */
u8 SCSIChanPresent; /* Number of SCSI Channels detected */
u8 FCLoopPresent; /* Number of Fibre Loops detected */
u8 memType; /* EDO, FPM, SDRAM etc */
u32 signature;
u16 DramSize; /* In terms of MB */
u16 subSystemID;
u16 subSystemVendorID;
u8 numNotifyCounters;
u8 pad1k[889]; /* 135 + 889 resvd = 1024 total size */
} __attribute__ ((packed));
typedef struct MRaidProductInfo megaRaidProductInfo;
/********************************************
* Standard ENQUIRY
********************************************/
struct FC_ADP_INFO {
u8 MaxConcCmds; /* Max. concurrent commands supported. */
u8 RbldRate; /* Rebuild Rate. Varies from 0%-100% */
u8 MaxTargPerChan; /* Max. Targets supported per chan. */
u8 ChanPresent; /* No. of Chans present on this adapter. */
u8 FwVer[4]; /* Firmware version. */
u16 AgeOfFlash; /* No. of times FW has been downloaded. */
u8 ChipSetValue; /* Contents of 0xC0000832 */
u8 DramSize; /* In terms of MB */
u8 CacheFlushInterval; /* In terms of Seconds */
u8 BiosVersion[4];
u8 BoardType;
u8 sense_alert;
u8 write_config_count; /* Increase with evry configuration change */
u8 drive_inserted_count;/* Increase with every drive inserted */
u8 inserted_drive; /* Channel: Id of inserted drive */
u8 battery_status;
/*
BIT 0 : battery module missing
BIT 1 : VBAD
BIT 2 : temp high
BIT 3 : battery pack missing
BIT 4,5 : 00 - charge complete
01 - fast charge in prog
10 - fast charge fail
11 - undefined
BIt 6 : counter > 1000
Bit 7 : undefined
*/
u8 dec_fault_bus_info; /* was resvd */
} __attribute__ ((packed));
struct FC_LDRV_INFO {
u8 NumLDrv; /* No. of Log. Drvs configured. */
u8 recon_state[FC_MAX_LOGICAL_DRIVES / 8];
/* bit field for State of reconstruct */
u16 LDrvOpStatus[FC_MAX_LOGICAL_DRIVES / 8];
/* bit field Status of Long Operations. */
u32 LDrvSize[FC_MAX_LOGICAL_DRIVES]; /* Size of each log. Drv. */
u8 LDrvProp[FC_MAX_LOGICAL_DRIVES];
u8 LDrvState[FC_MAX_LOGICAL_DRIVES]; /* State of Logical Drives. */
} __attribute__ ((packed));
#define PREVSTAT_MASK 0xf0
#define CURRSTAT_MASK 0x0f
struct FC_PDRV_INFO {
u8 PDrvState[FC_MAX_PHYSICAL_DEVICES]; /* State of Phys Drvs. */
} __attribute__ ((packed));
struct FC_AdapterInq {
struct FC_ADP_INFO AdpInfo;
struct FC_LDRV_INFO LogdrvInfo;
struct FC_PDRV_INFO PhysdrvInfo;
} __attribute__ ((packed));
typedef struct FC_AdapterInq mega_RAIDINQ_FC;
/******************************************** typedef struct {
* NOTIFICATION /* 0x0 */ u8 cmd;
********************************************/ /* 0x1 */ u8 cmdid;
/* 0x2 */ u16 numsectors;
/* 0x4 */ u32 lba;
/* 0x8 */ u32 xferaddr;
/* 0xC */ u8 logdrv;
/* 0xD */ u8 numsgelements;
/* 0xE */ u8 resvd;
/* 0xF */ volatile u8 busy;
/* 0x10 */ volatile u8 numstatus;
/* 0x11 */ volatile u8 status;
/* 0x12 */ volatile u8 completed[MAX_FIRMWARE_STATUS];
volatile u8 poll;
volatile u8 ack;
} __attribute__ ((packed)) mbox_t;
#define MAX_NOTIFY_SIZE 0x80 typedef struct {
#define CUR_NOTIFY_SIZE sizeof(struct MegaRAID_Notify) u32 xfer_segment_lo;
u32 xfer_segment_hi;
mbox_t mbox;
} __attribute__ ((packed)) mbox64_t;
/*
* Utilities declare this strcture size as ?? bytes. So more fields can
* be added in future.
*/
struct MegaRAID_Notify {
u32 globalCounter; /* Any change increments this counter */
u8 paramCounter; /* Indicates any params changed */
u8 paramId; /* Param modified - defined below */
u16 paramVal; /* New val of last param modified */
u8 writeConfigCounter; /* write config occurred */
u8 writeConfigRsvd[3];
u8 ldrvOpCounter; /* Indicates ldrv op started/completed */
u8 ldrvOpId; /* ldrv num */
u8 ldrvOpCmd; /* ldrv operation - defined below */
u8 ldrvOpStatus; /* status of the operation */
u8 ldrvStateCounter; /* Indicates change of ldrv state */
u8 ldrvStateId; /* ldrv num */
u8 ldrvStateNew; /* New state */
u8 ldrvStateOld; /* old state */
u8 pdrvStateCounter; /* Indicates change of ldrv state */
u8 pdrvStateId; /* pdrv id */
u8 pdrvStateNew; /* New state */
u8 pdrvStateOld; /* old state */
u8 pdrvFmtCounter; /* Indicates pdrv format started/over */
u8 pdrvFmtId; /* pdrv id */
u8 pdrvFmtVal; /* format started/over */
u8 pdrvFmtRsvd;
u8 targXferCounter; /* Indicates SCSI-2 Xfer rate change */
u8 targXferId; /* pdrv Id */
u8 targXferVal; /* new Xfer params of last pdrv */
u8 targXferRsvd;
u8 fcLoopIdChgCounter; /* Indicates loopid changed */
u8 fcLoopIdPdrvId; /* pdrv id */
u8 fcLoopId0; /* loopid on fc loop 0 */
u8 fcLoopId1; /* loopid on fc loop 1 */
u8 fcLoopStateCounter; /* Indicates loop state changed */
u8 fcLoopState0; /* state of fc loop 0 */
u8 fcLoopState1; /* state of fc loop 1 */
u8 fcLoopStateRsvd;
} __attribute__ ((packed));
/********************************************
* PARAM IDs in Notify struct
********************************************/
#define PARAM_RBLD_RATE 0x01
/*--------------------------------------
* Param val =
* byte 0: new rbld rate
*--------------------------------------*/
#define PARAM_CACHE_FLUSH_INTERVAL 0x02
/*--------------------------------------
* Param val =
* byte 0: new cache flush interval
*--------------------------------------*/
#define PARAM_SENSE_ALERT 0x03
/*--------------------------------------
* Param val =
* byte 0: last pdrv id causing chkcond
*--------------------------------------*/
#define PARAM_DRIVE_INSERTED 0x04
/*--------------------------------------
* Param val =
* byte 0: last pdrv id inserted
*--------------------------------------*/
#define PARAM_BATTERY_STATUS 0x05
/*--------------------------------------
* Param val =
* byte 0: battery status
*--------------------------------------*/
/********************************************
* Ldrv operation cmd in Notify struct
********************************************/
#define LDRV_CMD_CHKCONSISTANCY 0x01
#define LDRV_CMD_INITIALIZE 0x02
#define LDRV_CMD_RECONSTRUCTION 0x03
/********************************************
* Ldrv operation status in Notify struct
********************************************/
#define LDRV_OP_SUCCESS 0x00
#define LDRV_OP_FAILED 0x01
#define LDRV_OP_ABORTED 0x02
#define LDRV_OP_CORRECTED 0x03
#define LDRV_OP_STARTED 0x04
/********************************************
* Raid Logical drive states.
********************************************/
#define RDRV_OFFLINE 0
#define RDRV_DEGRADED 1
#define RDRV_OPTIMAL 2
#define RDRV_DELETED 3
/*******************************************
* Physical drive states.
*******************************************/
#define PDRV_UNCNF 0
#define PDRV_ONLINE 3
#define PDRV_FAILED 4
#define PDRV_RBLD 5
/*******************************************
* Formal val in Notify struct
*******************************************/
#define PDRV_FMT_START 0x01
#define PDRV_FMT_OVER 0x02
/********************************************
* FC Loop State in Notify Struct
********************************************/
#define ENQ_FCLOOP_FAILED 0
#define ENQ_FCLOOP_ACTIVE 1
#define ENQ_FCLOOP_TRANSIENT 2
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
#define M_RD_DMA_TYPE_NONE 0xFFFF
#define M_RD_PTHRU_WITH_BULK_DATA 0x0001
#define M_RD_PTHRU_WITH_SGLIST 0x0002
#define M_RD_BULK_DATA_ONLY 0x0004
#define M_RD_SGLIST_ONLY 0x0008
#define M_RD_EPTHRU_WITH_BULK_DATA 0x0010
#endif
/********************************************
* ENQUIRY3
********************************************/
/* /*
* Utilities declare this strcture size as 1024 bytes. So more fields can * Passthru definitions
* be added in future.
*/ */
struct MegaRAID_Enquiry3 { #define MAX_REQ_SENSE_LEN 0x20
u32 dataSize; /* current size in bytes (not including resvd) */
struct MegaRAID_Notify notify;
u8 notifyRsvd[MAX_NOTIFY_SIZE - CUR_NOTIFY_SIZE];
u8 rbldRate; /* Rebuild rate (0% - 100%) */
u8 cacheFlushInterval; /* In terms of Seconds */
u8 senseAlert;
u8 driveInsertedCount; /* drive insertion count */
u8 batteryStatus;
u8 numLDrv; /* No. of Log Drives configured */
u8 reconState[FC_MAX_LOGICAL_DRIVES / 8]; /* State of reconstruct */
u16 lDrvOpStatus[FC_MAX_LOGICAL_DRIVES / 8]; /* log. Drv Status */
u32 lDrvSize[FC_MAX_LOGICAL_DRIVES]; /* Size of each log. Drv */
u8 lDrvProp[FC_MAX_LOGICAL_DRIVES];
u8 lDrvState[FC_MAX_LOGICAL_DRIVES]; /* State of Logical Drives */
u8 pDrvState[FC_MAX_PHYSICAL_DEVICES]; /* State of Phys. Drvs. */
u16 physDrvFormat[FC_MAX_PHYSICAL_DEVICES / 16];
u8 targXfer[80]; /* phys device transfer rate */
u8 pad1k[263]; /* 761 + 263reserved = 1024 bytes total size */
} __attribute__ ((packed));
typedef struct MegaRAID_Enquiry3 mega_Enquiry3;
/* Structures */ typedef struct {
typedef struct _mega_ADP_INFO {
u8 MaxConcCmds;
u8 RbldRate;
u8 MaxTargPerChan;
u8 ChanPresent;
u8 FwVer[4];
u16 AgeOfFlash;
u8 ChipSetValue;
u8 DramSize;
u8 CacheFlushInterval;
u8 BiosVer[4];
u8 resvd[7];
} mega_ADP_INFO;
typedef struct _mega_LDRV_INFO {
u8 NumLDrv;
u8 resvd[3];
u32 LDrvSize[MAX_LOGICAL_DRIVES];
u8 LDrvProp[MAX_LOGICAL_DRIVES];
u8 LDrvState[MAX_LOGICAL_DRIVES];
} mega_LDRV_INFO;
typedef struct _mega_PDRV_INFO {
u8 PDrvState[MAX_PHYSICAL_DRIVES];
u8 resvd;
} mega_PDRV_INFO;
/* RAID inquiry: Mailbox command 0x5*/
typedef struct _mega_RAIDINQ {
mega_ADP_INFO AdpInfo;
mega_LDRV_INFO LogdrvInfo;
mega_PDRV_INFO PhysdrvInfo;
} mega_RAIDINQ;
/* Passthrough command: Mailbox command 0x3*/
typedef struct mega_passthru {
u8 timeout:3; /* 0=6sec/1=60sec/2=10min/3=3hrs */ u8 timeout:3; /* 0=6sec/1=60sec/2=10min/3=3hrs */
u8 ars:1; u8 ars:1;
u8 reserved:3; u8 reserved:3;
...@@ -567,7 +195,8 @@ typedef struct mega_passthru { ...@@ -567,7 +195,8 @@ typedef struct mega_passthru {
u8 scsistatus; u8 scsistatus;
u32 dataxferaddr; u32 dataxferaddr;
u32 dataxferlen; u32 dataxferlen;
} mega_passthru; } __attribute__ ((packed)) mega_passthru;
/* /*
* Extended passthru: support CDB > 10 bytes * Extended passthru: support CDB > 10 bytes
...@@ -579,228 +208,318 @@ typedef struct { ...@@ -579,228 +208,318 @@ typedef struct {
u8 cd_rom:1; u8 cd_rom:1;
u8 rsvd2:1; u8 rsvd2:1;
u8 islogical:1; u8 islogical:1;
u8 logdrv; /* if islogical == 1 */ u8 logdrv; /* if islogical == 1 */
u8 channel; /* if islogical == 0 */ u8 channel; /* if islogical == 0 */
u8 target; /* if islogical == 0 */ u8 target; /* if islogical == 0 */
u8 queuetag; /* unused */ u8 queuetag; /* unused */
u8 queueaction; /* unused */ u8 queueaction; /* unused */
u8 cdblen; u8 cdblen;
u8 rsvd3; u8 rsvd3;
u8 cdb[16]; u8 cdb[MAX_EXT_CDB_LEN];
u8 numsgelements; u8 numsgelements;
u8 status; u8 status;
u8 reqsenselen; u8 reqsenselen;
u8 reqsensearea[MAX_REQ_SENSE_LEN]; u8 reqsensearea[MAX_REQ_SENSE_LEN];
u8 rsvd4; u8 rsvd4;
u32 dataxferaddr; u32 dataxferaddr;
u32 dataxferlen; u32 dataxferlen;
}mega_ext_passthru; } __attribute__ ((packed)) mega_ext_passthru;
struct _mega_mailbox {
/* 0x0 */ u8 cmd;
/* 0x1 */ u8 cmdid;
/* 0x2 */ u16 numsectors;
/* 0x4 */ u32 lba;
/* 0x8 */ u32 xferaddr;
/* 0xC */ u8 logdrv;
/* 0xD */ u8 numsgelements;
/* 0xE */ u8 resvd;
/* 0xF */ u8 busy;
/* 0x10 */ u8 numstatus;
/* 0x11 */ u8 status;
/* 0x12 */ u8 completed[46];
volatile u8 mraid_poll;
volatile u8 mraid_ack;
u8 pad[16]; /* for alignment purposes */
} __attribute__ ((packed));
typedef struct _mega_mailbox mega_mailbox;
typedef struct { typedef struct {
u32 xferSegment_lo;
u32 xferSegment_hi;
mega_mailbox mailbox;
} mega_mailbox64;
typedef struct _mega_ioctl_mbox {
/* 0x0 */ u8 cmd;
/* 0x1 */ u8 cmdid;
/* 0x2 */ u8 channel;
/* 0x3 */ u8 param;
/* 0x4 */ u8 pad[4];
/* 0x8 */ u32 xferaddr;
/* 0xC */ u8 logdrv;
/* 0xD */ u8 numsgelements;
/* 0xE */ u8 resvd;
/* 0xF */ u8 busy;
/* 0x10 */ u8 numstatus;
/* 0x11 */ u8 status;
/* 0x12 */ u8 completed[46];
u8 mraid_poll;
u8 mraid_ack;
u8 malign[16];
} mega_ioctl_mbox;
typedef struct _mega_64sglist32 {
u64 address; u64 address;
u32 length; u32 length;
} __attribute__ ((packed)) mega_64sglist; } __attribute__ ((packed)) mega_sgl64;
typedef struct _mega_sglist { typedef struct {
u32 address; u32 address;
u32 length; u32 length;
} mega_sglist; } __attribute__ ((packed)) mega_sglist;
/* Queued command data */ /* Queued command data */
typedef struct _mega_scb mega_scb; typedef struct {
int idx;
struct _mega_scb { u32 state;
int idx; struct list_head list;
u32 state; u8 raw_mbox[66];
u32 isrcount; u32 dma_type;
u8 mboxData[16]; u32 dma_direction;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
u32 dma_type; Scsi_Cmnd *cmd;
dma_addr_t dma_h_bulkdata; /*Dma handle for bulk data transfter */ dma_addr_t dma_h_bulkdata;
u32 dma_direction; /*Dma direction */ dma_addr_t dma_h_sgdata;
dma_addr_t dma_h_sgdata; /*Dma handle for the sglist structure */
dma_addr_t dma_h_sglist[MAX_SGLIST]; /*Dma handle for all SGL elements */ mega_sglist *sgl;
u8 sglist_count; mega_sgl64 *sgl64;
dma_addr_t dma_sghandle64; dma_addr_t sgl_dma_addr;
dma_addr_t dma_passthruhandle64;
dma_addr_t dma_ext_passthruhandle64; mega_passthru *pthru;
dma_addr_t dma_bounce_buffer; dma_addr_t pthru_dma_addr;
u8 *bounce_buffer; mega_ext_passthru *epthru;
#endif dma_addr_t epthru_dma_addr;
} scb_t;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) /*
mega_passthru *pthru; * Flags to follow the scb as it transitions between various stages
mega_ext_passthru *epthru; */
#else #define SCB_FREE 0x0000 /* on the free list */
mega_passthru pthru; #define SCB_ACTIVE 0x0001 /* off the free list */
mega_ext_passthru epthru; #define SCB_PENDQ 0x0002 /* on the pending queue */
#endif #define SCB_ISSUED 0x0004 /* issued - owner f/w */
#define SCB_ABORT 0x0008 /* Got an abort for this one */
#define SCB_RESET 0x0010 /* Got a reset for this one */
Scsi_Cmnd *SCpnt; /*
mega_sglist *sgList; * Utilities declare this strcture size as 1024 bytes. So more fields can
mega_64sglist *sg64List; * be added in future.
struct semaphore ioctl_sem; */
void *buff_ptr; typedef struct {
u32 iDataSize; u32 data_size; /* current size in bytes (not including resvd) */
mega_scb *next;
}; u32 config_signature;
/* Current value is 0x00282008
* 0x28=MAX_LOGICAL_DRIVES,
* 0x20=Number of stripes and
* 0x08=Number of spans */
u8 fw_version[16]; /* printable ASCI string */
u8 bios_version[16]; /* printable ASCI string */
u8 product_name[80]; /* printable ASCI string */
u8 max_commands; /* Max. concurrent commands supported */
u8 nchannels; /* Number of SCSI Channels detected */
u8 fc_loop_present; /* Number of Fibre Loops detected */
u8 mem_type; /* EDO, FPM, SDRAM etc */
u32 signature;
u16 dram_size; /* In terms of MB */
u16 subsysid;
u16 subsysvid;
u8 notify_counters;
u8 pad1k[889]; /* 135 + 889 resvd = 1024 total size */
} __attribute__ ((packed)) mega_product_info;
struct notify {
u32 global_counter; /* Any change increments this counter */
u8 param_counter; /* Indicates any params changed */
u8 param_id; /* Param modified - defined below */
u16 param_val; /* New val of last param modified */
u8 write_config_counter; /* write config occurred */
u8 write_config_rsvd[3];
u8 ldrv_op_counter; /* Indicates ldrv op started/completed */
u8 ldrv_opid; /* ldrv num */
u8 ldrv_opcmd; /* ldrv operation - defined below */
u8 ldrv_opstatus; /* status of the operation */
u8 ldrv_state_counter; /* Indicates change of ldrv state */
u8 ldrv_state_id; /* ldrv num */
u8 ldrv_state_new; /* New state */
u8 ldrv_state_old; /* old state */
u8 pdrv_state_counter; /* Indicates change of ldrv state */
u8 pdrv_state_id; /* pdrv id */
u8 pdrv_state_new; /* New state */
u8 pdrv_state_old; /* old state */
u8 pdrv_fmt_counter; /* Indicates pdrv format started/over */
u8 pdrv_fmt_id; /* pdrv id */
u8 pdrv_fmt_val; /* format started/over */
u8 pdrv_fmt_rsvd;
u8 targ_xfer_counter; /* Indicates SCSI-2 Xfer rate change */
u8 targ_xfer_id; /* pdrv Id */
u8 targ_xfer_val; /* new Xfer params of last pdrv */
u8 targ_xfer_rsvd;
u8 fcloop_id_chg_counter; /* Indicates loopid changed */
u8 fcloopid_pdrvid; /* pdrv id */
u8 fcloop_id0; /* loopid on fc loop 0 */
u8 fcloop_id1; /* loopid on fc loop 1 */
u8 fcloop_state_counter; /* Indicates loop state changed */
u8 fcloop_state0; /* state of fc loop 0 */
u8 fcloop_state1; /* state of fc loop 1 */
u8 fcloop_state_rsvd;
} __attribute__ ((packed));
/* internal locking by the queue manipulting routines */ #define MAX_NOTIFY_SIZE 0x80
#define INTERNAL_LOCK 0 #define CUR_NOTIFY_SIZE sizeof(struct notify)
/* external locking by the queue manipulting routines */
#define EXTERNAL_LOCK 1
#define NO_LOCK 2
#define INTR_ENB 0 /* do not disable interrupt while manipulating */
#define INTR_DIS 1 /* disable interrupt while manipulating */
/* Per-controller data */ typedef struct {
typedef struct _mega_host_config { u32 data_size; /* current size in bytes (not including resvd) */
u8 numldrv;
u32 flag;
#ifdef __LP64__ struct notify notify;
u64 base;
#else
u32 base;
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) u8 notify_rsvd[MAX_NOTIFY_SIZE - CUR_NOTIFY_SIZE];
dma_addr_t dma_handle64, adjdmahandle64;
struct pci_dev *dev;
#endif
mega_scb *qFreeH; u8 rebuild_rate; /* Rebuild rate (0% - 100%) */
mega_scb *qFreeT; u8 cache_flush_interval; /* In terms of Seconds */
spinlock_t lock_free; u8 sense_alert;
u8 drive_insert_count; /* drive insertion count */
mega_scb *qPendingH; u8 battery_status;
mega_scb *qPendingT; u8 num_ldrv; /* No. of Log Drives configured */
spinlock_t lock_pend; u8 recon_state[MAX_LOGICAL_DRIVES_40LD / 8]; /* State of
reconstruct */
u16 ldrv_op_status[MAX_LOGICAL_DRIVES_40LD / 8]; /* logdrv
Status */
Scsi_Cmnd *qCompletedH; u32 ldrv_size[MAX_LOGICAL_DRIVES_40LD];/* Size of each log drv */
Scsi_Cmnd *qCompletedT; u8 ldrv_prop[MAX_LOGICAL_DRIVES_40LD];
spinlock_t lock_scsicmd; u8 ldrv_state[MAX_LOGICAL_DRIVES_40LD];/* State of log drives */
u8 pdrv_state[FC_MAX_PHYSICAL_DEVICES];/* State of phys drvs. */
u16 pdrv_format[FC_MAX_PHYSICAL_DEVICES / 16];
u32 qFcnt; u8 targ_xfer[80]; /* phys device transfer rate */
u32 qPcnt; u8 pad1k[263]; /* 761 + 263reserved = 1024 bytes total size */
u32 qCcnt; } __attribute__ ((packed)) mega_inquiry3;
unsigned long nReads[FC_MAX_LOGICAL_DRIVES];
unsigned long nReadBlocks[FC_MAX_LOGICAL_DRIVES];
unsigned long nWrites[FC_MAX_LOGICAL_DRIVES];
unsigned long nWriteBlocks[FC_MAX_LOGICAL_DRIVES];
unsigned long nInterrupts;
/* Host adapter parameters */
u8 fwVer[7];
u8 biosVer[7];
struct Scsi_Host *host; /* Structures */
typedef struct {
u8 max_commands; /* Max concurrent commands supported */
u8 rebuild_rate; /* Rebuild rate - 0% thru 100% */
u8 max_targ_per_chan; /* Max targ per channel */
u8 nchannels; /* Number of channels on HBA */
u8 fw_version[4]; /* Firmware version */
u16 age_of_flash; /* Number of times FW has been flashed */
u8 chip_set_value; /* Contents of 0xC0000832 */
u8 dram_size; /* In MB */
u8 cache_flush_interval; /* in seconds */
u8 bios_version[4];
u8 board_type;
u8 sense_alert;
u8 write_config_count; /* Increase with every configuration
change */
u8 drive_inserted_count; /* Increase with every drive inserted
*/
u8 inserted_drive; /* Channel:Id of inserted drive */
u8 battery_status; /*
* BIT 0: battery module missing
* BIT 1: VBAD
* BIT 2: temprature high
* BIT 3: battery pack missing
* BIT 4,5:
* 00 - charge complete
* 01 - fast charge in progress
* 10 - fast charge fail
* 11 - undefined
* Bit 6: counter > 1000
* Bit 7: Undefined
*/
u8 dec_fault_bus_info;
} __attribute__ ((packed)) mega_adp_info;
volatile mega_mailbox64 *mbox64; /* ptr to beginning of 64-bit mailbox */
volatile mega_mailbox *mbox; /* ptr to beginning of standard mailbox */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) typedef struct {
/* ptr to beginning of standard mailbox */ u8 num_ldrv; /* Number of logical drives configured */
volatile mega_mailbox64 *mailbox64ptr; u8 rsvd[3];
#else u32 ldrv_size[MAX_LOGICAL_DRIVES_8LD];
volatile mega_mailbox64 mailbox64; u8 ldrv_prop[MAX_LOGICAL_DRIVES_8LD];
#endif u8 ldrv_state[MAX_LOGICAL_DRIVES_8LD];
} __attribute__ ((packed)) mega_ldrv_info;
volatile u8 mega_buffer[2 * 1024L]; typedef struct {
volatile megaRaidProductInfo productInfo; u8 pdrv_state[MAX_PHYSICAL_DRIVES];
u8 rsvd;
} __attribute__ ((packed)) mega_pdrv_info;
u8 max_cmds; /* RAID inquiry: Mailbox command 0x05*/
mega_scb scbList[MAX_COMMANDS]; typedef struct {
mega_adp_info adapter_info;
mega_ldrv_info logdrv_info;
mega_pdrv_info pdrv_info;
} __attribute__ ((packed)) mraid_inquiry;
#define PROCBUFSIZE 4096
char procbuf[PROCBUFSIZE];
int procidx;
struct proc_dir_entry *controller_proc_dir_entry;
struct proc_dir_entry *proc_read, *proc_stat, *proc_status, *proc_mbox;
int support_ext_cdb;
int boot_ldrv_enabled;
int boot_ldrv;
int support_random_del; /* Do we support random deletion of logdrvs */ /* RAID extended inquiry: Mailbox command 0x04*/
int read_ldidmap; /* set after logical drive deltion. The logical typedef struct {
drive number must be read from the map */ mraid_inquiry raid_inq;
int quiescent; /* a stage reached when delete logical drive needs to u16 phys_drv_format[MAX_CHANNELS];
be done. Stop sending requests to the hba till u8 stack_attn;
delete operation is completed */ u8 modem_status;
u8 rsvd[2];
} __attribute__ ((packed)) mraid_ext_inquiry;
typedef struct {
u8 channel;
u8 target;
}__attribute__ ((packed)) adp_device;
typedef struct {
u32 start_blk; /* starting block */
u32 num_blks; /* # of blocks */
adp_device device[MAX_ROW_SIZE_40LD];
}__attribute__ ((packed)) adp_span_40ld;
typedef struct {
u32 start_blk; /* starting block */
u32 num_blks; /* # of blocks */
adp_device device[MAX_ROW_SIZE_8LD];
}__attribute__ ((packed)) adp_span_8ld;
typedef struct {
u8 span_depth; /* Total # of spans */
u8 level; /* RAID level */
u8 read_ahead; /* read ahead, no read ahead, adaptive read
ahead */
u8 stripe_sz; /* Encoded stripe size */
u8 status; /* Status of the logical drive */
u8 write_mode; /* write mode, write_through/write_back */
u8 direct_io; /* direct io or through cache */
u8 row_size; /* Number of stripes in a row */
} __attribute__ ((packed)) logdrv_param;
mega_scb *int_qh; /* commands are queued in the internal queue */ typedef struct {
mega_scb *int_qt; /* while the hba is quiescent */ logdrv_param lparam;
int int_qlen; adp_span_40ld span[MAX_SPAN_DEPTH];
} mega_host_config; }__attribute__ ((packed)) logdrv_40ld;
typedef struct {
logdrv_param lparam;
adp_span_8ld span[MAX_SPAN_DEPTH];
}__attribute__ ((packed)) logdrv_8ld;
typedef struct {
u8 type; /* Type of the device */
u8 cur_status; /* current status of the device */
u8 tag_depth; /* Level of tagging */
u8 sync_neg; /* sync negotiation - ENABLE or DISBALE */
u32 size; /* configurable size in terms of 512 byte
blocks */
}__attribute__ ((packed)) phys_drv;
typedef struct {
u8 nlog_drives; /* number of logical drives */
u8 resvd[3];
logdrv_40ld ldrv[MAX_LOGICAL_DRIVES_40LD];
phys_drv pdrv[MAX_PHYSICAL_DRIVES];
}__attribute__ ((packed)) disk_array_40ld;
typedef struct {
u8 nlog_drives; /* number of logical drives */
u8 resvd[3];
logdrv_8ld ldrv[MAX_LOGICAL_DRIVES_8LD];
phys_drv pdrv[MAX_PHYSICAL_DRIVES];
}__attribute__ ((packed)) disk_array_8ld;
typedef struct _driver_info {
int size;
ulong version;
} mega_driver_info;
/* /*
* User ioctl structure. * User ioctl structure.
* This structure will be used for Traditional Method ioctl interface * This structure will be used for Traditional Method ioctl interface
* commands (M_RD_IOCTL_CMD),Alternate Buffer Method (M_RD_IOCTL_CMD_NEW) * commands (0x80),Alternate Buffer Method (0x81) ioctl commands and the
* ioctl commands and the Driver ioctls(M_RD_DRIVER_IOCTL_INTERFACE). * Driver ioctls.
* The Driver ioctl interface handles the commands at * The Driver ioctl interface handles the commands at the driver level,
* the driver level, without being sent to the card. * without being sent to the card.
*/ */
#define MEGADEVIOC 0x84
/* system call imposed limit. Change accordingly */ /* system call imposed limit. Change accordingly */
#define IOCTL_MAX_DATALEN 4096 #define IOCTL_MAX_DATALEN 4096
#pragma pack(1)
struct uioctl_t { struct uioctl_t {
u32 inlen; u32 inlen;
u32 outlen; u32 outlen;
...@@ -818,8 +537,8 @@ struct uioctl_t { ...@@ -818,8 +537,8 @@ struct uioctl_t {
u8 *buffer; u8 *buffer;
#endif #endif
u32 length; u32 length;
} fcs; } __attribute__ ((packed)) fcs;
} ui; } __attribute__ ((packed)) ui;
u8 mbox[18]; /* 16 bytes + 2 status bytes */ u8 mbox[18]; /* 16 bytes + 2 status bytes */
mega_passthru pthru; mega_passthru pthru;
#if BITS_PER_LONG == 32 #if BITS_PER_LONG == 32
...@@ -829,8 +548,7 @@ struct uioctl_t { ...@@ -829,8 +548,7 @@ struct uioctl_t {
#if BITS_PER_LONG == 64 #if BITS_PER_LONG == 64
char *data; char *data;
#endif #endif
}; } __attribute__ ((packed));
#pragma pack()
/* /*
* struct mcontroller is used to pass information about the controllers in the * struct mcontroller is used to pass information about the controllers in the
...@@ -854,25 +572,26 @@ struct mcontroller { ...@@ -854,25 +572,26 @@ struct mcontroller {
u32 uid; u32 uid;
}; };
struct mbox_passthru { /*
u8 cmd; * mailbox structure used for internal commands
u8 cmdid; */
u16 pad1; typedef struct {
u32 pad2; u8 cmd;
u32 dataxferaddr; u8 cmdid;
u8 pad3; u8 opcode;
u8 pad4; u8 subopcode;
u8 rsvd; u32 lba;
u8 mboxbusy; u32 xferaddr;
u8 nstatus; u8 logdrv;
u8 status; u8 rsvd[3];
}; u8 numstatus;
u8 status;
} __attribute__ ((packed)) megacmd_t;
/* /*
* Defines for Driver IOCTL interface, Op-code:M_RD_DRIVER_IOCTL_INTERFACE * Defines for Driver IOCTL interface
*/ */
#define MEGAIOC_MAGIC 'm' #define MEGAIOC_MAGIC 'm'
#define MEGAIOCCMD _IOWR(MEGAIOC_MAGIC, 0) /* Mega IOCTL command */
#define MEGAIOC_QNADAP 'm' /* Query # of adapters */ #define MEGAIOC_QNADAP 'm' /* Query # of adapters */
#define MEGAIOC_QDRVRVER 'e' /* Query driver version */ #define MEGAIOC_QDRVRVER 'e' /* Query driver version */
...@@ -880,126 +599,508 @@ struct mbox_passthru { ...@@ -880,126 +599,508 @@ struct mbox_passthru {
#define MKADAP(adapno) (MEGAIOC_MAGIC << 8 | (adapno) ) #define MKADAP(adapno) (MEGAIOC_MAGIC << 8 | (adapno) )
#define GETADAP(mkadap) ( (mkadap) ^ MEGAIOC_MAGIC << 8 ) #define GETADAP(mkadap) ( (mkadap) ^ MEGAIOC_MAGIC << 8 )
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) /*0x20300 */ /*
extern struct proc_dir_entry proc_scsi_megaraid; * Definition for the new ioctl interface (NIT)
#endif */
/* For Host Re-Ordering */ /*
#define MAX_CONTROLLERS 32 * Vendor specific Group-7 commands
*/
#define VENDOR_SPECIFIC_COMMANDS 0xE0
#define MEGA_INTERNAL_CMD VENDOR_SPECIFIC_COMMANDS + 0x01
struct mega_hbas { /*
int is_bios_enabled; * The ioctl command. No other command shall be used for this interface
mega_host_config *hostdata_addr; */
}; #define USCSICMD VENDOR_SPECIFIC_COMMANDS
/*
* Data direction flags
*/
#define UIOC_RD 0x00001
#define UIOC_WR 0x00002
#define IS_BIOS_ENABLED 0x62 /*
#define GET_BIOS 0x01 * ioctl opcodes
#define CHNL_CLASS 0xA9 */
#define GET_CHNL_CLASS 0x00 #define MBOX_CMD 0x00000 /* DCMD or passthru command */
#define SET_CHNL_CLASS 0x01 #define GET_DRIVER_VER 0x10000 /* Get driver version */
#define CH_RAID 0x01 #define GET_N_ADAP 0x20000 /* Get number of adapters */
#define CH_SCSI 0x00 #define GET_ADAP_INFO 0x30000 /* Get information about a adapter */
#define GET_CAP 0x40000 /* Get ioctl capabilities */
#define GET_STATS 0x50000 /* Get statistics, including error info */
#define BIOS_PVT_DATA 0x40 /*
#define GET_BIOS_PVT_DATA 0x00 * The ioctl structure.
* MBOX macro converts a nitioctl_t structure to megacmd_t pointer and
* MBOX_P macro converts a nitioctl_t pointer to megacmd_t pointer.
*/
typedef struct {
char signature[8]; /* Must contain "MEGANIT" */
u32 opcode; /* opcode for the command */
u32 adapno; /* adapter number */
union {
u8 __raw_mbox[18];
caddr_t __uaddr; /* xferaddr for non-mbox cmds */
}__ua;
#define uioc_rmbox __ua.__raw_mbox
#define MBOX(uioc) ((megacmd_t *)&((uioc).__ua.__raw_mbox[0]))
#define MBOX_P(uioc) ((megacmd_t *)&((uioc)->__ua.__raw_mbox[0]))
#define uioc_uaddr __ua.__uaddr
u32 xferlen; /* xferlen for DCMD and non-mbox
commands */
u32 flags; /* data direction flags */
}nitioctl_t;
/*
* I/O statistics for some applications like SNMP agent. The caller must
* provide the number of logical drives for which status should be reported.
*/
typedef struct {
int num_ldrv; /* Number for logical drives for which the
status should be reported. */
u32 nreads[MAX_LOGICAL_DRIVES_40LD]; /* number of reads for
each logical drive */
u32 nreadblocks[MAX_LOGICAL_DRIVES_40LD]; /* number of blocks
read for each logical
drive */
u32 nwrites[MAX_LOGICAL_DRIVES_40LD]; /* number of writes
for each logical
drive */
u32 nwriteblocks[MAX_LOGICAL_DRIVES_40LD]; /* number of blocks
writes for each
logical drive */
u32 rd_errors[MAX_LOGICAL_DRIVES_40LD]; /* number of read
errors for each
logical drive */
u32 wr_errors[MAX_LOGICAL_DRIVES_40LD]; /* number of write
errors for each
logical drive */
}megastat_t;
#pragma pack(1)
struct private_bios_data { struct private_bios_data {
u8 geometry:4; /* u8 geometry:4; /*
* bits 0-3 - BIOS geometry * bits 0-3 - BIOS geometry
* 0x0001 - 1GB * 0x0001 - 1GB
* 0x0010 - 2GB * 0x0010 - 2GB
* 0x1000 - 8GB * 0x1000 - 8GB
* Others values are invalid * Others values are invalid
*/ */
u8 unused:4; /* bits 4-7 are unused */ u8 unused:4; /* bits 4-7 are unused */
u8 boot_ldrv; /* u8 boot_drv; /*
* logical drive set as boot drive * logical drive set as boot drive
* 0..7 - for 8LD cards * 0..7 - for 8LD cards
* 0..39 - for 40LD cards * 0..39 - for 40LD cards
*/ */
u8 rsvd[12]; u8 rsvd[12];
u16 cksum; /* 0-(sum of first 13 bytes of this structure) */ u16 cksum; /* 0-(sum of first 13 bytes of this structure) */
}; } __attribute__ ((packed));
#pragma pack()
/*
* Mailbox and firmware commands and subopcodes used in this driver.
*/
#define NVIRT_CHAN 4 /* # of virtual channels to represent 60 logical #define MEGA_MBOXCMD_LREAD 0x01
drives */ #define MEGA_MBOXCMD_LWRITE 0x02
#define MEGA_MBOXCMD_PASSTHRU 0x03
#define MEGA_MBOXCMD_ADPEXTINQ 0x04
#define MEGA_MBOXCMD_ADAPTERINQ 0x05
#define MEGA_MBOXCMD_LREAD64 0xA7
#define MEGA_MBOXCMD_LWRITE64 0xA8
#define MEGA_MBOXCMD_PASSTHRU64 0xC3
#define MEGA_MBOXCMD_EXTPTHRU 0xE3
#define MAIN_MISC_OPCODE 0xA4 /* f/w misc opcode */
#define GET_MAX_SG_SUPPORT 0x01 /* get max sg len supported by f/w */
#define FC_NEW_CONFIG 0xA1
#define NC_SUBOP_PRODUCT_INFO 0x0E
#define NC_SUBOP_ENQUIRY3 0x0F
#define ENQ3_GET_SOLICITED_FULL 0x02
#define OP_DCMD_READ_CONFIG 0x04
#define NEW_READ_CONFIG_8LD 0x67
#define READ_CONFIG_8LD 0x07
#define FLUSH_ADAPTER 0x0A
#define FLUSH_SYSTEM 0xFE
/* /*
* Command for random deletion of logical drives * Command for random deletion of logical drives
*/ */
#define FC_DEL_LOGDRV 0xA4 /* f/w command */ #define FC_DEL_LOGDRV 0xA4 /* f/w command */
#define OP_SUP_DEL_LOGDRV 0x2A /* is feature supported */ #define OP_SUP_DEL_LOGDRV 0x2A /* is feature supported */
#define OP_GET_LDID_MAP 0x18 /* get logdrv id and logdrv number map */ #define OP_GET_LDID_MAP 0x18 /* get ldid and logdrv number map */
#define OP_DEL_LOGDRV 0x1C /* delete logical drive */ #define OP_DEL_LOGDRV 0x1C /* delete logical drive */
/*================================================================ /*
* * BIOS commands
* Function prototypes */
* #define IS_BIOS_ENABLED 0x62
*================================================================ #define GET_BIOS 0x01
#define CHNL_CLASS 0xA9
#define GET_CHNL_CLASS 0x00
#define SET_CHNL_CLASS 0x01
#define CH_RAID 0x01
#define CH_SCSI 0x00
#define BIOS_PVT_DATA 0x40
#define GET_BIOS_PVT_DATA 0x00
/*
* Commands to support clustering
*/
#define MEGA_GET_TARGET_ID 0x7D
#define MEGA_CLUSTER_OP 0x70
#define MEGA_GET_CLUSTER_MODE 0x02
#define MEGA_CLUSTER_CMD 0x6E
#define MEGA_RESERVE_LD 0x01
#define MEGA_RELEASE_LD 0x02
#define MEGA_RESET_RESERVATIONS 0x03
#define MEGA_RESERVATION_STATUS 0x04
#define MEGA_RESERVE_PD 0x05
#define MEGA_RELEASE_PD 0x06
/*
* Module battery status
*/
#define MEGA_BATT_MODULE_MISSING 0x01
#define MEGA_BATT_LOW_VOLTAGE 0x02
#define MEGA_BATT_TEMP_HIGH 0x04
#define MEGA_BATT_PACK_MISSING 0x08
#define MEGA_BATT_CHARGE_MASK 0x30
#define MEGA_BATT_CHARGE_DONE 0x00
#define MEGA_BATT_CHARGE_INPROG 0x10
#define MEGA_BATT_CHARGE_FAIL 0x20
#define MEGA_BATT_CYCLES_EXCEEDED 0x40
/*
* Physical drive states.
*/
#define PDRV_UNCNF 0
#define PDRV_ONLINE 3
#define PDRV_FAILED 4
#define PDRV_RBLD 5
#define PDRV_HOTSPARE 6
/*
* Raid logical drive states.
*/
#define RDRV_OFFLINE 0
#define RDRV_DEGRADED 1
#define RDRV_OPTIMAL 2
#define RDRV_DELETED 3
/*
* Read, write and cache policies
*/
#define NO_READ_AHEAD 0
#define READ_AHEAD 1
#define ADAP_READ_AHEAD 2
#define WRMODE_WRITE_THRU 0
#define WRMODE_WRITE_BACK 1
#define CACHED_IO 0
#define DIRECT_IO 1
#define SCSI_LIST(scp) ((struct list_head *)(&(scp)->SCp))
/*
* Each controller's soft state
*/
typedef struct {
int this_id; /* our id, may set to different than 7 if
clustering is available */
u32 flag;
unsigned long base;
/* mbox64 with mbox not aligned on 16-byte boundry */
mbox64_t *una_mbox64;
dma_addr_t una_mbox64_dma;
volatile mbox64_t *mbox64;/* ptr to 64-bit mailbox */
volatile mbox_t *mbox; /* ptr to standard mailbox */
dma_addr_t mbox_dma;
struct pci_dev *dev;
struct list_head free_list;
struct list_head pending_list;
struct list_head completed_list;
struct Scsi_Host *host;
#define MEGA_BUFFER_SIZE (2*1024)
u8 *mega_buffer;
dma_addr_t buf_dma_handle;
mega_product_info product_info;
u8 max_cmds;
scb_t *scb_list;
atomic_t pend_cmds; /* maintain a counter for pending
commands in firmware */
#if MEGA_HAVE_STATS
u32 nreads[MAX_LOGICAL_DRIVES_40LD];
u32 nreadblocks[MAX_LOGICAL_DRIVES_40LD];
u32 nwrites[MAX_LOGICAL_DRIVES_40LD];
u32 nwriteblocks[MAX_LOGICAL_DRIVES_40LD];
u32 rd_errors[MAX_LOGICAL_DRIVES_40LD];
u32 wr_errors[MAX_LOGICAL_DRIVES_40LD];
#endif
/* Host adapter parameters */
u8 numldrv;
u8 fw_version[7];
u8 bios_version[7];
#ifdef CONFIG_PROC_FS
struct proc_dir_entry *controller_proc_dir_entry;
struct proc_dir_entry *proc_read;
struct proc_dir_entry *proc_stat;
struct proc_dir_entry *proc_mbox;
#if MEGA_HAVE_ENH_PROC
struct proc_dir_entry *proc_rr;
struct proc_dir_entry *proc_battery;
#define MAX_PROC_CHANNELS 4
struct proc_dir_entry *proc_pdrvstat[MAX_PROC_CHANNELS];
struct proc_dir_entry *proc_rdrvstat[MAX_PROC_CHANNELS];
#endif
#endif
int has_64bit_addr; /* are we using 64-bit addressing */
int support_ext_cdb;
int boot_ldrv_enabled;
int boot_ldrv;
int boot_pdrv_enabled; /* boot from physical drive */
int boot_pdrv_ch; /* boot physical drive channel */
int boot_pdrv_tgt; /* boot physical drive target */
int support_random_del; /* Do we support random deletion of
logdrvs */
int read_ldidmap; /* set after logical drive deltion. The
logical drive number must be read from the
map */
atomic_t quiescent; /* a stage reached when delete logical
drive needs to be done. Stop
sending requests to the hba till
delete operation is completed */
spinlock_t lock;
u8 logdrv_chan[MAX_CHANNELS+NVIRT_CHAN]; /* logical drive are on
what channels. */
int mega_ch_class;
u8 sglen; /* f/w supported scatter-gather list length */
scb_t int_scb;
Scsi_Cmnd int_scmd;
struct semaphore int_mtx; /* To synchronize the internal
commands */
wait_queue_head_t int_waitq; /* wait queue for internal
cmds */
int has_cluster; /* cluster support on this HBA */
}adapter_t;
struct mega_hbas {
int is_bios_enabled;
adapter_t *hostdata_addr;
};
/*
* For state flag. Do not use LSB(8 bits) which are
* reserved for storing info about channels.
*/
#define IN_ABORT 0x80000000L
#define IN_RESET 0x40000000L
#define BOARD_MEMMAP 0x20000000L
#define BOARD_IOMAP 0x10000000L
#define BOARD_40LD 0x08000000L
#define BOARD_64BIT 0x04000000L
#define INTR_VALID 0x40
#define PCI_CONF_AMISIG 0xa0
#define PCI_CONF_AMISIG64 0xa4
#define MEGA_DMA_TYPE_NONE 0xFFFF
#define MEGA_BULK_DATA 0x0001
#define MEGA_SGLIST 0x0002
/*
* lockscope definitions, callers can specify the lock scope with this data
* type. LOCK_INT would mean the caller has not acquired the lock before
* making the call and LOCK_EXT would mean otherwise.
*/ */
typedef enum { LOCK_INT, LOCK_EXT } lockscope_t;
/*
* Parameters for the io-mapped controllers
*/
/* I/O Port offsets */
#define CMD_PORT 0x00
#define ACK_PORT 0x00
#define TOGGLE_PORT 0x01
#define INTR_PORT 0x0a
#define MBOX_BUSY_PORT 0x00
#define MBOX_PORT0 0x04
#define MBOX_PORT1 0x05
#define MBOX_PORT2 0x06
#define MBOX_PORT3 0x07
#define ENABLE_MBOX_REGION 0x0B
/* I/O Port Values */
#define ISSUE_BYTE 0x10
#define ACK_BYTE 0x08
#define ENABLE_INTR_BYTE 0xc0
#define DISABLE_INTR_BYTE 0x00
#define VALID_INTR_BYTE 0x40
#define MBOX_BUSY_BYTE 0x10
#define ENABLE_MBOX_BYTE 0x00
/* Setup some port macros here */
#define issue_command(adapter) \
outb_p(ISSUE_BYTE, (adapter)->base + CMD_PORT)
#define irq_state(adapter) inb_p((adapter)->base + INTR_PORT)
#define set_irq_state(adapter, value) \
outb_p((value), (adapter)->base + INTR_PORT)
#define irq_ack(adapter) \
outb_p(ACK_BYTE, (adapter)->base + ACK_PORT)
#define irq_enable(adapter) \
outb_p(ENABLE_INTR_BYTE, (adapter)->base + TOGGLE_PORT)
#define irq_disable(adapter) \
outb_p(DISABLE_INTR_BYTE, (adapter)->base + TOGGLE_PORT)
/*
* This is our SYSDEP area. All kernel specific detail should be placed here -
* as much as possible
*/
/*
* End of SYSDEP area
*/
const char *megaraid_info (struct Scsi_Host *); const char *megaraid_info (struct Scsi_Host *);
int megaraid_detect (Scsi_Host_Template *);
int megaraid_release (struct Scsi_Host *); static int megaraid_detect(Scsi_Host_Template *);
int megaraid_command (Scsi_Cmnd *); static void mega_find_card(Scsi_Host_Template *, u16, u16);
int megaraid_abort (Scsi_Cmnd *); static int mega_query_adapter(adapter_t *);
int megaraid_reset (Scsi_Cmnd *, unsigned int); static inline int issue_scb(adapter_t *, scb_t *);
int megaraid_queue (Scsi_Cmnd *, void (*done) (Scsi_Cmnd *)); static int mega_setup_mailbox(adapter_t *);
int megaraid_biosparam (struct scsi_device *, struct block_device *,
sector_t, int *); static int megaraid_queue (Scsi_Cmnd *, void (*)(Scsi_Cmnd *));
int megaraid_proc_info (char *buffer, char **start, off_t offset, static scb_t * mega_build_cmd(adapter_t *, Scsi_Cmnd *, int *);
int length, int hostno, int inout); static inline scb_t *mega_allocate_scb(adapter_t *, Scsi_Cmnd *);
static void __mega_runpendq(adapter_t *);
static int megaIssueCmd (mega_host_config * megaCfg, u_char * mboxData, static inline void mega_runpendq(adapter_t *);
mega_scb * scb, int intr); static int issue_scb_block(adapter_t *, u_char *);
static int mega_build_sglist (mega_host_config * megaCfg, mega_scb * scb,
u32 * buffer, u32 * length); static void megaraid_isr_memmapped(int, void *, struct pt_regs *);
static int mega_busyWaitMbox (mega_host_config *); static void megaraid_isr_iomapped(int, void *, struct pt_regs *);
static int mega_runpendq (mega_host_config *);
static void mega_rundoneq (mega_host_config *); static void mega_free_scb(adapter_t *, scb_t *);
static void mega_cmd_done (mega_host_config *, mega_scb *, int);
static inline void mega_freeSgList (mega_host_config * megaCfg); static int megaraid_release (struct Scsi_Host *);
static void mega_Convert8ldTo40ld (mega_RAIDINQ * inquiry, static int megaraid_command (Scsi_Cmnd *);
mega_Enquiry3 * enquiry3, static int megaraid_abort(Scsi_Cmnd *);
megaRaidProductInfo * productInfo); static int megaraid_reset(Scsi_Cmnd *);
static int megaraid_abort_and_reset(adapter_t *, Scsi_Cmnd *, int);
static int megaraid_biosparam(struct scsi_device *, struct block_device *,
sector_t, int []);
static int megaraid_proc_info (char *, char **, off_t, int, int, int);
static int mega_print_inquiry(char *, char *);
static int mega_build_sglist (adapter_t *adapter, scb_t *scb,
u32 *buffer, u32 *length);
static inline int mega_busywait_mbox (adapter_t *);
static int __mega_busywait_mbox (adapter_t *);
static void mega_rundoneq (adapter_t *);
static inline void mega_cmd_done(adapter_t *, u8 [], int, int);
static inline void mega_free_sgl (adapter_t *adapter);
static void mega_8_to_40ld (mraid_inquiry *inquiry,
mega_inquiry3 *enquiry3, mega_product_info *);
static int megaraid_reboot_notify (struct notifier_block *, static int megaraid_reboot_notify (struct notifier_block *,
unsigned long, void *); unsigned long, void *);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) static int megadev_open (struct inode *, struct file *);
static mega_scb *mega_ioctl (mega_host_config * megaCfg, Scsi_Cmnd * SCpnt); static int megadev_ioctl (struct inode *, struct file *, unsigned int,
static void mega_build_kernel_sg (char *barea, ulong xfersize, mega_scb * pScb, unsigned long);
mega_ioctl_mbox * mbox); static int mega_m_to_n(void *, nitioctl_t *);
static int mega_n_to_m(void *, megacmd_t *);
static int mega_init_scb (adapter_t *);
static int mega_is_bios_enabled (adapter_t *);
#ifdef CONFIG_PROC_FS
static void mega_create_proc_entry(int, struct proc_dir_entry *);
static int proc_read_config(char *, char **, off_t, int, int *, void *);
static int proc_read_stat(char *, char **, off_t, int, int *, void *);
static int proc_read_mbox(char *, char **, off_t, int, int *, void *);
static int proc_rebuild_rate(char *, char **, off_t, int, int *, void *);
static int proc_battery(char *, char **, off_t, int, int *, void *);
static int proc_pdrv_ch0(char *, char **, off_t, int, int *, void *);
static int proc_pdrv_ch1(char *, char **, off_t, int, int *, void *);
static int proc_pdrv_ch2(char *, char **, off_t, int, int *, void *);
static int proc_pdrv_ch3(char *, char **, off_t, int, int *, void *);
static int proc_pdrv(adapter_t *, char *, int);
static int proc_rdrv_10(char *, char **, off_t, int, int *, void *);
static int proc_rdrv_20(char *, char **, off_t, int, int *, void *);
static int proc_rdrv_30(char *, char **, off_t, int, int *, void *);
static int proc_rdrv_40(char *, char **, off_t, int, int *, void *);
static int proc_rdrv(adapter_t *, char *, int, int);
#endif #endif
static int megadev_ioctl_entry (struct inode *, struct file *, static int mega_adapinq(adapter_t *, dma_addr_t);
unsigned int, unsigned long); static int mega_internal_dev_inquiry(adapter_t *, u8, u8, dma_addr_t);
static int megadev_ioctl (struct inode *, struct file *, static inline caddr_t mega_allocate_inquiry(dma_addr_t *, struct pci_dev *);
unsigned int, unsigned long); static inline void mega_free_inquiry(caddr_t, dma_addr_t, struct pci_dev *);
static mega_scb *megadev_doioctl (mega_host_config *, Scsi_Cmnd *); static inline int make_local_pdev(adapter_t *, struct pci_dev **);
static void megadev_ioctl_done (Scsi_Cmnd *); static inline void free_local_pdev(struct pci_dev *);
static int mega_init_scb (mega_host_config *);
static void enq_scb_freelist (mega_host_config *, mega_scb *, static int mega_support_ext_cdb(adapter_t *);
int lock, int intr); static mega_passthru* mega_prepare_passthru(adapter_t *, scb_t *,
Scsi_Cmnd *, int, int);
static int mega_is_bios_enabled (mega_host_config *); static mega_ext_passthru* mega_prepare_extpassthru(adapter_t *,
scb_t *, Scsi_Cmnd *, int, int);
static void mega_create_proc_entry (int index, struct proc_dir_entry *); static void mega_enum_raid_scsi(adapter_t *);
static int mega_support_ext_cdb(mega_host_config *); static void mega_get_boot_drv(adapter_t *);
static mega_passthru* mega_prepare_passthru(mega_host_config *, mega_scb *, static inline int mega_get_ldrv_num(adapter_t *, Scsi_Cmnd *, int);
Scsi_Cmnd *); static int mega_support_random_del(adapter_t *);
static mega_ext_passthru* mega_prepare_extpassthru(mega_host_config *, static int mega_del_logdrv(adapter_t *, int);
mega_scb *, Scsi_Cmnd *); static int mega_do_del_logdrv(adapter_t *, int);
static void mega_enum_raid_scsi(mega_host_config *); static void mega_get_max_sgl(adapter_t *);
static int mega_partsize(struct block_device *, sector_t, int *); static int mega_internal_command(adapter_t *, lockscope_t, megacmd_t *,
static void mega_get_boot_ldrv(mega_host_config *); mega_passthru *);
static int mega_get_lun(mega_host_config *, Scsi_Cmnd *); static void mega_internal_done(Scsi_Cmnd *);
static int mega_support_random_del(mega_host_config *); static int mega_support_cluster(adapter_t *);
static int mega_del_logdrv(mega_host_config *, int);
static int mega_do_del_logdrv(mega_host_config *, int);
#endif #endif
/* vi: set ts=4: */ /* vi: set ts=8 sw=8 tw=78: */
...@@ -398,7 +398,7 @@ static Scsi_Host_Template *the_template = NULL; ...@@ -398,7 +398,7 @@ static Scsi_Host_Template *the_template = NULL;
#define ScsiResult(host_code, scsi_code) (((host_code) << 16) + ((scsi_code) & 0x7f)) #define ScsiResult(host_code, scsi_code) (((host_code) << 16) + ((scsi_code) & 0x7f))
static void ncr53c8xx_intr(int irq, void *dev_id, struct pt_regs * regs); static irqreturn_t ncr53c8xx_intr(int irq, void *dev_id, struct pt_regs * regs);
static void ncr53c8xx_timeout(unsigned long np); static void ncr53c8xx_timeout(unsigned long np);
static int ncr53c8xx_proc_info(char *buffer, char **start, off_t offset, static int ncr53c8xx_proc_info(char *buffer, char **start, off_t offset,
int length, int hostno, int func); int length, int hostno, int func);
...@@ -4883,7 +4883,7 @@ static int ncr_reset_bus (ncb_p np, Scsi_Cmnd *cmd, int sync_reset) ...@@ -4883,7 +4883,7 @@ static int ncr_reset_bus (ncb_p np, Scsi_Cmnd *cmd, int sync_reset)
* Return immediately if reset is in progress. * Return immediately if reset is in progress.
*/ */
if (np->settle_time) { if (np->settle_time) {
return SCSI_RESET_PUNT; return FAILED;
} }
/* /*
* Start the reset process. * Start the reset process.
...@@ -4929,7 +4929,7 @@ static int ncr_reset_bus (ncb_p np, Scsi_Cmnd *cmd, int sync_reset) ...@@ -4929,7 +4929,7 @@ static int ncr_reset_bus (ncb_p np, Scsi_Cmnd *cmd, int sync_reset)
ncr_queue_done_cmd(np, cmd); ncr_queue_done_cmd(np, cmd);
} }
return SCSI_RESET_SUCCESS; return SUCCESS;
} }
/*========================================================== /*==========================================================
...@@ -8775,7 +8775,7 @@ printk("ncr53c8xx : command successfully queued\n"); ...@@ -8775,7 +8775,7 @@ printk("ncr53c8xx : command successfully queued\n");
** routine for each host that uses this IRQ. ** routine for each host that uses this IRQ.
*/ */
static void ncr53c8xx_intr(int irq, void *dev_id, struct pt_regs * regs) static irqreturn_t ncr53c8xx_intr(int irq, void *dev_id, struct pt_regs * regs)
{ {
unsigned long flags; unsigned long flags;
ncb_p np = (ncb_p) dev_id; ncb_p np = (ncb_p) dev_id;
...@@ -8800,6 +8800,7 @@ static void ncr53c8xx_intr(int irq, void *dev_id, struct pt_regs * regs) ...@@ -8800,6 +8800,7 @@ static void ncr53c8xx_intr(int irq, void *dev_id, struct pt_regs * regs)
ncr_flush_done_cmds(done_list); ncr_flush_done_cmds(done_list);
NCR_UNLOCK_SCSI_DONE(done_list->device->host, flags); NCR_UNLOCK_SCSI_DONE(done_list->device->host, flags);
} }
return IRQ_HANDLED;
} }
/* /*
...@@ -8829,59 +8830,24 @@ static void ncr53c8xx_timeout(unsigned long npref) ...@@ -8829,59 +8830,24 @@ static void ncr53c8xx_timeout(unsigned long npref)
** Linux entry point of reset() function ** Linux entry point of reset() function
*/ */
#if defined SCSI_RESET_SYNCHRONOUS && defined SCSI_RESET_ASYNCHRONOUS int ncr53c8xx_bus_reset(Scsi_Cmnd *cmd)
int ncr53c8xx_reset(Scsi_Cmnd *cmd, unsigned int reset_flags)
#else
int ncr53c8xx_reset(Scsi_Cmnd *cmd)
#endif
{ {
ncb_p np = ((struct host_data *) cmd->device->host->hostdata)->ncb; ncb_p np = ((struct host_data *) cmd->device->host->hostdata)->ncb;
int sts; int sts;
unsigned long flags; unsigned long flags;
Scsi_Cmnd *done_list; Scsi_Cmnd *done_list;
#if defined SCSI_RESET_SYNCHRONOUS && defined SCSI_RESET_ASYNCHRONOUS
printk("ncr53c8xx_reset: pid=%lu reset_flags=%x serial_number=%ld serial_number_at_timeout=%ld\n",
cmd->pid, reset_flags, cmd->serial_number, cmd->serial_number_at_timeout);
#else
printk("ncr53c8xx_reset: command pid %lu\n", cmd->pid);
#endif
NCR_LOCK_NCB(np, flags); NCR_LOCK_NCB(np, flags);
/*
* We have to just ignore reset requests in some situations.
*/
#if defined SCSI_RESET_NOT_RUNNING
if (cmd->serial_number != cmd->serial_number_at_timeout) {
sts = SCSI_RESET_NOT_RUNNING;
goto out;
}
#endif
/* /*
* If the mid-level driver told us reset is synchronous, it seems * If the mid-level driver told us reset is synchronous, it seems
* that we must call the done() callback for the involved command, * that we must call the done() callback for the involved command,
* even if this command was not queued to the low-level driver, * even if this command was not queued to the low-level driver,
* before returning SCSI_RESET_SUCCESS. * before returning SUCCESS.
*/ */
#if defined SCSI_RESET_SYNCHRONOUS && defined SCSI_RESET_ASYNCHRONOUS sts = ncr_reset_bus(np, cmd, 1);
sts = ncr_reset_bus(np, cmd,
(reset_flags & (SCSI_RESET_SYNCHRONOUS | SCSI_RESET_ASYNCHRONOUS)) == SCSI_RESET_SYNCHRONOUS);
#else
sts = ncr_reset_bus(np, cmd, 0);
#endif
/*
* Since we always reset the controller, when we return success,
* we add this information to the return code.
*/
#if defined SCSI_RESET_HOST_RESET
if (sts == SCSI_RESET_SUCCESS)
sts |= SCSI_RESET_HOST_RESET;
#endif
out:
done_list = np->done_list; done_list = np->done_list;
np->done_list = 0; np->done_list = 0;
NCR_UNLOCK_NCB(np, flags); NCR_UNLOCK_NCB(np, flags);
...@@ -9513,6 +9479,8 @@ Scsi_Host_Template driver_template = { ...@@ -9513,6 +9479,8 @@ Scsi_Host_Template driver_template = {
.release = zalon7xx_release, .release = zalon7xx_release,
.info = ncr53c8xx_info, .info = ncr53c8xx_info,
.queuecommand = ncr53c8xx_queue_command, .queuecommand = ncr53c8xx_queue_command,
.slave_configure = ncr53c8xx_slave_configure,
.eh_bus_reset_handler = ncr53c8xx_bus_reset,
.can_queue = SCSI_NCR_CAN_QUEUE, .can_queue = SCSI_NCR_CAN_QUEUE,
.this_id = 7, .this_id = 7,
.sg_tablesize = SCSI_NCR_SG_TABLESIZE, .sg_tablesize = SCSI_NCR_SG_TABLESIZE,
......
...@@ -63,35 +63,19 @@ int ncr53c8xx_slave_configure(Scsi_Device *); ...@@ -63,35 +63,19 @@ int ncr53c8xx_slave_configure(Scsi_Device *);
int ncr53c8xx_release(struct Scsi_Host *); int ncr53c8xx_release(struct Scsi_Host *);
#if LINUX_VERSION_CODE >= LinuxVersionCode(2,1,75)
#define NCR53C8XX { .name = "ncr53c8xx", \ #define NCR53C8XX { .name = "ncr53c8xx", \
.detect = ncr53c8xx_detect, \ .detect = ncr53c8xx_detect, \
.release = ncr53c8xx_release, \ .release = ncr53c8xx_release, \
.info = ncr53c8xx_info, \ .info = ncr53c8xx_info, \
.queuecommand = ncr53c8xx_queue_command,\ .queuecommand = ncr53c8xx_queue_command,\
.slave_configure = ncr53c8xx_slave_configure,\ .slave_configure = ncr53c8xx_slave_configure,\
.abort = ncr53c8xx_abort, \ .eh_bus_reset_handler = ncr53c8xx_bus_reset, \
.reset = ncr53c8xx_reset, \
.can_queue = SCSI_NCR_CAN_QUEUE, \ .can_queue = SCSI_NCR_CAN_QUEUE, \
.this_id = 7, \ .this_id = 7, \
.sg_tablesize = SCSI_NCR_SG_TABLESIZE, \ .sg_tablesize = SCSI_NCR_SG_TABLESIZE, \
.cmd_per_lun = SCSI_NCR_CMD_PER_LUN, \ .cmd_per_lun = SCSI_NCR_CMD_PER_LUN, \
.use_clustering = DISABLE_CLUSTERING} .use_clustering = DISABLE_CLUSTERING}
#else
#define NCR53C8XX { NULL, NULL, NULL, NULL, \
NULL, ncr53c8xx_detect, \
ncr53c8xx_release, ncr53c8xx_info, NULL, \
ncr53c8xx_queue_command,ncr53c8xx_abort, \
ncr53c8xx_reset, NULL, scsicam_bios_param, \
SCSI_NCR_CAN_QUEUE, 7, \
SCSI_NCR_SG_TABLESIZE, SCSI_NCR_CMD_PER_LUN, \
0, 0, DISABLE_CLUSTERING}
#endif /* LINUX_VERSION_CODE */
#endif /* defined(HOSTS_C) || defined(MODULE) */ #endif /* defined(HOSTS_C) || defined(MODULE) */
#endif /* NCR53C8XX_H */ #endif /* NCR53C8XX_H */
...@@ -219,15 +219,12 @@ int ppa_detect(Scsi_Host_Template * host) ...@@ -219,15 +219,12 @@ int ppa_detect(Scsi_Host_Template * host)
printk(" supported by the imm (ZIP Plus) driver. If the\n"); printk(" supported by the imm (ZIP Plus) driver. If the\n");
printk(" cable is marked with \"AutoDetect\", this is what has\n"); printk(" cable is marked with \"AutoDetect\", this is what has\n");
printk(" happened.\n"); printk(" happened.\n");
spin_lock_irq(hreg->host_lock);
return 0; return 0;
} }
try_again = 1; try_again = 1;
goto retry_entry; goto retry_entry;
} else { } else
spin_lock_irq(hreg->host_lock);
return 1; /* return number of hosts detected */ return 1; /* return number of hosts detected */
}
} }
/* This is to give the ppa driver a way to modify the timings (and other /* This is to give the ppa driver a way to modify the timings (and other
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
#define DEB(x) #define DEB(x)
#endif #endif
#define MAXBOARDS 2 /* Increase this and the sizes of the arrays below, if you need more. */ #define MAXBOARDS 6 /* Increase this and the sizes of the arrays below, if you need more. */
#define PORT_DATA 0 #define PORT_DATA 0
#define PORT_ERROR 1 #define PORT_ERROR 1
...@@ -367,7 +367,7 @@ irqerror:; ...@@ -367,7 +367,7 @@ irqerror:;
SCpnt->result = DecodeError (shost, status); SCpnt->result = DecodeError (shost, status);
SCpnt->scsi_done (SCpnt); SCpnt->scsi_done (SCpnt);
} }
static void do_Irq_Handler (int irq, void *dev_id, struct pt_regs *regs) static irqreturn_t do_Irq_Handler (int irq, void *dev_id, struct pt_regs *regs)
{ {
unsigned long flags; unsigned long flags;
struct Scsi_Host *dev = dev_id; struct Scsi_Host *dev = dev_id;
...@@ -375,6 +375,8 @@ static void do_Irq_Handler (int irq, void *dev_id, struct pt_regs *regs) ...@@ -375,6 +375,8 @@ static void do_Irq_Handler (int irq, void *dev_id, struct pt_regs *regs)
spin_lock_irqsave(dev->host_lock, flags); spin_lock_irqsave(dev->host_lock, flags);
Irq_Handler(irq, dev_id, regs); Irq_Handler(irq, dev_id, regs);
spin_unlock_irqrestore(dev->host_lock, flags); spin_unlock_irqrestore(dev->host_lock, flags);
/* FIXME: we should check to see if this is true */
return IRQ_HANDLED;
} }
/**************************************************************** /****************************************************************
* Name: Psi240i_QueueCommand * Name: Psi240i_QueueCommand
...@@ -390,8 +392,8 @@ static void do_Irq_Handler (int irq, void *dev_id, struct pt_regs *regs) ...@@ -390,8 +392,8 @@ static void do_Irq_Handler (int irq, void *dev_id, struct pt_regs *regs)
int Psi240i_QueueCommand (Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) int Psi240i_QueueCommand (Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
{ {
UCHAR *cdb = (UCHAR *)SCpnt->cmnd; // Pointer to SCSI CDB UCHAR *cdb = (UCHAR *)SCpnt->cmnd; // Pointer to SCSI CDB
PADAPTER240I padapter = HOSTDATA(SCpnt->host); // Pointer to adapter control structure PADAPTER240I padapter = HOSTDATA (SCpnt->device->host); // Pointer to adapter control structure
POUR_DEVICE pdev = &padapter->device[SCpnt->target];// Pointer to device information POUR_DEVICE pdev = &padapter->device [SCpnt->device->id];// Pointer to device information
UCHAR rc; // command return code UCHAR rc; // command return code
SCpnt->scsi_done = done; SCpnt->scsi_done = done;
...@@ -566,25 +568,25 @@ int Psi240i_Detect (Scsi_Host_Template *tpnt) ...@@ -566,25 +568,25 @@ int Psi240i_Detect (Scsi_Host_Template *tpnt)
int count = 0; int count = 0;
int unit; int unit;
int z; int z;
USHORT port; USHORT port, port_range = 16;
CHIP_CONFIG_N chipConfig; CHIP_CONFIG_N chipConfig;
CHIP_DEVICE_N chipDevice[8]; CHIP_DEVICE_N chipDevice[8];
struct Scsi_Host *pshost; struct Scsi_Host *pshost;
ULONG flags;
for ( board = 0; board < 6; board++ ) // scan for I/O ports for ( board = 0; board < MAXBOARDS; board++ ) // scan for I/O ports
{ {
pshost = NULL;
port = portAddr[board]; // get base address to test port = portAddr[board]; // get base address to test
if ( check_region (port, 16) ) // test for I/O addresses available if ( !request_region (port, port_range, "psi240i") )
continue; // nope
if ( inb_p (port + REG_FAIL) != CHIP_ID ) // do the first test for likley hood that it is us
continue; continue;
if ( inb_p (port + REG_FAIL) != CHIP_ID ) // do the first test for likley hood that it is us
goto host_init_failure;
outb_p (SEL_NONE, port + REG_SEL_FAIL); // setup EEPROM/RAM access outb_p (SEL_NONE, port + REG_SEL_FAIL); // setup EEPROM/RAM access
outw (0, port + REG_ADDRESS); // setup EEPROM address zero outw (0, port + REG_ADDRESS); // setup EEPROM address zero
if ( inb_p (port) != 0x55 ) // test 1st byte if ( inb_p (port) != 0x55 ) // test 1st byte
continue; // nope goto host_init_failure; // nope
if ( inb_p (port + 1) != 0xAA ) // test 2nd byte if ( inb_p (port + 1) != 0xAA ) // test 2nd byte
continue; // nope goto host_init_failure; // nope
// at this point our board is found and can be accessed. Now we need to initialize // at this point our board is found and can be accessed. Now we need to initialize
// our informatation and register with the kernel. // our informatation and register with the kernel.
...@@ -595,20 +597,11 @@ int Psi240i_Detect (Scsi_Host_Template *tpnt) ...@@ -595,20 +597,11 @@ int Psi240i_Detect (Scsi_Host_Template *tpnt)
ReadChipMemory (&ChipSetup, CHIP_EEPROM_DATA, sizeof (ChipSetup), port); ReadChipMemory (&ChipSetup, CHIP_EEPROM_DATA, sizeof (ChipSetup), port);
if ( !chipConfig.numDrives ) // if no devices on this board if ( !chipConfig.numDrives ) // if no devices on this board
continue; goto host_init_failure;
pshost = scsi_register (tpnt, sizeof(ADAPTER240I)); pshost = scsi_register (tpnt, sizeof(ADAPTER240I));
if(pshost == NULL) if(pshost == NULL)
continue; goto host_init_failure;
save_flags (flags);
cli ();
if ( request_irq (chipConfig.irq, do_Irq_Handler, 0, "psi240i", pshost) )
{
printk ("Unable to allocate IRQ for PSI-240I controller.\n");
restore_flags (flags);
goto unregister;
}
PsiHost[chipConfig.irq - 10] = pshost; PsiHost[chipConfig.irq - 10] = pshost;
pshost->unique_id = port; pshost->unique_id = port;
...@@ -642,14 +635,22 @@ int Psi240i_Detect (Scsi_Host_Template *tpnt) ...@@ -642,14 +635,22 @@ int Psi240i_Detect (Scsi_Host_Template *tpnt)
DEB (printk ("\n blocks = %lX", HOSTDATA(pshost)->device[unit].blocks)); DEB (printk ("\n blocks = %lX", HOSTDATA(pshost)->device[unit].blocks));
} }
restore_flags (flags); if ( request_irq (chipConfig.irq, do_Irq_Handler, 0, "psi240i", pshost) == 0 )
printk("\nPSI-240I EIDE CONTROLLER: at I/O = %x IRQ = %d\n", port, chipConfig.irq); {
printk("(C) 1997 Perceptive Solutions, Inc. All rights reserved\n\n"); printk("\nPSI-240I EIDE CONTROLLER: at I/O = %x IRQ = %d\n", port, chipConfig.irq);
count++; printk("(C) 1997 Perceptive Solutions, Inc. All rights reserved\n\n");
continue; count++;
continue;
}
printk ("Unable to allocate IRQ for PSI-240I controller.\n");
host_init_failure:
release_region (port, port_range);
if (pshost)
scsi_unregister (pshost);
unregister:;
scsi_unregister (pshost);
} }
return count; return count;
} }
......
...@@ -224,8 +224,10 @@ void scsi_release_request(Scsi_Request * req) ...@@ -224,8 +224,10 @@ void scsi_release_request(Scsi_Request * req)
{ {
if( req->sr_command != NULL ) if( req->sr_command != NULL )
{ {
request_queue_t *q = req->sr_device->request_queue;
scsi_put_command(req->sr_command); scsi_put_command(req->sr_command);
req->sr_command = NULL; req->sr_command = NULL;
scsi_queue_next_request(q, NULL);
} }
kfree(req); kfree(req);
......
...@@ -86,21 +86,6 @@ extern const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE]; ...@@ -86,21 +86,6 @@ extern const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE];
#define SCSI_TIMEOUT (2*HZ) #define SCSI_TIMEOUT (2*HZ)
#endif #endif
/*
* Used for debugging the new queueing code. We want to make sure
* that the lock state is consistent with design. Only do this in
* the user space simulator.
*/
#define ASSERT_LOCK(_LOCK, _COUNT)
#if defined(CONFIG_SMP) && defined(CONFIG_USER_DEBUG)
#undef ASSERT_LOCK
#define ASSERT_LOCK(_LOCK,_COUNT) \
{ if( (_LOCK)->lock != _COUNT ) \
panic("Lock count inconsistent %s %d\n", __FILE__, __LINE__); \
}
#endif
/* /*
* Use these to separate status msg and our bytes * Use these to separate status msg and our bytes
* *
......
...@@ -1334,10 +1334,6 @@ static void scsi_eh_lock_done(struct scsi_cmnd *scmd) ...@@ -1334,10 +1334,6 @@ static void scsi_eh_lock_done(struct scsi_cmnd *scmd)
{ {
struct scsi_request *sreq = scmd->sc_request; struct scsi_request *sreq = scmd->sc_request;
scmd->sc_request = NULL;
sreq->sr_command = NULL;
scsi_put_command(scmd);
scsi_release_request(sreq); scsi_release_request(sreq);
} }
......
...@@ -733,7 +733,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, int good_sectors, ...@@ -733,7 +733,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, int good_sectors,
if (good_sectors >= 0) { if (good_sectors >= 0) {
SCSI_LOG_HLCOMPLETE(1, printk("%ld sectors total, %d sectors done.\n", SCSI_LOG_HLCOMPLETE(1, printk("%ld sectors total, %d sectors done.\n",
req->nr_sectors, good_sectors)); req->nr_sectors, good_sectors));
SCSI_LOG_HLCOMPLETE(1, printk("use_sg is %d\n ", cmd->use_sg)); SCSI_LOG_HLCOMPLETE(1, printk("use_sg is %d\n", cmd->use_sg));
if (clear_errors) if (clear_errors)
req->errors = 0; req->errors = 0;
......
...@@ -376,15 +376,15 @@ static void print_inquiry(unsigned char *inq_result) ...@@ -376,15 +376,15 @@ static void print_inquiry(unsigned char *inq_result)
} }
/** /**
* scsi_alloc_sdev - allocate and setup a Scsi_Device * scsi_alloc_sdev - allocate and setup a scsi_Device
* *
* Description: * Description:
* Allocate, initialize for io, and return a pointer to a Scsi_Device. * Allocate, initialize for io, and return a pointer to a scsi_Device.
* Stores the @shost, @channel, @id, and @lun in the Scsi_Device, and * Stores the @shost, @channel, @id, and @lun in the scsi_Device, and
* adds Scsi_Device to the appropriate list. * adds scsi_Device to the appropriate list.
* *
* Return value: * Return value:
* Scsi_Device pointer, or NULL on failure. * scsi_Device pointer, or NULL on failure.
**/ **/
static struct scsi_device *scsi_alloc_sdev(struct Scsi_Host *shost, static struct scsi_device *scsi_alloc_sdev(struct Scsi_Host *shost,
uint channel, uint id, uint lun) uint channel, uint id, uint lun)
...@@ -465,9 +465,7 @@ static struct scsi_device *scsi_alloc_sdev(struct Scsi_Host *shost, ...@@ -465,9 +465,7 @@ static struct scsi_device *scsi_alloc_sdev(struct Scsi_Host *shost,
return sdev; return sdev;
out_free_queue: out_free_queue:
if (sdev->request_queue) scsi_free_queue(sdev->request_queue);
scsi_free_queue(sdev->request_queue);
out_free_dev: out_free_dev:
kfree(sdev); kfree(sdev);
out: out:
...@@ -476,8 +474,8 @@ static struct scsi_device *scsi_alloc_sdev(struct Scsi_Host *shost, ...@@ -476,8 +474,8 @@ static struct scsi_device *scsi_alloc_sdev(struct Scsi_Host *shost,
} }
/** /**
* scsi_free_sdev - cleanup and free a Scsi_Device * scsi_free_sdev - cleanup and free a scsi_device
* @sdev: cleanup and free this Scsi_Device * @sdev: cleanup and free this scsi_device
* *
* Description: * Description:
* Undo the actions in scsi_alloc_sdev, including removing @sdev from * Undo the actions in scsi_alloc_sdev, including removing @sdev from
...@@ -499,8 +497,7 @@ static void scsi_free_sdev(struct scsi_device *sdev) ...@@ -499,8 +497,7 @@ static void scsi_free_sdev(struct scsi_device *sdev)
spin_lock_irqsave(sdev->host->host_lock, flags); spin_lock_irqsave(sdev->host->host_lock, flags);
list_del(&sdev->starved_entry); list_del(&sdev->starved_entry);
if (sdev->single_lun) { if (sdev->single_lun) {
sdev->sdev_target->starget_refcnt--; if (--sdev->sdev_target->starget_refcnt == 0)
if (sdev->sdev_target->starget_refcnt == 0)
kfree(sdev->sdev_target); kfree(sdev->sdev_target);
} }
spin_unlock_irqrestore(sdev->host->host_lock, flags); spin_unlock_irqrestore(sdev->host->host_lock, flags);
...@@ -1004,6 +1001,7 @@ static void scsi_probe_lun(Scsi_Request *sreq, char *inq_result, ...@@ -1004,6 +1001,7 @@ static void scsi_probe_lun(Scsi_Request *sreq, char *inq_result,
unsigned char scsi_cmd[MAX_COMMAND_SIZE]; unsigned char scsi_cmd[MAX_COMMAND_SIZE];
int possible_inq_resp_len; int possible_inq_resp_len;
repeat_inquiry:
SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO "scsi scan: INQUIRY to host %d" SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO "scsi scan: INQUIRY to host %d"
" channel %d id %d lun %d\n", sdev->host->host_no, " channel %d id %d lun %d\n", sdev->host->host_no,
sdev->channel, sdev->id, sdev->lun)); sdev->channel, sdev->id, sdev->lun));
...@@ -1070,8 +1068,14 @@ static void scsi_probe_lun(Scsi_Request *sreq, char *inq_result, ...@@ -1070,8 +1068,14 @@ static void scsi_probe_lun(Scsi_Request *sreq, char *inq_result,
SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO "scsi scan: 2nd INQUIRY" SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO "scsi scan: 2nd INQUIRY"
" %s with code 0x%x\n", sreq->sr_result ? " %s with code 0x%x\n", sreq->sr_result ?
"failed" : "successful", sreq->sr_result)); "failed" : "successful", sreq->sr_result));
if (sreq->sr_result) if (sreq->sr_result) {
return; /* if the longer inquiry has failed, flag the device
* as only accepting 36 byte inquiries and retry the
* 36 byte inquiry */
printk(KERN_INFO "scsi scan: %d byte inquiry failed with code %d. Consider BLIST_INQUIRY_36 for this device\n", sreq->sr_result);
*bflags |= BLIST_INQUIRY_36;
goto repeat_inquiry;
}
/* /*
* The INQUIRY can change, this means the length can change. * The INQUIRY can change, this means the length can change.
...@@ -1482,25 +1486,25 @@ static void scsi_sequential_lun_scan(struct Scsi_Host *shost, uint channel, ...@@ -1482,25 +1486,25 @@ static void scsi_sequential_lun_scan(struct Scsi_Host *shost, uint channel,
#ifdef CONFIG_SCSI_REPORT_LUNS #ifdef CONFIG_SCSI_REPORT_LUNS
/** /**
* scsilun_to_int: convert a ScsiLun to an int * scsilun_to_int: convert a scsi_lun to an int
* @scsilun: ScsiLun to be converted. * @scsilun: struct scsi_lun to be converted.
* *
* Description: * Description:
* Convert @scsilun from a ScsiLun to a four byte host byte-ordered * Convert @scsilun from a struct scsi_lun to a four byte host byte-ordered
* integer, and return the result. The caller must check for * integer, and return the result. The caller must check for
* truncation before using this function. * truncation before using this function.
* *
* Notes: * Notes:
* The ScsiLun is assumed to be four levels, with each level * The struct scsi_lun is assumed to be four levels, with each level
* effectively containing a SCSI byte-ordered (big endian) short; the * effectively containing a SCSI byte-ordered (big endian) short; the
* addressing bits of each level are ignored (the highest two bits). * addressing bits of each level are ignored (the highest two bits).
* For a description of the LUN format, post SCSI-3 see the SCSI * For a description of the LUN format, post SCSI-3 see the SCSI
* Architecture Model, for SCSI-3 see the SCSI Controller Commands. * Architecture Model, for SCSI-3 see the SCSI Controller Commands.
* *
* Given a ScsiLun of: 0a 04 0b 03 00 00 00 00, this function returns * Given a struct scsi_lun of: 0a 04 0b 03 00 00 00 00, this function returns
* the integer: 0x0b030a04 * the integer: 0x0b030a04
**/ **/
static int scsilun_to_int(ScsiLun *scsilun) static int scsilun_to_int(struct scsi_lun *scsilun)
{ {
int i; int i;
unsigned int lun; unsigned int lun;
...@@ -1511,7 +1515,6 @@ static int scsilun_to_int(ScsiLun *scsilun) ...@@ -1511,7 +1515,6 @@ static int scsilun_to_int(ScsiLun *scsilun)
scsilun->scsi_lun[i + 1]) << (i * 8)); scsilun->scsi_lun[i + 1]) << (i * 8));
return lun; return lun;
} }
#endif
/** /**
* scsi_report_lun_scan - Scan using SCSI REPORT LUN results * scsi_report_lun_scan - Scan using SCSI REPORT LUN results
...@@ -1528,18 +1531,16 @@ static int scsilun_to_int(ScsiLun *scsilun) ...@@ -1528,18 +1531,16 @@ static int scsilun_to_int(ScsiLun *scsilun)
* 0: scan completed (or no memory, so further scanning is futile) * 0: scan completed (or no memory, so further scanning is futile)
* 1: no report lun scan, or not configured * 1: no report lun scan, or not configured
**/ **/
static int scsi_report_lun_scan(Scsi_Device *sdev, int bflags) static int scsi_report_lun_scan(struct scsi_device *sdev, int bflags)
{ {
#ifdef CONFIG_SCSI_REPORT_LUNS
char devname[64]; char devname[64];
unsigned char scsi_cmd[MAX_COMMAND_SIZE]; unsigned char scsi_cmd[MAX_COMMAND_SIZE];
unsigned int length; unsigned int length;
unsigned int lun; unsigned int lun;
unsigned int num_luns; unsigned int num_luns;
unsigned int retries; unsigned int retries;
ScsiLun *fcp_cur_lun, *lun_data; struct scsi_lun *lunp, *lun_data;
Scsi_Request *sreq; struct scsi_request *sreq;
char *data; char *data;
/* /*
...@@ -1551,15 +1552,14 @@ static int scsi_report_lun_scan(Scsi_Device *sdev, int bflags) ...@@ -1551,15 +1552,14 @@ static int scsi_report_lun_scan(Scsi_Device *sdev, int bflags)
return 0; return 0;
sreq = scsi_allocate_request(sdev); sreq = scsi_allocate_request(sdev);
if (sreq == NULL) { if (!sreq)
printk(ALLOC_FAILURE_MSG, __FUNCTION__); goto out;
return 0;
} sprintf(devname, "host %d channel %d id %d",
sdev->host->host_no, sdev->channel, sdev->id);
sprintf(devname, "host %d channel %d id %d", sdev->host->host_no,
sdev->channel, sdev->id);
/* /*
* Allocate enough to hold the header (the same size as one ScsiLun) * Allocate enough to hold the header (the same size as one scsi_lun)
* plus the max number of luns we are requesting. * plus the max number of luns we are requesting.
* *
* Reallocating and trying again (with the exact amount we need) * Reallocating and trying again (with the exact amount we need)
...@@ -1568,24 +1568,19 @@ static int scsi_report_lun_scan(Scsi_Device *sdev, int bflags) ...@@ -1568,24 +1568,19 @@ static int scsi_report_lun_scan(Scsi_Device *sdev, int bflags)
* kmalloc - we don't want a kmalloc() failure of a huge value to * kmalloc - we don't want a kmalloc() failure of a huge value to
* prevent us from finding any LUNs on this target. * prevent us from finding any LUNs on this target.
*/ */
length = (max_scsi_report_luns + 1) * sizeof(ScsiLun); length = (max_scsi_report_luns + 1) * sizeof(struct scsi_lun);
lun_data = (ScsiLun *) kmalloc(length, GFP_ATOMIC | lun_data = kmalloc(length, GFP_ATOMIC |
(sdev->host->unchecked_isa_dma ? (sdev->host->unchecked_isa_dma ? __GFP_DMA : 0));
GFP_DMA : 0)); if (!lun_data)
if (lun_data == NULL) { goto out_release_request;
printk(ALLOC_FAILURE_MSG, __FUNCTION__);
scsi_release_request(sreq);
/*
* We are out of memory, don't try scanning any further.
*/
return 0;
}
scsi_cmd[0] = REPORT_LUNS; scsi_cmd[0] = REPORT_LUNS;
/* /*
* bytes 1 - 5: reserved, set to zero. * bytes 1 - 5: reserved, set to zero.
*/ */
memset(&scsi_cmd[1], 0, 5); memset(&scsi_cmd[1], 0, 5);
/* /*
* bytes 6 - 9: length of the command. * bytes 6 - 9: length of the command.
*/ */
...@@ -1609,19 +1604,18 @@ static int scsi_report_lun_scan(Scsi_Device *sdev, int bflags) ...@@ -1609,19 +1604,18 @@ static int scsi_report_lun_scan(Scsi_Device *sdev, int bflags)
* should come through as a check condition, and will not generate * should come through as a check condition, and will not generate
* a retry. * a retry.
*/ */
retries = 0; for (retries = 0; retries < 3; retries++) {
while (retries++ < 3) {
SCSI_LOG_SCAN_BUS(3, printk (KERN_INFO "scsi scan: Sending" SCSI_LOG_SCAN_BUS(3, printk (KERN_INFO "scsi scan: Sending"
" REPORT LUNS to %s (try %d)\n", devname, " REPORT LUNS to %s (try %d)\n", devname,
retries)); retries));
scsi_wait_req(sreq, (void *) scsi_cmd, (void *) lun_data, scsi_wait_req(sreq, scsi_cmd, lun_data, length,
length, SCSI_TIMEOUT + 4 * HZ, 3); SCSI_TIMEOUT + 4*HZ, 3);
SCSI_LOG_SCAN_BUS(3, printk (KERN_INFO "scsi scan: REPORT LUNS" SCSI_LOG_SCAN_BUS(3, printk (KERN_INFO "scsi scan: REPORT LUNS"
" %s (try %d) result 0x%x\n", sreq->sr_result " %s (try %d) result 0x%x\n", sreq->sr_result
? "failed" : "successful", retries, ? "failed" : "successful", retries,
sreq->sr_result)); sreq->sr_result));
if (sreq->sr_result == 0 if (sreq->sr_result == 0 ||
|| sreq->sr_sense_buffer[2] != UNIT_ATTENTION) sreq->sr_sense_buffer[2] != UNIT_ATTENTION)
break; break;
} }
...@@ -1629,7 +1623,7 @@ static int scsi_report_lun_scan(Scsi_Device *sdev, int bflags) ...@@ -1629,7 +1623,7 @@ static int scsi_report_lun_scan(Scsi_Device *sdev, int bflags)
/* /*
* The device probably does not support a REPORT LUN command * The device probably does not support a REPORT LUN command
*/ */
kfree((char *) lun_data); kfree(lun_data);
scsi_release_request(sreq); scsi_release_request(sreq);
return 1; return 1;
} }
...@@ -1641,31 +1635,32 @@ static int scsi_report_lun_scan(Scsi_Device *sdev, int bflags) ...@@ -1641,31 +1635,32 @@ static int scsi_report_lun_scan(Scsi_Device *sdev, int bflags)
data = (char *) lun_data->scsi_lun; data = (char *) lun_data->scsi_lun;
length = ((data[0] << 24) | (data[1] << 16) | length = ((data[0] << 24) | (data[1] << 16) |
(data[2] << 8) | (data[3] << 0)); (data[2] << 8) | (data[3] << 0));
if ((length / sizeof(ScsiLun)) > max_scsi_report_luns) {
num_luns = (length / sizeof(struct scsi_lun));
if (num_luns > max_scsi_report_luns) {
printk(KERN_WARNING "scsi: On %s only %d (max_scsi_report_luns)" printk(KERN_WARNING "scsi: On %s only %d (max_scsi_report_luns)"
" of %d luns reported, try increasing" " of %d luns reported, try increasing"
" max_scsi_report_luns.\n", devname, " max_scsi_report_luns.\n", devname,
max_scsi_report_luns, length / sizeof(ScsiLun)); max_scsi_report_luns, num_luns);
num_luns = max_scsi_report_luns; num_luns = max_scsi_report_luns;
} else }
num_luns = (length / sizeof(ScsiLun));
SCSI_LOG_SCAN_BUS(3, printk (KERN_INFO "scsi scan: REPORT LUN scan of" SCSI_LOG_SCAN_BUS(3, printk (KERN_INFO "scsi scan: REPORT LUN scan of"
" host %d channel %d id %d\n", sdev->host->host_no, " host %d channel %d id %d\n", sdev->host->host_no,
sdev->channel, sdev->id)); sdev->channel, sdev->id));
/* /*
* Scan the luns in lun_data. The entry at offset 0 is really * Scan the luns in lun_data. The entry at offset 0 is really
* the header, so start at 1 and go up to and including num_luns. * the header, so start at 1 and go up to and including num_luns.
*/ */
for (fcp_cur_lun = &lun_data[1]; for (lunp = &lun_data[1]; lunp <= &lun_data[num_luns]; lunp++) {
fcp_cur_lun <= &lun_data[num_luns]; fcp_cur_lun++) { lun = scsilun_to_int(lunp);
lun = scsilun_to_int(fcp_cur_lun);
/* /*
* Check if the unused part of fcp_cur_lun is non-zero, * Check if the unused part of lunp is non-zero, and so
* and so does not fit in lun. * does not fit in lun.
*/ */
if (memcmp(&fcp_cur_lun->scsi_lun[sizeof(lun)], if (memcmp(&lunp->scsi_lun[sizeof(lun)], "\0\0\0\0", 4)) {
"\0\0\0\0", 4) != 0) {
int i; int i;
/* /*
...@@ -1674,8 +1669,8 @@ static int scsi_report_lun_scan(Scsi_Device *sdev, int bflags) ...@@ -1674,8 +1669,8 @@ static int scsi_report_lun_scan(Scsi_Device *sdev, int bflags)
* integer LUN value. * integer LUN value.
*/ */
printk(KERN_WARNING "scsi: %s lun 0x", devname); printk(KERN_WARNING "scsi: %s lun 0x", devname);
data = (char *) fcp_cur_lun->scsi_lun; data = (char *)lunp->scsi_lun;
for (i = 0; i < sizeof(ScsiLun); i++) for (i = 0; i < sizeof(struct scsi_lun); i++)
printk("%02x", data[i]); printk("%02x", data[i]);
printk(" has a LUN larger than currently supported.\n"); printk(" has a LUN larger than currently supported.\n");
} else if (lun == 0) { } else if (lun == 0) {
...@@ -1703,15 +1698,22 @@ static int scsi_report_lun_scan(Scsi_Device *sdev, int bflags) ...@@ -1703,15 +1698,22 @@ static int scsi_report_lun_scan(Scsi_Device *sdev, int bflags)
} }
} }
kfree((char *) lun_data); kfree(lun_data);
return 0; return 0;
out_release_request:
scsi_release_request(sreq);
out:
/*
* We are out of memory, don't try scanning any further.
*/
printk(ALLOC_FAILURE_MSG, __FUNCTION__);
return 0;
}
#else #else
return 1; # define scsi_report_lun_scan(sdev, blags) (1)
#endif /* CONFIG_SCSI_REPORT_LUNS */ #endif /* CONFIG_SCSI_REPORT_LUNS */
}
struct scsi_device *scsi_add_device(struct Scsi_Host *shost, struct scsi_device *scsi_add_device(struct Scsi_Host *shost,
uint channel, uint id, uint lun) uint channel, uint id, uint lun)
{ {
......
...@@ -92,7 +92,6 @@ EXPORT_SYMBOL(scsi_reset_provider); ...@@ -92,7 +92,6 @@ EXPORT_SYMBOL(scsi_reset_provider);
/* /*
* These are here only while I debug the rest of the scsi stuff. * These are here only while I debug the rest of the scsi stuff.
*/ */
EXPORT_SYMBOL(scsi_host_get_next);
EXPORT_SYMBOL(scsi_host_hn_get); EXPORT_SYMBOL(scsi_host_hn_get);
EXPORT_SYMBOL(scsi_host_put); EXPORT_SYMBOL(scsi_host_put);
EXPORT_SYMBOL(scsi_device_types); EXPORT_SYMBOL(scsi_device_types);
......
...@@ -106,22 +106,22 @@ int sym53c8xx_release(struct Scsi_Host *); ...@@ -106,22 +106,22 @@ int sym53c8xx_release(struct Scsi_Host *);
#include <scsi/scsicam.h> #include <scsi/scsicam.h>
#define SYM53C8XX { \ #define SYM53C8XX { \
name: "sym53c8xx", \ .name = "sym53c8xx", \
detect: sym53c8xx_detect, \ .detect = sym53c8xx_detect, \
release: sym53c8xx_release, \ .release = sym53c8xx_release, \
info: sym53c8xx_info, \ .info = sym53c8xx_info, \
queuecommand: sym53c8xx_queue_command, \ .queuecommand = sym53c8xx_queue_command, \
slave_configure: sym53c8xx_slave_configure, \ .slave_configure = sym53c8xx_slave_configure, \
eh_abort_handler: sym53c8xx_eh_abort_handler, \ .eh_abort_handler = sym53c8xx_eh_abort_handler, \
eh_device_reset_handler:sym53c8xx_eh_device_reset_handler, \ .eh_device_reset_handler = sym53c8xx_eh_device_reset_handler,\
eh_bus_reset_handler: sym53c8xx_eh_bus_reset_handler, \ .eh_bus_reset_handler = sym53c8xx_eh_bus_reset_handler, \
eh_host_reset_handler: sym53c8xx_eh_host_reset_handler, \ .eh_host_reset_handler = sym53c8xx_eh_host_reset_handler, \
can_queue: 0, \ .can_queue = 0, \
this_id: 7, \ .this_id = 7, \
sg_tablesize: 0, \ .sg_tablesize = 0, \
cmd_per_lun: 0, \ .cmd_per_lun = 0, \
use_clustering: DISABLE_CLUSTERING, \ .use_clustering = DISABLE_CLUSTERING, \
highmem_io: 1} .highmem_io = 1}
#endif /* defined(HOSTS_C) || defined(MODULE) */ #endif /* defined(HOSTS_C) || defined(MODULE) */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment