aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi/libsas.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-22 15:55:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-22 15:55:29 -0400
commit424a6f6ef990b7e9f56f6627bfc6c46b493faeb4 (patch)
tree0028356ed8003495fbbe1f716f359e3c8ebc35b6 /include/scsi/libsas.h
parent1ab142d499294b844ecc81e8004db4ce029b0b61 (diff)
parentcd8df932d894f3128c884e3ae1b2b484540513db (diff)
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
SCSI updates from James Bottomley: "The update includes the usual assortment of driver updates (lpfc, qla2xxx, qla4xxx, bfa, bnx2fc, bnx2i, isci, fcoe, hpsa) plus a huge amount of infrastructure work in the SAS library and transport class as well as an iSCSI update. There's also a new SCSI based virtio driver." * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (177 commits) [SCSI] qla4xxx: Update driver version to 5.02.00-k15 [SCSI] qla4xxx: trivial cleanup [SCSI] qla4xxx: Fix sparse warning [SCSI] qla4xxx: Add support for multiple session per host. [SCSI] qla4xxx: Export CHAP index as sysfs attribute [SCSI] scsi_transport: Export CHAP index as sysfs attribute [SCSI] qla4xxx: Add support to display CHAP list and delete CHAP entry [SCSI] iscsi_transport: Add support to display CHAP list and delete CHAP entry [SCSI] pm8001: fix endian issue with code optimization. [SCSI] pm8001: Fix possible racing condition. [SCSI] pm8001: Fix bogus interrupt state flag issue. [SCSI] ipr: update PCI ID definitions for new adapters [SCSI] qla2xxx: handle default case in qla2x00_request_firmware() [SCSI] isci: improvements in driver unloading routine [SCSI] isci: improve phy event warnings [SCSI] isci: debug, provide state-enum-to-string conversions [SCSI] scsi_transport_sas: 'enable' phys on reset [SCSI] libsas: don't recover end devices attached to disabled phys [SCSI] libsas: fixup target_port_protocols for expanders that don't report sata [SCSI] libsas: set attached device type and target protocols for local phys ...
Diffstat (limited to 'include/scsi/libsas.h')
-rw-r--r--include/scsi/libsas.h71
1 files changed, 42 insertions, 29 deletions
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index 6a308d42d98f..5f5ed1b8b41b 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -86,7 +86,9 @@ enum discover_event {
86 DISCE_DISCOVER_DOMAIN = 0U, 86 DISCE_DISCOVER_DOMAIN = 0U,
87 DISCE_REVALIDATE_DOMAIN = 1, 87 DISCE_REVALIDATE_DOMAIN = 1,
88 DISCE_PORT_GONE = 2, 88 DISCE_PORT_GONE = 2,
89 DISC_NUM_EVENTS = 3, 89 DISCE_PROBE = 3,
90 DISCE_DESTRUCT = 4,
91 DISC_NUM_EVENTS = 5,
90}; 92};
91 93
92/* ---------- Expander Devices ---------- */ 94/* ---------- Expander Devices ---------- */
@@ -151,6 +153,8 @@ struct expander_device {
151 153
152 struct ex_phy *ex_phy; 154 struct ex_phy *ex_phy;
153 struct sas_port *parent_port; 155 struct sas_port *parent_port;
156
157 struct mutex cmd_mutex;
154}; 158};
155 159
156/* ---------- SATA device ---------- */ 160/* ---------- SATA device ---------- */
@@ -162,22 +166,21 @@ enum ata_command_set {
162struct sata_device { 166struct sata_device {
163 enum ata_command_set command_set; 167 enum ata_command_set command_set;
164 struct smp_resp rps_resp; /* report_phy_sata_resp */ 168 struct smp_resp rps_resp; /* report_phy_sata_resp */
165 __le16 *identify_device;
166 __le16 *identify_packet_device;
167
168 u8 port_no; /* port number, if this is a PM (Port) */ 169 u8 port_no; /* port number, if this is a PM (Port) */
169 struct list_head children; /* PM Ports if this is a PM */ 170 struct list_head children; /* PM Ports if this is a PM */
170 171
171 struct ata_port *ap; 172 struct ata_port *ap;
172 struct ata_host ata_host; 173 struct ata_host ata_host;
173 struct ata_taskfile tf; 174 struct ata_taskfile tf;
174 u32 sstatus;
175 u32 serror;
176 u32 scontrol;
177}; 175};
178 176
179/* ---------- Domain device ---------- */ 177enum {
178 SAS_DEV_GONE,
179 SAS_DEV_DESTROY,
180};
181
180struct domain_device { 182struct domain_device {
183 spinlock_t done_lock;
181 enum sas_dev_type dev_type; 184 enum sas_dev_type dev_type;
182 185
183 enum sas_linkrate linkrate; 186 enum sas_linkrate linkrate;
@@ -189,8 +192,10 @@ struct domain_device {
189 struct domain_device *parent; 192 struct domain_device *parent;
190 struct list_head siblings; /* devices on the same level */ 193 struct list_head siblings; /* devices on the same level */
191 struct asd_sas_port *port; /* shortcut to root of the tree */ 194 struct asd_sas_port *port; /* shortcut to root of the tree */
195 struct sas_phy *phy;
192 196
193 struct list_head dev_list_node; 197 struct list_head dev_list_node;
198 struct list_head disco_list_node; /* awaiting probe or destruct */
194 199
195 enum sas_protocol iproto; 200 enum sas_protocol iproto;
196 enum sas_protocol tproto; 201 enum sas_protocol tproto;
@@ -208,7 +213,8 @@ struct domain_device {
208 }; 213 };
209 214
210 void *lldd_dev; 215 void *lldd_dev;
211 int gone; 216 unsigned long state;
217 struct kref kref;
212}; 218};
213 219
214struct sas_discovery_event { 220struct sas_discovery_event {
@@ -217,7 +223,6 @@ struct sas_discovery_event {
217}; 223};
218 224
219struct sas_discovery { 225struct sas_discovery {
220 spinlock_t disc_event_lock;
221 struct sas_discovery_event disc_work[DISC_NUM_EVENTS]; 226 struct sas_discovery_event disc_work[DISC_NUM_EVENTS];
222 unsigned long pending; 227 unsigned long pending;
223 u8 fanout_sas_addr[8]; 228 u8 fanout_sas_addr[8];
@@ -226,7 +231,6 @@ struct sas_discovery {
226 int max_level; 231 int max_level;
227}; 232};
228 233
229
230/* The port struct is Class:RW, driver:RO */ 234/* The port struct is Class:RW, driver:RO */
231struct asd_sas_port { 235struct asd_sas_port {
232/* private: */ 236/* private: */
@@ -236,9 +240,10 @@ struct asd_sas_port {
236 struct domain_device *port_dev; 240 struct domain_device *port_dev;
237 spinlock_t dev_list_lock; 241 spinlock_t dev_list_lock;
238 struct list_head dev_list; 242 struct list_head dev_list;
243 struct list_head disco_list;
244 struct list_head destroy_list;
239 enum sas_linkrate linkrate; 245 enum sas_linkrate linkrate;
240 246
241 struct sas_phy *phy;
242 struct work_struct work; 247 struct work_struct work;
243 248
244/* public: */ 249/* public: */
@@ -274,7 +279,6 @@ struct asd_sas_event {
274 */ 279 */
275struct asd_sas_phy { 280struct asd_sas_phy {
276/* private: */ 281/* private: */
277 /* protected by ha->event_lock */
278 struct asd_sas_event port_events[PORT_NUM_EVENTS]; 282 struct asd_sas_event port_events[PORT_NUM_EVENTS];
279 struct asd_sas_event phy_events[PHY_NUM_EVENTS]; 283 struct asd_sas_event phy_events[PHY_NUM_EVENTS];
280 284
@@ -320,6 +324,7 @@ struct asd_sas_phy {
320struct scsi_core { 324struct scsi_core {
321 struct Scsi_Host *shost; 325 struct Scsi_Host *shost;
322 326
327 struct mutex task_queue_flush;
323 spinlock_t task_queue_lock; 328 spinlock_t task_queue_lock;
324 struct list_head task_queue; 329 struct list_head task_queue;
325 int task_queue_size; 330 int task_queue_size;
@@ -334,18 +339,23 @@ struct sas_ha_event {
334 339
335enum sas_ha_state { 340enum sas_ha_state {
336 SAS_HA_REGISTERED, 341 SAS_HA_REGISTERED,
337 SAS_HA_UNREGISTERED 342 SAS_HA_DRAINING,
343 SAS_HA_ATA_EH_ACTIVE,
344 SAS_HA_FROZEN,
338}; 345};
339 346
340struct sas_ha_struct { 347struct sas_ha_struct {
341/* private: */ 348/* private: */
342 spinlock_t event_lock;
343 struct sas_ha_event ha_events[HA_NUM_EVENTS]; 349 struct sas_ha_event ha_events[HA_NUM_EVENTS];
344 unsigned long pending; 350 unsigned long pending;
345 351
346 enum sas_ha_state state; 352 struct list_head defer_q; /* work queued while draining */
353 struct mutex drain_mutex;
354 unsigned long state;
347 spinlock_t state_lock; 355 spinlock_t state_lock;
348 356
357 struct mutex disco_mutex;
358
349 struct scsi_core core; 359 struct scsi_core core;
350 360
351/* public: */ 361/* public: */
@@ -374,7 +384,8 @@ struct sas_ha_struct {
374 384
375 void *lldd_ha; /* not touched by sas class code */ 385 void *lldd_ha; /* not touched by sas class code */
376 386
377 struct list_head eh_done_q; 387 struct list_head eh_done_q; /* complete via scsi_eh_flush_done_q */
388 struct list_head eh_ata_q; /* scmds to promote from sas to ata eh */
378}; 389};
379 390
380#define SHOST_TO_SAS_HA(_shost) (*(struct sas_ha_struct **)(_shost)->hostdata) 391#define SHOST_TO_SAS_HA(_shost) (*(struct sas_ha_struct **)(_shost)->hostdata)
@@ -418,6 +429,11 @@ static inline unsigned int to_sas_gpio_od(int device, int bit)
418 return 3 * device + bit; 429 return 3 * device + bit;
419} 430}
420 431
432static inline void sas_put_local_phy(struct sas_phy *phy)
433{
434 put_device(&phy->dev);
435}
436
421#ifdef CONFIG_SCSI_SAS_HOST_SMP 437#ifdef CONFIG_SCSI_SAS_HOST_SMP
422int try_test_sas_gpio_gp_bit(unsigned int od, u8 *data, u8 index, u8 count); 438int try_test_sas_gpio_gp_bit(unsigned int od, u8 *data, u8 index, u8 count);
423#else 439#else
@@ -447,7 +463,10 @@ enum service_response {
447}; 463};
448 464
449enum exec_status { 465enum exec_status {
450 /* The SAM_STAT_.. codes fit in the lower 6 bits */ 466 /* The SAM_STAT_.. codes fit in the lower 6 bits, alias some of
467 * them here to silence 'case value not in enumerated type' warnings
468 */
469 __SAM_STAT_CHECK_CONDITION = SAM_STAT_CHECK_CONDITION,
451 470
452 SAS_DEV_NO_RESPONSE = 0x80, 471 SAS_DEV_NO_RESPONSE = 0x80,
453 SAS_DATA_UNDERRUN, 472 SAS_DATA_UNDERRUN,
@@ -487,10 +506,6 @@ enum exec_status {
487struct ata_task_resp { 506struct ata_task_resp {
488 u16 frame_len; 507 u16 frame_len;
489 u8 ending_fis[24]; /* dev to host or data-in */ 508 u8 ending_fis[24]; /* dev to host or data-in */
490 u32 sstatus;
491 u32 serror;
492 u32 scontrol;
493 u32 sactive;
494}; 509};
495 510
496#define SAS_STATUS_BUF_SIZE 96 511#define SAS_STATUS_BUF_SIZE 96
@@ -604,7 +619,8 @@ struct sas_domain_function_template {
604 int (*lldd_clear_aca)(struct domain_device *, u8 *lun); 619 int (*lldd_clear_aca)(struct domain_device *, u8 *lun);
605 int (*lldd_clear_task_set)(struct domain_device *, u8 *lun); 620 int (*lldd_clear_task_set)(struct domain_device *, u8 *lun);
606 int (*lldd_I_T_nexus_reset)(struct domain_device *); 621 int (*lldd_I_T_nexus_reset)(struct domain_device *);
607 int (*lldd_ata_soft_reset)(struct domain_device *); 622 int (*lldd_ata_check_ready)(struct domain_device *);
623 void (*lldd_ata_set_dmamode)(struct domain_device *);
608 int (*lldd_lu_reset)(struct domain_device *, u8 *lun); 624 int (*lldd_lu_reset)(struct domain_device *, u8 *lun);
609 int (*lldd_query_task)(struct sas_task *); 625 int (*lldd_query_task)(struct sas_task *);
610 626
@@ -625,14 +641,11 @@ extern int sas_unregister_ha(struct sas_ha_struct *);
625 641
626int sas_set_phy_speed(struct sas_phy *phy, 642int sas_set_phy_speed(struct sas_phy *phy,
627 struct sas_phy_linkrates *rates); 643 struct sas_phy_linkrates *rates);
628int sas_phy_enable(struct sas_phy *phy, int enabled);
629int sas_phy_reset(struct sas_phy *phy, int hard_reset); 644int sas_phy_reset(struct sas_phy *phy, int hard_reset);
630int sas_queue_up(struct sas_task *task); 645int sas_queue_up(struct sas_task *task);
631extern int sas_queuecommand(struct Scsi_Host * ,struct scsi_cmnd *); 646extern int sas_queuecommand(struct Scsi_Host * ,struct scsi_cmnd *);
632extern int sas_target_alloc(struct scsi_target *); 647extern int sas_target_alloc(struct scsi_target *);
633extern int sas_slave_alloc(struct scsi_device *);
634extern int sas_slave_configure(struct scsi_device *); 648extern int sas_slave_configure(struct scsi_device *);
635extern void sas_slave_destroy(struct scsi_device *);
636extern int sas_change_queue_depth(struct scsi_device *, int new_depth, 649extern int sas_change_queue_depth(struct scsi_device *, int new_depth,
637 int reason); 650 int reason);
638extern int sas_change_queue_type(struct scsi_device *, int qt); 651extern int sas_change_queue_type(struct scsi_device *, int qt);
@@ -649,7 +662,7 @@ void sas_init_ex_attr(void);
649 662
650int sas_ex_revalidate_domain(struct domain_device *); 663int sas_ex_revalidate_domain(struct domain_device *);
651 664
652void sas_unregister_domain_devices(struct asd_sas_port *port); 665void sas_unregister_domain_devices(struct asd_sas_port *port, int gone);
653void sas_init_disc(struct sas_discovery *disc, struct asd_sas_port *); 666void sas_init_disc(struct sas_discovery *disc, struct asd_sas_port *);
654int sas_discover_event(struct asd_sas_port *, enum discover_event ev); 667int sas_discover_event(struct asd_sas_port *, enum discover_event ev);
655 668
@@ -661,20 +674,20 @@ void sas_unregister_dev(struct asd_sas_port *port, struct domain_device *);
661void sas_init_dev(struct domain_device *); 674void sas_init_dev(struct domain_device *);
662 675
663void sas_task_abort(struct sas_task *); 676void sas_task_abort(struct sas_task *);
664int __sas_task_abort(struct sas_task *);
665int sas_eh_device_reset_handler(struct scsi_cmnd *cmd); 677int sas_eh_device_reset_handler(struct scsi_cmnd *cmd);
666int sas_eh_bus_reset_handler(struct scsi_cmnd *cmd); 678int sas_eh_bus_reset_handler(struct scsi_cmnd *cmd);
667 679
668extern void sas_target_destroy(struct scsi_target *); 680extern void sas_target_destroy(struct scsi_target *);
669extern int sas_slave_alloc(struct scsi_device *); 681extern int sas_slave_alloc(struct scsi_device *);
670extern int sas_ioctl(struct scsi_device *sdev, int cmd, void __user *arg); 682extern int sas_ioctl(struct scsi_device *sdev, int cmd, void __user *arg);
683extern int sas_drain_work(struct sas_ha_struct *ha);
671 684
672extern int sas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, 685extern int sas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy,
673 struct request *req); 686 struct request *req);
674 687
675extern void sas_ssp_task_response(struct device *dev, struct sas_task *task, 688extern void sas_ssp_task_response(struct device *dev, struct sas_task *task,
676 struct ssp_response_iu *iu); 689 struct ssp_response_iu *iu);
677struct sas_phy *sas_find_local_phy(struct domain_device *dev); 690struct sas_phy *sas_get_local_phy(struct domain_device *dev);
678 691
679int sas_request_addr(struct Scsi_Host *shost, u8 *addr); 692int sas_request_addr(struct Scsi_Host *shost, u8 *addr);
680 693