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