11 #include <gpxe/list.h>
12 #include <gpxe/if_ether.h>
13 #include <gpxe/retry.h>
14 #include <gpxe/async.h>
17 /** An AoE ATA command */
19 /** AoE command flags */
21 /** ATA error/feature register */
23 /** ATA sector count register */
25 /** ATA command/status register */
27 /** Logical block address, in little-endian order */
34 } __attribute__ (( packed ));
36 #define AOE_FL_EXTENDED 0x40 /**< LBA48 extended addressing */
37 #define AOE_FL_DEV_HEAD 0x10 /**< Device/head flag */
38 #define AOE_FL_ASYNC 0x02 /**< Asynchronous write */
39 #define AOE_FL_WRITE 0x01 /**< Write command */
43 /** Protocol version number and flags */
47 /** Major device number, in network byte order */
49 /** Minor device number */
53 /** Tag, in network byte order */
58 struct aoecmd command[0];
60 } __attribute__ (( packed ));
62 #define AOE_VERSION 0x10 /**< Version 1 */
63 #define AOE_VERSION_MASK 0xf0 /**< Version part of ver_flags field */
65 #define AOE_FL_RESPONSE 0x08 /**< Message is a response */
66 #define AOE_FL_ERROR 0x04 /**< Command generated an error */
68 #define AOE_MAJOR_BROADCAST 0xffff
69 #define AOE_MINOR_BROADCAST 0xff
71 #define AOE_CMD_ATA 0x00 /**< Issue ATA command */
72 #define AOE_CMD_CONFIG 0x01 /**< Query Config Information */
74 #define AOE_ERR_BAD_COMMAND 1 /**< Unrecognised command code */
75 #define AOE_ERR_BAD_PARAMETER 2 /**< Bad argument parameter */
76 #define AOE_ERR_UNAVAILABLE 3 /**< Device unavailable */
77 #define AOE_ERR_CONFIG_EXISTS 4 /**< Config string present */
78 #define AOE_ERR_BAD_VERSION 5 /**< Unsupported version */
82 /** List of all AoE sessions */
83 struct list_head list;
86 struct net_device *netdev;
91 /** Target MAC address */
92 uint8_t target[ETH_ALEN];
94 /** Tag for current AoE command */
97 /** Current ATA command */
98 struct ata_command *command;
99 /** Overall status of current ATA command */
101 /** Byte offset within command's data buffer */
102 unsigned int command_offset;
103 /** Asynchronous operation for this command */
104 struct async_operation aop;
106 /** Retransmission timer */
107 struct retry_timer timer;
110 #define AOE_STATUS_ERR_MASK 0x0f /**< Error portion of status code */
111 #define AOE_STATUS_PENDING 0x80 /**< Command pending */
113 /** Maximum number of sectors per packet */
114 #define AOE_MAX_COUNT 2
116 extern void aoe_open ( struct aoe_session *aoe );
117 extern void aoe_close ( struct aoe_session *aoe );
118 extern void aoe_issue ( struct aoe_session *aoe, struct ata_command *command );
122 /** ATA device interface */
123 struct ata_device ata;
124 /** AoE protocol instance */
125 struct aoe_session aoe;
128 extern int init_aoedev ( struct aoe_device *aoedev );
130 #endif /* _GPXE_AOE_H */