2 * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 2.0 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
23 #ifndef _PEXPERT_I386_EFI_H
24 #define _PEXPERT_I386_EFI_H
26 typedef uint8_t EFI_UINT8
;
27 typedef uint16_t EFI_UINT16
;
28 typedef uint32_t EFI_UINT32
;
29 typedef uint64_t EFI_UINT64
;
31 typedef uint32_t EFI_UINTN
;
33 typedef int8_t EFI_INT8
;
34 typedef int16_t EFI_INT16
;
35 typedef int32_t EFI_INT32
;
36 typedef int64_t EFI_INT64
;
38 typedef int8_t EFI_CHAR8
;
39 typedef int16_t EFI_CHAR16
;
40 typedef int32_t EFI_CHAR32
;
41 typedef int64_t EFI_CHAR64
;
43 typedef uint32_t EFI_STATUS
;
44 typedef boolean_t EFI_BOOLEAN
;
46 typedef VOID
* EFI_HANDLE
;
48 typedef uint64_t EFI_PTR64
;
49 typedef uint64_t EFI_HANDLE64
;
52 Portions Copyright 2004, Intel Corporation
53 All rights reserved. This program and the accompanying materials
54 are licensed and made available under the terms and conditions of the BSD License
55 which accompanies this distribution. The full text of the license may be found at
56 http://opensource.org/licenses/bsd-license.php
58 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
59 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
65 // Modifiers for EFI Runtime and Boot Services
67 #define EFI_RUNTIMESERVICE
73 #define EFI_MAX_BIT 0x80000000
76 // Set the upper bit to indicate EFI Error.
78 #define EFIERR(a) (EFI_MAX_BIT | (a))
80 #define EFIWARN(a) (a)
81 #define EFI_ERROR(a) (((INTN) (a)) < 0)
84 #define EFI_LOAD_ERROR EFIERR (1)
85 #define EFI_INVALID_PARAMETER EFIERR (2)
86 #define EFI_UNSUPPORTED EFIERR (3)
87 #define EFI_BAD_BUFFER_SIZE EFIERR (4)
88 #define EFI_BUFFER_TOO_SMALL EFIERR (5)
89 #define EFI_NOT_READY EFIERR (6)
90 #define EFI_DEVICE_ERROR EFIERR (7)
91 #define EFI_WRITE_PROTECTED EFIERR (8)
92 #define EFI_OUT_OF_RESOURCES EFIERR (9)
93 #define EFI_VOLUME_CORRUPTED EFIERR (10)
94 #define EFI_VOLUME_FULL EFIERR (11)
95 #define EFI_NO_MEDIA EFIERR (12)
96 #define EFI_MEDIA_CHANGED EFIERR (13)
97 #define EFI_NOT_FOUND EFIERR (14)
98 #define EFI_ACCESS_DENIED EFIERR (15)
99 #define EFI_NO_RESPONSE EFIERR (16)
100 #define EFI_NO_MAPPING EFIERR (17)
101 #define EFI_TIMEOUT EFIERR (18)
102 #define EFI_NOT_STARTED EFIERR (19)
103 #define EFI_ALREADY_STARTED EFIERR (20)
104 #define EFI_ABORTED EFIERR (21)
105 #define EFI_ICMP_ERROR EFIERR (22)
106 #define EFI_TFTP_ERROR EFIERR (23)
107 #define EFI_PROTOCOL_ERROR EFIERR (24)
108 #define EFI_INCOMPATIBLE_VERSION EFIERR (25)
109 #define EFI_SECURITY_VIOLATION EFIERR (26)
110 #define EFI_CRC_ERROR EFIERR (27)
112 #define EFI_WARN_UNKNOWN_GLYPH EFIWARN (1)
113 #define EFI_WARN_DELETE_FAILURE EFIWARN (2)
114 #define EFI_WARN_WRITE_FAILURE EFIWARN (3)
115 #define EFI_WARN_BUFFER_TOO_SMALL EFIWARN (4)
118 // EFI Specification Revision information
120 #define EFI_SPECIFICATION_MAJOR_REVISION 1
121 #define EFI_SPECIFICATION_MINOR_REVISION 10
130 #define APPLE_VENDOR_GUID \
131 {0xAC39C713, 0x7E50, 0x423D, {0x88, 0x9D, 0x27,0x8F, 0xCC, 0x34, 0x22, 0xB6} }
133 #define EFI_GLOBAL_VARIABLE_GUID \
134 {0x8BE4DF61, 0x93CA, 0x11d2, {0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C} }
142 // EFI Time Abstraction:
149 // Nanosecond: 0 - 999,999,999
150 // TimeZone: -1440 to 1440 or 2047
160 EFI_UINT32 Nanosecond
;
167 // Bit definitions for EFI_TIME.Daylight
169 #define EFI_TIME_ADJUST_DAYLIGHT 0x01
170 #define EFI_TIME_IN_DAYLIGHT 0x02
173 // Value definition for EFI_TIME.TimeZone
175 #define EFI_UNSPECIFIED_TIMEZONE 0x07FF
178 EfiReservedMemoryType
,
183 EfiRuntimeServicesCode
,
184 EfiRuntimeServicesData
,
185 EfiConventionalMemory
,
187 EfiACPIReclaimMemory
,
190 EfiMemoryMappedIOPortSpace
,
196 EFI_UINT64 Signature
;
198 EFI_UINT32 HeaderSize
;
201 } __attribute__((aligned(8))) EFI_TABLE_HEADER
;
204 // possible caching types for the memory range
206 #define EFI_MEMORY_UC 0x0000000000000001ULL
207 #define EFI_MEMORY_WC 0x0000000000000002ULL
208 #define EFI_MEMORY_WT 0x0000000000000004ULL
209 #define EFI_MEMORY_WB 0x0000000000000008ULL
210 #define EFI_MEMORY_UCE 0x0000000000000010ULL
213 // physical memory protection on range
215 #define EFI_MEMORY_WP 0x0000000000001000ULL
216 #define EFI_MEMORY_RP 0x0000000000002000ULL
217 #define EFI_MEMORY_XP 0x0000000000004000ULL
220 // range requires a runtime mapping
222 #define EFI_MEMORY_RUNTIME 0x8000000000000000ULL
224 typedef EFI_UINT64 EFI_PHYSICAL_ADDRESS
;
225 typedef EFI_UINT64 EFI_VIRTUAL_ADDRESS
;
227 #define EFI_MEMORY_DESCRIPTOR_VERSION 1
231 EFI_PHYSICAL_ADDRESS PhysicalStart
;
232 EFI_VIRTUAL_ADDRESS VirtualStart
;
233 EFI_UINT64 NumberOfPages
;
234 EFI_UINT64 Attribute
;
235 } __attribute__((aligned(8))) EFI_MEMORY_DESCRIPTOR
;
241 (EFIAPI
*EFI_SET_VIRTUAL_ADDRESS_MAP
) (
242 IN EFI_UINTN MemoryMapSize
,
243 IN EFI_UINTN DescriptorSize
,
244 IN EFI_UINT32 DescriptorVersion
,
245 IN EFI_MEMORY_DESCRIPTOR
* VirtualMap
246 ) __attribute__((regparm(0)));
251 (EFIAPI
*EFI_CONVERT_POINTER
) (
252 IN EFI_UINTN DebugDisposition
,
253 IN OUT VOID
**Address
254 ) __attribute__((regparm(0)));
257 // Variable attributes
259 #define EFI_VARIABLE_NON_VOLATILE 0x00000001
260 #define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002
261 #define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004
262 #define EFI_VARIABLE_READ_ONLY 0x00000008
267 (EFIAPI
*EFI_GET_VARIABLE
) (
268 IN EFI_CHAR16
* VariableName
,
269 IN EFI_GUID
* VendorGuid
,
270 OUT EFI_UINT32
* Attributes OPTIONAL
,
271 IN OUT EFI_UINTN
* DataSize
,
273 ) __attribute__((regparm(0)));
278 (EFIAPI
*EFI_GET_NEXT_VARIABLE_NAME
) (
279 IN OUT EFI_UINTN
* VariableNameSize
,
280 IN OUT EFI_CHAR16
* VariableName
,
281 IN OUT EFI_GUID
* VendorGuid
282 ) __attribute__((regparm(0)));
287 (EFIAPI
*EFI_SET_VARIABLE
) (
288 IN EFI_CHAR16
* VariableName
,
289 IN EFI_GUID
* VendorGuid
,
290 IN EFI_UINT32 Attributes
,
291 IN EFI_UINTN DataSize
,
293 ) __attribute__((regparm(0)));
299 EFI_UINT32 Resolution
;
301 EFI_BOOLEAN SetsToZero
;
302 } __attribute__((aligned(4))) EFI_TIME_CAPABILITIES
;
307 (EFIAPI
*EFI_GET_TIME
) (
309 OUT EFI_TIME_CAPABILITIES
* Capabilities OPTIONAL
310 ) __attribute__((regparm(0)));
315 (EFIAPI
*EFI_SET_TIME
) (
317 ) __attribute__((regparm(0)));
322 (EFIAPI
*EFI_GET_WAKEUP_TIME
) (
323 OUT EFI_BOOLEAN
* Enabled
,
324 OUT EFI_BOOLEAN
* Pending
,
326 ) __attribute__((regparm(0)));
331 (EFIAPI
*EFI_SET_WAKEUP_TIME
) (
332 IN EFI_BOOLEAN Enable
,
333 IN EFI_TIME
* Time OPTIONAL
334 ) __attribute((regparm(0)));
341 #ifdef TIANO_EXTENSION_FLAG
350 (EFIAPI
*EFI_RESET_SYSTEM
) (
351 IN EFI_RESET_TYPE ResetType
,
352 IN EFI_STATUS ResetStatus
,
353 IN EFI_UINTN DataSize
,
354 IN EFI_CHAR16
* ResetData OPTIONAL
355 ) __attribute__((regparm(0)));
360 (EFIAPI
*EFI_GET_NEXT_HIGH_MONO_COUNT
) (
361 OUT EFI_UINT32
* HighCount
362 ) __attribute__((regparm(0)));
365 // Definition of Status Code extended data header
367 // HeaderSize The size of the architecture. This is specified to enable
368 // the future expansion
370 // Size The size of the data in bytes. This does not include the size
371 // of the header structure.
373 // Type A GUID defining the type of the data
376 #ifdef TIANO_EXTENSION_FLAG
381 (EFIAPI
*EFI_REPORT_STATUS_CODE
) (
382 IN EFI_STATUS_CODE_TYPE Type
,
383 IN EFI_STATUS_CODE_VALUE Value
,
384 IN EFI_UINT32 Instance
,
385 IN EFI_GUID
* CallerId OPTIONAL
,
386 IN EFI_STATUS_CODE_DATA
* Data OPTIONAL
387 ) __attribute__((regparm(0)));
391 // EFI Runtime Services Table
393 #define EFI_RUNTIME_SERVICES_SIGNATURE 0x56524553544e5552ULL
394 #define EFI_RUNTIME_SERVICES_REVISION ((EFI_SPECIFICATION_MAJOR_REVISION << 16) | (EFI_SPECIFICATION_MINOR_REVISION))
397 EFI_TABLE_HEADER Hdr
;
402 EFI_GET_TIME GetTime
;
403 EFI_SET_TIME SetTime
;
404 EFI_GET_WAKEUP_TIME GetWakeupTime
;
405 EFI_SET_WAKEUP_TIME SetWakeupTime
;
408 // Virtual memory services
410 EFI_SET_VIRTUAL_ADDRESS_MAP SetVirtualAddressMap
;
411 EFI_CONVERT_POINTER ConvertPointer
;
416 EFI_GET_VARIABLE GetVariable
;
417 EFI_GET_NEXT_VARIABLE_NAME GetNextVariableName
;
418 EFI_SET_VARIABLE SetVariable
;
423 EFI_GET_NEXT_HIGH_MONO_COUNT GetNextHighMonotonicCount
;
424 EFI_RESET_SYSTEM ResetSystem
;
426 #ifdef TIANO_EXTENSION_FLAG
428 // ////////////////////////////////////////////////////
429 // Extended EFI Services
430 //////////////////////////////////////////////////////
432 EFI_REPORT_STATUS_CODE ReportStatusCode
;
435 } __attribute__((aligned(8))) EFI_RUNTIME_SERVICES
;
438 EFI_TABLE_HEADER Hdr
;
445 EFI_PTR64 GetWakeupTime
;
446 EFI_PTR64 SetWakeupTime
;
449 // Virtual memory services
451 EFI_PTR64 SetVirtualAddressMap
;
452 EFI_PTR64 ConvertPointer
;
457 EFI_PTR64 GetVariable
;
458 EFI_PTR64 GetNextVariableName
;
459 EFI_PTR64 SetVariable
;
464 EFI_PTR64 GetNextHighMonotonicCount
;
465 EFI_PTR64 ResetSystem
;
467 #ifdef TIANO_EXTENSION_FLAG
469 // ////////////////////////////////////////////////////
470 // Extended EFI Services
471 //////////////////////////////////////////////////////
473 EFI_PTR64 ReportStatusCode
;
476 } __attribute__((aligned(8))) EFI_RUNTIME_SERVICES_64
;
479 // EFI Configuration Table
484 } EFI_CONFIGURATION_TABLE
;
489 #define EFI_SYSTEM_TABLE_SIGNATURE 0x5453595320494249ULL
490 #define EFI_SYSTEM_TABLE_REVISION ((EFI_SPECIFICATION_MAJOR_REVISION << 16) | (EFI_SPECIFICATION_MINOR_REVISION))
491 #define EFI_2_00_SYSTEM_TABLE_REVISION ((2 << 16) | 00)
492 #define EFI_1_02_SYSTEM_TABLE_REVISION ((1 << 16) | 02)
493 #define EFI_1_10_SYSTEM_TABLE_REVISION ((1 << 16) | 10)
495 typedef struct EFI_SYSTEM_TABLE
{
496 EFI_TABLE_HEADER Hdr
;
498 EFI_CHAR16
*FirmwareVendor
;
499 EFI_UINT32 FirmwareRevision
;
501 EFI_HANDLE ConsoleInHandle
;
504 EFI_HANDLE ConsoleOutHandle
;
507 EFI_HANDLE StandardErrorHandle
;
510 EFI_RUNTIME_SERVICES
*RuntimeServices
;
513 EFI_UINTN NumberOfTableEntries
;
514 EFI_CONFIGURATION_TABLE
*ConfigurationTable
;
516 } __attribute__((aligned(8))) EFI_SYSTEM_TABLE
;
518 typedef struct EFI_SYSTEM_TABLE_64
{
519 EFI_TABLE_HEADER Hdr
;
521 EFI_PTR64 FirmwareVendor
;
522 EFI_UINT32 FirmwareRevision
;
526 EFI_HANDLE64 ConsoleInHandle
;
529 EFI_HANDLE64 ConsoleOutHandle
;
532 EFI_HANDLE64 StandardErrorHandle
;
535 EFI_PTR64 RuntimeServices
;
536 EFI_PTR64 BootServices
;
538 EFI_UINT64 NumberOfTableEntries
;
539 EFI_PTR64 ConfigurationTable
;
541 } __attribute__((aligned(8))) EFI_SYSTEM_TABLE_64
;
543 #endif /* _PEXPERT_I386_EFI_H */