]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg/NorFlashDxe: prepare for devicepath format change
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Wed, 21 Nov 2018 11:58:24 +0000 (12:58 +0100)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 26 Nov 2018 16:53:42 +0000 (17:53 +0100)
A subsequent patch will change the layout of devicepath nodes
produced by this driver. In preparation, make some tweaks to
the code to use a packed struct for the devicepath and to pass
the device index to NorFlashCreateInstance(). These are cosmetic
changes only, the resulting binaries should be identical.

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 46e815beb34306eb51d25e7922ed5555a6bcfeec..53753a4721ac980f202e690b596a1ad31e7250c6 100644 (file)
@@ -82,7 +82,10 @@ NOR_FLASH_INSTANCE  mNorFlashInstanceTemplate = {
       {\r
         HARDWARE_DEVICE_PATH,\r
         HW_VENDOR_DP,\r
-        { (UINT8)sizeof(VENDOR_DEVICE_PATH), (UINT8)((sizeof(VENDOR_DEVICE_PATH)) >> 8) }\r
+        {\r
+          (UINT8)(OFFSET_OF (NOR_FLASH_DEVICE_PATH, End)),\r
+          (UINT8)(OFFSET_OF (NOR_FLASH_DEVICE_PATH, End) >> 8)\r
+        }\r
       },\r
       { 0x0, 0x0, 0x0, { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }, // GUID ... NEED TO BE FILLED\r
     },\r
@@ -99,7 +102,7 @@ NorFlashCreateInstance (
   IN UINTN                  NorFlashDeviceBase,\r
   IN UINTN                  NorFlashRegionBase,\r
   IN UINTN                  NorFlashSize,\r
-  IN UINT32                 MediaId,\r
+  IN UINT32                 Index,\r
   IN UINT32                 BlockSize,\r
   IN BOOLEAN                SupportFvb,\r
   IN CONST GUID             *NorFlashGuid,\r
@@ -121,7 +124,7 @@ NorFlashCreateInstance (
   Instance->Size = NorFlashSize;\r
 \r
   Instance->BlockIoProtocol.Media = &Instance->Media;\r
-  Instance->Media.MediaId = MediaId;\r
+  Instance->Media.MediaId = Index;\r
   Instance->Media.BlockSize = BlockSize;\r
   Instance->Media.LastBlock = (NorFlashSize / BlockSize)-1;\r
 \r
index 5c07694fbfaa18140730a60171e60b4df43d635e..4436fc4323f56a95ef786a9b3d21452588806d1b 100644 (file)
 \r
 typedef struct _NOR_FLASH_INSTANCE                NOR_FLASH_INSTANCE;\r
 \r
+#pragma pack (1)\r
 typedef struct {\r
   VENDOR_DEVICE_PATH                  Vendor;\r
   EFI_DEVICE_PATH_PROTOCOL            End;\r
 } NOR_FLASH_DEVICE_PATH;\r
+#pragma pack ()\r
 \r
 struct _NOR_FLASH_INSTANCE {\r
   UINT32                              Signature;\r