diff options
author | Robert Moore <Robert.Moore@intel.com> | 2016-06-07 09:07:51 -0700 |
---|---|---|
committer | Robert Moore <Robert.Moore@intel.com> | 2016-06-07 09:07:51 -0700 |
commit | 3c128da48756d2bdb050653371055707f394a1b0 (patch) | |
tree | b1ac4e74ca90a4f1aa1058c988fecc9f856174ae | |
parent | 37131916c8d8759edf37824de98dc6916096355b (diff) | |
parent | aae77acf0f994cc81b81713d768df10f74a6d4de (diff) | |
download | acpica-3c128da48756d2bdb050653371055707f394a1b0.tar.gz |
Merge pull request #142 from Lekensteyn/windows-ssdt
Windows: add support for dumping SSDT tables
-rw-r--r-- | source/os_specific/service_layers/oswintbl.c | 68 |
1 files changed, 56 insertions, 12 deletions
diff --git a/source/os_specific/service_layers/oswintbl.c b/source/os_specific/service_layers/oswintbl.c index 3fc77bf8e..7f50ed7a3 100644 --- a/source/os_specific/service_layers/oswintbl.c +++ b/source/os_specific/service_layers/oswintbl.c @@ -143,8 +143,8 @@ static char KeyBuffer[LOCAL_BUFFER_SIZE]; static char ErrorBuffer[LOCAL_BUFFER_SIZE]; /* - * Tables supported in the Windows registry. SSDTs are not placed into - * the registry, a limitation. + * Tables supported in the Windows registry. Zero or more SSDTs are assumed to + * follow these tables. */ static char *SupportedTables[] = { @@ -154,9 +154,9 @@ static char *SupportedTables[] = "FACP" }; -/* Max index for table above */ +/* Number of table names for the table above. */ -#define ACPI_OS_MAX_TABLE_INDEX 3 +#define ACPI_OS_NUM_TABLE_ENTRIES 4 /****************************************************************************** @@ -243,14 +243,32 @@ AcpiOsGetTableByIndex ( ACPI_PHYSICAL_ADDRESS *Address) { ACPI_STATUS Status; + char *Signature; - if (Index > ACPI_OS_MAX_TABLE_INDEX) + if (Index < ACPI_OS_NUM_TABLE_ENTRIES) { - return (AE_LIMIT); + Signature = SupportedTables[Index]; + Index = 0; + } + else + { + Signature = ACPI_SIG_SSDT; + Index -= ACPI_OS_NUM_TABLE_ENTRIES; + } + + Status = AcpiOsGetTableByName (Signature, Index, Table, Address); + + if (ACPI_SUCCESS (Status)) + { + *Instance = Index; + } + else if (Status == AE_NOT_FOUND && ACPI_COMPARE_NAME (Signature, ACPI_SIG_SSDT)) + { + /* Treat SSDTs that are not found as invalid index. */ + Status = (AE_LIMIT); } - Status = AcpiOsGetTableByName (SupportedTables[Index], 0, Table, Address); return (Status); } @@ -297,11 +315,9 @@ AcpiOsGetTableByName ( ACPI_STATUS Status = AE_OK; - /* - * Windows has no SSDTs in the registry, so multiple instances are - * not supported. - */ - if (Instance > 0) + /* Multiple instances are only supported for SSDT tables. */ + + if (Instance > 0 && !ACPI_COMPARE_NAME (Signature, ACPI_SIG_SSDT)) { return (AE_LIMIT); } @@ -316,6 +332,28 @@ AcpiOsGetTableByName ( return (AE_BUFFER_OVERFLOW); } + /* + * Windows stores SSDT at SSDT, SSD1, ..., SSD9, SSDA, ..., SSDS, SSDT, + * SSDU, ..., SSDY. If the first (0th) and the 29th tables have the same + * OEM ID, Table ID and Revision, then the 29th entry will overwrite the + * first entry... Let's hope that we do not have that many entries. + */ + if (Instance > 0 && ACPI_COMPARE_NAME (Signature, ACPI_SIG_SSDT)) + { + if (Instance < 10) + { + KeyBuffer[strlen (KeyBuffer) - 1] = '0' + (char) Instance; + } + else if (Instance < 29) + { + KeyBuffer[strlen (KeyBuffer) - 1] = 'A' + (char) (Instance - 10); + } + else + { + return (AE_LIMIT); + } + } + WinStatus = RegOpenKeyEx (HKEY_LOCAL_MACHINE, KeyBuffer, 0L, KEY_READ, &Handle); @@ -337,6 +375,12 @@ AcpiOsGetTableByName ( { Signature = "RSDT"; } + else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_SSDT)) + { + /* SSDT may not be present on older Windows versions, but it is + * also possible that the index is not found. */ + return (AE_NOT_FOUND); + } else { fprintf (stderr, |