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, thomas.abraham@arm.com,
	nariman.poushin@linaro.org, masahisa.kojima@linaro.org,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH edk2-platforms 2/3] Silicon/SynQuacer: drop per-bank NOR flash GUIDs
Date: Wed, 21 Nov 2018 13:01:44 +0100	[thread overview]
Message-ID: <20181121120145.3148-3-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <20181121120145.3148-1-ard.biesheuvel@linaro.org>

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(-)

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 }
-    }
   },
 };
 
-- 
2.17.1



  parent reply	other threads:[~2018-11-21 12:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-21 12:01 [PATCH edk2-platforms 0/3] drop GUIDs from NOR flash bank descriptors Ard Biesheuvel
2018-11-21 12:01 ` [PATCH edk2-platforms 1/3] Platform/ARM: replace hardcoded VenHW() device paths referring to NOR flash Ard Biesheuvel
2018-11-21 12:01 ` Ard Biesheuvel [this message]
2018-11-21 12:01 ` [PATCH edk2-platforms 3/3] Platform/ARM: drop per-bank NOR flash GUIDs Ard Biesheuvel
2018-11-21 13:48 ` [PATCH edk2-platforms 0/3] drop GUIDs from NOR flash bank descriptors Thomas Abraham
2018-11-21 22:16   ` Ard Biesheuvel
2018-11-22  4:01     ` Thomas Abraham
2018-11-22  7:50       ` Ard Biesheuvel
2018-11-22 11:19         ` chandni cherukuri
2018-11-22 11:37           ` Ard Biesheuvel
2018-11-22 12:54             ` Thomas Abraham
2018-11-22 13:08             ` Ard Biesheuvel
2018-11-22 13:33               ` Thomas Abraham
2018-11-22 16:30               ` Laszlo Ersek
2018-11-22 16:37                 ` Ard Biesheuvel
2018-11-26 15:15 ` Leif Lindholm
2018-11-26 17:26   ` 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=20181121120145.3148-3-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