~pmdj/ubuntu/trusty/qemu/2.9+applesmc+fadtv3

« back to all changes in this revision

Viewing changes to roms/ipxe/src/include/ipxe/aoe.h

  • Committer: Phil Dennis-Jordan
  • Date: 2017-07-21 08:03:43 UTC
  • mfrom: (1.1.1)
  • Revision ID: phil@philjordan.eu-20170721080343-2yr2vdj7713czahv
New upstream release 2.9.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
19
/** An AoE config command */
 
20
struct aoecfg {
 
21
        /** AoE queue depth */
 
22
        uint16_t bufcnt;
 
23
        /** ATA target firmware version */
 
24
        uint16_t fwver;
 
25
        /** ATA target sector count */
 
26
        uint8_t scnt;
 
27
        /** AoE config string subcommand */
 
28
        uint8_t aoeccmd;
 
29
        /** AoE config string length */
 
30
        uint16_t cfglen;
 
31
        /** AoE config string */
 
32
        uint8_t data[0];
 
33
} __attribute__ (( packed ));
 
34
 
 
35
/** An AoE ATA command */
 
36
struct aoeata {
 
37
        /** AoE command flags */
 
38
        uint8_t aflags;
 
39
        /** ATA error/feature register */
 
40
        uint8_t err_feat;
 
41
        /** ATA sector count register */
 
42
        uint8_t count;
 
43
        /** ATA command/status register */
 
44
        uint8_t cmd_stat;
 
45
        /** Logical block address, in little-endian order */
 
46
        union {
 
47
                uint64_t u64;
 
48
                uint8_t bytes[6];
 
49
        } lba;
 
50
        /** Data payload */
 
51
        uint8_t data[0];
 
52
} __attribute__ (( packed ));
 
53
 
 
54
#define AOE_FL_EXTENDED 0x40    /**< LBA48 extended addressing */
 
55
#define AOE_FL_DEV_HEAD 0x10    /**< Device/head flag */
 
56
#define AOE_FL_ASYNC    0x02    /**< Asynchronous write */
 
57
#define AOE_FL_WRITE    0x01    /**< Write command */
 
58
 
 
59
/** An AoE command */
 
60
union aoecmd {
 
61
        /** Config command */
 
62
        struct aoecfg cfg;
 
63
        /** ATA command */
 
64
        struct aoeata ata;
 
65
};
 
66
 
 
67
/** An AoE header */
 
68
struct aoehdr {
 
69
        /** Protocol version number and flags */
 
70
        uint8_t ver_flags;
 
71
        /** Error code */
 
72
        uint8_t error;
 
73
        /** Major device number, in network byte order */
 
74
        uint16_t major;
 
75
        /** Minor device number */
 
76
        uint8_t minor;
 
77
        /** Command number */
 
78
        uint8_t command;
 
79
        /** Tag, in network byte order */
 
80
        uint32_t tag;
 
81
        /** Payload */
 
82
        union aoecmd payload[0];
 
83
} __attribute__ (( packed ));
 
84
 
 
85
#define AOE_VERSION     0x10    /**< Version 1 */
 
86
#define AOE_VERSION_MASK 0xf0   /**< Version part of ver_flags field */
 
87
 
 
88
#define AOE_FL_RESPONSE 0x08    /**< Message is a response */
 
89
#define AOE_FL_ERROR    0x04    /**< Command generated an error */
 
90
 
 
91
#define AOE_MAJOR_BROADCAST 0xffff
 
92
#define AOE_MINOR_BROADCAST 0xff
 
93
 
 
94
#define AOE_CMD_ATA     0x00    /**< Issue ATA command */
 
95
#define AOE_CMD_CONFIG  0x01    /**< Query Config Information */
 
96
 
 
97
#define AOE_ERR_BAD_COMMAND     1 /**< Unrecognised command code */
 
98
#define AOE_ERR_BAD_PARAMETER   2 /**< Bad argument parameter */
 
99
#define AOE_ERR_UNAVAILABLE     3 /**< Device unavailable */
 
100
#define AOE_ERR_CONFIG_EXISTS   4 /**< Config string present */
 
101
#define AOE_ERR_BAD_VERSION     5 /**< Unsupported version */
 
102
 
 
103
#define AOE_STATUS_ERR_MASK     0x0f /**< Error portion of status code */ 
 
104
#define AOE_STATUS_PENDING      0x80 /**< Command pending */
 
105
 
 
106
/** AoE tag magic marker */
 
107
#define AOE_TAG_MAGIC 0x18ae0000
 
108
 
 
109
/** Maximum number of sectors per packet */
 
110
#define AOE_MAX_COUNT 2
 
111
 
 
112
/** AoE boot firmware table signature */
 
113
#define ABFT_SIG ACPI_SIGNATURE ( 'a', 'B', 'F', 'T' )
 
114
 
 
115
/**
 
116
 * AoE Boot Firmware Table (aBFT)
 
117
 */
 
118
struct abft_table {
 
119
        /** ACPI header */
 
120
        struct acpi_description_header acpi;
 
121
        /** AoE shelf */
 
122
        uint16_t shelf;
 
123
        /** AoE slot */
 
124
        uint8_t slot;
 
125
        /** Reserved */
 
126
        uint8_t reserved_a;
 
127
        /** MAC address */
 
128
        uint8_t mac[ETH_ALEN];
 
129
} __attribute__ (( packed ));
 
130
 
 
131
#endif /* _IPXE_AOE_H */