diff mbox series

[edk2,edk2-platforms,2/3] Silicon/SynQuacer: drop per-bank NOR flash GUIDs

Message ID 20181121120145.3148-3-ard.biesheuvel@linaro.org
State New
Headers show
Series drop GUIDs from NOR flash bank descriptors | expand

Commit Message

Ard Biesheuvel Nov. 21, 2018, 12:01 p.m. UTC
Give the SynQuacer NOR flash driver the same treatment as we gave the
one in ArmPlatformPkg: identify NOR flash banks by a single GUID
identifying the driver, and use indexes to identify each device instance
owned by the driver.

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

---
 Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c                  | 14 +++++++-------
 Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.h                  |  3 +++
 Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacer.c |  6 ------
 3 files changed, 10 insertions(+), 13 deletions(-)

-- 
2.17.1

_______________________________________________
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/Fip006Dxe/NorFlashDxe.c b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c
index 8d6bca8739d0..98f3e4d5a012 100644
--- a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c
+++ b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c
@@ -1093,12 +1093,13 @@  STATIC CONST NOR_FLASH_INSTANCE mNorFlashInstanceTemplate = {
         HARDWARE_DEVICE_PATH,
         HW_VENDOR_DP,
         {
-          (UINT8)sizeof(VENDOR_DEVICE_PATH),
-          (UINT8)((sizeof(VENDOR_DEVICE_PATH)) >> 8)
+          (UINT8)(OFFSET_OF (NOR_FLASH_DEVICE_PATH, End)),
+          (UINT8)(OFFSET_OF (NOR_FLASH_DEVICE_PATH, End) >> 8)
         }
       },
       { 0x0, 0x0, 0x0, { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } },
     },
+    0,  // Index
     {
       END_DEVICE_PATH_TYPE,
       END_ENTIRE_DEVICE_PATH_SUBTYPE,
@@ -1118,10 +1119,9 @@  NorFlashCreateInstance (
   IN UINTN                  NorFlashDeviceBase,
   IN UINTN                  NorFlashRegionBase,
   IN UINTN                  NorFlashSize,
-  IN UINT32                 MediaId,
+  IN UINT32                 Index,
   IN UINT32                 BlockSize,
   IN BOOLEAN                HasVarStore,
-  IN CONST GUID             *NorFlashGuid,
   IN CONST CSDC_DEFINITION  *CommandTable,
   IN UINTN                  CommandTableSize,
   OUT NOR_FLASH_INSTANCE**  NorFlashInstance
@@ -1146,12 +1146,13 @@  NorFlashCreateInstance (
   Instance->Size = NorFlashSize;
 
   Instance->BlockIoProtocol.Media = &Instance->Media;
-  Instance->Media.MediaId = MediaId;
+  Instance->Media.MediaId = Index;
   Instance->Media.BlockSize = BlockSize;
   Instance->Media.LastBlock = (NorFlashSize / BlockSize) - 1;
   Instance->OffsetLba = (NorFlashRegionBase - NorFlashDeviceBase) / BlockSize;
 
-  CopyGuid (&Instance->DevicePath.Vendor.Guid, NorFlashGuid);
+  CopyGuid (&Instance->DevicePath.Vendor.Guid, &gEfiCallerIdGuid);
+  Instance->DevicePath.Index = (UINT8)Index;
 
   Instance->CmdTable = CommandTable;
   Instance->CmdTableSize = CommandTableSize;
@@ -1360,7 +1361,6 @@  NorFlashInitialise (
       Index,
       NorFlashDevices[Index].BlockSize,
       ContainVariableStorage,
-      &NorFlashDevices[Index].Guid,
       mN25qCSDCDefTable,
       ARRAY_SIZE (mN25qCSDCDefTable),
       &mNorFlashInstances[Index]
diff --git a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.h b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.h
index 5e1e6adecf67..ef1257a64904 100644
--- a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.h
+++ b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.h
@@ -83,10 +83,13 @@  typedef struct _NOR_FLASH_INSTANCE                NOR_FLASH_INSTANCE;
 
 typedef EFI_STATUS (*NOR_FLASH_INITIALIZE)        (NOR_FLASH_INSTANCE* Instance);
 
+#pragma pack(1)
 typedef struct {
   VENDOR_DEVICE_PATH                  Vendor;
+  UINT8                               Index;
   EFI_DEVICE_PATH_PROTOCOL            End;
 } NOR_FLASH_DEVICE_PATH;
+#pragma pack()
 
 struct _NOR_FLASH_INSTANCE {
   UINT32                              Signature;
diff --git a/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacer.c b/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacer.c
index d44fe3e4e94c..1b3995d799de 100644
--- a/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacer.c
+++ b/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacer.c
@@ -34,9 +34,6 @@  STATIC NOR_FLASH_DESCRIPTION mNorFlashDevices[] = {
     FW_CODE_REGION_BASE,                                // region base
     FW_CODE_REGION_SIZE,                                // region size
     SIZE_64KB,                                          // block size
-    {
-      0x19c118b0, 0xc423, 0x42be, { 0xb8, 0x0f, 0x70, 0x6f, 0x1f, 0xcb, 0x59, 0x9a }
-    }
   },
   {
     // Environment variable region
@@ -44,9 +41,6 @@  STATIC NOR_FLASH_DESCRIPTION mNorFlashDevices[] = {
     FW_ENV_REGION_BASE,                                 // region base
     FW_ENV_REGION_SIZE,                                 // region size
     SIZE_64KB,                                          // block size
-    {
-      0x3105bd7a, 0x82c3, 0x486f, { 0xb1, 0x03, 0x1e, 0x09, 0x54, 0xec, 0x85, 0x75 }
-    }
   },
 };