iPXE
aoe.h
Go to the documentation of this file.
1 #ifndef _IPXE_AOE_H
2 #define _IPXE_AOE_H
3 
4 /** @file
5  *
6  * AoE protocol
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 FILE_SECBOOT ( PERMITTED );
12 
13 #include <stdint.h>
14 #include <ipxe/list.h>
15 #include <ipxe/if_ether.h>
16 #include <ipxe/retry.h>
17 #include <ipxe/ata.h>
18 #include <ipxe/acpi.h>
19 #include <ipxe/netdevice.h>
20 #include <ipxe/interface.h>
21 
22 /** An AoE config command */
23 struct aoecfg {
24  /** AoE queue depth */
26  /** ATA target firmware version */
28  /** ATA target sector count */
30  /** AoE config string subcommand */
32  /** AoE config string length */
34  /** AoE config string */
36 } __attribute__ (( packed ));
37 
38 /** An AoE ATA command */
39 struct aoeata {
40  /** AoE command flags */
42  /** ATA error/feature register */
44  /** ATA sector count register */
46  /** ATA command/status register */
48  /** Logical block address, in little-endian order */
49  union {
52  } lba;
53  /** Data payload */
55 } __attribute__ (( packed ));
56 
57 #define AOE_FL_EXTENDED 0x40 /**< LBA48 extended addressing */
58 #define AOE_FL_DEV_HEAD 0x10 /**< Device/head flag */
59 #define AOE_FL_ASYNC 0x02 /**< Asynchronous write */
60 #define AOE_FL_WRITE 0x01 /**< Write command */
61 
62 /** An AoE command */
63 union aoecmd {
64  /** Config command */
65  struct aoecfg cfg;
66  /** ATA command */
67  struct aoeata ata;
68 };
69 
70 /** An AoE header */
71 struct aoehdr {
72  /** Protocol version number and flags */
74  /** Error code */
76  /** Major device number, in network byte order */
78  /** Minor device number */
80  /** Command number */
82  /** Tag, in network byte order */
84  /** Payload */
85  union aoecmd payload[0];
86 } __attribute__ (( packed ));
87 
88 #define AOE_VERSION 0x10 /**< Version 1 */
89 #define AOE_VERSION_MASK 0xf0 /**< Version part of ver_flags field */
90 
91 #define AOE_FL_RESPONSE 0x08 /**< Message is a response */
92 #define AOE_FL_ERROR 0x04 /**< Command generated an error */
93 
94 #define AOE_MAJOR_BROADCAST 0xffff
95 #define AOE_MINOR_BROADCAST 0xff
96 
97 #define AOE_CMD_ATA 0x00 /**< Issue ATA command */
98 #define AOE_CMD_CONFIG 0x01 /**< Query Config Information */
99 
100 #define AOE_ERR_BAD_COMMAND 1 /**< Unrecognised command code */
101 #define AOE_ERR_BAD_PARAMETER 2 /**< Bad argument parameter */
102 #define AOE_ERR_UNAVAILABLE 3 /**< Device unavailable */
103 #define AOE_ERR_CONFIG_EXISTS 4 /**< Config string present */
104 #define AOE_ERR_BAD_VERSION 5 /**< Unsupported version */
105 
106 #define AOE_STATUS_ERR_MASK 0x0f /**< Error portion of status code */
107 #define AOE_STATUS_PENDING 0x80 /**< Command pending */
108 
109 /** AoE tag magic marker */
110 #define AOE_TAG_MAGIC 0x18ae0000
111 
112 /** Maximum number of sectors per packet */
113 #define AOE_MAX_COUNT 2
114 
115 /** An AoE device */
116 struct aoe_device {
117  /** Reference counter */
118  struct refcnt refcnt;
119 
120  /** Network device */
122  /** ATA command issuing interface */
123  struct interface ata;
124 
125  /** Major number */
127  /** Minor number */
129  /** Target MAC address */
131 
132  /** Saved timeout value */
133  unsigned long timeout;
134 
135  /** Configuration command interface */
137  /** Device is configued */
139 
140  /** ACPI descriptor */
142 };
143 
144 /** AoE boot firmware table signature */
145 #define ABFT_SIG ACPI_SIGNATURE ( 'a', 'B', 'F', 'T' )
146 
147 /**
148  * AoE Boot Firmware Table (aBFT)
149  */
150 struct abft_table {
151  /** ACPI header */
153  /** AoE shelf */
155  /** AoE slot */
157  /** Reserved */
159  /** MAC address */
161 } __attribute__ (( packed ));
162 
163 #endif /* _IPXE_AOE_H */
#define __attribute__(x)
Definition: compiler.h:10
struct aoecfg cfg
Config command.
Definition: aoe.h:65
unsigned short uint16_t
Definition: stdint.h:11
struct acpi_header acpi
ACPI header.
Definition: aoe.h:152
uint8_t err_feat
ATA error/feature register.
Definition: aoe.h:43
An AoE ATA command.
Definition: aoe.h:39
uint8_t bytes[6]
Definition: aoe.h:51
Retry timers.
uint16_t major
Major number.
Definition: aoe.h:126
uint8_t data[0]
AoE config string.
Definition: aoe.h:35
uint8_t data[0]
Data payload.
Definition: aoe.h:54
union aoecmd payload[0]
Payload.
Definition: aoe.h:85
uint16_t major
Major device number, in network byte order.
Definition: aoe.h:77
unsigned long long uint64_t
Definition: stdint.h:13
uint16_t fwver
ATA target firmware version.
Definition: aoe.h:27
uint8_t reserved_a
Reserved.
Definition: aoe.h:158
uint8_t aoeccmd
AoE config string subcommand.
Definition: aoe.h:31
unsigned long timeout
Saved timeout value.
Definition: aoe.h:133
uint8_t cmd_stat
ATA command/status register.
Definition: aoe.h:47
An AoE device.
Definition: aoe.h:116
uint8_t command
Command number.
Definition: aoe.h:81
A reference counter.
Definition: refcnt.h:27
uint8_t mac[ETH_ALEN]
MAC address.
Definition: aoe.h:160
union aoeata::@508 lba
Logical block address, in little-endian order.
#define MAX_LL_ADDR_LEN
Maximum length of a link-layer address.
Definition: netdevice.h:37
An object interface.
Definition: interface.h:125
Object interfaces.
struct acpi_descriptor desc
ACPI descriptor.
Definition: aoe.h:141
uint8_t minor
Minor device number.
Definition: aoe.h:79
struct interface ata
ATA command issuing interface.
Definition: aoe.h:123
uint8_t slot
AoE slot.
Definition: aoe.h:156
An AoE command.
Definition: aoe.h:63
Linked lists.
uint8_t target[MAX_LL_ADDR_LEN]
Target MAC address.
Definition: aoe.h:130
ACPI data structures.
An AoE config command.
Definition: aoe.h:23
uint32_t tag
Tag, in network byte order.
Definition: aoe.h:83
uint16_t bufcnt
AoE queue depth.
Definition: aoe.h:25
A network device.
Definition: netdevice.h:353
struct interface config
Configuration command interface.
Definition: aoe.h:136
unsigned char uint8_t
Definition: stdint.h:10
uint8_t aflags
AoE command flags.
Definition: aoe.h:41
AoE Boot Firmware Table (aBFT)
Definition: aoe.h:150
ATA devices.
#define ETH_ALEN
Definition: if_ether.h:9
An ACPI description header.
Definition: acpi.h:180
unsigned int uint32_t
Definition: stdint.h:12
uint64_t u64
Definition: aoe.h:50
FILE_SECBOOT(PERMITTED)
Network device management.
An ACPI descriptor (used to construct ACPI tables)
Definition: acpi.h:295
int configured
Device is configued.
Definition: aoe.h:138
uint8_t count
ATA sector count register.
Definition: aoe.h:45
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
uint8_t error
Error code.
Definition: aoe.h:75
uint8_t minor
Minor number.
Definition: aoe.h:128
struct net_device * netdev
Network device.
Definition: aoe.h:121
uint8_t ver_flags
Protocol version number and flags.
Definition: aoe.h:73
uint16_t cfglen
AoE config string length.
Definition: aoe.h:33
uint8_t scnt
ATA target sector count.
Definition: aoe.h:29
struct aoeata ata
ATA command.
Definition: aoe.h:67
An AoE header.
Definition: aoe.h:71
uint16_t shelf
AoE shelf.
Definition: aoe.h:154