iPXE
aoe.h
Go to the documentation of this file.
00001 #ifndef _IPXE_AOE_H
00002 #define _IPXE_AOE_H
00003 
00004 /** @file
00005  *
00006  * AoE protocol
00007  *
00008  */
00009 
00010 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
00011 
00012 #include <stdint.h>
00013 #include <ipxe/list.h>
00014 #include <ipxe/if_ether.h>
00015 #include <ipxe/retry.h>
00016 #include <ipxe/ata.h>
00017 #include <ipxe/acpi.h>
00018 
00019 /** An AoE config command */
00020 struct aoecfg {
00021         /** AoE queue depth */
00022         uint16_t bufcnt;
00023         /** ATA target firmware version */
00024         uint16_t fwver;
00025         /** ATA target sector count */
00026         uint8_t scnt;
00027         /** AoE config string subcommand */
00028         uint8_t aoeccmd;
00029         /** AoE config string length */
00030         uint16_t cfglen;
00031         /** AoE config string */
00032         uint8_t data[0];
00033 } __attribute__ (( packed ));
00034 
00035 /** An AoE ATA command */
00036 struct aoeata {
00037         /** AoE command flags */
00038         uint8_t aflags;
00039         /** ATA error/feature register */
00040         uint8_t err_feat;
00041         /** ATA sector count register */
00042         uint8_t count;
00043         /** ATA command/status register */
00044         uint8_t cmd_stat;
00045         /** Logical block address, in little-endian order */
00046         union {
00047                 uint64_t u64;
00048                 uint8_t bytes[6];
00049         } lba;
00050         /** Data payload */
00051         uint8_t data[0];
00052 } __attribute__ (( packed ));
00053 
00054 #define AOE_FL_EXTENDED 0x40    /**< LBA48 extended addressing */
00055 #define AOE_FL_DEV_HEAD 0x10    /**< Device/head flag */
00056 #define AOE_FL_ASYNC    0x02    /**< Asynchronous write */
00057 #define AOE_FL_WRITE    0x01    /**< Write command */
00058 
00059 /** An AoE command */
00060 union aoecmd {
00061         /** Config command */
00062         struct aoecfg cfg;
00063         /** ATA command */
00064         struct aoeata ata;
00065 };
00066 
00067 /** An AoE header */
00068 struct aoehdr {
00069         /** Protocol version number and flags */
00070         uint8_t ver_flags;
00071         /** Error code */
00072         uint8_t error;
00073         /** Major device number, in network byte order */
00074         uint16_t major;
00075         /** Minor device number */
00076         uint8_t minor;
00077         /** Command number */
00078         uint8_t command;
00079         /** Tag, in network byte order */
00080         uint32_t tag;
00081         /** Payload */
00082         union aoecmd payload[0];
00083 } __attribute__ (( packed ));
00084 
00085 #define AOE_VERSION     0x10    /**< Version 1 */
00086 #define AOE_VERSION_MASK 0xf0   /**< Version part of ver_flags field */
00087 
00088 #define AOE_FL_RESPONSE 0x08    /**< Message is a response */
00089 #define AOE_FL_ERROR    0x04    /**< Command generated an error */
00090 
00091 #define AOE_MAJOR_BROADCAST 0xffff
00092 #define AOE_MINOR_BROADCAST 0xff
00093 
00094 #define AOE_CMD_ATA     0x00    /**< Issue ATA command */
00095 #define AOE_CMD_CONFIG  0x01    /**< Query Config Information */
00096 
00097 #define AOE_ERR_BAD_COMMAND     1 /**< Unrecognised command code */
00098 #define AOE_ERR_BAD_PARAMETER   2 /**< Bad argument parameter */
00099 #define AOE_ERR_UNAVAILABLE     3 /**< Device unavailable */
00100 #define AOE_ERR_CONFIG_EXISTS   4 /**< Config string present */
00101 #define AOE_ERR_BAD_VERSION     5 /**< Unsupported version */
00102 
00103 #define AOE_STATUS_ERR_MASK     0x0f /**< Error portion of status code */ 
00104 #define AOE_STATUS_PENDING      0x80 /**< Command pending */
00105 
00106 /** AoE tag magic marker */
00107 #define AOE_TAG_MAGIC 0x18ae0000
00108 
00109 /** Maximum number of sectors per packet */
00110 #define AOE_MAX_COUNT 2
00111 
00112 /** AoE boot firmware table signature */
00113 #define ABFT_SIG ACPI_SIGNATURE ( 'a', 'B', 'F', 'T' )
00114 
00115 /**
00116  * AoE Boot Firmware Table (aBFT)
00117  */
00118 struct abft_table {
00119         /** ACPI header */
00120         struct acpi_header acpi;
00121         /** AoE shelf */
00122         uint16_t shelf;
00123         /** AoE slot */
00124         uint8_t slot;
00125         /** Reserved */
00126         uint8_t reserved_a;
00127         /** MAC address */
00128         uint8_t mac[ETH_ALEN];
00129 } __attribute__ (( packed ));
00130 
00131 #endif /* _IPXE_AOE_H */