libsas.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722
  1. /*
  2. * SAS host prototypes and structures header file
  3. *
  4. * Copyright (C) 2005 Adaptec, Inc. All rights reserved.
  5. * Copyright (C) 2005 Luben Tuikov <luben_tuikov@adaptec.com>
  6. *
  7. * This file is licensed under GPLv2.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License as
  11. * published by the Free Software Foundation; either version 2 of the
  12. * License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful, but
  15. * WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  22. * USA
  23. *
  24. */
  25. #ifndef _LIBSAS_H_
  26. #define _LIBSAS_H_
  27. #include <linux/timer.h>
  28. #include <linux/pci.h>
  29. #include <scsi/sas.h>
  30. #include <linux/libata.h>
  31. #include <linux/list.h>
  32. #include <scsi/scsi_device.h>
  33. #include <scsi/scsi_cmnd.h>
  34. #include <scsi/scsi_transport_sas.h>
  35. #include <linux/scatterlist.h>
  36. #include <linux/slab.h>
  37. struct block_device;
  38. enum sas_class {
  39. SAS,
  40. EXPANDER
  41. };
  42. enum sas_phy_role {
  43. PHY_ROLE_NONE = 0,
  44. PHY_ROLE_TARGET = 0x40,
  45. PHY_ROLE_INITIATOR = 0x80,
  46. };
  47. enum sas_phy_type {
  48. PHY_TYPE_PHYSICAL,
  49. PHY_TYPE_VIRTUAL
  50. };
  51. /* The events are mnemonically described in sas_dump.c
  52. * so when updating/adding events here, please also
  53. * update the other file too.
  54. */
  55. enum port_event {
  56. PORTE_BYTES_DMAED = 0U,
  57. PORTE_BROADCAST_RCVD,
  58. PORTE_LINK_RESET_ERR,
  59. PORTE_TIMER_EVENT,
  60. PORTE_HARD_RESET,
  61. PORT_NUM_EVENTS,
  62. };
  63. enum phy_event {
  64. PHYE_LOSS_OF_SIGNAL = 0U,
  65. PHYE_OOB_DONE,
  66. PHYE_OOB_ERROR,
  67. PHYE_SPINUP_HOLD, /* hot plug SATA, no COMWAKE sent */
  68. PHYE_RESUME_TIMEOUT,
  69. PHYE_SHUTDOWN,
  70. PHY_NUM_EVENTS,
  71. };
  72. enum discover_event {
  73. DISCE_DISCOVER_DOMAIN = 0U,
  74. DISCE_REVALIDATE_DOMAIN,
  75. DISCE_SUSPEND,
  76. DISCE_RESUME,
  77. DISC_NUM_EVENTS,
  78. };
  79. /* ---------- Expander Devices ---------- */
  80. #define to_dom_device(_obj) container_of(_obj, struct domain_device, dev_obj)
  81. #define to_dev_attr(_attr) container_of(_attr, struct domain_dev_attribute,\
  82. attr)
  83. enum routing_attribute {
  84. DIRECT_ROUTING,
  85. SUBTRACTIVE_ROUTING,
  86. TABLE_ROUTING,
  87. };
  88. enum ex_phy_state {
  89. PHY_EMPTY,
  90. PHY_VACANT,
  91. PHY_NOT_PRESENT,
  92. PHY_DEVICE_DISCOVERED
  93. };
  94. struct ex_phy {
  95. int phy_id;
  96. enum ex_phy_state phy_state;
  97. enum sas_device_type attached_dev_type;
  98. enum sas_linkrate linkrate;
  99. u8 attached_sata_host:1;
  100. u8 attached_sata_dev:1;
  101. u8 attached_sata_ps:1;
  102. enum sas_protocol attached_tproto;
  103. enum sas_protocol attached_iproto;
  104. u8 attached_sas_addr[SAS_ADDR_SIZE];
  105. u8 attached_phy_id;
  106. int phy_change_count;
  107. enum routing_attribute routing_attr;
  108. u8 virtual:1;
  109. int last_da_index;
  110. struct sas_phy *phy;
  111. struct sas_port *port;
  112. };
  113. struct expander_device {
  114. struct list_head children;
  115. int ex_change_count;
  116. u16 max_route_indexes;
  117. u8 num_phys;
  118. u8 t2t_supp:1;
  119. u8 configuring:1;
  120. u8 conf_route_table:1;
  121. u8 enclosure_logical_id[8];
  122. struct ex_phy *ex_phy;
  123. struct sas_port *parent_port;
  124. struct mutex cmd_mutex;
  125. };
  126. /* ---------- SATA device ---------- */
  127. #define ATA_RESP_FIS_SIZE 24
  128. struct sata_device {
  129. unsigned int class;
  130. u8 port_no; /* port number, if this is a PM (Port) */
  131. struct ata_port *ap;
  132. struct ata_host *ata_host;
  133. struct smp_resp rps_resp ____cacheline_aligned; /* report_phy_sata_resp */
  134. u8 fis[ATA_RESP_FIS_SIZE];
  135. };
  136. struct ssp_device {
  137. struct list_head eh_list_node; /* pending a user requested eh action */
  138. struct scsi_lun reset_lun;
  139. };
  140. enum {
  141. SAS_DEV_GONE,
  142. SAS_DEV_FOUND, /* device notified to lldd */
  143. SAS_DEV_DESTROY,
  144. SAS_DEV_EH_PENDING,
  145. SAS_DEV_LU_RESET,
  146. SAS_DEV_RESET,
  147. };
  148. struct domain_device {
  149. spinlock_t done_lock;
  150. enum sas_device_type dev_type;
  151. enum sas_linkrate linkrate;
  152. enum sas_linkrate min_linkrate;
  153. enum sas_linkrate max_linkrate;
  154. int pathways;
  155. struct domain_device *parent;
  156. struct list_head siblings; /* devices on the same level */
  157. struct asd_sas_port *port; /* shortcut to root of the tree */
  158. struct sas_phy *phy;
  159. struct list_head dev_list_node;
  160. struct list_head disco_list_node; /* awaiting probe or destruct */
  161. enum sas_protocol iproto;
  162. enum sas_protocol tproto;
  163. struct sas_rphy *rphy;
  164. u8 sas_addr[SAS_ADDR_SIZE];
  165. u8 hashed_sas_addr[HASHED_SAS_ADDR_SIZE];
  166. u8 frame_rcvd[32];
  167. union {
  168. struct expander_device ex_dev;
  169. struct sata_device sata_dev; /* STP & directly attached */
  170. struct ssp_device ssp_dev;
  171. };
  172. void *lldd_dev;
  173. unsigned long state;
  174. struct kref kref;
  175. };
  176. struct sas_work {
  177. struct list_head drain_node;
  178. struct work_struct work;
  179. };
  180. static inline void INIT_SAS_WORK(struct sas_work *sw, void (*fn)(struct work_struct *))
  181. {
  182. INIT_WORK(&sw->work, fn);
  183. INIT_LIST_HEAD(&sw->drain_node);
  184. }
  185. struct sas_discovery_event {
  186. struct sas_work work;
  187. struct asd_sas_port *port;
  188. };
  189. static inline struct sas_discovery_event *to_sas_discovery_event(struct work_struct *work)
  190. {
  191. struct sas_discovery_event *ev = container_of(work, typeof(*ev), work.work);
  192. return ev;
  193. }
  194. struct sas_discovery {
  195. struct sas_discovery_event disc_work[DISC_NUM_EVENTS];
  196. unsigned long pending;
  197. u8 fanout_sas_addr[8];
  198. u8 eeds_a[8];
  199. u8 eeds_b[8];
  200. int max_level;
  201. };
  202. /* The port struct is Class:RW, driver:RO */
  203. struct asd_sas_port {
  204. /* private: */
  205. struct sas_discovery disc;
  206. struct domain_device *port_dev;
  207. spinlock_t dev_list_lock;
  208. struct list_head dev_list;
  209. struct list_head disco_list;
  210. struct list_head destroy_list;
  211. struct list_head sas_port_del_list;
  212. enum sas_linkrate linkrate;
  213. struct sas_work work;
  214. int suspended;
  215. /* public: */
  216. int id;
  217. enum sas_class class;
  218. u8 sas_addr[SAS_ADDR_SIZE];
  219. u8 attached_sas_addr[SAS_ADDR_SIZE];
  220. enum sas_protocol iproto;
  221. enum sas_protocol tproto;
  222. enum sas_oob_mode oob_mode;
  223. spinlock_t phy_list_lock;
  224. struct list_head phy_list;
  225. int num_phys;
  226. u32 phy_mask;
  227. struct sas_ha_struct *ha;
  228. struct sas_port *port;
  229. void *lldd_port; /* not touched by the sas class code */
  230. };
  231. struct asd_sas_event {
  232. struct sas_work work;
  233. struct asd_sas_phy *phy;
  234. int event;
  235. };
  236. static inline struct asd_sas_event *to_asd_sas_event(struct work_struct *work)
  237. {
  238. struct asd_sas_event *ev = container_of(work, typeof(*ev), work.work);
  239. return ev;
  240. }
  241. static inline void INIT_SAS_EVENT(struct asd_sas_event *ev,
  242. void (*fn)(struct work_struct *),
  243. struct asd_sas_phy *phy, int event)
  244. {
  245. INIT_SAS_WORK(&ev->work, fn);
  246. ev->phy = phy;
  247. ev->event = event;
  248. }
  249. #define SAS_PHY_SHUTDOWN_THRES 1024
  250. /* The phy pretty much is controlled by the LLDD.
  251. * The class only reads those fields.
  252. */
  253. struct asd_sas_phy {
  254. /* private: */
  255. atomic_t event_nr;
  256. int in_shutdown;
  257. int error;
  258. int suspended;
  259. struct sas_phy *phy;
  260. /* public: */
  261. /* The following are class:RO, driver:R/W */
  262. int enabled; /* must be set */
  263. int id; /* must be set */
  264. enum sas_class class;
  265. enum sas_protocol iproto;
  266. enum sas_protocol tproto;
  267. enum sas_phy_type type;
  268. enum sas_phy_role role;
  269. enum sas_oob_mode oob_mode;
  270. enum sas_linkrate linkrate;
  271. u8 *sas_addr; /* must be set */
  272. u8 attached_sas_addr[SAS_ADDR_SIZE]; /* class:RO, driver: R/W */
  273. spinlock_t frame_rcvd_lock;
  274. u8 *frame_rcvd; /* must be set */
  275. int frame_rcvd_size;
  276. spinlock_t sas_prim_lock;
  277. u32 sas_prim;
  278. struct list_head port_phy_el; /* driver:RO */
  279. struct asd_sas_port *port; /* Class:RW, driver: RO */
  280. struct sas_ha_struct *ha; /* may be set; the class sets it anyway */
  281. void *lldd_phy; /* not touched by the sas_class_code */
  282. };
  283. struct scsi_core {
  284. struct Scsi_Host *shost;
  285. };
  286. enum sas_ha_state {
  287. SAS_HA_REGISTERED,
  288. SAS_HA_DRAINING,
  289. SAS_HA_ATA_EH_ACTIVE,
  290. SAS_HA_FROZEN,
  291. };
  292. struct sas_ha_struct {
  293. /* private: */
  294. struct list_head defer_q; /* work queued while draining */
  295. struct mutex drain_mutex;
  296. unsigned long state;
  297. spinlock_t lock;
  298. int eh_active;
  299. wait_queue_head_t eh_wait_q;
  300. struct list_head eh_dev_q;
  301. struct mutex disco_mutex;
  302. struct scsi_core core;
  303. /* public: */
  304. char *sas_ha_name;
  305. struct device *dev; /* should be set */
  306. struct module *lldd_module; /* should be set */
  307. struct workqueue_struct *event_q;
  308. struct workqueue_struct *disco_q;
  309. u8 *sas_addr; /* must be set */
  310. u8 hashed_sas_addr[HASHED_SAS_ADDR_SIZE];
  311. spinlock_t phy_port_lock;
  312. struct asd_sas_phy **sas_phy; /* array of valid pointers, must be set */
  313. struct asd_sas_port **sas_port; /* array of valid pointers, must be set */
  314. int num_phys; /* must be set, gt 0, static */
  315. int strict_wide_ports; /* both sas_addr and attached_sas_addr must match
  316. * their siblings when forming wide ports */
  317. /* LLDD calls these to notify the class of an event. */
  318. int (*notify_port_event)(struct asd_sas_phy *, enum port_event);
  319. int (*notify_phy_event)(struct asd_sas_phy *, enum phy_event);
  320. void *lldd_ha; /* not touched by sas class code */
  321. struct list_head eh_done_q; /* complete via scsi_eh_flush_done_q */
  322. struct list_head eh_ata_q; /* scmds to promote from sas to ata eh */
  323. int event_thres;
  324. };
  325. #define SHOST_TO_SAS_HA(_shost) (*(struct sas_ha_struct **)(_shost)->hostdata)
  326. static inline struct domain_device *
  327. starget_to_domain_dev(struct scsi_target *starget) {
  328. return starget->hostdata;
  329. }
  330. static inline struct domain_device *
  331. sdev_to_domain_dev(struct scsi_device *sdev) {
  332. return starget_to_domain_dev(sdev->sdev_target);
  333. }
  334. static inline struct ata_device *sas_to_ata_dev(struct domain_device *dev)
  335. {
  336. return &dev->sata_dev.ap->link.device[0];
  337. }
  338. static inline struct domain_device *
  339. cmd_to_domain_dev(struct scsi_cmnd *cmd)
  340. {
  341. return sdev_to_domain_dev(cmd->device);
  342. }
  343. void sas_hash_addr(u8 *hashed, const u8 *sas_addr);
  344. /* Before calling a notify event, LLDD should use this function
  345. * when the link is severed (possibly from its tasklet).
  346. * The idea is that the Class only reads those, while the LLDD,
  347. * can R/W these (thus avoiding a race).
  348. */
  349. static inline void sas_phy_disconnected(struct asd_sas_phy *phy)
  350. {
  351. phy->oob_mode = OOB_NOT_CONNECTED;
  352. phy->linkrate = SAS_LINK_RATE_UNKNOWN;
  353. }
  354. static inline unsigned int to_sas_gpio_od(int device, int bit)
  355. {
  356. return 3 * device + bit;
  357. }
  358. static inline void sas_put_local_phy(struct sas_phy *phy)
  359. {
  360. put_device(&phy->dev);
  361. }
  362. #ifdef CONFIG_SCSI_SAS_HOST_SMP
  363. int try_test_sas_gpio_gp_bit(unsigned int od, u8 *data, u8 index, u8 count);
  364. #else
  365. static inline int try_test_sas_gpio_gp_bit(unsigned int od, u8 *data, u8 index, u8 count)
  366. {
  367. return -1;
  368. }
  369. #endif
  370. /* ---------- Tasks ---------- */
  371. /*
  372. service_response | SAS_TASK_COMPLETE | SAS_TASK_UNDELIVERED |
  373. exec_status | | |
  374. ---------------------+---------------------+-----------------------+
  375. SAM_... | X | |
  376. DEV_NO_RESPONSE | X | X |
  377. INTERRUPTED | X | |
  378. QUEUE_FULL | | X |
  379. DEVICE_UNKNOWN | | X |
  380. SG_ERR | | X |
  381. ---------------------+---------------------+-----------------------+
  382. */
  383. enum service_response {
  384. SAS_TASK_COMPLETE,
  385. SAS_TASK_UNDELIVERED = -1,
  386. };
  387. enum exec_status {
  388. /* The SAM_STAT_.. codes fit in the lower 6 bits, alias some of
  389. * them here to silence 'case value not in enumerated type' warnings
  390. */
  391. __SAM_STAT_CHECK_CONDITION = SAM_STAT_CHECK_CONDITION,
  392. SAS_DEV_NO_RESPONSE = 0x80,
  393. SAS_DATA_UNDERRUN,
  394. SAS_DATA_OVERRUN,
  395. SAS_INTERRUPTED,
  396. SAS_QUEUE_FULL,
  397. SAS_DEVICE_UNKNOWN,
  398. SAS_SG_ERR,
  399. SAS_OPEN_REJECT,
  400. SAS_OPEN_TO,
  401. SAS_PROTO_RESPONSE,
  402. SAS_PHY_DOWN,
  403. SAS_NAK_R_ERR,
  404. SAS_PENDING,
  405. SAS_ABORTED_TASK,
  406. };
  407. /* When a task finishes with a response, the LLDD examines the
  408. * response:
  409. * - For an ATA task task_status_struct::stat is set to
  410. * SAS_PROTO_RESPONSE, and the task_status_struct::buf is set to the
  411. * contents of struct ata_task_resp.
  412. * - For SSP tasks, if no data is present or status/TMF response
  413. * is valid, task_status_struct::stat is set. If data is present
  414. * (SENSE data), the LLDD copies up to SAS_STATUS_BUF_SIZE, sets
  415. * task_status_struct::buf_valid_size, and task_status_struct::stat is
  416. * set to SAM_CHECK_COND.
  417. *
  418. * "buf" has format SCSI Sense for SSP task, or struct ata_task_resp
  419. * for ATA task.
  420. *
  421. * "frame_len" is the total frame length, which could be more or less
  422. * than actually copied.
  423. *
  424. * Tasks ending with response, always set the residual field.
  425. */
  426. struct ata_task_resp {
  427. u16 frame_len;
  428. u8 ending_fis[ATA_RESP_FIS_SIZE]; /* dev to host or data-in */
  429. };
  430. #define SAS_STATUS_BUF_SIZE 96
  431. struct task_status_struct {
  432. enum service_response resp;
  433. enum exec_status stat;
  434. int buf_valid_size;
  435. u8 buf[SAS_STATUS_BUF_SIZE];
  436. u32 residual;
  437. enum sas_open_rej_reason open_rej_reason;
  438. };
  439. /* ATA and ATAPI task queuable to a SAS LLDD.
  440. */
  441. struct sas_ata_task {
  442. struct host_to_dev_fis fis;
  443. u8 atapi_packet[16]; /* 0 if not ATAPI task */
  444. u8 retry_count; /* hardware retry, should be > 0 */
  445. u8 dma_xfer:1; /* PIO:0 or DMA:1 */
  446. u8 use_ncq:1;
  447. u8 set_affil_pol:1;
  448. u8 stp_affil_pol:1;
  449. u8 device_control_reg_update:1;
  450. };
  451. struct sas_smp_task {
  452. struct scatterlist smp_req;
  453. struct scatterlist smp_resp;
  454. };
  455. enum task_attribute {
  456. TASK_ATTR_SIMPLE = 0,
  457. TASK_ATTR_HOQ = 1,
  458. TASK_ATTR_ORDERED= 2,
  459. TASK_ATTR_ACA = 4,
  460. };
  461. struct sas_ssp_task {
  462. u8 retry_count; /* hardware retry, should be > 0 */
  463. u8 LUN[8];
  464. u8 enable_first_burst:1;
  465. enum task_attribute task_attr;
  466. u8 task_prio;
  467. struct scsi_cmnd *cmd;
  468. };
  469. struct sas_task {
  470. struct domain_device *dev;
  471. spinlock_t task_state_lock;
  472. unsigned task_state_flags;
  473. enum sas_protocol task_proto;
  474. union {
  475. struct sas_ata_task ata_task;
  476. struct sas_smp_task smp_task;
  477. struct sas_ssp_task ssp_task;
  478. };
  479. struct scatterlist *scatter;
  480. int num_scatter;
  481. u32 total_xfer_len;
  482. u8 data_dir:2; /* Use PCI_DMA_... */
  483. struct task_status_struct task_status;
  484. void (*task_done)(struct sas_task *);
  485. void *lldd_task; /* for use by LLDDs */
  486. void *uldd_task;
  487. struct sas_task_slow *slow_task;
  488. };
  489. struct sas_task_slow {
  490. /* standard/extra infrastructure for slow path commands (SMP and
  491. * internal lldd commands
  492. */
  493. struct timer_list timer;
  494. struct completion completion;
  495. struct sas_task *task;
  496. };
  497. #define SAS_TASK_STATE_PENDING 1
  498. #define SAS_TASK_STATE_DONE 2
  499. #define SAS_TASK_STATE_ABORTED 4
  500. #define SAS_TASK_NEED_DEV_RESET 8
  501. #define SAS_TASK_AT_INITIATOR 16
  502. extern struct sas_task *sas_alloc_task(gfp_t flags);
  503. extern struct sas_task *sas_alloc_slow_task(gfp_t flags);
  504. extern void sas_free_task(struct sas_task *task);
  505. struct sas_domain_function_template {
  506. /* The class calls these to notify the LLDD of an event. */
  507. void (*lldd_port_formed)(struct asd_sas_phy *);
  508. void (*lldd_port_deformed)(struct asd_sas_phy *);
  509. /* The class calls these when a device is found or gone. */
  510. int (*lldd_dev_found)(struct domain_device *);
  511. void (*lldd_dev_gone)(struct domain_device *);
  512. int (*lldd_execute_task)(struct sas_task *, gfp_t gfp_flags);
  513. /* Task Management Functions. Must be called from process context. */
  514. int (*lldd_abort_task)(struct sas_task *);
  515. int (*lldd_abort_task_set)(struct domain_device *, u8 *lun);
  516. int (*lldd_clear_aca)(struct domain_device *, u8 *lun);
  517. int (*lldd_clear_task_set)(struct domain_device *, u8 *lun);
  518. int (*lldd_I_T_nexus_reset)(struct domain_device *);
  519. int (*lldd_ata_check_ready)(struct domain_device *);
  520. void (*lldd_ata_set_dmamode)(struct domain_device *);
  521. int (*lldd_lu_reset)(struct domain_device *, u8 *lun);
  522. int (*lldd_query_task)(struct sas_task *);
  523. /* Port and Adapter management */
  524. int (*lldd_clear_nexus_port)(struct asd_sas_port *);
  525. int (*lldd_clear_nexus_ha)(struct sas_ha_struct *);
  526. /* Phy management */
  527. int (*lldd_control_phy)(struct asd_sas_phy *, enum phy_func, void *);
  528. /* GPIO support */
  529. int (*lldd_write_gpio)(struct sas_ha_struct *, u8 reg_type,
  530. u8 reg_index, u8 reg_count, u8 *write_data);
  531. };
  532. extern int sas_register_ha(struct sas_ha_struct *);
  533. extern int sas_unregister_ha(struct sas_ha_struct *);
  534. extern void sas_prep_resume_ha(struct sas_ha_struct *sas_ha);
  535. extern void sas_resume_ha(struct sas_ha_struct *sas_ha);
  536. extern void sas_suspend_ha(struct sas_ha_struct *sas_ha);
  537. int sas_set_phy_speed(struct sas_phy *phy,
  538. struct sas_phy_linkrates *rates);
  539. int sas_phy_reset(struct sas_phy *phy, int hard_reset);
  540. extern int sas_queuecommand(struct Scsi_Host * ,struct scsi_cmnd *);
  541. extern int sas_target_alloc(struct scsi_target *);
  542. extern int sas_slave_configure(struct scsi_device *);
  543. extern int sas_change_queue_depth(struct scsi_device *, int new_depth);
  544. extern int sas_bios_param(struct scsi_device *,
  545. struct block_device *,
  546. sector_t capacity, int *hsc);
  547. extern struct scsi_transport_template *
  548. sas_domain_attach_transport(struct sas_domain_function_template *);
  549. extern struct device_attribute dev_attr_phy_event_threshold;
  550. int sas_discover_root_expander(struct domain_device *);
  551. void sas_init_ex_attr(void);
  552. int sas_ex_revalidate_domain(struct domain_device *);
  553. void sas_unregister_domain_devices(struct asd_sas_port *port, int gone);
  554. void sas_init_disc(struct sas_discovery *disc, struct asd_sas_port *);
  555. int sas_discover_event(struct asd_sas_port *, enum discover_event ev);
  556. int sas_discover_sata(struct domain_device *);
  557. int sas_discover_end_dev(struct domain_device *);
  558. void sas_unregister_dev(struct asd_sas_port *port, struct domain_device *);
  559. void sas_init_dev(struct domain_device *);
  560. void sas_task_abort(struct sas_task *);
  561. int sas_eh_abort_handler(struct scsi_cmnd *cmd);
  562. int sas_eh_device_reset_handler(struct scsi_cmnd *cmd);
  563. int sas_eh_target_reset_handler(struct scsi_cmnd *cmd);
  564. extern void sas_target_destroy(struct scsi_target *);
  565. extern int sas_slave_alloc(struct scsi_device *);
  566. extern int sas_ioctl(struct scsi_device *sdev, int cmd, void __user *arg);
  567. extern int sas_drain_work(struct sas_ha_struct *ha);
  568. extern void sas_ssp_task_response(struct device *dev, struct sas_task *task,
  569. struct ssp_response_iu *iu);
  570. struct sas_phy *sas_get_local_phy(struct domain_device *dev);
  571. int sas_request_addr(struct Scsi_Host *shost, u8 *addr);
  572. #endif /* _SASLIB_H_ */