1 /****************************************************************************** 2 * 3 * Name: acefiex.h - Extra OS specific defines, etc. for EFI 4 * 5 *****************************************************************************/ 6 7 /****************************************************************************** 8 * 9 * 1. Copyright Notice 10 * 11 * Some or all of this work - Copyright (c) 1999 - 2023, Intel Corp. 12 * All rights reserved. 13 * 14 * 2. License 15 * 16 * 2.1. This is your license from Intel Corp. under its intellectual property 17 * rights. You may have additional license terms from the party that provided 18 * you this software, covering your right to use that party's intellectual 19 * property rights. 20 * 21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 22 * copy of the source code appearing in this file ("Covered Code") an 23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 24 * base code distributed originally by Intel ("Original Intel Code") to copy, 25 * make derivatives, distribute, use and display any portion of the Covered 26 * Code in any form, with the right to sublicense such rights; and 27 * 28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 29 * license (with the right to sublicense), under only those claims of Intel 30 * patents that are infringed by the Original Intel Code, to make, use, sell, 31 * offer to sell, and import the Covered Code and derivative works thereof 32 * solely to the minimum extent necessary to exercise the above copyright 33 * license, and in no event shall the patent license extend to any additions 34 * to or modifications of the Original Intel Code. No other license or right 35 * is granted directly or by implication, estoppel or otherwise; 36 * 37 * The above copyright and patent license is granted only if the following 38 * conditions are met: 39 * 40 * 3. Conditions 41 * 42 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 43 * Redistribution of source code of any substantial portion of the Covered 44 * Code or modification with rights to further distribute source must include 45 * the above Copyright Notice, the above License, this list of Conditions, 46 * and the following Disclaimer and Export Compliance provision. In addition, 47 * Licensee must cause all Covered Code to which Licensee contributes to 48 * contain a file documenting the changes Licensee made to create that Covered 49 * Code and the date of any change. Licensee must include in that file the 50 * documentation of any changes made by any predecessor Licensee. Licensee 51 * must include a prominent statement that the modification is derived, 52 * directly or indirectly, from Original Intel Code. 53 * 54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 55 * Redistribution of source code of any substantial portion of the Covered 56 * Code or modification without rights to further distribute source must 57 * include the following Disclaimer and Export Compliance provision in the 58 * documentation and/or other materials provided with distribution. In 59 * addition, Licensee may not authorize further sublicense of source of any 60 * portion of the Covered Code, and must include terms to the effect that the 61 * license from Licensee to its licensee is limited to the intellectual 62 * property embodied in the software Licensee provides to its licensee, and 63 * not to intellectual property embodied in modifications its licensee may 64 * make. 65 * 66 * 3.3. Redistribution of Executable. Redistribution in executable form of any 67 * substantial portion of the Covered Code or modification must reproduce the 68 * above Copyright Notice, and the following Disclaimer and Export Compliance 69 * provision in the documentation and/or other materials provided with the 70 * distribution. 71 * 72 * 3.4. Intel retains all right, title, and interest in and to the Original 73 * Intel Code. 74 * 75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 76 * Intel shall be used in advertising or otherwise to promote the sale, use or 77 * other dealings in products derived from or relating to the Covered Code 78 * without prior written authorization from Intel. 79 * 80 * 4. Disclaimer and Export Compliance 81 * 82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 88 * PARTICULAR PURPOSE. 89 * 90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 97 * LIMITED REMEDY. 98 * 99 * 4.3. Licensee shall not export, either directly or indirectly, any of this 100 * software or system incorporating such software without first obtaining any 101 * required license or other approval from the U. S. Department of Commerce or 102 * any other agency or department of the United States Government. In the 103 * event Licensee exports any such software from the United States or 104 * re-exports any such software from a foreign destination, Licensee shall 105 * ensure that the distribution and export/re-export of the software is in 106 * compliance with all laws, regulations, orders, or other restrictions of the 107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 108 * any of its subsidiaries will export/re-export any technical data, process, 109 * software, or service, directly or indirectly, to any country for which the 110 * United States government or any agency thereof requires an export license, 111 * other governmental approval, or letter of assurance, without first obtaining 112 * such license, approval or letter. 113 * 114 ***************************************************************************** 115 * 116 * Alternatively, you may choose to be licensed under the terms of the 117 * following license: 118 * 119 * Redistribution and use in source and binary forms, with or without 120 * modification, are permitted provided that the following conditions 121 * are met: 122 * 1. Redistributions of source code must retain the above copyright 123 * notice, this list of conditions, and the following disclaimer, 124 * without modification. 125 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 126 * substantially similar to the "NO WARRANTY" disclaimer below 127 * ("Disclaimer") and any redistribution must be conditioned upon 128 * including a substantially similar Disclaimer requirement for further 129 * binary redistribution. 130 * 3. Neither the names of the above-listed copyright holders nor the names 131 * of any contributors may be used to endorse or promote products derived 132 * from this software without specific prior written permission. 133 * 134 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 135 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 136 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 137 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 138 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 139 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 140 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 141 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 142 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 143 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 144 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 145 * 146 * Alternatively, you may choose to be licensed under the terms of the 147 * GNU General Public License ("GPL") version 2 as published by the Free 148 * Software Foundation. 149 * 150 *****************************************************************************/ 151 152 #ifndef __ACEFIEX_H__ 153 #define __ACEFIEX_H__ 154 155 156 #ifndef ACPI_USE_SYSTEM_CLIBRARY 157 158 typedef signed char int8_t; 159 typedef short int int16_t; 160 typedef int int32_t; 161 typedef unsigned char uint8_t; 162 typedef unsigned short int uint16_t; 163 typedef unsigned int uint32_t; 164 typedef COMPILER_DEPENDENT_INT64 int64_t; 165 typedef COMPILER_DEPENDENT_UINT64 uint64_t; 166 167 #endif /* ACPI_USE_SYSTEM_CLIBRARY */ 168 169 #define ACPI_EFI_ERROR(a) (((INTN) a) < 0) 170 #define ACPI_EFI_SUCCESS 0 171 #define ACPI_EFI_LOAD_ERROR ACPI_EFI_ERR(1) 172 #define ACPI_EFI_INVALID_PARAMETER ACPI_EFI_ERR(2) 173 #define ACPI_EFI_UNSUPPORTED ACPI_EFI_ERR(3) 174 #define ACPI_EFI_BAD_BUFFER_SIZE ACPI_EFI_ERR(4) 175 #define ACPI_EFI_BUFFER_TOO_SMALL ACPI_EFI_ERR(5) 176 #define ACPI_EFI_NOT_READY ACPI_EFI_ERR(6) 177 #define ACPI_EFI_DEVICE_ERROR ACPI_EFI_ERR(7) 178 #define ACPI_EFI_WRITE_PROTECTED ACPI_EFI_ERR(8) 179 #define ACPI_EFI_OUT_OF_RESOURCES ACPI_EFI_ERR(9) 180 #define ACPI_EFI_VOLUME_CORRUPTED ACPI_EFI_ERR(10) 181 #define ACPI_EFI_VOLUME_FULL ACPI_EFI_ERR(11) 182 #define ACPI_EFI_NO_MEDIA ACPI_EFI_ERR(12) 183 #define ACPI_EFI_MEDIA_CHANGED ACPI_EFI_ERR(13) 184 #define ACPI_EFI_NOT_FOUND ACPI_EFI_ERR(14) 185 #define ACPI_EFI_ACCESS_DENIED ACPI_EFI_ERR(15) 186 #define ACPI_EFI_NO_RESPONSE ACPI_EFI_ERR(16) 187 #define ACPI_EFI_NO_MAPPING ACPI_EFI_ERR(17) 188 #define ACPI_EFI_TIMEOUT ACPI_EFI_ERR(18) 189 #define ACPI_EFI_NOT_STARTED ACPI_EFI_ERR(19) 190 #define ACPI_EFI_ALREADY_STARTED ACPI_EFI_ERR(20) 191 #define ACPI_EFI_ABORTED ACPI_EFI_ERR(21) 192 #define ACPI_EFI_PROTOCOL_ERROR ACPI_EFI_ERR(24) 193 194 195 typedef UINTN ACPI_EFI_STATUS; 196 typedef VOID *ACPI_EFI_HANDLE; 197 typedef VOID *ACPI_EFI_EVENT; 198 199 typedef struct { 200 UINT32 Data1; 201 UINT16 Data2; 202 UINT16 Data3; 203 UINT8 Data4[8]; 204 } ACPI_EFI_GUID; 205 206 typedef struct { 207 UINT16 Year; /* 1998 - 20XX */ 208 UINT8 Month; /* 1 - 12 */ 209 UINT8 Day; /* 1 - 31 */ 210 UINT8 Hour; /* 0 - 23 */ 211 UINT8 Minute; /* 0 - 59 */ 212 UINT8 Second; /* 0 - 59 */ 213 UINT8 Pad1; 214 UINT32 Nanosecond; /* 0 - 999,999,999 */ 215 INT16 TimeZone; /* -1440 to 1440 or 2047 */ 216 UINT8 Daylight; 217 UINT8 Pad2; 218 } ACPI_EFI_TIME; 219 220 typedef struct _ACPI_EFI_DEVICE_PATH { 221 UINT8 Type; 222 UINT8 SubType; 223 UINT8 Length[2]; 224 } ACPI_EFI_DEVICE_PATH; 225 226 typedef UINT64 ACPI_EFI_PHYSICAL_ADDRESS; 227 typedef UINT64 ACPI_EFI_VIRTUAL_ADDRESS; 228 229 typedef enum { 230 AcpiEfiAllocateAnyPages, 231 AcpiEfiAllocateMaxAddress, 232 AcpiEfiAllocateAddress, 233 AcpiEfiMaxAllocateType 234 } ACPI_EFI_ALLOCATE_TYPE; 235 236 typedef enum { 237 AcpiEfiReservedMemoryType, 238 AcpiEfiLoaderCode, 239 AcpiEfiLoaderData, 240 AcpiEfiBootServicesCode, 241 AcpiEfiBootServicesData, 242 AcpiEfiRuntimeServicesCode, 243 AcpiEfiRuntimeServicesData, 244 AcpiEfiConventionalMemory, 245 AcpiEfiUnusableMemory, 246 AcpiEfiACPIReclaimMemory, 247 AcpiEfiACPIMemoryNVS, 248 AcpiEfiMemoryMappedIO, 249 AcpiEfiMemoryMappedIOPortSpace, 250 AcpiEfiPalCode, 251 AcpiEfiMaxMemoryType 252 } ACPI_EFI_MEMORY_TYPE; 253 254 /* possible caching types for the memory range */ 255 #define ACPI_EFI_MEMORY_UC 0x0000000000000001 256 #define ACPI_EFI_MEMORY_WC 0x0000000000000002 257 #define ACPI_EFI_MEMORY_WT 0x0000000000000004 258 #define ACPI_EFI_MEMORY_WB 0x0000000000000008 259 #define ACPI_EFI_MEMORY_UCE 0x0000000000000010 260 261 /* physical memory protection on range */ 262 #define ACPI_EFI_MEMORY_WP 0x0000000000001000 263 #define ACPI_EFI_MEMORY_RP 0x0000000000002000 264 #define ACPI_EFI_MEMORY_XP 0x0000000000004000 265 266 /* range requires a runtime mapping */ 267 #define ACPI_EFI_MEMORY_RUNTIME 0x8000000000000000 268 269 #define ACPI_EFI_MEMORY_DESCRIPTOR_VERSION 1 270 typedef struct { 271 UINT32 Type; 272 UINT32 Pad; 273 ACPI_EFI_PHYSICAL_ADDRESS PhysicalStart; 274 ACPI_EFI_VIRTUAL_ADDRESS VirtualStart; 275 UINT64 NumberOfPages; 276 UINT64 Attribute; 277 } ACPI_EFI_MEMORY_DESCRIPTOR; 278 279 typedef struct _ACPI_EFI_TABLE_HEARDER { 280 UINT64 Signature; 281 UINT32 Revision; 282 UINT32 HeaderSize; 283 UINT32 CRC32; 284 UINT32 Reserved; 285 } ACPI_EFI_TABLE_HEADER; 286 287 typedef 288 ACPI_EFI_STATUS 289 (ACPI_EFI_API *ACPI_EFI_UNKNOWN_INTERFACE) ( 290 void); 291 292 293 /* 294 * Text output protocol 295 */ 296 #define ACPI_SIMPLE_TEXT_OUTPUT_PROTOCOL \ 297 { 0x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } 298 299 typedef 300 ACPI_EFI_STATUS 301 (ACPI_EFI_API *ACPI_EFI_TEXT_RESET) ( 302 struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *This, 303 BOOLEAN ExtendedVerification); 304 305 typedef 306 ACPI_EFI_STATUS 307 (ACPI_EFI_API *ACPI_EFI_TEXT_OUTPUT_STRING) ( 308 struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *This, 309 CHAR16 *String); 310 311 typedef 312 ACPI_EFI_STATUS 313 (ACPI_EFI_API *ACPI_EFI_TEXT_TEST_STRING) ( 314 struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *This, 315 CHAR16 *String); 316 317 typedef 318 ACPI_EFI_STATUS 319 (ACPI_EFI_API *ACPI_EFI_TEXT_QUERY_MODE) ( 320 struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *This, 321 UINTN ModeNumber, 322 UINTN *Columns, 323 UINTN *Rows); 324 325 typedef 326 ACPI_EFI_STATUS 327 (ACPI_EFI_API *ACPI_EFI_TEXT_SET_MODE) ( 328 struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *This, 329 UINTN ModeNumber); 330 331 typedef 332 ACPI_EFI_STATUS 333 (ACPI_EFI_API *ACPI_EFI_TEXT_SET_ATTRIBUTE) ( 334 struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *This, 335 UINTN Attribute); 336 337 typedef 338 ACPI_EFI_STATUS 339 (ACPI_EFI_API *ACPI_EFI_TEXT_CLEAR_SCREEN) ( 340 struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *This); 341 342 typedef 343 ACPI_EFI_STATUS 344 (ACPI_EFI_API *ACPI_EFI_TEXT_SET_CURSOR_POSITION) ( 345 struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *This, 346 UINTN Column, 347 UINTN Row); 348 349 typedef 350 ACPI_EFI_STATUS 351 (ACPI_EFI_API *ACPI_EFI_TEXT_ENABLE_CURSOR) ( 352 struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *This, 353 BOOLEAN Enable); 354 355 typedef struct { 356 INT32 MaxMode; 357 INT32 Mode; 358 INT32 Attribute; 359 INT32 CursorColumn; 360 INT32 CursorRow; 361 BOOLEAN CursorVisible; 362 } ACPI_SIMPLE_TEXT_OUTPUT_MODE; 363 364 typedef struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE { 365 ACPI_EFI_TEXT_RESET Reset; 366 367 ACPI_EFI_TEXT_OUTPUT_STRING OutputString; 368 ACPI_EFI_TEXT_TEST_STRING TestString; 369 370 ACPI_EFI_TEXT_QUERY_MODE QueryMode; 371 ACPI_EFI_TEXT_SET_MODE SetMode; 372 ACPI_EFI_TEXT_SET_ATTRIBUTE SetAttribute; 373 374 ACPI_EFI_TEXT_CLEAR_SCREEN ClearScreen; 375 ACPI_EFI_TEXT_SET_CURSOR_POSITION SetCursorPosition; 376 ACPI_EFI_TEXT_ENABLE_CURSOR EnableCursor; 377 378 ACPI_SIMPLE_TEXT_OUTPUT_MODE *Mode; 379 } ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE; 380 381 /* 382 * Text input protocol 383 */ 384 #define ACPI_SIMPLE_TEXT_INPUT_PROTOCOL \ 385 { 0x387477c1, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } 386 387 typedef struct { 388 UINT16 ScanCode; 389 CHAR16 UnicodeChar; 390 } ACPI_EFI_INPUT_KEY; 391 392 /* 393 * Baseline unicode control chars 394 */ 395 #define CHAR_NULL 0x0000 396 #define CHAR_BACKSPACE 0x0008 397 #define CHAR_TAB 0x0009 398 #define CHAR_LINEFEED 0x000A 399 #define CHAR_CARRIAGE_RETURN 0x000D 400 401 typedef 402 ACPI_EFI_STATUS 403 (ACPI_EFI_API *ACPI_EFI_INPUT_RESET) ( 404 struct _ACPI_SIMPLE_INPUT_INTERFACE *This, 405 BOOLEAN ExtendedVerification); 406 407 typedef 408 ACPI_EFI_STATUS 409 (ACPI_EFI_API *ACPI_EFI_INPUT_READ_KEY) ( 410 struct _ACPI_SIMPLE_INPUT_INTERFACE *This, 411 ACPI_EFI_INPUT_KEY *Key); 412 413 typedef struct _ACPI_SIMPLE_INPUT_INTERFACE { 414 ACPI_EFI_INPUT_RESET Reset; 415 ACPI_EFI_INPUT_READ_KEY ReadKeyStroke; 416 ACPI_EFI_EVENT WaitForKey; 417 } ACPI_SIMPLE_INPUT_INTERFACE; 418 419 420 /* 421 * Simple file system protocol 422 */ 423 #define ACPI_SIMPLE_FILE_SYSTEM_PROTOCOL \ 424 { 0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } 425 426 typedef 427 ACPI_EFI_STATUS 428 (ACPI_EFI_API *ACPI_EFI_VOLUME_OPEN) ( 429 struct _ACPI_EFI_FILE_IO_INTERFACE *This, 430 struct _ACPI_EFI_FILE_HANDLE **Root); 431 432 #define ACPI_EFI_FILE_IO_INTERFACE_REVISION 0x00010000 433 434 typedef struct _ACPI_EFI_FILE_IO_INTERFACE { 435 UINT64 Revision; 436 ACPI_EFI_VOLUME_OPEN OpenVolume; 437 } ACPI_EFI_FILE_IO_INTERFACE; 438 439 typedef 440 ACPI_EFI_STATUS 441 (ACPI_EFI_API *ACPI_EFI_FILE_OPEN) ( 442 struct _ACPI_EFI_FILE_HANDLE *File, 443 struct _ACPI_EFI_FILE_HANDLE **NewHandle, 444 CHAR16 *FileName, 445 UINT64 OpenMode, 446 UINT64 Attributes); 447 448 /* Values for OpenMode used above */ 449 450 #define ACPI_EFI_FILE_MODE_READ 0x0000000000000001 451 #define ACPI_EFI_FILE_MODE_WRITE 0x0000000000000002 452 #define ACPI_EFI_FILE_MODE_CREATE 0x8000000000000000 453 454 /* Values for Attribute used above */ 455 456 #define ACPI_EFI_FILE_READ_ONLY 0x0000000000000001 457 #define ACPI_EFI_FILE_HIDDEN 0x0000000000000002 458 #define ACPI_EFI_FILE_SYSTEM 0x0000000000000004 459 #define ACPI_EFI_FILE_RESERVIED 0x0000000000000008 460 #define ACPI_EFI_FILE_DIRECTORY 0x0000000000000010 461 #define ACPI_EFI_FILE_ARCHIVE 0x0000000000000020 462 #define ACPI_EFI_FILE_VALID_ATTR 0x0000000000000037 463 464 typedef 465 ACPI_EFI_STATUS 466 (ACPI_EFI_API *ACPI_EFI_FILE_CLOSE) ( 467 struct _ACPI_EFI_FILE_HANDLE *File); 468 469 typedef 470 ACPI_EFI_STATUS 471 (ACPI_EFI_API *ACPI_EFI_FILE_DELETE) ( 472 struct _ACPI_EFI_FILE_HANDLE *File); 473 474 typedef 475 ACPI_EFI_STATUS 476 (ACPI_EFI_API *ACPI_EFI_FILE_READ) ( 477 struct _ACPI_EFI_FILE_HANDLE *File, 478 UINTN *BufferSize, 479 VOID *Buffer); 480 481 typedef 482 ACPI_EFI_STATUS 483 (ACPI_EFI_API *ACPI_EFI_FILE_WRITE) ( 484 struct _ACPI_EFI_FILE_HANDLE *File, 485 UINTN *BufferSize, 486 VOID *Buffer); 487 488 typedef 489 ACPI_EFI_STATUS 490 (ACPI_EFI_API *ACPI_EFI_FILE_SET_POSITION) ( 491 struct _ACPI_EFI_FILE_HANDLE *File, 492 UINT64 Position); 493 494 typedef 495 ACPI_EFI_STATUS 496 (ACPI_EFI_API *ACPI_EFI_FILE_GET_POSITION) ( 497 struct _ACPI_EFI_FILE_HANDLE *File, 498 UINT64 *Position); 499 500 #define ACPI_EFI_FILE_INFO_ID \ 501 { 0x9576e92, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } 502 503 typedef struct { 504 UINT64 Size; 505 UINT64 FileSize; 506 UINT64 PhysicalSize; 507 ACPI_EFI_TIME CreateTime; 508 ACPI_EFI_TIME LastAccessTime; 509 ACPI_EFI_TIME ModificationTime; 510 UINT64 Attribute; 511 CHAR16 FileName[]; 512 } ACPI_EFI_FILE_INFO; 513 514 #define SIZE_OF_ACPI_EFI_FILE_INFO ACPI_OFFSET(ACPI_EFI_FILE_INFO, FileName) 515 516 typedef 517 ACPI_EFI_STATUS 518 (ACPI_EFI_API *ACPI_EFI_FILE_GET_INFO) ( 519 struct _ACPI_EFI_FILE_HANDLE *File, 520 ACPI_EFI_GUID *InformationType, 521 UINTN *BufferSize, 522 VOID *Buffer); 523 524 typedef 525 ACPI_EFI_STATUS 526 (ACPI_EFI_API *ACPI_EFI_FILE_SET_INFO) ( 527 struct _ACPI_EFI_FILE_HANDLE *File, 528 ACPI_EFI_GUID *InformationType, 529 UINTN BufferSize, 530 VOID *Buffer); 531 532 typedef 533 ACPI_EFI_STATUS 534 (ACPI_EFI_API *ACPI_EFI_FILE_FLUSH) ( 535 struct _ACPI_EFI_FILE_HANDLE *File); 536 537 538 #define ACPI_EFI_FILE_HANDLE_REVISION 0x00010000 539 540 typedef struct _ACPI_EFI_FILE_HANDLE { 541 UINT64 Revision; 542 ACPI_EFI_FILE_OPEN Open; 543 ACPI_EFI_FILE_CLOSE Close; 544 ACPI_EFI_FILE_DELETE Delete; 545 ACPI_EFI_FILE_READ Read; 546 ACPI_EFI_FILE_WRITE Write; 547 ACPI_EFI_FILE_GET_POSITION GetPosition; 548 ACPI_EFI_FILE_SET_POSITION SetPosition; 549 ACPI_EFI_FILE_GET_INFO GetInfo; 550 ACPI_EFI_FILE_SET_INFO SetInfo; 551 ACPI_EFI_FILE_FLUSH Flush; 552 } ACPI_EFI_FILE_STRUCT, *ACPI_EFI_FILE_HANDLE; 553 554 555 /* 556 * Loaded image protocol 557 */ 558 #define ACPI_EFI_LOADED_IMAGE_PROTOCOL \ 559 { 0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} } 560 561 typedef 562 ACPI_EFI_STATUS 563 (ACPI_EFI_API *ACPI_EFI_IMAGE_ENTRY_POINT) ( 564 ACPI_EFI_HANDLE ImageHandle, 565 struct _ACPI_EFI_SYSTEM_TABLE *SystemTable); 566 567 typedef 568 ACPI_EFI_STATUS 569 (ACPI_EFI_API *ACPI_EFI_IMAGE_LOAD) ( 570 BOOLEAN BootPolicy, 571 ACPI_EFI_HANDLE ParentImageHandle, 572 ACPI_EFI_DEVICE_PATH *FilePath, 573 VOID *SourceBuffer, 574 UINTN SourceSize, 575 ACPI_EFI_HANDLE *ImageHandle); 576 577 typedef 578 ACPI_EFI_STATUS 579 (ACPI_EFI_API *ACPI_EFI_IMAGE_START) ( 580 ACPI_EFI_HANDLE ImageHandle, 581 UINTN *ExitDataSize, 582 CHAR16 **ExitData); 583 584 typedef 585 ACPI_EFI_STATUS 586 (ACPI_EFI_API *ACPI_EFI_EXIT) ( 587 ACPI_EFI_HANDLE ImageHandle, 588 ACPI_EFI_STATUS ExitStatus, 589 UINTN ExitDataSize, 590 CHAR16 *ExitData); 591 592 typedef 593 ACPI_EFI_STATUS 594 (ACPI_EFI_API *ACPI_EFI_IMAGE_UNLOAD) ( 595 ACPI_EFI_HANDLE ImageHandle); 596 597 598 typedef 599 ACPI_EFI_STATUS 600 (ACPI_EFI_API *ACPI_EFI_STALL) ( 601 UINTN Microseconds); 602 603 typedef 604 ACPI_EFI_STATUS 605 (ACPI_EFI_API *ACPI_EFI_SET_WATCHDOG_TIMER) ( 606 UINTN Timeout, 607 UINT64 WatchdogCode, 608 UINTN DataSize, 609 CHAR16 *WatchdogData); 610 611 612 #define EFI_IMAGE_INFORMATION_REVISION 0x1000 613 typedef struct { 614 UINT32 Revision; 615 ACPI_EFI_HANDLE ParentHandle; 616 struct _ACPI_EFI_SYSTEM_TABLE *SystemTable; 617 ACPI_EFI_HANDLE DeviceHandle; 618 ACPI_EFI_DEVICE_PATH *FilePath; 619 VOID *Reserved; 620 UINT32 LoadOptionsSize; 621 VOID *LoadOptions; 622 VOID *ImageBase; 623 UINT64 ImageSize; 624 ACPI_EFI_MEMORY_TYPE ImageCodeType; 625 ACPI_EFI_MEMORY_TYPE ImageDataType; 626 ACPI_EFI_IMAGE_UNLOAD Unload; 627 628 } ACPI_EFI_LOADED_IMAGE; 629 630 631 /* 632 * EFI Memory 633 */ 634 typedef 635 ACPI_EFI_STATUS 636 (ACPI_EFI_API *ACPI_EFI_ALLOCATE_PAGES) ( 637 ACPI_EFI_ALLOCATE_TYPE Type, 638 ACPI_EFI_MEMORY_TYPE MemoryType, 639 UINTN NoPages, 640 ACPI_EFI_PHYSICAL_ADDRESS *Memory); 641 642 typedef 643 ACPI_EFI_STATUS 644 (ACPI_EFI_API *ACPI_EFI_FREE_PAGES) ( 645 ACPI_EFI_PHYSICAL_ADDRESS Memory, 646 UINTN NoPages); 647 648 typedef 649 ACPI_EFI_STATUS 650 (ACPI_EFI_API *ACPI_EFI_GET_MEMORY_MAP) ( 651 UINTN *MemoryMapSize, 652 ACPI_EFI_MEMORY_DESCRIPTOR *MemoryMap, 653 UINTN *MapKey, 654 UINTN *DescriptorSize, 655 UINT32 *DescriptorVersion); 656 657 #define NextMemoryDescriptor(Ptr,Size) ((ACPI_EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) Ptr) + Size)) 658 659 typedef 660 ACPI_EFI_STATUS 661 (ACPI_EFI_API *ACPI_EFI_ALLOCATE_POOL) ( 662 ACPI_EFI_MEMORY_TYPE PoolType, 663 UINTN Size, 664 VOID **Buffer); 665 666 typedef 667 ACPI_EFI_STATUS 668 (ACPI_EFI_API *ACPI_EFI_FREE_POOL) ( 669 VOID *Buffer); 670 671 672 /* 673 * EFI Time 674 */ 675 typedef struct { 676 UINT32 Resolution; 677 UINT32 Accuracy; 678 BOOLEAN SetsToZero; 679 } ACPI_EFI_TIME_CAPABILITIES; 680 681 typedef 682 ACPI_EFI_STATUS 683 (ACPI_EFI_API *ACPI_EFI_GET_TIME) ( 684 ACPI_EFI_TIME *Time, 685 ACPI_EFI_TIME_CAPABILITIES *Capabilities); 686 687 typedef 688 ACPI_EFI_STATUS 689 (ACPI_EFI_API *ACPI_EFI_SET_TIME) ( 690 ACPI_EFI_TIME *Time); 691 692 693 /* 694 * Protocol handler functions 695 */ 696 typedef enum { 697 ACPI_EFI_NATIVE_INTERFACE, 698 ACPI_EFI_PCODE_INTERFACE 699 } ACPI_EFI_INTERFACE_TYPE; 700 701 typedef enum { 702 AcpiEfiAllHandles, 703 AcpiEfiByRegisterNotify, 704 AcpiEfiByProtocol 705 } ACPI_EFI_LOCATE_SEARCH_TYPE; 706 707 typedef 708 ACPI_EFI_STATUS 709 (ACPI_EFI_API *ACPI_EFI_INSTALL_PROTOCOL_INTERFACE) ( 710 ACPI_EFI_HANDLE *Handle, 711 ACPI_EFI_GUID *Protocol, 712 ACPI_EFI_INTERFACE_TYPE InterfaceType, 713 VOID *Interface); 714 715 typedef 716 ACPI_EFI_STATUS 717 (ACPI_EFI_API *ACPI_EFI_REINSTALL_PROTOCOL_INTERFACE) ( 718 ACPI_EFI_HANDLE Handle, 719 ACPI_EFI_GUID *Protocol, 720 VOID *OldInterface, 721 VOID *NewInterface); 722 723 typedef 724 ACPI_EFI_STATUS 725 (ACPI_EFI_API *ACPI_EFI_UNINSTALL_PROTOCOL_INTERFACE) ( 726 ACPI_EFI_HANDLE Handle, 727 ACPI_EFI_GUID *Protocol, 728 VOID *Interface); 729 730 typedef 731 ACPI_EFI_STATUS 732 (ACPI_EFI_API *ACPI_EFI_HANDLE_PROTOCOL) ( 733 ACPI_EFI_HANDLE Handle, 734 ACPI_EFI_GUID *Protocol, 735 VOID **Interface); 736 737 typedef 738 ACPI_EFI_STATUS 739 (ACPI_EFI_API *ACPI_EFI_REGISTER_PROTOCOL_NOTIFY) ( 740 ACPI_EFI_GUID *Protocol, 741 ACPI_EFI_EVENT Event, 742 VOID **Registration); 743 744 typedef 745 ACPI_EFI_STATUS 746 (ACPI_EFI_API *ACPI_EFI_LOCATE_HANDLE) ( 747 ACPI_EFI_LOCATE_SEARCH_TYPE SearchType, 748 ACPI_EFI_GUID *Protocol, 749 VOID *SearchKey, 750 UINTN *BufferSize, 751 ACPI_EFI_HANDLE *Buffer); 752 753 typedef 754 ACPI_EFI_STATUS 755 (ACPI_EFI_API *ACPI_EFI_LOCATE_DEVICE_PATH) ( 756 ACPI_EFI_GUID *Protocol, 757 ACPI_EFI_DEVICE_PATH **DevicePath, 758 ACPI_EFI_HANDLE *Device); 759 760 typedef 761 ACPI_EFI_STATUS 762 (ACPI_EFI_API *ACPI_EFI_INSTALL_CONFIGURATION_TABLE) ( 763 ACPI_EFI_GUID *Guid, 764 VOID *Table); 765 766 #define ACPI_EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 0x00000001 767 #define ACPI_EFI_OPEN_PROTOCOL_GET_PROTOCOL 0x00000002 768 #define ACPI_EFI_OPEN_PROTOCOL_TEST_PROTOCOL 0x00000004 769 #define ACPI_EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008 770 #define ACPI_EFI_OPEN_PROTOCOL_BY_DRIVER 0x00000010 771 #define ACPI_EFI_OPEN_PROTOCOL_EXCLUSIVE 0x00000020 772 773 typedef 774 ACPI_EFI_STATUS 775 (ACPI_EFI_API *ACPI_EFI_OPEN_PROTOCOL) ( 776 ACPI_EFI_HANDLE Handle, 777 ACPI_EFI_GUID *Protocol, 778 VOID **Interface, 779 ACPI_EFI_HANDLE AgentHandle, 780 ACPI_EFI_HANDLE ControllerHandle, 781 UINT32 Attributes); 782 783 typedef 784 ACPI_EFI_STATUS 785 (ACPI_EFI_API *ACPI_EFI_CLOSE_PROTOCOL) ( 786 ACPI_EFI_HANDLE Handle, 787 ACPI_EFI_GUID *Protocol, 788 ACPI_EFI_HANDLE AgentHandle, 789 ACPI_EFI_HANDLE ControllerHandle); 790 791 typedef struct { 792 ACPI_EFI_HANDLE AgentHandle; 793 ACPI_EFI_HANDLE ControllerHandle; 794 UINT32 Attributes; 795 UINT32 OpenCount; 796 } ACPI_EFI_OPEN_PROTOCOL_INFORMATION_ENTRY; 797 798 typedef 799 ACPI_EFI_STATUS 800 (ACPI_EFI_API *ACPI_EFI_OPEN_PROTOCOL_INFORMATION) ( 801 ACPI_EFI_HANDLE Handle, 802 ACPI_EFI_GUID *Protocol, 803 ACPI_EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer, 804 UINTN *EntryCount); 805 806 typedef 807 ACPI_EFI_STATUS 808 (ACPI_EFI_API *ACPI_EFI_PROTOCOLS_PER_HANDLE) ( 809 ACPI_EFI_HANDLE Handle, 810 ACPI_EFI_GUID ***ProtocolBuffer, 811 UINTN *ProtocolBufferCount); 812 813 typedef 814 ACPI_EFI_STATUS 815 (ACPI_EFI_API *ACPI_EFI_LOCATE_HANDLE_BUFFER) ( 816 ACPI_EFI_LOCATE_SEARCH_TYPE SearchType, 817 ACPI_EFI_GUID *Protocol, 818 VOID *SearchKey, 819 UINTN *NoHandles, 820 ACPI_EFI_HANDLE **Buffer); 821 822 typedef 823 ACPI_EFI_STATUS 824 (ACPI_EFI_API *ACPI_EFI_LOCATE_PROTOCOL) ( 825 ACPI_EFI_GUID *Protocol, 826 VOID *Registration, 827 VOID **Interface); 828 829 typedef 830 ACPI_EFI_STATUS 831 (ACPI_EFI_API *ACPI_EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) ( 832 ACPI_EFI_HANDLE *Handle, 833 ...); 834 835 typedef 836 ACPI_EFI_STATUS 837 (ACPI_EFI_API *ACPI_EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) ( 838 ACPI_EFI_HANDLE Handle, 839 ...); 840 841 typedef 842 ACPI_EFI_STATUS 843 (ACPI_EFI_API *ACPI_EFI_CALCULATE_CRC32) ( 844 VOID *Data, 845 UINTN DataSize, 846 UINT32 *Crc32); 847 848 typedef 849 VOID 850 (ACPI_EFI_API *ACPI_EFI_COPY_MEM) ( 851 VOID *Destination, 852 VOID *Source, 853 UINTN Length); 854 855 typedef 856 VOID 857 (ACPI_EFI_API *ACPI_EFI_SET_MEM) ( 858 VOID *Buffer, 859 UINTN Size, 860 UINT8 Value); 861 862 /* 863 * EFI Boot Services Table 864 */ 865 #define ACPI_EFI_BOOT_SERVICES_SIGNATURE 0x56524553544f4f42 866 #define ACPI_EFI_BOOT_SERVICES_REVISION (ACPI_EFI_SPECIFICATION_MAJOR_REVISION<<16) | (ACPI_EFI_SPECIFICATION_MINOR_REVISION) 867 868 typedef struct _ACPI_EFI_BOOT_SERVICES { 869 ACPI_EFI_TABLE_HEADER Hdr; 870 871 #if 0 872 ACPI_EFI_RAISE_TPL RaiseTPL; 873 ACPI_EFI_RESTORE_TPL RestoreTPL; 874 #else 875 ACPI_EFI_UNKNOWN_INTERFACE RaiseTPL; 876 ACPI_EFI_UNKNOWN_INTERFACE RestoreTPL; 877 #endif 878 879 ACPI_EFI_ALLOCATE_PAGES AllocatePages; 880 ACPI_EFI_FREE_PAGES FreePages; 881 ACPI_EFI_GET_MEMORY_MAP GetMemoryMap; 882 ACPI_EFI_ALLOCATE_POOL AllocatePool; 883 ACPI_EFI_FREE_POOL FreePool; 884 885 #if 0 886 ACPI_EFI_CREATE_EVENT CreateEvent; 887 ACPI_EFI_SET_TIMER SetTimer; 888 ACPI_EFI_WAIT_FOR_EVENT WaitForEvent; 889 ACPI_EFI_SIGNAL_EVENT SignalEvent; 890 ACPI_EFI_CLOSE_EVENT CloseEvent; 891 ACPI_EFI_CHECK_EVENT CheckEvent; 892 #else 893 ACPI_EFI_UNKNOWN_INTERFACE CreateEvent; 894 ACPI_EFI_UNKNOWN_INTERFACE SetTimer; 895 ACPI_EFI_UNKNOWN_INTERFACE WaitForEvent; 896 ACPI_EFI_UNKNOWN_INTERFACE SignalEvent; 897 ACPI_EFI_UNKNOWN_INTERFACE CloseEvent; 898 ACPI_EFI_UNKNOWN_INTERFACE CheckEvent; 899 #endif 900 901 ACPI_EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface; 902 ACPI_EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface; 903 ACPI_EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface; 904 ACPI_EFI_HANDLE_PROTOCOL HandleProtocol; 905 ACPI_EFI_HANDLE_PROTOCOL PCHandleProtocol; 906 ACPI_EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify; 907 ACPI_EFI_LOCATE_HANDLE LocateHandle; 908 ACPI_EFI_LOCATE_DEVICE_PATH LocateDevicePath; 909 ACPI_EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable; 910 911 ACPI_EFI_IMAGE_LOAD LoadImage; 912 ACPI_EFI_IMAGE_START StartImage; 913 ACPI_EFI_EXIT Exit; 914 ACPI_EFI_IMAGE_UNLOAD UnloadImage; 915 916 #if 0 917 ACPI_EFI_EXIT_BOOT_SERVICES ExitBootServices; 918 ACPI_EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount; 919 #else 920 ACPI_EFI_UNKNOWN_INTERFACE ExitBootServices; 921 ACPI_EFI_UNKNOWN_INTERFACE GetNextMonotonicCount; 922 #endif 923 ACPI_EFI_STALL Stall; 924 ACPI_EFI_SET_WATCHDOG_TIMER SetWatchdogTimer; 925 926 #if 0 927 ACPI_EFI_CONNECT_CONTROLLER ConnectController; 928 ACPI_EFI_DISCONNECT_CONTROLLER DisconnectController; 929 #else 930 ACPI_EFI_UNKNOWN_INTERFACE ConnectController; 931 ACPI_EFI_UNKNOWN_INTERFACE DisconnectController; 932 #endif 933 934 ACPI_EFI_OPEN_PROTOCOL OpenProtocol; 935 ACPI_EFI_CLOSE_PROTOCOL CloseProtocol; 936 ACPI_EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation; 937 ACPI_EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle; 938 ACPI_EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer; 939 ACPI_EFI_LOCATE_PROTOCOL LocateProtocol; 940 ACPI_EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces; 941 ACPI_EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces; 942 943 ACPI_EFI_CALCULATE_CRC32 CalculateCrc32; 944 945 ACPI_EFI_COPY_MEM CopyMem; 946 ACPI_EFI_SET_MEM SetMem; 947 948 #if 0 949 ACPI_EFI_CREATE_EVENT_EX CreateEventEx; 950 #else 951 ACPI_EFI_UNKNOWN_INTERFACE CreateEventEx; 952 #endif 953 } ACPI_EFI_BOOT_SERVICES; 954 955 956 /* 957 * EFI Runtime Services Table 958 */ 959 #define ACPI_EFI_RUNTIME_SERVICES_SIGNATURE 0x56524553544e5552 960 #define ACPI_EFI_RUNTIME_SERVICES_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION) 961 962 typedef struct _ACPI_EFI_RUNTIME_SERVICES { 963 ACPI_EFI_TABLE_HEADER Hdr; 964 965 ACPI_EFI_GET_TIME GetTime; 966 ACPI_EFI_SET_TIME SetTime; 967 #if 0 968 ACPI_EFI_GET_WAKEUP_TIME GetWakeupTime; 969 ACPI_EFI_SET_WAKEUP_TIME SetWakeupTime; 970 #else 971 ACPI_EFI_UNKNOWN_INTERFACE GetWakeupTime; 972 ACPI_EFI_UNKNOWN_INTERFACE SetWakeupTime; 973 #endif 974 975 #if 0 976 ACPI_EFI_SET_VIRTUAL_ADDRESS_MAP SetVirtualAddressMap; 977 ACPI_EFI_CONVERT_POINTER ConvertPointer; 978 #else 979 ACPI_EFI_UNKNOWN_INTERFACE SetVirtualAddressMap; 980 ACPI_EFI_UNKNOWN_INTERFACE ConvertPointer; 981 #endif 982 983 #if 0 984 ACPI_EFI_GET_VARIABLE GetVariable; 985 ACPI_EFI_GET_NEXT_VARIABLE_NAME GetNextVariableName; 986 ACPI_EFI_SET_VARIABLE SetVariable; 987 #else 988 ACPI_EFI_UNKNOWN_INTERFACE GetVariable; 989 ACPI_EFI_UNKNOWN_INTERFACE GetNextVariableName; 990 ACPI_EFI_UNKNOWN_INTERFACE SetVariable; 991 #endif 992 993 #if 0 994 ACPI_EFI_GET_NEXT_HIGH_MONO_COUNT GetNextHighMonotonicCount; 995 ACPI_EFI_RESET_SYSTEM ResetSystem; 996 #else 997 ACPI_EFI_UNKNOWN_INTERFACE GetNextHighMonotonicCount; 998 ACPI_EFI_UNKNOWN_INTERFACE ResetSystem; 999 #endif 1000 1001 } ACPI_EFI_RUNTIME_SERVICES; 1002 1003 1004 /* 1005 * EFI System Table 1006 */ 1007 1008 /* 1009 * EFI Configuration Table and GUID definitions 1010 */ 1011 #define ACPI_TABLE_GUID \ 1012 { 0xeb9d2d30, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } 1013 #define ACPI_20_TABLE_GUID \ 1014 { 0x8868e871, 0xe4f1, 0x11d3, {0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} } 1015 1016 typedef struct _ACPI_EFI_CONFIGURATION_TABLE { 1017 ACPI_EFI_GUID VendorGuid; 1018 VOID *VendorTable; 1019 } ACPI_EFI_CONFIGURATION_TABLE; 1020 1021 1022 #define ACPI_EFI_SYSTEM_TABLE_SIGNATURE 0x5453595320494249 1023 #define ACPI_EFI_SYSTEM_TABLE_REVISION (ACPI_EFI_SPECIFICATION_MAJOR_REVISION<<16) | (ACPI_EFI_SPECIFICATION_MINOR_REVISION) 1024 1025 typedef struct _ACPI_EFI_SYSTEM_TABLE { 1026 ACPI_EFI_TABLE_HEADER Hdr; 1027 1028 CHAR16 *FirmwareVendor; 1029 UINT32 FirmwareRevision; 1030 1031 ACPI_EFI_HANDLE ConsoleInHandle; 1032 ACPI_SIMPLE_INPUT_INTERFACE *ConIn; 1033 1034 ACPI_EFI_HANDLE ConsoleOutHandle; 1035 ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *ConOut; 1036 1037 ACPI_EFI_HANDLE StandardErrorHandle; 1038 ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *StdErr; 1039 1040 ACPI_EFI_RUNTIME_SERVICES *RuntimeServices; 1041 ACPI_EFI_BOOT_SERVICES *BootServices; 1042 1043 UINTN NumberOfTableEntries; 1044 ACPI_EFI_CONFIGURATION_TABLE *ConfigurationTable; 1045 1046 } ACPI_EFI_SYSTEM_TABLE; 1047 1048 1049 /* 1050 * EFI PCI I/O Protocol 1051 */ 1052 #define ACPI_EFI_PCI_IO_PROTOCOL \ 1053 { 0x4cf5b200, 0x68b8, 0x4ca5, {0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x2, 0x9a} } 1054 1055 typedef enum { 1056 AcpiEfiPciIoWidthUint8 = 0, 1057 AcpiEfiPciIoWidthUint16, 1058 AcpiEfiPciIoWidthUint32, 1059 AcpiEfiPciIoWidthUint64, 1060 AcpiEfiPciIoWidthFifoUint8, 1061 AcpiEfiPciIoWidthFifoUint16, 1062 AcpiEfiPciIoWidthFifoUint32, 1063 AcpiEfiPciIoWidthFifoUint64, 1064 AcpiEfiPciIoWidthFillUint8, 1065 AcpiEfiPciIoWidthFillUint16, 1066 AcpiEfiPciIoWidthFillUint32, 1067 AcpiEfiPciIoWidthFillUint64, 1068 AcpiEfiPciIoWidthMaximum 1069 } ACPI_EFI_PCI_IO_PROTOCOL_WIDTH; 1070 1071 typedef 1072 ACPI_EFI_STATUS 1073 (ACPI_EFI_API *ACPI_EFI_PCI_IO_PROTOCOL_CONFIG)( 1074 struct _ACPI_EFI_PCI_IO *This, 1075 ACPI_EFI_PCI_IO_PROTOCOL_WIDTH Width, 1076 UINT32 Offset, 1077 UINTN Count, 1078 VOID *Buffer); 1079 1080 typedef struct { 1081 ACPI_EFI_PCI_IO_PROTOCOL_CONFIG Read; 1082 ACPI_EFI_PCI_IO_PROTOCOL_CONFIG Write; 1083 } ACPI_EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS; 1084 1085 typedef 1086 ACPI_EFI_STATUS 1087 (ACPI_EFI_API *ACPI_EFI_PCI_IO_PROTOCOL_GET_LOCATION)( 1088 struct _ACPI_EFI_PCI_IO *This, 1089 UINTN *SegmentNumber, 1090 UINTN *BusNumber, 1091 UINTN *DeviceNumber, 1092 UINTN *FunctionNumber); 1093 1094 typedef struct _ACPI_EFI_PCI_IO { 1095 ACPI_EFI_UNKNOWN_INTERFACE PollMem; 1096 ACPI_EFI_UNKNOWN_INTERFACE PollIo; 1097 ACPI_EFI_UNKNOWN_INTERFACE Mem; 1098 ACPI_EFI_UNKNOWN_INTERFACE Io; 1099 ACPI_EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS Pci; 1100 ACPI_EFI_UNKNOWN_INTERFACE CopyMem; 1101 ACPI_EFI_UNKNOWN_INTERFACE Map; 1102 ACPI_EFI_UNKNOWN_INTERFACE Unmap; 1103 ACPI_EFI_UNKNOWN_INTERFACE AllocateBuffer; 1104 ACPI_EFI_UNKNOWN_INTERFACE FreeBuffer; 1105 ACPI_EFI_UNKNOWN_INTERFACE Flush; 1106 ACPI_EFI_PCI_IO_PROTOCOL_GET_LOCATION GetLocation; 1107 ACPI_EFI_UNKNOWN_INTERFACE Attributes; 1108 ACPI_EFI_UNKNOWN_INTERFACE GetBarAttributes; 1109 ACPI_EFI_UNKNOWN_INTERFACE SetBarAttributes; 1110 UINT64 RomSize; 1111 VOID *RomImage; 1112 } ACPI_EFI_PCI_IO; 1113 1114 /* FILE abstraction */ 1115 1116 union acpi_efi_file { 1117 struct _ACPI_EFI_FILE_HANDLE File; 1118 struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE ConOut; 1119 struct _ACPI_SIMPLE_INPUT_INTERFACE ConIn; 1120 }; 1121 1122 1123 /* EFI definitions */ 1124 1125 #if defined(_GNU_EFI) || defined(_EDK2_EFI) 1126 1127 /* 1128 * This is needed to hide platform specific code from ACPICA 1129 */ 1130 UINT64 ACPI_EFI_API 1131 DivU64x32 ( 1132 UINT64 Dividend, 1133 UINTN Divisor, 1134 UINTN *Remainder); 1135 1136 UINT64 ACPI_EFI_API 1137 MultU64x32 ( 1138 UINT64 Multiplicand, 1139 UINTN Multiplier); 1140 1141 UINT64 ACPI_EFI_API 1142 LShiftU64 ( 1143 UINT64 Operand, 1144 UINTN Count); 1145 1146 UINT64 ACPI_EFI_API 1147 RShiftU64 ( 1148 UINT64 Operand, 1149 UINTN Count); 1150 1151 /* 1152 * EFI specific prototypes 1153 */ 1154 ACPI_EFI_STATUS 1155 efi_main ( 1156 ACPI_EFI_HANDLE Image, 1157 ACPI_EFI_SYSTEM_TABLE *SystemTab); 1158 1159 int 1160 acpi_main ( 1161 int argc, 1162 char *argv[]); 1163 1164 #endif 1165 1166 extern ACPI_EFI_GUID AcpiGbl_LoadedImageProtocol; 1167 extern ACPI_EFI_GUID AcpiGbl_TextInProtocol; 1168 extern ACPI_EFI_GUID AcpiGbl_TextOutProtocol; 1169 extern ACPI_EFI_GUID AcpiGbl_FileSystemProtocol; 1170 extern ACPI_EFI_GUID AcpiGbl_GenericFileInfo; 1171 1172 #endif /* __ACEFIEX_H__ */ 1173