Add comment that describes the TPL restrictions for the Data Hub Protocol.
[mirror_edk2.git] / MdePkg / Include / Uefi / UefiBaseType.h
CommitLineData
c311f86b 1/** @file\r
959ccb23 2 Defines data types and constants introduced in UEFI.\r
3\r
9df063a0 4Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
af2dc6a7 5This program and the accompanying materials are licensed and made available under \r
6the terms and conditions of the BSD License that accompanies this distribution. \r
7The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php. \r
9 \r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
959ccb23 12\r
13**/\r
14\r
15#ifndef __UEFI_BASETYPE_H__\r
16#define __UEFI_BASETYPE_H__\r
17\r
a0f1b047 18#include <Base.h>\r
959ccb23 19\r
e0c047a0 20//\r
eaad1319 21// Basic data type definitions introduced in UEFI.\r
e0c047a0 22//\r
23\r
24///\r
25/// 128-bit buffer containing a unique identifier value.\r
8b13229b 26///\r
00edb218 27typedef GUID EFI_GUID;\r
3f748e52 28///\r
af2dc6a7 29/// Function return status for EFI API.\r
3f748e52 30///\r
00edb218 31typedef RETURN_STATUS EFI_STATUS;\r
e0c047a0 32///\r
33/// A collection of related interfaces.\r
34///\r
00edb218 35typedef VOID *EFI_HANDLE;\r
e0c047a0 36///\r
37/// Handle to an event structure.\r
38///\r
00edb218 39typedef VOID *EFI_EVENT;\r
e0c047a0 40///\r
41/// Task priority level.\r
42///\r
00edb218 43typedef UINTN EFI_TPL;\r
e0c047a0 44///\r
45/// Logical block address.\r
46///\r
00edb218 47typedef UINT64 EFI_LBA;\r
6617fcc2 48\r
49///\r
50/// 64-bit physical memory address.\r
51///\r
00edb218 52typedef UINT64 EFI_PHYSICAL_ADDRESS;\r
6617fcc2 53\r
54///\r
55/// 64-bit virtual memory address.\r
56///\r
00edb218 57typedef UINT64 EFI_VIRTUAL_ADDRESS;\r
959ccb23 58\r
fb5148a0 59///\r
60/// EFI Time Abstraction:\r
e189264e 61/// Year: 1900 - 9999\r
fb5148a0 62/// Month: 1 - 12\r
63/// Day: 1 - 31\r
64/// Hour: 0 - 23\r
65/// Minute: 0 - 59\r
66/// Second: 0 - 59\r
67/// Nanosecond: 0 - 999,999,999\r
68/// TimeZone: -1440 to 1440 or 2047\r
69///\r
959ccb23 70typedef struct {\r
71 UINT16 Year;\r
72 UINT8 Month;\r
73 UINT8 Day;\r
74 UINT8 Hour;\r
75 UINT8 Minute;\r
76 UINT8 Second;\r
77 UINT8 Pad1;\r
78 UINT32 Nanosecond;\r
79 INT16 TimeZone;\r
80 UINT8 Daylight;\r
81 UINT8 Pad2;\r
82} EFI_TIME;\r
83\r
d1f95000 84\r
e0c047a0 85///\r
86/// 4-byte buffer. An IPv4 internet protocol address.\r
87///\r
d1f95000 88typedef struct {\r
89 UINT8 Addr[4];\r
90} EFI_IPv4_ADDRESS;\r
91\r
e0c047a0 92///\r
af2dc6a7 93/// 16-byte buffer. An IPv6 internet protocol address.\r
e0c047a0 94///\r
d1f95000 95typedef struct {\r
96 UINT8 Addr[16];\r
97} EFI_IPv6_ADDRESS;\r
98\r
e0c047a0 99///\r
100/// 32-byte buffer containing a network Media Access Control address.\r
101///\r
d1f95000 102typedef struct {\r
103 UINT8 Addr[32];\r
104} EFI_MAC_ADDRESS;\r
105\r
e0c047a0 106///\r
107/// 16-byte buffer aligned on a 4-byte boundary.\r
108/// An IPv4 or IPv6 internet protocol address.\r
109///\r
d1f95000 110typedef union {\r
111 UINT32 Addr[4];\r
112 EFI_IPv4_ADDRESS v4;\r
113 EFI_IPv6_ADDRESS v6;\r
114} EFI_IP_ADDRESS;\r
115\r
116\r
d674ed53 117///\r
118/// Enumeration of EFI_STATUS.\r
119///@{ \r
959ccb23 120#define EFI_SUCCESS RETURN_SUCCESS \r
121#define EFI_LOAD_ERROR RETURN_LOAD_ERROR \r
122#define EFI_INVALID_PARAMETER RETURN_INVALID_PARAMETER \r
123#define EFI_UNSUPPORTED RETURN_UNSUPPORTED \r
124#define EFI_BAD_BUFFER_SIZE RETURN_BAD_BUFFER_SIZE \r
125#define EFI_BUFFER_TOO_SMALL RETURN_BUFFER_TOO_SMALL \r
126#define EFI_NOT_READY RETURN_NOT_READY \r
127#define EFI_DEVICE_ERROR RETURN_DEVICE_ERROR \r
128#define EFI_WRITE_PROTECTED RETURN_WRITE_PROTECTED \r
129#define EFI_OUT_OF_RESOURCES RETURN_OUT_OF_RESOURCES \r
130#define EFI_VOLUME_CORRUPTED RETURN_VOLUME_CORRUPTED \r
131#define EFI_VOLUME_FULL RETURN_VOLUME_FULL \r
132#define EFI_NO_MEDIA RETURN_NO_MEDIA \r
133#define EFI_MEDIA_CHANGED RETURN_MEDIA_CHANGED \r
134#define EFI_NOT_FOUND RETURN_NOT_FOUND \r
135#define EFI_ACCESS_DENIED RETURN_ACCESS_DENIED \r
136#define EFI_NO_RESPONSE RETURN_NO_RESPONSE \r
137#define EFI_NO_MAPPING RETURN_NO_MAPPING \r
138#define EFI_TIMEOUT RETURN_TIMEOUT \r
139#define EFI_NOT_STARTED RETURN_NOT_STARTED \r
140#define EFI_ALREADY_STARTED RETURN_ALREADY_STARTED \r
141#define EFI_ABORTED RETURN_ABORTED \r
142#define EFI_ICMP_ERROR RETURN_ICMP_ERROR \r
143#define EFI_TFTP_ERROR RETURN_TFTP_ERROR \r
144#define EFI_PROTOCOL_ERROR RETURN_PROTOCOL_ERROR \r
145#define EFI_INCOMPATIBLE_VERSION RETURN_INCOMPATIBLE_VERSION \r
146#define EFI_SECURITY_VIOLATION RETURN_SECURITY_VIOLATION \r
147#define EFI_CRC_ERROR RETURN_CRC_ERROR \r
148#define EFI_END_OF_MEDIA RETURN_END_OF_MEDIA\r
149#define EFI_END_OF_FILE RETURN_END_OF_FILE\r
54cf8780 150#define EFI_INVALID_LANGUAGE RETURN_INVALID_LANGUAGE\r
959ccb23 151\r
152#define EFI_WARN_UNKNOWN_GLYPH RETURN_WARN_UNKNOWN_GLYPH \r
153#define EFI_WARN_DELETE_FAILURE RETURN_WARN_DELETE_FAILURE \r
154#define EFI_WARN_WRITE_FAILURE RETURN_WARN_WRITE_FAILURE \r
155#define EFI_WARN_BUFFER_TOO_SMALL RETURN_WARN_BUFFER_TOO_SMALL\r
d674ed53 156///@}\r
959ccb23 157\r
d674ed53 158///\r
159/// Define macro to encode the status code.\r
160/// \r
00edb218 161#define EFIERR(_a) ENCODE_ERROR(_a)\r
959ccb23 162\r
163#define EFI_ERROR(A) RETURN_ERROR(A)\r
164\r
d674ed53 165///\r
166/// ICMP error definitions\r
167///@{\r
168#define EFI_NETWORK_UNREACHABLE EFIERR(100)\r
169#define EFI_HOST_UNREACHABLE EFIERR(101) \r
170#define EFI_PROTOCOL_UNREACHABLE EFIERR(102)\r
171#define EFI_PORT_UNREACHABLE EFIERR(103)\r
172///@}\r
959ccb23 173\r
d674ed53 174///\r
175/// Tcp connection status definitions\r
176///@{\r
177#define EFI_CONNECTION_FIN EFIERR(104)\r
178#define EFI_CONNECTION_RESET EFIERR(105)\r
179#define EFI_CONNECTION_REFUSED EFIERR(106)\r
180///@}\r
959ccb23 181\r
182//\r
183// The EFI memory allocation functions work in units of EFI_PAGEs that are\r
184// 4K. This should in no way be confused with the page size of the processor.\r
185// An EFI_PAGE is just the quanta of memory in EFI.\r
186//\r
00edb218
A
187#define EFI_PAGE_SIZE 0x1000\r
188#define EFI_PAGE_MASK 0xFFF\r
189#define EFI_PAGE_SHIFT 12\r
959ccb23 190\r
740ee2ea 191//\r
192// It is expected that a parameter for the following two macros is of type UINTN.\r
193// Be careful to pass a UINT64 parameter because 32-bit build break may happen\r
194// if << or >> shift operations are performed on a 64-bit integer with 32-bit C compiler.\r
195//\r
833bd94e 196#define EFI_SIZE_TO_PAGES(a) (((a) >> EFI_PAGE_SHIFT) + (((a) & EFI_PAGE_MASK) ? 1 : 0))\r
833bd94e 197#define EFI_PAGES_TO_SIZE(a) ( (a) << EFI_PAGE_SHIFT)\r
959ccb23 198\r
4ab0dff3 199///\r
af2dc6a7 200/// PE32+ Machine type for IA32 UEFI images.\r
4ab0dff3 201///\r
97f8b30c 202#define EFI_IMAGE_MACHINE_IA32 0x014C\r
4ab0dff3 203\r
204///\r
af2dc6a7 205/// PE32+ Machine type for IA64 UEFI images.\r
4ab0dff3 206///\r
97f8b30c 207#define EFI_IMAGE_MACHINE_IA64 0x0200\r
4ab0dff3 208\r
209///\r
af2dc6a7 210/// PE32+ Machine type for EBC UEFI images.\r
4ab0dff3 211///\r
97f8b30c 212#define EFI_IMAGE_MACHINE_EBC 0x0EBC\r
4ab0dff3 213\r
214///\r
af2dc6a7 215/// PE32+ Machine type for X64 UEFI images.\r
4ab0dff3 216///\r
97f8b30c 217#define EFI_IMAGE_MACHINE_X64 0x8664\r
4ab0dff3 218\r
ebd04fc2 219///\r
af2dc6a7 220/// PE32+ Machine type for ARM mixed ARM and Thumb/Thumb2 images.\r
ebd04fc2 221///\r
222#define EFI_IMAGE_MACHINE_ARMTHUMB_MIXED 0x01C2\r
223\r
4ab0dff3 224\r
225#if defined (MDE_CPU_IA32)\r
226\r
227#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \\r
228 (((Machine) == EFI_IMAGE_MACHINE_IA32) || ((Machine) == EFI_IMAGE_MACHINE_EBC))\r
229\r
230#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_X64) \r
231\r
232#elif defined (MDE_CPU_IPF)\r
233\r
234#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \\r
235 (((Machine) == EFI_IMAGE_MACHINE_IA64) || ((Machine) == EFI_IMAGE_MACHINE_EBC))\r
236\r
237#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE) \r
238\r
239#elif defined (MDE_CPU_X64)\r
240\r
241#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \\r
242 (((Machine) == EFI_IMAGE_MACHINE_X64) || ((Machine) == EFI_IMAGE_MACHINE_EBC))\r
243\r
244#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_IA32) \r
245\r
ebd04fc2 246#elif defined (MDE_CPU_ARM)\r
247\r
248#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \\r
249 (((Machine) == EFI_IMAGE_MACHINE_ARMTHUMB_MIXED) || ((Machine) == EFI_IMAGE_MACHINE_EBC))\r
250\r
251#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_ARMTHUMB_MIXED) \r
252\r
4ab0dff3 253#elif defined (MDE_CPU_EBC)\r
254\r
255///\r
eaad1319 256/// This is just to make sure you can cross compile with the EBC compiler.\r
8992ce06 257/// It does not make sense to have a PE loader coded in EBC. \r
4ab0dff3 258///\r
259#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_EBC)\r
260\r
261#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE) \r
262\r
263#else\r
264#error Unknown Processor Type\r
265#endif\r
f4e8509b 266\r
959ccb23 267#endif\r