diff options
| author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2012-05-04 16:49:54 +0000 |
|---|---|---|
| committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2012-05-04 16:49:54 +0000 |
| commit | 435bba8aa5d73ccd0b9ec7c79e28bec795904992 (patch) | |
| tree | 5c8d2be08b8e0ad06f44ecdd188641a0eca265dd /usr/src/uts/intel/io/acpica/tables | |
| parent | 9961023fd01212c8ab13953b1510e4d00368c995 (diff) | |
| download | illumos-joyent-435bba8aa5d73ccd0b9ec7c79e28bec795904992.tar.gz | |
OS-1149 update to latest acpica release; transition to ACPI 5.0
Diffstat (limited to 'usr/src/uts/intel/io/acpica/tables')
| -rw-r--r-- | usr/src/uts/intel/io/acpica/tables/tbfadt.c | 54 | ||||
| -rw-r--r-- | usr/src/uts/intel/io/acpica/tables/tbfind.c | 2 | ||||
| -rw-r--r-- | usr/src/uts/intel/io/acpica/tables/tbinstal.c | 121 | ||||
| -rw-r--r-- | usr/src/uts/intel/io/acpica/tables/tbutils.c | 103 | ||||
| -rw-r--r-- | usr/src/uts/intel/io/acpica/tables/tbxface.c | 2 | ||||
| -rw-r--r-- | usr/src/uts/intel/io/acpica/tables/tbxfroot.c | 2 |
6 files changed, 204 insertions, 80 deletions
diff --git a/usr/src/uts/intel/io/acpica/tables/tbfadt.c b/usr/src/uts/intel/io/acpica/tables/tbfadt.c index f8c63408b9..e877320447 100644 --- a/usr/src/uts/intel/io/acpica/tables/tbfadt.c +++ b/usr/src/uts/intel/io/acpica/tables/tbfadt.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -77,14 +77,15 @@ AcpiTbSetupFadtRegisters ( typedef struct acpi_fadt_info { char *Name; - UINT8 Address64; - UINT8 Address32; - UINT8 Length; + UINT16 Address64; + UINT16 Address32; + UINT16 Length; UINT8 DefaultLength; UINT8 Type; } ACPI_FADT_INFO; +#define ACPI_FADT_OPTIONAL 0 #define ACPI_FADT_REQUIRED 1 #define ACPI_FADT_SEPARATE_LENGTH 2 @@ -102,7 +103,7 @@ static ACPI_FADT_INFO FadtInfoTable[] = ACPI_FADT_OFFSET (Pm1bEventBlock), ACPI_FADT_OFFSET (Pm1EventLength), ACPI_PM1_REGISTER_WIDTH * 2, /* Enable + Status register */ - 0}, + ACPI_FADT_OPTIONAL}, {"Pm1aControlBlock", ACPI_FADT_OFFSET (XPm1aControlBlock), @@ -116,7 +117,7 @@ static ACPI_FADT_INFO FadtInfoTable[] = ACPI_FADT_OFFSET (Pm1bControlBlock), ACPI_FADT_OFFSET (Pm1ControlLength), ACPI_PM1_REGISTER_WIDTH, - 0}, + ACPI_FADT_OPTIONAL}, {"Pm2ControlBlock", ACPI_FADT_OFFSET (XPm2ControlBlock), @@ -156,7 +157,7 @@ static ACPI_FADT_INFO FadtInfoTable[] = typedef struct acpi_fadt_pm_info { ACPI_GENERIC_ADDRESS *Target; - UINT8 Source; + UINT16 Source; UINT8 RegisterNum; } ACPI_FADT_PM_INFO; @@ -280,8 +281,13 @@ AcpiTbParseFadt ( AcpiTbInstallTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XDsdt, ACPI_SIG_DSDT, ACPI_TABLE_INDEX_DSDT); - AcpiTbInstallTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs, - ACPI_SIG_FACS, ACPI_TABLE_INDEX_FACS); + /* If Hardware Reduced flag is set, there is no FACS */ + + if (!AcpiGbl_ReducedHardware) + { + AcpiTbInstallTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs, + ACPI_SIG_FACS, ACPI_TABLE_INDEX_FACS); + } } @@ -309,13 +315,13 @@ AcpiTbCreateLocalFadt ( /* * Check if the FADT is larger than the largest table that we expect - * (the ACPI 2.0/3.0 version). If so, truncate the table, and issue + * (the ACPI 5.0 version). If so, truncate the table, and issue * a warning. */ if (Length > sizeof (ACPI_TABLE_FADT)) { ACPI_WARNING ((AE_INFO, - "FADT (revision %u) is longer than ACPI 2.0 version, " + "FADT (revision %u) is longer than ACPI 5.0 version, " "truncating length %u to %u", Table->Revision, Length, (UINT32) sizeof (ACPI_TABLE_FADT))); } @@ -329,6 +335,14 @@ AcpiTbCreateLocalFadt ( ACPI_MEMCPY (&AcpiGbl_FADT, Table, ACPI_MIN (Length, sizeof (ACPI_TABLE_FADT))); + /* Take a copy of the Hardware Reduced flag */ + + AcpiGbl_ReducedHardware = FALSE; + if (AcpiGbl_FADT.Flags & ACPI_FADT_HW_REDUCED) + { + AcpiGbl_ReducedHardware = TRUE; + } + /* Convert the local copy of the FADT to the common internal format */ AcpiTbConvertFadt (); @@ -386,10 +400,6 @@ AcpiTbConvertFadt ( UINT32 i; - /* Update the local FADT table header length */ - - AcpiGbl_FADT.Header.Length = sizeof (ACPI_TABLE_FADT); - /* * Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary. * Later code will always use the X 64-bit field. @@ -423,6 +433,13 @@ AcpiTbConvertFadt ( } /* + * Now we can update the local FADT length to the length of the + * current FADT version as defined by the ACPI specification. + * Thus, we will have a common FADT internally. + */ + AcpiGbl_FADT.Header.Length = sizeof (ACPI_TABLE_FADT); + + /* * Expand the ACPI 1.0 32-bit addresses to the ACPI 2.0 64-bit "X" * generic address structures as necessary. Later code will always use * the 64-bit address structures. @@ -530,6 +547,13 @@ AcpiTbValidateFadt ( AcpiGbl_FADT.XDsdt = (UINT64) AcpiGbl_FADT.Dsdt; } + /* If Hardware Reduced flag is set, we are all done */ + + if (AcpiGbl_ReducedHardware) + { + return; + } + /* Examine all of the 64-bit extended address fields (X fields) */ for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) diff --git a/usr/src/uts/intel/io/acpica/tables/tbfind.c b/usr/src/uts/intel/io/acpica/tables/tbfind.c index 3b7c420f01..d7e2440b32 100644 --- a/usr/src/uts/intel/io/acpica/tables/tbfind.c +++ b/usr/src/uts/intel/io/acpica/tables/tbfind.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/usr/src/uts/intel/io/acpica/tables/tbinstal.c b/usr/src/uts/intel/io/acpica/tables/tbinstal.c index ab69691a1e..f100ab43f7 100644 --- a/usr/src/uts/intel/io/acpica/tables/tbinstal.c +++ b/usr/src/uts/intel/io/acpica/tables/tbinstal.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -128,7 +128,6 @@ AcpiTbAddTable ( { UINT32 i; ACPI_STATUS Status = AE_OK; - ACPI_TABLE_HEADER *OverrideTable = NULL; ACPI_FUNCTION_TRACE (TbAddTable); @@ -242,26 +241,10 @@ AcpiTbAddTable ( /* * ACPI Table Override: * Allow the host to override dynamically loaded tables. + * NOTE: the table is fully mapped at this point, and the mapping will + * be deleted by TbTableOverride if the table is actually overridden. */ - Status = AcpiOsTableOverride (TableDesc->Pointer, &OverrideTable); - if (ACPI_SUCCESS (Status) && OverrideTable) - { - ACPI_INFO ((AE_INFO, - "%4.4s @ 0x%p Table override, replaced with:", - TableDesc->Pointer->Signature, - ACPI_CAST_PTR (void, TableDesc->Address))); - - /* We can delete the table that was passed as a parameter */ - - AcpiTbDeleteTable (TableDesc); - - /* Setup descriptor for the new table */ - - TableDesc->Address = ACPI_PTR_TO_PHYSADDR (OverrideTable); - TableDesc->Pointer = OverrideTable; - TableDesc->Length = OverrideTable->Length; - TableDesc->Flags = ACPI_TABLE_ORIGIN_OVERRIDE; - } + (void) AcpiTbTableOverride (TableDesc->Pointer, TableDesc); /* Add the table to the global root table list */ @@ -283,6 +266,98 @@ Release: /******************************************************************************* * + * FUNCTION: AcpiTbTableOverride + * + * PARAMETERS: TableHeader - Header for the original table + * TableDesc - Table descriptor initialized for the + * original table. May or may not be mapped. + * + * RETURN: Pointer to the entire new table. NULL if table not overridden. + * If overridden, installs the new table within the input table + * descriptor. + * + * DESCRIPTION: Attempt table override by calling the OSL override functions. + * Note: If the table is overridden, then the entire new table + * is mapped and returned by this function. + * + ******************************************************************************/ + +ACPI_TABLE_HEADER * +AcpiTbTableOverride ( + ACPI_TABLE_HEADER *TableHeader, + ACPI_TABLE_DESC *TableDesc) +{ + ACPI_STATUS Status; + ACPI_TABLE_HEADER *NewTable = NULL; + ACPI_PHYSICAL_ADDRESS NewAddress = 0; + UINT32 NewTableLength = 0; + UINT8 NewFlags; + char *OverrideType; + + + /* (1) Attempt logical override (returns a logical address) */ + + Status = AcpiOsTableOverride (TableHeader, &NewTable); + if (ACPI_SUCCESS (Status) && NewTable) + { + NewAddress = ACPI_PTR_TO_PHYSADDR (NewTable); + NewTableLength = NewTable->Length; + NewFlags = ACPI_TABLE_ORIGIN_OVERRIDE; + OverrideType = "Logical"; + goto FinishOverride; + } + + /* (2) Attempt physical override (returns a physical address) */ + + Status = AcpiOsPhysicalTableOverride (TableHeader, + &NewAddress, &NewTableLength); + if (ACPI_SUCCESS (Status) && NewAddress && NewTableLength) + { + /* Map the entire new table */ + + NewTable = AcpiOsMapMemory (NewAddress, NewTableLength); + if (!NewTable) + { + ACPI_EXCEPTION ((AE_INFO, AE_NO_MEMORY, + "%4.4s %p Attempted physical table override failed", + TableHeader->Signature, + ACPI_CAST_PTR (void, TableDesc->Address))); + return (NULL); + } + + OverrideType = "Physical"; + NewFlags = ACPI_TABLE_ORIGIN_MAPPED; + goto FinishOverride; + } + + return (NULL); /* There was no override */ + + +FinishOverride: + + ACPI_INFO ((AE_INFO, + "%4.4s %p %s table override, new table: %p", + TableHeader->Signature, + ACPI_CAST_PTR (void, TableDesc->Address), + OverrideType, NewTable)); + + /* We can now unmap/delete the original table (if fully mapped) */ + + AcpiTbDeleteTable (TableDesc); + + /* Setup descriptor for the new table */ + + TableDesc->Address = NewAddress; + TableDesc->Pointer = NewTable; + TableDesc->Length = NewTableLength; + TableDesc->Flags = NewFlags; + + return (NewTable); +} + + +/******************************************************************************* + * * FUNCTION: AcpiTbResizeRootTableList * * PARAMETERS: None @@ -435,8 +510,10 @@ AcpiTbDeleteTable ( ACPI_FREE (TableDesc->Pointer); break; + /* Not mapped or allocated, there is nothing we can do */ + default: - break; + return; } TableDesc->Pointer = NULL; diff --git a/usr/src/uts/intel/io/acpica/tables/tbutils.c b/usr/src/uts/intel/io/acpica/tables/tbutils.c index bff6540e07..e8b5705e96 100644 --- a/usr/src/uts/intel/io/acpica/tables/tbutils.c +++ b/usr/src/uts/intel/io/acpica/tables/tbutils.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -50,6 +50,7 @@ #define _COMPONENT ACPI_TABLES ACPI_MODULE_NAME ("tbutils") + /* Local prototypes */ static void @@ -68,6 +69,7 @@ AcpiTbGetRootTableEntry ( UINT32 TableEntrySize); +#if (!ACPI_REDUCED_HARDWARE) /******************************************************************************* * * FUNCTION: AcpiTbInitializeFacs @@ -88,10 +90,19 @@ AcpiTbInitializeFacs ( ACPI_STATUS Status; + /* If Hardware Reduced flag is set, there is no FACS */ + + if (AcpiGbl_ReducedHardware) + { + AcpiGbl_FACS = NULL; + return (AE_OK); + } + Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS, ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &AcpiGbl_FACS)); return (Status); } +#endif /* !ACPI_REDUCED_HARDWARE */ /******************************************************************************* @@ -415,7 +426,7 @@ AcpiTbCopyDsdt ( * RETURN: None * * DESCRIPTION: Install an ACPI table into the global data structure. The - * table override mechanism is implemented here to allow the host + * table override mechanism is called to allow the host * OS to replace any table before it is installed in the root * table array. * @@ -427,11 +438,9 @@ AcpiTbInstallTable ( char *Signature, UINT32 TableIndex) { - UINT8 Flags; - ACPI_STATUS Status; - ACPI_TABLE_HEADER *TableToInstall; - ACPI_TABLE_HEADER *MappedTable; - ACPI_TABLE_HEADER *OverrideTable = NULL; + ACPI_TABLE_HEADER *Table; + ACPI_TABLE_HEADER *FinalTable; + ACPI_TABLE_DESC *TableDesc; if (!Address) @@ -443,70 +452,84 @@ AcpiTbInstallTable ( /* Map just the table header */ - MappedTable = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER)); - if (!MappedTable) + Table = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER)); + if (!Table) { + ACPI_ERROR ((AE_INFO, "Could not map memory for table [%s] at %p", + Signature, ACPI_CAST_PTR (void, Address))); return; } /* If a particular signature is expected (DSDT/FACS), it must match */ if (Signature && - !ACPI_COMPARE_NAME (MappedTable->Signature, Signature)) + !ACPI_COMPARE_NAME (Table->Signature, Signature)) { ACPI_ERROR ((AE_INFO, "Invalid signature 0x%X for ACPI table, expected [%s]", - *ACPI_CAST_PTR (UINT32, MappedTable->Signature), Signature)); + *ACPI_CAST_PTR (UINT32, Table->Signature), Signature)); goto UnmapAndExit; } /* + * Initialize the table entry. Set the pointer to NULL, since the + * table is not fully mapped at this time. + */ + TableDesc = &AcpiGbl_RootTableList.Tables[TableIndex]; + + TableDesc->Address = Address; + TableDesc->Pointer = NULL; + TableDesc->Length = Table->Length; + TableDesc->Flags = ACPI_TABLE_ORIGIN_MAPPED; + ACPI_MOVE_32_TO_32 (TableDesc->Signature.Ascii, Table->Signature); + + /* * ACPI Table Override: * * Before we install the table, let the host OS override it with a new * one if desired. Any table within the RSDT/XSDT can be replaced, * including the DSDT which is pointed to by the FADT. + * + * NOTE: If the table is overridden, then FinalTable will contain a + * mapped pointer to the full new table. If the table is not overridden, + * or if there has been a physical override, then the table will be + * fully mapped later (in verify table). In any case, we must + * unmap the header that was mapped above. */ - Status = AcpiOsTableOverride (MappedTable, &OverrideTable); - if (ACPI_SUCCESS (Status) && OverrideTable) + FinalTable = AcpiTbTableOverride (Table, TableDesc); + if (!FinalTable) { - ACPI_INFO ((AE_INFO, - "%4.4s @ 0x%p Table override, replaced with:", - MappedTable->Signature, ACPI_CAST_PTR (void, Address))); - - AcpiGbl_RootTableList.Tables[TableIndex].Pointer = OverrideTable; - Address = ACPI_PTR_TO_PHYSADDR (OverrideTable); - - TableToInstall = OverrideTable; - Flags = ACPI_TABLE_ORIGIN_OVERRIDE; - } - else - { - TableToInstall = MappedTable; - Flags = ACPI_TABLE_ORIGIN_MAPPED; + FinalTable = Table; /* There was no override */ } - /* Initialize the table entry */ - - AcpiGbl_RootTableList.Tables[TableIndex].Address = Address; - AcpiGbl_RootTableList.Tables[TableIndex].Length = TableToInstall->Length; - AcpiGbl_RootTableList.Tables[TableIndex].Flags = Flags; - - ACPI_MOVE_32_TO_32 ( - &(AcpiGbl_RootTableList.Tables[TableIndex].Signature), - TableToInstall->Signature); + AcpiTbPrintTableHeader (TableDesc->Address, FinalTable); - AcpiTbPrintTableHeader (Address, TableToInstall); + /* Set the global integer width (based upon revision of the DSDT) */ if (TableIndex == ACPI_TABLE_INDEX_DSDT) { - /* Global integer width is based upon revision of the DSDT */ + AcpiUtSetIntegerWidth (FinalTable->Revision); + } - AcpiUtSetIntegerWidth (TableToInstall->Revision); + /* + * If we have a physical override during this early loading of the ACPI + * tables, unmap the table for now. It will be mapped again later when + * it is actually used. This supports very early loading of ACPI tables, + * before virtual memory is fully initialized and running within the + * host OS. Note: A logical override has the ACPI_TABLE_ORIGIN_OVERRIDE + * flag set and will not be deleted below. + */ + if (FinalTable != Table) + { + AcpiTbDeleteTable (TableDesc); } + UnmapAndExit: - AcpiOsUnmapMemory (MappedTable, sizeof (ACPI_TABLE_HEADER)); + + /* Always unmap the table header that we mapped above */ + + AcpiOsUnmapMemory (Table, sizeof (ACPI_TABLE_HEADER)); } diff --git a/usr/src/uts/intel/io/acpica/tables/tbxface.c b/usr/src/uts/intel/io/acpica/tables/tbxface.c index 465bf95c64..58dae6935d 100644 --- a/usr/src/uts/intel/io/acpica/tables/tbxface.c +++ b/usr/src/uts/intel/io/acpica/tables/tbxface.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/usr/src/uts/intel/io/acpica/tables/tbxfroot.c b/usr/src/uts/intel/io/acpica/tables/tbxfroot.c index e447108ebe..17e52ef7f4 100644 --- a/usr/src/uts/intel/io/acpica/tables/tbxfroot.c +++ b/usr/src/uts/intel/io/acpica/tables/tbxfroot.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without |
