scsi_host.h
来自「Linux Kernel 2.6.9 for OMAP1710」· C头文件 代码 · 共 570 行 · 第 1/2 页
H
570 行
* dma scatter gather segment boundary limit. a segment crossing this * boundary will be split in two. */ unsigned long dma_boundary; /* * This specifies "machine infinity" for host templates which don't * limit the transfer size. Note this limit represents an absolute * maximum, and may be over the transfer limits allowed for * individual devices (e.g. 256 for SCSI-1) */#define SCSI_DEFAULT_MAX_SECTORS 1024 /* * True if this host adapter can make good use of linked commands. * This will allow more than one command to be queued to a given * unit on a given host. Set this to the maximum number of command * blocks to be provided for each device. Set this to 1 for one * command block per lun, 2 for two, etc. Do not set this to 0. * You should make sure that the host adapter will do the right thing * before you try setting this above 1. */ short cmd_per_lun; /* * present contains counter indicating how many boards of this * type were found when we did the scan. */ unsigned char present; /* * true if this host adapter uses unchecked DMA onto an ISA bus. */ unsigned unchecked_isa_dma:1; /* * true if this host adapter can make good use of clustering. * I originally thought that if the tablesize was large that it * was a waste of CPU cycles to prepare a cluster list, but * it works out that the Buslogic is faster if you use a smaller * number of segments (i.e. use clustering). I guess it is * inefficient. */ unsigned use_clustering:1; /* * True for emulated SCSI host adapters (e.g. ATAPI) */ unsigned emulated:1; /* * True if the low-level driver performs its own reset-settle delays. */ unsigned skip_settle_delay:1; /* * Countdown for host blocking with no commands outstanding */ unsigned int max_host_blocked; /* * Default value for the blocking. If the queue is empty, * host_blocked counts down in the request_fn until it restarts * host operations as zero is reached. * * FIXME: This should probably be a value in the template */#define SCSI_DEFAULT_HOST_BLOCKED 7 /* * Pointer to the sysfs class properties for this host, NULL terminated. */ struct class_device_attribute **shost_attrs; /* * Pointer to the SCSI device properties for this host, NULL terminated. */ struct device_attribute **sdev_attrs; /* * List of hosts per template. * * This is only for use by scsi_module.c for legacy templates. * For these access to it is synchronized implicitly by * module_init/module_exit. */ struct list_head legacy_hosts;};/* * shost states */enum { SHOST_ADD, SHOST_DEL, SHOST_CANCEL, SHOST_RECOVERY,};struct Scsi_Host { /* * __devices is protected by the host_lock, but you should * usually use scsi_device_lookup / shost_for_each_device * to access it and don't care about locking yourself. * In the rare case of beeing in irq context you can use * their __ prefixed variants with the lock held. NEVER * access this list directly from a driver. */ struct list_head __devices; struct scsi_host_cmd_pool *cmd_pool; spinlock_t free_list_lock; struct list_head free_list; /* backup store of cmd structs */ struct list_head starved_list; spinlock_t default_lock; spinlock_t *host_lock; struct semaphore scan_mutex;/* serialize scanning activity */ struct list_head eh_cmd_q; struct task_struct * ehandler; /* Error recovery thread. */ struct semaphore * eh_wait; /* The error recovery thread waits on this. */ struct completion * eh_notify; /* wait for eh to begin or end */ struct semaphore * eh_action; /* Wait for specific actions on the host. */ unsigned int eh_active:1; /* Indicates the eh thread is awake and active if this is true. */ unsigned int eh_kill:1; /* set when killing the eh thread */ wait_queue_head_t host_wait; struct scsi_host_template *hostt; struct scsi_transport_template *transportt; volatile unsigned short host_busy; /* commands actually active on low-level */ volatile unsigned short host_failed; /* commands that failed. */ unsigned short host_no; /* Used for IOCTL_GET_IDLUN, /proc/scsi et al. */ int resetting; /* if set, it means that last_reset is a valid value */ unsigned long last_reset; /* * These three parameters can be used to allow for wide scsi, * and for host adapters that support multiple busses * The first two should be set to 1 more than the actual max id * or lun (i.e. 8 for normal systems). */ unsigned int max_id; unsigned int max_lun; unsigned int max_channel; /* * This is a unique identifier that must be assigned so that we * have some way of identifying each detected host adapter properly * and uniquely. For hosts that do not support more than one card * in the system at one time, this does not need to be set. It is * initialized to 0 in scsi_register. */ unsigned int unique_id; /* * The maximum length of SCSI commands that this host can accept. * Probably 12 for most host adapters, but could be 16 for others. * For drivers that don't set this field, a value of 12 is * assumed. I am leaving this as a number rather than a bit * because you never know what subsequent SCSI standards might do * (i.e. could there be a 20 byte or a 24-byte command a few years * down the road?). */ unsigned char max_cmd_len; int this_id; int can_queue; short cmd_per_lun; short unsigned int sg_tablesize; short unsigned int max_sectors; unsigned long dma_boundary; unsigned unchecked_isa_dma:1; unsigned use_clustering:1; unsigned use_blk_tcq:1; /* * Host has requested that no further requests come through for the * time being. */ unsigned host_self_blocked:1; /* * Host uses correct SCSI ordering not PC ordering. The bit is * set for the minority of drivers whose authors actually read * the spec ;) */ unsigned reverse_ordering:1; /* * Host has rejected a command because it was busy. */ unsigned int host_blocked; /* * Value host_blocked counts down from */ unsigned int max_host_blocked; /* legacy crap */ unsigned long base; unsigned long io_port; unsigned char n_io_port; unsigned char dma_channel; unsigned int irq; unsigned long shost_state; /* ldm bits */ struct device shost_gendev; struct class_device shost_classdev; /* * List of hosts per template. * * This is only for use by scsi_module.c for legacy templates. * For these access to it is synchronized implicitly by * module_init/module_exit. */ struct list_head sht_legacy_list; /* * We should ensure that this is aligned, both for better performance * and also because some compilers (m68k) don't automatically force * alignment to a long boundary. */ unsigned long hostdata[0] /* Used for storage of host specific stuff */ __attribute__ ((aligned (sizeof(unsigned long))));};#define dev_to_shost(d) \ container_of(d, struct Scsi_Host, shost_gendev)#define class_to_shost(d) \ container_of(d, struct Scsi_Host, shost_classdev)extern struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *, int);extern int scsi_add_host(struct Scsi_Host *, struct device *);extern void scsi_scan_host(struct Scsi_Host *);extern void scsi_remove_host(struct Scsi_Host *);extern struct Scsi_Host *scsi_host_get(struct Scsi_Host *);extern void scsi_host_put(struct Scsi_Host *t);extern struct Scsi_Host *scsi_host_lookup(unsigned short);extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *);static inline void scsi_assign_lock(struct Scsi_Host *shost, spinlock_t *lock){ shost->host_lock = lock;}static inline void scsi_set_device(struct Scsi_Host *shost, struct device *dev){ shost->shost_gendev.parent = dev;}static inline struct device *scsi_get_device(struct Scsi_Host *shost){ return shost->shost_gendev.parent;}extern void scsi_unblock_requests(struct Scsi_Host *);extern void scsi_block_requests(struct Scsi_Host *);/* * These two functions are used to allocate and free a pseudo device * which will connect to the host adapter itself rather than any * physical device. You must deallocate when you are done with the * thing. This physical pseudo-device isn't real and won't be available * from any high-level drivers. */extern void scsi_free_host_dev(struct scsi_device *);extern struct scsi_device *scsi_get_host_dev(struct Scsi_Host *);/* legacy interfaces */extern struct Scsi_Host *scsi_register(struct scsi_host_template *, int);extern void scsi_unregister(struct Scsi_Host *);#endif /* _SCSI_SCSI_HOST_H */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?