scsi_transport_sas.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #ifndef SCSI_TRANSPORT_SAS_H
  2. #define SCSI_TRANSPORT_SAS_H
  3. #include <linux/transport_class.h>
  4. #include <linux/types.h>
  5. struct scsi_transport_template;
  6. struct sas_rphy;
  7. enum sas_device_type {
  8. SAS_PHY_UNUSED,
  9. SAS_END_DEVICE,
  10. SAS_EDGE_EXPANDER_DEVICE,
  11. SAS_FANOUT_EXPANDER_DEVICE,
  12. };
  13. enum sas_protocol {
  14. SAS_PROTOCOL_SATA = 0x01,
  15. SAS_PROTOCOL_SMP = 0x02,
  16. SAS_PROTOCOL_STP = 0x04,
  17. SAS_PROTOCOL_SSP = 0x08,
  18. };
  19. enum sas_linkrate {
  20. SAS_LINK_RATE_UNKNOWN,
  21. SAS_PHY_DISABLED,
  22. SAS_LINK_RATE_FAILED,
  23. SAS_SATA_SPINUP_HOLD,
  24. SAS_SATA_PORT_SELECTOR,
  25. SAS_LINK_RATE_1_5_GBPS,
  26. SAS_LINK_RATE_3_0_GBPS,
  27. SAS_LINK_VIRTUAL,
  28. };
  29. struct sas_identify {
  30. enum sas_device_type device_type;
  31. enum sas_protocol initiator_port_protocols;
  32. enum sas_protocol target_port_protocols;
  33. u64 sas_address;
  34. u8 phy_identifier;
  35. };
  36. /* The functions by which the transport class and the driver communicate */
  37. struct sas_function_template {
  38. };
  39. struct sas_phy {
  40. struct device dev;
  41. int number;
  42. struct sas_identify identify;
  43. enum sas_linkrate negotiated_linkrate;
  44. enum sas_linkrate minimum_linkrate_hw;
  45. enum sas_linkrate minimum_linkrate;
  46. enum sas_linkrate maximum_linkrate_hw;
  47. enum sas_linkrate maximum_linkrate;
  48. u8 port_identifier;
  49. struct sas_rphy *rphy;
  50. };
  51. #define dev_to_phy(d) \
  52. container_of((d), struct sas_phy, dev)
  53. #define transport_class_to_phy(cdev) \
  54. dev_to_phy((cdev)->dev)
  55. #define phy_to_shost(phy) \
  56. dev_to_shost((phy)->dev.parent)
  57. struct sas_rphy {
  58. struct device dev;
  59. struct sas_identify identify;
  60. struct list_head list;
  61. u32 scsi_target_id;
  62. };
  63. #define dev_to_rphy(d) \
  64. container_of((d), struct sas_rphy, dev)
  65. #define transport_class_to_rphy(cdev) \
  66. dev_to_rphy((cdev)->dev)
  67. #define rphy_to_shost(rphy) \
  68. dev_to_shost((rphy)->dev.parent)
  69. extern void sas_remove_host(struct Scsi_Host *);
  70. extern struct sas_phy *sas_phy_alloc(struct device *, int);
  71. extern void sas_phy_free(struct sas_phy *);
  72. extern int sas_phy_add(struct sas_phy *);
  73. extern void sas_phy_delete(struct sas_phy *);
  74. extern int scsi_is_sas_phy(const struct device *);
  75. extern struct sas_rphy *sas_rphy_alloc(struct sas_phy *);
  76. void sas_rphy_free(struct sas_rphy *);
  77. extern int sas_rphy_add(struct sas_rphy *);
  78. extern void sas_rphy_delete(struct sas_rphy *);
  79. extern int scsi_is_sas_rphy(const struct device *);
  80. extern struct scsi_transport_template *
  81. sas_attach_transport(struct sas_function_template *);
  82. extern void sas_release_transport(struct scsi_transport_template *);
  83. #endif /* SCSI_TRANSPORT_SAS_H */