aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi/libsas.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/scsi/libsas.h')
-rw-r--r--include/scsi/libsas.h54
1 files changed, 29 insertions, 25 deletions
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index ee866060f8a4..6a308d42d98f 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -142,8 +142,11 @@ struct expander_device {
142 u16 ex_change_count; 142 u16 ex_change_count;
143 u16 max_route_indexes; 143 u16 max_route_indexes;
144 u8 num_phys; 144 u8 num_phys;
145
146 u8 t2t_supp:1;
145 u8 configuring:1; 147 u8 configuring:1;
146 u8 conf_route_table:1; 148 u8 conf_route_table:1;
149
147 u8 enclosure_logical_id[8]; 150 u8 enclosure_logical_id[8];
148 151
149 struct ex_phy *ex_phy; 152 struct ex_phy *ex_phy;
@@ -386,6 +389,11 @@ sdev_to_domain_dev(struct scsi_device *sdev) {
386 return starget_to_domain_dev(sdev->sdev_target); 389 return starget_to_domain_dev(sdev->sdev_target);
387} 390}
388 391
392static inline struct ata_device *sas_to_ata_dev(struct domain_device *dev)
393{
394 return &dev->sata_dev.ap->link.device[0];
395}
396
389static inline struct domain_device * 397static inline struct domain_device *
390cmd_to_domain_dev(struct scsi_cmnd *cmd) 398cmd_to_domain_dev(struct scsi_cmnd *cmd)
391{ 399{
@@ -405,6 +413,20 @@ static inline void sas_phy_disconnected(struct asd_sas_phy *phy)
405 phy->linkrate = SAS_LINK_RATE_UNKNOWN; 413 phy->linkrate = SAS_LINK_RATE_UNKNOWN;
406} 414}
407 415
416static inline unsigned int to_sas_gpio_od(int device, int bit)
417{
418 return 3 * device + bit;
419}
420
421#ifdef CONFIG_SCSI_SAS_HOST_SMP
422int try_test_sas_gpio_gp_bit(unsigned int od, u8 *data, u8 index, u8 count);
423#else
424static inline int try_test_sas_gpio_gp_bit(unsigned int od, u8 *data, u8 index, u8 count)
425{
426 return -1;
427}
428#endif
429
408/* ---------- Tasks ---------- */ 430/* ---------- Tasks ---------- */
409/* 431/*
410 service_response | SAS_TASK_COMPLETE | SAS_TASK_UNDELIVERED | 432 service_response | SAS_TASK_COMPLETE | SAS_TASK_UNDELIVERED |
@@ -555,36 +577,14 @@ struct sas_task {
555 struct work_struct abort_work; 577 struct work_struct abort_work;
556}; 578};
557 579
558extern struct kmem_cache *sas_task_cache;
559
560#define SAS_TASK_STATE_PENDING 1 580#define SAS_TASK_STATE_PENDING 1
561#define SAS_TASK_STATE_DONE 2 581#define SAS_TASK_STATE_DONE 2
562#define SAS_TASK_STATE_ABORTED 4 582#define SAS_TASK_STATE_ABORTED 4
563#define SAS_TASK_NEED_DEV_RESET 8 583#define SAS_TASK_NEED_DEV_RESET 8
564#define SAS_TASK_AT_INITIATOR 16 584#define SAS_TASK_AT_INITIATOR 16
565 585
566static inline struct sas_task *sas_alloc_task(gfp_t flags) 586extern struct sas_task *sas_alloc_task(gfp_t flags);
567{ 587extern void sas_free_task(struct sas_task *task);
568 struct sas_task *task = kmem_cache_zalloc(sas_task_cache, flags);
569
570 if (task) {
571 INIT_LIST_HEAD(&task->list);
572 spin_lock_init(&task->task_state_lock);
573 task->task_state_flags = SAS_TASK_STATE_PENDING;
574 init_timer(&task->timer);
575 init_completion(&task->completion);
576 }
577
578 return task;
579}
580
581static inline void sas_free_task(struct sas_task *task)
582{
583 if (task) {
584 BUG_ON(!list_empty(&task->list));
585 kmem_cache_free(sas_task_cache, task);
586 }
587}
588 588
589struct sas_domain_function_template { 589struct sas_domain_function_template {
590 /* The class calls these to notify the LLDD of an event. */ 590 /* The class calls these to notify the LLDD of an event. */
@@ -614,6 +614,10 @@ struct sas_domain_function_template {
614 614
615 /* Phy management */ 615 /* Phy management */
616 int (*lldd_control_phy)(struct asd_sas_phy *, enum phy_func, void *); 616 int (*lldd_control_phy)(struct asd_sas_phy *, enum phy_func, void *);
617
618 /* GPIO support */
619 int (*lldd_write_gpio)(struct sas_ha_struct *, u8 reg_type,
620 u8 reg_index, u8 reg_count, u8 *write_data);
617}; 621};
618 622
619extern int sas_register_ha(struct sas_ha_struct *); 623extern int sas_register_ha(struct sas_ha_struct *);
@@ -652,7 +656,7 @@ int sas_discover_event(struct asd_sas_port *, enum discover_event ev);
652int sas_discover_sata(struct domain_device *); 656int sas_discover_sata(struct domain_device *);
653int sas_discover_end_dev(struct domain_device *); 657int sas_discover_end_dev(struct domain_device *);
654 658
655void sas_unregister_dev(struct domain_device *); 659void sas_unregister_dev(struct asd_sas_port *port, struct domain_device *);
656 660
657void sas_init_dev(struct domain_device *); 661void sas_init_dev(struct domain_device *);
658 662