]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg/NorFlashDxe: use one GUID plus index to identify flash banks
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Wed, 21 Nov 2018 11:58:25 +0000 (12:58 +0100)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 26 Nov 2018 16:53:46 +0000 (17:53 +0100)
Currently, each flash bank controlled by ArmPlatformPkg/NorFlashDxe
has its own VendorHw GUID, and instances of NorFlashPlatformLib
describe each bank to the driver, along with the GUID for each.

This works ok for bare metal platforms, but it would be useful for
virtual platforms if we could obtain this information from a
device tree, which would require us to invent GUIDs on the fly,
given that the 'cfi-flash' binding does not include a GUID.

So instead, let's switch to a single GUID for all flash banks,
and update the driver's device path handling to include an index
to identify each bank uniquely.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Thomas Abraham <thomas.abraham@arm.com>
ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c
ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h

index 53753a4721ac980f202e690b596a1ad31e7250c6..af40a4c88412c555c5696022a7561f70660ec84b 100644 (file)
@@ -89,6 +89,7 @@ NOR_FLASH_INSTANCE  mNorFlashInstanceTemplate = {
       },\r
       { 0x0, 0x0, 0x0, { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }, // GUID ... NEED TO BE FILLED\r
     },\r
+    0, // Index\r
     {\r
       END_DEVICE_PATH_TYPE,\r
       END_ENTIRE_DEVICE_PATH_SUBTYPE,\r
@@ -105,7 +106,6 @@ NorFlashCreateInstance (
   IN UINT32                 Index,\r
   IN UINT32                 BlockSize,\r
   IN BOOLEAN                SupportFvb,\r
-  IN CONST GUID             *NorFlashGuid,\r
   OUT NOR_FLASH_INSTANCE**  NorFlashInstance\r
   )\r
 {\r
@@ -128,7 +128,8 @@ NorFlashCreateInstance (
   Instance->Media.BlockSize = BlockSize;\r
   Instance->Media.LastBlock = (NorFlashSize / BlockSize)-1;\r
 \r
-  CopyGuid (&Instance->DevicePath.Vendor.Guid, NorFlashGuid);\r
+  CopyGuid (&Instance->DevicePath.Vendor.Guid, &gEfiCallerIdGuid);\r
+  Instance->DevicePath.Index = (UINT8)Index;\r
 \r
   Instance->ShadowBuffer = AllocateRuntimePool (BlockSize);;\r
   if (Instance->ShadowBuffer == NULL) {\r
@@ -1314,7 +1315,6 @@ NorFlashInitialise (
       Index,\r
       NorFlashDevices[Index].BlockSize,\r
       ContainVariableStorage,\r
-      &NorFlashDevices[Index].Guid,\r
       &mNorFlashInstances[Index]\r
     );\r
     if (EFI_ERROR(Status)) {\r
index 4436fc4323f56a95ef786a9b3d21452588806d1b..c0563f6d05dd3eb233767b1da4849ce9e6d4d933 100644 (file)
@@ -125,6 +125,7 @@ typedef struct _NOR_FLASH_INSTANCE                NOR_FLASH_INSTANCE;
 #pragma pack (1)\r
 typedef struct {\r
   VENDOR_DEVICE_PATH                  Vendor;\r
+  UINT8                               Index;\r
   EFI_DEVICE_PATH_PROTOCOL            End;\r
 } NOR_FLASH_DEVICE_PATH;\r
 #pragma pack ()\r