diff --git a/Docs/Configuration.pdf b/Docs/Configuration.pdf index cfe4659a..c05fd979 100644 Binary files a/Docs/Configuration.pdf and b/Docs/Configuration.pdf differ diff --git a/Docs/Configuration.tex b/Docs/Configuration.tex index 1c8f7513..af2c0149 100644 --- a/Docs/Configuration.tex +++ b/Docs/Configuration.tex @@ -513,12 +513,9 @@ some of those are provided as a part of OpenCore. \textbf{Description}: Load selected tables from \texttt{OC/ACPI/Custom} directory. - Designed to be filled with string filenames meant to be loaded as ACPI - tables. Example values include \texttt{DSDT.aml}, \texttt{SSDT-8.aml}, - \texttt{SSDT-USBX.aml}, etc. ACPI table load order follows the item order in the array. + Designed to be filled with \texttt{plist\ dict} values, describing each block entry. + See \hyperref[acpipropsadd]{Add Properties} section below. - \textbf{Note}: All values but \texttt{DSDT.aml} insert new tables into ACPI stack. - \texttt{DSDT.aml}, unlike the rest, performs replacement of DSDT table. \item \texttt{Block}\\ \textbf{Type}: \texttt{plist\ array}\\ @@ -546,6 +543,41 @@ some of those are provided as a part of OpenCore. \end{enumerate} +\subsection{Add Properties}\label{acpipropsadd} + +\begin{enumerate} +\item + \texttt{Comment}\\ + \textbf{Type}: \texttt{plist\ string}\\ + \textbf{Default value}: Empty string\\ + \textbf{Description}: Arbitrary ASCII string used to provide human readable + reference for the entry. It is implementation defined whether this value is + used. + +\item + \texttt{Enabled}\\ + \textbf{Type}: \texttt{plist\ boolean}\\ + \textbf{Default value}: \texttt{false}\\ + \textbf{Description}: This ACPI table will not be removed unless set to + \texttt{true}. + +\item + \texttt{Path}\\ + \textbf{Type}: \texttt{plist\ string}\\ + \textbf{Default value}: Empty string\\ + \textbf{Description}: File paths meant to be loaded as ACPI tables. + Example values include \texttt{DSDT.aml}, \texttt{SubDir/SSDT-8.aml}, + \texttt{SSDT-USBX.aml}, etc. + + ACPI table load order follows the item order in the array. All ACPI tables + load from \texttt{OC/ACPI/Custom} directory. + + \textbf{Note}: All tables but tables with \texttt{DSDT} table identifier + (determined by parsing data not by filename) insert new tables into ACPI stack. + \texttt{DSDT}, unlike the rest, performs replacement of DSDT table. + +\end{enumerate} + \subsection{Block Properties}\label{acpipropsblock} \begin{enumerate} diff --git a/Docs/Sample.plist b/Docs/Sample.plist index 9e6db67e..1430972e 100644 --- a/Docs/Sample.plist +++ b/Docs/Sample.plist @@ -10,10 +10,38 @@ Add - DSDT.aml - SSDT.aml - SSDT-1.aml - SSDT-ACPI.aml + + Enabled + + Comment + DSDT + Path + DSDT.aml + + + Enabled + + Comment + Fix 123 + Path + SSDT.aml + + + Enabled + + Comment + Fix 456 + Path + SSDT-1.aml + + + Enabled + + Comment + + Path + SSDT-ACPI.aml + Block diff --git a/Platform/OpenCore/OpenCore.c b/Platform/OpenCore/OpenCore.c index cfd980bb..4fee2f36 100644 --- a/Platform/OpenCore/OpenCore.c +++ b/Platform/OpenCore/OpenCore.c @@ -232,6 +232,70 @@ OcMain ( } } +STATIC +VOID +RunStorageTests ( + IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *FileSystem + ) +{ + EFI_STATUS Status; + EFI_FILE_PROTOCOL *RootVolume; + EFI_FILE_PROTOCOL *FileHandle; + + DEBUG ((DEBUG_WARN, "Running FS tests...\n")); + + Status = FileSystem->OpenVolume (FileSystem, &RootVolume); + + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Cannot open root volume - %r\n", Status)); + return; + } + + STATIC CONST CHAR16 *Paths[] = { + L"EFI", + L"\\EFI", + L"EFI\\", + L"\\EFI\\", + L"EFI\\OC", + L"\\EFI\\OC", + L"EFI\\OC\\", + L"\\EFI\\OC\\", + L"EFI\\OC\\config.plist", + L"\\EFI\\OC\\config.plist", + }; + + for (UINTN Index = 0; Index < ARRAY_SIZE (Paths); ++Index) { + FileHandle = NULL; + Status = RootVolume->Open ( + RootVolume, + &FileHandle, + (CHAR16 *) Paths[Index], + EFI_FILE_MODE_READ, + 0 + ); + + DEBUG (( + DEBUG_WARN, + "Testing (%u/%u) %s - %r (%p)\n", + (UINT32) Index+1, + (UINT32) ARRAY_SIZE (Paths), + Paths[Index], + Status, + FileHandle + )); + + if (!EFI_ERROR (Status)) { + FileHandle->Close (FileHandle); + } + } + + RootVolume->Close (RootVolume); + + DEBUG ((DEBUG_WARN, "Done tests, waiting 5 seconds.\n")); + + gBS->Stall (5000000); +} + STATIC VOID EFIAPI @@ -245,6 +309,8 @@ OcBootstrapRerun ( DEBUG ((DEBUG_INFO, "OC: ReRun executed!\n")); + RunStorageTests (FileSystem); + ++This->NestedCount; if (This->NestedCount == 1) { diff --git a/Platform/OpenCore/OpenCoreAcpi.c b/Platform/OpenCore/OpenCoreAcpi.c index beb0d014..aeeb5b99 100644 --- a/Platform/OpenCore/OpenCoreAcpi.c +++ b/Platform/OpenCore/OpenCoreAcpi.c @@ -35,17 +35,20 @@ OcAcpiAddTables ( UINT8 *TableData; UINT32 TableDataLength; UINT32 Index; - CONST CHAR8 *Table; + OC_ACPI_ADD_ENTRY *Table; + CONST CHAR8 *TablePath; CHAR16 FullPath[128]; for (Index = 0; Index < Config->Acpi.Add.Count; ++Index) { - Table = OC_BLOB_GET (Config->Acpi.Add.Values[Index]); + Table = Config->Acpi.Add.Values[Index]; + TablePath = OC_BLOB_GET (&Table->Path); - if (Table[0] == '\0') { + if (!Table->Enabled || TablePath[0] == '\0') { + DEBUG ((DEBUG_INFO, "OC: Skipping add ACPI %a (%d)\n", TablePath, Table->Enabled)); continue; } - UnicodeSPrint (FullPath, sizeof (FullPath), OPEN_CORE_ACPI_PATH "%a", Table); + UnicodeSPrint (FullPath, sizeof (FullPath), OPEN_CORE_ACPI_PATH "%a", TablePath); UnicodeUefiSlashes (FullPath); TableData = OcStorageReadFileUnicode (Storage, FullPath, &TableDataLength); @@ -54,7 +57,7 @@ OcAcpiAddTables ( DEBUG (( DEBUG_WARN, "OC: Failed to find ACPI %a\n", - Table + TablePath )); continue; } @@ -65,7 +68,7 @@ OcAcpiAddTables ( DEBUG (( DEBUG_WARN, "OC: Failed to add ACPI %a - %r\n", - Table, + TablePath, Status )); }