From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from hqemgate14.nvidia.com (hqemgate14.nvidia.com [216.228.121.143]) by mx.groups.io with SMTP id smtpd.web11.973.1572406708145006944 for ; Tue, 29 Oct 2019 20:38:28 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=n1 header.b=kMQ2hgt0; spf=pass (domain: nvidia.com, ip: 216.228.121.143, mailfrom: ashishsingha@nvidia.com) Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 29 Oct 2019 20:38:33 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Tue, 29 Oct 2019 20:38:27 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Tue, 29 Oct 2019 20:38:27 -0700 Received: from HQMAIL107.nvidia.com (172.20.187.13) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 30 Oct 2019 03:38:27 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Wed, 30 Oct 2019 03:38:27 +0000 Received: from ashishsingha-lnx.nvidia.com (Not Verified[10.28.48.147]) by hqnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Tue, 29 Oct 2019 20:38:27 -0700 From: "Ashish Singhal" To: , , CC: Ashish Singhal Subject: [PATCH] EmbeddedPkg/DtPlatformDxe: Add DT/ACPI Default Flexibility Date: Tue, 29 Oct 2019 21:38:24 -0600 Message-ID: <0fd3af31134ae81ade4ede6d91fe807521a6865d.1572406299.git.ashishsingha@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: X-NVConfidentiality: public Return-Path: ashishsingha@nvidia.com MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1572406713; bh=Zojp8IwA5p6wZA4erlPAMRA95vAHs/OpZnwjT47mE7c=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=kMQ2hgt0PIlWQaFYkYdWRkvmumU3WpRjc62Ap9ZAgPLmC6Yf0qGanY2jW6SfXgoL1 YJNnWjwNdBm+YLWAS9k/rITJlt8Vp+facnV20uJaYzocUfZeI8VgigxpIixA3dBlR4 qU+LO/92f6qLTwJEwxKiLESnY9rywE3kAhw3Ur+xOZRrp5cXwub21ExegH7rd+XBd4 9EajLDoHihJsei69rNqdNSAMAgNIaiEZSSv8QLT95v6/6s3FnR3bZiMKvDPmTDZ7S7 1xGKINtaniG4GFDpvOqtjhYeFQuVFRyPu1kDaS4tBVnKUBWvoZ5ttwtOkRDdgv/5o6 3XAjQ2vxIuHQQ== Content-Type: text/plain 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 --- EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c | 16 ++++++++++------ EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf | 3 +++ EmbeddedPkg/EmbeddedPkg.dec | 5 +++++ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c index 907d46a..e35ca33 100644 --- a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c +++ b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c @@ -124,18 +124,22 @@ 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 %s\n", + __FUNCTION__, PcdGetBool (PcdDefaultDtPref) ? L"DT" : L"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 %s\n", + __FUNCTION__, DT_ACPI_VARIABLE_NAME, PcdGetBool (PcdDefaultDtPref) ? L"DT" : L"ACPI")); + DtAcpiPref.Pref = PcdGetBool (PcdDefaultDtPref) ? + DT_ACPI_SELECT_DT : + DT_ACPI_SELECT_ACPI; Status = EFI_INVALID_PARAMETER; // trigger setvar below } diff --git a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf index b68f154..450ea29 100644 --- a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf +++ b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf @@ -46,6 +46,9 @@ gEdkiiPlatformHasAcpiGuid gFdtTableGuid +[Pcd] + gEmbeddedTokenSpaceGuid.PcdDefaultDtPref + [Depex] gEfiVariableArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec index bbaadc5..8812a6d 100644 --- a/EmbeddedPkg/EmbeddedPkg.dec +++ b/EmbeddedPkg/EmbeddedPkg.dec @@ -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 -- 2.7.4