11 #include <gpxe/list.h>
12 #include <gpxe/if_ether.h>
13 #include <gpxe/retry.h>
16 /** An AoE config command */
18 /** AoE Queue depth */
20 /** ATA target firmware version */
22 /** ATA target sector count */
24 /** AoE config string subcommand */
26 /** AoE config string length */
28 /** AoE config string */
30 } __attribute__ (( packed
));
32 /** An AoE ATA command */
34 /** AoE command flags */
36 /** ATA error/feature register */
38 /** ATA sector count register */
40 /** ATA command/status register */
42 /** Logical block address, in little-endian order */
49 } __attribute__ (( packed
));
51 #define AOE_FL_EXTENDED 0x40 /**< LBA48 extended addressing */
52 #define AOE_FL_DEV_HEAD 0x10 /**< Device/head flag */
53 #define AOE_FL_ASYNC 0x02 /**< Asynchronous write */
54 #define AOE_FL_WRITE 0x01 /**< Write command */
66 /** Protocol version number and flags */
70 /** Major device number, in network byte order */
72 /** Minor device number */
76 /** Tag, in network byte order */
80 } __attribute__ (( packed
));
82 #define AOE_VERSION 0x10 /**< Version 1 */
83 #define AOE_VERSION_MASK 0xf0 /**< Version part of ver_flags field */
85 #define AOE_FL_RESPONSE 0x08 /**< Message is a response */
86 #define AOE_FL_ERROR 0x04 /**< Command generated an error */
88 #define AOE_MAJOR_BROADCAST 0xffff
89 #define AOE_MINOR_BROADCAST 0xff
91 #define AOE_CMD_ATA 0x00 /**< Issue ATA command */
92 #define AOE_CMD_CONFIG 0x01 /**< Query Config Information */
94 #define AOE_TAG_MAGIC 0xebeb0000
96 #define AOE_ERR_BAD_COMMAND 1 /**< Unrecognised command code */
97 #define AOE_ERR_BAD_PARAMETER 2 /**< Bad argument parameter */
98 #define AOE_ERR_UNAVAILABLE 3 /**< Device unavailable */
99 #define AOE_ERR_CONFIG_EXISTS 4 /**< Config string present */
100 #define AOE_ERR_BAD_VERSION 5 /**< Unsupported version */
102 /** An AoE session */
104 /** Reference counter */
105 struct refcnt refcnt
;
107 /** List of all AoE sessions */
108 struct list_head list
;
110 /** Network device */
111 struct net_device
*netdev
;
117 /** Target MAC address */
118 uint8_t target
[ETH_ALEN
];
120 /** Tag for current AoE command */
123 /** Current AOE command */
124 uint8_t aoe_cmd_type
;
125 /** Current ATA command */
126 struct ata_command
*command
;
127 /** Overall status of current ATA command */
129 /** Byte offset within command's data buffer */
130 unsigned int command_offset
;
131 /** Return status code for command */
134 /** Retransmission timer */
135 struct retry_timer timer
;
138 #define AOE_STATUS_ERR_MASK 0x0f /**< Error portion of status code */
139 #define AOE_STATUS_PENDING 0x80 /**< Command pending */
141 /** Maximum number of sectors per packet */
142 #define AOE_MAX_COUNT 2
144 extern void aoe_detach ( struct ata_device
*ata
);
145 extern int aoe_attach ( struct ata_device
*ata
, struct net_device
*netdev
,
146 const char *root_path
);
148 #endif /* _GPXE_AOE_H */