xref: /dragonfly/stand/boot/efi/include/efi.h (revision 7d3e9a5b)
1 /*
2  * Copyright (c)  1999 - 2002 Intel Corporation. All rights reserved
3  * This software and associated documentation (if any) is furnished
4  * under a license and may only be used or copied in accordance
5  * with the terms of the license. Except as permitted by such
6  * license, no part of this software or documentation may be
7  * reproduced, stored in a retrieval system, or transmitted in any
8  * form or by any means without the express written consent of
9  * Intel Corporation.
10  */
11 
12 #ifndef _EFI_INCLUDE_
13 #define _EFI_INCLUDE_
14 
15 #ifdef	__x86_64__
16 #define	EFIAPI	__attribute__((ms_abi))
17 #endif
18 
19 /*
20  * The following macros are defined unconditionally in the EDK II headers,
21  * so get our definitions out of the way.
22  */
23 #undef NULL
24 #undef MIN
25 #undef MAX
26 
27 #include <Uefi.h>
28 #include <Guid/Acpi.h>
29 #include <Guid/DebugImageInfoTable.h>
30 #include <Guid/DxeServices.h>
31 #include <Guid/HobList.h>
32 #include <Guid/Mps.h>
33 #include <Guid/SmBios.h>
34 #include <Protocol/BlockIo.h>
35 #include <Protocol/GraphicsOutput.h>
36 #include <Protocol/NetworkInterfaceIdentifier.h>
37 #include <Protocol/PciIo.h>
38 #include <Protocol/SerialIo.h>
39 #include <Protocol/SimpleNetwork.h>
40 #include <Protocol/UgaDraw.h>
41 
42 /*
43  * The following macros haven been preserved from the old EFI headers for now.
44  */
45 #define	EFI_DP_TYPE_MASK	0x7f
46 
47 #define	END_DEVICE_PATH_TYPE	0x7f
48 
49 #define	DevicePathType(a)		(((a)->Type) & EFI_DP_TYPE_MASK)
50 #define	DevicePathSubType(a)		((a)->SubType)
51 #define	DevicePathNodeLength(a)		((size_t)(((a)->Length[0]) | ((a)->Length[1] << 8)))
52 #define	NextDevicePathNode(a)		((EFI_DEVICE_PATH *)(((UINT8 *)(a)) + DevicePathNodeLength(a)))
53 #define	IsDevicePathType(a, t)		(DevicePathType(a) == t)
54 #define	IsDevicePathEndType(a)		IsDevicePathType(a, END_DEVICE_PATH_TYPE)
55 #define	IsDevicePathEndSubType(a)	((a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE)
56 #define	IsDevicePathEnd(a)		(IsDevicePathEndType(a) && IsDevicePathEndSubType(a))
57 
58 #define	SetDevicePathEndNode(a)	do {			\
59 	(a)->Type = END_DEVICE_PATH_TYPE;		\
60 	(a)->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE;	\
61 	(a)->Length[0] = sizeof(EFI_DEVICE_PATH);	\
62 	(a)->Length[1] = 0;				\
63 } while (0)
64 
65 #define	NextMemoryDescriptor(Ptr,Size)	((EFI_MEMORY_DESCRIPTOR *)(((UINT8 *)Ptr) + Size))
66 
67 #define	FDT_TABLE_GUID \
68 	{ 0xb1b621d5, 0xf19c, 0x41a5, {0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0} }
69 
70 #define	MEMORY_TYPE_INFORMATION_TABLE_GUID \
71 	{ 0x4c19049f, 0x4137, 0x4dd3, {0x9c, 0x10, 0x8b, 0x97, 0xa8, 0x3f, 0xfd, 0xfa} }
72 
73 #endif
74