Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
scsi_host.h File Reference
#include <linux/device.h>
#include <linux/list.h>
#include <linux/types.h>
#include <linux/workqueue.h>
#include <linux/mutex.h>
#include <scsi/scsi.h>

Go to the source code of this file.

Data Structures

struct  scsi_host_template
 
struct  Scsi_Host
 

Macros

#define SG_NONE   0
 
#define SG_ALL   SCSI_MAX_SG_SEGMENTS
 
#define MODE_UNKNOWN   0x00
 
#define MODE_INITIATOR   0x01
 
#define MODE_TARGET   0x02
 
#define DISABLE_CLUSTERING   0
 
#define ENABLE_CLUSTERING   1
 
#define SCSI_ADAPTER_RESET   1
 
#define SCSI_FIRMWARE_RESET   2
 
#define SCSI_DEFAULT_MAX_SECTORS   1024
 
#define SCSI_DEFAULT_HOST_BLOCKED   7
 
#define DEF_SCSI_QCMD(func_name)
 
#define class_to_shost(d)   container_of(d, struct Scsi_Host, shost_dev)
 
#define shost_printk(prefix, shost, fmt, a...)   dev_printk(prefix, &(shost)->shost_gendev, fmt, ##a)
 

Enumerations

enum  { SCSI_QDEPTH_DEFAULT, SCSI_QDEPTH_QFULL, SCSI_QDEPTH_RAMP_UP }
 
enum  scsi_host_state {
  SHOST_CREATED = 1, SHOST_RUNNING, SHOST_CANCEL, SHOST_DEL,
  SHOST_RECOVERY, SHOST_CANCEL_RECOVERY, SHOST_DEL_RECOVERY
}
 
enum  scsi_host_prot_capabilities {
  SHOST_DIF_TYPE1_PROTECTION = 1 << 0, SHOST_DIF_TYPE2_PROTECTION = 1 << 1, SHOST_DIF_TYPE3_PROTECTION = 1 << 2, SHOST_DIX_TYPE0_PROTECTION = 1 << 3,
  SHOST_DIX_TYPE1_PROTECTION = 1 << 4, SHOST_DIX_TYPE2_PROTECTION = 1 << 5, SHOST_DIX_TYPE3_PROTECTION = 1 << 6
}
 
enum  scsi_host_guard_type { SHOST_DIX_GUARD_CRC = 1 << 0, SHOST_DIX_GUARD_IP = 1 << 1 }
 

Functions

int scsi_is_host_device (const struct device *)
 
int scsi_queue_work (struct Scsi_Host *, struct work_struct *)
 
void scsi_flush_work (struct Scsi_Host *)
 
struct Scsi_Hostscsi_host_alloc (struct scsi_host_template *, int)
 
int __must_check scsi_add_host_with_dma (struct Scsi_Host *, struct device *, struct device *)
 
void scsi_scan_host (struct Scsi_Host *)
 
void scsi_rescan_device (struct device *)
 
void scsi_remove_host (struct Scsi_Host *)
 
struct Scsi_Hostscsi_host_get (struct Scsi_Host *)
 
void scsi_host_put (struct Scsi_Host *t)
 
struct Scsi_Hostscsi_host_lookup (unsigned short)
 
const charscsi_host_state_name (enum scsi_host_state)
 
void scsi_cmd_get_serial (struct Scsi_Host *, struct scsi_cmnd *)
 
u64 scsi_calculate_bounce_limit (struct Scsi_Host *)
 
void scsi_unblock_requests (struct Scsi_Host *)
 
void scsi_block_requests (struct Scsi_Host *)
 
struct request_queue__scsi_alloc_queue (struct Scsi_Host *shost, void(*)(struct request_queue *))
 
void scsi_free_host_dev (struct scsi_device *)
 
struct scsi_devicescsi_get_host_dev (struct Scsi_Host *)
 
struct Scsi_Hostscsi_register (struct scsi_host_template *, int)
 
void scsi_unregister (struct Scsi_Host *)
 
int scsi_host_set_state (struct Scsi_Host *, enum scsi_host_state)
 

Macro Definition Documentation

