10 FILE_LICENCE ( GPL2_OR_LATER
);
13 #include <gpxe/list.h>
14 #include <gpxe/if_ether.h>
15 #include <gpxe/retry.h>
18 /** An AoE config command */
20 /** AoE Queue depth */
22 /** ATA target firmware version */
24 /** ATA target sector count */
26 /** AoE config string subcommand */
28 /** AoE config string length */
30 /** AoE config string */
32 } __attribute__ (( packed
));
34 /** An AoE ATA command */
36 /** AoE command flags */
38 /** ATA error/feature register */
40 /** ATA sector count register */
42 /** ATA command/status register */
44 /** Logical block address, in little-endian order */
51 } __attribute__ (( packed
));
53 #define AOE_FL_EXTENDED 0x40 /**< LBA48 extended addressing */
54 #define AOE_FL_DEV_HEAD 0x10 /**< Device/head flag */
55 #define AOE_FL_ASYNC 0x02 /**< Asynchronous write */
56 #define AOE_FL_WRITE 0x01 /**< Write command */
68 /** Protocol version number and flags */
72 /** Major device number, in network byte order */
74 /** Minor device number */
78 /** Tag, in network byte order */
82 } __attribute__ (( packed
));
84 #define AOE_VERSION 0x10 /**< Version 1 */
85 #define AOE_VERSION_MASK 0xf0 /**< Version part of ver_flags field */
87 #define AOE_FL_RESPONSE 0x08 /**< Message is a response */
88 #define AOE_FL_ERROR 0x04 /**< Command generated an error */
90 #define AOE_MAJOR_BROADCAST 0xffff
91 #define AOE_MINOR_BROADCAST 0xff
93 #define AOE_CMD_ATA 0x00 /**< Issue ATA command */
94 #define AOE_CMD_CONFIG 0x01 /**< Query Config Information */
96 #define AOE_TAG_MAGIC 0xebeb0000
98 #define AOE_ERR_BAD_COMMAND 1 /**< Unrecognised command code */
99 #define AOE_ERR_BAD_PARAMETER 2 /**< Bad argument parameter */
100 #define AOE_ERR_UNAVAILABLE 3 /**< Device unavailable */
101 #define AOE_ERR_CONFIG_EXISTS 4 /**< Config string present */
102 #define AOE_ERR_BAD_VERSION 5 /**< Unsupported version */
104 /** An AoE session */
106 /** Reference counter */
107 struct refcnt refcnt
;
109 /** List of all AoE sessions */
110 struct list_head list
;
112 /** Network device */
113 struct net_device
*netdev
;
119 /** Target MAC address */
120 uint8_t target
[ETH_ALEN
];
122 /** Tag for current AoE command */
125 /** Current AOE command */
126 uint8_t aoe_cmd_type
;
127 /** Current ATA command */
128 struct ata_command
*command
;
129 /** Overall status of current ATA command */
131 /** Byte offset within command's data buffer */
132 unsigned int command_offset
;
133 /** Return status code for command */
136 /** Retransmission timer */
137 struct retry_timer timer
;
140 #define AOE_STATUS_ERR_MASK 0x0f /**< Error portion of status code */
141 #define AOE_STATUS_PENDING 0x80 /**< Command pending */
143 /** Maximum number of sectors per packet */
144 #define AOE_MAX_COUNT 2
146 extern void aoe_detach ( struct ata_device
*ata
);
147 extern int aoe_attach ( struct ata_device
*ata
, struct net_device
*netdev
,
148 const char *root_path
);
150 #endif /* _GPXE_AOE_H */