From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from hqemgate16.nvidia.com (hqemgate16.nvidia.com [216.228.121.65]) by mx.groups.io with SMTP id smtpd.web09.8534.1572889776491672471 for ; Mon, 04 Nov 2019 09:49:36 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=n1 header.b=igLRmE9O; spf=pass (domain: nvidia.com, ip: 216.228.121.65, mailfrom: ashishsingha@nvidia.com) Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 04 Nov 2019 09:49:42 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 04 Nov 2019 09:49:36 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 04 Nov 2019 09:49:36 -0800 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 4 Nov 2019 17:49:35 +0000 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 4 Nov 2019 17:49:35 +0000 Received: from hqnvemgw02.nvidia.com (172.16.227.111) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Mon, 4 Nov 2019 17:49:35 +0000 Received: from ashishsingha-lnx.nvidia.com (Not Verified[10.28.48.147]) by hqnvemgw02.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Mon, 04 Nov 2019 09:49:35 -0800 From: "Ashish Singhal" To: , , CC: Ashish Singhal Subject: [PATCH] EmbeddedPkg/DtPlatformDxe: Add DT/ACPI Default Flexibility Date: Mon, 4 Nov 2019 10:49:31 -0700 Message-ID: <36d7d7bc005983af4ca5edca8e80b1df1d7c5559.1572889407.git.ashishsingha@nvidia.com> X-Mailer: git-send-email 2.7.4 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=1572889782; bh=Zojp8IwA5p6wZA4erlPAMRA95vAHs/OpZnwjT47mE7c=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: X-NVConfidentiality:MIME-Version:Content-Type; b=igLRmE9O06820BFRUePcy6NploujwQCriRjlHe6jEhcqGkkdaBqWyxivHWcpw3ik0 kn4jFUigQhZf1GzgSVnOh/nrodZ2u8OMzU7IDGTO11fqAJ4JLCrx9LeR3Wclv+5try 3rZvb/vFoOX2UUsynnz9XT5Fk4r2EXikHXHJXR9/ZkS8Umxb2RdIwWFd0iv7OLYqJg HhALWQZIR3vUFS8w6/Nx+wJQTIS1ugqn5yE2hP3krmBEzpEnM7Gs1ZBjt9BrUwswnT 1eUlhXOOaeCqHjivmfVKgRmCKZll46pHEqsGewIqN3JFANDg2CeYX6tLn//Jm1enwf n6VV98OA9wYmg== 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