aboutsummaryrefslogtreecommitdiff
path: root/source/include/platform
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2015-06-16 19:48:16 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2015-06-16 19:48:16 +0000
commit8811b910b092027f905013bced1da3e87c6b07b9 (patch)
treeb0c56a23f2d8877b9431deb3cab73df3c1913fb7 /source/include/platform
parent0c85196b0c51b4e5eba8fcace026f947f9112c9e (diff)
Notes
Diffstat (limited to 'source/include/platform')
-rw-r--r--source/include/platform/acefi.h174
-rw-r--r--source/include/platform/acefiex.h855
-rw-r--r--source/include/platform/acenv.h80
-rw-r--r--source/include/platform/acenvex.h6
-rw-r--r--source/include/platform/acgcc.h4
-rw-r--r--source/include/platform/acmsvc.h8
6 files changed, 1069 insertions, 58 deletions
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__ */