162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright 2016-2020 Broadcom Limited. All rights reserved.
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci *          Name: mpi2_image.h
662306a36Sopenharmony_ci * Description: Contains definitions for firmware and other component images
762306a36Sopenharmony_ci * Creation Date: 04/02/2018
862306a36Sopenharmony_ci *       Version: 02.06.04
962306a36Sopenharmony_ci *
1062306a36Sopenharmony_ci *
1162306a36Sopenharmony_ci * Version History
1262306a36Sopenharmony_ci * ---------------
1362306a36Sopenharmony_ci *
1462306a36Sopenharmony_ci * Date      Version   Description
1562306a36Sopenharmony_ci * --------  --------  ------------------------------------------------------
1662306a36Sopenharmony_ci * 08-01-18  02.06.00  Initial version for MPI 2.6.5.
1762306a36Sopenharmony_ci * 08-14-18  02.06.01  Corrected define for MPI26_IMAGE_HEADER_SIGNATURE0_MPI26
1862306a36Sopenharmony_ci * 08-28-18  02.06.02  Added MPI2_EXT_IMAGE_TYPE_RDE
1962306a36Sopenharmony_ci * 09-07-18  02.06.03  Added MPI26_EVENT_PCIE_TOPO_PI_16_LANES
2062306a36Sopenharmony_ci * 12-17-18  02.06.04  Addd MPI2_EXT_IMAGE_TYPE_PBLP
2162306a36Sopenharmony_ci *			Shorten some defines to be compatible with DOS
2262306a36Sopenharmony_ci * 06-24-19  02.06.05  Whitespace adjustments to help with identifier
2362306a36Sopenharmony_ci *			checking tool.
2462306a36Sopenharmony_ci * 10-02-19  02.06.06  Added MPI26_IMAGE_HEADER_SIG1_COREDUMP
2562306a36Sopenharmony_ci *                     Added MPI2_FLASH_REGION_COREDUMP
2662306a36Sopenharmony_ci */
2762306a36Sopenharmony_ci#ifndef MPI2_IMAGE_H
2862306a36Sopenharmony_ci#define MPI2_IMAGE_H
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci/*FW Image Header */
3262306a36Sopenharmony_citypedef struct _MPI2_FW_IMAGE_HEADER {
3362306a36Sopenharmony_ci	U32 Signature;		/*0x00 */
3462306a36Sopenharmony_ci	U32 Signature0;		/*0x04 */
3562306a36Sopenharmony_ci	U32 Signature1;		/*0x08 */
3662306a36Sopenharmony_ci	U32 Signature2;		/*0x0C */
3762306a36Sopenharmony_ci	MPI2_VERSION_UNION MPIVersion;	/*0x10 */
3862306a36Sopenharmony_ci	MPI2_VERSION_UNION FWVersion;	/*0x14 */
3962306a36Sopenharmony_ci	MPI2_VERSION_UNION NVDATAVersion;	/*0x18 */
4062306a36Sopenharmony_ci	MPI2_VERSION_UNION PackageVersion;	/*0x1C */
4162306a36Sopenharmony_ci	U16 VendorID;		/*0x20 */
4262306a36Sopenharmony_ci	U16 ProductID;		/*0x22 */
4362306a36Sopenharmony_ci	U16 ProtocolFlags;	/*0x24 */
4462306a36Sopenharmony_ci	U16 Reserved26;		/*0x26 */
4562306a36Sopenharmony_ci	U32 IOCCapabilities;	/*0x28 */
4662306a36Sopenharmony_ci	U32 ImageSize;		/*0x2C */
4762306a36Sopenharmony_ci	U32 NextImageHeaderOffset;	/*0x30 */
4862306a36Sopenharmony_ci	U32 Checksum;		/*0x34 */
4962306a36Sopenharmony_ci	U32 Reserved38;		/*0x38 */
5062306a36Sopenharmony_ci	U32 Reserved3C;		/*0x3C */
5162306a36Sopenharmony_ci	U32 Reserved40;		/*0x40 */
5262306a36Sopenharmony_ci	U32 Reserved44;		/*0x44 */
5362306a36Sopenharmony_ci	U32 Reserved48;		/*0x48 */
5462306a36Sopenharmony_ci	U32 Reserved4C;		/*0x4C */
5562306a36Sopenharmony_ci	U32 Reserved50;		/*0x50 */
5662306a36Sopenharmony_ci	U32 Reserved54;		/*0x54 */
5762306a36Sopenharmony_ci	U32 Reserved58;		/*0x58 */
5862306a36Sopenharmony_ci	U32 Reserved5C;		/*0x5C */
5962306a36Sopenharmony_ci	U32 BootFlags;		/*0x60 */
6062306a36Sopenharmony_ci	U32 FirmwareVersionNameWhat;	/*0x64 */
6162306a36Sopenharmony_ci	U8 FirmwareVersionName[32];	/*0x68 */
6262306a36Sopenharmony_ci	U32 VendorNameWhat;	/*0x88 */
6362306a36Sopenharmony_ci	U8 VendorName[32];	/*0x8C */
6462306a36Sopenharmony_ci	U32 PackageNameWhat;	/*0x88 */
6562306a36Sopenharmony_ci	U8 PackageName[32];	/*0x8C */
6662306a36Sopenharmony_ci	U32 ReservedD0;		/*0xD0 */
6762306a36Sopenharmony_ci	U32 ReservedD4;		/*0xD4 */
6862306a36Sopenharmony_ci	U32 ReservedD8;		/*0xD8 */
6962306a36Sopenharmony_ci	U32 ReservedDC;		/*0xDC */
7062306a36Sopenharmony_ci	U32 ReservedE0;		/*0xE0 */
7162306a36Sopenharmony_ci	U32 ReservedE4;		/*0xE4 */
7262306a36Sopenharmony_ci	U32 ReservedE8;		/*0xE8 */
7362306a36Sopenharmony_ci	U32 ReservedEC;		/*0xEC */
7462306a36Sopenharmony_ci	U32 ReservedF0;		/*0xF0 */
7562306a36Sopenharmony_ci	U32 ReservedF4;		/*0xF4 */
7662306a36Sopenharmony_ci	U32 ReservedF8;		/*0xF8 */
7762306a36Sopenharmony_ci	U32 ReservedFC;		/*0xFC */
7862306a36Sopenharmony_ci} MPI2_FW_IMAGE_HEADER, *PTR_MPI2_FW_IMAGE_HEADER,
7962306a36Sopenharmony_ci	Mpi2FWImageHeader_t, *pMpi2FWImageHeader_t;
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ci/*Signature field */
8262306a36Sopenharmony_ci#define MPI2_FW_HEADER_SIGNATURE_OFFSET         (0x00)
8362306a36Sopenharmony_ci#define MPI2_FW_HEADER_SIGNATURE_MASK           (0xFF000000)
8462306a36Sopenharmony_ci#define MPI2_FW_HEADER_SIGNATURE                (0xEA000000)
8562306a36Sopenharmony_ci#define MPI26_FW_HEADER_SIGNATURE               (0xEB000000)
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ci/*Signature0 field */
8862306a36Sopenharmony_ci#define MPI2_FW_HEADER_SIGNATURE0_OFFSET        (0x04)
8962306a36Sopenharmony_ci#define MPI2_FW_HEADER_SIGNATURE0               (0x5AFAA55A)
9062306a36Sopenharmony_ci/*Last byte is defined by architecture */
9162306a36Sopenharmony_ci#define MPI26_FW_HEADER_SIGNATURE0_BASE         (0x5AEAA500)
9262306a36Sopenharmony_ci#define MPI26_FW_HEADER_SIGNATURE0_ARC_0        (0x5A)
9362306a36Sopenharmony_ci#define MPI26_FW_HEADER_SIGNATURE0_ARC_1        (0x00)
9462306a36Sopenharmony_ci#define MPI26_FW_HEADER_SIGNATURE0_ARC_2        (0x01)
9562306a36Sopenharmony_ci/*legacy (0x5AEAA55A) */
9662306a36Sopenharmony_ci#define MPI26_FW_HEADER_SIGNATURE0_ARC_3        (0x02)
9762306a36Sopenharmony_ci#define MPI26_FW_HEADER_SIGNATURE0 \
9862306a36Sopenharmony_ci	(MPI26_FW_HEADER_SIGNATURE0_BASE+MPI26_FW_HEADER_SIGNATURE0_ARC_0)
9962306a36Sopenharmony_ci#define MPI26_FW_HEADER_SIGNATURE0_3516 \
10062306a36Sopenharmony_ci	(MPI26_FW_HEADER_SIGNATURE0_BASE+MPI26_FW_HEADER_SIGNATURE0_ARC_1)
10162306a36Sopenharmony_ci#define MPI26_FW_HEADER_SIGNATURE0_4008 \
10262306a36Sopenharmony_ci	(MPI26_FW_HEADER_SIGNATURE0_BASE+MPI26_FW_HEADER_SIGNATURE0_ARC_3)
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ci/*Signature1 field */
10562306a36Sopenharmony_ci#define MPI2_FW_HEADER_SIGNATURE1_OFFSET        (0x08)
10662306a36Sopenharmony_ci#define MPI2_FW_HEADER_SIGNATURE1               (0xA55AFAA5)
10762306a36Sopenharmony_ci#define MPI26_FW_HEADER_SIGNATURE1              (0xA55AEAA5)
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_ci/*Signature2 field */
11062306a36Sopenharmony_ci#define MPI2_FW_HEADER_SIGNATURE2_OFFSET        (0x0C)
11162306a36Sopenharmony_ci#define MPI2_FW_HEADER_SIGNATURE2               (0x5AA55AFA)
11262306a36Sopenharmony_ci#define MPI26_FW_HEADER_SIGNATURE2              (0x5AA55AEA)
11362306a36Sopenharmony_ci
11462306a36Sopenharmony_ci/*defines for using the ProductID field */
11562306a36Sopenharmony_ci#define MPI2_FW_HEADER_PID_TYPE_MASK            (0xF000)
11662306a36Sopenharmony_ci#define MPI2_FW_HEADER_PID_TYPE_SAS             (0x2000)
11762306a36Sopenharmony_ci
11862306a36Sopenharmony_ci#define MPI2_FW_HEADER_PID_PROD_MASK                    (0x0F00)
11962306a36Sopenharmony_ci#define MPI2_FW_HEADER_PID_PROD_A                       (0x0000)
12062306a36Sopenharmony_ci#define MPI2_FW_HEADER_PID_PROD_TARGET_INITIATOR_SCSI   (0x0200)
12162306a36Sopenharmony_ci#define MPI2_FW_HEADER_PID_PROD_IR_SCSI                 (0x0700)
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ci#define MPI2_FW_HEADER_PID_FAMILY_MASK          (0x00FF)
12462306a36Sopenharmony_ci/*SAS ProductID Family bits */
12562306a36Sopenharmony_ci#define MPI2_FW_HEADER_PID_FAMILY_2108_SAS      (0x0013)
12662306a36Sopenharmony_ci#define MPI2_FW_HEADER_PID_FAMILY_2208_SAS      (0x0014)
12762306a36Sopenharmony_ci#define MPI25_FW_HEADER_PID_FAMILY_3108_SAS     (0x0021)
12862306a36Sopenharmony_ci#define MPI26_FW_HEADER_PID_FAMILY_3324_SAS     (0x0028)
12962306a36Sopenharmony_ci#define MPI26_FW_HEADER_PID_FAMILY_3516_SAS     (0x0031)
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ci/*use MPI2_IOCFACTS_PROTOCOL_ defines for ProtocolFlags field */
13262306a36Sopenharmony_ci
13362306a36Sopenharmony_ci/*use MPI2_IOCFACTS_CAPABILITY_ defines for IOCCapabilities field */
13462306a36Sopenharmony_ci
13562306a36Sopenharmony_ci#define MPI2_FW_HEADER_IMAGESIZE_OFFSET         (0x2C)
13662306a36Sopenharmony_ci#define MPI2_FW_HEADER_NEXTIMAGE_OFFSET         (0x30)
13762306a36Sopenharmony_ci
13862306a36Sopenharmony_ci#define MPI26_FW_HEADER_BOOTFLAGS_OFFSET          (0x60)
13962306a36Sopenharmony_ci#define MPI2_FW_HEADER_BOOTFLAGS_ISSI32M_FLAG     (0x00000001)
14062306a36Sopenharmony_ci#define MPI2_FW_HEADER_BOOTFLAGS_W25Q256JW_FLAG   (0x00000002)
14162306a36Sopenharmony_ci/*This image has a auto-discovery version of SPI */
14262306a36Sopenharmony_ci#define MPI2_FW_HEADER_BOOTFLAGS_AUTO_SPI_FLAG    (0x00000004)
14362306a36Sopenharmony_ci
14462306a36Sopenharmony_ci
14562306a36Sopenharmony_ci#define MPI2_FW_HEADER_VERNMHWAT_OFFSET         (0x64)
14662306a36Sopenharmony_ci
14762306a36Sopenharmony_ci#define MPI2_FW_HEADER_WHAT_SIGNATURE           (0x29232840)
14862306a36Sopenharmony_ci
14962306a36Sopenharmony_ci#define MPI2_FW_HEADER_SIZE                     (0x100)
15062306a36Sopenharmony_ci
15162306a36Sopenharmony_ci
15262306a36Sopenharmony_ci/****************************************************************************
15362306a36Sopenharmony_ci *              Component Image Format and related defines                  *
15462306a36Sopenharmony_ci ****************************************************************************/
15562306a36Sopenharmony_ci
15662306a36Sopenharmony_ci/*Maximum number of Hash Exclusion entries in a Component Image Header */
15762306a36Sopenharmony_ci#define MPI26_COMP_IMG_HDR_NUM_HASH_EXCL        (4)
15862306a36Sopenharmony_ci
15962306a36Sopenharmony_ci/*Hash Exclusion Format */
16062306a36Sopenharmony_citypedef struct _MPI26_HASH_EXCLUSION_FORMAT {
16162306a36Sopenharmony_ci	U32 Offset;        /*0x00 */
16262306a36Sopenharmony_ci	U32 Size;          /*0x04 */
16362306a36Sopenharmony_ci} MPI26_HASH_EXCLUSION_FORMAT,
16462306a36Sopenharmony_ci	*PTR_MPI26_HASH_EXCLUSION_FORMAT,
16562306a36Sopenharmony_ci	Mpi26HashSxclusionFormat_t,
16662306a36Sopenharmony_ci	*pMpi26HashExclusionFormat_t;
16762306a36Sopenharmony_ci
16862306a36Sopenharmony_ci/*FW Image Header */
16962306a36Sopenharmony_citypedef struct _MPI26_COMPONENT_IMAGE_HEADER {
17062306a36Sopenharmony_ci	U32 Signature0;					/*0x00 */
17162306a36Sopenharmony_ci	U32 LoadAddress;				/*0x04 */
17262306a36Sopenharmony_ci	U32 DataSize;					/*0x08 */
17362306a36Sopenharmony_ci	U32 StartAddress;				/*0x0C */
17462306a36Sopenharmony_ci	U32 Signature1;					/*0x10 */
17562306a36Sopenharmony_ci	U32 FlashOffset;				/*0x14 */
17662306a36Sopenharmony_ci	U32 FlashSize;					/*0x18 */
17762306a36Sopenharmony_ci	U32 VersionStringOffset;			/*0x1C */
17862306a36Sopenharmony_ci	U32 BuildDateStringOffset;			/*0x20 */
17962306a36Sopenharmony_ci	U32 BuildTimeStringOffset;			/*0x24 */
18062306a36Sopenharmony_ci	U32 EnvironmentVariableOffset;			/*0x28 */
18162306a36Sopenharmony_ci	U32 ApplicationSpecific;			/*0x2C */
18262306a36Sopenharmony_ci	U32 Signature2;					/*0x30 */
18362306a36Sopenharmony_ci	U32 HeaderSize;					/*0x34 */
18462306a36Sopenharmony_ci	U32 Crc;					/*0x38 */
18562306a36Sopenharmony_ci	U8 NotFlashImage;				/*0x3C */
18662306a36Sopenharmony_ci	U8 Compressed;					/*0x3D */
18762306a36Sopenharmony_ci	U16 Reserved3E;					/*0x3E */
18862306a36Sopenharmony_ci	U32 SecondaryFlashOffset;			/*0x40 */
18962306a36Sopenharmony_ci	U32 Reserved44;					/*0x44 */
19062306a36Sopenharmony_ci	U32 Reserved48;					/*0x48 */
19162306a36Sopenharmony_ci	MPI2_VERSION_UNION RMCInterfaceVersion;		/*0x4C */
19262306a36Sopenharmony_ci	MPI2_VERSION_UNION Reserved50;			/*0x50 */
19362306a36Sopenharmony_ci	MPI2_VERSION_UNION FWVersion;			/*0x54 */
19462306a36Sopenharmony_ci	MPI2_VERSION_UNION NvdataVersion;		/*0x58 */
19562306a36Sopenharmony_ci	MPI26_HASH_EXCLUSION_FORMAT
19662306a36Sopenharmony_ci	HashExclusion[MPI26_COMP_IMG_HDR_NUM_HASH_EXCL];/*0x5C */
19762306a36Sopenharmony_ci	U32 NextImageHeaderOffset;			/*0x7C */
19862306a36Sopenharmony_ci	U32 Reserved80[32];				/*0x80 -- 0xFC */
19962306a36Sopenharmony_ci} MPI26_COMPONENT_IMAGE_HEADER,
20062306a36Sopenharmony_ci	*PTR_MPI26_COMPONENT_IMAGE_HEADER,
20162306a36Sopenharmony_ci	Mpi26ComponentImageHeader_t,
20262306a36Sopenharmony_ci	*pMpi26ComponentImageHeader_t;
20362306a36Sopenharmony_ci
20462306a36Sopenharmony_ci
20562306a36Sopenharmony_ci/**** Definitions for Signature0 field ****/
20662306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_SIGNATURE0_MPI26                     (0xEB000042)
20762306a36Sopenharmony_ci
20862306a36Sopenharmony_ci/**** Definitions for Signature1 field ****/
20962306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_SIG1_APPLICATION              (0x20505041)
21062306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_SIG1_CBB                      (0x20424243)
21162306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_SIG1_MFG                      (0x2047464D)
21262306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_SIG1_BIOS                     (0x534F4942)
21362306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_SIG1_HIIM                     (0x4D494948)
21462306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_SIG1_HIIA                     (0x41494948)
21562306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_SIG1_CPLD                     (0x444C5043)
21662306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_SIG1_SPD                      (0x20445053)
21762306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_SIG1_NVDATA                   (0x5444564E)
21862306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_SIG1_GAS_GAUGE                (0x20534147)
21962306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_SIG1_PBLP                     (0x504C4250)
22062306a36Sopenharmony_ci/* little-endian "DUMP" */
22162306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_SIG1_COREDUMP                 (0x504D5544)
22262306a36Sopenharmony_ci
22362306a36Sopenharmony_ci/**** Definitions for Signature2 field ****/
22462306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_SIGNATURE2_VALUE                    (0x50584546)
22562306a36Sopenharmony_ci
22662306a36Sopenharmony_ci/**** Offsets for Image Header Fields ****/
22762306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_SIGNATURE0_OFFSET                   (0x00)
22862306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_LOAD_ADDRESS_OFFSET                 (0x04)
22962306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_DATA_SIZE_OFFSET                    (0x08)
23062306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_START_ADDRESS_OFFSET                (0x0C)
23162306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_SIGNATURE1_OFFSET                   (0x10)
23262306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_FLASH_OFFSET_OFFSET                 (0x14)
23362306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_FLASH_SIZE_OFFSET                   (0x18)
23462306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_VERSION_STRING_OFFSET_OFFSET        (0x1C)
23562306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_BUILD_DATE_STRING_OFFSET_OFFSET     (0x20)
23662306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_BUILD_TIME_OFFSET_OFFSET            (0x24)
23762306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_ENVIROMENT_VAR_OFFSET_OFFSET        (0x28)
23862306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_APPLICATION_SPECIFIC_OFFSET         (0x2C)
23962306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_SIGNATURE2_OFFSET                   (0x30)
24062306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_HEADER_SIZE_OFFSET                  (0x34)
24162306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_CRC_OFFSET                          (0x38)
24262306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_NOT_FLASH_IMAGE_OFFSET              (0x3C)
24362306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_COMPRESSED_OFFSET                   (0x3D)
24462306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_SECONDARY_FLASH_OFFSET_OFFSET       (0x40)
24562306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_RMC_INTERFACE_VER_OFFSET            (0x4C)
24662306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_COMPONENT_IMAGE_VER_OFFSET          (0x54)
24762306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_HASH_EXCLUSION_OFFSET               (0x5C)
24862306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_NEXT_IMAGE_HEADER_OFFSET_OFFSET     (0x7C)
24962306a36Sopenharmony_ci
25062306a36Sopenharmony_ci
25162306a36Sopenharmony_ci#define MPI26_IMAGE_HEADER_SIZE                                (0x100)
25262306a36Sopenharmony_ci
25362306a36Sopenharmony_ci
25462306a36Sopenharmony_ci/*Extended Image Header */
25562306a36Sopenharmony_citypedef struct _MPI2_EXT_IMAGE_HEADER {
25662306a36Sopenharmony_ci	U8 ImageType;		/*0x00 */
25762306a36Sopenharmony_ci	U8 Reserved1;		/*0x01 */
25862306a36Sopenharmony_ci	U16 Reserved2;		/*0x02 */
25962306a36Sopenharmony_ci	U32 Checksum;		/*0x04 */
26062306a36Sopenharmony_ci	U32 ImageSize;		/*0x08 */
26162306a36Sopenharmony_ci	U32 NextImageHeaderOffset;	/*0x0C */
26262306a36Sopenharmony_ci	U32 PackageVersion;	/*0x10 */
26362306a36Sopenharmony_ci	U32 Reserved3;		/*0x14 */
26462306a36Sopenharmony_ci	U32 Reserved4;		/*0x18 */
26562306a36Sopenharmony_ci	U32 Reserved5;		/*0x1C */
26662306a36Sopenharmony_ci	U8 IdentifyString[32];	/*0x20 */
26762306a36Sopenharmony_ci} MPI2_EXT_IMAGE_HEADER, *PTR_MPI2_EXT_IMAGE_HEADER,
26862306a36Sopenharmony_ci	Mpi2ExtImageHeader_t, *pMpi2ExtImageHeader_t;
26962306a36Sopenharmony_ci
27062306a36Sopenharmony_ci/*useful offsets */
27162306a36Sopenharmony_ci#define MPI2_EXT_IMAGE_IMAGETYPE_OFFSET         (0x00)
27262306a36Sopenharmony_ci#define MPI2_EXT_IMAGE_IMAGESIZE_OFFSET         (0x08)
27362306a36Sopenharmony_ci#define MPI2_EXT_IMAGE_NEXTIMAGE_OFFSET         (0x0C)
27462306a36Sopenharmony_ci#define MPI2_EXT_IMAGE_PACKAGEVERSION_OFFSET   (0x10)
27562306a36Sopenharmony_ci
27662306a36Sopenharmony_ci#define MPI2_EXT_IMAGE_HEADER_SIZE              (0x40)
27762306a36Sopenharmony_ci
27862306a36Sopenharmony_ci/*defines for the ImageType field */
27962306a36Sopenharmony_ci#define MPI2_EXT_IMAGE_TYPE_UNSPECIFIED             (0x00)
28062306a36Sopenharmony_ci#define MPI2_EXT_IMAGE_TYPE_FW                      (0x01)
28162306a36Sopenharmony_ci#define MPI2_EXT_IMAGE_TYPE_NVDATA                  (0x03)
28262306a36Sopenharmony_ci#define MPI2_EXT_IMAGE_TYPE_BOOTLOADER              (0x04)
28362306a36Sopenharmony_ci#define MPI2_EXT_IMAGE_TYPE_INITIALIZATION          (0x05)
28462306a36Sopenharmony_ci#define MPI2_EXT_IMAGE_TYPE_FLASH_LAYOUT            (0x06)
28562306a36Sopenharmony_ci#define MPI2_EXT_IMAGE_TYPE_SUPPORTED_DEVICES       (0x07)
28662306a36Sopenharmony_ci#define MPI2_EXT_IMAGE_TYPE_MEGARAID                (0x08)
28762306a36Sopenharmony_ci#define MPI2_EXT_IMAGE_TYPE_ENCRYPTED_HASH          (0x09)
28862306a36Sopenharmony_ci#define MPI2_EXT_IMAGE_TYPE_RDE                     (0x0A)
28962306a36Sopenharmony_ci#define MPI2_EXT_IMAGE_TYPE_PBLP                    (0x0B)
29062306a36Sopenharmony_ci#define MPI2_EXT_IMAGE_TYPE_MIN_PRODUCT_SPECIFIC    (0x80)
29162306a36Sopenharmony_ci#define MPI2_EXT_IMAGE_TYPE_MAX_PRODUCT_SPECIFIC    (0xFF)
29262306a36Sopenharmony_ci
29362306a36Sopenharmony_ci#define MPI2_EXT_IMAGE_TYPE_MAX (MPI2_EXT_IMAGE_TYPE_MAX_PRODUCT_SPECIFIC)
29462306a36Sopenharmony_ci
29562306a36Sopenharmony_ci/*FLASH Layout Extended Image Data */
29662306a36Sopenharmony_ci
29762306a36Sopenharmony_ci/*
29862306a36Sopenharmony_ci *Host code (drivers, BIOS, utilities, etc.) should leave this define set to
29962306a36Sopenharmony_ci *one and check RegionsPerLayout at runtime.
30062306a36Sopenharmony_ci */
30162306a36Sopenharmony_ci#ifndef MPI2_FLASH_NUMBER_OF_REGIONS
30262306a36Sopenharmony_ci#define MPI2_FLASH_NUMBER_OF_REGIONS        (1)
30362306a36Sopenharmony_ci#endif
30462306a36Sopenharmony_ci
30562306a36Sopenharmony_ci/*
30662306a36Sopenharmony_ci *Host code (drivers, BIOS, utilities, etc.) should leave this define set to
30762306a36Sopenharmony_ci *one and check NumberOfLayouts at runtime.
30862306a36Sopenharmony_ci */
30962306a36Sopenharmony_ci#ifndef MPI2_FLASH_NUMBER_OF_LAYOUTS
31062306a36Sopenharmony_ci#define MPI2_FLASH_NUMBER_OF_LAYOUTS        (1)
31162306a36Sopenharmony_ci#endif
31262306a36Sopenharmony_ci
31362306a36Sopenharmony_citypedef struct _MPI2_FLASH_REGION {
31462306a36Sopenharmony_ci	U8 RegionType;		/*0x00 */
31562306a36Sopenharmony_ci	U8 Reserved1;		/*0x01 */
31662306a36Sopenharmony_ci	U16 Reserved2;		/*0x02 */
31762306a36Sopenharmony_ci	U32 RegionOffset;	/*0x04 */
31862306a36Sopenharmony_ci	U32 RegionSize;		/*0x08 */
31962306a36Sopenharmony_ci	U32 Reserved3;		/*0x0C */
32062306a36Sopenharmony_ci} MPI2_FLASH_REGION, *PTR_MPI2_FLASH_REGION,
32162306a36Sopenharmony_ci	Mpi2FlashRegion_t, *pMpi2FlashRegion_t;
32262306a36Sopenharmony_ci
32362306a36Sopenharmony_citypedef struct _MPI2_FLASH_LAYOUT {
32462306a36Sopenharmony_ci	U32 FlashSize;		/*0x00 */
32562306a36Sopenharmony_ci	U32 Reserved1;		/*0x04 */
32662306a36Sopenharmony_ci	U32 Reserved2;		/*0x08 */
32762306a36Sopenharmony_ci	U32 Reserved3;		/*0x0C */
32862306a36Sopenharmony_ci	MPI2_FLASH_REGION Region[MPI2_FLASH_NUMBER_OF_REGIONS];	/*0x10 */
32962306a36Sopenharmony_ci} MPI2_FLASH_LAYOUT, *PTR_MPI2_FLASH_LAYOUT,
33062306a36Sopenharmony_ci	Mpi2FlashLayout_t, *pMpi2FlashLayout_t;
33162306a36Sopenharmony_ci
33262306a36Sopenharmony_citypedef struct _MPI2_FLASH_LAYOUT_DATA {
33362306a36Sopenharmony_ci	U8 ImageRevision;	/*0x00 */
33462306a36Sopenharmony_ci	U8 Reserved1;		/*0x01 */
33562306a36Sopenharmony_ci	U8 SizeOfRegion;	/*0x02 */
33662306a36Sopenharmony_ci	U8 Reserved2;		/*0x03 */
33762306a36Sopenharmony_ci	U16 NumberOfLayouts;	/*0x04 */
33862306a36Sopenharmony_ci	U16 RegionsPerLayout;	/*0x06 */
33962306a36Sopenharmony_ci	U16 MinimumSectorAlignment;	/*0x08 */
34062306a36Sopenharmony_ci	U16 Reserved3;		/*0x0A */
34162306a36Sopenharmony_ci	U32 Reserved4;		/*0x0C */
34262306a36Sopenharmony_ci	MPI2_FLASH_LAYOUT Layout[MPI2_FLASH_NUMBER_OF_LAYOUTS];	/*0x10 */
34362306a36Sopenharmony_ci} MPI2_FLASH_LAYOUT_DATA, *PTR_MPI2_FLASH_LAYOUT_DATA,
34462306a36Sopenharmony_ci	Mpi2FlashLayoutData_t, *pMpi2FlashLayoutData_t;
34562306a36Sopenharmony_ci
34662306a36Sopenharmony_ci/*defines for the RegionType field */
34762306a36Sopenharmony_ci#define MPI2_FLASH_REGION_UNUSED                (0x00)
34862306a36Sopenharmony_ci#define MPI2_FLASH_REGION_FIRMWARE              (0x01)
34962306a36Sopenharmony_ci#define MPI2_FLASH_REGION_BIOS                  (0x02)
35062306a36Sopenharmony_ci#define MPI2_FLASH_REGION_NVDATA                (0x03)
35162306a36Sopenharmony_ci#define MPI2_FLASH_REGION_FIRMWARE_BACKUP       (0x05)
35262306a36Sopenharmony_ci#define MPI2_FLASH_REGION_MFG_INFORMATION       (0x06)
35362306a36Sopenharmony_ci#define MPI2_FLASH_REGION_CONFIG_1              (0x07)
35462306a36Sopenharmony_ci#define MPI2_FLASH_REGION_CONFIG_2              (0x08)
35562306a36Sopenharmony_ci#define MPI2_FLASH_REGION_MEGARAID              (0x09)
35662306a36Sopenharmony_ci#define MPI2_FLASH_REGION_COMMON_BOOT_BLOCK     (0x0A)
35762306a36Sopenharmony_ci#define MPI2_FLASH_REGION_INIT (MPI2_FLASH_REGION_COMMON_BOOT_BLOCK)
35862306a36Sopenharmony_ci#define MPI2_FLASH_REGION_CBB_BACKUP            (0x0D)
35962306a36Sopenharmony_ci#define MPI2_FLASH_REGION_SBR                   (0x0E)
36062306a36Sopenharmony_ci#define MPI2_FLASH_REGION_SBR_BACKUP            (0x0F)
36162306a36Sopenharmony_ci#define MPI2_FLASH_REGION_HIIM                  (0x10)
36262306a36Sopenharmony_ci#define MPI2_FLASH_REGION_HIIA                  (0x11)
36362306a36Sopenharmony_ci#define MPI2_FLASH_REGION_CTLR                  (0x12)
36462306a36Sopenharmony_ci#define MPI2_FLASH_REGION_IMR_FIRMWARE          (0x13)
36562306a36Sopenharmony_ci#define MPI2_FLASH_REGION_MR_NVDATA             (0x14)
36662306a36Sopenharmony_ci#define MPI2_FLASH_REGION_CPLD                  (0x15)
36762306a36Sopenharmony_ci#define MPI2_FLASH_REGION_PSOC                  (0x16)
36862306a36Sopenharmony_ci#define MPI2_FLASH_REGION_COREDUMP              (0x17)
36962306a36Sopenharmony_ci
37062306a36Sopenharmony_ci/*ImageRevision */
37162306a36Sopenharmony_ci#define MPI2_FLASH_LAYOUT_IMAGE_REVISION        (0x00)
37262306a36Sopenharmony_ci
37362306a36Sopenharmony_ci/*Supported Devices Extended Image Data */
37462306a36Sopenharmony_ci
37562306a36Sopenharmony_ci/*
37662306a36Sopenharmony_ci *Host code (drivers, BIOS, utilities, etc.) should leave this define set to
37762306a36Sopenharmony_ci *one and check NumberOfDevices at runtime.
37862306a36Sopenharmony_ci */
37962306a36Sopenharmony_ci#ifndef MPI2_SUPPORTED_DEVICES_IMAGE_NUM_DEVICES
38062306a36Sopenharmony_ci#define MPI2_SUPPORTED_DEVICES_IMAGE_NUM_DEVICES    (1)
38162306a36Sopenharmony_ci#endif
38262306a36Sopenharmony_ci
38362306a36Sopenharmony_citypedef struct _MPI2_SUPPORTED_DEVICE {
38462306a36Sopenharmony_ci	U16 DeviceID;		/*0x00 */
38562306a36Sopenharmony_ci	U16 VendorID;		/*0x02 */
38662306a36Sopenharmony_ci	U16 DeviceIDMask;	/*0x04 */
38762306a36Sopenharmony_ci	U16 Reserved1;		/*0x06 */
38862306a36Sopenharmony_ci	U8 LowPCIRev;		/*0x08 */
38962306a36Sopenharmony_ci	U8 HighPCIRev;		/*0x09 */
39062306a36Sopenharmony_ci	U16 Reserved2;		/*0x0A */
39162306a36Sopenharmony_ci	U32 Reserved3;		/*0x0C */
39262306a36Sopenharmony_ci} MPI2_SUPPORTED_DEVICE, *PTR_MPI2_SUPPORTED_DEVICE,
39362306a36Sopenharmony_ci	Mpi2SupportedDevice_t, *pMpi2SupportedDevice_t;
39462306a36Sopenharmony_ci
39562306a36Sopenharmony_citypedef struct _MPI2_SUPPORTED_DEVICES_DATA {
39662306a36Sopenharmony_ci	U8 ImageRevision;	/*0x00 */
39762306a36Sopenharmony_ci	U8 Reserved1;		/*0x01 */
39862306a36Sopenharmony_ci	U8 NumberOfDevices;	/*0x02 */
39962306a36Sopenharmony_ci	U8 Reserved2;		/*0x03 */
40062306a36Sopenharmony_ci	U32 Reserved3;		/*0x04 */
40162306a36Sopenharmony_ci	MPI2_SUPPORTED_DEVICE
40262306a36Sopenharmony_ci	SupportedDevice[MPI2_SUPPORTED_DEVICES_IMAGE_NUM_DEVICES];/*0x08 */
40362306a36Sopenharmony_ci} MPI2_SUPPORTED_DEVICES_DATA, *PTR_MPI2_SUPPORTED_DEVICES_DATA,
40462306a36Sopenharmony_ci	Mpi2SupportedDevicesData_t, *pMpi2SupportedDevicesData_t;
40562306a36Sopenharmony_ci
40662306a36Sopenharmony_ci/*ImageRevision */
40762306a36Sopenharmony_ci#define MPI2_SUPPORTED_DEVICES_IMAGE_REVISION   (0x00)
40862306a36Sopenharmony_ci
40962306a36Sopenharmony_ci/*Init Extended Image Data */
41062306a36Sopenharmony_ci
41162306a36Sopenharmony_citypedef struct _MPI2_INIT_IMAGE_FOOTER {
41262306a36Sopenharmony_ci	U32 BootFlags;		/*0x00 */
41362306a36Sopenharmony_ci	U32 ImageSize;		/*0x04 */
41462306a36Sopenharmony_ci	U32 Signature0;		/*0x08 */
41562306a36Sopenharmony_ci	U32 Signature1;		/*0x0C */
41662306a36Sopenharmony_ci	U32 Signature2;		/*0x10 */
41762306a36Sopenharmony_ci	U32 ResetVector;	/*0x14 */
41862306a36Sopenharmony_ci} MPI2_INIT_IMAGE_FOOTER, *PTR_MPI2_INIT_IMAGE_FOOTER,
41962306a36Sopenharmony_ci	Mpi2InitImageFooter_t, *pMpi2InitImageFooter_t;
42062306a36Sopenharmony_ci
42162306a36Sopenharmony_ci/*defines for the BootFlags field */
42262306a36Sopenharmony_ci#define MPI2_INIT_IMAGE_BOOTFLAGS_OFFSET        (0x00)
42362306a36Sopenharmony_ci
42462306a36Sopenharmony_ci/*defines for the ImageSize field */
42562306a36Sopenharmony_ci#define MPI2_INIT_IMAGE_IMAGESIZE_OFFSET        (0x04)
42662306a36Sopenharmony_ci
42762306a36Sopenharmony_ci/*defines for the Signature0 field */
42862306a36Sopenharmony_ci#define MPI2_INIT_IMAGE_SIGNATURE0_OFFSET       (0x08)
42962306a36Sopenharmony_ci#define MPI2_INIT_IMAGE_SIGNATURE0              (0x5AA55AEA)
43062306a36Sopenharmony_ci
43162306a36Sopenharmony_ci/*defines for the Signature1 field */
43262306a36Sopenharmony_ci#define MPI2_INIT_IMAGE_SIGNATURE1_OFFSET       (0x0C)
43362306a36Sopenharmony_ci#define MPI2_INIT_IMAGE_SIGNATURE1              (0xA55AEAA5)
43462306a36Sopenharmony_ci
43562306a36Sopenharmony_ci/*defines for the Signature2 field */
43662306a36Sopenharmony_ci#define MPI2_INIT_IMAGE_SIGNATURE2_OFFSET       (0x10)
43762306a36Sopenharmony_ci#define MPI2_INIT_IMAGE_SIGNATURE2              (0x5AEAA55A)
43862306a36Sopenharmony_ci
43962306a36Sopenharmony_ci/*Signature fields as individual bytes */
44062306a36Sopenharmony_ci#define MPI2_INIT_IMAGE_SIGNATURE_BYTE_0        (0xEA)
44162306a36Sopenharmony_ci#define MPI2_INIT_IMAGE_SIGNATURE_BYTE_1        (0x5A)
44262306a36Sopenharmony_ci#define MPI2_INIT_IMAGE_SIGNATURE_BYTE_2        (0xA5)
44362306a36Sopenharmony_ci#define MPI2_INIT_IMAGE_SIGNATURE_BYTE_3        (0x5A)
44462306a36Sopenharmony_ci
44562306a36Sopenharmony_ci#define MPI2_INIT_IMAGE_SIGNATURE_BYTE_4        (0xA5)
44662306a36Sopenharmony_ci#define MPI2_INIT_IMAGE_SIGNATURE_BYTE_5        (0xEA)
44762306a36Sopenharmony_ci#define MPI2_INIT_IMAGE_SIGNATURE_BYTE_6        (0x5A)
44862306a36Sopenharmony_ci#define MPI2_INIT_IMAGE_SIGNATURE_BYTE_7        (0xA5)
44962306a36Sopenharmony_ci
45062306a36Sopenharmony_ci#define MPI2_INIT_IMAGE_SIGNATURE_BYTE_8        (0x5A)
45162306a36Sopenharmony_ci#define MPI2_INIT_IMAGE_SIGNATURE_BYTE_9        (0xA5)
45262306a36Sopenharmony_ci#define MPI2_INIT_IMAGE_SIGNATURE_BYTE_A        (0xEA)
45362306a36Sopenharmony_ci#define MPI2_INIT_IMAGE_SIGNATURE_BYTE_B        (0x5A)
45462306a36Sopenharmony_ci
45562306a36Sopenharmony_ci/*defines for the ResetVector field */
45662306a36Sopenharmony_ci#define MPI2_INIT_IMAGE_RESETVECTOR_OFFSET      (0x14)
45762306a36Sopenharmony_ci
45862306a36Sopenharmony_ci
45962306a36Sopenharmony_ci/* Encrypted Hash Extended Image Data */
46062306a36Sopenharmony_ci
46162306a36Sopenharmony_citypedef struct _MPI25_ENCRYPTED_HASH_ENTRY {
46262306a36Sopenharmony_ci	U8		HashImageType;		/*0x00 */
46362306a36Sopenharmony_ci	U8		HashAlgorithm;		/*0x01 */
46462306a36Sopenharmony_ci	U8		EncryptionAlgorithm;	/*0x02 */
46562306a36Sopenharmony_ci	U8		Reserved1;		/*0x03 */
46662306a36Sopenharmony_ci	U32		Reserved2;		/*0x04 */
46762306a36Sopenharmony_ci	U32		EncryptedHash[1];	/*0x08 */ /* variable length */
46862306a36Sopenharmony_ci} MPI25_ENCRYPTED_HASH_ENTRY, *PTR_MPI25_ENCRYPTED_HASH_ENTRY,
46962306a36Sopenharmony_ciMpi25EncryptedHashEntry_t, *pMpi25EncryptedHashEntry_t;
47062306a36Sopenharmony_ci
47162306a36Sopenharmony_ci/* values for HashImageType */
47262306a36Sopenharmony_ci#define MPI25_HASH_IMAGE_TYPE_UNUSED            (0x00)
47362306a36Sopenharmony_ci#define MPI25_HASH_IMAGE_TYPE_FIRMWARE          (0x01)
47462306a36Sopenharmony_ci#define MPI25_HASH_IMAGE_TYPE_BIOS              (0x02)
47562306a36Sopenharmony_ci
47662306a36Sopenharmony_ci#define MPI26_HASH_IMAGE_TYPE_UNUSED            (0x00)
47762306a36Sopenharmony_ci#define MPI26_HASH_IMAGE_TYPE_FIRMWARE          (0x01)
47862306a36Sopenharmony_ci#define MPI26_HASH_IMAGE_TYPE_BIOS              (0x02)
47962306a36Sopenharmony_ci#define MPI26_HASH_IMAGE_TYPE_KEY_HASH          (0x03)
48062306a36Sopenharmony_ci
48162306a36Sopenharmony_ci/* values for HashAlgorithm */
48262306a36Sopenharmony_ci#define MPI25_HASH_ALGORITHM_UNUSED             (0x00)
48362306a36Sopenharmony_ci#define MPI25_HASH_ALGORITHM_SHA256             (0x01)
48462306a36Sopenharmony_ci
48562306a36Sopenharmony_ci#define MPI26_HASH_ALGORITHM_VER_MASK		(0xE0)
48662306a36Sopenharmony_ci#define MPI26_HASH_ALGORITHM_VER_NONE		(0x00)
48762306a36Sopenharmony_ci#define MPI26_HASH_ALGORITHM_VER_SHA1		(0x20)
48862306a36Sopenharmony_ci#define MPI26_HASH_ALGORITHM_VER_SHA2		(0x40)
48962306a36Sopenharmony_ci#define MPI26_HASH_ALGORITHM_VER_SHA3		(0x60)
49062306a36Sopenharmony_ci#define MPI26_HASH_ALGORITHM_SIZE_MASK		(0x1F)
49162306a36Sopenharmony_ci#define MPI26_HASH_ALGORITHM_SIZE_256           (0x01)
49262306a36Sopenharmony_ci#define MPI26_HASH_ALGORITHM_SIZE_512           (0x02)
49362306a36Sopenharmony_ci
49462306a36Sopenharmony_ci
49562306a36Sopenharmony_ci/* values for EncryptionAlgorithm */
49662306a36Sopenharmony_ci#define MPI25_ENCRYPTION_ALG_UNUSED             (0x00)
49762306a36Sopenharmony_ci#define MPI25_ENCRYPTION_ALG_RSA256             (0x01)
49862306a36Sopenharmony_ci
49962306a36Sopenharmony_ci#define MPI26_ENCRYPTION_ALG_UNUSED             (0x00)
50062306a36Sopenharmony_ci#define MPI26_ENCRYPTION_ALG_RSA256             (0x01)
50162306a36Sopenharmony_ci#define MPI26_ENCRYPTION_ALG_RSA512             (0x02)
50262306a36Sopenharmony_ci#define MPI26_ENCRYPTION_ALG_RSA1024            (0x03)
50362306a36Sopenharmony_ci#define MPI26_ENCRYPTION_ALG_RSA2048            (0x04)
50462306a36Sopenharmony_ci#define MPI26_ENCRYPTION_ALG_RSA4096            (0x05)
50562306a36Sopenharmony_ci
50662306a36Sopenharmony_citypedef struct _MPI25_ENCRYPTED_HASH_DATA {
50762306a36Sopenharmony_ci	U8				ImageVersion;		/*0x00 */
50862306a36Sopenharmony_ci	U8				NumHash;		/*0x01 */
50962306a36Sopenharmony_ci	U16				Reserved1;		/*0x02 */
51062306a36Sopenharmony_ci	U32				Reserved2;		/*0x04 */
51162306a36Sopenharmony_ci	MPI25_ENCRYPTED_HASH_ENTRY	EncryptedHashEntry[1];  /*0x08 */
51262306a36Sopenharmony_ci} MPI25_ENCRYPTED_HASH_DATA, *PTR_MPI25_ENCRYPTED_HASH_DATA,
51362306a36Sopenharmony_ciMpi25EncryptedHashData_t, *pMpi25EncryptedHashData_t;
51462306a36Sopenharmony_ci
51562306a36Sopenharmony_ci
51662306a36Sopenharmony_ci#endif /* MPI2_IMAGE_H */
517