diff mbox series

[edk2,edk2-platforms,4/5] Silicon/SynQuacer/PlatformDxe: add menu option to select mezzanine

Message ID 20180215172054.27452-5-ard.biesheuvel@linaro.org
State New
Headers show
Series Add Secure96 mezzanine support | expand

Commit Message

Ard Biesheuvel Feb. 15, 2018, 5:20 p.m. UTC
96boards mezzanines are not runtime discoverable, so it is up to the
user to tell the firmware what is connected. So add a pulldown entry
that allows a selection to be made: note that boards are only expected
to have a single LS connector, so a pulldown is appropriate here.

If Secure96 has been selected by the user, install the associated GUID
as a protocol, which the Secure96Dxe (which installs the DT overlay into
the device tree) has a depex on.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

---
 Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c      | 8 ++++++++
 Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf    | 2 ++
 Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.uni | 6 ++++++
 Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.vfr | 8 ++++++++
 Silicon/Socionext/SynQuacer/Include/Platform/VarStore.h            | 6 +++++-
 5 files changed, 29 insertions(+), 1 deletion(-)

-- 
2.11.0

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox series

Patch

diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c
index aab830dc3a5a..d57d1bbb52fa 100644
--- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c
+++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c
@@ -327,5 +327,13 @@  PlatformDxeEntryPoint (
     ASSERT_EFI_ERROR (Status);
   }
 
+  if (mHiiSettings->InstalledMezzanineType == MEZZANINE_SECURE96) {
+    Handle = NULL;
+    Status = gBS->InstallProtocolInterface (&Handle,
+                    &gSecure96HardwarePresent,
+                    EFI_NATIVE_INTERFACE, NULL);
+    ASSERT_EFI_ERROR (Status);
+  }
+
   return EFI_SUCCESS;
 }
diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf
index 49d9deee57ea..f3f913609452 100644
--- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf
+++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf
@@ -34,6 +34,7 @@  [Packages]
   EmbeddedPkg/EmbeddedPkg.dec
   MdeModulePkg/MdeModulePkg.dec
   MdePkg/MdePkg.dec
+  Platform/96boards/Secure96/Secure96.dec
   Silicon/NXP/Library/Pcf8563RealTimeClockLib/Pcf8563RealTimeClockLib.dec
   Silicon/Socionext/SynQuacer/Drivers/Net/NetsecDxe/NetsecDxe.dec
   Silicon/Socionext/SynQuacer/SynQuacer.dec
@@ -59,6 +60,7 @@  [Guids]
   gEfiHiiPlatformSetupFormsetGuid
   gFdtTableGuid
   gNetsecNonDiscoverableDeviceGuid
+  gSecure96HardwarePresent
   gSynQuacerNonDiscoverableI2cMasterGuid
   gSynQuacerNonDiscoverableRuntimeI2cMasterGuid
   gSynQuacerPlatformFormSetGuid
diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.uni b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.uni
index 2eca8bbba8c3..707540542616 100644
--- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.uni
+++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.uni
@@ -33,3 +33,9 @@ 
 
 #string STR_EMMC_DISABLED              #language en-US "Disabled"
 #string STR_EMMC_ENABLED               #language en-US "Enabled"
+
+#string STR_MEZZANINE_SELECT_PROMPT    #language en-US "96boards mezzanine"
+#string STR_MEZZANINE_SELECT_HELP      #language en-US "The type of mezzanine board plugged into the 96boards LS connector"
+
+#string STR_MEZZANINE_NONE             #language en-US "None/Unknown"
+#string STR_MEZZANINE_SECURE96         #language en-US "Secure96"
diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.vfr b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.vfr
index ea35e902b2d7..6c348aa0a29b 100644
--- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.vfr
+++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.vfr
@@ -70,6 +70,14 @@  formset
         option text = STRING_TOKEN(STR_EMMC_ENABLED), value = EMMC_ENABLED, flags = 0;
     endoneof;
 
+    oneof varid = SynQuacerPlatformSettings.InstalledMezzanineType,
+        prompt      = STRING_TOKEN(STR_MEZZANINE_SELECT_PROMPT),
+        help        = STRING_TOKEN(STR_MEZZANINE_SELECT_HELP),
+        flags       = NUMERIC_SIZE_1 | INTERACTIVE | RESET_REQUIRED,
+        option text = STRING_TOKEN(STR_MEZZANINE_NONE), value = MEZZANINE_NONE, flags = DEFAULT;
+        option text = STRING_TOKEN(STR_MEZZANINE_SECURE96), value = MEZZANINE_SECURE96, 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..a723f78a738a 100644
--- a/Silicon/Socionext/SynQuacer/Include/Platform/VarStore.h
+++ b/Silicon/Socionext/SynQuacer/Include/Platform/VarStore.h
@@ -22,12 +22,16 @@ 
 #define PCIE_MAX_SPEED_UNLIMITED          0x0
 #define PCIE_MAX_SPEED_GEN1               0x1
 
+#define MEZZANINE_NONE                    0x0
+#define MEZZANINE_SECURE96                0x1
+
 typedef struct {
   UINT8         EnableEmmc;
   UINT8         PcieSlot0MaxSpeed;
   UINT8         PcieSlot1MaxSpeed;
   UINT8         PcieSlot2MaxSpeed;
-  UINT8         Reserved[4];
+  UINT8         InstalledMezzanineType;
+  UINT8         Reserved[3];
 } SYNQUACER_PLATFORM_VARSTORE_DATA;
 
 #endif