Move to directory "Include"
[mirror_edk2.git] / MdePkg / Include / Uefi / UefiBaseType.h
CommitLineData
959ccb23 1\r
2/* @file\r
3\r
4 Defines data types and constants introduced in UEFI.\r
5\r
6Copyright (c) 2006 - 2007, Intel Corporation\r
7All rights reserved. This program and the accompanying materials\r
8are licensed and made available under the terms and conditions of the BSD License\r
9which accompanies this distribution. The 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
14\r
15**/\r
16\r
17#ifndef __UEFI_BASETYPE_H__\r
18#define __UEFI_BASETYPE_H__\r
19\r
20#include "Base.h"\r
21\r
22//\r
23// Basical data type definitions introduced in UEFI.\r
24// \r
25typedef GUID EFI_GUID;\r
26typedef RETURN_STATUS EFI_STATUS;\r
27typedef VOID *EFI_HANDLE;\r
28\r
29typedef VOID *EFI_EVENT;\r
30\r
31typedef UINTN EFI_TPL;\r
32\r
33\r
34typedef UINT64 EFI_LBA;\r
35\r
36\r
37typedef UINT16 EFI_HII_HANDLE;\r
38typedef UINT16 STRING_REF;\r
39\r
40typedef UINT64 EFI_PHYSICAL_ADDRESS;\r
41typedef UINT64 EFI_VIRTUAL_ADDRESS;\r
42\r
43//\r
44// EFI Time Abstraction:\r
45// Year: 2000 - 20XX\r
46// Month: 1 - 12\r
47// Day: 1 - 31\r
48// Hour: 0 - 23\r
49// Minute: 0 - 59\r
50// Second: 0 - 59\r
51// Nanosecond: 0 - 999,999,999\r
52// TimeZone: -1440 to 1440 or 2047\r
53//\r
54typedef struct {\r
55 UINT16 Year;\r
56 UINT8 Month;\r
57 UINT8 Day;\r
58 UINT8 Hour;\r
59 UINT8 Minute;\r
60 UINT8 Second;\r
61 UINT8 Pad1;\r
62 UINT32 Nanosecond;\r
63 INT16 TimeZone;\r
64 UINT8 Daylight;\r
65 UINT8 Pad2;\r
66} EFI_TIME;\r
67\r
68//\r
69// Enumeration of EFI_STATUS.\r
70// \r
71#define EFI_SUCCESS RETURN_SUCCESS \r
72#define EFI_LOAD_ERROR RETURN_LOAD_ERROR \r
73#define EFI_INVALID_PARAMETER RETURN_INVALID_PARAMETER \r
74#define EFI_UNSUPPORTED RETURN_UNSUPPORTED \r
75#define EFI_BAD_BUFFER_SIZE RETURN_BAD_BUFFER_SIZE \r
76#define EFI_BUFFER_TOO_SMALL RETURN_BUFFER_TOO_SMALL \r
77#define EFI_NOT_READY RETURN_NOT_READY \r
78#define EFI_DEVICE_ERROR RETURN_DEVICE_ERROR \r
79#define EFI_WRITE_PROTECTED RETURN_WRITE_PROTECTED \r
80#define EFI_OUT_OF_RESOURCES RETURN_OUT_OF_RESOURCES \r
81#define EFI_VOLUME_CORRUPTED RETURN_VOLUME_CORRUPTED \r
82#define EFI_VOLUME_FULL RETURN_VOLUME_FULL \r
83#define EFI_NO_MEDIA RETURN_NO_MEDIA \r
84#define EFI_MEDIA_CHANGED RETURN_MEDIA_CHANGED \r
85#define EFI_NOT_FOUND RETURN_NOT_FOUND \r
86#define EFI_ACCESS_DENIED RETURN_ACCESS_DENIED \r
87#define EFI_NO_RESPONSE RETURN_NO_RESPONSE \r
88#define EFI_NO_MAPPING RETURN_NO_MAPPING \r
89#define EFI_TIMEOUT RETURN_TIMEOUT \r
90#define EFI_NOT_STARTED RETURN_NOT_STARTED \r
91#define EFI_ALREADY_STARTED RETURN_ALREADY_STARTED \r
92#define EFI_ABORTED RETURN_ABORTED \r
93#define EFI_ICMP_ERROR RETURN_ICMP_ERROR \r
94#define EFI_TFTP_ERROR RETURN_TFTP_ERROR \r
95#define EFI_PROTOCOL_ERROR RETURN_PROTOCOL_ERROR \r
96#define EFI_INCOMPATIBLE_VERSION RETURN_INCOMPATIBLE_VERSION \r
97#define EFI_SECURITY_VIOLATION RETURN_SECURITY_VIOLATION \r
98#define EFI_CRC_ERROR RETURN_CRC_ERROR \r
99#define EFI_END_OF_MEDIA RETURN_END_OF_MEDIA\r
100#define EFI_END_OF_FILE RETURN_END_OF_FILE\r
101\r
102#define EFI_WARN_UNKNOWN_GLYPH RETURN_WARN_UNKNOWN_GLYPH \r
103#define EFI_WARN_DELETE_FAILURE RETURN_WARN_DELETE_FAILURE \r
104#define EFI_WARN_WRITE_FAILURE RETURN_WARN_WRITE_FAILURE \r
105#define EFI_WARN_BUFFER_TOO_SMALL RETURN_WARN_BUFFER_TOO_SMALL\r
106\r
107\r
108#define NULL_HANDLE ((VOID *) 0)\r
109\r
110//\r
111// Define macro to encode the status code.\r
112// \r
113#define EFIERR(_a) ENCODE_ERROR(_a)\r
114\r
115#define EFI_ERROR(A) RETURN_ERROR(A)\r
116\r
117//\r
118// Define macros to build data structure signatures from characters.\r
119//\r
120#define EFI_SIGNATURE_16(A, B) ((A) | (B << 8))\r
121#define EFI_SIGNATURE_32(A, B, C, D) (EFI_SIGNATURE_16 (A, B) | (EFI_SIGNATURE_16 (C, D) << 16))\r
122#define EFI_SIGNATURE_64(A, B, C, D, E, F, G, H) \\r
123 (EFI_SIGNATURE_32 (A, B, C, D) | ((UINT64) (EFI_SIGNATURE_32 (E, F, G, H)) << 32))\r
124\r
125\r
126//\r
127// Returns the byte offset to a field within a structure\r
128//\r
129#define EFI_FIELD_OFFSET(TYPE,Field) ((UINTN)(&(((TYPE *) 0)->Field)))\r
130\r
131//\r
132// The EFI memory allocation functions work in units of EFI_PAGEs that are\r
133// 4K. This should in no way be confused with the page size of the processor.\r
134// An EFI_PAGE is just the quanta of memory in EFI.\r
135//\r
136#define EFI_PAGE_SIZE 0x1000\r
137#define EFI_PAGE_MASK 0xFFF\r
138#define EFI_PAGE_SHIFT 12\r
139\r
140\r
141#endif\r