X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=include%2Fscsi%2Flibsas.h;h=e78d3b62d8ec76d5bce350f9f996bcdd26439670;hb=42e9a92fe6a9095bd68a379aaec7ad2be0337f7a;hp=72acdabe7f807c6b3d4538677dfa19c337b80381;hpb=2908d778ab3e244900c310974e1fc1c69066e450;p=safe%2Fjmp%2Flinux-2.6 diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h index 72acdab..e78d3b6 100644 --- a/include/scsi/libsas.h +++ b/include/scsi/libsas.h @@ -30,11 +30,12 @@ #include #include #include +#include #include -#include #include #include #include +#include struct block_device; @@ -89,8 +90,6 @@ enum discover_event { /* ---------- Expander Devices ---------- */ -#define ETASK 0xFA - #define to_dom_device(_obj) container_of(_obj, struct domain_device, dev_obj) #define to_dev_attr(_attr) container_of(_attr, struct domain_dev_attribute,\ attr) @@ -114,14 +113,14 @@ struct ex_phy { enum ex_phy_state phy_state; enum sas_dev_type attached_dev_type; - enum sas_phy_linkrate linkrate; + enum sas_linkrate linkrate; u8 attached_sata_host:1; u8 attached_sata_dev:1; u8 attached_sata_ps:1; - enum sas_proto attached_tproto; - enum sas_proto attached_iproto; + enum sas_protocol attached_tproto; + enum sas_protocol attached_iproto; u8 attached_sas_addr[SAS_ADDR_SIZE]; u8 attached_phy_id; @@ -164,15 +163,22 @@ struct sata_device { u8 port_no; /* port number, if this is a PM (Port) */ struct list_head children; /* PM Ports if this is a PM */ + + struct ata_port *ap; + struct ata_host ata_host; + struct ata_taskfile tf; + u32 sstatus; + u32 serror; + u32 scontrol; }; /* ---------- Domain device ---------- */ struct domain_device { enum sas_dev_type dev_type; - enum sas_phy_linkrate linkrate; - enum sas_phy_linkrate min_linkrate; - enum sas_phy_linkrate max_linkrate; + enum sas_linkrate linkrate; + enum sas_linkrate min_linkrate; + enum sas_linkrate max_linkrate; int pathways; @@ -182,8 +188,8 @@ struct domain_device { struct list_head dev_list_node; - enum sas_proto iproto; - enum sas_proto tproto; + enum sas_protocol iproto; + enum sas_protocol tproto; struct sas_rphy *rphy; @@ -200,9 +206,14 @@ struct domain_device { void *lldd_dev; }; +struct sas_discovery_event { + struct work_struct work; + struct asd_sas_port *port; +}; + struct sas_discovery { spinlock_t disc_event_lock; - struct work_struct disc_work[DISC_NUM_EVENTS]; + struct sas_discovery_event disc_work[DISC_NUM_EVENTS]; unsigned long pending; u8 fanout_sas_addr[8]; u8 eeds_a[8]; @@ -220,7 +231,7 @@ struct asd_sas_port { struct domain_device *port_dev; spinlock_t dev_list_lock; struct list_head dev_list; - enum sas_phy_linkrate linkrate; + enum sas_linkrate linkrate; struct sas_phy *phy; struct work_struct work; @@ -231,8 +242,8 @@ struct asd_sas_port { enum sas_class class; u8 sas_addr[SAS_ADDR_SIZE]; u8 attached_sas_addr[SAS_ADDR_SIZE]; - enum sas_proto iproto; - enum sas_proto tproto; + enum sas_protocol iproto; + enum sas_protocol tproto; enum sas_oob_mode oob_mode; @@ -248,14 +259,19 @@ struct asd_sas_port { void *lldd_port; /* not touched by the sas class code */ }; +struct asd_sas_event { + struct work_struct work; + struct asd_sas_phy *phy; +}; + /* The phy pretty much is controlled by the LLDD. * The class only reads those fields. */ struct asd_sas_phy { /* private: */ /* protected by ha->event_lock */ - struct work_struct port_events[PORT_NUM_EVENTS]; - struct work_struct phy_events[PHY_NUM_EVENTS]; + struct asd_sas_event port_events[PORT_NUM_EVENTS]; + struct asd_sas_event phy_events[PHY_NUM_EVENTS]; unsigned long port_events_pending; unsigned long phy_events_pending; @@ -270,13 +286,13 @@ struct asd_sas_phy { int id; /* must be set */ enum sas_class class; - enum sas_proto iproto; - enum sas_proto tproto; + enum sas_protocol iproto; + enum sas_protocol tproto; enum sas_phy_type type; enum sas_phy_role role; enum sas_oob_mode oob_mode; - enum sas_phy_linkrate linkrate; + enum sas_linkrate linkrate; u8 *sas_addr; /* must be set */ u8 attached_sas_addr[SAS_ADDR_SIZE]; /* class:RO, driver: R/W */ @@ -303,21 +319,33 @@ struct scsi_core { struct list_head task_queue; int task_queue_size; - struct semaphore queue_thread_sema; - int queue_thread_kill; + struct task_struct *queue_thread; +}; + +struct sas_ha_event { + struct work_struct work; + struct sas_ha_struct *ha; +}; + +enum sas_ha_state { + SAS_HA_REGISTERED, + SAS_HA_UNREGISTERED }; struct sas_ha_struct { /* private: */ spinlock_t event_lock; - struct work_struct ha_events[HA_NUM_EVENTS]; + struct sas_ha_event ha_events[HA_NUM_EVENTS]; unsigned long pending; + enum sas_ha_state state; + spinlock_t state_lock; + struct scsi_core core; /* public: */ char *sas_ha_name; - struct pci_dev *pcidev; /* should be set */ + struct device *dev; /* should be set */ struct module *lldd_module; /* should be set */ u8 *sas_addr; /* must be set */ @@ -338,6 +366,8 @@ struct sas_ha_struct { void (*notify_phy_event)(struct asd_sas_phy *, enum phy_event); void *lldd_ha; /* not touched by sas class code */ + + struct list_head eh_done_q; }; #define SHOST_TO_SAS_HA(_shost) (*(struct sas_ha_struct **)(_shost)->hostdata) @@ -368,7 +398,7 @@ void sas_hash_addr(u8 *hashed, const u8 *sas_addr); static inline void sas_phy_disconnected(struct asd_sas_phy *phy) { phy->oob_mode = OOB_NOT_CONNECTED; - phy->linkrate = PHY_LINKRATE_NONE; + phy->linkrate = SAS_LINK_RATE_UNKNOWN; } /* ---------- Tasks ---------- */ @@ -504,7 +534,7 @@ struct sas_task { spinlock_t task_state_lock; unsigned task_state_flags; - enum sas_proto task_proto; + enum sas_protocol task_proto; /* Used by the discovery code. */ struct timer_list timer; @@ -526,21 +556,23 @@ struct sas_task { void *lldd_task; /* for use by LLDDs */ void *uldd_task; -}; + struct work_struct abort_work; +}; +extern struct kmem_cache *sas_task_cache; -#define SAS_TASK_STATE_PENDING 1 -#define SAS_TASK_STATE_DONE 2 -#define SAS_TASK_STATE_ABORTED 4 +#define SAS_TASK_STATE_PENDING 1 +#define SAS_TASK_STATE_DONE 2 +#define SAS_TASK_STATE_ABORTED 4 +#define SAS_TASK_NEED_DEV_RESET 8 +#define SAS_TASK_AT_INITIATOR 16 -static inline struct sas_task *sas_alloc_task(unsigned long flags) +static inline struct sas_task *sas_alloc_task(gfp_t flags) { - extern kmem_cache_t *sas_task_cache; - struct sas_task *task = kmem_cache_alloc(sas_task_cache, flags); + struct sas_task *task = kmem_cache_zalloc(sas_task_cache, flags); if (task) { - memset(task, 0, sizeof(*task)); INIT_LIST_HEAD(&task->list); spin_lock_init(&task->task_state_lock); task->task_state_flags = SAS_TASK_STATE_PENDING; @@ -554,7 +586,6 @@ static inline struct sas_task *sas_alloc_task(unsigned long flags) static inline void sas_free_task(struct sas_task *task) { if (task) { - extern kmem_cache_t *sas_task_cache; BUG_ON(!list_empty(&task->list)); kmem_cache_free(sas_task_cache, task); } @@ -570,7 +601,7 @@ struct sas_domain_function_template { void (*lldd_dev_gone)(struct domain_device *); int (*lldd_execute_task)(struct sas_task *, int num, - unsigned long gfp_flags); + gfp_t gfp_flags); /* Task Management Functions. Must be called from process context. */ int (*lldd_abort_task)(struct sas_task *); @@ -586,12 +617,17 @@ struct sas_domain_function_template { int (*lldd_clear_nexus_ha)(struct sas_ha_struct *); /* Phy management */ - int (*lldd_control_phy)(struct asd_sas_phy *, enum phy_func); + int (*lldd_control_phy)(struct asd_sas_phy *, enum phy_func, void *); }; extern int sas_register_ha(struct sas_ha_struct *); extern int sas_unregister_ha(struct sas_ha_struct *); +int sas_set_phy_speed(struct sas_phy *phy, + struct sas_phy_linkrates *rates); +int sas_phy_enable(struct sas_phy *phy, int enabled); +int sas_phy_reset(struct sas_phy *phy, int hard_reset); +int sas_queue_up(struct sas_task *task); extern int sas_queuecommand(struct scsi_cmnd *, void (*scsi_done)(struct scsi_cmnd *)); extern int sas_target_alloc(struct scsi_target *); @@ -624,4 +660,22 @@ void sas_unregister_dev(struct domain_device *); void sas_init_dev(struct domain_device *); +void sas_task_abort(struct sas_task *); +int __sas_task_abort(struct sas_task *); +int sas_eh_device_reset_handler(struct scsi_cmnd *cmd); +int sas_eh_bus_reset_handler(struct scsi_cmnd *cmd); + +extern void sas_target_destroy(struct scsi_target *); +extern int sas_slave_alloc(struct scsi_device *); +extern int sas_ioctl(struct scsi_device *sdev, int cmd, void __user *arg); + +extern int sas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, + struct request *req); + +extern void sas_ssp_task_response(struct device *dev, struct sas_task *task, + struct ssp_response_iu *iu); +struct sas_phy *sas_find_local_phy(struct domain_device *dev); + +int sas_request_addr(struct Scsi_Host *shost, u8 *addr); + #endif /* _SASLIB_H_ */