[SCSI] add supported_mode and active_mode attributes to the host

This adds supported_mode and active_mode attributes to
/sys/class/sys_host/hostX/ for specifying the mode that a lld supports
and the currently activated mode. The output format is similar to fc
rport roles:

luce:/sys/class/scsi_host/host0$ cat supported_mode
Initiator
luce:/sys/class/scsi_host/host0$ cat active_mode
Initiator

The mode values uses bitmap since we would support dual-mode llds in
the future like this:

luce:/sys/class/scsi_host/host0$ cat supported_mode
Initiator, Target

The supported_mode attribute looks at a scsi_host_template and the
active_mode attribute looks at a scsi_host. We would add a hook to a
scsi_host_template to change the active_mode attribute
dynamically. But now there is no hook since no lld supports that
feature.

Signed-off-by: FUJITA Tomonori <[email protected]>
Signed-off-by: Mike Christie <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
This commit is contained in:
FUJITA Tomonori 2007-09-01 02:02:20 +09:00 • committed by James Bottomley
commit 5dc2b89e12
3 changed files with 52 additions and 0 deletions

View file

@ -32,6 +32,9 @@ struct blk_queue_tags;
#define SG_NONE 0
#define SG_ALL 0xff
#define MODE_UNKNOWN 0x00
#define MODE_INITIATOR 0x01
#define MODE_TARGET 0x02
#define DISABLE_CLUSTERING 0
#define ENABLE_CLUSTERING 1
@ -404,6 +407,11 @@ struct scsi_host_template {
*/
unsigned char present;
/*
* This specifies the mode that a LLD supports.
*/
unsigned supported_mode:2;
/*
* true if this host adapter uses unchecked DMA onto an ISA bus.
*/
@ -574,6 +582,7 @@ struct Scsi_Host {
*/
unsigned long cmd_serial_number, cmd_pid;
unsigned active_mode:2;
unsigned unchecked_isa_dma:1;
unsigned use_clustering:1;
unsigned use_blk_tcq:1;