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.

aoe.h 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. #ifndef _IPXE_AOE_H
  2. #define _IPXE_AOE_H
  3. /** @file
  4. *
  5. * AoE protocol
  6. *
  7. */
  8. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  9. #include <stdint.h>
  10. #include <ipxe/list.h>
  11. #include <ipxe/if_ether.h>
  12. #include <ipxe/retry.h>
  13. #include <ipxe/ata.h>
  14. #include <ipxe/acpi.h>
  15. /** An AoE config command */
  16. struct aoecfg {
  17. /** AoE queue depth */
  18. uint16_t bufcnt;
  19. /** ATA target firmware version */
  20. uint16_t fwver;
  21. /** ATA target sector count */
  22. uint8_t scnt;
  23. /** AoE config string subcommand */
  24. uint8_t aoeccmd;
  25. /** AoE config string length */
  26. uint16_t cfglen;
  27. /** AoE config string */
  28. uint8_t data[0];
  29. } __attribute__ (( packed ));
  30. /** An AoE ATA command */
  31. struct aoeata {
  32. /** AoE command flags */
  33. uint8_t aflags;
  34. /** ATA error/feature register */
  35. uint8_t err_feat;
  36. /** ATA sector count register */
  37. uint8_t count;
  38. /** ATA command/status register */
  39. uint8_t cmd_stat;
  40. /** Logical block address, in little-endian order */
  41. union {
  42. uint64_t u64;
  43. uint8_t bytes[6];
  44. } lba;
  45. /** Data payload */
  46. uint8_t data[0];
  47. } __attribute__ (( packed ));
  48. #define AOE_FL_EXTENDED 0x40 /**< LBA48 extended addressing */
  49. #define AOE_FL_DEV_HEAD 0x10 /**< Device/head flag */
  50. #define AOE_FL_ASYNC 0x02 /**< Asynchronous write */
  51. #define AOE_FL_WRITE 0x01 /**< Write command */
  52. /** An AoE command */
  53. union aoecmd {
  54. /** Config command */
  55. struct aoecfg cfg;
  56. /** ATA command */
  57. struct aoeata ata;
  58. };
  59. /** An AoE header */
  60. struct aoehdr {
  61. /** Protocol version number and flags */
  62. uint8_t ver_flags;
  63. /** Error code */
  64. uint8_t error;
  65. /** Major device number, in network byte order */
  66. uint16_t major;
  67. /** Minor device number */
  68. uint8_t minor;
  69. /** Command number */
  70. uint8_t command;
  71. /** Tag, in network byte order */
  72. uint32_t tag;
  73. /** Payload */
  74. union aoecmd payload[0];
  75. } __attribute__ (( packed ));
  76. #define AOE_VERSION 0x10 /**< Version 1 */
  77. #define AOE_VERSION_MASK 0xf0 /**< Version part of ver_flags field */
  78. #define AOE_FL_RESPONSE 0x08 /**< Message is a response */
  79. #define AOE_FL_ERROR 0x04 /**< Command generated an error */
  80. #define AOE_MAJOR_BROADCAST 0xffff
  81. #define AOE_MINOR_BROADCAST 0xff
  82. #define AOE_CMD_ATA 0x00 /**< Issue ATA command */
  83. #define AOE_CMD_CONFIG 0x01 /**< Query Config Information */
  84. #define AOE_ERR_BAD_COMMAND 1 /**< Unrecognised command code */
  85. #define AOE_ERR_BAD_PARAMETER 2 /**< Bad argument parameter */
  86. #define AOE_ERR_UNAVAILABLE 3 /**< Device unavailable */
  87. #define AOE_ERR_CONFIG_EXISTS 4 /**< Config string present */
  88. #define AOE_ERR_BAD_VERSION 5 /**< Unsupported version */
  89. #define AOE_STATUS_ERR_MASK 0x0f /**< Error portion of status code */
  90. #define AOE_STATUS_PENDING 0x80 /**< Command pending */
  91. /** AoE tag magic marker */
  92. #define AOE_TAG_MAGIC 0x18ae0000
  93. /** Maximum number of sectors per packet */
  94. #define AOE_MAX_COUNT 2
  95. /** AoE boot firmware table signature */
  96. #define ABFT_SIG ACPI_SIGNATURE ( 'a', 'B', 'F', 'T' )
  97. /**
  98. * AoE Boot Firmware Table (aBFT)
  99. */
  100. struct abft_table {
  101. /** ACPI header */
  102. struct acpi_header acpi;
  103. /** AoE shelf */
  104. uint16_t shelf;
  105. /** AoE slot */
  106. uint8_t slot;
  107. /** Reserved */
  108. uint8_t reserved_a;
  109. /** MAC address */
  110. uint8_t mac[ETH_ALEN];
  111. } __attribute__ (( packed ));
  112. #endif /* _IPXE_AOE_H */