From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-x235.google.com (mail-wr0-x235.google.com [IPv6:2a00:1450:400c:c0c::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C26202041D9DF for ; Wed, 29 Mar 2017 06:48:46 -0700 (PDT) Received: by mail-wr0-x235.google.com with SMTP id k6so9917586wre.2 for ; Wed, 29 Mar 2017 06:48:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4s311jhtym8bb98tuC45BLRAA+m4z4gh2crPlv28eEM=; b=VPnxZVtt/T5s49XZrUKn5bB0x+0FRh7zPxHlvz2/koNXrFCv7qKQnmWt+yl66+zs6n 3rkAdN77j3O5LdJVnEJRZaqKD3KMBgGJjZpFuiHlNX4fDgG0stvbL9zIjPEWlhWL9ax5 fli483Gp6oZDT4ttaHhJa1u2909JCjHU+3ufk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4s311jhtym8bb98tuC45BLRAA+m4z4gh2crPlv28eEM=; b=CWjoqhpRpPX40Qrf+1VIDPMq5aZ7teYwj2LpCUtoVvJFlige9Jxfz26WYRHbMY2zlQ 9PLB0gSTyYFEfNhVzkTYaRZg8Bc064ZI6eTz3UyI7P/Ed4CT2PJ3GbZf//GUk6IUsaXM Nk7KTMKE8x+iHLAZ6ZXvZxJ1ofnl8D6+xA2JIksXhPk6E3AAekXReBIGOhfHr8aPt6Tk QR0jutgomMEI+NmUPBCqwRkRs+wmbxUlGwPXtD5XYXdQXYf+qiJAC6o75M0liZMVnDDp 0qDud06vDB/3IAmHwP3Wxwy2F+2OwOOJXz6JSIJ93dCHxOTmb3FoPLtA1w6v7Zbjmzu5 688g== X-Gm-Message-State: AFeK/H21AktTpUxgZ4v4wjmZV2MBgNotlanQrKA+FLJu6Xumzlh15yOrrQbLJA+tsSivdDm4 X-Received: by 10.223.136.125 with SMTP id e58mr659293wre.14.1490795325380; Wed, 29 Mar 2017 06:48:45 -0700 (PDT) Received: from localhost.localdomain ([196.81.160.3]) by smtp.gmail.com with ESMTPSA id h65sm9479406wrh.32.2017.03.29.06.48.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Mar 2017 06:48:44 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org Cc: lersek@redhat.com, ryan.harkin@linaro.org, Ard Biesheuvel Date: Wed, 29 Mar 2017 14:48:28 +0100 Message-Id: <20170329134833.12956-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170329134833.12956-1-ard.biesheuvel@linaro.org> References: <20170329134833.12956-1-ard.biesheuvel@linaro.org> Subject: [PATCH 1/6] EmbeddedPkg/DtPlatformDxe: allow multiple entries in DTB FV file X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Mar 2017 13:48:47 -0000 To allow some dynamic behavior in selecting the DTB to expose to the OS, allow the DTB FV file to contain multiple sections, and indirect the choice of section via a fixed/dynamic PCD, which defaults to 0. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c | 5 ++++- EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf | 4 ++++ EmbeddedPkg/EmbeddedPkg.dec | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c index 5778633b4985..72f9f5721cda 100644 --- a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c +++ b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -121,7 +122,9 @@ DtPlatformDxeEntryPoint ( // Dtb = NULL; Status = GetSectionFromAnyFv (&gDtPlatformDefaultDtbFileGuid, - EFI_SECTION_RAW, 0, &Dtb, &DtbSize); + EFI_SECTION_RAW, + PcdGet8 (PcdDtPlatformDefaultDtbSectionIndex), + &Dtb, &DtbSize); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_WARN, "%a: no DTB blob found, defaulting to ACPI\n", __FUNCTION__)); diff --git a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf index b73877a6086b..c16202790ed9 100644 --- a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf +++ b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf @@ -43,6 +43,7 @@ [LibraryClasses] DxeServicesLib HiiLib MemoryAllocationLib + PcdLib UefiBootServicesTableLib UefiDriverEntryPoint UefiRuntimeServicesTableLib @@ -56,3 +57,6 @@ [Guids] [Depex] gEfiVariableArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid + +[Pcd] + gEmbeddedTokenSpaceGuid.PcdDtPlatformDefaultDtbSectionIndex diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec index 871fc5ff4016..f1b7af347861 100644 --- a/EmbeddedPkg/EmbeddedPkg.dec +++ b/EmbeddedPkg/EmbeddedPkg.dec @@ -198,3 +198,6 @@ [PcdsFixedAtBuild.X64] [PcdsFixedAtBuild.common, PcdsDynamic.common] gEmbeddedTokenSpaceGuid.PcdFdtDevicePaths|L""|VOID*|0x00000055 + + # the section containing the default DTB for the current platform + gEmbeddedTokenSpaceGuid.PcdDtPlatformDefaultDtbSectionIndex|0|UINT8|0x00000057 -- 2.9.3