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