#define class_to_shost (   d)    container_of(d, struct Scsi_Host, shost_dev)

Definition at line 744 of file scsi_host.h.

#define DEF_SCSI_QCMD (   func_name)
Value:
int func_name(struct Scsi_Host *shost, struct scsi_cmnd *cmd) \
{ \
unsigned long irq_flags; \
int rc; \
spin_lock_irqsave(shost->host_lock, irq_flags); \
scsi_cmd_get_serial(shost, cmd); \
rc = func_name##_lck (cmd, cmd->scsi_done); \
spin_unlock_irqrestore(shost->host_lock, irq_flags); \
return rc; \
}

Definition at line 525 of file scsi_host.h.

#define DISABLE_CLUSTERING   0

Definition at line 43 of file scsi_host.h.

#define ENABLE_CLUSTERING   1

Definition at line 44 of file scsi_host.h.

#define MODE_INITIATOR   0x01

Definition at line 40 of file scsi_host.h.

#define MODE_TARGET   0x02

Definition at line 41 of file scsi_host.h.

#define MODE_UNKNOWN   0x00

Definition at line 39 of file scsi_host.h.

#define SCSI_ADAPTER_RESET   1

Definition at line 367 of file scsi_host.h.

#define SCSI_DEFAULT_HOST_BLOCKED   7

Definition at line 488 of file scsi_host.h.

#define SCSI_DEFAULT_MAX_SECTORS   1024

Definition at line 422 of file scsi_host.h.

#define SCSI_FIRMWARE_RESET   2

Definition at line 368 of file scsi_host.h.

#define SG_ALL   SCSI_MAX_SG_SEGMENTS

Definition at line 37 of file scsi_host.h.

#define SG_NONE   0

Definition at line 36 of file scsi_host.h.

