Move definition of EFI_PARTITION_ENTRY_STATUS from IndustryStandard in MDE Package...
[mirror_edk2.git] / MdePkg / Include / Uefi / UefiBaseType.h
CommitLineData
c311f86b 1/** @file\r
959ccb23 2\r
3 Defines data types and constants introduced in UEFI.\r
4\r
54cf8780 5 Copyright (c) 2006 - 2008, Intel Corporation\r
c311f86b 6 All rights reserved. This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10 \r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
959ccb23 13\r
14**/\r
15\r
16#ifndef __UEFI_BASETYPE_H__\r
17#define __UEFI_BASETYPE_H__\r
18\r
19#include "Base.h"\r
20\r
8b13229b 21///\r
22/// Basical data type definitions introduced in UEFI.\r
23/// \r
00edb218 24typedef GUID EFI_GUID;\r
8b13229b 25\r
3f748e52 26///\r
27/// Function return status for EFI API\r
28///\r
00edb218
A
29typedef RETURN_STATUS EFI_STATUS;\r
30typedef VOID *EFI_HANDLE;\r
959ccb23 31\r
00edb218 32typedef VOID *EFI_EVENT;\r
959ccb23 33\r
00edb218 34typedef UINTN EFI_TPL;\r
959ccb23 35\r
36\r
00edb218 37typedef UINT64 EFI_LBA;\r
959ccb23 38\r
39\r
00edb218 40typedef UINT16 STRING_REF;\r
959ccb23 41\r
00edb218
A
42typedef UINT64 EFI_PHYSICAL_ADDRESS;\r
43typedef UINT64 EFI_VIRTUAL_ADDRESS;\r
959ccb23 44\r
fb5148a0 45///\r
46/// EFI Time Abstraction:\r
47/// Year: 2000 - 20XX\r
48/// Month: 1 - 12\r
49/// Day: 1 - 31\r
50/// Hour: 0 - 23\r
51/// Minute: 0 - 59\r
52/// Second: 0 - 59\r
53/// Nanosecond: 0 - 999,999,999\r
54/// TimeZone: -1440 to 1440 or 2047\r
55///\r
959ccb23 56typedef struct {\r
57 UINT16 Year;\r
58 UINT8 Month;\r
59 UINT8 Day;\r
60 UINT8 Hour;\r
61 UINT8 Minute;\r
62 UINT8 Second;\r
63 UINT8 Pad1;\r
64 UINT32 Nanosecond;\r
65 INT16 TimeZone;\r
66 UINT8 Daylight;\r
67 UINT8 Pad2;\r
68} EFI_TIME;\r
69\r
d1f95000 70\r
71//\r
72// Networking Definitions\r
73//\r
74typedef struct {\r
75 UINT8 Addr[4];\r
76} EFI_IPv4_ADDRESS;\r
77\r
78typedef struct {\r
79 UINT8 Addr[16];\r
80} EFI_IPv6_ADDRESS;\r
81\r
82typedef struct {\r
83 UINT8 Addr[32];\r
84} EFI_MAC_ADDRESS;\r
85\r
86typedef union {\r
87 UINT32 Addr[4];\r
88 EFI_IPv4_ADDRESS v4;\r
89 EFI_IPv6_ADDRESS v6;\r
90} EFI_IP_ADDRESS;\r
91\r
92\r
959ccb23 93//\r
94// Enumeration of EFI_STATUS.\r
95// \r
96#define EFI_SUCCESS RETURN_SUCCESS \r
97#define EFI_LOAD_ERROR RETURN_LOAD_ERROR \r
98#define EFI_INVALID_PARAMETER RETURN_INVALID_PARAMETER \r
99#define EFI_UNSUPPORTED RETURN_UNSUPPORTED \r
100#define EFI_BAD_BUFFER_SIZE RETURN_BAD_BUFFER_SIZE \r
101#define EFI_BUFFER_TOO_SMALL RETURN_BUFFER_TOO_SMALL \r
102#define EFI_NOT_READY RETURN_NOT_READY \r
103#define EFI_DEVICE_ERROR RETURN_DEVICE_ERROR \r
104#define EFI_WRITE_PROTECTED RETURN_WRITE_PROTECTED \r
105#define EFI_OUT_OF_RESOURCES RETURN_OUT_OF_RESOURCES \r
106#define EFI_VOLUME_CORRUPTED RETURN_VOLUME_CORRUPTED \r
107#define EFI_VOLUME_FULL RETURN_VOLUME_FULL \r
108#define EFI_NO_MEDIA RETURN_NO_MEDIA \r
109#define EFI_MEDIA_CHANGED RETURN_MEDIA_CHANGED \r
110#define EFI_NOT_FOUND RETURN_NOT_FOUND \r
111#define EFI_ACCESS_DENIED RETURN_ACCESS_DENIED \r
112#define EFI_NO_RESPONSE RETURN_NO_RESPONSE \r
113#define EFI_NO_MAPPING RETURN_NO_MAPPING \r
114#define EFI_TIMEOUT RETURN_TIMEOUT \r
115#define EFI_NOT_STARTED RETURN_NOT_STARTED \r
116#define EFI_ALREADY_STARTED RETURN_ALREADY_STARTED \r
117#define EFI_ABORTED RETURN_ABORTED \r
118#define EFI_ICMP_ERROR RETURN_ICMP_ERROR \r
119#define EFI_TFTP_ERROR RETURN_TFTP_ERROR \r
120#define EFI_PROTOCOL_ERROR RETURN_PROTOCOL_ERROR \r
121#define EFI_INCOMPATIBLE_VERSION RETURN_INCOMPATIBLE_VERSION \r
122#define EFI_SECURITY_VIOLATION RETURN_SECURITY_VIOLATION \r
123#define EFI_CRC_ERROR RETURN_CRC_ERROR \r
124#define EFI_END_OF_MEDIA RETURN_END_OF_MEDIA\r
125#define EFI_END_OF_FILE RETURN_END_OF_FILE\r
54cf8780 126#define EFI_INVALID_LANGUAGE RETURN_INVALID_LANGUAGE\r
959ccb23 127\r
128#define EFI_WARN_UNKNOWN_GLYPH RETURN_WARN_UNKNOWN_GLYPH \r
129#define EFI_WARN_DELETE_FAILURE RETURN_WARN_DELETE_FAILURE \r
130#define EFI_WARN_WRITE_FAILURE RETURN_WARN_WRITE_FAILURE \r
131#define EFI_WARN_BUFFER_TOO_SMALL RETURN_WARN_BUFFER_TOO_SMALL\r
132\r
133\r
959ccb23 134//\r
135// Define macro to encode the status code.\r
136// \r
00edb218 137#define EFIERR(_a) ENCODE_ERROR(_a)\r
959ccb23 138\r
139#define EFI_ERROR(A) RETURN_ERROR(A)\r
140\r
141//\r
142// Define macros to build data structure signatures from characters.\r
143//\r
144#define EFI_SIGNATURE_16(A, B) ((A) | (B << 8))\r
145#define EFI_SIGNATURE_32(A, B, C, D) (EFI_SIGNATURE_16 (A, B) | (EFI_SIGNATURE_16 (C, D) << 16))\r
146#define EFI_SIGNATURE_64(A, B, C, D, E, F, G, H) \\r
147 (EFI_SIGNATURE_32 (A, B, C, D) | ((UINT64) (EFI_SIGNATURE_32 (E, F, G, H)) << 32))\r
148\r
149\r
8b13229b 150///\r
151/// Returns the byte offset to a field within a structure\r
152///\r
959ccb23 153#define EFI_FIELD_OFFSET(TYPE,Field) ((UINTN)(&(((TYPE *) 0)->Field)))\r
154\r
155//\r
156// The EFI memory allocation functions work in units of EFI_PAGEs that are\r
157// 4K. This should in no way be confused with the page size of the processor.\r
158// An EFI_PAGE is just the quanta of memory in EFI.\r
159//\r
00edb218
A
160#define EFI_PAGE_SIZE 0x1000\r
161#define EFI_PAGE_MASK 0xFFF\r
162#define EFI_PAGE_SHIFT 12\r
959ccb23 163\r
833bd94e 164#define EFI_SIZE_TO_PAGES(a) (((a) >> EFI_PAGE_SHIFT) + (((a) & EFI_PAGE_MASK) ? 1 : 0))\r
165\r
166#define EFI_PAGES_TO_SIZE(a) ( (a) << EFI_PAGE_SHIFT)\r
959ccb23 167\r
ce2f5557 168\r
169#define EFI_MAX_BIT MAX_BIT\r
170#define EFI_MAX_ADDRESS MAX_ADDRESS\r
171\r
f4e8509b 172\r
173///\r
174/// Limited buffer size for a language code recommended by RFC3066\r
175/// (42 characters plus a NULL terminator)\r
176///\r
177#define RFC_3066_ENTRY_SIZE (42 + 1)\r
178\r
179///\r
180/// The size of a 3 character ISO639 language code.\r
181///\r
182#define ISO_639_2_ENTRY_SIZE 3\r
183\r
184\r
959ccb23 185#endif\r