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