diff options
Diffstat (limited to 'source/include')
| -rw-r--r-- | source/include/acglobal.h | 2 | ||||
| -rw-r--r-- | source/include/acinterp.h | 5 | ||||
| -rw-r--r-- | source/include/aclocal.h | 1 | ||||
| -rw-r--r-- | source/include/acnames.h | 1 | ||||
| -rw-r--r-- | source/include/acnamesp.h | 1 | ||||
| -rw-r--r-- | source/include/acobject.h | 15 | ||||
| -rw-r--r-- | source/include/acoutput.h | 13 | ||||
| -rw-r--r-- | source/include/acpixf.h | 26 | ||||
| -rw-r--r-- | source/include/acstruct.h | 1 | ||||
| -rw-r--r-- | source/include/actbl.h | 1 | ||||
| -rw-r--r-- | source/include/actbl1.h | 14 | ||||
| -rw-r--r-- | source/include/actbl2.h | 87 | ||||
| -rw-r--r-- | source/include/actbl3.h | 39 | ||||
| -rw-r--r-- | source/include/actypes.h | 36 | ||||
| -rw-r--r-- | source/include/acutils.h | 107 | ||||
| -rw-r--r-- | source/include/platform/acefi.h | 174 | ||||
| -rw-r--r-- | source/include/platform/acefiex.h | 855 | ||||
| -rw-r--r-- | source/include/platform/acenv.h | 80 | ||||
| -rw-r--r-- | source/include/platform/acenvex.h | 6 | ||||
| -rw-r--r-- | source/include/platform/acgcc.h | 4 | ||||
| -rw-r--r-- | source/include/platform/acmsvc.h | 8 |
21 files changed, 1309 insertions, 167 deletions
diff --git a/source/include/acglobal.h b/source/include/acglobal.h index ab2fc26b9a18..9e7da94ccf3a 100644 --- a/source/include/acglobal.h +++ b/source/include/acglobal.h @@ -62,6 +62,8 @@ ACPI_GLOBAL (ACPI_TABLE_HEADER, AcpiGbl_OriginalDsdtHeader); #if (!ACPI_REDUCED_HARDWARE) ACPI_GLOBAL (ACPI_TABLE_FACS *, AcpiGbl_FACS); +ACPI_GLOBAL (ACPI_TABLE_FACS *, AcpiGbl_Facs32); +ACPI_GLOBAL (ACPI_TABLE_FACS *, AcpiGbl_Facs64); #endif /* !ACPI_REDUCED_HARDWARE */ diff --git a/source/include/acinterp.h b/source/include/acinterp.h index 66463d6db8f7..00eb8f0d2545 100644 --- a/source/include/acinterp.h +++ b/source/include/acinterp.h @@ -638,6 +638,11 @@ AcpiExIntegerToString ( char *Dest, UINT64 Value); +void +AcpiExPciClsToString ( + char *Dest, + UINT8 ClassCode[3]); + BOOLEAN AcpiIsValidSpaceId ( UINT8 SpaceId); diff --git a/source/include/aclocal.h b/source/include/aclocal.h index 4c96303101ed..dc1afffde35a 100644 --- a/source/include/aclocal.h +++ b/source/include/aclocal.h @@ -238,6 +238,7 @@ typedef struct acpi_table_list #define ACPI_TABLE_INDEX_DSDT (0) #define ACPI_TABLE_INDEX_FACS (1) +#define ACPI_TABLE_INDEX_X_FACS (2) typedef struct acpi_find_context diff --git a/source/include/acnames.h b/source/include/acnames.h index 6bb6bbf9df6a..6887d42c92b7 100644 --- a/source/include/acnames.h +++ b/source/include/acnames.h @@ -51,6 +51,7 @@ #define METHOD_NAME__BBN "_BBN" #define METHOD_NAME__CBA "_CBA" #define METHOD_NAME__CID "_CID" +#define METHOD_NAME__CLS "_CLS" #define METHOD_NAME__CRS "_CRS" #define METHOD_NAME__DDN "_DDN" #define METHOD_NAME__HID "_HID" diff --git a/source/include/acnamesp.h b/source/include/acnamesp.h index 07e76b596649..786fd293688f 100644 --- a/source/include/acnamesp.h +++ b/source/include/acnamesp.h @@ -67,6 +67,7 @@ #define ACPI_NS_PREFIX_IS_SCOPE 0x10 #define ACPI_NS_EXTERNAL 0x20 #define ACPI_NS_TEMPORARY 0x40 +#define ACPI_NS_OVERRIDE_IF_FOUND 0x80 /* Flags for AcpiNsWalkNamespace */ diff --git a/source/include/acobject.h b/source/include/acobject.h index b7b624b70302..481eb449bbd3 100644 --- a/source/include/acobject.h +++ b/source/include/acobject.h @@ -430,13 +430,14 @@ typedef struct acpi_object_addr_handler typedef struct acpi_object_reference { ACPI_OBJECT_COMMON_HEADER - UINT8 Class; /* Reference Class */ - UINT8 TargetType; /* Used for Index Op */ - UINT8 Reserved; - void *Object; /* NameOp=>HANDLE to obj, IndexOp=>ACPI_OPERAND_OBJECT */ - ACPI_NAMESPACE_NODE *Node; /* RefOf or Namepath */ - union acpi_operand_object **Where; /* Target of Index */ - UINT32 Value; /* Used for Local/Arg/Index/DdbHandle */ + UINT8 Class; /* Reference Class */ + UINT8 TargetType; /* Used for Index Op */ + UINT8 Reserved; + void *Object; /* NameOp=>HANDLE to obj, IndexOp=>ACPI_OPERAND_OBJECT */ + ACPI_NAMESPACE_NODE *Node; /* RefOf or Namepath */ + union acpi_operand_object **Where; /* Target of Index */ + UINT8 *IndexPointer; /* Used for Buffers and Strings */ + UINT32 Value; /* Used for Local/Arg/Index/DdbHandle */ } ACPI_OBJECT_REFERENCE; diff --git a/source/include/acoutput.h b/source/include/acoutput.h index ab078091839f..0ef98eb4494d 100644 --- a/source/include/acoutput.h +++ b/source/include/acoutput.h @@ -298,8 +298,12 @@ /* DEBUG_PRINT functions */ -#define ACPI_DEBUG_PRINT(plist) ACPI_ACTUAL_DEBUG plist -#define ACPI_DEBUG_PRINT_RAW(plist) ACPI_ACTUAL_DEBUG_RAW plist +#ifndef COMPILER_VA_MACRO + +#define ACPI_DEBUG_PRINT(plist) AcpiDebugPrint plist +#define ACPI_DEBUG_PRINT_RAW(plist) AcpiDebugPrintRaw plist + +#else /* Helper macros for DEBUG_PRINT */ @@ -319,6 +323,11 @@ ACPI_DO_DEBUG_PRINT (AcpiDebugPrintRaw, Level, Line, \ Filename, Modulename, Component, __VA_ARGS__) +#define ACPI_DEBUG_PRINT(plist) ACPI_ACTUAL_DEBUG plist +#define ACPI_DEBUG_PRINT_RAW(plist) ACPI_ACTUAL_DEBUG_RAW plist + +#endif + /* * Function entry tracing diff --git a/source/include/acpixf.h b/source/include/acpixf.h index e9180b32032d..ab640f3a3261 100644 --- a/source/include/acpixf.h +++ b/source/include/acpixf.h @@ -46,7 +46,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20150515 +#define ACPI_CA_VERSION 0x20150616 #include "acconfig.h" #include "actypes.h" @@ -202,6 +202,15 @@ ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DoNotUseXsdt, FALSE); ACPI_INIT_GLOBAL (UINT8, AcpiGbl_Use32BitFadtAddresses, FALSE); /* + * Optionally use 32-bit FACS table addresses. + * It is reported that some platforms fail to resume from system suspending + * if 64-bit FACS table address is selected: + * https://bugzilla.kernel.org/show_bug.cgi?id=74021 + * Default is TRUE, favor the 32-bit addresses. + */ +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_Use32BitFacsAddresses, TRUE); + +/* * Optionally truncate I/O addresses to 16 bits. Provides compatibility * with other ACPI implementations. NOTE: During ACPICA initialization, * this value is set to TRUE if any Windows OSI strings have been @@ -222,6 +231,11 @@ ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DisableAutoRepair, FALSE); ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DisableSsdtTableInstall, FALSE); /* + * Optionally enable runtime namespace override. + */ +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_RuntimeNamespaceOverride, TRUE); + +/* * We keep track of the latest version of Windows that has been requested by * the BIOS. ACPI 5.0. */ @@ -1066,14 +1080,8 @@ AcpiLeaveSleepState ( ACPI_HW_DEPENDENT_RETURN_STATUS ( ACPI_STATUS AcpiSetFirmwareWakingVector ( - UINT32 PhysicalAddress)) - -#if ACPI_MACHINE_WIDTH == 64 -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiSetFirmwareWakingVector64 ( - UINT64 PhysicalAddress)) -#endif + ACPI_PHYSICAL_ADDRESS PhysicalAddress, + ACPI_PHYSICAL_ADDRESS PhysicalAddress64)) /* diff --git a/source/include/acstruct.h b/source/include/acstruct.h index 547921b34b40..3a6faa6bf06b 100644 --- a/source/include/acstruct.h +++ b/source/include/acstruct.h @@ -85,6 +85,7 @@ typedef struct acpi_walk_state UINT8 ReturnUsed; UINT8 ScopeDepth; UINT8 PassNumber; /* Parse pass during table load */ + BOOLEAN NamespaceOverride; /* Override existing objects */ UINT8 ResultSize; /* Total elements for the result stack */ UINT8 ResultCount; /* Current number of occupied elements of result stack */ UINT32 AmlOffset; diff --git a/source/include/actbl.h b/source/include/actbl.h index 28421950ca37..a1fc7bf80ae1 100644 --- a/source/include/actbl.h +++ b/source/include/actbl.h @@ -67,6 +67,7 @@ #define ACPI_SIG_DSDT "DSDT" /* Differentiated System Description Table */ #define ACPI_SIG_FADT "FACP" /* Fixed ACPI Description Table */ #define ACPI_SIG_FACS "FACS" /* Firmware ACPI Control Structure */ +#define ACPI_SIG_OSDT "OSDT" /* Override System Description Table */ #define ACPI_SIG_PSDT "PSDT" /* Persistent System Description Table */ #define ACPI_SIG_RSDP "RSD PTR " /* Root System Description Pointer */ #define ACPI_SIG_RSDT "RSDT" /* Root System Description Table */ diff --git a/source/include/actbl1.h b/source/include/actbl1.h index 962324add5e1..3a11553297dc 100644 --- a/source/include/actbl1.h +++ b/source/include/actbl1.h @@ -974,10 +974,22 @@ typedef struct acpi_madt_generic_distributor UINT64 BaseAddress; UINT32 GlobalIrqBase; UINT8 Version; - UINT8 Reserved2[3]; /* Reserved - must be zero */ + UINT8 Reserved2[3]; /* Reserved - must be zero */ } ACPI_MADT_GENERIC_DISTRIBUTOR; +/* Values for Version field above */ + +enum AcpiMadtGicVersion +{ + ACPI_MADT_GIC_VERSION_NONE = 0, + ACPI_MADT_GIC_VERSION_V1 = 1, + ACPI_MADT_GIC_VERSION_V2 = 2, + ACPI_MADT_GIC_VERSION_V3 = 3, + ACPI_MADT_GIC_VERSION_V4 = 4, + ACPI_MADT_GIC_VERSION_RESERVED = 5 /* 5 and greater are reserved */ +}; + /* 13: Generic MSI Frame (ACPI 5.1) */ diff --git a/source/include/actbl2.h b/source/include/actbl2.h index 6f0c62ee78e8..02a3cb0dceff 100644 --- a/source/include/actbl2.h +++ b/source/include/actbl2.h @@ -52,8 +52,8 @@ * These tables are not consumed directly by the ACPICA subsystem, but are * included here to support device drivers and the AML disassembler. * - * The tables in this file are defined by third-party specifications, and are - * not defined directly by the ACPI specification itself. + * Generally, the tables in this file are defined by third-party specifications, + * and are not defined directly by the ACPI specification itself. * ******************************************************************************/ @@ -82,6 +82,7 @@ #define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */ #define ACPI_SIG_SPMI "SPMI" /* Server Platform Management Interface table */ #define ACPI_SIG_TCPA "TCPA" /* Trusted Computing Platform Alliance table */ +#define ACPI_SIG_TPM2 "TPM2" /* Trusted Platform Module 2.0 H/W interface table */ #define ACPI_SIG_UEFI "UEFI" /* Uefi Boot Optimization Table */ #define ACPI_SIG_VRTC "VRTC" /* Virtual Real Time Clock Table */ #define ACPI_SIG_WAET "WAET" /* Windows ACPI Emulated devices Table */ @@ -1368,21 +1369,91 @@ enum AcpiSpmiInterfaceTypes /******************************************************************************* * * TCPA - Trusted Computing Platform Alliance table - * Version 1 + * Version 2 + * + * Conforms to "TCG ACPI Specification, Family 1.2 and 2.0", + * December 19, 2014 * - * Conforms to "TCG PC Specific Implementation Specification", - * Version 1.1, August 18, 2003 + * NOTE: There are two versions of the table with the same signature -- + * the client version and the server version. * ******************************************************************************/ -typedef struct acpi_table_tcpa +typedef struct acpi_table_tcpa_client +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT16 PlatformClass; + UINT32 MinimumLogLength; /* Minimum length for the event log area */ + UINT64 LogAddress; /* Address of the event log area */ + +} ACPI_TABLE_TCPA_CLIENT; + +typedef struct acpi_table_tcpa_server { ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT16 PlatformClass; UINT16 Reserved; - UINT32 MaxLogLength; /* Maximum length for the event log area */ + UINT64 MinimumLogLength; /* Minimum length for the event log area */ UINT64 LogAddress; /* Address of the event log area */ + UINT16 SpecRevision; + UINT8 DeviceFlags; + UINT8 InterruptFlags; + UINT8 GpeNumber; + UINT8 Reserved2[3]; + UINT32 GlobalInterrupt; + ACPI_GENERIC_ADDRESS Address; + UINT32 Reserved3; + ACPI_GENERIC_ADDRESS ConfigAddress; + UINT8 Group; + UINT8 Bus; /* PCI Bus/Segment/Function numbers */ + UINT8 Device; + UINT8 Function; + +} ACPI_TABLE_TCPA_SERVER; + +/* Values for DeviceFlags above */ + +#define ACPI_TCPA_PCI_DEVICE (1) +#define ACPI_TCPA_BUS_PNP (1<<1) +#define ACPI_TCPA_ADDRESS_VALID (1<<2) + +/* Values for InterruptFlags above */ + +#define ACPI_TCPA_INTERRUPT_MODE (1) +#define ACPI_TCPA_INTERRUPT_POLARITY (1<<1) +#define ACPI_TCPA_SCI_VIA_GPE (1<<2) +#define ACPI_TCPA_GLOBAL_INTERRUPT (1<<3) + + +/******************************************************************************* + * + * TPM2 - Trusted Platform Module (TPM) 2.0 Hardware Interface Table + * Version 4 + * + * Conforms to "TCG ACPI Specification, Family 1.2 and 2.0", + * December 19, 2014 + * + ******************************************************************************/ + +typedef struct acpi_table_tpm2 +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT16 PlatformClass; + UINT16 Reserved; + UINT64 ControlAddress; + UINT32 StartMethod; + + /* Platform-specific data follows */ + +} ACPI_TABLE_TPM2; + +/* Values for StartMethod above */ -} ACPI_TABLE_TCPA; +#define ACPI_TPM2_NOT_ALLOWED 0 +#define ACPI_TPM2_START_METHOD 2 +#define ACPI_TPM2_MEMORY_MAPPED 6 +#define ACPI_TPM2_COMMAND_BUFFER 7 +#define ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD 8 /******************************************************************************* diff --git a/source/include/actbl3.h b/source/include/actbl3.h index f575d086b55c..7da6bc68daee 100644 --- a/source/include/actbl3.h +++ b/source/include/actbl3.h @@ -52,7 +52,8 @@ * These tables are not consumed directly by the ACPICA subsystem, but are * included here to support device drivers and the AML disassembler. * - * The tables in this file are fully defined within the ACPI specification. + * In general, the tables in this file are fully defined within the ACPI + * specification. * ******************************************************************************/ @@ -71,7 +72,6 @@ #define ACPI_SIG_PMTT "PMTT" /* Platform Memory Topology Table */ #define ACPI_SIG_RASF "RASF" /* RAS Feature table */ #define ACPI_SIG_STAO "STAO" /* Status Override table */ -#define ACPI_SIG_TPM2 "TPM2" /* Trusted Platform Module 2.0 H/W interface table */ #define ACPI_SIG_WPBT "WPBT" /* Windows Platform Binary Table */ #define ACPI_SIG_XENV "XENV" /* Xen Environment table */ @@ -848,41 +848,6 @@ typedef struct acpi_table_stao /******************************************************************************* * - * TPM2 - Trusted Platform Module (TPM) 2.0 Hardware Interface Table - * Version 3 - * - * Conforms to "TPM 2.0 Hardware Interface Table (TPM2)" 29 November 2011 - * - ******************************************************************************/ - -typedef struct acpi_table_tpm2 -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 Flags; - UINT64 ControlAddress; - UINT32 StartMethod; - -} ACPI_TABLE_TPM2; - -/* Control area structure (not part of table, pointed to by ControlAddress) */ - -typedef struct acpi_tpm2_control -{ - UINT32 Reserved; - UINT32 Error; - UINT32 Cancel; - UINT32 Start; - UINT64 InterruptControl; - UINT32 CommandSize; - UINT64 CommandAddress; - UINT32 ResponseSize; - UINT64 ResponseAddress; - -} ACPI_TPM2_CONTROL; - - -/******************************************************************************* - * * WPBT - Windows Platform Environment Table (ACPI 6.0) * Version 1 * diff --git a/source/include/actypes.h b/source/include/actypes.h index 0bee2a771b9d..ad00713139e9 100644 --- a/source/include/actypes.h +++ b/source/include/actypes.h @@ -555,14 +555,14 @@ typedef UINT64 ACPI_INTEGER; #define ACPI_COMPARE_NAME(a,b) (*ACPI_CAST_PTR (UINT32, (a)) == *ACPI_CAST_PTR (UINT32, (b))) #define ACPI_MOVE_NAME(dest,src) (*ACPI_CAST_PTR (UINT32, (dest)) = *ACPI_CAST_PTR (UINT32, (src))) #else -#define ACPI_COMPARE_NAME(a,b) (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE)) -#define ACPI_MOVE_NAME(dest,src) (ACPI_STRNCPY (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAME_SIZE)) +#define ACPI_COMPARE_NAME(a,b) (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE)) +#define ACPI_MOVE_NAME(dest,src) (strncpy (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAME_SIZE)) #endif /* Support for the special RSDP signature (8 characters) */ -#define ACPI_VALIDATE_RSDP_SIG(a) (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, 8)) -#define ACPI_MAKE_RSDP_SIG(dest) (ACPI_MEMCPY (ACPI_CAST_PTR (char, (dest)), ACPI_SIG_RSDP, 8)) +#define ACPI_VALIDATE_RSDP_SIG(a) (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, 8)) +#define ACPI_MAKE_RSDP_SIG(dest) (memcpy (ACPI_CAST_PTR (char, (dest)), ACPI_SIG_RSDP, 8)) /******************************************************************************* @@ -767,10 +767,6 @@ typedef UINT32 ACPI_EVENT_STATUS; #define ACPI_GPE_ENABLE 0 #define ACPI_GPE_DISABLE 1 #define ACPI_GPE_CONDITIONAL_ENABLE 2 -#define ACPI_GPE_SAVE_MASK 4 - -#define ACPI_GPE_ENABLE_SAVE (ACPI_GPE_ENABLE | ACPI_GPE_SAVE_MASK) -#define ACPI_GPE_DISABLE_SAVE (ACPI_GPE_DISABLE | ACPI_GPE_SAVE_MASK) /* * GPE info flags - Per GPE @@ -1227,6 +1223,10 @@ UINT32 (*ACPI_INTERFACE_HANDLER) ( #define ACPI_UUID_LENGTH 16 +/* Length of 3-byte PCI class code values when converted back to a string */ + +#define ACPI_PCICLS_STRING_SIZE 7 /* Includes null terminator */ + /* Structures used for device/processor HID, UID, CID, and SUB */ @@ -1255,7 +1255,7 @@ typedef struct acpi_device_info UINT32 Name; /* ACPI object Name */ ACPI_OBJECT_TYPE Type; /* ACPI object Type */ UINT8 ParamCount; /* If a method, required parameter count */ - UINT8 Valid; /* Indicates which optional fields are valid */ + UINT16 Valid; /* Indicates which optional fields are valid */ UINT8 Flags; /* Miscellaneous info */ UINT8 HighestDstates[4]; /* _SxD values: 0xFF indicates not valid */ UINT8 LowestDstates[5]; /* _SxW values: 0xFF indicates not valid */ @@ -1264,6 +1264,7 @@ typedef struct acpi_device_info ACPI_PNP_DEVICE_ID HardwareId; /* _HID value */ ACPI_PNP_DEVICE_ID UniqueId; /* _UID value */ ACPI_PNP_DEVICE_ID SubsystemId; /* _SUB value */ + ACPI_PNP_DEVICE_ID ClassCode; /* _CLS value */ ACPI_PNP_DEVICE_ID_LIST CompatibleIdList; /* _CID list <must be last> */ } ACPI_DEVICE_INFO; @@ -1274,14 +1275,15 @@ typedef struct acpi_device_info /* Flags for Valid field above (AcpiGetObjectInfo) */ -#define ACPI_VALID_STA 0x01 -#define ACPI_VALID_ADR 0x02 -#define ACPI_VALID_HID 0x04 -#define ACPI_VALID_UID 0x08 -#define ACPI_VALID_SUB 0x10 -#define ACPI_VALID_CID 0x20 -#define ACPI_VALID_SXDS 0x40 -#define ACPI_VALID_SXWS 0x80 +#define ACPI_VALID_STA 0x0001 +#define ACPI_VALID_ADR 0x0002 +#define ACPI_VALID_HID 0x0004 +#define ACPI_VALID_UID 0x0008 +#define ACPI_VALID_SUB 0x0010 +#define ACPI_VALID_CID 0x0020 +#define ACPI_VALID_CLS 0x0040 +#define ACPI_VALID_SXDS 0x0100 +#define ACPI_VALID_SXWS 0x0200 /* Flags for _STA return value (CurrentStatus above) */ diff --git a/source/include/acutils.h b/source/include/acutils.h index 1be82c75999b..4f4a13efd7ff 100644 --- a/source/include/acutils.h +++ b/source/include/acutils.h @@ -251,85 +251,113 @@ AcpiUtSubsystemShutdown ( */ #ifndef ACPI_USE_SYSTEM_CLIBRARY +#ifdef memcmp +#error memcmp defined! +#endif + +#undef strstr +#undef strchr +#undef strlen +#undef strcpy +#undef strncpy +#undef strncmp +#undef strcmp +#undef strcat +#undef strncat +#undef strtoul +#undef memcmp +#undef memcpy +#undef memset +#undef toupper +#undef tolower +#undef isxdigit +#undef isdigit +#undef isspace +#undef isupper +#undef isprint +#undef isalpha + ACPI_SIZE -AcpiUtStrlen ( +strlen ( const char *String); char * -AcpiUtStrchr ( +strchr ( const char *String, int ch); char * -AcpiUtStrcpy ( +strcpy ( char *DstString, const char *SrcString); char * -AcpiUtStrncpy ( +strncpy ( char *DstString, const char *SrcString, ACPI_SIZE Count); int -AcpiUtMemcmp ( - const char *Buffer1, - const char *Buffer2, - ACPI_SIZE Count); - -int -AcpiUtStrncmp ( +strncmp ( const char *String1, const char *String2, ACPI_SIZE Count); int -AcpiUtStrcmp ( +strcmp ( const char *String1, const char *String2); char * -AcpiUtStrcat ( +strcat ( char *DstString, const char *SrcString); char * -AcpiUtStrncat ( +strncat ( char *DstString, const char *SrcString, ACPI_SIZE Count); UINT32 -AcpiUtStrtoul ( +strtoul ( const char *String, char **Terminator, UINT32 Base); char * -AcpiUtStrstr ( +strstr ( char *String1, char *String2); +int +memcmp ( + void *Buffer1, + void *Buffer2, + ACPI_SIZE Count); + void * -AcpiUtMemcpy ( +memcpy ( void *Dest, const void *Src, ACPI_SIZE Count); void * -AcpiUtMemset ( +memset ( void *Dest, - UINT8 Value, + int Value, ACPI_SIZE Count); int -AcpiUtToUpper ( +toupper ( int c); int -AcpiUtToLower ( +tolower ( int c); + + extern const UINT8 _acpi_ctype[]; #define _ACPI_XA 0x00 /* extra alphabetic - not supported */ @@ -343,13 +371,31 @@ extern const UINT8 _acpi_ctype[]; #define _ACPI_UP 0x01 /* 'A'-'Z' */ #define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */ -#define ACPI_IS_DIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI)) -#define ACPI_IS_SPACE(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP)) -#define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD)) -#define ACPI_IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP)) -#define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO)) -#define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_XS | _ACPI_PU)) -#define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP)) +#define isdigit(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI)) +#define isspace(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP)) +#define isxdigit(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD)) +#define isupper(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP)) +#define islower(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO)) +#define isprint(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_XS | _ACPI_PU)) +#define isalpha(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP)) + +#ifndef ACPI_CLIBRARY +#define strstr(s1,s2) strstr ((s1), (s2)) +#define strchr(s1,c) strchr ((s1), (c)) +#define strlen(s) (ACPI_SIZE) strlen ((s)) +#define strcpy(d,s) (void) strcpy ((d), (s)) +#define strncpy(d,s,n) (void) strncpy ((d), (s), (ACPI_SIZE)(n)) +#define strncmp(d,s,n) strncmp ((d), (s), (ACPI_SIZE)(n)) +#define strcmp(d,s) strcmp ((d), (s)) +#define strcat(d,s) (void) strcat ((d), (s)) +#define strncat(d,s,n) strncat ((d), (s), (ACPI_SIZE)(n)) +#define strtoul(d,s,n) strtoul ((d), (s), (ACPI_SIZE)(n)) +#define memcmp(s1,s2,n) memcmp((void *)(s1), (void *)(s2), (ACPI_SIZE)(n)) +#define memcpy(d,s,n) (void) memcpy ((d), (s), (ACPI_SIZE)(n)) +#define memset(d,v,n) (void) memset ((d), (v), (ACPI_SIZE)(n)) +#define toupper(c) toupper ((int) (c)) +#define tolower(c) tolower ((int) (c)) +#endif /* ACPI_CLIBRARY */ #endif /* !ACPI_USE_SYSTEM_CLIBRARY */ @@ -602,6 +648,11 @@ AcpiUtExecute_CID ( ACPI_NAMESPACE_NODE *DeviceNode, ACPI_PNP_DEVICE_ID_LIST **ReturnCidList); +ACPI_STATUS +AcpiUtExecute_CLS ( + ACPI_NAMESPACE_NODE *DeviceNode, + ACPI_PNP_DEVICE_ID **ReturnId); + /* * utlock - reader/writer locks diff --git a/source/include/platform/acefi.h b/source/include/platform/acefi.h index ae39dc759dac..c19ce01586a8 100644 --- a/source/include/platform/acefi.h +++ b/source/include/platform/acefi.h @@ -49,10 +49,150 @@ #include <stdint.h> #include <unistd.h> #endif -#include <efi.h> -#include <efistdarg.h> -#include <efilib.h> +#if defined(__x86_64__) +#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) +#define USE_MS_ABI 1 +#endif +#endif + +#ifdef _MSC_EXTENSIONS +#define EFIAPI __cdecl +#elif USE_MS_ABI +#define EFIAPI __attribute__((ms_abi)) +#else +#define EFIAPI +#endif + +typedef uint8_t UINT8; +typedef uint16_t UINT16; +typedef int16_t INT16; +typedef uint32_t UINT32; +typedef int32_t INT32; +typedef uint64_t UINT64; +typedef int64_t INT64; +typedef uint8_t BOOLEAN; +typedef uint16_t CHAR16; + +#define VOID void + +#if defined(__ia64__) || defined(__x86_64__) + +#define ACPI_MACHINE_WIDTH 64 + +#if defined(__x86_64__) + +/* for x86_64, EFI_FUNCTION_WRAPPER must be defined */ + +#ifndef USE_MS_ABI +#define USE_EFI_FUNCTION_WRAPPER +#endif + +#ifdef _MSC_EXTENSIONS +#pragma warning ( disable : 4731 ) // Suppress warnings about modification of EBP +#endif + +#endif + +typedef uint64_t UINTN; +typedef int64_t INTN; + +#define EFIERR(a) (0x8000000000000000 | a) + +#else + +#define ACPI_MACHINE_WIDTH 32 +#define ACPI_USE_NATIVE_DIVIDE + +typedef uint32_t UINTN; +typedef int32_t INTN; + +#define EFIERR(a) (0x80000000 | a) + +#endif + + +#ifdef USE_EFI_FUNCTION_WRAPPER +#define __VA_NARG__(...) \ + __VA_NARG_(_0, ## __VA_ARGS__, __RSEQ_N()) +#define __VA_NARG_(...) \ + __VA_ARG_N(__VA_ARGS__) +#define __VA_ARG_N( \ + _0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,N,...) N +#define __RSEQ_N() \ + 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 + +#define __VA_ARG_NSUFFIX__(prefix,...) \ + __VA_ARG_NSUFFIX_N(prefix, __VA_NARG__(__VA_ARGS__)) +#define __VA_ARG_NSUFFIX_N(prefix,nargs) \ + __VA_ARG_NSUFFIX_N_(prefix, nargs) +#define __VA_ARG_NSUFFIX_N_(prefix,nargs) \ + prefix ## nargs + +/* Prototypes of EFI cdecl -> stdcall trampolines */ +UINT64 efi_call0(void *func); +UINT64 efi_call1(void *func, UINT64 arg1); +UINT64 efi_call2(void *func, UINT64 arg1, UINT64 arg2); +UINT64 efi_call3(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3); +UINT64 efi_call4(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3, + UINT64 arg4); +UINT64 efi_call5(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3, + UINT64 arg4, UINT64 arg5); +UINT64 efi_call6(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3, + UINT64 arg4, UINT64 arg5, UINT64 arg6); +UINT64 efi_call7(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3, + UINT64 arg4, UINT64 arg5, UINT64 arg6, UINT64 arg7); +UINT64 efi_call8(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3, + UINT64 arg4, UINT64 arg5, UINT64 arg6, UINT64 arg7, + UINT64 arg8); +UINT64 efi_call9(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3, + UINT64 arg4, UINT64 arg5, UINT64 arg6, UINT64 arg7, + UINT64 arg8, UINT64 arg9); +UINT64 efi_call10(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3, + UINT64 arg4, UINT64 arg5, UINT64 arg6, UINT64 arg7, + UINT64 arg8, UINT64 arg9, UINT64 arg10); + +/* Front-ends to efi_callX to avoid compiler warnings */ +#define _cast64_efi_call0(f) \ + efi_call0(f) +#define _cast64_efi_call1(f,a1) \ + efi_call1(f, (UINT64)(a1)) +#define _cast64_efi_call2(f,a1,a2) \ + efi_call2(f, (UINT64)(a1), (UINT64)(a2)) +#define _cast64_efi_call3(f,a1,a2,a3) \ + efi_call3(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3)) +#define _cast64_efi_call4(f,a1,a2,a3,a4) \ + efi_call4(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4)) +#define _cast64_efi_call5(f,a1,a2,a3,a4,a5) \ + efi_call5(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4), \ + (UINT64)(a5)) +#define _cast64_efi_call6(f,a1,a2,a3,a4,a5,a6) \ + efi_call6(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4), \ + (UINT64)(a5), (UINT64)(a6)) +#define _cast64_efi_call7(f,a1,a2,a3,a4,a5,a6,a7) \ + efi_call7(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4), \ + (UINT64)(a5), (UINT64)(a6), (UINT64)(a7)) +#define _cast64_efi_call8(f,a1,a2,a3,a4,a5,a6,a7,a8) \ + efi_call8(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4), \ + (UINT64)(a5), (UINT64)(a6), (UINT64)(a7), (UINT64)(a8)) +#define _cast64_efi_call9(f,a1,a2,a3,a4,a5,a6,a7,a8,a9) \ + efi_call9(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4), \ + (UINT64)(a5), (UINT64)(a6), (UINT64)(a7), (UINT64)(a8), \ + (UINT64)(a9)) +#define _cast64_efi_call10(f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) \ + efi_call10(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4), \ + (UINT64)(a5), (UINT64)(a6), (UINT64)(a7), (UINT64)(a8), \ + (UINT64)(a9), (UINT64)(a10)) + +/* main wrapper (va_num ignored) */ +#define uefi_call_wrapper(func,va_num,...) \ + __VA_ARG_NSUFFIX__(_cast64_efi_call, __VA_ARGS__) (func , ##__VA_ARGS__) + +#else + +#define uefi_call_wrapper(func, va_num, ...) func(__VA_ARGS__) + +#endif /* AED EFI definitions */ @@ -96,10 +236,6 @@ #undef ACPI_USE_NATIVE_DIVIDE #define ACPI_USE_SYSTEM_INTTYPES -#define ACPI_FILE SIMPLE_TEXT_OUTPUT_INTERFACE * -#define ACPI_FILE_OUT ST->ConOut -#define ACPI_FILE_ERR ST->ConOut - /* * Math helpers */ @@ -116,21 +252,21 @@ (n_hi) >>= 1; \ } while (0) -/* - * EFI specific prototypes - */ -EFI_STATUS -efi_main ( - EFI_HANDLE Image, - EFI_SYSTEM_TABLE *SystemTab); -int -acpi_main ( - int argc, - char *argv[]); +#endif +struct _SIMPLE_TEXT_OUTPUT_INTERFACE; +struct _SIMPLE_INPUT_INTERFACE; +struct _EFI_FILE_IO_INTERFACE; +struct _EFI_FILE_HANDLE; +struct _EFI_BOOT_SERVICES; +struct _EFI_SYSTEM_TABLE; -#endif +extern struct _EFI_SYSTEM_TABLE *ST; +extern struct _EFI_BOOT_SERVICES *BS; +#define ACPI_FILE struct _SIMPLE_TEXT_OUTPUT_INTERFACE * +#define ACPI_FILE_OUT ST->ConOut +#define ACPI_FILE_ERR ST->ConOut #endif /* __ACEFI_H__ */ diff --git a/source/include/platform/acefiex.h b/source/include/platform/acefiex.h new file mode 100644 index 000000000000..1eb1e573a428 --- /dev/null +++ b/source/include/platform/acefiex.h @@ -0,0 +1,855 @@ +/****************************************************************************** + * + * Name: acefiex.h - Extra OS specific defines, etc. for EFI + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2015, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef __ACEFIEX_H__ +#define __ACEFIEX_H__ + + +#define EFI_ERROR(a) (((INTN) a) < 0) +#define EFI_SUCCESS 0 +#define EFI_LOAD_ERROR EFIERR(1) +#define EFI_INVALID_PARAMETER EFIERR(2) +#define EFI_UNSUPPORTED EFIERR(3) +#define EFI_BAD_BUFFER_SIZE EFIERR(4) +#define EFI_BUFFER_TOO_SMALL EFIERR(5) +#define EFI_NOT_READY EFIERR(6) +#define EFI_DEVICE_ERROR EFIERR(7) +#define EFI_WRITE_PROTECTED EFIERR(8) +#define EFI_OUT_OF_RESOURCES EFIERR(9) +#define EFI_VOLUME_CORRUPTED EFIERR(10) +#define EFI_VOLUME_FULL EFIERR(11) +#define EFI_NO_MEDIA EFIERR(12) +#define EFI_MEDIA_CHANGED EFIERR(13) +#define EFI_NOT_FOUND EFIERR(14) +#define EFI_ACCESS_DENIED EFIERR(15) +#define EFI_NO_RESPONSE EFIERR(16) +#define EFI_NO_MAPPING EFIERR(17) +#define EFI_TIMEOUT EFIERR(18) +#define EFI_NOT_STARTED EFIERR(19) +#define EFI_ALREADY_STARTED EFIERR(20) +#define EFI_ABORTED EFIERR(21) +#define EFI_PROTOCOL_ERROR EFIERR(24) + + +typedef UINTN EFI_STATUS; +typedef VOID *EFI_HANDLE; +typedef VOID *EFI_EVENT; + +typedef struct { + UINT32 Data1; + UINT16 Data2; + UINT16 Data3; + UINT8 Data4[8]; +} EFI_GUID; + +typedef struct _EFI_DEVICE_PATH { + UINT8 Type; + UINT8 SubType; + UINT8 Length[2]; +} EFI_DEVICE_PATH; + +typedef UINT64 EFI_PHYSICAL_ADDRESS; +typedef UINT64 EFI_VIRTUAL_ADDRESS; + +typedef enum { + AllocateAnyPages, + AllocateMaxAddress, + AllocateAddress, + MaxAllocateType +} EFI_ALLOCATE_TYPE; + +typedef enum { + EfiReservedMemoryType, + EfiLoaderCode, + EfiLoaderData, + EfiBootServicesCode, + EfiBootServicesData, + EfiRuntimeServicesCode, + EfiRuntimeServicesData, + EfiConventionalMemory, + EfiUnusableMemory, + EfiACPIReclaimMemory, + EfiACPIMemoryNVS, + EfiMemoryMappedIO, + EfiMemoryMappedIOPortSpace, + EfiPalCode, + EfiMaxMemoryType +} EFI_MEMORY_TYPE; + +/* possible caching types for the memory range */ +#define EFI_MEMORY_UC 0x0000000000000001 +#define EFI_MEMORY_WC 0x0000000000000002 +#define EFI_MEMORY_WT 0x0000000000000004 +#define EFI_MEMORY_WB 0x0000000000000008 +#define EFI_MEMORY_UCE 0x0000000000000010 + +/* physical memory protection on range */ +#define EFI_MEMORY_WP 0x0000000000001000 +#define EFI_MEMORY_RP 0x0000000000002000 +#define EFI_MEMORY_XP 0x0000000000004000 + +/* range requires a runtime mapping */ +#define EFI_MEMORY_RUNTIME 0x8000000000000000 + +#define EFI_MEMORY_DESCRIPTOR_VERSION 1 +typedef struct { + UINT32 Type; + UINT32 Pad; + EFI_PHYSICAL_ADDRESS PhysicalStart; + EFI_VIRTUAL_ADDRESS VirtualStart; + UINT64 NumberOfPages; + UINT64 Attribute; +} EFI_MEMORY_DESCRIPTOR; + +typedef struct _EFI_TABLE_HEARDER { + UINT64 Signature; + UINT32 Revision; + UINT32 HeaderSize; + UINT32 CRC32; + UINT32 Reserved; +} EFI_TABLE_HEADER; + +typedef +EFI_STATUS +(EFIAPI *EFI_UNKNOWN_INTERFACE) ( + void); + + +/* + * Text output protocol + */ +#define SIMPLE_TEXT_OUTPUT_PROTOCOL \ + { 0x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } + +typedef +EFI_STATUS +(EFIAPI *EFI_TEXT_RESET) ( + struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, + BOOLEAN ExtendedVerification); + +typedef +EFI_STATUS +(EFIAPI *EFI_TEXT_OUTPUT_STRING) ( + struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, + CHAR16 *String); + +typedef +EFI_STATUS +(EFIAPI *EFI_TEXT_TEST_STRING) ( + struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, + CHAR16 *String); + +typedef +EFI_STATUS +(EFIAPI *EFI_TEXT_QUERY_MODE) ( + struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, + UINTN ModeNumber, + UINTN *Columns, + UINTN *Rows); + +typedef +EFI_STATUS +(EFIAPI *EFI_TEXT_SET_MODE) ( + struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, + UINTN ModeNumber); + +typedef +EFI_STATUS +(EFIAPI *EFI_TEXT_SET_ATTRIBUTE) ( + struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, + UINTN Attribute); + +typedef +EFI_STATUS +(EFIAPI *EFI_TEXT_CLEAR_SCREEN) ( + struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This); + +typedef +EFI_STATUS +(EFIAPI *EFI_TEXT_SET_CURSOR_POSITION) ( + struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, + UINTN Column, + UINTN Row); + +typedef +EFI_STATUS +(EFIAPI *EFI_TEXT_ENABLE_CURSOR) ( + struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, + BOOLEAN Enable); + +typedef struct { + INT32 MaxMode; + INT32 Mode; + INT32 Attribute; + INT32 CursorColumn; + INT32 CursorRow; + BOOLEAN CursorVisible; +} SIMPLE_TEXT_OUTPUT_MODE; + +typedef struct _SIMPLE_TEXT_OUTPUT_INTERFACE { + EFI_TEXT_RESET Reset; + + EFI_TEXT_OUTPUT_STRING OutputString; + EFI_TEXT_TEST_STRING TestString; + + EFI_TEXT_QUERY_MODE QueryMode; + EFI_TEXT_SET_MODE SetMode; + EFI_TEXT_SET_ATTRIBUTE SetAttribute; + + EFI_TEXT_CLEAR_SCREEN ClearScreen; + EFI_TEXT_SET_CURSOR_POSITION SetCursorPosition; + EFI_TEXT_ENABLE_CURSOR EnableCursor; + + SIMPLE_TEXT_OUTPUT_MODE *Mode; +} SIMPLE_TEXT_OUTPUT_INTERFACE; + +/* + * Text input protocol + */ +#define SIMPLE_TEXT_INPUT_PROTOCOL \ + { 0x387477c1, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } + +typedef struct { + UINT16 ScanCode; + CHAR16 UnicodeChar; +} EFI_INPUT_KEY; + +/* + * Baseline unicode control chars + */ +#define CHAR_NULL 0x0000 +#define CHAR_BACKSPACE 0x0008 +#define CHAR_TAB 0x0009 +#define CHAR_LINEFEED 0x000A +#define CHAR_CARRIAGE_RETURN 0x000D + +typedef +EFI_STATUS +(EFIAPI *EFI_INPUT_RESET) ( + struct _SIMPLE_INPUT_INTERFACE *This, + BOOLEAN ExtendedVerification); + +typedef +EFI_STATUS +(EFIAPI *EFI_INPUT_READ_KEY) ( + struct _SIMPLE_INPUT_INTERFACE *This, + EFI_INPUT_KEY *Key); + +typedef struct _SIMPLE_INPUT_INTERFACE { + EFI_INPUT_RESET Reset; + EFI_INPUT_READ_KEY ReadKeyStroke; + EFI_EVENT WaitForKey; +} SIMPLE_INPUT_INTERFACE; + + +/* + * Simple file system protocol + */ +#define SIMPLE_FILE_SYSTEM_PROTOCOL \ + { 0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } + +typedef +EFI_STATUS +(EFIAPI *EFI_VOLUME_OPEN) ( + struct _EFI_FILE_IO_INTERFACE *This, + struct _EFI_FILE_HANDLE **Root); + +#define EFI_FILE_IO_INTERFACE_REVISION 0x00010000 + +typedef struct _EFI_FILE_IO_INTERFACE { + UINT64 Revision; + EFI_VOLUME_OPEN OpenVolume; +} EFI_FILE_IO_INTERFACE; + +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_OPEN) ( + struct _EFI_FILE_HANDLE *File, + struct _EFI_FILE_HANDLE **NewHandle, + CHAR16 *FileName, + UINT64 OpenMode, + UINT64 Attributes); + +/* Values for OpenMode used above */ + +#define EFI_FILE_MODE_READ 0x0000000000000001 +#define EFI_FILE_MODE_WRITE 0x0000000000000002 +#define EFI_FILE_MODE_CREATE 0x8000000000000000 + +/* Values for Attribute used above */ + +#define EFI_FILE_READ_ONLY 0x0000000000000001 +#define EFI_FILE_HIDDEN 0x0000000000000002 +#define EFI_FILE_SYSTEM 0x0000000000000004 +#define EFI_FILE_RESERVIED 0x0000000000000008 +#define EFI_FILE_DIRECTORY 0x0000000000000010 +#define EFI_FILE_ARCHIVE 0x0000000000000020 +#define EFI_FILE_VALID_ATTR 0x0000000000000037 + +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_CLOSE) ( + struct _EFI_FILE_HANDLE *File); + +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_DELETE) ( + struct _EFI_FILE_HANDLE *File); + +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_READ) ( + struct _EFI_FILE_HANDLE *File, + UINTN *BufferSize, + VOID *Buffer); + +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_WRITE) ( + struct _EFI_FILE_HANDLE *File, + UINTN *BufferSize, + VOID *Buffer); + +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_SET_POSITION) ( + struct _EFI_FILE_HANDLE *File, + UINT64 Position); + +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_GET_POSITION) ( + struct _EFI_FILE_HANDLE *File, + UINT64 *Position); + +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_GET_INFO) ( + struct _EFI_FILE_HANDLE *File, + EFI_GUID *InformationType, + UINTN *BufferSize, + VOID *Buffer); + +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_SET_INFO) ( + struct _EFI_FILE_HANDLE *File, + EFI_GUID *InformationType, + UINTN BufferSize, + VOID *Buffer); + +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_FLUSH) ( + struct _EFI_FILE_HANDLE *File); + + +#define EFI_FILE_HANDLE_REVISION 0x00010000 + +typedef struct _EFI_FILE_HANDLE { + UINT64 Revision; + EFI_FILE_OPEN Open; + EFI_FILE_CLOSE Close; + EFI_FILE_DELETE Delete; + EFI_FILE_READ Read; + EFI_FILE_WRITE Write; + EFI_FILE_GET_POSITION GetPosition; + EFI_FILE_SET_POSITION SetPosition; + EFI_FILE_GET_INFO GetInfo; + EFI_FILE_SET_INFO SetInfo; + EFI_FILE_FLUSH Flush; +} EFI_FILE, *EFI_FILE_HANDLE; + + +/* + * Loaded image protocol + */ +#define LOADED_IMAGE_PROTOCOL \ + { 0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} } + +typedef +EFI_STATUS +(EFIAPI *EFI_IMAGE_ENTRY_POINT) ( + EFI_HANDLE ImageHandle, + struct _EFI_SYSTEM_TABLE *SystemTable); + +typedef +EFI_STATUS +(EFIAPI *EFI_IMAGE_LOAD) ( + BOOLEAN BootPolicy, + EFI_HANDLE ParentImageHandle, + EFI_DEVICE_PATH *FilePath, + VOID *SourceBuffer, + UINTN SourceSize, + EFI_HANDLE *ImageHandle); + +typedef +EFI_STATUS +(EFIAPI *EFI_IMAGE_START) ( + EFI_HANDLE ImageHandle, + UINTN *ExitDataSize, + CHAR16 **ExitData); + +typedef +EFI_STATUS +(EFIAPI *EFI_EXIT) ( + EFI_HANDLE ImageHandle, + EFI_STATUS ExitStatus, + UINTN ExitDataSize, + CHAR16 *ExitData); + +typedef +EFI_STATUS +(EFIAPI *EFI_IMAGE_UNLOAD) ( + EFI_HANDLE ImageHandle); + + +#define EFI_IMAGE_INFORMATION_REVISION 0x1000 +typedef struct { + UINT32 Revision; + EFI_HANDLE ParentHandle; + struct _EFI_SYSTEM_TABLE *SystemTable; + EFI_HANDLE DeviceHandle; + EFI_DEVICE_PATH *FilePath; + VOID *Reserved; + UINT32 LoadOptionsSize; + VOID *LoadOptions; + VOID *ImageBase; + UINT64 ImageSize; + EFI_MEMORY_TYPE ImageCodeType; + EFI_MEMORY_TYPE ImageDataType; + EFI_IMAGE_UNLOAD Unload; + +} EFI_LOADED_IMAGE; + + +/* + * EFI Memory + */ +typedef +EFI_STATUS +(EFIAPI *EFI_ALLOCATE_PAGES) ( + EFI_ALLOCATE_TYPE Type, + EFI_MEMORY_TYPE MemoryType, + UINTN NoPages, + EFI_PHYSICAL_ADDRESS *Memory); + +typedef +EFI_STATUS +(EFIAPI *EFI_FREE_PAGES) ( + EFI_PHYSICAL_ADDRESS Memory, + UINTN NoPages); + +typedef +EFI_STATUS +(EFIAPI *EFI_GET_MEMORY_MAP) ( + UINTN *MemoryMapSize, + EFI_MEMORY_DESCRIPTOR *MemoryMap, + UINTN *MapKey, + UINTN *DescriptorSize, + UINT32 *DescriptorVersion); + +#define NextMemoryDescriptor(Ptr,Size) ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) Ptr) + Size)) + +typedef +EFI_STATUS +(EFIAPI *EFI_ALLOCATE_POOL) ( + EFI_MEMORY_TYPE PoolType, + UINTN Size, + VOID **Buffer); + +typedef +EFI_STATUS +(EFIAPI *EFI_FREE_POOL) ( + VOID *Buffer); + + +/* + * Protocol handler functions + */ +typedef enum { + EFI_NATIVE_INTERFACE, + EFI_PCODE_INTERFACE +} EFI_INTERFACE_TYPE; + +typedef enum { + AllHandles, + ByRegisterNotify, + ByProtocol +} EFI_LOCATE_SEARCH_TYPE; + +typedef +EFI_STATUS +(EFIAPI *EFI_INSTALL_PROTOCOL_INTERFACE) ( + EFI_HANDLE *Handle, + EFI_GUID *Protocol, + EFI_INTERFACE_TYPE InterfaceType, + VOID *Interface); + +typedef +EFI_STATUS +(EFIAPI *EFI_REINSTALL_PROTOCOL_INTERFACE) ( + EFI_HANDLE Handle, + EFI_GUID *Protocol, + VOID *OldInterface, + VOID *NewInterface); + +typedef +EFI_STATUS +(EFIAPI *EFI_UNINSTALL_PROTOCOL_INTERFACE) ( + EFI_HANDLE Handle, + EFI_GUID *Protocol, + VOID *Interface); + +typedef +EFI_STATUS +(EFIAPI *EFI_HANDLE_PROTOCOL) ( + EFI_HANDLE Handle, + EFI_GUID *Protocol, + VOID **Interface); + +typedef +EFI_STATUS +(EFIAPI *EFI_REGISTER_PROTOCOL_NOTIFY) ( + EFI_GUID *Protocol, + EFI_EVENT Event, + VOID **Registration); + +typedef +EFI_STATUS +(EFIAPI *EFI_LOCATE_HANDLE) ( + EFI_LOCATE_SEARCH_TYPE SearchType, + EFI_GUID *Protocol, + VOID *SearchKey, + UINTN *BufferSize, + EFI_HANDLE *Buffer); + +typedef +EFI_STATUS +(EFIAPI *EFI_LOCATE_DEVICE_PATH) ( + EFI_GUID *Protocol, + EFI_DEVICE_PATH **DevicePath, + EFI_HANDLE *Device); + +typedef +EFI_STATUS +(EFIAPI *EFI_INSTALL_CONFIGURATION_TABLE) ( + EFI_GUID *Guid, + VOID *Table); + +#define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 0x00000001 +#define EFI_OPEN_PROTOCOL_GET_PROTOCOL 0x00000002 +#define EFI_OPEN_PROTOCOL_TEST_PROTOCOL 0x00000004 +#define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008 +#define EFI_OPEN_PROTOCOL_BY_DRIVER 0x00000010 +#define EFI_OPEN_PROTOCOL_EXCLUSIVE 0x00000020 + +typedef +EFI_STATUS +(EFIAPI *EFI_OPEN_PROTOCOL) ( + EFI_HANDLE Handle, + EFI_GUID *Protocol, + VOID **Interface, + EFI_HANDLE AgentHandle, + EFI_HANDLE ControllerHandle, + UINT32 Attributes); + +typedef +EFI_STATUS +(EFIAPI *EFI_CLOSE_PROTOCOL) ( + EFI_HANDLE Handle, + EFI_GUID *Protocol, + EFI_HANDLE AgentHandle, + EFI_HANDLE ControllerHandle); + +typedef struct { + EFI_HANDLE AgentHandle; + EFI_HANDLE ControllerHandle; + UINT32 Attributes; + UINT32 OpenCount; +} EFI_OPEN_PROTOCOL_INFORMATION_ENTRY; + +typedef +EFI_STATUS +(EFIAPI *EFI_OPEN_PROTOCOL_INFORMATION) ( + EFI_HANDLE Handle, + EFI_GUID *Protocol, + EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer, + UINTN *EntryCount); + +typedef +EFI_STATUS +(EFIAPI *EFI_PROTOCOLS_PER_HANDLE) ( + EFI_HANDLE Handle, + EFI_GUID ***ProtocolBuffer, + UINTN *ProtocolBufferCount); + +typedef +EFI_STATUS +(EFIAPI *EFI_LOCATE_HANDLE_BUFFER) ( + EFI_LOCATE_SEARCH_TYPE SearchType, + EFI_GUID *Protocol, + VOID *SearchKey, + UINTN *NoHandles, + EFI_HANDLE **Buffer); + +typedef +EFI_STATUS +(EFIAPI *EFI_LOCATE_PROTOCOL) ( + EFI_GUID *Protocol, + VOID *Registration, + VOID **Interface); + +typedef +EFI_STATUS +(EFIAPI *EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) ( + EFI_HANDLE *Handle, + ...); + +typedef +EFI_STATUS +(EFIAPI *EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) ( + EFI_HANDLE Handle, + ...); + +typedef +EFI_STATUS +(EFIAPI *EFI_CALCULATE_CRC32) ( + VOID *Data, + UINTN DataSize, + UINT32 *Crc32); + +typedef +VOID +(EFIAPI *EFI_COPY_MEM) ( + VOID *Destination, + VOID *Source, + UINTN Length); + +typedef +VOID +(EFIAPI *EFI_SET_MEM) ( + VOID *Buffer, + UINTN Size, + UINT8 Value); + +/* + * EFI Boot Services Table + */ +#define EFI_BOOT_SERVICES_SIGNATURE 0x56524553544f4f42 +#define EFI_BOOT_SERVICES_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION) + +typedef struct _EFI_BOOT_SERVICES { + EFI_TABLE_HEADER Hdr; + +#if 0 + EFI_RAISE_TPL RaiseTPL; + EFI_RESTORE_TPL RestoreTPL; +#else + EFI_UNKNOWN_INTERFACE RaiseTPL; + EFI_UNKNOWN_INTERFACE RestoreTPL; +#endif + + EFI_ALLOCATE_PAGES AllocatePages; + EFI_FREE_PAGES FreePages; + EFI_GET_MEMORY_MAP GetMemoryMap; + EFI_ALLOCATE_POOL AllocatePool; + EFI_FREE_POOL FreePool; + +#if 0 + EFI_CREATE_EVENT CreateEvent; + EFI_SET_TIMER SetTimer; + EFI_WAIT_FOR_EVENT WaitForEvent; + EFI_SIGNAL_EVENT SignalEvent; + EFI_CLOSE_EVENT CloseEvent; + EFI_CHECK_EVENT CheckEvent; +#else + EFI_UNKNOWN_INTERFACE CreateEvent; + EFI_UNKNOWN_INTERFACE SetTimer; + EFI_UNKNOWN_INTERFACE WaitForEvent; + EFI_UNKNOWN_INTERFACE SignalEvent; + EFI_UNKNOWN_INTERFACE CloseEvent; + EFI_UNKNOWN_INTERFACE CheckEvent; +#endif + + EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface; + EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface; + EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface; + EFI_HANDLE_PROTOCOL HandleProtocol; + EFI_HANDLE_PROTOCOL PCHandleProtocol; + EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify; + EFI_LOCATE_HANDLE LocateHandle; + EFI_LOCATE_DEVICE_PATH LocateDevicePath; + EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable; + + EFI_IMAGE_LOAD LoadImage; + EFI_IMAGE_START StartImage; + EFI_EXIT Exit; + EFI_IMAGE_UNLOAD UnloadImage; + +#if 0 + EFI_EXIT_BOOT_SERVICES ExitBootServices; + EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount; + EFI_STALL Stall; + EFI_SET_WATCHDOG_TIMER SetWatchdogTimer; +#else + EFI_UNKNOWN_INTERFACE ExitBootServices; + EFI_UNKNOWN_INTERFACE GetNextMonotonicCount; + EFI_UNKNOWN_INTERFACE Stall; + EFI_UNKNOWN_INTERFACE SetWatchdogTimer; +#endif + +#if 0 + EFI_CONNECT_CONTROLLER ConnectController; + EFI_DISCONNECT_CONTROLLER DisconnectController; +#else + EFI_UNKNOWN_INTERFACE ConnectController; + EFI_UNKNOWN_INTERFACE DisconnectController; +#endif + + EFI_OPEN_PROTOCOL OpenProtocol; + EFI_CLOSE_PROTOCOL CloseProtocol; + EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation; + EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle; + EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer; + EFI_LOCATE_PROTOCOL LocateProtocol; + EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces; + EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces; + + EFI_CALCULATE_CRC32 CalculateCrc32; + + EFI_COPY_MEM CopyMem; + EFI_SET_MEM SetMem; + +#if 0 + EFI_CREATE_EVENT_EX CreateEventEx; +#else + EFI_UNKNOWN_INTERFACE CreateEventEx; +#endif +} EFI_BOOT_SERVICES; + + +/* + * EFI System Table + */ + +/* + * EFI Configuration Table and GUID definitions + */ +#define ACPI_TABLE_GUID \ + { 0xeb9d2d30, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } +#define ACPI_20_TABLE_GUID \ + { 0x8868e871, 0xe4f1, 0x11d3, {0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} } + +typedef struct _EFI_CONFIGURATION_TABLE { + EFI_GUID VendorGuid; + VOID *VendorTable; +} EFI_CONFIGURATION_TABLE; + + +#define EFI_SYSTEM_TABLE_SIGNATURE 0x5453595320494249 +#define EFI_SYSTEM_TABLE_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION) + +typedef struct _EFI_SYSTEM_TABLE { + EFI_TABLE_HEADER Hdr; + + CHAR16 *FirmwareVendor; + UINT32 FirmwareRevision; + + EFI_HANDLE ConsoleInHandle; + SIMPLE_INPUT_INTERFACE *ConIn; + + EFI_HANDLE ConsoleOutHandle; + SIMPLE_TEXT_OUTPUT_INTERFACE *ConOut; + + EFI_HANDLE StandardErrorHandle; + SIMPLE_TEXT_OUTPUT_INTERFACE *StdErr; + +#if 0 + EFI_RUNTIME_SERVICES *RuntimeServices; +#else + EFI_HANDLE *RuntimeServices; +#endif + EFI_BOOT_SERVICES *BootServices; + + UINTN NumberOfTableEntries; + EFI_CONFIGURATION_TABLE *ConfigurationTable; + +} EFI_SYSTEM_TABLE; + + +/* GNU EFI definitions */ + +#if defined(_GNU_EFI) + +/* + * This is needed to hide platform specific code from ACPICA + */ +UINT64 +DivU64x32 ( + UINT64 Dividend, + UINTN Divisor, + UINTN *Remainder); + +/* + * EFI specific prototypes + */ +EFI_STATUS +efi_main ( + EFI_HANDLE Image, + EFI_SYSTEM_TABLE *SystemTab); + +int +acpi_main ( + int argc, + char *argv[]); + + +#endif + +extern EFI_GUID AcpiGbl_LoadedImageProtocol; +extern EFI_GUID AcpiGbl_TextInProtocol; +extern EFI_GUID AcpiGbl_TextOutProtocol; +extern EFI_GUID AcpiGbl_FileSystemProtocol; + +#endif /* __ACEFIEX_H__ */ diff --git a/source/include/platform/acenv.h b/source/include/platform/acenv.h index 6d144fc88ef6..768059c160d6 100644 --- a/source/include/platform/acenv.h +++ b/source/include/platform/acenv.h @@ -349,27 +349,49 @@ /* We will be linking to the standard Clib functions */ -#define ACPI_STRSTR(s1,s2) strstr((s1), (s2)) -#define ACPI_STRCHR(s1,c) strchr((s1), (c)) -#define ACPI_STRLEN(s) (ACPI_SIZE) strlen((s)) -#define ACPI_STRCPY(d,s) (void) strcpy((d), (s)) -#define ACPI_STRNCPY(d,s,n) (void) strncpy((d), (s), (ACPI_SIZE)(n)) -#define ACPI_STRNCMP(d,s,n) strncmp((d), (s), (ACPI_SIZE)(n)) -#define ACPI_STRCMP(d,s) strcmp((d), (s)) -#define ACPI_STRCAT(d,s) (void) strcat((d), (s)) -#define ACPI_STRNCAT(d,s,n) strncat((d), (s), (ACPI_SIZE)(n)) -#define ACPI_STRTOUL(d,s,n) strtoul((d), (s), (ACPI_SIZE)(n)) -#define ACPI_MEMCMP(s1,s2,n) memcmp((const char *)(s1), (const char *)(s2), (ACPI_SIZE)(n)) -#define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (ACPI_SIZE)(n)) -#define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (ACPI_SIZE)(n)) -#define ACPI_TOUPPER(i) toupper((int) (i)) -#define ACPI_TOLOWER(i) tolower((int) (i)) -#define ACPI_IS_XDIGIT(i) isxdigit((int) (i)) -#define ACPI_IS_DIGIT(i) isdigit((int) (i)) -#define ACPI_IS_SPACE(i) isspace((int) (i)) -#define ACPI_IS_UPPER(i) isupper((int) (i)) -#define ACPI_IS_PRINT(i) isprint((int) (i)) -#define ACPI_IS_ALPHA(i) isalpha((int) (i)) +#undef strstr +#undef strchr +#undef strlen +#undef strcpy +#undef strncpy +#undef strncmp +#undef strcmp +#undef strcat +#undef strncat +#undef strtoul +#undef memcmp +#undef memcpy +#undef memset +#undef toupper +#undef tolower +#undef isxdigit +#undef isdigit +#undef isspace +#undef isupper +#undef isprint +#undef isalpha + +#define strstr(s1,s2) strstr((s1), (s2)) +#define strchr(s1,c) strchr((s1), (c)) +#define strlen(s) (ACPI_SIZE) strlen((s)) +#define strcpy(d,s) (void) strcpy((d), (s)) +#define strncpy(d,s,n) (void) strncpy((d), (s), (ACPI_SIZE)(n)) +#define strncmp(d,s,n) strncmp((d), (s), (ACPI_SIZE)(n)) +#define strcmp(d,s) strcmp((d), (s)) +#define strcat(d,s) (void) strcat((d), (s)) +#define strncat(d,s,n) strncat((d), (s), (ACPI_SIZE)(n)) +#define strtoul(d,s,n) strtoul((d), (s), (ACPI_SIZE)(n)) +#define memcmp(s1,s2,n) memcmp((const char *)(s1), (const char *)(s2), (ACPI_SIZE)(n)) +#define memcpy(d,s,n) (void) memcpy((d), (s), (ACPI_SIZE)(n)) +#define memset(d,s,n) (void) memset((d), (s), (ACPI_SIZE)(n)) +#define toupper(i) toupper((int) (i)) +#define tolower(i) tolower((int) (i)) +#define isxdigit(i) isxdigit((int) (i)) +#define isdigit(i) isdigit((int) (i)) +#define isspace(i) isspace((int) (i)) +#define isupper(i) isupper((int) (i)) +#define isprint(i) isprint((int) (i)) +#define isalpha(i) isalpha((int) (i)) #else @@ -408,22 +430,6 @@ typedef char *va_list; /* Use the local (ACPICA) definitions of the clib functions */ -#define ACPI_STRSTR(s1,s2) AcpiUtStrstr ((s1), (s2)) -#define ACPI_STRCHR(s1,c) AcpiUtStrchr ((s1), (c)) -#define ACPI_STRLEN(s) (ACPI_SIZE) AcpiUtStrlen ((s)) -#define ACPI_STRCPY(d,s) (void) AcpiUtStrcpy ((d), (s)) -#define ACPI_STRNCPY(d,s,n) (void) AcpiUtStrncpy ((d), (s), (ACPI_SIZE)(n)) -#define ACPI_STRNCMP(d,s,n) AcpiUtStrncmp ((d), (s), (ACPI_SIZE)(n)) -#define ACPI_STRCMP(d,s) AcpiUtStrcmp ((d), (s)) -#define ACPI_STRCAT(d,s) (void) AcpiUtStrcat ((d), (s)) -#define ACPI_STRNCAT(d,s,n) AcpiUtStrncat ((d), (s), (ACPI_SIZE)(n)) -#define ACPI_STRTOUL(d,s,n) AcpiUtStrtoul ((d), (s), (ACPI_SIZE)(n)) -#define ACPI_MEMCMP(s1,s2,n) AcpiUtMemcmp((const char *)(s1), (const char *)(s2), (ACPI_SIZE)(n)) -#define ACPI_MEMCPY(d,s,n) (void) AcpiUtMemcpy ((d), (s), (ACPI_SIZE)(n)) -#define ACPI_MEMSET(d,v,n) (void) AcpiUtMemset ((d), (v), (ACPI_SIZE)(n)) -#define ACPI_TOUPPER(c) AcpiUtToUpper ((int) (c)) -#define ACPI_TOLOWER(c) AcpiUtToLower ((int) (c)) - #endif /* ACPI_USE_SYSTEM_CLIBRARY */ #ifndef ACPI_FILE diff --git a/source/include/platform/acenvex.h b/source/include/platform/acenvex.h index 6e1130e02076..c799fd8adbbe 100644 --- a/source/include/platform/acenvex.h +++ b/source/include/platform/acenvex.h @@ -56,6 +56,12 @@ #if defined(_LINUX) || defined(__linux__) #include "aclinuxex.h" +#elif defined(_AED_EFI) +#include "acefiex.h" + +#elif defined(_GNU_EFI) +#include "acefiex.h" + #elif defined(__DragonFly__) #include "acdragonflyex.h" diff --git a/source/include/platform/acgcc.h b/source/include/platform/acgcc.h index 2a274451faff..472b6d7f8a1a 100644 --- a/source/include/platform/acgcc.h +++ b/source/include/platform/acgcc.h @@ -75,4 +75,8 @@ #undef strchr #endif +/* GCC supports __VA_ARGS__ in macros */ + +#define COMPILER_VA_MACRO 1 + #endif /* __ACGCC_H__ */ diff --git a/source/include/platform/acmsvc.h b/source/include/platform/acmsvc.h index 59e0b2d33e49..da9df8905354 100644 --- a/source/include/platform/acmsvc.h +++ b/source/include/platform/acmsvc.h @@ -44,6 +44,7 @@ #ifndef __ACMSVC_H__ #define __ACMSVC_H__ +/* Note: do not include any C library headers here */ /* * Map low I/O functions for MS. This allows us to disable MS language @@ -152,8 +153,6 @@ #ifdef _DEBUG #define _CRTDBG_MAP_ALLOC /* Enables specific file/lineno for leaks */ -#include <stdlib.h> -#include <malloc.h> #include <crtdbg.h> /* @@ -185,4 +184,9 @@ _CrtSetBreakAlloc (937); #endif +#if _MSC_VER > 1200 /* Versions above VC++ 6 */ +#define COMPILER_VA_MACRO 1 +#else +#endif + #endif /* __ACMSVC_H__ */ |
