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>
{\r
HARDWARE_DEVICE_PATH,\r
HW_VENDOR_DP,\r
{\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
},\r
{ 0x0, 0x0, 0x0, { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }, // GUID ... NEED TO BE FILLED\r
},\r
IN UINTN NorFlashDeviceBase,\r
IN UINTN NorFlashRegionBase,\r
IN UINTN NorFlashSize,\r
IN UINTN NorFlashDeviceBase,\r
IN UINTN NorFlashRegionBase,\r
IN UINTN NorFlashSize,\r
IN UINT32 BlockSize,\r
IN BOOLEAN SupportFvb,\r
IN CONST GUID *NorFlashGuid,\r
IN UINT32 BlockSize,\r
IN BOOLEAN SupportFvb,\r
IN CONST GUID *NorFlashGuid,\r
Instance->Size = NorFlashSize;\r
\r
Instance->BlockIoProtocol.Media = &Instance->Media;\r
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
Instance->Media.BlockSize = BlockSize;\r
Instance->Media.LastBlock = (NorFlashSize / BlockSize)-1;\r
\r
\r
typedef struct _NOR_FLASH_INSTANCE NOR_FLASH_INSTANCE;\r
\r
\r
typedef struct _NOR_FLASH_INSTANCE NOR_FLASH_INSTANCE;\r
\r
typedef struct {\r
VENDOR_DEVICE_PATH Vendor;\r
EFI_DEVICE_PATH_PROTOCOL End;\r
} NOR_FLASH_DEVICE_PATH;\r
typedef struct {\r
VENDOR_DEVICE_PATH Vendor;\r
EFI_DEVICE_PATH_PROTOCOL End;\r
} NOR_FLASH_DEVICE_PATH;\r
\r
struct _NOR_FLASH_INSTANCE {\r
UINT32 Signature;\r
\r
struct _NOR_FLASH_INSTANCE {\r
UINT32 Signature;\r