public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: edk2-devel@lists.01.org, leif.lindholm@linaro.org
Cc: lersek@redhat.com, ryan.harkin@linaro.org,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH 1/6] EmbeddedPkg/DtPlatformDxe: allow multiple entries in DTB FV file
Date: Wed, 29 Mar 2017 14:48:28 +0100	[thread overview]
Message-ID: <20170329134833.12956-2-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <20170329134833.12956-1-ard.biesheuvel@linaro.org>

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 <ard.biesheuvel@linaro.org>
---
 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 <Library/DevicePathLib.h>
 #include <Library/DxeServicesLib.h>
 #include <Library/HiiLib.h>
+#include <Library/PcdLib.h>
 #include <Library/MemoryAllocationLib.h>
 #include <Library/UefiBootServicesTableLib.h>
 #include <Library/UefiDriverEntryPoint.h>
@@ -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



  reply	other threads:[~2017-03-29 13:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-29 13:48 [PATCH 0/6] Embedded|ArmPlatformPkg: spring cleaning + DtPlatformDxe switch Ard Biesheuvel
2017-03-29 13:48 ` Ard Biesheuvel [this message]
2017-03-29 13:48 ` [PATCH 2/6] EmbeddedPkg/DtPlatformDxe: declare symbolic name for FILE_GUID Ard Biesheuvel
2017-03-29 13:48 ` [PATCH 3/6] ArmPlatformPkg/ArmShellCmdRunAxf: remove BdsLib dependency Ard Biesheuvel
2017-03-29 13:48 ` [PATCH 4/6] ArmPlatformPkg/ArmVExpressDxe: remove ARM support Ard Biesheuvel
2017-03-29 13:48 ` [PATCH 5/6] ArmPlatformPkg/ArmVExpressDxe: remove unused cruft from ArmHwDxe Ard Biesheuvel
2017-03-29 13:48 ` [PATCH 6/6] ArmPlatformPkg/ArmVExpressDxe: simply FDT handling in ArmFvpDxe Ard Biesheuvel
2017-03-30 18:28 ` [PATCH 0/6] Embedded|ArmPlatformPkg: spring cleaning + DtPlatformDxe switch Laszlo Ersek
2017-03-31  9:22   ` Ard Biesheuvel
2017-03-31  9:46     ` Laszlo Ersek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170329134833.12956-2-ard.biesheuvel@linaro.org \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox