Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2726 | vana | 1 | #ifndef _DEVPATH_H |
2 | #define _DEVPATH_H |
||
3 | |||
4 | /*++ |
||
5 | |||
6 | Copyright (c) 1998 Intel Corporation |
||
7 | |||
8 | Module Name: |
||
9 | |||
10 | devpath.h |
||
11 | |||
12 | Abstract: |
||
13 | |||
14 | Defines for parsing the EFI Device Path structures |
||
15 | |||
16 | |||
17 | |||
18 | Revision History |
||
19 | |||
20 | --*/ |
||
21 | |||
22 | // |
||
23 | // Device Path structures - Section C |
||
24 | // |
||
25 | |||
26 | typedef struct _EFI_DEVICE_PATH { |
||
27 | UINT8 Type; |
||
28 | UINT8 SubType; |
||
29 | UINT8 Length[2]; |
||
30 | } EFI_DEVICE_PATH; |
||
31 | |||
32 | #define EFI_DP_TYPE_MASK 0x7F |
||
33 | #define EFI_DP_TYPE_UNPACKED 0x80 |
||
34 | |||
35 | //#define END_DEVICE_PATH_TYPE 0xff |
||
36 | #define END_DEVICE_PATH_TYPE 0x7f |
||
37 | //#define END_DEVICE_PATH_TYPE_UNPACKED 0x7f |
||
38 | |||
39 | #define END_ENTIRE_DEVICE_PATH_SUBTYPE 0xff |
||
40 | #define END_INSTANCE_DEVICE_PATH_SUBTYPE 0x01 |
||
41 | #define END_DEVICE_PATH_LENGTH (sizeof(EFI_DEVICE_PATH)) |
||
42 | |||
43 | |||
44 | #define DP_IS_END_TYPE(a) |
||
45 | #define DP_IS_END_SUBTYPE(a) ( ((a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE ) |
||
46 | |||
47 | #define DevicePathType(a) ( ((a)->Type) & EFI_DP_TYPE_MASK ) |
||
48 | #define DevicePathSubType(a) ( (a)->SubType ) |
||
49 | #define DevicePathNodeLength(a) ( ((a)->Length[0]) | ((a)->Length[1] << 8) ) |
||
50 | #define NextDevicePathNode(a) ( (EFI_DEVICE_PATH *) ( ((UINT8 *) (a)) + DevicePathNodeLength(a))) |
||
51 | //#define IsDevicePathEndType(a) ( DevicePathType(a) == END_DEVICE_PATH_TYPE_UNPACKED ) |
||
52 | #define IsDevicePathEndType(a) ( DevicePathType(a) == END_DEVICE_PATH_TYPE ) |
||
53 | #define IsDevicePathEndSubType(a) ( (a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE ) |
||
54 | #define IsDevicePathEnd(a) ( IsDevicePathEndType(a) && IsDevicePathEndSubType(a) ) |
||
55 | #define IsDevicePathUnpacked(a) ( (a)->Type & EFI_DP_TYPE_UNPACKED ) |
||
56 | |||
57 | |||
58 | #define SetDevicePathNodeLength(a,l) { \ |
||
59 | (a)->Length[0] = (UINT8) (l); \ |
||
60 | (a)->Length[1] = (UINT8) ((l) >> 8); \ |
||
61 | } |
||
62 | |||
63 | #define SetDevicePathEndNode(a) { \ |
||
64 | (a)->Type = END_DEVICE_PATH_TYPE; \ |
||
65 | (a)->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE; \ |
||
66 | (a)->Length[0] = sizeof(EFI_DEVICE_PATH); \ |
||
67 | (a)->Length[1] = 0; \ |
||
68 | } |
||
69 | |||
70 | |||
71 | |||
72 | /* |
||
73 | * |
||
74 | */ |
||
75 | #define HARDWARE_DEVICE_PATH 0x01 |
||
76 | |||
77 | #define HW_PCI_DP 0x01 |
||
78 | typedef struct _PCI_DEVICE_PATH { |
||
79 | EFI_DEVICE_PATH Header; |
||
80 | UINT8 Function; |
||
81 | UINT8 Device; |
||
82 | } PCI_DEVICE_PATH; |
||
83 | |||
84 | #define HW_PCCARD_DP 0x02 |
||
85 | typedef struct _PCCARD_DEVICE_PATH { |
||
86 | EFI_DEVICE_PATH Header; |
||
87 | UINT8 SocketNumber; |
||
88 | } PCCARD_DEVICE_PATH; |
||
89 | |||
90 | #define HW_MEMMAP_DP 0x03 |
||
91 | typedef struct _MEMMAP_DEVICE_PATH { |
||
92 | EFI_DEVICE_PATH Header; |
||
93 | UINT32 MemoryType; |
||
94 | EFI_PHYSICAL_ADDRESS StartingAddress; |
||
95 | EFI_PHYSICAL_ADDRESS EndingAddress; |
||
96 | } MEMMAP_DEVICE_PATH; |
||
97 | |||
98 | #define HW_VENDOR_DP 0x04 |
||
99 | typedef struct _VENDOR_DEVICE_PATH { |
||
100 | EFI_DEVICE_PATH Header; |
||
101 | EFI_GUID Guid; |
||
102 | } VENDOR_DEVICE_PATH; |
||
103 | |||
104 | #define UNKNOWN_DEVICE_GUID \ |
||
105 | { 0xcf31fac5, 0xc24e, 0x11d2, {0x85, 0xf3, 0x0, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b} } |
||
106 | |||
107 | typedef struct _UKNOWN_DEVICE_VENDOR_DP { |
||
108 | VENDOR_DEVICE_PATH DevicePath; |
||
109 | UINT8 LegacyDriveLetter; |
||
110 | } UNKNOWN_DEVICE_VENDOR_DEVICE_PATH; |
||
111 | |||
112 | #define HW_CONTROLLER_DP 0x05 |
||
113 | typedef struct _CONTROLLER_DEVICE_PATH { |
||
114 | EFI_DEVICE_PATH Header; |
||
115 | UINT32 Controller; |
||
116 | } CONTROLLER_DEVICE_PATH; |
||
117 | |||
118 | /* |
||
119 | * |
||
120 | */ |
||
121 | #define ACPI_DEVICE_PATH 0x02 |
||
122 | |||
123 | #define ACPI_DP 0x01 |
||
124 | typedef struct _ACPI_HID_DEVICE_PATH { |
||
125 | EFI_DEVICE_PATH Header; |
||
126 | UINT32 HID; |
||
127 | UINT32 UID; |
||
128 | } ACPI_HID_DEVICE_PATH; |
||
129 | |||
130 | // |
||
131 | // EISA ID Macro |
||
132 | // EISA ID Definition 32-bits |
||
133 | // bits[15:0] - three character compressed ASCII EISA ID. |
||
134 | // bits[31:16] - binary number |
||
135 | // Compressed ASCII is 5 bits per character 0b00001 = 'A' 0b11010 = 'Z' |
||
136 | // |
||
137 | #define PNP_EISA_ID_CONST 0x41d0 |
||
138 | #define EISA_ID(_Name, _Num) ((UINT32) ((_Name) | (_Num) << 16)) |
||
139 | #define EISA_PNP_ID(_PNPId) (EISA_ID(PNP_EISA_ID_CONST, (_PNPId))) |
||
140 | |||
141 | #define PNP_EISA_ID_MASK 0xffff |
||
142 | #define EISA_ID_TO_NUM(_Id) ((_Id) >> 16) |
||
143 | /* |
||
144 | * |
||
145 | */ |
||
146 | #define MESSAGING_DEVICE_PATH 0x03 |
||
147 | |||
148 | #define MSG_ATAPI_DP 0x01 |
||
149 | typedef struct _ATAPI_DEVICE_PATH { |
||
150 | EFI_DEVICE_PATH Header; |
||
151 | UINT8 PrimarySecondary; |
||
152 | UINT8 SlaveMaster; |
||
153 | UINT16 Lun; |
||
154 | } ATAPI_DEVICE_PATH; |
||
155 | |||
156 | #define MSG_SCSI_DP 0x02 |
||
157 | typedef struct _SCSI_DEVICE_PATH { |
||
158 | EFI_DEVICE_PATH Header; |
||
159 | UINT16 Pun; |
||
160 | UINT16 Lun; |
||
161 | } SCSI_DEVICE_PATH; |
||
162 | |||
163 | #define MSG_FIBRECHANNEL_DP 0x03 |
||
164 | typedef struct _FIBRECHANNEL_DEVICE_PATH { |
||
165 | EFI_DEVICE_PATH Header; |
||
166 | UINT32 Reserved; |
||
167 | UINT64 WWN; |
||
168 | UINT64 Lun; |
||
169 | } FIBRECHANNEL_DEVICE_PATH; |
||
170 | |||
171 | #define MSG_1394_DP 0x04 |
||
172 | typedef struct _F1394_DEVICE_PATH { |
||
173 | EFI_DEVICE_PATH Header; |
||
174 | UINT32 Reserved; |
||
175 | UINT64 Guid; |
||
176 | } F1394_DEVICE_PATH; |
||
177 | |||
178 | #define MSG_USB_DP 0x05 |
||
179 | typedef struct _USB_DEVICE_PATH { |
||
180 | EFI_DEVICE_PATH Header; |
||
181 | UINT8 Port; |
||
182 | UINT8 Endpoint; |
||
183 | } USB_DEVICE_PATH; |
||
184 | |||
185 | #define MSG_USB_CLASS_DP 0x0F |
||
186 | typedef struct _USB_CLASS_DEVICE_PATH { |
||
187 | EFI_DEVICE_PATH Header; |
||
188 | UINT16 VendorId; |
||
189 | UINT16 ProductId; |
||
190 | UINT8 DeviceClass; |
||
191 | UINT8 DeviceSubclass; |
||
192 | UINT8 DeviceProtocol; |
||
193 | } USB_CLASS_DEVICE_PATH; |
||
194 | |||
195 | #define MSG_I2O_DP 0x06 |
||
196 | typedef struct _I2O_DEVICE_PATH { |
||
197 | EFI_DEVICE_PATH Header; |
||
198 | UINT32 Tid; |
||
199 | } I2O_DEVICE_PATH; |
||
200 | |||
201 | #define MSG_MAC_ADDR_DP 0x0b |
||
202 | typedef struct _MAC_ADDR_DEVICE_PATH { |
||
203 | EFI_DEVICE_PATH Header; |
||
204 | EFI_MAC_ADDRESS MacAddress; |
||
205 | UINT8 IfType; |
||
206 | } MAC_ADDR_DEVICE_PATH; |
||
207 | |||
208 | #define MSG_IPv4_DP 0x0c |
||
209 | typedef struct _IPv4_DEVICE_PATH { |
||
210 | EFI_DEVICE_PATH Header; |
||
211 | EFI_IPv4_ADDRESS LocalIpAddress; |
||
212 | EFI_IPv4_ADDRESS RemoteIpAddress; |
||
213 | UINT16 LocalPort; |
||
214 | UINT16 RemotePort; |
||
215 | UINT16 Protocol; |
||
216 | BOOLEAN StaticIpAddress; |
||
217 | } IPv4_DEVICE_PATH; |
||
218 | |||
219 | #define MSG_IPv6_DP 0x0d |
||
220 | typedef struct _IPv6_DEVICE_PATH { |
||
221 | EFI_DEVICE_PATH Header; |
||
222 | EFI_IPv6_ADDRESS LocalIpAddress; |
||
223 | EFI_IPv6_ADDRESS RemoteIpAddress; |
||
224 | UINT16 LocalPort; |
||
225 | UINT16 RemotePort; |
||
226 | UINT16 Protocol; |
||
227 | BOOLEAN StaticIpAddress; |
||
228 | } IPv6_DEVICE_PATH; |
||
229 | |||
230 | #define MSG_INFINIBAND_DP 0x09 |
||
231 | typedef struct _INFINIBAND_DEVICE_PATH { |
||
232 | EFI_DEVICE_PATH Header; |
||
233 | UINT32 Reserved; |
||
234 | UINT64 NodeGuid; |
||
235 | UINT64 IocGuid; |
||
236 | UINT64 DeviceId; |
||
237 | } INFINIBAND_DEVICE_PATH; |
||
238 | |||
239 | #define MSG_UART_DP 0x0e |
||
240 | typedef struct _UART_DEVICE_PATH { |
||
241 | EFI_DEVICE_PATH Header; |
||
242 | UINT32 Reserved; |
||
243 | UINT64 BaudRate; |
||
244 | UINT8 DataBits; |
||
245 | UINT8 Parity; |
||
246 | UINT8 StopBits; |
||
247 | } UART_DEVICE_PATH; |
||
248 | |||
249 | #define MSG_VENDOR_DP 0x0A |
||
250 | /* Use VENDOR_DEVICE_PATH struct */ |
||
251 | |||
252 | #define DEVICE_PATH_MESSAGING_PC_ANSI \ |
||
253 | { 0xe0c14753, 0xf9be, 0x11d2, {0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } |
||
254 | |||
255 | #define DEVICE_PATH_MESSAGING_VT_100 \ |
||
256 | { 0xdfa66065, 0xb419, 0x11d3, {0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } |
||
257 | |||
258 | |||
259 | |||
260 | #define MEDIA_DEVICE_PATH 0x04 |
||
261 | |||
262 | #define MEDIA_HARDDRIVE_DP 0x01 |
||
263 | typedef struct _HARDDRIVE_DEVICE_PATH { |
||
264 | EFI_DEVICE_PATH Header; |
||
265 | UINT32 PartitionNumber; |
||
266 | UINT64 PartitionStart; |
||
267 | UINT64 PartitionSize; |
||
268 | UINT8 Signature[16]; |
||
269 | UINT8 MBRType; |
||
270 | UINT8 SignatureType; |
||
271 | } HARDDRIVE_DEVICE_PATH; |
||
272 | |||
273 | #define MBR_TYPE_PCAT 0x01 |
||
274 | #define MBR_TYPE_EFI_PARTITION_TABLE_HEADER 0x02 |
||
275 | |||
276 | #define SIGNATURE_TYPE_MBR 0x01 |
||
277 | #define SIGNATURE_TYPE_GUID 0x02 |
||
278 | |||
279 | #define MEDIA_CDROM_DP 0x02 |
||
280 | typedef struct _CDROM_DEVICE_PATH { |
||
281 | EFI_DEVICE_PATH Header; |
||
282 | UINT32 BootEntry; |
||
283 | UINT64 PartitionStart; |
||
284 | UINT64 PartitionSize; |
||
285 | } CDROM_DEVICE_PATH; |
||
286 | |||
287 | #define MEDIA_VENDOR_DP 0x03 |
||
288 | /* Use VENDOR_DEVICE_PATH struct */ |
||
289 | |||
290 | #define MEDIA_FILEPATH_DP 0x04 |
||
291 | typedef struct _FILEPATH_DEVICE_PATH { |
||
292 | EFI_DEVICE_PATH Header; |
||
293 | CHAR16 PathName[1]; |
||
294 | } FILEPATH_DEVICE_PATH; |
||
295 | |||
296 | #define SIZE_OF_FILEPATH_DEVICE_PATH EFI_FIELD_OFFSET(FILEPATH_DEVICE_PATH,PathName) |
||
297 | |||
298 | #define MEDIA_PROTOCOL_DP 0x05 |
||
299 | typedef struct _MEDIA_PROTOCOL_DEVICE_PATH { |
||
300 | EFI_DEVICE_PATH Header; |
||
301 | EFI_GUID Protocol; |
||
302 | } MEDIA_PROTOCOL_DEVICE_PATH; |
||
303 | |||
304 | |||
305 | #define BBS_DEVICE_PATH 0x05 |
||
306 | #define BBS_BBS_DP 0x01 |
||
307 | typedef struct _BBS_BBS_DEVICE_PATH { |
||
308 | EFI_DEVICE_PATH Header; |
||
309 | UINT16 DeviceType; |
||
310 | UINT16 StatusFlag; |
||
311 | CHAR8 String[1]; |
||
312 | } BBS_BBS_DEVICE_PATH; |
||
313 | |||
314 | /* DeviceType definitions - from BBS specification */ |
||
315 | #define BBS_TYPE_FLOPPY 0x01 |
||
316 | #define BBS_TYPE_HARDDRIVE 0x02 |
||
317 | #define BBS_TYPE_CDROM 0x03 |
||
318 | #define BBS_TYPE_PCMCIA 0x04 |
||
319 | #define BBS_TYPE_USB 0x05 |
||
320 | #define BBS_TYPE_EMBEDDED_NETWORK 0x06 |
||
321 | #define BBS_TYPE_DEV 0x80 |
||
322 | #define BBS_TYPE_UNKNOWN 0xFF |
||
323 | |||
324 | typedef union { |
||
325 | EFI_DEVICE_PATH DevPath; |
||
326 | PCI_DEVICE_PATH Pci; |
||
327 | PCCARD_DEVICE_PATH PcCard; |
||
328 | MEMMAP_DEVICE_PATH MemMap; |
||
329 | VENDOR_DEVICE_PATH Vendor; |
||
330 | UNKNOWN_DEVICE_VENDOR_DEVICE_PATH UnknownVendor; |
||
331 | CONTROLLER_DEVICE_PATH Controller; |
||
332 | ACPI_HID_DEVICE_PATH Acpi; |
||
333 | |||
334 | ATAPI_DEVICE_PATH Atapi; |
||
335 | SCSI_DEVICE_PATH Scsi; |
||
336 | FIBRECHANNEL_DEVICE_PATH FibreChannel; |
||
337 | |||
338 | F1394_DEVICE_PATH F1394; |
||
339 | USB_DEVICE_PATH Usb; |
||
340 | USB_CLASS_DEVICE_PATH UsbClass; |
||
341 | I2O_DEVICE_PATH I2O; |
||
342 | MAC_ADDR_DEVICE_PATH MacAddr; |
||
343 | IPv4_DEVICE_PATH Ipv4; |
||
344 | IPv6_DEVICE_PATH Ipv6; |
||
345 | INFINIBAND_DEVICE_PATH InfiniBand; |
||
346 | UART_DEVICE_PATH Uart; |
||
347 | |||
348 | HARDDRIVE_DEVICE_PATH HardDrive; |
||
349 | CDROM_DEVICE_PATH CD; |
||
350 | |||
351 | FILEPATH_DEVICE_PATH FilePath; |
||
352 | MEDIA_PROTOCOL_DEVICE_PATH MediaProtocol; |
||
353 | |||
354 | BBS_BBS_DEVICE_PATH Bbs; |
||
355 | |||
356 | } EFI_DEV_PATH; |
||
357 | |||
358 | typedef union { |
||
359 | EFI_DEVICE_PATH *DevPath; |
||
360 | PCI_DEVICE_PATH *Pci; |
||
361 | PCCARD_DEVICE_PATH *PcCard; |
||
362 | MEMMAP_DEVICE_PATH *MemMap; |
||
363 | VENDOR_DEVICE_PATH *Vendor; |
||
364 | UNKNOWN_DEVICE_VENDOR_DEVICE_PATH *UnknownVendor; |
||
365 | CONTROLLER_DEVICE_PATH *Controller; |
||
366 | ACPI_HID_DEVICE_PATH *Acpi; |
||
367 | |||
368 | ATAPI_DEVICE_PATH *Atapi; |
||
369 | SCSI_DEVICE_PATH *Scsi; |
||
370 | FIBRECHANNEL_DEVICE_PATH *FibreChannel; |
||
371 | |||
372 | F1394_DEVICE_PATH *F1394; |
||
373 | USB_DEVICE_PATH *Usb; |
||
374 | USB_CLASS_DEVICE_PATH *UsbClass; |
||
375 | I2O_DEVICE_PATH *I2O; |
||
376 | MAC_ADDR_DEVICE_PATH *MacAddr; |
||
377 | IPv4_DEVICE_PATH *Ipv4; |
||
378 | IPv6_DEVICE_PATH *Ipv6; |
||
379 | INFINIBAND_DEVICE_PATH *InfiniBand; |
||
380 | UART_DEVICE_PATH *Uart; |
||
381 | |||
382 | HARDDRIVE_DEVICE_PATH *HardDrive; |
||
383 | |||
384 | FILEPATH_DEVICE_PATH *FilePath; |
||
385 | MEDIA_PROTOCOL_DEVICE_PATH *MediaProtocol; |
||
386 | |||
387 | CDROM_DEVICE_PATH *CD; |
||
388 | BBS_BBS_DEVICE_PATH *Bbs; |
||
389 | |||
390 | } EFI_DEV_PATH_PTR; |
||
391 | |||
392 | |||
393 | #endif |