iPXE
edd.h
Go to the documentation of this file.
1 #ifndef _IPXE_EDD_H
2 #define _IPXE_EDD_H
3 
4 /** @file
5  *
6  * Enhanced Disk Drive specification
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 
12 #include <stdint.h>
13 #include <ipxe/interface.h>
14 
15 /** An EDD host bus type */
17  /** Type */
19 } __attribute__ (( packed ));
20 
21 /** EDD bus type */
22 #define EDD_BUS_TYPE_FIXED( a, b, c, d, ... ) \
23  ( ( (a) << 0 ) | ( (b) << 8 ) | ( (c) << 16 ) | ( (d) << 24 ) )
24 #define EDD_BUS_TYPE( ... ) \
25  EDD_BUS_TYPE_FIXED ( __VA_ARGS__, ' ', ' ', ' ', ' ' )
26 /** EDD PCI bus type */
27 #define EDD_BUS_TYPE_PCI EDD_BUS_TYPE ( 'P', 'C', 'I' )
28 /** EDD ISA bus type */
29 #define EDD_BUS_TYPE_ISA EDD_BUS_TYPE ( 'I', 'S', 'A' )
30 /** EDD PCI-X bus type */
31 #define EDD_BUS_TYPE_PCIX EDD_BUS_TYPE ( 'P', 'C', 'I', 'X' )
32 /** EDD Infiniband bus type */
33 #define EDD_BUS_TYPE_IBND EDD_BUS_TYPE ( 'I', 'B', 'N', 'D' )
34 /** EDD PCI Express bus type */
35 #define EDD_BUS_TYPE_XPRS EDD_BUS_TYPE ( 'X', 'P', 'R', 'S' )
36 /** EDD HyperTransport bus type */
37 #define EDD_BUS_TYPE_HTPT EDD_BUS_TYPE ( 'H', 'T', 'P', 'T' )
38 
39 /** An EDD interface type */
41  /** Type */
43 } __attribute__ (( packed ));
44 
45 /** EDD interface type */
46 #define EDD_INTF_TYPE_FIXED( a, b, c, d, e, f, g, h, ... ) \
47  ( ( ( ( uint64_t ) (a) ) << 0 ) | ( ( ( uint64_t ) (b) ) << 8 ) | \
48  ( ( ( uint64_t ) (c) ) << 16 ) | ( ( ( uint64_t ) (d) ) << 24 ) | \
49  ( ( ( uint64_t ) (e) ) << 32 ) | ( ( ( uint64_t ) (f) ) << 40 ) | \
50  ( ( ( uint64_t ) (g) ) << 48 ) | ( ( ( uint64_t ) (h) ) << 56 ) )
51 #define EDD_INTF_TYPE( ... ) \
52  EDD_INTF_TYPE_FIXED ( __VA_ARGS__, \
53  ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' )
54 /** EDD ATA interface type */
55 #define EDD_INTF_TYPE_ATA EDD_INTF_TYPE ( 'A', 'T', 'A' )
56 /** EDD ATAPI interface type */
57 #define EDD_INTF_TYPE_ATAPI EDD_INTF_TYPE ( 'A', 'T', 'A', 'P', 'I' )
58 /** EDD SCSI interface type */
59 #define EDD_INTF_TYPE_SCSI EDD_INTF_TYPE ( 'S', 'C', 'S', 'I' )
60 /** EDD USB interface type */
61 #define EDD_INTF_TYPE_USB EDD_INTF_TYPE ( 'U', 'S', 'B' )
62 /** EDD 1394 interface type */
63 #define EDD_INTF_TYPE_1394 EDD_INTF_TYPE ( '1', '3', '9', '4' )
64 /** EDD Fibre Channel interface type */
65 #define EDD_INTF_TYPE_FIBRE EDD_INTF_TYPE ( 'F', 'I', 'B', 'R', 'E' )
66 /** EDD I2O interface type */
67 #define EDD_INTF_TYPE_I2O EDD_INTF_TYPE ( 'I', '2', 'O' )
68 /** EDD RAID interface type */
69 #define EDD_INTF_TYPE_RAID EDD_INTF_TYPE ( 'R', 'A', 'I', 'D' )
70 /** EDD SATA interface type */
71 #define EDD_INTF_TYPE_SATA EDD_INTF_TYPE ( 'S', 'A', 'T', 'A' )
72 /** EDD SAS interface type */
73 #define EDD_INTF_TYPE_SAS EDD_INTF_TYPE ( 'S', 'A', 'S' )
74 
75 /** An EDD interface path */
77  /** Legacy bus type */
78  struct {
79  /** Base address */
81  } __attribute__ (( packed )) legacy;
82  /** PCI, PCI-X, PCI Express, or HyperTransport bus type */
83  struct {
84  /** Bus */
86  /** Slot */
88  /** Function */
89  uint8_t function;
90  /** Channel number */
92  } __attribute__ (( packed )) pci;
93  /** Padding */
95 } __attribute__ (( packed ));
96 
97 /** An EDD device path */
99  /** ATA interface type */
100  struct {
101  /** Slave */
103  } __attribute__ (( packed )) ata;
104  /** ATAPI interface type */
105  struct {
106  /** Slave */
107  uint8_t slave;
108  /** Logical Unit Number */
110  } __attribute__ (( packed )) atapi;
111  /** SCSI interface type */
112  struct {
113  /** SCSI ID */
115  /** Logical Unit Number */
117  } __attribute__ (( packed )) scsi;
118  /** USB interface type */
119  struct {
120  /** Serial number */
122  } __attribute__ (( packed )) usb;
123  /** IEEE1394 interface type */
124  struct {
125  /** GUID */
127  } __attribute__ (( packed )) ieee1394;
128  /** Fibre Channel interface type */
129  struct {
130  /** WWN */
132  /** Logical Unit Number */
133  uint64_t lun;
134  } __attribute__ (( packed )) fibre;
135  /** I2O interface type */
136  struct {
137  /** Identity tag */
139  } __attribute__ (( packed )) i2o;
140  /** RAID interface type */
141  struct {
142  /** Array number */
144  } __attribute__ (( packed )) raid;
145  /** SATA interface type */
146  struct {
147  /** Port number */
149  /** Port multiplier number */
151  } __attribute__ (( packed )) sata;
152  /** SAS interface type */
153  struct {
154  /** Address */
156  } __attribute__ (( packed )) sas;
157  /** Padding */
159 } __attribute__ (( packed ));
160 
161 /** EDD device path information */
163  /** Key */
165  /** Length of this structure */
167  /** Reserved */
169  /** Host bus type */
171  /** Interface type */
173  /** Interface path */
175  /** Device path */
177  /** Reserved */
179  /** Checksum */
181 } __attribute__ (( packed ));
182 
183 /** EDD device path information key */
184 #define EDD_DEVICE_PATH_INFO_KEY 0xbedd
185 
186 extern int edd_describe ( struct interface *intf,
187  struct edd_interface_type *type,
188  union edd_device_path *path );
189 #define edd_describe_TYPE( object_type ) \
190  typeof ( int ( object_type, struct edd_interface_type *type, \
191  union edd_device_path *path ) )
192 
193 #endif /* _IPXE_EDD_H */
struct edd_host_bus_type host_bus_type
Host bus type.
Definition: edd.h:170
uint64_t address
Address.
Definition: edd.h:155
unsigned short uint16_t
Definition: stdint.h:11
uint64_t type
Type.
Definition: edd.h:42
uint64_t wwn
WWN.
Definition: edd.h:131
struct edd_interface_type interface_type
Interface type.
Definition: edd.h:172
uint8_t slot
Slot.
Definition: edd.h:87
An EDD device path.
Definition: edd.h:98
uint16_t base
Base address.
Definition: edd.h:80
EDD device path information.
Definition: edd.h:162
unsigned long long uint64_t
Definition: stdint.h:13
uint8_t channel
Channel number.
Definition: edd.h:91
An EDD interface type.
Definition: edd.h:40
union edd_device_path device_path
Device path.
Definition: edd.h:176
uint8_t bus
Bus.
Definition: edd.h:85
struct edd_host_bus_type __attribute__((packed))
Legacy bus type.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
An object interface.
Definition: interface.h:124
Object interfaces.
uint8_t len
Length of this structure.
Definition: edd.h:166
An EDD interface path.
Definition: edd.h:76
uint16_t key
Key.
Definition: edd.h:164
uint8_t reserved_b
Reserved.
Definition: edd.h:178
int edd_describe(struct interface *intf, struct edd_interface_type *type, union edd_device_path *path)
Describe a disk device using EDD.
Definition: edd.c:44
unsigned char uint8_t
Definition: stdint.h:10
uint8_t port
Port number.
Definition: edd.h:148
uint64_t guid
GUID.
Definition: edd.h:126
uint8_t lun
Logical Unit Number.
Definition: edd.h:109
uint16_t id
SCSI ID.
Definition: edd.h:114
An EDD host bus type.
Definition: edd.h:16
unsigned int uint32_t
Definition: stdint.h:12
uint8_t pad[16]
Padding.
Definition: edd.h:158
uint32_t array
Array number.
Definition: edd.h:143
uint8_t multiplier
Port multiplier number.
Definition: edd.h:150
uint64_t serial
Serial number.
Definition: edd.h:121
struct edd_device_path::@456 __attribute__((packed)) ata
ATA interface type.
uint32_t type
Type.
Definition: edd.h:12
uint8_t pad[8]
Padding.
Definition: edd.h:94
uint8_t slave
Slave.
Definition: edd.h:102
uint64_t lun
Logical Unit Number.
Definition: edd.h:116
uint8_t checksum
Checksum.
Definition: edd.h:180
union edd_interface_path interface_path
Interface path.
Definition: edd.h:174
struct edd_interface_path::@452 __attribute__((packed)) legacy
Legacy bus type.
uint8_t reserved_a[3]
Reserved.
Definition: edd.h:168
uint32_t type
Type.
Definition: edd.h:18
uint64_t tag
Identity tag.
Definition: edd.h:138