diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2014-06-27 19:10:35 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2014-06-27 19:10:35 +0000 |
commit | e599b42ef5047e5546af949d87d2cfd2e17062b0 (patch) | |
tree | eeef1a6644e518893667349342fa66f9f0249fec /source/include | |
parent | 6b8f78e0a6a7880856440b372097482adb326592 (diff) | |
download | src-test2-e599b42ef5047e5546af949d87d2cfd2e17062b0.tar.gz src-test2-e599b42ef5047e5546af949d87d2cfd2e17062b0.zip |
Notes
Diffstat (limited to 'source/include')
-rw-r--r-- | source/include/acapps.h | 9 | ||||
-rw-r--r-- | source/include/acdebug.h | 5 | ||||
-rw-r--r-- | source/include/acglobal.h | 8 | ||||
-rw-r--r-- | source/include/acnames.h | 1 | ||||
-rw-r--r-- | source/include/acpi.h | 4 | ||||
-rw-r--r-- | source/include/acpiosxf.h | 49 | ||||
-rw-r--r-- | source/include/acpixf.h | 36 | ||||
-rw-r--r-- | source/include/acpredef.h | 6 | ||||
-rw-r--r-- | source/include/actables.h | 14 | ||||
-rw-r--r-- | source/include/actypes.h | 16 | ||||
-rw-r--r-- | source/include/acutils.h | 70 | ||||
-rw-r--r-- | source/include/platform/accygwin.h | 9 | ||||
-rw-r--r-- | source/include/platform/acefi.h | 61 | ||||
-rw-r--r-- | source/include/platform/acenv.h | 53 | ||||
-rw-r--r-- | source/include/platform/acenvex.h | 63 | ||||
-rw-r--r-- | source/include/platform/aclinux.h | 194 | ||||
-rw-r--r-- | source/include/platform/aclinuxex.h | 137 |
17 files changed, 542 insertions, 193 deletions
diff --git a/source/include/acapps.h b/source/include/acapps.h index fa8e3866db09..f75478953170 100644 --- a/source/include/acapps.h +++ b/source/include/acapps.h @@ -84,10 +84,13 @@ /* Macros for usage messages */ #define ACPI_USAGE_HEADER(Usage) \ - printf ("Usage: %s\nOptions:\n", Usage); + AcpiOsPrintf ("Usage: %s\nOptions:\n", Usage); + +#define ACPI_USAGE_TEXT(Description) \ + AcpiOsPrintf (Description); #define ACPI_OPTION(Name, Description) \ - printf (" %-18s%s\n", Name, Description); + AcpiOsPrintf (" %-18s%s\n", Name, Description); #define FILE_SUFFIX_DISASSEMBLY "dsl" @@ -119,7 +122,7 @@ extern char *AcpiGbl_Optarg; */ UINT32 CmGetFileSize ( - FILE *File); + ACPI_FILE File); #ifndef ACPI_DUMP_APP diff --git a/source/include/acdebug.h b/source/include/acdebug.h index f85ec01ac29a..a85625731b08 100644 --- a/source/include/acdebug.h +++ b/source/include/acdebug.h @@ -377,11 +377,6 @@ AcpiDbGetTableFromFile ( char *Filename, ACPI_TABLE_HEADER **Table); -ACPI_STATUS -AcpiDbReadTableFromFile ( - char *Filename, - ACPI_TABLE_HEADER **Table); - /* * dbhistry - debugger HISTORY command diff --git a/source/include/acglobal.h b/source/include/acglobal.h index 06225c1247f2..a83f8c34b0eb 100644 --- a/source/include/acglobal.h +++ b/source/include/acglobal.h @@ -301,7 +301,7 @@ ACPI_GLOBAL (UINT32, AcpiGbl_TraceDbgLayer); * ****************************************************************************/ -ACPI_GLOBAL (UINT8, AcpiGbl_DbOutputFlags); +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DbOutputFlags, ACPI_DB_CONSOLE_OUTPUT); #ifdef ACPI_DISASSEMBLER @@ -367,6 +367,12 @@ ACPI_GLOBAL (UINT32, AcpiGbl_NumObjects); #ifdef ACPI_APPLICATION ACPI_INIT_GLOBAL (ACPI_FILE, AcpiGbl_DebugFile, NULL); +ACPI_INIT_GLOBAL (ACPI_FILE, AcpiGbl_OutputFile, NULL); + +/* Print buffer */ + +ACPI_GLOBAL (ACPI_SPINLOCK, AcpiGbl_PrintLock); /* For print buffer */ +ACPI_GLOBAL (char, AcpiGbl_PrintBuffer[1024]); #endif /* ACPI_APPLICATION */ diff --git a/source/include/acnames.h b/source/include/acnames.h index 3db143cbbdaa..f5daaceb2f81 100644 --- a/source/include/acnames.h +++ b/source/include/acnames.h @@ -55,7 +55,6 @@ #define METHOD_NAME__HID "_HID" #define METHOD_NAME__INI "_INI" #define METHOD_NAME__PLD "_PLD" -#define METHOD_NAME__PRP "_PRP" #define METHOD_NAME__PRS "_PRS" #define METHOD_NAME__PRT "_PRT" #define METHOD_NAME__PRW "_PRW" diff --git a/source/include/acpi.h b/source/include/acpi.h index 8c65613529b2..fb1f565e2f28 100644 --- a/source/include/acpi.h +++ b/source/include/acpi.h @@ -62,8 +62,6 @@ #include "acrestyp.h" /* Resource Descriptor structs */ #include "acpiosxf.h" /* OSL interfaces (ACPICA-to-OS) */ #include "acpixf.h" /* ACPI core subsystem external interfaces */ -#ifdef ACPI_NATIVE_INTERFACE_HEADER -#include ACPI_NATIVE_INTERFACE_HEADER -#endif +#include "platform/acenvex.h" /* Extra environment-specific items */ #endif /* __ACPI_H__ */ diff --git a/source/include/acpiosxf.h b/source/include/acpiosxf.h index ebbcb6bd6f61..3888b488e9ad 100644 --- a/source/include/acpiosxf.h +++ b/source/include/acpiosxf.h @@ -551,4 +551,53 @@ AcpiOsCloseDirectory ( #endif +/* + * File I/O and related support + */ +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsOpenFile +ACPI_FILE +AcpiOsOpenFile ( + const char *Path, + UINT8 Modes); +#endif + +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCloseFile +void +AcpiOsCloseFile ( + ACPI_FILE File); +#endif + +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadFile +int +AcpiOsReadFile ( + ACPI_FILE File, + void *Buffer, + ACPI_SIZE Size, + ACPI_SIZE Count); +#endif + +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWriteFile +int +AcpiOsWriteFile ( + ACPI_FILE File, + void *Buffer, + ACPI_SIZE Size, + ACPI_SIZE Count); +#endif + +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetFileOffset +long +AcpiOsGetFileOffset ( + ACPI_FILE File); +#endif + +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsSetFileOffset +ACPI_STATUS +AcpiOsSetFileOffset ( + ACPI_FILE File, + long Offset, + UINT8 From); +#endif + + #endif /* __ACPIOSXF_H__ */ diff --git a/source/include/acpixf.h b/source/include/acpixf.h index 53d2c1fd0ed4..31adb7026afd 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 0x20140424 +#define ACPI_CA_VERSION 0x20140627 #include "acconfig.h" #include "actypes.h" @@ -162,6 +162,15 @@ ACPI_INIT_GLOBAL (UINT8, AcpiGbl_CreateOsiMethod, TRUE); ACPI_INIT_GLOBAL (UINT8, AcpiGbl_UseDefaultRegisterWidths, TRUE); /* + * Whether or not to verify the table checksum before installation. Set + * this to TRUE to verify the table checksum before install it to the table + * manager. Note that enabling this option causes errors to happen in some + * OSPMs during early initialization stages. Default behavior is to do such + * verification. + */ +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_VerifyTableChecksum, TRUE); + +/* * Optionally enable output from the AML Debug Object. */ ACPI_INIT_GLOBAL (UINT8, AcpiGbl_EnableAmlDebugObject, FALSE); @@ -334,6 +343,24 @@ ACPI_GLOBAL (BOOLEAN, AcpiGbl_SystemAwakeAndRunning); #endif /* ACPI_DEBUG_OUTPUT */ +/* + * Application prototypes + * + * All interfaces used by application will be configured + * out of the ACPICA build unless the ACPI_APPLICATION + * flag is defined. + */ +#ifdef ACPI_APPLICATION +#define ACPI_APP_DEPENDENT_RETURN_VOID(Prototype) \ + Prototype; + +#else +#define ACPI_APP_DEPENDENT_RETURN_VOID(Prototype) \ + static ACPI_INLINE Prototype {return;} + +#endif /* ACPI_APPLICATION */ + + /***************************************************************************** * * ACPICA public interface prototypes @@ -1136,4 +1163,11 @@ AcpiDebugPrintRaw ( const char *Format, ...)) +ACPI_APP_DEPENDENT_RETURN_VOID ( +ACPI_PRINTF_LIKE(1) +void ACPI_INTERNAL_VAR_XFACE +AcpiLogError ( + const char *Format, + ...)) + #endif /* __ACXFACE_H__ */ diff --git a/source/include/acpredef.h b/source/include/acpredef.h index d7af2db26974..3ab4ae0a229f 100644 --- a/source/include/acpredef.h +++ b/source/include/acpredef.h @@ -688,12 +688,6 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - {{"_PRP", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each: 1 Str, 1 Int/Str/Pkg */ - PACKAGE_INFO (ACPI_PTYPE2, ACPI_RTYPE_STRING, 1, - ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | - ACPI_RTYPE_PACKAGE | ACPI_RTYPE_REFERENCE, 1,0), - {{"_PRS", METHOD_0ARGS, METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, diff --git a/source/include/actables.h b/source/include/actables.h index 672b6b40632b..e266924b0540 100644 --- a/source/include/actables.h +++ b/source/include/actables.h @@ -86,6 +86,15 @@ void AcpiTbReleaseTempTable ( ACPI_TABLE_DESC *TableDesc); +ACPI_STATUS +AcpiTbValidateTempTable ( + ACPI_TABLE_DESC *TableDesc); + +ACPI_STATUS +AcpiTbVerifyTempTable ( + ACPI_TABLE_DESC *TableDesc, + char *Signature); + BOOLEAN AcpiTbIsTableLoaded ( UINT32 TableIndex); @@ -135,11 +144,6 @@ void AcpiTbInvalidateTable ( ACPI_TABLE_DESC *TableDesc); -ACPI_STATUS -AcpiTbVerifyTable ( - ACPI_TABLE_DESC *TableDesc, - char *Signature); - void AcpiTbOverrideTable ( ACPI_TABLE_DESC *OldTableDesc); diff --git a/source/include/actypes.h b/source/include/actypes.h index 7a8d5c5c3b4b..5e1c307f46ce 100644 --- a/source/include/actypes.h +++ b/source/include/actypes.h @@ -127,6 +127,7 @@ typedef unsigned char BOOLEAN; typedef unsigned char UINT8; typedef unsigned short UINT16; +typedef short INT16; typedef COMPILER_DEPENDENT_UINT64 UINT64; typedef COMPILER_DEPENDENT_INT64 INT64; @@ -1336,4 +1337,19 @@ typedef struct acpi_memory_list #define ACPI_OSI_WIN_8 0x0C +/* Definitions of file IO */ + +#define ACPI_FILE_READING 0x01 +#define ACPI_FILE_WRITING 0x02 +#define ACPI_FILE_BINARY 0x04 + +#define ACPI_FILE_BEGIN 0x01 +#define ACPI_FILE_END 0x02 + + +/* Definitions of getopt */ + +#define ACPI_OPT_END -1 + + #endif /* __ACTYPES_H__ */ diff --git a/source/include/acutils.h b/source/include/acutils.h index 5c873133801c..b0062340632c 100644 --- a/source/include/acutils.h +++ b/source/include/acutils.h @@ -96,7 +96,6 @@ extern const char *AcpiGbl_PtDecode[]; #ifdef ACPI_ASL_COMPILER #include <stdio.h> -extern FILE *AcpiGbl_OutputFile; #define ACPI_MSG_REDIRECT_BEGIN \ FILE *OutputFile = AcpiGbl_OutputFile; \ @@ -253,6 +252,11 @@ AcpiUtStrlen ( const char *String); char * +AcpiUtStrchr ( + const char *String, + int ch); + +char * AcpiUtStrcpy ( char *DstString, const char *SrcString); @@ -340,7 +344,7 @@ extern const UINT8 _acpi_ctype[]; #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_SP | _ACPI_PU)) +#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)) #endif /* !ACPI_USE_SYSTEM_CLIBRARY */ @@ -482,6 +486,16 @@ AcpiUtDumpBuffer ( UINT32 Display, UINT32 Offset); +#ifdef ACPI_APPLICATION +void +AcpiUtDumpBufferToFile ( + ACPI_FILE File, + UINT8 *Buffer, + UINT32 Count, + UINT32 Display, + UINT32 BaseOffset); +#endif + void AcpiUtReportError ( char *ModuleName, @@ -551,6 +565,17 @@ AcpiUtExecutePowerMethods ( /* + * utfileio - file operations + */ +#ifdef ACPI_APPLICATION +ACPI_STATUS +AcpiUtReadTableFromFile ( + char *Filename, + ACPI_TABLE_HEADER **Table); +#endif + + +/* * utids - device ID support */ ACPI_STATUS @@ -1110,4 +1135,45 @@ const AH_DEVICE_ID * AcpiAhMatchHardwareId ( char *Hid); +/* + * utprint - printf/vprintf output functions + */ +const char * +AcpiUtScanNumber ( + const char *String, + UINT64 *NumberPtr); + +const char * +AcpiUtPrintNumber ( + char *String, + UINT64 Number); + +int +AcpiUtVsnprintf ( + char *String, + ACPI_SIZE Size, + const char *Format, + va_list Args); + +int +AcpiUtSnprintf ( + char *String, + ACPI_SIZE Size, + const char *Format, + ...); + +#ifdef ACPI_APPLICATION +int +AcpiUtFileVprintf ( + ACPI_FILE File, + const char *Format, + va_list Args); + +int +AcpiUtFilePrintf ( + ACPI_FILE File, + const char *Format, + ...); +#endif + #endif /* _ACUTILS_H */ diff --git a/source/include/platform/accygwin.h b/source/include/platform/accygwin.h index cf8a2a33d7bb..09581c4a3032 100644 --- a/source/include/platform/accygwin.h +++ b/source/include/platform/accygwin.h @@ -92,11 +92,14 @@ /* - * The vsnprintf function is defined by c99, but cygwin/gcc does not - * enable this prototype when the -ansi flag is set. Also related to - * __STRICT_ANSI__. So, we just declare the prototype here. + * The vsnprintf/snprintf functions are defined by c99, but cygwin/gcc + * does not enable this prototype when the -ansi flag is set. Also related + * to __STRICT_ANSI__. So, we just declare the prototype here. */ int vsnprintf (char *s, size_t n, const char *format, va_list ap); +int +snprintf (char *s, size_t n, const char *format, ...); + #endif /* __ACCYGWIN_H__ */ diff --git a/source/include/platform/acefi.h b/source/include/platform/acefi.h index 1fafeb483dd4..cc24fbb4bd24 100644 --- a/source/include/platform/acefi.h +++ b/source/include/platform/acefi.h @@ -44,11 +44,20 @@ #ifndef __ACEFI_H__ #define __ACEFI_H__ +#include <stdarg.h> +#if defined(_GNU_EFI) +#include <stdint.h> +#include <unistd.h> +#endif #include <efi.h> #include <efistdarg.h> #include <efilib.h> +/* AED EFI definitions */ + +#if defined(_AED_EFI) + /* _int64 works for both IA32 and IA64 */ #define COMPILER_DEPENDENT_INT64 __int64 @@ -71,5 +80,57 @@ #pragma warning(disable:4142) +#endif + + +/* GNU EFI definitions */ + +#if defined(_GNU_EFI) + +/* Using GCC for GNU EFI */ + +#include "acgcc.h" + +#undef ACPI_USE_SYSTEM_CLIBRARY +#undef ACPI_USE_STANDARD_HEADERS +#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 + */ +#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \ + do { \ + UINT64 __n = ((UINT64) n_hi) << 32 | (n_lo); \ + (q32) = DivU64x32 ((__n), (d32), &(r32)); \ + } while (0) + +#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \ + do { \ + (n_lo) >>= 1; \ + (n_lo) |= (((n_hi) & 1) << 31); \ + (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 + #endif /* __ACEFI_H__ */ diff --git a/source/include/platform/acenv.h b/source/include/platform/acenv.h index e0100b168c73..b7444f0fbc6d 100644 --- a/source/include/platform/acenv.h +++ b/source/include/platform/acenv.h @@ -88,20 +88,14 @@ #define ACPI_DBG_TRACK_ALLOCATIONS #endif -/* AcpiNames configuration. Single threaded with debugger output enabled. */ - -#ifdef ACPI_NAMES_APP -#define ACPI_DEBUGGER -#define ACPI_APPLICATION -#define ACPI_SINGLE_THREADED -#endif - /* - * AcpiBin/AcpiDump/AcpiSrc/AcpiXtract/Example configuration. All single - * threaded, with no debug output. + * AcpiBin/AcpiDump/AcpiHelp/AcpiNames/AcpiSrc/AcpiXtract/Example configuration. + * All single threaded. */ #if (defined ACPI_BIN_APP) || \ (defined ACPI_DUMP_APP) || \ + (defined ACPI_HELP_APP) || \ + (defined ACPI_NAMES_APP) || \ (defined ACPI_SRC_APP) || \ (defined ACPI_XTRACT_APP) || \ (defined ACPI_EXAMPLE_APP) @@ -109,12 +103,40 @@ #define ACPI_SINGLE_THREADED #endif +/* AcpiHelp configuration. Error messages disabled. */ + #ifdef ACPI_HELP_APP -#define ACPI_APPLICATION -#define ACPI_SINGLE_THREADED #define ACPI_NO_ERROR_MESSAGES #endif +/* AcpiNames configuration. Debug output enabled. */ + +#ifdef ACPI_NAMES_APP +#define ACPI_DEBUG_OUTPUT +#endif + +/* AcpiExec/AcpiNames/Example configuration. Native RSDP used. */ + +#if (defined ACPI_EXEC_APP) || \ + (defined ACPI_EXAMPLE_APP) || \ + (defined ACPI_NAMES_APP) +#define ACPI_USE_NATIVE_RSDP_POINTER +#endif + +/* AcpiDump configuration. Native mapping used if provied by OSPMs */ + +#ifdef ACPI_DUMP_APP +#define ACPI_USE_NATIVE_MEMORY_MAPPING +#define USE_NATIVE_ALLOCATE_ZEROED +#endif + +/* AcpiNames/Example configuration. Hardware disabled */ + +#if (defined ACPI_EXAMPLE_APP) || \ + (defined ACPI_NAMES_APP) +#define ACPI_REDUCED_HARDWARE 1 +#endif + /* Linkable ACPICA library */ #ifdef ACPI_LIBRARY @@ -185,6 +207,9 @@ #elif defined(_AED_EFI) #include "acefi.h" +#elif defined(_GNU_EFI) +#include "acefi.h" + #elif defined(__HAIKU__) #include "achaiku.h" @@ -401,8 +426,12 @@ typedef char *va_list; #ifdef ACPI_APPLICATION #include <stdio.h> #define ACPI_FILE FILE * +#define ACPI_FILE_OUT stdout +#define ACPI_FILE_ERR stderr #else #define ACPI_FILE void * +#define ACPI_FILE_OUT NULL +#define ACPI_FILE_ERR NULL #endif /* ACPI_APPLICATION */ #endif /* ACPI_FILE */ diff --git a/source/include/platform/acenvex.h b/source/include/platform/acenvex.h new file mode 100644 index 000000000000..a1de87ffee25 --- /dev/null +++ b/source/include/platform/acenvex.h @@ -0,0 +1,63 @@ +/****************************************************************************** + * + * Name: acenvex.h - Extra host and compiler configuration + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2014, 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 __ACENVEX_H__ +#define __ACENVEX_H__ + +/*! [Begin] no source code translation */ + +/****************************************************************************** + * + * Extra host configuration files. All ACPICA headers are included before + * including these files. + * + *****************************************************************************/ + +#if defined(_LINUX) || defined(__linux__) +#include "aclinuxex.h" + +#endif + +/*! [End] no source code translation !*/ + +#endif /* __ACENVEX_H__ */ diff --git a/source/include/platform/aclinux.h b/source/include/platform/aclinux.h index a57f7f00db32..a51f28872bc9 100644 --- a/source/include/platform/aclinux.h +++ b/source/include/platform/aclinux.h @@ -48,13 +48,18 @@ #define ACPI_USE_SYSTEM_CLIBRARY #define ACPI_USE_DO_WHILE_0 -#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE #ifdef __KERNEL__ #define ACPI_USE_SYSTEM_INTTYPES +/* Compile for reduced hardware mode only with this kernel config */ + +#ifdef CONFIG_ACPI_REDUCED_HARDWARE_ONLY +#define ACPI_REDUCED_HARDWARE 1 +#endif + #include <linux/string.h> #include <linux/kernel.h> #include <linux/ctype.h> @@ -66,7 +71,7 @@ #ifdef EXPORT_ACPI_INTERFACES #include <linux/export.h> #endif -#include <asm/acpi.h> +#include <asm/acenv.h> #ifndef CONFIG_ACPI @@ -109,6 +114,42 @@ #define ACPI_SPINLOCK spinlock_t * #define ACPI_CPU_FLAGS unsigned long +/* Use native linux version of AcpiOsAllocateZeroed */ + +#define USE_NATIVE_ALLOCATE_ZEROED + +/* + * Overrides for in-kernel ACPICA + */ +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsInitialize +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTerminate +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAllocate +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAllocateZeroed +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsFree +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAcquireObject +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetThreadId +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateLock +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsMapMemory +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsUnmapMemory + +/* + * OSL interfaces used by debugger/disassembler + */ +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadable +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWritable + +/* + * OSL interfaces used by utilities + */ +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsRedirectOutput +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetLine +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByName +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByIndex +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByAddress +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsOpenDirectory +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetNextFilename +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCloseDirectory + #else /* !__KERNEL__ */ #include <stdarg.h> @@ -154,153 +195,4 @@ #include "acgcc.h" - -#ifdef __KERNEL__ - -/* - * FIXME: Inclusion of actypes.h - * Linux kernel need this before defining inline OSL interfaces as - * actypes.h need to be included to find ACPICA type definitions. - * Since from ACPICA's perspective, the actypes.h should be included after - * acenv.h (aclinux.h), this leads to a inclusion mis-ordering issue. - */ -#include <acpi/actypes.h> - -/* - * Overrides for in-kernel ACPICA - */ -ACPI_STATUS __init AcpiOsInitialize ( - void); -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsInitialize - -ACPI_STATUS AcpiOsTerminate ( - void); -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTerminate - -/* - * Memory allocation/deallocation - */ - -/* - * The irqs_disabled() check is for resume from RAM. - * Interrupts are off during resume, just like they are for boot. - * However, boot has (system_state != SYSTEM_RUNNING) - * to quiet __might_sleep() in kmalloc() and resume does not. - */ -static inline void * -AcpiOsAllocate ( - ACPI_SIZE Size) -{ - return kmalloc (Size, irqs_disabled () ? GFP_ATOMIC : GFP_KERNEL); -} -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAllocate - -/* Use native linux version of AcpiOsAllocateZeroed */ - -static inline void * -AcpiOsAllocateZeroed ( - ACPI_SIZE Size) -{ - return kzalloc (Size, irqs_disabled () ? GFP_ATOMIC : GFP_KERNEL); -} -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAllocateZeroed -#define USE_NATIVE_ALLOCATE_ZEROED - -static inline void -AcpiOsFree ( - void *Memory) -{ - kfree (Memory); -} -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsFree - -static inline void * -AcpiOsAcquireObject ( - ACPI_CACHE_T *Cache) -{ - return kmem_cache_zalloc (Cache, - irqs_disabled () ? GFP_ATOMIC : GFP_KERNEL); -} -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAcquireObject - -static inline ACPI_THREAD_ID -AcpiOsGetThreadId ( - void) -{ - return (ACPI_THREAD_ID) (unsigned long) current; -} -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetThreadId - -#ifndef CONFIG_PREEMPT - -/* - * Used within ACPICA to show where it is safe to preempt execution - * when CONFIG_PREEMPT=n - */ -#define ACPI_PREEMPTION_POINT() \ - do { \ - if (!irqs_disabled()) \ - cond_resched(); \ - } while (0) - -#endif - -/* - * When lockdep is enabled, the spin_lock_init() macro stringifies it's - * argument and uses that as a name for the lock in debugging. - * By executing spin_lock_init() in a macro the key changes from "lock" for - * all locks to the name of the argument of acpi_os_create_lock(), which - * prevents lockdep from reporting false positives for ACPICA locks. - */ -#define AcpiOsCreateLock(__Handle) \ - ({ \ - spinlock_t *Lock = ACPI_ALLOCATE(sizeof(*Lock)); \ - if (Lock) { \ - *(__Handle) = Lock; \ - spin_lock_init(*(__Handle)); \ - } \ - Lock ? AE_OK : AE_NO_MEMORY; \ - }) -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateLock - -void __iomem * -AcpiOsMapMemory ( - ACPI_PHYSICAL_ADDRESS Where, - ACPI_SIZE Length); -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsMapMemory - -void -AcpiOsUnmapMemory ( - void __iomem *LogicalAddress, - ACPI_SIZE Size); -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsUnmapMemory - -/* - * OSL interfaces used by debugger/disassembler - */ -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadable -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWritable - -/* - * OSL interfaces used by utilities - */ -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsRedirectOutput -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetLine -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByName -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByIndex -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByAddress -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsOpenDirectory -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetNextFilename -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCloseDirectory - -/* - * OSL interfaces added by Linux - */ -void -EarlyAcpiOsUnmapMemory ( - void __iomem *Virt, - ACPI_SIZE Size); - -#endif /* __KERNEL__ */ - #endif /* __ACLINUX_H__ */ diff --git a/source/include/platform/aclinuxex.h b/source/include/platform/aclinuxex.h new file mode 100644 index 000000000000..87d43910b226 --- /dev/null +++ b/source/include/platform/aclinuxex.h @@ -0,0 +1,137 @@ +/****************************************************************************** + * + * Name: aclinuxex.h - Extra OS specific defines, etc. for Linux + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2014, 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 __ACLINUXEX_H__ +#define __ACLINUXEX_H__ + +#ifdef __KERNEL__ + +/* + * Overrides for in-kernel ACPICA + */ +ACPI_STATUS __init AcpiOsInitialize ( + void); + +ACPI_STATUS AcpiOsTerminate ( + void); + +/* + * The irqs_disabled() check is for resume from RAM. + * Interrupts are off during resume, just like they are for boot. + * However, boot has (system_state != SYSTEM_RUNNING) + * to quiet __might_sleep() in kmalloc() and resume does not. + */ +static inline void * +AcpiOsAllocate ( + ACPI_SIZE Size) +{ + return kmalloc (Size, irqs_disabled () ? GFP_ATOMIC : GFP_KERNEL); +} + +static inline void * +AcpiOsAllocateZeroed ( + ACPI_SIZE Size) +{ + return kzalloc (Size, irqs_disabled () ? GFP_ATOMIC : GFP_KERNEL); +} + +static inline void +AcpiOsFree ( + void *Memory) +{ + kfree (Memory); +} + +static inline void * +AcpiOsAcquireObject ( + ACPI_CACHE_T *Cache) +{ + return kmem_cache_zalloc (Cache, + irqs_disabled () ? GFP_ATOMIC : GFP_KERNEL); +} + +static inline ACPI_THREAD_ID +AcpiOsGetThreadId ( + void) +{ + return (ACPI_THREAD_ID) (unsigned long) current; +} + +/* + * When lockdep is enabled, the spin_lock_init() macro stringifies it's + * argument and uses that as a name for the lock in debugging. + * By executing spin_lock_init() in a macro the key changes from "lock" for + * all locks to the name of the argument of acpi_os_create_lock(), which + * prevents lockdep from reporting false positives for ACPICA locks. + */ +#define AcpiOsCreateLock(__Handle) \ + ({ \ + spinlock_t *Lock = ACPI_ALLOCATE(sizeof(*Lock)); \ + if (Lock) { \ + *(__Handle) = Lock; \ + spin_lock_init(*(__Handle)); \ + } \ + Lock ? AE_OK : AE_NO_MEMORY; \ + }) + +void __iomem * +AcpiOsMapMemory ( + ACPI_PHYSICAL_ADDRESS Where, + ACPI_SIZE Length); + +void +AcpiOsUnmapMemory ( + void __iomem *LogicalAddress, + ACPI_SIZE Size); + +/* + * OSL interfaces added by Linux + */ +void +EarlyAcpiOsUnmapMemory ( + void __iomem *Virt, + ACPI_SIZE Size); + +#endif /* __KERNEL__ */ + +#endif /* __ACLINUXEX_H__ */ |