OpenCoreAcpi: Put ACPI -> Add to a dictionary

This commit is contained in:
vit9696 2019-04-20 12:38:56 +03:00
parent 36766e8133
commit 11808d8382
5 changed files with 144 additions and 15 deletions

Binary file not shown.

View File

@ -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}

View File

@ -10,10 +10,38 @@
<dict>
<key>Add</key>
<array>
<string>DSDT.aml</string>
<string>SSDT.aml</string>
<string>SSDT-1.aml</string>
<string>SSDT-ACPI.aml</string>
<dict>
<key>Enabled</key>
<true/>
<key>Comment</key>
<string>DSDT</string>
<key>Path</key>
<string>DSDT.aml</string>
</dict>
<dict>
<key>Enabled</key>
<true/>
<key>Comment</key>
<string>Fix 123</string>
<key>Path</key>
<string>SSDT.aml</string>
</dict>
<dict>
<key>Enabled</key>
<false/>
<key>Comment</key>
<string>Fix 456</string>
<key>Path</key>
<string>SSDT-1.aml</string>
</dict>
<dict>
<key>Enabled</key>
<false/>
<key>Comment</key>
<string></string>
<key>Path</key>
<string>SSDT-ACPI.aml</string>
</dict>
</array>
<key>Block</key>
<array>

View File

@ -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) {

View File

@ -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
));
}