#define shost_printk (   prefix,
  shost,
  fmt,
  a... 
)    dev_printk(prefix, &(shost)->shost_gendev, fmt, ##a)

Definition at line 747 of file scsi_host.h.

Enumeration Type Documentation

anonymous enum
Enumerator:
SCSI_QDEPTH_DEFAULT 
SCSI_QDEPTH_QFULL 
SCSI_QDEPTH_RAMP_UP 

Definition at line 46 of file scsi_host.h.

Enumerator:
SHOST_DIX_GUARD_CRC 
SHOST_DIX_GUARD_IP 

Definition at line 907 of file scsi_host.h.

Enumerator:
SHOST_DIF_TYPE1_PROTECTION 
SHOST_DIF_TYPE2_PROTECTION 
SHOST_DIF_TYPE3_PROTECTION 
SHOST_DIX_TYPE0_PROTECTION 
SHOST_DIX_TYPE1_PROTECTION 
SHOST_DIX_TYPE2_PROTECTION 
SHOST_DIX_TYPE3_PROTECTION 

Definition at line 838 of file scsi_host.h.

Enumerator:
SHOST_CREATED 
SHOST_RUNNING 
SHOST_CANCEL 
SHOST_DEL 
SHOST_RECOVERY 
SHOST_CANCEL_RECOVERY 
SHOST_DEL_RECOVERY 

Definition at line 543 of file scsi_host.h.

Function Documentation

struct request_queue* __scsi_alloc_queue ( struct Scsi_Host shost,
void(*)(struct request_queue *)   
)
read
int __must_check scsi_add_host_with_dma ( struct Scsi_Host shost,
struct device dev,
struct device dma_dev 
)

scsi_add_host_with_dma - add a scsi host with dma device : scsi host pointer to add : a struct device of type scsi class : dma device for the host

Note: You rarely need to worry about this unless you're in a virtualised host environments, so use the simpler scsi_add_host() function instead.

Return value: 0 on success / != 0 for error

Definition at line 200 of file hosts.c.

void scsi_block_requests ( struct Scsi_Host )

Definition at line 1749 of file scsi_lib.c.

u64 scsi_calculate_bounce_limit ( struct Scsi_Host )

Definition at line 1651 of file scsi_lib.c.

void scsi_cmd_get_serial ( struct Scsi_Host host,
struct scsi_cmnd cmd 
)

scsi_cmd_get_serial - Assign a serial number to a command : the scsi host : command to assign serial number to

Description: a serial number identifies a request for error recovery and debugging purposes. Protected by the Host_Lock of host.

Definition at line 643 of file scsi.c.

void scsi_flush_work ( struct Scsi_Host shost)

scsi_flush_work - Flush a Scsi_Host's workqueue. : Pointer to Scsi_Host.

Definition at line 574 of file hosts.c.

void scsi_free_host_dev ( struct scsi_device sdev)

scsi_free_host_dev - Free a scsi_device that points to the host adapter itself : Host device to be freed

Lock status: None assumed.

Returns: Nothing

Definition at line 1950 of file scsi_scan.c.

struct scsi_device* scsi_get_host_dev ( struct Scsi_Host shost)
read

scsi_get_host_dev - Create a scsi_device that points to the host adapter itself : Host that needs a scsi_device

Lock status: None assumed.

Returns: The scsi_device or NULL

Notes: Attach a single scsi_device to the Scsi_Host - this should be made to look like a "pseudo-device" that points to the HA itself.

Note - this device is not accessible from any high-level drivers (including generics), which is probably not optimal. We can add hooks later to attach.

Definition at line 1918 of file scsi_scan.c.

struct Scsi_Host* scsi_host_alloc ( struct scsi_host_template sht,
int  privsize 
)
read

scsi_host_alloc - register a scsi host adapter instance. : pointer to scsi host template : extra bytes to allocate for driver

Note: Allocate a new Scsi_Host and perform basic initialization. The host is not published to the scsi midlayer until scsi_add_host is called.

Return value: Pointer to a new Scsi_Host

Definition at line 337 of file hosts.c.

struct Scsi_Host* scsi_host_get ( struct Scsi_Host shost)
read

scsi_host_get - inc a Scsi_Host ref count : Pointer to Scsi_Host to inc.

Definition at line 510 of file hosts.c.

struct Scsi_Host* scsi_host_lookup ( unsigned short  hostnum)
read

scsi_host_lookup - get a reference to a Scsi_Host by host no : host number to locate

Return value: A pointer to located Scsi_Host or NULL.

The caller must do a scsi_host_put() to drop the reference that scsi_host_get() took. The put_device() below dropped the reference from class_find_device().

Definition at line 491 of file hosts.c.

void scsi_host_put ( struct Scsi_Host shost)

scsi_host_put - dec a Scsi_Host ref count : Pointer to Scsi_Host to dec.

Definition at line 523 of file hosts.c.

int scsi_host_set_state ( struct Scsi_Host shost,
enum scsi_host_state  state 
)

scsi_host_set_state - Take the given host through the host state model. : scsi host to change the state of. : state to change to.

Returns zero if unsuccessful or an error if the requested transition is illegal.

Definition at line 66 of file hosts.c.

const char* scsi_host_state_name ( enum  scsi_host_state)

Definition at line 69 of file scsi_sysfs.c.

int scsi_is_host_device ( const struct device )

Definition at line 539 of file hosts.c.

int scsi_queue_work ( struct Scsi_Host shost,
struct work_struct work 
)

scsi_queue_work - Queue work to the Scsi_Host workqueue. : Pointer to Scsi_Host. : Work to queue for execution.

Return value: 1 - work queued for execution 0 - work is already queued -EINVAL - work queue doesn't exist

Definition at line 555 of file hosts.c.

struct Scsi_Host* scsi_register ( struct scsi_host_template ,
int   
)
read

Definition at line 448 of file hosts.c.

void scsi_remove_host ( struct Scsi_Host shost)

scsi_remove_host - remove a scsi host : a pointer to a scsi host to remove

Definition at line 157 of file hosts.c.

void scsi_rescan_device ( struct device )

Definition at line 1550 of file scsi_scan.c.

void scsi_scan_host ( struct Scsi_Host shost)

scsi_scan_host - scan the given adapter : adapter to scan

Definition at line 1859 of file scsi_scan.c.

void scsi_unblock_requests ( struct Scsi_Host )

Definition at line 1775 of file scsi_lib.c.

void scsi_unregister ( struct Scsi_Host )

Definition at line 464 of file hosts.c.