Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
9877980f
Commit
9877980f
authored
Jun 25, 2003
by
James Bottomley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scsi_mid_low_api.txt update
From Douglas Gilbert <dougg@torque.net>
parent
5c8dfe47
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
428 additions
and
392 deletions
+428
-392
Documentation/scsi/scsi_mid_low_api.txt
Documentation/scsi/scsi_mid_low_api.txt
+428
-392
No files found.
Documentation/scsi/scsi_mid_low_api.txt
View file @
9877980f
...
@@ -22,24 +22,26 @@ has its own PCI device address. [The one-to-one correspondence between
...
@@ -22,24 +22,26 @@ 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).]
Th
is version of the document roughly matches linux kernel version 2.5.68 .
Th
e SCSI mid level isolates a LLD from other layers such as the SCSI
This document can be found in the Linux kernel source Documentation/scsi
upper layer drivers and the block layer.
directory and is called scsi_mid_low_api.txt . A more recent copy may
be found at http://www.torque.net/scsi/scsi_mid_low_api.txt.gz
.
This version of the document roughly matches linux kernel version 2.5.73
.
Documentation
Documentation
=============
=============
There is a SCSI documentation directory within the kernel source tree.
There is a SCSI documentation directory within the kernel source tree,
That directory is typically /usr/src/linux/Documentation/scsi . Most
typically /usr/src/linux/Documentation/scsi . Most documents are in plain
documents are in plain (i.e. ASCII) text. This file can be found in that
(i.e. ASCII) text. This file is named scsi_mid_low_api.txt and can be
directory, named scsi_mid_low_api.txt . Many LLDs are documented there
found in that directory. A more recent copy of this document may be found
(e.g. aic7xxx.txt). The SCSI mid-level is briefly described in scsi.txt
at http://www.torque.net/scsi/scsi_mid_low_api.txt.gz .
(with a url to a document describing the SCSI subsystem in the lk 2.4
Many LLDs are documented there (e.g. aic7xxx.txt). The SCSI mid-level is
series). Two upper level drivers have documents in that directory:
briefly described in scsi.txt which contains a url to a document
st.txt (SCSI tape driver) and scsi-generic.txt (for the sg driver).
describing the SCSI subsystem in the lk 2.4 series. Two upper level
drivers have documents in that directory: st.txt (SCSI tape driver) and
Some documentation (or urls) for LLDs may be in the C source code or
scsi-generic.txt (for the sg driver).
in the same directory as the C source code. For example to find a url
Some documentation (or urls) for LLDs may be found in the C source code
or in the same directory as the C source code. For example to find a url
about the USB mass storage driver see the
about the USB mass storage driver see the
/usr/src/linux/drivers/usb/storage directory.
/usr/src/linux/drivers/usb/storage directory.
...
@@ -69,12 +71,12 @@ initialization code where there are now 2 models available. The older
...
@@ -69,12 +71,12 @@ initialization code where there are now 2 models available. The older
one, similar to what was found in the lk 2.4 series, is based on hosts
one, similar to what was found in the lk 2.4 series, is based on hosts
that are detected at HBA driver load time. This will be referred to
that are detected at HBA driver load time. This will be referred to
the "passive" initialization model. The newer model allows HBAs to be
the "passive" initialization model. The newer model allows HBAs to be
hot
plugged (and unplugged) while the driver is loaded
and will be
hot
plugged (and unplugged) during the lifetime of the LLD
and will be
referred to as the "hotplug" initialization model. The newer model is
referred to as the "hotplug" initialization model. The newer model is
preferred as it can handle both traditional SCSI equipment that is
preferred as it can handle both traditional SCSI equipment that is
permanently connected as well as modern "SCSI"
usb-storage devices
permanently connected as well as modern "SCSI"
devices (e.g. USB or
(e.g. digital cameras) that are hotplugged. Both initialization models
IEEE 1394 connected digital cameras) that are hotplugged. Both
are discussed in the following sections.
initialization models
are discussed in the following sections.
A LLD interfaces to the SCSI subsystem several ways:
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
...
@@ -90,21 +92,27 @@ supplied functions" below.
...
@@ -90,21 +92,27 @@ 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. Their 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
scsi_host_template", an instance of which is passed to
scsi_
register_host() in the passive initialization model]. Those interface
scsi_
host_alloc() ** . Those interface functions that the LLD does not
functions that are not mandatory and that the LLD does not wish to supply
wish to supply should have NULL placed in the corresponding member of
s
hould have NULL placed in the corresponding member of struct SHT.
s
truct scsi_host_template. Defining an instance of struct
[Defining an instance of struct SHT at file scope will cause NULL to be
scsi_host_template at file scope will cause NULL to be placed in function
placed in function pointer members not explicitly initialized.]
pointer members not explicitly initialized.
Those instances in group c) are slowly being removed as they tend to be
Those usages in group c) should be handled with care, especially in a
"racy" especially in a hotplug environment.
"hotplug" environment. LLDs should be aware of the lifetime of instances
that are shared with the mid level and other layers.
All functions defined within a LLD and all data defined at file scope
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
should be static. For example the slave_alloc() function in a LLD
called "xxx" could be defined as
called "xxx" could be defined as
"static int xxx_slave_alloc(struct scsi_device * sdev) { /* code */ }"
"static int xxx_slave_alloc(struct scsi_device * sdev) { /* code */ }"
** the scsi_host_alloc() function is a replacement for the rather vaguely
named scsi_register() function in most situations. The scsi_register()
and scsi_unregister() functions remain to support legacy LLDs that use
the passive initialization model.
Hotplug initialization model
Hotplug initialization model
============================
============================
...
@@ -116,13 +124,6 @@ detected. After confirming that the new device is one that the LLD wants
...
@@ -116,13 +124,6 @@ detected. After confirming that the new device is one that the LLD wants
to control, the LLD will initialize the HBA and then register a new host
to control, the LLD will initialize the HBA and then register a new host
with the SCSI mid level.
with the SCSI mid level.
Hot unplugging a HBA that controls a disk which is processing SCSI
commands on a mounted file system is an ugly situation. Issues with
this scenario are still being worked through. The primary concern is
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.
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
...
@@ -135,10 +136,10 @@ is a typical sequence of calls between the LLD and the mid level.
...
@@ -135,10 +136,10 @@ is a typical sequence of calls between the LLD and the mid level.
This example shows the mid level scanning the newly introduced HBA for 3
This example shows the mid level scanning the newly introduced HBA for 3
scsi devices of which only the first 2 respond:
scsi devices of which only the first 2 respond:
[HBA PROBE]
HBA PROBE: assume 2 SCSI devices found in scan
LLD mid level LLD
LLD mid level LLD
--- ---------
---
===-------------------=========--------------------===---
---
scsi_
register
() -->
scsi_
host_alloc
() -->
scsi_add_host() --------+
scsi_add_host() --------+
|
|
slave_alloc()
slave_alloc()
...
@@ -147,79 +148,107 @@ scsi_add_host() --------+
...
@@ -147,79 +148,107 @@ scsi_add_host() --------+
slave_alloc()
slave_alloc()
slave_configure()
slave_configure()
|
|
slave_alloc() **
slave_alloc() ***
slave_destroy() **
slave_destroy() ***
------------------------------------------------------------
If the LLD wants to adjust the default queue settings, it can invoke
If the LLD wants to adjust the default queue settings, it can invoke
scsi_adjust_queue_depth() in its slave_configure() routine.
scsi_adjust_queue_depth() in its slave_configure() routine.
** For scsi devices that the mid level tries to scan but do not
**
*
For scsi devices that the mid level tries to scan but do not
respond, a slave_alloc(), slave_destroy() pair is called.
respond, a slave_alloc(), slave_destroy() pair is called.
Here is the corresponding sequence when a host (HBA) is being
When a HBA is being removed is could as part of an orderly shutdown
removed:
associated with the LLD module being unloaded (e.g. with the "rmmod"
command) or in response to a "hot unplug" indicated by sysfs()'s
remove() callback being invoked. In either case, the sequence is the
same:
[HBA REMOVE]
HBA REMOVE: assume 2 SCSI devices attached
LLD mid level LLD
LLD mid level LLD
--- ---------
---
===----------------------=========-----------------===---
---
scsi_remove_host() ---------+
scsi_remove_host() ---------+
|
|
slave_destroy()
slave_destroy()
slave_destroy()
slave_destroy()
release() --> scsi_unregister()
scsi_host_put()
------------------------------------------------------------
It is practical for a LLD to keep track of struct Scsi_Host instances
It may be useful 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_host_alloc()). Such instances are "owned"
instances (a pointer is passed as the parameter to slave_alloc() and
by the mid-level. struct Scsi_Host instances are freed from
slave_configure() ). Both classes of instances are "owned" by the
scsi_host_put() when the reference count hits zero.
mid-level. struct scsi_device instances are freed after slave_destroy().
struct Scsi_Host instances are freed within scsi_unregister().
TODO:
Hot unplugging a HBA that controls a disk which is processing SCSI
Descriptions, are the following correct?
commands on a mounted file system is an interesting situation. Reference
[DEVICE hotplug]
counting logic is being introduced into the mid level to cope with many
of the issues involved. See the section on reference counting below.
The hotplug concept may be extended to SCSI devices. Currently, when a
HBA is added, the scsi_add_host() function causes a scan for SCSI devices
attached to the HBA's SCSI transport. On newer SCSI transports the HBA
may become aware of a new SCSI device _after_ the scan has completed.
A LLD can use this sequence to make the mid level aware of a SCSI device:
SCSI DEVICE hotplug
LLD mid level LLD
LLD mid level LLD
--- ---------
---
===-------------------=========--------------------===---
---
scsi_add_device() ------+
scsi_add_device() ------+
|
|
slave_alloc()
slave_alloc()
slave_configure() [--> scsi_adjust_queue_depth()]
slave_configure() [--> scsi_adjust_queue_depth()]
------------------------------------------------------------
[DEVICE unplug]
In a similar fashion, a LLD may become aware that a SCSI device has been
removed (unplugged) or the connection to it has been interrupted. Some
existing SCSI transports (e.g. SPI) may not become aware that a SCSI
device has been removed until a subsequent SCSI command fails which will
probably cause that device to be set offline by the mid level. A LLD that
detects the removal of a SCSI device can instigate its removal from
upper layers with this sequence:
SCSI DEVICE hot unplug
LLD mid level LLD
LLD mid level LLD
--- ---------
---
===----------------------=========-----------------===---
---
scsi_set_device_offline()
scsi_set_device_offline()
scsi_remove_device() -------+
scsi_remove_device() -------+
|
|
slave_destroy()
slave_destroy()
------------------------------------------------------------
It may be useful for a LLD to keep track of struct scsi_device instances
(a pointer is passed as the parameter to slave_alloc() and
slave_configure() callbacks). Such instances are "owned" by the mid-level.
struct scsi_device instances are freed after slave_destroy().
Passive initialization model
Passive initialization model
============================
============================
LLD initialization (both built-in and module) and shutdown are "wired
These older LLDs include a file called "scsi_module.c" [yes the ".c" is a
up" by passing function pointers to the module_init() and module_exit()
little surprising] in their source code. For that file to work an
macros respectively. In this model the function identified by "module_init"
instance of struct scsi_host_template with the name "driver_template"
must call scsi_register_host() and the function identified by "module_exit"
needs to be defined. Here is a typical code sequence used in this model:
must call scsi_unregister_host().
static struct scsi_host_template driver_template = {
Most LLDs inherited from the lk 2.4 series include a file called
...
"scsi_module.c" [yes the ".c" is a little surprising] in their
};
source code. For that file to work a declaration like this is needed before
it is included:
static struct SHT driver_template = DRIVER_TEMPLATE;
#include "scsi_module.c"
#include "scsi_module.c"
In this case "DRIVER_TEMPLATE" is defined to be a structure initializer
The scsi_module.c file contains two functions:
that is placed in the driver header file by convention. It contains
- init_this_scsi_driver() which is executed when the LLD is
pointers to supported interface functions and other values.
initialized (i.e. boot time or module load time)
- exit_this_scsi_driver() which is executed when the LLD is shut
down (i.e. module unload time)
Note: since these functions are tagged with __init and __exit qualifiers
a LLD should not call them explicitly (since the kernel does that).
Here is an example of an initialization sequence when two hosts are
Here is an example of an initialization sequence when two hosts are
detected (so detect() returns 2) and the SCSI bus scan on each host
detected (so detect() returns 2) and the SCSI bus scan on each host
finds 1 SCSI device (and a second device does not respond).
finds 1 SCSI device (and a second device does not respond).
LLD mid level LLD
LLD mid level LLD
--- ---------
---
===----------------------=========-----------------===---
---
scsi_register_host() ---
----+
init_this_scsi_driver()
----+
|
|
detect() -----------------+
detect() -----------------+
| |
| |
...
@@ -228,52 +257,77 @@ scsi_register_host() -------+
...
@@ -228,52 +257,77 @@ scsi_register_host() -------+
|
|
slave_alloc()
slave_alloc()
slave_configure() --> scsi_adjust_queue_depth()
slave_configure() --> scsi_adjust_queue_depth()
slave_alloc()
**
slave_alloc() *
**
slave_destroy()
**
slave_destroy() *
**
|
|
slave_alloc()
slave_alloc()
slave_configure()
slave_configure()
slave_alloc() **
slave_alloc() ***
slave_destroy() **
slave_destroy() ***
------------------------------------------------------------
The mid level invokes scsi_adjust_queue_depth() with tagged queuing off and
The mid level invokes scsi_adjust_queue_depth() with tagged queuing off and
"cmd_per_lun" for that host as the queue length. These settings can be
"cmd_per_lun" for that host as the queue length. These settings can be
overridden by a slave_configure() supplied by the LLD.
overridden by a slave_configure() supplied by the LLD.
** For scsi devices that the mid level tries to scan but do not
**
*
For scsi devices that the mid level tries to scan but do not
respond, a slave_alloc(), slave_destroy() pair is called.
respond, a slave_alloc(), slave_destroy() pair is called.
Here is a LLD shutdown sequence:
Here is a LLD shutdown sequence:
LLD mid level LLD
LLD mid level LLD
--- ---------
---
===----------------------=========-----------------===---
---
scsi_unregister_host() -
----+
exit_this_scsi_driver()
----+
|
|
slave_destroy()
slave_destroy()
release() --> scsi_unregister()
release() --> scsi_unregister()
|
|
slave_destroy()
slave_destroy()
release() --> scsi_unregister()
release() --> scsi_unregister()
------------------------------------------------------------
slave_destroy() is optional
.
A LLD need not define slave_destroy() (i.e. it is optional)
.
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
and shutdown. Once the LLD is initialized then a new host that appears
and shutdown. Once the LLD is initialized then a new host that appears
(e.g. via hotplugging) cannot easily be added without a redundant
(e.g. via hotplugging) cannot easily be added without a redundant
driver shutdown and re-initialization.
driver shutdown and re-initialization. It may be possible to write a LLD
that uses both initialization models.
Reference Counting
==================
The Scsi_Host structure has had reference counting infrastructure added.
This effectively spreads the ownership of struct Scsi_Host instances
across the various SCSI layers which use them. Previously such instances
were exclusively owned by the mid level. LLDs would not usually need to
directly manipulate these reference counts but there may be some cases
where they do.
There are 3 reference counting functions of interest associated with
struct Scsi_Host:
- scsi_host_alloc(): returns a pointer to new instance of struct
Scsi_Host which has its reference count ^^ set to 1
- scsi_host_get(): adds 1 to the reference count of the given instance
- scsi_host_put(): decrements 1 from the reference count of the given
instance. If the reference count reaches 0 then the given instance
is freed
^^ struct Scsi_Host actually has 2 reference counts which are manipulated
in parallel by these functions.
Conventions
Conventions
===========
===========
First, Linus
's thoughts on C coding can be found in the file
First, Linus
Torvald's thoughts on C coding style can be found in the
Documentation/CodingStyle .
Documentation/CodingStyle
file
.
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,
but
"typedef struct SHT { ...} Scsi_Host_Template;" in hosts.h . In this
the typedefs have been moved to a single file, scsi_typedefs.h to
case "struct SHT" is preferred to "Scsi_Host_Template". [The poor naming
make their future removal easier, for example:
example was chosen with malevolent intent.]
"typedef struct scsi_host_template Scsi_Host_Template;"
Also, C99 enhancements 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
...
@@ -304,9 +358,11 @@ Summary:
...
@@ -304,9 +358,11 @@ Summary:
scsi_bios_ptable - return copy of block device's partition table
scsi_bios_ptable - return copy of block device's partition table
scsi_block_requests - prevent further commands being queued to given host
scsi_block_requests - prevent further commands being queued to given host
scsi_delete_timer - cancel timer on a SCSI command.
scsi_delete_timer - cancel timer on a SCSI command.
scsi_host_alloc - return a new scsi_host instance whose refcount==1
scsi_host_get - increments Scsi_Host instance's refcount
scsi_host_put - decrements Scsi_Host instance's refcount (free if 0)
scsi_partsize - parse partition table into cylinders, heads + sectors
scsi_partsize - parse partition table into cylinders, heads + sectors
scsi_register - create and register a scsi host adapter instance.
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_device - detach and remove a SCSI device
scsi_remove_host - detach and remove all SCSI devices owned by host
scsi_remove_host - detach and remove all SCSI devices owned by host
scsi_report_bus_reset - report scsi _bus_ reset observed
scsi_report_bus_reset - report scsi _bus_ reset observed
...
@@ -316,8 +372,8 @@ Summary:
...
@@ -316,8 +372,8 @@ Summary:
scsi_to_sbus_dma_dir - convert SCSI subsystem direction flag to SBUS
scsi_to_sbus_dma_dir - convert SCSI subsystem direction flag to SBUS
scsi_track_queue_full - track successive QUEUE_FULL events
scsi_track_queue_full - track successive QUEUE_FULL events
scsi_unblock_requests - allow further commands to be queued to given host
scsi_unblock_requests - allow further commands to be queued to given host
scsi_unregister -
unregister and free memory used by host instance
scsi_unregister -
[calls scsi_host_put()]
scsi_unregister_host - unregister a low level host adapter driver
Details:
Details:
...
@@ -354,7 +410,7 @@ struct scsi_device * scsi_add_device(struct Scsi_Host *shost,
...
@@ -354,7 +410,7 @@ struct scsi_device * scsi_add_device(struct Scsi_Host *shost,
* 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_host_alloc
().
*
*
* Defined in: drivers/scsi/hosts.c
* Defined in: drivers/scsi/hosts.c
**/
**/
...
@@ -376,8 +432,8 @@ int scsi_add_host(struct Scsi_Host *shost, struct device * dev)
...
@@ -376,8 +432,8 @@ int scsi_add_host(struct Scsi_Host *shost, struct device * dev)
*
*
* 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(
struct scsi_cmnd *scmd, int timeout,
(Scsi_C
mnd *))
void (*complete)(struct scsi_c
mnd *))
/**
/**
...
@@ -458,7 +514,56 @@ void scsi_block_requests(struct Scsi_Host * SHpnt)
...
@@ -458,7 +514,56 @@ void scsi_block_requests(struct Scsi_Host * SHpnt)
*
*
* 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(struct scsi_cmnd *scmd)
/**
* scsi_host_alloc - create and register a scsi host adapter instance.
* @shost_tp: pointer to scsi host template
* @xtr_bytes: extra bytes to allocate in hostdata array (which is the
* last member of the returned Scsi_Host instance)
*
* Returns pointer to new Scsi_Host instance or NULL on failure
*
* Notes: When this call returns to the LLDD, the SCSI bus scan on
* this host has _not_ yet been done.
* The hostdata array (by default zero length) is a per host scratch
* area for the LLD.
* Both associated refcounting objects have there refcount set to 1.
*
* Defined in: drivers/scsi/hosts.c .
**/
struct Scsi_Host * scsi_host_alloc(struct scsi_host_template *, int xtr_bytes)
/**
* scsi_host_get - increment Scsi_Host instance refcount
* @shost: pointer to struct Scsi_Host instance
*
* Returns nothing
*
* Notes: Actually increments the counts in two sub-objects
*
* Defined in: drivers/scsi/hosts.c
**/
void scsi_host_get(struct Scsi_Host *shost)
/**
* scsi_host_put - decrement Scsi_Host instance refcount, free if 0
* @shost: pointer to struct Scsi_Host instance
*
* Returns nothing
*
* Notes: Actually decrements the counts in two sub-objects. If the
* latter refcount reaches 0, the Scsi_Host instance is freed.
* The LLD need not worry exactly when the Scsi_Host instance is
* freed, it just shouldn't access the instance after it has balanced
* out its refcount usage.
*
* Defined in: drivers/scsi/hosts.c
**/
void scsi_host_put(struct Scsi_Host *shost)
/**
/**
...
@@ -494,25 +599,7 @@ int scsi_partsize(unsigned char *buf, unsigned long capacity,
...
@@ -494,25 +599,7 @@ int scsi_partsize(unsigned char *buf, unsigned long capacity,
*
*
* 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 scsi_host_template *, int xtr_bytes)
/**
* scsi_register_host - register a low level host driver
* @shost_tp: pointer to a scsi host driver template
*
* Returns 0 on Success, 1 on failure
*
* Notes: Should only be invoked if the "passive initialization
* model" is being used. Notice this is a _driver_ rather than
* HBA registration function. Most older drivers call this
* function by including the scsi_module.c file.
* This function is deprecated, use the "hotplug initialization
* model" instead.
*
* Defined in: drivers/scsi/hosts.c .
**/
int scsi_register_host(Scsi_Host_Template *shost_tp)
/**
/**
...
@@ -668,48 +755,26 @@ void scsi_unblock_requests(struct Scsi_Host * SHpnt)
...
@@ -668,48 +755,26 @@ void scsi_unblock_requests(struct Scsi_Host * SHpnt)
void scsi_unregister(struct Scsi_Host * shp)
void scsi_unregister(struct Scsi_Host * shp)
/**
* scsi_unregister_host - unregister a low level host adapter driver
* @shost_tp: scsi host template to unregister.
*
* Returns 0 on Success, 1 on Failure
*
* Notes: Should only be invoked if the "passive initialization
* model" is being used. Notice this is a _driver_ rather than
* HBA deregistration function. So if there are multiple HBAs
* associated with the given template, they are each removed. Most
* older drivers call this function by including the scsi_module.c
* file. This function is deprecated, use the "hotplug initialization
* model" instead.
*
* Defined in: drivers/scsi/hosts.c .
**/
int scsi_unregister_host(Scsi_Host_Template *shost_tp)
Interface Functions
Interface Functions
===================
===================
Interface functions are supplied (defined) by LLDs and
Interface functions are supplied (defined) by LLDs and
their function
their function pointers are placed in an instance of struct SHT
which
pointers are placed in an instance of struct scsi_host_template
which
is passed to scsi_
register() [or scsi_register_host()]. Some
is passed to scsi_
host_alloc() [or scsi_register() / init_this_scsi_driver()].
are mandatory. Interface functions should be declared static. The
Some are mandatory. Interface functions should be declared static. The
accepted convention is that driver "xyz" will declare its slave_configure()
accepted convention is that driver "xyz" will declare its slave_configure()
function as:
function as:
static int xyz_slave_configure(struct scsi_device * sdev);
static int xyz_slave_configure(struct scsi_device * sdev);
A pointer to this function should be placed in the 'slave_configure' member
A pointer to this function should be placed in the 'slave_configure' member
of a "struct SHT" instance. A pointer to such an instance should
of a "struct scsi_host_template" instance. A pointer to such an instance
passed to the mid level's scsi_register() [or scsi_register_host()].
should passed to the mid level's scsi_host_alloc() [or scsi_register() /
init_this_scsi_driver()].
The interface functions are also described in the hosts.h file immediately
The interface functions are also described in the hosts.h file immediately
above their definition point in "struct SHT". In some cases more detail
above their definition point in "struct scsi_host_template". In some cases
is given in hosts.h than below.
more detail is given in hosts.h than below.
Those interface functions marked "Required: yes" must be implemented
by the LLD and a pointer to that function must be placed in the driver's
"struct SHT" instance. Interface functions marked "Required: no" need not
be implemented.
The interface functions are listed below in alphabetical order.
The interface functions are listed below in alphabetical order.
...
@@ -731,6 +796,7 @@ Summary:
...
@@ -731,6 +796,7 @@ Summary:
slave_configure - driver fine tuning for given device after attach
slave_configure - driver fine tuning for given device after attach
slave_destroy - given device is about to be shut down
slave_destroy - given device is about to be shut down
Details:
Details:
/**
/**
...
@@ -745,8 +811,6 @@ Details:
...
@@ -745,8 +811,6 @@ Details:
*
*
* Return value is ignored
* Return value is ignored
*
*
* Required: no
*
* Locks: none
* Locks: none
*
*
* Notes: an arbitrary geometry (based on READ CAPACITY) is used
* Notes: an arbitrary geometry (based on READ CAPACITY) is used
...
@@ -754,10 +818,10 @@ Details:
...
@@ -754,10 +818,10 @@ Details:
* 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.
*
*
*
D
efined in: LLD
*
Optionally d
efined 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])
/**
/**
...
@@ -768,18 +832,16 @@ Details:
...
@@ -768,18 +832,16 @@ Details:
* host_byte, driver_byte (status_byte is in the lsb). A value of
* host_byte, driver_byte (status_byte is in the lsb). A value of
* 0 is an unqualified success.
* 0 is an unqualified success.
*
*
* Required: if struct Scsi_Host::can_queue can ever by cleared (zero)
* then this function is required.
*
* Locks: struct Scsi_Host::host_lock held on entry (with "irqsave")
* Locks: struct Scsi_Host::host_lock held on entry (with "irqsave")
* and is expected to be held on return.
* and is expected to be held on return.
*
*
* 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
* Defined in: LLD (if struct Scsi_Host::can_queue can ever by cleared
* (zero) then this function is required)
**/
**/
int command(struct scsi_cmnd * scp)
;
int command(struct scsi_cmnd * scp)
/**
/**
...
@@ -789,9 +851,6 @@ Details:
...
@@ -789,9 +851,6 @@ Details:
* Returns number of hosts this driver wants to control. 0 means no
* Returns number of hosts this driver wants to control. 0 means no
* suitable hosts found.
* suitable hosts found.
*
*
* Required: yes, if "passive initialization mode" is used
* [in "hotplug initialization mode" it is not invoked]
*
* Locks: none held
* Locks: none held
*
*
* Notes: First function called from the SCSI mid level on this
* Notes: First function called from the SCSI mid level on this
...
@@ -799,9 +858,10 @@ Details:
...
@@ -799,9 +858,10 @@ Details:
* 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
* Defined in: LLD (required if "passive initialization mode" is used,
* not invoked in "hotplug initialization mode")
**/
**/
int detect(struct
SHT * shtp);
int detect(struct
scsi_host_template * shtp)
/**
/**
...
@@ -810,17 +870,15 @@ Details:
...
@@ -810,17 +870,15 @@ Details:
*
*
* Returns SUCCESS if command aborted else FAILED
* Returns SUCCESS if command aborted else FAILED
*
*
* 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.
*
*
*
D
efined in: LLD
*
Optionally d
efined in: LLD
**/
**/
int eh_abort_handler(struct scsi_cmnd * scp)
;
int eh_abort_handler(struct scsi_cmnd * scp)
/**
/**
...
@@ -829,17 +887,15 @@ Details:
...
@@ -829,17 +887,15 @@ Details:
*
*
* Returns SUCCESS if command aborted else FAILED
* Returns SUCCESS if command aborted else FAILED
*
*
* 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.
*
*
*
D
efined in: LLD
*
Optionally d
efined in: LLD
**/
**/
int eh_bus_reset_handler(struct scsi_cmnd * scp)
;
int eh_bus_reset_handler(struct scsi_cmnd * scp)
/**
/**
...
@@ -848,17 +904,15 @@ Details:
...
@@ -848,17 +904,15 @@ Details:
*
*
* Returns SUCCESS if command aborted else FAILED
* Returns SUCCESS if command aborted else FAILED
*
*
* 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.
*
*
*
D
efined in: LLD
*
Optionally d
efined in: LLD
**/
**/
int eh_device_reset_handler(struct scsi_cmnd * scp)
;
int eh_device_reset_handler(struct scsi_cmnd * scp)
/**
/**
...
@@ -867,8 +921,6 @@ Details:
...
@@ -867,8 +921,6 @@ Details:
*
*
* Returns SUCCESS if command aborted else FAILED
* Returns SUCCESS if command aborted else FAILED
*
*
* 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.
*
*
...
@@ -879,9 +931,9 @@ Details:
...
@@ -879,9 +931,9 @@ Details:
* 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.
*
*
*
D
efined in: LLD
*
Optionally d
efined in: LLD
**/
**/
int eh_host_reset_handler(struct scsi_cmnd * scp)
;
int eh_host_reset_handler(struct scsi_cmnd * scp)
/**
/**
...
@@ -890,16 +942,14 @@ Details:
...
@@ -890,16 +942,14 @@ Details:
*
*
* Returns TRUE if host unjammed, else FALSE.
* Returns TRUE if host unjammed, else FALSE.
*
*
* Required: no
*
* Locks: none
* Locks: none
*
*
* Notes: Invoked from scsi_eh thread.
Driver
supplied alternate to
* Notes: Invoked from scsi_eh thread.
LLD
supplied alternate to
* scsi_unjam_host() found in scsi_error.c
* scsi_unjam_host() found in scsi_error.c
*
*
*
D
efined in: LLD
*
Optionally d
efined in: LLD
**/
**/
int eh_strategy_handler(struct Scsi_Host * shp)
;
int eh_strategy_handler(struct Scsi_Host * shp)
/**
/**
...
@@ -911,8 +961,6 @@ Details:
...
@@ -911,8 +961,6 @@ Details:
* manage the memory pointed to and maintain it, typically for the
* manage the memory pointed to and maintain it, typically for the
* lifetime of this host.]
* lifetime of this host.]
*
*
* Required: no
*
* Locks: none
* Locks: none
*
*
* Notes: Often supplies PCI or ISA information such as IO addresses
* Notes: Often supplies PCI or ISA information such as IO addresses
...
@@ -922,14 +970,14 @@ Details:
...
@@ -922,14 +970,14 @@ Details:
* The SCSI_IOCTL_PROBE_HOST ioctl yields the string returned by this
* The SCSI_IOCTL_PROBE_HOST ioctl yields the string returned by this
* function (or struct Scsi_Host::name if this function is not
* function (or struct Scsi_Host::name if this function is not
* available).
* available).
* In a similar manner,
scsi_register_host
() outputs to the console
* In a similar manner,
init_this_scsi_driver
() outputs to the console
* 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.
*
*
*
D
efined in: LLD
*
Optionally d
efined in: LLD
**/
**/
const char * info(struct Scsi_Host * shp)
;
const char * info(struct Scsi_Host * shp)
/**
/**
...
@@ -944,8 +992,6 @@ Details:
...
@@ -944,8 +992,6 @@ Details:
* Returns negative "errno" value when there is a problem. 0 or a
* Returns negative "errno" value when there is a problem. 0 or a
* positive value indicates success and is returned to the user space.
* positive value indicates success and is returned to the user space.
*
*
* Required: no
*
* Locks: none
* Locks: none
*
*
* Notes: The SCSI subsystem uses a "trickle down" ioctl model.
* Notes: The SCSI subsystem uses a "trickle down" ioctl model.
...
@@ -960,9 +1006,9 @@ Details:
...
@@ -960,9 +1006,9 @@ Details:
* 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.
*
*
*
D
efined in: LLD
*
Optionally d
efined in: LLD
**/
**/
int ioctl(struct scsi_device *sdp, int cmd, void *arg)
;
int ioctl(struct scsi_device *sdp, int cmd, void *arg)
/**
/**
...
@@ -983,16 +1029,14 @@ Details:
...
@@ -983,16 +1029,14 @@ Details:
* Returns length when 1==writeto1_read0. Otherwise number of chars
* Returns length when 1==writeto1_read0. Otherwise number of chars
* output to buffer past offset.
* output to buffer past offset.
*
*
* Required: no
*
* 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
*
*
*
D
efined in: LLD
*
Optionally d
efined 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)
/**
/**
...
@@ -1000,13 +1044,10 @@ int proc_info(char * buffer, char ** start, off_t offset,
...
@@ -1000,13 +1044,10 @@ int proc_info(char * buffer, char ** start, off_t offset,
* @scp: pointer to scsi command object
* @scp: pointer to scsi command object
* @done: function pointer to be invoked on completion
* @done: function pointer to be invoked on completion
*
*
* Returns 1 if the adapter (host) is busy, else returns 0. One
* Returns 0 on success and 1 if the LLD or the HBA is busy (i.e. run
* reason for an adapter to be busy is that the number
* out of resources to queue further commands). Other types of errors
* of outstanding queued commands is already equal to
* are flagged by setting struct scsi_cmnd:result to an appropriate
* struct Scsi_Host::can_queue .
* value, invoking the 'done' callback, and then returning 0.
*
* Required: if struct Scsi_Host::can_queue is ever non-zero
* then this function is required.
*
*
* Locks: struct Scsi_Host::host_lock held on entry (with "irqsave")
* Locks: struct Scsi_Host::host_lock held on entry (with "irqsave")
* and is expected to be held on return.
* and is expected to be held on return.
...
@@ -1028,10 +1069,11 @@ int proc_info(char * buffer, char ** start, off_t offset,
...
@@ -1028,10 +1069,11 @@ int proc_info(char * buffer, char ** start, off_t offset,
* 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
* Defined in: LLD (required if if struct Scsi_Host::can_queue is ever
* non-zero)
**/
**/
int queuecommand(struct scsi_cmnd * scp,
int queuecommand(struct scsi_cmnd * scp,
void (*done)(struct scsi_cmnd *));
void (*done)(struct scsi_cmnd *))
/**
/**
...
@@ -1040,20 +1082,17 @@ int proc_info(char * buffer, char ** start, off_t offset,
...
@@ -1040,20 +1082,17 @@ int proc_info(char * buffer, char ** start, off_t offset,
*
*
* Return value ignored (could soon be a function returning void).
* Return value ignored (could soon be a function returning void).
*
*
* Required: yes (see notes)
*
* Locks: none held
* Locks: none held
*
*
* Notes: Invoked from
mid level's scsi_unregister_host
().
* Notes: Invoked from
scsi_module.c's exit_this_scsi_driver
().
* LLD's implementation of this function should call
* LLD's implementation of this function should call
* scsi_unregister(shp) prior to returning.
* scsi_unregister(shp) prior to returning.
* If not supplied mid-level [in hosts.c] supplies its own
* Only needed for old-style host templates.
* implementation (see scsi_host_legacy_release()) which is for old
* ISA adapters so it is best not to use it.
*
*
* Defined in: LLD
* Defined in: LLD (required in "passive initialization model",
* should not be defined in hotplug model)
**/
**/
int release(struct Scsi_Host * shp)
;
int release(struct Scsi_Host * shp)
/**
/**
...
@@ -1064,8 +1103,6 @@ int proc_info(char * buffer, char ** start, off_t offset,
...
@@ -1064,8 +1103,6 @@ int proc_info(char * buffer, char ** start, off_t offset,
* Returns 0 if ok. Any other return is assumed to be an error and
* Returns 0 if ok. Any other return is assumed to be an error and
* the device is ignored.
* the device is ignored.
*
*
* Required: no
*
* Locks: none
* Locks: none
*
*
* Notes: Allows the driver to allocate any resources for a device
* Notes: Allows the driver to allocate any resources for a device
...
@@ -1076,9 +1113,9 @@ int proc_info(char * buffer, char ** start, off_t offset,
...
@@ -1076,9 +1113,9 @@ int proc_info(char * buffer, char ** start, off_t offset,
* slave_destroy() is called.
* slave_destroy() is called.
* For more details see the hosts.h file.
* For more details see the hosts.h file.
*
*
*
D
efined in: LLD
*
Optionally d
efined in: LLD
**/
**/
int slave_alloc(struct scsi_device *sdp)
;
int slave_alloc(struct scsi_device *sdp)
/**
/**
...
@@ -1091,17 +1128,15 @@ int proc_info(char * buffer, char ** start, off_t offset,
...
@@ -1091,17 +1128,15 @@ int proc_info(char * buffer, char ** start, off_t offset,
* the device is taken offline. [offline devices will _not_ have
* the device is taken offline. [offline devices will _not_ have
* slave_destroy() called on them so clean up resources.]
* slave_destroy() called on them so clean up resources.]
*
*
* Required: no
*
* Locks: none
* Locks: none
*
*
* Notes: Allows the driver to inspect the response to the initial
* Notes: Allows the driver to inspect the response to the initial
* INQUIRY done by the scanning code and take appropriate action.
* INQUIRY done by the scanning code and take appropriate action.
* For more details see the hosts.h file.
* For more details see the hosts.h file.
*
*
*
D
efined in: LLD
*
Optionally d
efined in: LLD
**/
**/
int slave_configure(struct scsi_device *sdp)
;
int slave_configure(struct scsi_device *sdp)
/**
/**
...
@@ -1111,8 +1146,6 @@ int proc_info(char * buffer, char ** start, off_t offset,
...
@@ -1111,8 +1146,6 @@ int proc_info(char * buffer, char ** start, off_t offset,
*
*
* Returns nothing
* Returns nothing
*
*
* Required: no
*
* Locks: none
* Locks: none
*
*
* Notes: Mid level structures for given device are still in place
* Notes: Mid level structures for given device are still in place
...
@@ -1123,17 +1156,17 @@ int proc_info(char * buffer, char ** start, off_t offset,
...
@@ -1123,17 +1156,17 @@ int proc_info(char * buffer, char ** start, off_t offset,
* 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.]
*
*
*
D
efined in: LLD
*
Optionally d
efined in: LLD
**/
**/
void slave_destroy(struct scsi_device *sdp)
;
void slave_destroy(struct scsi_device *sdp)
Data Structures
Data Structures
===============
===============
struct
SHT
struct
scsi_host_template
----------
----------
---------------
There is one "struct
SHT
" instance per LLD ***. It is
There is one "struct
scsi_host_template
" 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:
...
@@ -1143,22 +1176,23 @@ Member of interest:
...
@@ -1143,22 +1176,23 @@ Member of interest:
by sysfs in one of its "drivers" directories. Hence
by sysfs in one of its "drivers" directories. Hence
"proc_name" should only contain characters acceptable
"proc_name" should only contain characters acceptable
to a Unix file name.
to a Unix file name.
(*
release)() - should be defined by all LLDs as the default (legacy)
(*
queuecommand)() - primary callback that the mid level uses to inject
implementation is only appropriate for ISA adapters)
.
SCSI commands into a LLD
.
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.
a LLD
advansys driver handles both ISA and PCI cards and has a separate
that handles both ISA and PCI cards and has a separate instance of
instance of struct SHT for each
).
struct scsi_host_template for each class
).
struct Scsi_Host
struct Scsi_Host
----------------
----------------
There is one struct Scsi_Host instance per host (HBA) that a LLD
There is one struct Scsi_Host instance per host (HBA) that a LLD
controls. The struct Scsi_Host structure has many members in common
controls. The struct Scsi_Host structure has many members in common
with "struct SHT". When a new struct Scsi_Host instance is created (in
with "struct scsi_host_template". When a new struct Scsi_Host instance
scsi_register() in hosts.c) those common members are initialized from
is created (in scsi_host_alloc() in hosts.c) those common members are
the driver's struct SHT instance. Members of interest:
initialized from the driver's struct scsi_host_template instance. Members
of interest:
host_no - system wide unique number that is used for identifying
host_no - system wide unique number that is used for identifying
this host. Issued in ascending order from 0 (and the
this host. Issued in ascending order from 0 (and the
positioning can be influenced by the scsihosts
positioning can be influenced by the scsihosts
...
@@ -1180,22 +1214,22 @@ the driver's struct SHT instance. Members of interest:
...
@@ -1180,22 +1214,22 @@ the driver's struct SHT instance. Members of interest:
0->disallow SCSI command merging
0->disallow SCSI command merging
highmem_io - 1->can DMA in to or out of high memory,
highmem_io - 1->can DMA in to or out of high memory,
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
scsi_host_template from which
struct Scsi_Host instance was spawned
this
struct Scsi_Host instance was spawned
sh_list - a double linked list of pointers to all struct Scsi_Host
sh_list - a double linked list of pointers to all struct Scsi_Host
instances (currently ordered by ascending host_no)
instances (currently ordered by ascending host_no)
my_devices - a double linked list of pointers to struct scsi_device
my_devices - a double linked list of pointers to struct scsi_device
instances that belong to this host.
instances that belong to this host.
hostdata[0] - area reserved for LLD at end of struct Scsi_Host. Size
hostdata[0] - area reserved for LLD at end of struct Scsi_Host. Size
is set by the second argument (named 'xtr_bytes') to
is set by the second argument (named 'xtr_bytes') to
scsi_register().
scsi_
host_alloc() or 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
connected to a host are uniquely identified by a
c
ah
nnel number, target id and logical unit number (lun).
c
ha
nnel 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
...
@@ -1211,7 +1245,7 @@ The structure is defined in scsi.h
...
@@ -1211,7 +1245,7 @@ The structure is defined in scsi.h
Locks
Locks
=====
=====
Each struct Scsi_Host instance has a spin_lock called struct
Each struct Scsi_Host instance has a spin_lock called struct
Scsi_Host::default_lock which is initialized in scsi_
register
() [found in
Scsi_Host::default_lock which is initialized in scsi_
host_alloc
() [found in
hosts.c]. Within the same function the struct Scsi_Host::host_lock pointer
hosts.c]. Within the same function the struct Scsi_Host::host_lock pointer
is initialized to point at default_lock with the scsi_assign_lock() function.
is initialized to point at default_lock with the scsi_assign_lock() function.
Thereafter lock and unlock operations performed by the mid level use the
Thereafter lock and unlock operations performed by the mid level use the
...
@@ -1236,11 +1270,12 @@ detects a CHECK CONDITION status by either:
...
@@ -1236,11 +1270,12 @@ detects a CHECK CONDITION status by either:
to perform an extra data in phase on such responses
to perform an extra data in phase on such responses
b) or, the LLD issuing a REQUEST SENSE command itself
b) or, the LLD issuing a REQUEST SENSE command itself
Either way, the mid level decides whether the LLD has
Either way, when a status of CHECK CONDITION is detected, the mid level
performed autosense by checking struct scsi_cmnd::sense_buffer[0] . If this
decides whether the LLD has performed autosense by checking struct
byte has an upper nibble of 7 (or 0xf) then autosense is assumed to have
scsi_cmnd::sense_buffer[0] . If this byte has an upper nibble of 7 (or 0xf)
taken place. If it has another value (and this byte is initialized to 0
then autosense is assumed to have taken place. If it has another value (and
before each command) then the mid level will issue a REQUEST SENSE command.
this byte is initialized to 0 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
...
@@ -1256,7 +1291,7 @@ one per SCSI host.
...
@@ -1256,7 +1291,7 @@ one per SCSI host.
The older error handling mechanism has been removed. This means the
The older error handling mechanism has been removed. This means the
LLD interface functions abort() and reset() have been removed.
LLD interface functions abort() and reset() have been removed.
The struct
SHT
::use_new_eh_code flag has been removed.
The struct
scsi_host_template
::use_new_eh_code flag has been removed.
In the 2.4 series the SCSI subsystem configuration descriptions were
In the 2.4 series the SCSI subsystem configuration descriptions were
aggregated with the configuration descriptions from all other Linux
aggregated with the configuration descriptions from all other Linux
...
@@ -1264,9 +1299,10 @@ subsystems in the Documentation/Configure.help file. In the 2.5 series,
...
@@ -1264,9 +1299,10 @@ subsystems in the Documentation/Configure.help file. In the 2.5 series,
the SCSI subsystem now has its own (much smaller) drivers/scsi/Config.help
the SCSI subsystem now has its own (much smaller) drivers/scsi/Config.help
file.
file.
Addition of slave_alloc(), slave_configure() and slave_destroy()
.
struct SHT has been renamed to struct scsi_host_template
.
Addition of the "hotplug initialization model".
Addition of the "hotplug initialization model" and many extra functions
to support it.
Credits
Credits
...
@@ -1282,4 +1318,4 @@ The following people have contributed to this document:
...
@@ -1282,4 +1318,4 @@ The following people have contributed to this document:
Douglas Gilbert
Douglas Gilbert
dgilbert@interlog.com
dgilbert@interlog.com
29th April
2003
18th June
2003
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment