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
Cc: leif.lindholm@linaro.org, graeme.gregory@linaro.org,
	masahisa.kojima@linaro.org,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH edk2-platforms 4/5] Silicon/SynQuacer/PlatformDxe: add option to enable ACPI mode
Date: Tue, 27 Feb 2018 09:20:16 +0000	[thread overview]
Message-ID: <20180227092017.23617-5-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <20180227092017.23617-1-ard.biesheuvel@linaro.org>

Create a HII menu option to choose between device tree and ACPI platform
descriptions.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c      | 32 ++++++++++++++------
 Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf    |  1 +
 Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.uni |  8 ++++-
 Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.vfr | 10 +++++-
 Silicon/Socionext/SynQuacer/Include/Platform/VarStore.h            |  8 +++--
 5 files changed, 46 insertions(+), 13 deletions(-)

diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c
index 8787aa6288a7..4ae1c5b0ff6f 100644
--- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c
+++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c
@@ -277,15 +277,29 @@ PlatformDxeEntryPoint (
   mHiiSettingsVal = PcdGet64 (PcdPlatformSettings);
   mHiiSettings = (SYNQUACER_PLATFORM_VARSTORE_DATA *)&mHiiSettingsVal;
 
-  Dtb = NULL;
-  Status = DtPlatformLoadDtb (&Dtb, &DtbSize);
-  if (!EFI_ERROR (Status)) {
-    Status = gBS->InstallConfigurationTable (&gFdtTableGuid, Dtb);
-  }
-  if (EFI_ERROR (Status)) {
-     DEBUG ((DEBUG_ERROR,
-      "%a: failed to install FDT configuration table - %r\n", __FUNCTION__,
-      Status));
+  if (mHiiSettings->AcpiPref == ACPIPREF_DT) {
+    Dtb = NULL;
+    Status = DtPlatformLoadDtb (&Dtb, &DtbSize);
+    if (!EFI_ERROR (Status)) {
+      Status = gBS->InstallConfigurationTable (&gFdtTableGuid, Dtb);
+    }
+    if (EFI_ERROR (Status)) {
+       DEBUG ((DEBUG_ERROR,
+        "%a: failed to install FDT configuration table - %r\n", __FUNCTION__,
+        Status));
+    }
+  } else {
+    //
+    // ACPI was selected: install the gEdkiiPlatformHasAcpiGuid GUID as a
+    // NULL protocol to unlock dispatch of ACPI related drivers.
+    //
+    Status = gBS->InstallMultipleProtocolInterfaces (&ImageHandle,
+                    &gEdkiiPlatformHasAcpiGuid, NULL, NULL);
+    if (EFI_ERROR (Status)) {
+      DEBUG ((DEBUG_ERROR,
+        "%a: failed to install gEdkiiPlatformHasAcpiGuid as a protocol\n",
+        __FUNCTION__));
+    }
   }
 
   Handle = NULL;
diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf
index fca66799ebcb..bef7feccd8b8 100644
--- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf
+++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf
@@ -58,6 +58,7 @@ [LibraryClasses]
 
 [Guids]
   g96BoardsI2c0MasterGuid
+  gEdkiiPlatformHasAcpiGuid
   gEfiHiiPlatformSetupFormsetGuid
   gFdtTableGuid
   gNetsecNonDiscoverableDeviceGuid
diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.uni b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.uni
index 2eca8bbba8c3..836decc870f0 100644
--- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.uni
+++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.uni
@@ -1,6 +1,6 @@
 /** @file
 *
-*  Copyright (c) 2017, Linaro, Ltd. All rights reserved.
+*  Copyright (c) 2017 - 2018, Linaro, Ltd. All rights reserved.
 *
 *  This program and the accompanying materials are licensed and made available
 *  under the terms and conditions of the BSD License which accompanies this
@@ -33,3 +33,9 @@
 
 #string STR_EMMC_DISABLED              #language en-US "Disabled"
 #string STR_EMMC_ENABLED               #language en-US "Enabled"
+
+#string STR_DT_ACPI_SELECT_PROMPT      #language en-US "O/S Hardware Description"
+#string STR_DT_ACPI_SELECT_HELP        #language en-US "Select the hardware description that will be exposed to the O/S."
+
+#string STR_DT_ACPI_SELECT_DT          #language en-US "Device Tree"
+#string STR_DT_ACPI_SELECT_ACPI        #language en-US "ACPI"
diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.vfr b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.vfr
index ea35e902b2d7..8a395eac681b 100644
--- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.vfr
+++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.vfr
@@ -1,6 +1,6 @@
 /** @file
 *
-*  Copyright (c) 2017, Linaro, Ltd. All rights reserved.
+*  Copyright (c) 2017 - 2018, Linaro, Ltd. All rights reserved.
 *
 *  This program and the accompanying materials are licensed and made available
 *  under the terms and conditions of the BSD License which accompanies this
@@ -70,6 +70,14 @@ formset
         option text = STRING_TOKEN(STR_EMMC_ENABLED), value = EMMC_ENABLED, flags = 0;
     endoneof;
 
+    oneof varid = SynQuacerPlatformSettings.AcpiPref,
+        prompt      = STRING_TOKEN(STR_DT_ACPI_SELECT_PROMPT),
+        help        = STRING_TOKEN(STR_DT_ACPI_SELECT_HELP),
+        flags       = NUMERIC_SIZE_1 | INTERACTIVE | RESET_REQUIRED,
+        option text = STRING_TOKEN(STR_DT_ACPI_SELECT_DT), value = ACPIPREF_DT, flags = DEFAULT;
+        option text = STRING_TOKEN(STR_DT_ACPI_SELECT_ACPI), value = ACPIPREF_ACPI, flags = 0;
+    endoneof;
+
     subtitle text = STRING_TOKEN(STR_NULL_STRING);
 
   endform;
diff --git a/Silicon/Socionext/SynQuacer/Include/Platform/VarStore.h b/Silicon/Socionext/SynQuacer/Include/Platform/VarStore.h
index fbbcbd7d3eec..bb0e476fc3f8 100644
--- a/Silicon/Socionext/SynQuacer/Include/Platform/VarStore.h
+++ b/Silicon/Socionext/SynQuacer/Include/Platform/VarStore.h
@@ -1,6 +1,6 @@
 /** @file
 
-  Copyright (c) 2017, Linaro, Ltd. All rights reserved.<BR>
+  Copyright (c) 2017 - 2018, Linaro, Ltd. All rights reserved.<BR>
 
   This program and the accompanying materials are licensed and made available
   under the terms and conditions of the BSD License which accompanies this
@@ -22,12 +22,16 @@
 #define PCIE_MAX_SPEED_UNLIMITED          0x0
 #define PCIE_MAX_SPEED_GEN1               0x1
 
+#define ACPIPREF_DT                       0x0
+#define ACPIPREF_ACPI                     0x1
+
 typedef struct {
   UINT8         EnableEmmc;
   UINT8         PcieSlot0MaxSpeed;
   UINT8         PcieSlot1MaxSpeed;
   UINT8         PcieSlot2MaxSpeed;
-  UINT8         Reserved[4];
+  UINT8         AcpiPref;
+  UINT8         Reserved[3];
 } SYNQUACER_PLATFORM_VARSTORE_DATA;
 
 #endif
-- 
2.11.0



  parent reply	other threads:[~2018-02-27  9:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-27  9:20 [PATCH edk2-platforms 0/5] SynQuacer ACPI support Ard Biesheuvel
2018-02-27  9:20 ` [PATCH edk2-platforms 1/5] Platform/Socionext/DeveloperBox: fix PCIe slot to B/D/F mapping Ard Biesheuvel
2018-02-28 16:17   ` Leif Lindholm
2018-02-28 16:18     ` Ard Biesheuvel
2018-02-28 16:39       ` Leif Lindholm
2018-02-27  9:20 ` [PATCH edk2-platforms 2/5] Silicon/SynQuacer: tweak PCI I/O windows for ACPI/Linux support Ard Biesheuvel
2018-02-28 16:26   ` Leif Lindholm
2018-02-28 16:30     ` Ard Biesheuvel
2018-02-28 16:43       ` Leif Lindholm
2018-02-28 16:46         ` Ard Biesheuvel
2018-02-27  9:20 ` [PATCH edk2-platforms 3/5] Silicon/SynQuacer: add ACPI drivers and tables Ard Biesheuvel
2018-02-27  9:20 ` Ard Biesheuvel [this message]
2018-02-28 16:32   ` [PATCH edk2-platforms 4/5] Silicon/SynQuacer/PlatformDxe: add option to enable ACPI mode Leif Lindholm
2018-02-27  9:20 ` [PATCH edk2-platforms 5/5] Silicon/SynQuacer/PlatformDxe: add ACPI description of eMMC Ard Biesheuvel

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=20180227092017.23617-5-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