diff options
author | marks <marks@FreeBSD.org> | 2004-07-02 08:14:36 +0000 |
---|---|---|
committer | marks <marks@FreeBSD.org> | 2004-07-02 08:14:36 +0000 |
commit | 4a971257d3dcd405c227bcc6e540511cbd19fd03 (patch) | |
tree | 85746fbcce558bf49c838237c235f97d9084f9cd /sys/contrib | |
parent | 0d6049326d5b82458b0b44609a92236a360ace02 (diff) | |
download | FreeBSD-src-4a971257d3dcd405c227bcc6e540511cbd19fd03.zip FreeBSD-src-4a971257d3dcd405c227bcc6e540511cbd19fd03.tar.gz |
Vendor import of Intel ACPI-CA 20040527
Diffstat (limited to 'sys/contrib')
-rw-r--r-- | sys/contrib/dev/acpica/CHANGES.txt | 47 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/acconfig.h | 15 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/acfreebsd.h | 8 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/acinterp.h | 8 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/acmacros.h | 5 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/aslcompiler.y | 2 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/dbcmds.c | 6 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/dbdisply.c | 10 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/dsopcode.c | 5 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/evgpe.c | 46 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/evgpeblk.c | 6 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/exconfig.c | 6 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/exfldio.c | 154 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/tbxfroot.c | 102 |
14 files changed, 271 insertions, 149 deletions
diff --git a/sys/contrib/dev/acpica/CHANGES.txt b/sys/contrib/dev/acpica/CHANGES.txt index 9e71afc..81ac58d 100644 --- a/sys/contrib/dev/acpica/CHANGES.txt +++ b/sys/contrib/dev/acpica/CHANGES.txt @@ -1,4 +1,51 @@ ---------------------------------------- +27 May 2004. Summary of changes for version 20040527: + +1) ACPI CA Core Subsystem: + +Completed a new design and implementation for EBDA (Extended BIOS +Data Area) support in the RSDP scan code. The original code +improperly scanned for the EBDA by simply scanning from memory +location 0 to 0x400. The correct method is to first obtain the +EBDA pointer from within the BIOS data area, then scan 1K of +memory starting at the EBDA pointer. There appear to be few if +any machines that place the RSDP in the EBDA, however. + +Integrated a fix for a possible fault during evaluation of +BufferField arguments. Obsolete code that was causing the +problem was removed. + +Found and fixed a problem in the Field Support Code where data +could be corrupted on a bit field read that starts on an aligned +boundary but does not end on an aligned boundary. Merged the +read/write "datum length" calculation code into a common +procedure. + +Rolled in a couple of changes to the FreeBSD-specific header. + +Code and Data Size: Current and previous core subsystem library +sizes are shown below. These are the code and data sizes for the +acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and +these values do not include any ACPI driver or OSPM code. The +debug version of the code includes the debug output trace +mechanism and has a much larger code and data size. Note that +these values will vary depending on the efficiency of the +compiler and the compiler options used during generation. + + Previous Release: + Non-Debug Version: 77.6K Code, 11.5K Data, 89.1K Total + Debug Version: 163.2K Code, 67.2K Data, 230.4K Total + Current Release: + Non-Debug Version: 77.7K Code, 11.5K Data, 89.2K Total + Debug Version: 163.3K Code, 67.2K Data, 230.5K Total + + +2) iASL Compiler/Disassembler: + +Fixed a generation warning produced by some overly-verbose +compilers for a 64-bit constant. + +---------------------------------------- 14 May 2004. Summary of changes for version 20040514: 1) ACPI CA Core Subsystem: diff --git a/sys/contrib/dev/acpica/acconfig.h b/sys/contrib/dev/acpica/acconfig.h index f88098b..a953ca6 100644 --- a/sys/contrib/dev/acpica/acconfig.h +++ b/sys/contrib/dev/acpica/acconfig.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acconfig.h - Global configuration constants - * $Revision: 156 $ + * $Revision: 158 $ * *****************************************************************************/ @@ -137,7 +137,7 @@ /* Version string */ -#define ACPI_CA_VERSION 0x20040514 +#define ACPI_CA_VERSION 0x20040527 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, @@ -151,7 +151,7 @@ /* Maximum objects in the various object caches */ -#define ACPI_MAX_STATE_CACHE_DEPTH 64 /* State objects for stacks */ +#define ACPI_MAX_STATE_CACHE_DEPTH 64 /* State objects */ #define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */ #define ACPI_MAX_EXTPARSE_CACHE_DEPTH 64 /* Parse tree objects */ #define ACPI_MAX_OBJECT_CACHE_DEPTH 64 /* Interpreter operand objects */ @@ -235,10 +235,11 @@ /* Constants used in searching for the RSDP in low memory */ -#define ACPI_LO_RSDP_WINDOW_BASE 0 /* Physical Address */ -#define ACPI_HI_RSDP_WINDOW_BASE 0xE0000 /* Physical Address */ -#define ACPI_LO_RSDP_WINDOW_SIZE 0x400 -#define ACPI_HI_RSDP_WINDOW_SIZE 0x20000 +#define ACPI_EBDA_PTR_LOCATION 0x0000040E /* Physical Address */ +#define ACPI_EBDA_PTR_LENGTH 2 +#define ACPI_EBDA_WINDOW_SIZE 1024 +#define ACPI_HI_RSDP_WINDOW_BASE 0x000E0000 /* Physical Address */ +#define ACPI_HI_RSDP_WINDOW_SIZE 0x00020000 #define ACPI_RSDP_SCAN_STEP 16 /* Operation regions */ diff --git a/sys/contrib/dev/acpica/acfreebsd.h b/sys/contrib/dev/acpica/acfreebsd.h index 447d0f6..3ffaccb 100644 --- a/sys/contrib/dev/acpica/acfreebsd.h +++ b/sys/contrib/dev/acpica/acfreebsd.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acfreebsd.h - OS specific defines, etc. - * $Revision: 15 $ + * $Revision: 17 $ * *****************************************************************************/ @@ -121,6 +121,7 @@ /* FreeBSD uses GCC */ #include "acgcc.h" +#include <sys/types.h> #include <machine/acpica_machdep.h> #ifdef _KERNEL @@ -155,7 +156,10 @@ /* Not building kernel code, so use libc */ #define ACPI_USE_STANDARD_HEADERS #define ACPI_FLUSH_CPU_CACHE() -#include <sys/types.h> + +#if __STDC_HOSTED__ +#include <ctype.h> +#endif #define __cli() #define __sti() diff --git a/sys/contrib/dev/acpica/acinterp.h b/sys/contrib/dev/acpica/acinterp.h index a0f19a1..29ef907 100644 --- a/sys/contrib/dev/acpica/acinterp.h +++ b/sys/contrib/dev/acpica/acinterp.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acinterp.h - Interpreter subcomponent prototypes and defines - * $Revision: 148 $ + * $Revision: 149 $ * *****************************************************************************/ @@ -191,6 +191,12 @@ AcpiExConvertToAscii ( */ ACPI_STATUS +AcpiExCommonBufferSetup ( + ACPI_OPERAND_OBJECT *ObjDesc, + UINT32 BufferLength, + UINT32 *DatumCount); + +ACPI_STATUS AcpiExExtractFromField ( ACPI_OPERAND_OBJECT *ObjDesc, void *Buffer, diff --git a/sys/contrib/dev/acpica/acmacros.h b/sys/contrib/dev/acpica/acmacros.h index 9f577d6..6eb509d 100644 --- a/sys/contrib/dev/acpica/acmacros.h +++ b/sys/contrib/dev/acpica/acmacros.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acmacros.h - C macros for the entire subsystem. - * $Revision: 150 $ + * $Revision: 151 $ * *****************************************************************************/ @@ -126,6 +126,9 @@ #define ACPI_LOBYTE(l) ((UINT8)(UINT16)(l)) #define ACPI_HIBYTE(l) ((UINT8)((((UINT16)(l)) >> 8) & 0xFF)) +#define ACPI_SET_BIT(target,bit) ((target) |= (bit)) +#define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit)) + #if ACPI_MACHINE_WIDTH == 16 diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.y b/sys/contrib/dev/acpica/compiler/aslcompiler.y index 18fe3af..a3cbf5a 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompiler.y +++ b/sys/contrib/dev/acpica/compiler/aslcompiler.y @@ -2252,7 +2252,7 @@ QWordConstExpr ConstExprTerm : PARSEOP_ZERO {$$ = TrCreateValuedLeafNode (PARSEOP_ZERO, 0);} | PARSEOP_ONE {$$ = TrCreateValuedLeafNode (PARSEOP_ONE, 1);} - | PARSEOP_ONES {$$ = TrCreateValuedLeafNode (PARSEOP_ONES, 0xFFFFFFFFFFFFFFFFull);} + | PARSEOP_ONES {$$ = TrCreateValuedLeafNode (PARSEOP_ONES, ACPI_INTEGER_MAX);} ; /* OptionalCount must appear before ByteList or an incorrect reduction will result */ diff --git a/sys/contrib/dev/acpica/dbcmds.c b/sys/contrib/dev/acpica/dbcmds.c index 33c6e6b..8e91e5e 100644 --- a/sys/contrib/dev/acpica/dbcmds.c +++ b/sys/contrib/dev/acpica/dbcmds.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbcmds - debug commands and output routines - * $Revision: 112 $ + * $Revision: 113 $ * ******************************************************************************/ @@ -161,6 +161,9 @@ ACPI_STATUS AcpiDbSleep ( char *ObjectArg) { +#if ACPI_MACHINE_WIDTH == 16 + return (AE_OK); +#else ACPI_STATUS Status; UINT8 SleepState; @@ -185,6 +188,7 @@ AcpiDbSleep ( Status = AcpiLeaveSleepState (SleepState); return (Status); +#endif } diff --git a/sys/contrib/dev/acpica/dbdisply.c b/sys/contrib/dev/acpica/dbdisply.c index 0dd6396..38476f2 100644 --- a/sys/contrib/dev/acpica/dbdisply.c +++ b/sys/contrib/dev/acpica/dbdisply.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbdisply - debug display commands - * $Revision: 105 $ + * $Revision: 106 $ * ******************************************************************************/ @@ -824,8 +824,8 @@ AcpiDbDisplayGpes (void) (GpeBlock->RegisterCount * 8) -1); AcpiOsPrintf (" RegisterInfo: %p Status %8.8X%8.8X Enable %8.8X%8.8X\n", GpeBlock->RegisterInfo, - ACPI_FORMAT_UINT64 (GpeBlock->RegisterInfo->StatusAddress.Address), - ACPI_FORMAT_UINT64 (GpeBlock->RegisterInfo->EnableAddress.Address)); + ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeBlock->RegisterInfo->StatusAddress.Address)), + ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeBlock->RegisterInfo->EnableAddress.Address))); AcpiOsPrintf (" EventInfo: %p\n", GpeBlock->EventInfo); /* Examine each GPE Register within the block */ @@ -838,8 +838,8 @@ AcpiDbDisplayGpes (void) " Reg %u: WakeEnable %2.2X, RunEnable %2.2X Status %8.8X%8.8X Enable %8.8X%8.8X\n", i, GpeRegisterInfo->EnableForWake, GpeRegisterInfo->EnableForRun, - ACPI_FORMAT_UINT64 (GpeRegisterInfo->StatusAddress.Address), - ACPI_FORMAT_UINT64 (GpeRegisterInfo->EnableAddress.Address)); + ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeRegisterInfo->StatusAddress.Address)), + ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeRegisterInfo->EnableAddress.Address))); /* Now look at the individual GPEs in this byte register */ diff --git a/sys/contrib/dev/acpica/dsopcode.c b/sys/contrib/dev/acpica/dsopcode.c index 5ccabb6..6a69e4a 100644 --- a/sys/contrib/dev/acpica/dsopcode.c +++ b/sys/contrib/dev/acpica/dsopcode.c @@ -2,7 +2,7 @@ * * Module Name: dsopcode - Dispatcher Op Region support and handling of * "control" opcodes - * $Revision: 94 $ + * $Revision: 95 $ * *****************************************************************************/ @@ -153,7 +153,6 @@ AcpiDsExecuteArguments ( ACPI_STATUS Status; ACPI_PARSE_OBJECT *Op; ACPI_WALK_STATE *WalkState; - ACPI_PARSE_OBJECT *Arg; ACPI_FUNCTION_TRACE ("DsExecuteArguments"); @@ -204,9 +203,7 @@ AcpiDsExecuteArguments ( /* Get and init the Op created above */ - Arg = Op->Common.Value.Arg; Op->Common.Node = Node; - Arg->Common.Node = Node; AcpiPsDeleteParseTree (Op); /* Evaluate the deferred arguments */ diff --git a/sys/contrib/dev/acpica/evgpe.c b/sys/contrib/dev/acpica/evgpe.c index 77ac5cd..f191d44 100644 --- a/sys/contrib/dev/acpica/evgpe.c +++ b/sys/contrib/dev/acpica/evgpe.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evgpe - General Purpose Event handling and dispatch - * $Revision: 40 $ + * $Revision: 42 $ * *****************************************************************************/ @@ -206,28 +206,28 @@ AcpiEvUpdateGpeEnableMasks ( if (Type == ACPI_GPE_DISABLE) { - GpeRegisterInfo->EnableForWake &= ~RegisterBit; - GpeRegisterInfo->EnableForRun &= ~RegisterBit; + ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForWake, RegisterBit); + ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForRun, RegisterBit); return_ACPI_STATUS (AE_OK); } - /* 2) Enable case. Set the appropriate enable bits */ + /* 2) Enable case. Set/Clear the appropriate enable bits */ switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK) { case ACPI_GPE_TYPE_WAKE: - GpeRegisterInfo->EnableForWake |= RegisterBit; - GpeRegisterInfo->EnableForRun &= ~RegisterBit; + ACPI_SET_BIT (GpeRegisterInfo->EnableForWake, RegisterBit); + ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForRun, RegisterBit); break; case ACPI_GPE_TYPE_RUNTIME: - GpeRegisterInfo->EnableForWake &= ~RegisterBit; - GpeRegisterInfo->EnableForRun |= RegisterBit; + ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForWake, RegisterBit); + ACPI_SET_BIT (GpeRegisterInfo->EnableForRun, RegisterBit); break; case ACPI_GPE_TYPE_WAKE_RUN: - GpeRegisterInfo->EnableForWake |= RegisterBit; - GpeRegisterInfo->EnableForRun |= RegisterBit; + ACPI_SET_BIT (GpeRegisterInfo->EnableForWake, RegisterBit); + ACPI_SET_BIT (GpeRegisterInfo->EnableForRun, RegisterBit); break; default: @@ -274,17 +274,19 @@ AcpiEvEnableGpe ( switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK) { case ACPI_GPE_TYPE_WAKE: - GpeEventInfo->Flags |= ACPI_GPE_WAKE_ENABLED; + + ACPI_SET_BIT (GpeEventInfo->Flags, ACPI_GPE_WAKE_ENABLED); break; case ACPI_GPE_TYPE_WAKE_RUN: - GpeEventInfo->Flags |= ACPI_GPE_WAKE_ENABLED; + + ACPI_SET_BIT (GpeEventInfo->Flags, ACPI_GPE_WAKE_ENABLED); /*lint -fallthrough */ case ACPI_GPE_TYPE_RUNTIME: - GpeEventInfo->Flags |= ACPI_GPE_RUN_ENABLED; + ACPI_SET_BIT (GpeEventInfo->Flags, ACPI_GPE_RUN_ENABLED); if (WriteToHardware) { @@ -350,11 +352,11 @@ AcpiEvDisableGpe ( switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK) { case ACPI_GPE_TYPE_WAKE: - GpeEventInfo->Flags &= ~ACPI_GPE_WAKE_ENABLED; + ACPI_CLEAR_BIT (GpeEventInfo->Flags, ACPI_GPE_WAKE_ENABLED); break; case ACPI_GPE_TYPE_WAKE_RUN: - GpeEventInfo->Flags &= ~ACPI_GPE_WAKE_ENABLED; + ACPI_CLEAR_BIT (GpeEventInfo->Flags, ACPI_GPE_WAKE_ENABLED); /*lint -fallthrough */ @@ -362,7 +364,7 @@ AcpiEvDisableGpe ( /* Disable the requested runtime GPE */ - GpeEventInfo->Flags &= ~ACPI_GPE_RUN_ENABLED; + ACPI_CLEAR_BIT (GpeEventInfo->Flags, ACPI_GPE_RUN_ENABLED); Status = AcpiHwWriteGpeEnableReg (GpeEventInfo); break; @@ -721,11 +723,11 @@ AcpiEvGpeDispatch ( if (AcpiGbl_SystemAwakeAndRunning) { - GpeEventInfo->Flags |= ACPI_GPE_SYSTEM_RUNNING; + ACPI_SET_BIT (GpeEventInfo->Flags, ACPI_GPE_SYSTEM_RUNNING); } else { - GpeEventInfo->Flags &= ~ACPI_GPE_SYSTEM_RUNNING; + ACPI_CLEAR_BIT (GpeEventInfo->Flags, ACPI_GPE_SYSTEM_RUNNING); } /* @@ -739,9 +741,11 @@ AcpiEvGpeDispatch ( { case ACPI_GPE_DISPATCH_HANDLER: - /* Invoke the installed handler (at interrupt level) */ - - GpeEventInfo->Dispatch.Handler->Address ((void *) + /* + * Invoke the installed handler (at interrupt level) + * Ignore return status for now. TBD: leave GPE disabled on error? + */ + (void) GpeEventInfo->Dispatch.Handler->Address ( GpeEventInfo->Dispatch.Handler->Context); /* It is now safe to clear level-triggered events. */ diff --git a/sys/contrib/dev/acpica/evgpeblk.c b/sys/contrib/dev/acpica/evgpeblk.c index b34cbe9..cc8d380 100644 --- a/sys/contrib/dev/acpica/evgpeblk.c +++ b/sys/contrib/dev/acpica/evgpeblk.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evgpeblk - GPE block creation and initialization. - * $Revision: 34 $ + * $Revision: 36 $ * *****************************************************************************/ @@ -1102,8 +1102,8 @@ AcpiEvCreateGpeBlock ( /* Dump info about this GPE block */ ACPI_DEBUG_PRINT ((ACPI_DB_INIT, - "GPE %02d to %02d [%4.4s] %d regs at %8.8X%8.8X on int %d\n", - GpeBlock->BlockBaseNumber, + "GPE %02X to %02X [%4.4s] %u regs at %8.8X%8.8X on int 0x%X\n", + (UINT32) GpeBlock->BlockBaseNumber, (UINT32) (GpeBlock->BlockBaseNumber + ((GpeBlock->RegisterCount * ACPI_GPE_REGISTER_WIDTH) -1)), GpeDevice->Name.Ascii, diff --git a/sys/contrib/dev/acpica/exconfig.c b/sys/contrib/dev/acpica/exconfig.c index e3ed108..4686b4a 100644 --- a/sys/contrib/dev/acpica/exconfig.c +++ b/sys/contrib/dev/acpica/exconfig.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes) - * $Revision: 77 $ + * $Revision: 78 $ * *****************************************************************************/ @@ -415,7 +415,7 @@ AcpiExLoadOp ( for (i = 0; i < 8; i++) { Status = AcpiEvAddressSpaceDispatch (ObjDesc, ACPI_READ, - (ACPI_PHYSICAL_ADDRESS) i + Address, 8, + (ACPI_PHYSICAL_ADDRESS) (i + Address), 8, ((UINT8 *) &TableHeader) + i); if (ACPI_FAILURE (Status)) { @@ -443,7 +443,7 @@ AcpiExLoadOp ( for (i = 0; i < TableHeader.Length; i++) { Status = AcpiEvAddressSpaceDispatch (ObjDesc, ACPI_READ, - (ACPI_PHYSICAL_ADDRESS) i + Address, 8, + (ACPI_PHYSICAL_ADDRESS) (i + Address), 8, ((UINT8 *) TablePtr + i)); if (ACPI_FAILURE (Status)) { diff --git a/sys/contrib/dev/acpica/exfldio.c b/sys/contrib/dev/acpica/exfldio.c index b3dddc2..4c9a1f1 100644 --- a/sys/contrib/dev/acpica/exfldio.c +++ b/sys/contrib/dev/acpica/exfldio.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exfldio - Aml Field I/O - * $Revision: 104 $ + * $Revision: 106 $ * *****************************************************************************/ @@ -846,14 +846,84 @@ AcpiExSetBufferDatum ( /******************************************************************************* * + * FUNCTION: AcpiExCommonBufferSetup + * + * PARAMETERS: ObjDesc - Field object + * BufferLength - Length of caller's buffer + * DatumCount - Where the DatumCount is returned + * + * RETURN: Status, DatumCount + * + * DESCRIPTION: Common code to validate the incoming buffer size and compute + * the number of field "datums" that must be read or written. + * A "datum" is the smallest unit that can be read or written + * to the field, it is either 1,2,4, or 8 bytes. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiExCommonBufferSetup ( + ACPI_OPERAND_OBJECT *ObjDesc, + UINT32 BufferLength, + UINT32 *DatumCount) +{ + UINT32 ByteFieldLength; + UINT32 ActualByteFieldLength; + + + ACPI_FUNCTION_TRACE ("ExCommonBufferSetup"); + + + /* + * Incoming buffer must be at least as long as the field, we do not + * allow "partial" field reads/writes. We do not care if the buffer is + * larger than the field, this typically happens when an integer is + * read/written to a field that is actually smaller than an integer. + */ + ByteFieldLength = ACPI_ROUND_BITS_UP_TO_BYTES ( + ObjDesc->CommonField.BitLength); + if (ByteFieldLength > BufferLength) + { + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, + "Field size %X (bytes) is too large for buffer (%X)\n", + ByteFieldLength, BufferLength)); + + return_ACPI_STATUS (AE_BUFFER_OVERFLOW); + } + + /* + * Create "actual" field byte count (minimum number of bytes that + * must be read), then convert to datum count (minimum number + * of datum-sized units that must be read) + */ + ActualByteFieldLength = ACPI_ROUND_BITS_UP_TO_BYTES ( + ObjDesc->CommonField.StartFieldBitOffset + + ObjDesc->CommonField.BitLength); + + + *DatumCount = ACPI_ROUND_UP_TO (ActualByteFieldLength, + ObjDesc->CommonField.AccessByteWidth); + + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, + "BufferBytes %X, ActualBytes %X, Datums %X, ByteGran %X\n", + ByteFieldLength, ActualByteFieldLength, + *DatumCount, ObjDesc->CommonField.AccessByteWidth)); + + return_ACPI_STATUS (AE_OK); +} + + +/******************************************************************************* + * * FUNCTION: AcpiExExtractFromField * - * PARAMETERS: *ObjDesc - Field to be read - * *Value - Where to store value + * PARAMETERS: ObjDesc - Field to be read + * Buffer - Where to store the field data + * BufferLength - Length of Buffer * * RETURN: Status * - * DESCRIPTION: Retrieve the value of the given field + * DESCRIPTION: Retrieve the current value of the given field * ******************************************************************************/ @@ -869,7 +939,6 @@ AcpiExExtractFromField ( ACPI_INTEGER PreviousRawDatum = 0; ACPI_INTEGER ThisRawDatum = 0; ACPI_INTEGER MergedDatum = 0; - UINT32 ByteFieldLength; UINT32 DatumCount; UINT32 i; @@ -877,41 +946,14 @@ AcpiExExtractFromField ( ACPI_FUNCTION_TRACE ("ExExtractFromField"); - /* - * The field must fit within the caller's buffer - */ - ByteFieldLength = ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength); - if (ByteFieldLength > BufferLength) - { - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Field size %X (bytes) too large for buffer (%X)\n", - ByteFieldLength, BufferLength)); - - return_ACPI_STATUS (AE_BUFFER_OVERFLOW); - } - - /* Convert field byte count to datum count, round up if necessary */ - - DatumCount = ACPI_ROUND_UP_TO (ByteFieldLength, - ObjDesc->CommonField.AccessByteWidth); + /* Validate buffer, compute number of datums */ - /* - * If the field is not aligned on a datum boundary and does not - * fit within a single datum, we must read an extra datum. - * - * We could just split the aligned and non-aligned cases since the - * aligned case is so very simple, but this would require more code. - */ - if ((ObjDesc->CommonField.EndFieldValidBits != 0) && - (!(ObjDesc->CommonField.Flags & AOPOBJ_SINGLE_DATUM))) + Status = AcpiExCommonBufferSetup (ObjDesc, BufferLength, &DatumCount); + if (ACPI_FAILURE (Status)) { - DatumCount++; + return_ACPI_STATUS (Status); } - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "ByteLen %X, DatumLen %X, ByteGran %X\n", - ByteFieldLength, DatumCount,ObjDesc->CommonField.AccessByteWidth)); - /* * Clear the caller's buffer (the whole buffer length as given) * This is very important, especially in the cases where the buffer @@ -1033,12 +1075,13 @@ AcpiExExtractFromField ( * * FUNCTION: AcpiExInsertIntoField * - * PARAMETERS: *ObjDesc - Field to be set - * Buffer - Value to store + * PARAMETERS: ObjDesc - Field to be written + * Buffer - Data to be written + * BufferLength - Length of Buffer * * RETURN: Status * - * DESCRIPTION: Store the value into the given field + * DESCRIPTION: Store the Buffer contents into the given field * ******************************************************************************/ @@ -1055,43 +1098,20 @@ AcpiExInsertIntoField ( ACPI_INTEGER MergedDatum; ACPI_INTEGER PreviousRawDatum; ACPI_INTEGER ThisRawDatum; - UINT32 ByteFieldLength; UINT32 DatumCount; ACPI_FUNCTION_TRACE ("ExInsertIntoField"); - /* - * Incoming buffer must be at least as long as the field, we do not - * allow "partial" field writes. We do not care if the buffer is - * larger than the field, this typically happens when an integer is - * written to a field that is actually smaller than an integer. - */ - ByteFieldLength = ACPI_ROUND_BITS_UP_TO_BYTES ( - ObjDesc->CommonField.BitLength); - if (BufferLength < ByteFieldLength) - { - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Buffer length %X too small for field %X\n", - BufferLength, ByteFieldLength)); + /* Validate buffer, compute number of datums */ - return_ACPI_STATUS (AE_BUFFER_OVERFLOW); + Status = AcpiExCommonBufferSetup (ObjDesc, BufferLength, &DatumCount); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); } - ByteFieldLength = ACPI_ROUND_BITS_UP_TO_BYTES ( - ObjDesc->CommonField.StartFieldBitOffset + - ObjDesc->CommonField.BitLength); - - /* Convert byte count to datum count, round up if necessary */ - - DatumCount = ACPI_ROUND_UP_TO (ByteFieldLength, - ObjDesc->CommonField.AccessByteWidth); - - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Bytes %X, Datums %X, ByteGran %X\n", - ByteFieldLength, DatumCount, ObjDesc->CommonField.AccessByteWidth)); - /* * Break the request into up to three parts (similar to an I/O request): * 1) non-aligned part at start diff --git a/sys/contrib/dev/acpica/tbxfroot.c b/sys/contrib/dev/acpica/tbxfroot.c index 01b9dd3..4356602 100644 --- a/sys/contrib/dev/acpica/tbxfroot.c +++ b/sys/contrib/dev/acpica/tbxfroot.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbxfroot - Find the root ACPI table (RSDT) - * $Revision: 72 $ + * $Revision: 73 $ * *****************************************************************************/ @@ -486,14 +486,17 @@ AcpiTbScanMemoryForRsdp ( * Flags - Current memory mode (logical vs. * physical addressing) * - * RETURN: Status + * RETURN: Status, RSDP physical address * * DESCRIPTION: Search lower 1Mbyte of memory for the root system descriptor * pointer structure. If it is found, set *RSDP to point to it. * - * NOTE: The RSDP must be either in the first 1K of the Extended - * BIOS Data Area or between E0000 and FFFFF (ACPI 1.0 section - * 5.2.2; assertion #421). + * NOTE1: The RSDP must be either in the first 1K of the Extended + * BIOS Data Area or between E0000 and FFFFF (From ACPI Spec.) + * Only a 32-bit physical address is necessary. + * + * NOTE2: This function is always available, regardless of the + * initialization state of the rest of ACPI. * ******************************************************************************/ @@ -504,8 +507,8 @@ AcpiTbFindRsdp ( { UINT8 *TablePtr; UINT8 *MemRover; - UINT64 PhysAddr; - ACPI_STATUS Status = AE_OK; + UINT32 PhysicalAddress; + ACPI_STATUS Status; ACPI_FUNCTION_TRACE ("TbFindRsdp"); @@ -517,39 +520,62 @@ AcpiTbFindRsdp ( if ((Flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { /* - * 1) Search EBDA (low memory) paragraphs + * 1a) Get the location of the EBDA */ - Status = AcpiOsMapMemory ((UINT64) ACPI_LO_RSDP_WINDOW_BASE, ACPI_LO_RSDP_WINDOW_SIZE, + Status = AcpiOsMapMemory ((ACPI_PHYSICAL_ADDRESS) ACPI_EBDA_PTR_LOCATION, + ACPI_EBDA_PTR_LENGTH, (void *) &TablePtr); if (ACPI_FAILURE (Status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %X for length %X\n", - ACPI_LO_RSDP_WINDOW_BASE, ACPI_LO_RSDP_WINDOW_SIZE)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %8.8X for length %X\n", + ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH)); return_ACPI_STATUS (Status); } - MemRover = AcpiTbScanMemoryForRsdp (TablePtr, ACPI_LO_RSDP_WINDOW_SIZE); - AcpiOsUnmapMemory (TablePtr, ACPI_LO_RSDP_WINDOW_SIZE); + ACPI_MOVE_16_TO_32 (&PhysicalAddress, TablePtr); + PhysicalAddress <<= 4; /* Convert segment to physical address */ + AcpiOsUnmapMemory (TablePtr, ACPI_EBDA_PTR_LENGTH); - if (MemRover) + /* EBDA present? */ + + if (PhysicalAddress > 0x400) { - /* Found it, return the physical address */ + /* + * 1b) Search EBDA paragraphs (EBDA is required to be a minimum of 1K length) + */ + Status = AcpiOsMapMemory ((ACPI_PHYSICAL_ADDRESS) PhysicalAddress, + ACPI_EBDA_WINDOW_SIZE, + (void *) &TablePtr); + if (ACPI_FAILURE (Status)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %8.8X for length %X\n", + PhysicalAddress, ACPI_EBDA_WINDOW_SIZE)); + return_ACPI_STATUS (Status); + } - PhysAddr = ACPI_LO_RSDP_WINDOW_BASE; - PhysAddr += ACPI_PTR_DIFF (MemRover,TablePtr); + MemRover = AcpiTbScanMemoryForRsdp (TablePtr, ACPI_EBDA_WINDOW_SIZE); + AcpiOsUnmapMemory (TablePtr, ACPI_EBDA_WINDOW_SIZE); - TableInfo->PhysicalAddress = PhysAddr; - return_ACPI_STATUS (AE_OK); + if (MemRover) + { + /* Found it, return the physical address */ + + PhysicalAddress += ACPI_PTR_DIFF (MemRover, TablePtr); + + TableInfo->PhysicalAddress = (ACPI_PHYSICAL_ADDRESS) PhysicalAddress; + return_ACPI_STATUS (AE_OK); + } } /* - * 2) Search upper memory: 16-byte boundaries in E0000h-F0000h + * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh */ - Status = AcpiOsMapMemory ((UINT64) ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE, + Status = AcpiOsMapMemory ((ACPI_PHYSICAL_ADDRESS) ACPI_HI_RSDP_WINDOW_BASE, + ACPI_HI_RSDP_WINDOW_SIZE, (void *) &TablePtr); if (ACPI_FAILURE (Status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %X for length %X\n", + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %8.8X for length %X\n", ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE)); return_ACPI_STATUS (Status); } @@ -561,10 +587,9 @@ AcpiTbFindRsdp ( { /* Found it, return the physical address */ - PhysAddr = ACPI_HI_RSDP_WINDOW_BASE; - PhysAddr += ACPI_PTR_DIFF (MemRover, TablePtr); + PhysicalAddress = ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (MemRover, TablePtr); - TableInfo->PhysicalAddress = PhysAddr; + TableInfo->PhysicalAddress = (ACPI_PHYSICAL_ADDRESS) PhysicalAddress; return_ACPI_STATUS (AE_OK); } } @@ -575,20 +600,31 @@ AcpiTbFindRsdp ( else { /* - * 1) Search EBDA (low memory) paragraphs + * 1a) Get the location of the EBDA */ - MemRover = AcpiTbScanMemoryForRsdp (ACPI_PHYSADDR_TO_PTR (ACPI_LO_RSDP_WINDOW_BASE), - ACPI_LO_RSDP_WINDOW_SIZE); - if (MemRover) + ACPI_MOVE_16_TO_32 (&PhysicalAddress, ACPI_EBDA_PTR_LOCATION); + PhysicalAddress <<= 4; /* Convert segment to physical address */ + + /* EBDA present? */ + + if (PhysicalAddress > 0x400) { - /* Found it, return the physical address */ + /* + * 1b) Search EBDA paragraphs (EBDA is required to be a minimum of 1K length) + */ + MemRover = AcpiTbScanMemoryForRsdp (ACPI_PHYSADDR_TO_PTR (PhysicalAddress), + ACPI_EBDA_WINDOW_SIZE); + if (MemRover) + { + /* Found it, return the physical address */ - TableInfo->PhysicalAddress = ACPI_TO_INTEGER (MemRover); - return_ACPI_STATUS (AE_OK); + TableInfo->PhysicalAddress = ACPI_TO_INTEGER (MemRover); + return_ACPI_STATUS (AE_OK); + } } /* - * 2) Search upper memory: 16-byte boundaries in E0000h-F0000h + * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh */ MemRover = AcpiTbScanMemoryForRsdp (ACPI_PHYSADDR_TO_PTR (ACPI_HI_RSDP_WINDOW_BASE), ACPI_HI_RSDP_WINDOW_SIZE); |