You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

edd.h 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. #ifndef _IPXE_EDD_H
  2. #define _IPXE_EDD_H
  3. /** @file
  4. *
  5. * Enhanced Disk Drive specification
  6. *
  7. */
  8. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  9. #include <stdint.h>
  10. #include <ipxe/interface.h>
  11. /** An EDD host bus type */
  12. struct edd_host_bus_type {
  13. /** Type */
  14. uint32_t type;
  15. } __attribute__ (( packed ));
  16. /** EDD bus type */
  17. #define EDD_BUS_TYPE_FIXED( a, b, c, d, ... ) \
  18. ( ( (a) << 0 ) | ( (b) << 8 ) | ( (c) << 16 ) | ( (d) << 24 ) )
  19. #define EDD_BUS_TYPE( ... ) \
  20. EDD_BUS_TYPE_FIXED ( __VA_ARGS__, ' ', ' ', ' ', ' ' )
  21. /** EDD PCI bus type */
  22. #define EDD_BUS_TYPE_PCI EDD_BUS_TYPE ( 'P', 'C', 'I' )
  23. /** EDD ISA bus type */
  24. #define EDD_BUS_TYPE_ISA EDD_BUS_TYPE ( 'I', 'S', 'A' )
  25. /** EDD PCI-X bus type */
  26. #define EDD_BUS_TYPE_PCIX EDD_BUS_TYPE ( 'P', 'C', 'I', 'X' )
  27. /** EDD Infiniband bus type */
  28. #define EDD_BUS_TYPE_IBND EDD_BUS_TYPE ( 'I', 'B', 'N', 'D' )
  29. /** EDD PCI Express bus type */
  30. #define EDD_BUS_TYPE_XPRS EDD_BUS_TYPE ( 'X', 'P', 'R', 'S' )
  31. /** EDD HyperTransport bus type */
  32. #define EDD_BUS_TYPE_HTPT EDD_BUS_TYPE ( 'H', 'T', 'P', 'T' )
  33. /** An EDD interface type */
  34. struct edd_interface_type {
  35. /** Type */
  36. uint64_t type;
  37. } __attribute__ (( packed ));
  38. /** EDD interface type */
  39. #define EDD_INTF_TYPE_FIXED( a, b, c, d, e, f, g, h, ... ) \
  40. ( ( ( ( uint64_t ) (a) ) << 0 ) | ( ( ( uint64_t ) (b) ) << 8 ) | \
  41. ( ( ( uint64_t ) (c) ) << 16 ) | ( ( ( uint64_t ) (d) ) << 24 ) | \
  42. ( ( ( uint64_t ) (e) ) << 32 ) | ( ( ( uint64_t ) (f) ) << 40 ) | \
  43. ( ( ( uint64_t ) (g) ) << 48 ) | ( ( ( uint64_t ) (h) ) << 56 ) )
  44. #define EDD_INTF_TYPE( ... ) \
  45. EDD_INTF_TYPE_FIXED ( __VA_ARGS__, \
  46. ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' )
  47. /** EDD ATA interface type */
  48. #define EDD_INTF_TYPE_ATA EDD_INTF_TYPE ( 'A', 'T', 'A' )
  49. /** EDD ATAPI interface type */
  50. #define EDD_INTF_TYPE_ATAPI EDD_INTF_TYPE ( 'A', 'T', 'A', 'P', 'I' )
  51. /** EDD SCSI interface type */
  52. #define EDD_INTF_TYPE_SCSI EDD_INTF_TYPE ( 'S', 'C', 'S', 'I' )
  53. /** EDD USB interface type */
  54. #define EDD_INTF_TYPE_USB EDD_INTF_TYPE ( 'U', 'S', 'B' )
  55. /** EDD 1394 interface type */
  56. #define EDD_INTF_TYPE_1394 EDD_INTF_TYPE ( '1', '3', '9', '4' )
  57. /** EDD Fibre Channel interface type */
  58. #define EDD_INTF_TYPE_FIBRE EDD_INTF_TYPE ( 'F', 'I', 'B', 'R', 'E' )
  59. /** EDD I2O interface type */
  60. #define EDD_INTF_TYPE_I2O EDD_INTF_TYPE ( 'I', '2', 'O' )
  61. /** EDD RAID interface type */
  62. #define EDD_INTF_TYPE_RAID EDD_INTF_TYPE ( 'R', 'A', 'I', 'D' )
  63. /** EDD SATA interface type */
  64. #define EDD_INTF_TYPE_SATA EDD_INTF_TYPE ( 'S', 'A', 'T', 'A' )
  65. /** EDD SAS interface type */
  66. #define EDD_INTF_TYPE_SAS EDD_INTF_TYPE ( 'S', 'A', 'S' )
  67. /** An EDD interface path */
  68. union edd_interface_path {
  69. /** Legacy bus type */
  70. struct {
  71. /** Base address */
  72. uint16_t base;
  73. } __attribute__ (( packed )) legacy;
  74. /** PCI, PCI-X, PCI Express, or HyperTransport bus type */
  75. struct {
  76. /** Bus */
  77. uint8_t bus;
  78. /** Slot */
  79. uint8_t slot;
  80. /** Function */
  81. uint8_t function;
  82. /** Channel number */
  83. uint8_t channel;
  84. } __attribute__ (( packed )) pci;
  85. /** Padding */
  86. uint8_t pad[8];
  87. } __attribute__ (( packed ));
  88. /** An EDD device path */
  89. union edd_device_path {
  90. /** ATA interface type */
  91. struct {
  92. /** Slave */
  93. uint8_t slave;
  94. } __attribute__ (( packed )) ata;
  95. /** ATAPI interface type */
  96. struct {
  97. /** Slave */
  98. uint8_t slave;
  99. /** Logical Unit Number */
  100. uint8_t lun;
  101. } __attribute__ (( packed )) atapi;
  102. /** SCSI interface type */
  103. struct {
  104. /** SCSI ID */
  105. uint16_t id;
  106. /** Logical Unit Number */
  107. uint64_t lun;
  108. } __attribute__ (( packed )) scsi;
  109. /** USB interface type */
  110. struct {
  111. /** Serial number */
  112. uint64_t serial;
  113. } __attribute__ (( packed )) usb;
  114. /** IEEE1394 interface type */
  115. struct {
  116. /** GUID */
  117. uint64_t guid;
  118. } __attribute__ (( packed )) ieee1394;
  119. /** Fibre Channel interface type */
  120. struct {
  121. /** WWN */
  122. uint64_t wwn;
  123. /** Logical Unit Number */
  124. uint64_t lun;
  125. } __attribute__ (( packed )) fibre;
  126. /** I2O interface type */
  127. struct {
  128. /** Identity tag */
  129. uint64_t tag;
  130. } __attribute__ (( packed )) i2o;
  131. /** RAID interface type */
  132. struct {
  133. /** Array number */
  134. uint32_t array;
  135. } __attribute__ (( packed )) raid;
  136. /** SATA interface type */
  137. struct {
  138. /** Port number */
  139. uint8_t port;
  140. /** Port multiplier number */
  141. uint8_t multiplier;
  142. } __attribute__ (( packed )) sata;
  143. /** SAS interface type */
  144. struct {
  145. /** Address */
  146. uint64_t address;
  147. } __attribute__ (( packed )) sas;
  148. /** Padding */
  149. uint8_t pad[16];
  150. } __attribute__ (( packed ));
  151. /** EDD device path information */
  152. struct edd_device_path_information {
  153. /** Key */
  154. uint16_t key;
  155. /** Length of this structure */
  156. uint8_t len;
  157. /** Reserved */
  158. uint8_t reserved_a[3];
  159. /** Host bus type */
  160. struct edd_host_bus_type host_bus_type;
  161. /** Interface type */
  162. struct edd_interface_type interface_type;
  163. /** Interface path */
  164. union edd_interface_path interface_path;
  165. /** Device path */
  166. union edd_device_path device_path;
  167. /** Reserved */
  168. uint8_t reserved_b;
  169. /** Checksum */
  170. uint8_t checksum;
  171. } __attribute__ (( packed ));
  172. /** EDD device path information key */
  173. #define EDD_DEVICE_PATH_INFO_KEY 0xbedd
  174. extern int edd_describe ( struct interface *intf,
  175. struct edd_interface_type *type,
  176. union edd_device_path *path );
  177. #define edd_describe_TYPE( object_type ) \
  178. typeof ( int ( object_type, struct edd_interface_type *type, \
  179. union edd_device_path *path ) )
  180. #endif /* _IPXE_EDD_H */