EmbeddedPkg/DtPlatformDxe: Add DT/ACPI Default Flexibility

Add a PCD to govern whether to use DT or ACPI in case the
variable governing this is not found or is not valid.

Signed-off-by: Ashish Singhal <ashishsingha@nvidia.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
This commit is contained in:
Ashish Singhal 2019-11-04 10:49:31 -07:00 committed by Ard Biesheuvel
parent 3a63c17ebc
commit 601a18bf08
3 changed files with 17 additions and 6 deletions

View File

@ -124,18 +124,21 @@ DtPlatformDxeEntryPoint (
Status = gRT->GetVariable(DT_ACPI_VARIABLE_NAME, &gDtPlatformFormSetGuid,
NULL, &BufferSize, &DtAcpiPref);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_WARN, "%a: no DT/ACPI preference found, defaulting to DT\n",
__FUNCTION__));
DtAcpiPref.Pref = DT_ACPI_SELECT_DT;
DEBUG ((DEBUG_WARN, "%a: no DT/ACPI preference found, defaulting to %a\n",
__FUNCTION__, PcdGetBool (PcdDefaultDtPref) ? "DT" : "ACPI"));
DtAcpiPref.Pref = PcdGetBool (PcdDefaultDtPref) ? DT_ACPI_SELECT_DT
: DT_ACPI_SELECT_ACPI;
}
}
if (!EFI_ERROR (Status) &&
DtAcpiPref.Pref != DT_ACPI_SELECT_ACPI &&
DtAcpiPref.Pref != DT_ACPI_SELECT_DT) {
DEBUG ((DEBUG_WARN, "%a: invalid value for %s, defaulting to DT\n",
__FUNCTION__, DT_ACPI_VARIABLE_NAME));
DtAcpiPref.Pref = DT_ACPI_SELECT_DT;
DEBUG ((DEBUG_WARN, "%a: invalid value for %s, defaulting to %a\n",
__FUNCTION__, DT_ACPI_VARIABLE_NAME,
PcdGetBool (PcdDefaultDtPref) ? "DT" : "ACPI"));
DtAcpiPref.Pref = PcdGetBool (PcdDefaultDtPref) ? DT_ACPI_SELECT_DT
: DT_ACPI_SELECT_ACPI;
Status = EFI_INVALID_PARAMETER; // trigger setvar below
}

View File

@ -46,6 +46,9 @@
gEdkiiPlatformHasAcpiGuid
gFdtTableGuid
[Pcd]
gEmbeddedTokenSpaceGuid.PcdDefaultDtPref
[Depex]
gEfiVariableArchProtocolGuid AND
gEfiVariableWriteArchProtocolGuid

View File

@ -185,3 +185,8 @@
# truncation on overflow to specify negative offsets.
#
gEmbeddedTokenSpaceGuid.PcdDmaDeviceOffset|0x0|UINT64|0x0000058
#
# Selection between DT and ACPI as a default
#
gEmbeddedTokenSpaceGuid.PcdDefaultDtPref|TRUE|BOOLEAN|0x0000059