162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * PMC-Sierra SPCv/ve 8088/8089 SAS/SATA based host adapters driver
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Copyright (c) 2008-2009 USI Co., Ltd.
562306a36Sopenharmony_ci * All rights reserved.
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci * Redistribution and use in source and binary forms, with or without
862306a36Sopenharmony_ci * modification, are permitted provided that the following conditions
962306a36Sopenharmony_ci * are met:
1062306a36Sopenharmony_ci * 1. Redistributions of source code must retain the above copyright
1162306a36Sopenharmony_ci *	notice, this list of conditions, and the following disclaimer,
1262306a36Sopenharmony_ci *	without modification.
1362306a36Sopenharmony_ci * 2. Redistributions in binary form must reproduce at minimum a disclaimer
1462306a36Sopenharmony_ci *	substantially similar to the "NO WARRANTY" disclaimer below
1562306a36Sopenharmony_ci *	("Disclaimer") and any redistribution must be conditioned upon
1662306a36Sopenharmony_ci *	including a substantially similar Disclaimer requirement for further
1762306a36Sopenharmony_ci *	binary redistribution.
1862306a36Sopenharmony_ci * 3. Neither the names of the above-listed copyright holders nor the names
1962306a36Sopenharmony_ci *	of any contributors may be used to endorse or promote products derived
2062306a36Sopenharmony_ci *	from this software without specific prior written permission.
2162306a36Sopenharmony_ci *
2262306a36Sopenharmony_ci * Alternatively, this software may be distributed under the terms of the
2362306a36Sopenharmony_ci * GNU General Public License ("GPL") version 2 as published by the Free
2462306a36Sopenharmony_ci * Software Foundation.
2562306a36Sopenharmony_ci *
2662306a36Sopenharmony_ci * NO WARRANTY
2762306a36Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2862306a36Sopenharmony_ci * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2962306a36Sopenharmony_ci * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
3062306a36Sopenharmony_ci * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3162306a36Sopenharmony_ci * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3262306a36Sopenharmony_ci * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3362306a36Sopenharmony_ci * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3462306a36Sopenharmony_ci * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
3562306a36Sopenharmony_ci * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
3662306a36Sopenharmony_ci * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3762306a36Sopenharmony_ci * POSSIBILITY OF SUCH DAMAGES.
3862306a36Sopenharmony_ci *
3962306a36Sopenharmony_ci */
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci#ifndef _PMC8001_REG_H_
4262306a36Sopenharmony_ci#define _PMC8001_REG_H_
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci#include <linux/types.h>
4562306a36Sopenharmony_ci#include <scsi/libsas.h>
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci/* for Request Opcode of IOMB */
4862306a36Sopenharmony_ci#define OPC_INB_ECHO				1	/* 0x000 */
4962306a36Sopenharmony_ci#define OPC_INB_PHYSTART			4	/* 0x004 */
5062306a36Sopenharmony_ci#define OPC_INB_PHYSTOP				5	/* 0x005 */
5162306a36Sopenharmony_ci#define OPC_INB_SSPINIIOSTART			6	/* 0x006 */
5262306a36Sopenharmony_ci#define OPC_INB_SSPINITMSTART			7	/* 0x007 */
5362306a36Sopenharmony_ci/* 0x8 RESV IN SPCv */
5462306a36Sopenharmony_ci#define OPC_INB_RSVD				8	/* 0x008 */
5562306a36Sopenharmony_ci#define OPC_INB_DEV_HANDLE_ACCEPT		9	/* 0x009 */
5662306a36Sopenharmony_ci#define OPC_INB_SSPTGTIOSTART			10	/* 0x00A */
5762306a36Sopenharmony_ci#define OPC_INB_SSPTGTRSPSTART			11	/* 0x00B */
5862306a36Sopenharmony_ci/* 0xC, 0xD, 0xE removed in SPCv */
5962306a36Sopenharmony_ci#define OPC_INB_SSP_ABORT			15	/* 0x00F */
6062306a36Sopenharmony_ci#define OPC_INB_DEREG_DEV_HANDLE		16	/* 0x010 */
6162306a36Sopenharmony_ci#define OPC_INB_GET_DEV_HANDLE			17	/* 0x011 */
6262306a36Sopenharmony_ci#define OPC_INB_SMP_REQUEST			18	/* 0x012 */
6362306a36Sopenharmony_ci/* 0x13 SMP_RESPONSE is removed in SPCv */
6462306a36Sopenharmony_ci#define OPC_INB_SMP_ABORT			20	/* 0x014 */
6562306a36Sopenharmony_ci/* 0x16 RESV IN SPCv */
6662306a36Sopenharmony_ci#define OPC_INB_RSVD1				22	/* 0x016 */
6762306a36Sopenharmony_ci#define OPC_INB_SATA_HOST_OPSTART		23	/* 0x017 */
6862306a36Sopenharmony_ci#define OPC_INB_SATA_ABORT			24	/* 0x018 */
6962306a36Sopenharmony_ci#define OPC_INB_LOCAL_PHY_CONTROL		25	/* 0x019 */
7062306a36Sopenharmony_ci/* 0x1A RESV IN SPCv */
7162306a36Sopenharmony_ci#define OPC_INB_RSVD2				26	/* 0x01A */
7262306a36Sopenharmony_ci#define OPC_INB_FW_FLASH_UPDATE			32	/* 0x020 */
7362306a36Sopenharmony_ci#define OPC_INB_GPIO				34	/* 0x022 */
7462306a36Sopenharmony_ci#define OPC_INB_SAS_DIAG_MODE_START_END		35	/* 0x023 */
7562306a36Sopenharmony_ci#define OPC_INB_SAS_DIAG_EXECUTE		36	/* 0x024 */
7662306a36Sopenharmony_ci/* 0x25 RESV IN SPCv */
7762306a36Sopenharmony_ci#define OPC_INB_RSVD3				37	/* 0x025 */
7862306a36Sopenharmony_ci#define OPC_INB_GET_TIME_STAMP			38	/* 0x026 */
7962306a36Sopenharmony_ci#define OPC_INB_PORT_CONTROL			39	/* 0x027 */
8062306a36Sopenharmony_ci#define OPC_INB_GET_NVMD_DATA			40	/* 0x028 */
8162306a36Sopenharmony_ci#define OPC_INB_SET_NVMD_DATA			41	/* 0x029 */
8262306a36Sopenharmony_ci#define OPC_INB_SET_DEVICE_STATE		42	/* 0x02A */
8362306a36Sopenharmony_ci#define OPC_INB_GET_DEVICE_STATE		43	/* 0x02B */
8462306a36Sopenharmony_ci#define OPC_INB_SET_DEV_INFO			44	/* 0x02C */
8562306a36Sopenharmony_ci/* 0x2D RESV IN SPCv */
8662306a36Sopenharmony_ci#define OPC_INB_RSVD4				45	/* 0x02D */
8762306a36Sopenharmony_ci#define OPC_INB_SGPIO_REGISTER			46	/* 0x02E */
8862306a36Sopenharmony_ci#define OPC_INB_PCIE_DIAG_EXEC			47	/* 0x02F */
8962306a36Sopenharmony_ci#define OPC_INB_SET_CONTROLLER_CONFIG		48	/* 0x030 */
9062306a36Sopenharmony_ci#define OPC_INB_GET_CONTROLLER_CONFIG		49	/* 0x031 */
9162306a36Sopenharmony_ci#define OPC_INB_REG_DEV				50	/* 0x032 */
9262306a36Sopenharmony_ci#define OPC_INB_SAS_HW_EVENT_ACK		51	/* 0x033 */
9362306a36Sopenharmony_ci#define OPC_INB_GET_DEVICE_INFO			52	/* 0x034 */
9462306a36Sopenharmony_ci#define OPC_INB_GET_PHY_PROFILE			53	/* 0x035 */
9562306a36Sopenharmony_ci#define OPC_INB_FLASH_OP_EXT			54	/* 0x036 */
9662306a36Sopenharmony_ci#define OPC_INB_SET_PHY_PROFILE			55	/* 0x037 */
9762306a36Sopenharmony_ci#define OPC_INB_KEK_MANAGEMENT			256	/* 0x100 */
9862306a36Sopenharmony_ci#define OPC_INB_DEK_MANAGEMENT			257	/* 0x101 */
9962306a36Sopenharmony_ci#define OPC_INB_SSP_INI_DIF_ENC_IO		258	/* 0x102 */
10062306a36Sopenharmony_ci#define OPC_INB_SATA_DIF_ENC_IO			259	/* 0x103 */
10162306a36Sopenharmony_ci
10262306a36Sopenharmony_ci/* for Response Opcode of IOMB */
10362306a36Sopenharmony_ci#define OPC_OUB_ECHO					1	/* 0x001 */
10462306a36Sopenharmony_ci#define OPC_OUB_RSVD					4	/* 0x004 */
10562306a36Sopenharmony_ci#define OPC_OUB_SSP_COMP				5	/* 0x005 */
10662306a36Sopenharmony_ci#define OPC_OUB_SMP_COMP				6	/* 0x006 */
10762306a36Sopenharmony_ci#define OPC_OUB_LOCAL_PHY_CNTRL				7	/* 0x007 */
10862306a36Sopenharmony_ci#define OPC_OUB_RSVD1					10	/* 0x00A */
10962306a36Sopenharmony_ci#define OPC_OUB_DEREG_DEV				11	/* 0x00B */
11062306a36Sopenharmony_ci#define OPC_OUB_GET_DEV_HANDLE				12	/* 0x00C */
11162306a36Sopenharmony_ci#define OPC_OUB_SATA_COMP				13	/* 0x00D */
11262306a36Sopenharmony_ci#define OPC_OUB_SATA_EVENT				14	/* 0x00E */
11362306a36Sopenharmony_ci#define OPC_OUB_SSP_EVENT				15	/* 0x00F */
11462306a36Sopenharmony_ci#define OPC_OUB_RSVD2					16	/* 0x010 */
11562306a36Sopenharmony_ci/* 0x11 - SMP_RECEIVED Notification removed in SPCv*/
11662306a36Sopenharmony_ci#define OPC_OUB_SSP_RECV_EVENT				18	/* 0x012 */
11762306a36Sopenharmony_ci#define OPC_OUB_RSVD3					19	/* 0x013 */
11862306a36Sopenharmony_ci#define OPC_OUB_FW_FLASH_UPDATE				20	/* 0x014 */
11962306a36Sopenharmony_ci#define OPC_OUB_GPIO_RESPONSE				22	/* 0x016 */
12062306a36Sopenharmony_ci#define OPC_OUB_GPIO_EVENT				23	/* 0x017 */
12162306a36Sopenharmony_ci#define OPC_OUB_GENERAL_EVENT				24	/* 0x018 */
12262306a36Sopenharmony_ci#define OPC_OUB_SSP_ABORT_RSP				26	/* 0x01A */
12362306a36Sopenharmony_ci#define OPC_OUB_SATA_ABORT_RSP				27	/* 0x01B */
12462306a36Sopenharmony_ci#define OPC_OUB_SAS_DIAG_MODE_START_END			28	/* 0x01C */
12562306a36Sopenharmony_ci#define OPC_OUB_SAS_DIAG_EXECUTE			29	/* 0x01D */
12662306a36Sopenharmony_ci#define OPC_OUB_GET_TIME_STAMP				30	/* 0x01E */
12762306a36Sopenharmony_ci#define OPC_OUB_RSVD4					31	/* 0x01F */
12862306a36Sopenharmony_ci#define OPC_OUB_PORT_CONTROL				32	/* 0x020 */
12962306a36Sopenharmony_ci#define OPC_OUB_SKIP_ENTRY				33	/* 0x021 */
13062306a36Sopenharmony_ci#define OPC_OUB_SMP_ABORT_RSP				34	/* 0x022 */
13162306a36Sopenharmony_ci#define OPC_OUB_GET_NVMD_DATA				35	/* 0x023 */
13262306a36Sopenharmony_ci#define OPC_OUB_SET_NVMD_DATA				36	/* 0x024 */
13362306a36Sopenharmony_ci#define OPC_OUB_DEVICE_HANDLE_REMOVAL			37	/* 0x025 */
13462306a36Sopenharmony_ci#define OPC_OUB_SET_DEVICE_STATE			38	/* 0x026 */
13562306a36Sopenharmony_ci#define OPC_OUB_GET_DEVICE_STATE			39	/* 0x027 */
13662306a36Sopenharmony_ci#define OPC_OUB_SET_DEV_INFO				40	/* 0x028 */
13762306a36Sopenharmony_ci#define OPC_OUB_RSVD5					41	/* 0x029 */
13862306a36Sopenharmony_ci#define OPC_OUB_HW_EVENT				1792	/* 0x700 */
13962306a36Sopenharmony_ci#define OPC_OUB_DEV_HANDLE_ARRIV			1824	/* 0x720 */
14062306a36Sopenharmony_ci#define OPC_OUB_THERM_HW_EVENT				1840	/* 0x730 */
14162306a36Sopenharmony_ci#define OPC_OUB_SGPIO_RESP				2094	/* 0x82E */
14262306a36Sopenharmony_ci#define OPC_OUB_PCIE_DIAG_EXECUTE			2095	/* 0x82F */
14362306a36Sopenharmony_ci#define OPC_OUB_DEV_REGIST				2098	/* 0x832 */
14462306a36Sopenharmony_ci#define OPC_OUB_SAS_HW_EVENT_ACK			2099	/* 0x833 */
14562306a36Sopenharmony_ci#define OPC_OUB_GET_DEVICE_INFO				2100	/* 0x834 */
14662306a36Sopenharmony_ci/* spcv specific commands */
14762306a36Sopenharmony_ci#define OPC_OUB_PHY_START_RESP				2052	/* 0x804 */
14862306a36Sopenharmony_ci#define OPC_OUB_PHY_STOP_RESP				2053	/* 0x805 */
14962306a36Sopenharmony_ci#define OPC_OUB_SET_CONTROLLER_CONFIG			2096	/* 0x830 */
15062306a36Sopenharmony_ci#define OPC_OUB_GET_CONTROLLER_CONFIG			2097	/* 0x831 */
15162306a36Sopenharmony_ci#define OPC_OUB_GET_PHY_PROFILE				2101	/* 0x835 */
15262306a36Sopenharmony_ci#define OPC_OUB_FLASH_OP_EXT				2102	/* 0x836 */
15362306a36Sopenharmony_ci#define OPC_OUB_SET_PHY_PROFILE				2103	/* 0x837 */
15462306a36Sopenharmony_ci#define OPC_OUB_KEK_MANAGEMENT_RESP			2304	/* 0x900 */
15562306a36Sopenharmony_ci#define OPC_OUB_DEK_MANAGEMENT_RESP			2305	/* 0x901 */
15662306a36Sopenharmony_ci#define OPC_OUB_SSP_COALESCED_COMP_RESP			2306	/* 0x902 */
15762306a36Sopenharmony_ci
15862306a36Sopenharmony_ci/* for phy start*/
15962306a36Sopenharmony_ci#define SSC_DISABLE_15			(0x01 << 16)
16062306a36Sopenharmony_ci#define SSC_DISABLE_30			(0x02 << 16)
16162306a36Sopenharmony_ci#define SSC_DISABLE_60			(0x04 << 16)
16262306a36Sopenharmony_ci#define SAS_ASE				(0x01 << 15)
16362306a36Sopenharmony_ci#define SPINHOLD_DISABLE		(0x00 << 14)
16462306a36Sopenharmony_ci#define SPINHOLD_ENABLE			(0x01 << 14)
16562306a36Sopenharmony_ci#define LINKMODE_SAS			(0x01 << 12)
16662306a36Sopenharmony_ci#define LINKMODE_DSATA			(0x02 << 12)
16762306a36Sopenharmony_ci#define LINKMODE_AUTO			(0x03 << 12)
16862306a36Sopenharmony_ci#define LINKRATE_15			(0x01 << 8)
16962306a36Sopenharmony_ci#define LINKRATE_30			(0x02 << 8)
17062306a36Sopenharmony_ci#define LINKRATE_60			(0x04 << 8)
17162306a36Sopenharmony_ci#define LINKRATE_120			(0x08 << 8)
17262306a36Sopenharmony_ci
17362306a36Sopenharmony_ci/*phy_stop*/
17462306a36Sopenharmony_ci#define PHY_STOP_SUCCESS		0x00
17562306a36Sopenharmony_ci#define PHY_STOP_ERR_DEVICE_ATTACHED	0x1046
17662306a36Sopenharmony_ci
17762306a36Sopenharmony_ci/* phy_profile */
17862306a36Sopenharmony_ci#define SAS_PHY_ANALOG_SETTINGS_PAGE	0x04
17962306a36Sopenharmony_ci#define PHY_DWORD_LENGTH		0xC
18062306a36Sopenharmony_ci
18162306a36Sopenharmony_ci/* Thermal related */
18262306a36Sopenharmony_ci#define	THERMAL_ENABLE			0x1
18362306a36Sopenharmony_ci#define	THERMAL_LOG_ENABLE		0x1
18462306a36Sopenharmony_ci#define THERMAL_PAGE_CODE_7H		0x6
18562306a36Sopenharmony_ci#define THERMAL_PAGE_CODE_8H		0x7
18662306a36Sopenharmony_ci#define LTEMPHIL			 70
18762306a36Sopenharmony_ci#define RTEMPHIL			100
18862306a36Sopenharmony_ci
18962306a36Sopenharmony_ci/* Encryption info */
19062306a36Sopenharmony_ci#define SCRATCH_PAD3_ENC_DISABLED	0x00000000
19162306a36Sopenharmony_ci#define SCRATCH_PAD3_ENC_DIS_ERR	0x00000001
19262306a36Sopenharmony_ci#define SCRATCH_PAD3_ENC_ENA_ERR	0x00000002
19362306a36Sopenharmony_ci#define SCRATCH_PAD3_ENC_READY		0x00000003
19462306a36Sopenharmony_ci#define SCRATCH_PAD3_ENC_MASK		SCRATCH_PAD3_ENC_READY
19562306a36Sopenharmony_ci
19662306a36Sopenharmony_ci#define SCRATCH_PAD3_XTS_ENABLED		(1 << 14)
19762306a36Sopenharmony_ci#define SCRATCH_PAD3_SMA_ENABLED		(1 << 4)
19862306a36Sopenharmony_ci#define SCRATCH_PAD3_SMB_ENABLED		(1 << 5)
19962306a36Sopenharmony_ci#define SCRATCH_PAD3_SMF_ENABLED		0
20062306a36Sopenharmony_ci#define SCRATCH_PAD3_SM_MASK			0x000000F0
20162306a36Sopenharmony_ci#define SCRATCH_PAD3_ERR_CODE			0x00FF0000
20262306a36Sopenharmony_ci
20362306a36Sopenharmony_ci#define SEC_MODE_SMF				0x0
20462306a36Sopenharmony_ci#define SEC_MODE_SMA				0x100
20562306a36Sopenharmony_ci#define SEC_MODE_SMB				0x200
20662306a36Sopenharmony_ci#define CIPHER_MODE_ECB				0x00000001
20762306a36Sopenharmony_ci#define CIPHER_MODE_XTS				0x00000002
20862306a36Sopenharmony_ci#define KEK_MGMT_SUBOP_KEYCARDUPDATE		0x4
20962306a36Sopenharmony_ci
21062306a36Sopenharmony_ci/* SAS protocol timer configuration page */
21162306a36Sopenharmony_ci#define SAS_PROTOCOL_TIMER_CONFIG_PAGE  0x04
21262306a36Sopenharmony_ci#define STP_MCT_TMO                     32
21362306a36Sopenharmony_ci#define SSP_MCT_TMO                     32
21462306a36Sopenharmony_ci#define SAS_MAX_OPEN_TIME				5
21562306a36Sopenharmony_ci#define SMP_MAX_CONN_TIMER              0xFF
21662306a36Sopenharmony_ci#define STP_FRM_TIMER                   0
21762306a36Sopenharmony_ci#define STP_IDLE_TIME                   5 /* 5 us; controller default */
21862306a36Sopenharmony_ci#define SAS_MFD                         0
21962306a36Sopenharmony_ci#define SAS_OPNRJT_RTRY_INTVL           2
22062306a36Sopenharmony_ci#define SAS_DOPNRJT_RTRY_TMO            128
22162306a36Sopenharmony_ci#define SAS_COPNRJT_RTRY_TMO            128
22262306a36Sopenharmony_ci
22362306a36Sopenharmony_ci#define SPCV_DOORBELL_CLEAR_TIMEOUT	(30 * 50) /* 30 sec */
22462306a36Sopenharmony_ci#define SPC_DOORBELL_CLEAR_TIMEOUT	(15 * 50) /* 15 sec */
22562306a36Sopenharmony_ci
22662306a36Sopenharmony_ci/*
22762306a36Sopenharmony_ci  Making ORR bigger than IT NEXUS LOSS which is 2000000us = 2 second.
22862306a36Sopenharmony_ci  Assuming a bigger value 3 second, 3000000/128 = 23437.5 where 128
22962306a36Sopenharmony_ci  is DOPNRJT_RTRY_TMO
23062306a36Sopenharmony_ci*/
23162306a36Sopenharmony_ci#define SAS_DOPNRJT_RTRY_THR            23438
23262306a36Sopenharmony_ci#define SAS_COPNRJT_RTRY_THR            23438
23362306a36Sopenharmony_ci#define SAS_MAX_AIP                     0x200000
23462306a36Sopenharmony_ci#define IT_NEXUS_TIMEOUT       0x7D0
23562306a36Sopenharmony_ci#define PORT_RECOVERY_TIMEOUT  ((IT_NEXUS_TIMEOUT/100) + 30)
23662306a36Sopenharmony_ci/* Port recovery timeout, 10000 ms for PM8006 controller */
23762306a36Sopenharmony_ci#define CHIP_8006_PORT_RECOVERY_TIMEOUT 0x640000
23862306a36Sopenharmony_ci
23962306a36Sopenharmony_ci#ifdef __LITTLE_ENDIAN_BITFIELD
24062306a36Sopenharmony_cistruct sas_identify_frame_local {
24162306a36Sopenharmony_ci	/* Byte 0 */
24262306a36Sopenharmony_ci	u8  frame_type:4;
24362306a36Sopenharmony_ci	u8  dev_type:3;
24462306a36Sopenharmony_ci	u8  _un0:1;
24562306a36Sopenharmony_ci
24662306a36Sopenharmony_ci	/* Byte 1 */
24762306a36Sopenharmony_ci	u8  _un1;
24862306a36Sopenharmony_ci
24962306a36Sopenharmony_ci	/* Byte 2 */
25062306a36Sopenharmony_ci	union {
25162306a36Sopenharmony_ci		struct {
25262306a36Sopenharmony_ci			u8  _un20:1;
25362306a36Sopenharmony_ci			u8  smp_iport:1;
25462306a36Sopenharmony_ci			u8  stp_iport:1;
25562306a36Sopenharmony_ci			u8  ssp_iport:1;
25662306a36Sopenharmony_ci			u8  _un247:4;
25762306a36Sopenharmony_ci		};
25862306a36Sopenharmony_ci		u8 initiator_bits;
25962306a36Sopenharmony_ci	};
26062306a36Sopenharmony_ci
26162306a36Sopenharmony_ci	/* Byte 3 */
26262306a36Sopenharmony_ci	union {
26362306a36Sopenharmony_ci		struct {
26462306a36Sopenharmony_ci			u8  _un30:1;
26562306a36Sopenharmony_ci			u8 smp_tport:1;
26662306a36Sopenharmony_ci			u8 stp_tport:1;
26762306a36Sopenharmony_ci			u8 ssp_tport:1;
26862306a36Sopenharmony_ci			u8 _un347:4;
26962306a36Sopenharmony_ci		};
27062306a36Sopenharmony_ci		u8 target_bits;
27162306a36Sopenharmony_ci	};
27262306a36Sopenharmony_ci
27362306a36Sopenharmony_ci	/* Byte 4 - 11 */
27462306a36Sopenharmony_ci	u8 _un4_11[8];
27562306a36Sopenharmony_ci
27662306a36Sopenharmony_ci	/* Byte 12 - 19 */
27762306a36Sopenharmony_ci	u8 sas_addr[SAS_ADDR_SIZE];
27862306a36Sopenharmony_ci
27962306a36Sopenharmony_ci	/* Byte 20 */
28062306a36Sopenharmony_ci	u8 phy_id;
28162306a36Sopenharmony_ci
28262306a36Sopenharmony_ci	u8 _un21_27[7];
28362306a36Sopenharmony_ci
28462306a36Sopenharmony_ci} __packed;
28562306a36Sopenharmony_ci
28662306a36Sopenharmony_ci#elif defined(__BIG_ENDIAN_BITFIELD)
28762306a36Sopenharmony_cistruct sas_identify_frame_local {
28862306a36Sopenharmony_ci	/* Byte 0 */
28962306a36Sopenharmony_ci	u8  _un0:1;
29062306a36Sopenharmony_ci	u8  dev_type:3;
29162306a36Sopenharmony_ci	u8  frame_type:4;
29262306a36Sopenharmony_ci
29362306a36Sopenharmony_ci	/* Byte 1 */
29462306a36Sopenharmony_ci	u8  _un1;
29562306a36Sopenharmony_ci
29662306a36Sopenharmony_ci	/* Byte 2 */
29762306a36Sopenharmony_ci	union {
29862306a36Sopenharmony_ci		struct {
29962306a36Sopenharmony_ci			u8  _un247:4;
30062306a36Sopenharmony_ci			u8  ssp_iport:1;
30162306a36Sopenharmony_ci			u8  stp_iport:1;
30262306a36Sopenharmony_ci			u8  smp_iport:1;
30362306a36Sopenharmony_ci			u8  _un20:1;
30462306a36Sopenharmony_ci		};
30562306a36Sopenharmony_ci		u8 initiator_bits;
30662306a36Sopenharmony_ci	};
30762306a36Sopenharmony_ci
30862306a36Sopenharmony_ci	/* Byte 3 */
30962306a36Sopenharmony_ci	union {
31062306a36Sopenharmony_ci		struct {
31162306a36Sopenharmony_ci			u8 _un347:4;
31262306a36Sopenharmony_ci			u8 ssp_tport:1;
31362306a36Sopenharmony_ci			u8 stp_tport:1;
31462306a36Sopenharmony_ci			u8 smp_tport:1;
31562306a36Sopenharmony_ci			u8 _un30:1;
31662306a36Sopenharmony_ci		};
31762306a36Sopenharmony_ci		u8 target_bits;
31862306a36Sopenharmony_ci	};
31962306a36Sopenharmony_ci
32062306a36Sopenharmony_ci	/* Byte 4 - 11 */
32162306a36Sopenharmony_ci	u8 _un4_11[8];
32262306a36Sopenharmony_ci
32362306a36Sopenharmony_ci	/* Byte 12 - 19 */
32462306a36Sopenharmony_ci	u8 sas_addr[SAS_ADDR_SIZE];
32562306a36Sopenharmony_ci
32662306a36Sopenharmony_ci	/* Byte 20 */
32762306a36Sopenharmony_ci	u8 phy_id;
32862306a36Sopenharmony_ci
32962306a36Sopenharmony_ci	u8 _un21_27[7];
33062306a36Sopenharmony_ci} __packed;
33162306a36Sopenharmony_ci#else
33262306a36Sopenharmony_ci#error "Bitfield order not defined!"
33362306a36Sopenharmony_ci#endif
33462306a36Sopenharmony_ci
33562306a36Sopenharmony_cistruct mpi_msg_hdr {
33662306a36Sopenharmony_ci	__le32	header;	/* Bits [11:0] - Message operation code */
33762306a36Sopenharmony_ci	/* Bits [15:12] - Message Category */
33862306a36Sopenharmony_ci	/* Bits [21:16] - Outboundqueue ID for the
33962306a36Sopenharmony_ci	operation completion message */
34062306a36Sopenharmony_ci	/* Bits [23:22] - Reserved */
34162306a36Sopenharmony_ci	/* Bits [28:24] - Buffer Count, indicates how
34262306a36Sopenharmony_ci	many buffer are allocated for the massage */
34362306a36Sopenharmony_ci	/* Bits [30:29] - Reserved */
34462306a36Sopenharmony_ci	/* Bits [31] - Message Valid bit */
34562306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
34662306a36Sopenharmony_ci
34762306a36Sopenharmony_ci/*
34862306a36Sopenharmony_ci * brief the data structure of PHY Start Command
34962306a36Sopenharmony_ci * use to describe enable the phy (128 bytes)
35062306a36Sopenharmony_ci */
35162306a36Sopenharmony_cistruct phy_start_req {
35262306a36Sopenharmony_ci	__le32	tag;
35362306a36Sopenharmony_ci	__le32	ase_sh_lm_slr_phyid;
35462306a36Sopenharmony_ci	struct sas_identify_frame_local sas_identify; /* 28 Bytes */
35562306a36Sopenharmony_ci	__le32 spasti;
35662306a36Sopenharmony_ci	u32	reserved[21];
35762306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
35862306a36Sopenharmony_ci
35962306a36Sopenharmony_ci/*
36062306a36Sopenharmony_ci * brief the data structure of PHY Start Command
36162306a36Sopenharmony_ci * use to disable the phy (128 bytes)
36262306a36Sopenharmony_ci */
36362306a36Sopenharmony_cistruct phy_stop_req {
36462306a36Sopenharmony_ci	__le32	tag;
36562306a36Sopenharmony_ci	__le32	phy_id;
36662306a36Sopenharmony_ci	u32	reserved[29];
36762306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
36862306a36Sopenharmony_ci
36962306a36Sopenharmony_ci/* set device bits fis - device to host */
37062306a36Sopenharmony_cistruct set_dev_bits_fis {
37162306a36Sopenharmony_ci	u8	fis_type;	/* 0xA1*/
37262306a36Sopenharmony_ci	u8	n_i_pmport;
37362306a36Sopenharmony_ci	/* b7 : n Bit. Notification bit. If set device needs attention. */
37462306a36Sopenharmony_ci	/* b6 : i Bit. Interrupt Bit */
37562306a36Sopenharmony_ci	/* b5-b4: reserved2 */
37662306a36Sopenharmony_ci	/* b3-b0: PM Port */
37762306a36Sopenharmony_ci	u8	status;
37862306a36Sopenharmony_ci	u8	error;
37962306a36Sopenharmony_ci	u32	_r_a;
38062306a36Sopenharmony_ci} __attribute__ ((packed));
38162306a36Sopenharmony_ci/* PIO setup FIS - device to host */
38262306a36Sopenharmony_cistruct pio_setup_fis {
38362306a36Sopenharmony_ci	u8	fis_type;	/* 0x5f */
38462306a36Sopenharmony_ci	u8	i_d_pmPort;
38562306a36Sopenharmony_ci	/* b7 : reserved */
38662306a36Sopenharmony_ci	/* b6 : i bit. Interrupt bit */
38762306a36Sopenharmony_ci	/* b5 : d bit. data transfer direction. set to 1 for device to host
38862306a36Sopenharmony_ci	xfer */
38962306a36Sopenharmony_ci	/* b4 : reserved */
39062306a36Sopenharmony_ci	/* b3-b0: PM Port */
39162306a36Sopenharmony_ci	u8	status;
39262306a36Sopenharmony_ci	u8	error;
39362306a36Sopenharmony_ci	u8	lbal;
39462306a36Sopenharmony_ci	u8	lbam;
39562306a36Sopenharmony_ci	u8	lbah;
39662306a36Sopenharmony_ci	u8	device;
39762306a36Sopenharmony_ci	u8	lbal_exp;
39862306a36Sopenharmony_ci	u8	lbam_exp;
39962306a36Sopenharmony_ci	u8	lbah_exp;
40062306a36Sopenharmony_ci	u8	_r_a;
40162306a36Sopenharmony_ci	u8	sector_count;
40262306a36Sopenharmony_ci	u8	sector_count_exp;
40362306a36Sopenharmony_ci	u8	_r_b;
40462306a36Sopenharmony_ci	u8	e_status;
40562306a36Sopenharmony_ci	u8	_r_c[2];
40662306a36Sopenharmony_ci	u8	transfer_count;
40762306a36Sopenharmony_ci} __attribute__ ((packed));
40862306a36Sopenharmony_ci
40962306a36Sopenharmony_ci/*
41062306a36Sopenharmony_ci * brief the data structure of SATA Completion Response
41162306a36Sopenharmony_ci * use to describe the sata task response (64 bytes)
41262306a36Sopenharmony_ci */
41362306a36Sopenharmony_cistruct sata_completion_resp {
41462306a36Sopenharmony_ci	__le32	tag;
41562306a36Sopenharmony_ci	__le32	status;
41662306a36Sopenharmony_ci	__le32	param;
41762306a36Sopenharmony_ci	u32	sata_resp[12];
41862306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
41962306a36Sopenharmony_ci
42062306a36Sopenharmony_ci/*
42162306a36Sopenharmony_ci * brief the data structure of SAS HW Event Notification
42262306a36Sopenharmony_ci * use to alert the host about the hardware event(64 bytes)
42362306a36Sopenharmony_ci */
42462306a36Sopenharmony_ci/* updated outbound struct for spcv */
42562306a36Sopenharmony_ci
42662306a36Sopenharmony_cistruct hw_event_resp {
42762306a36Sopenharmony_ci	__le32	lr_status_evt_portid;
42862306a36Sopenharmony_ci	__le32	evt_param;
42962306a36Sopenharmony_ci	__le32	phyid_npip_portstate;
43062306a36Sopenharmony_ci	struct sas_identify_frame	sas_identify;
43162306a36Sopenharmony_ci	struct dev_to_host_fis	sata_fis;
43262306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
43362306a36Sopenharmony_ci
43462306a36Sopenharmony_ci/*
43562306a36Sopenharmony_ci * brief the data structure for thermal event notification
43662306a36Sopenharmony_ci */
43762306a36Sopenharmony_ci
43862306a36Sopenharmony_cistruct thermal_hw_event {
43962306a36Sopenharmony_ci	__le32	thermal_event;
44062306a36Sopenharmony_ci	__le32	rht_lht;
44162306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
44262306a36Sopenharmony_ci
44362306a36Sopenharmony_ci/*
44462306a36Sopenharmony_ci * brief the data structure of REGISTER DEVICE Command
44562306a36Sopenharmony_ci * use to describe MPI REGISTER DEVICE Command (64 bytes)
44662306a36Sopenharmony_ci */
44762306a36Sopenharmony_ci
44862306a36Sopenharmony_cistruct reg_dev_req {
44962306a36Sopenharmony_ci	__le32	tag;
45062306a36Sopenharmony_ci	__le32	phyid_portid;
45162306a36Sopenharmony_ci	__le32	dtype_dlr_mcn_ir_retry;
45262306a36Sopenharmony_ci	__le32	firstburstsize_ITNexustimeout;
45362306a36Sopenharmony_ci	u8	sas_addr[SAS_ADDR_SIZE];
45462306a36Sopenharmony_ci	__le32	upper_device_id;
45562306a36Sopenharmony_ci	u32	reserved[24];
45662306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
45762306a36Sopenharmony_ci
45862306a36Sopenharmony_ci/*
45962306a36Sopenharmony_ci * brief the data structure of DEREGISTER DEVICE Command
46062306a36Sopenharmony_ci * use to request spc to remove all internal resources associated
46162306a36Sopenharmony_ci * with the device id (64 bytes)
46262306a36Sopenharmony_ci */
46362306a36Sopenharmony_ci
46462306a36Sopenharmony_cistruct dereg_dev_req {
46562306a36Sopenharmony_ci	__le32	tag;
46662306a36Sopenharmony_ci	__le32	device_id;
46762306a36Sopenharmony_ci	u32	reserved[29];
46862306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
46962306a36Sopenharmony_ci
47062306a36Sopenharmony_ci/*
47162306a36Sopenharmony_ci * brief the data structure of DEVICE_REGISTRATION Response
47262306a36Sopenharmony_ci * use to notify the completion of the device registration (64 bytes)
47362306a36Sopenharmony_ci */
47462306a36Sopenharmony_cistruct dev_reg_resp {
47562306a36Sopenharmony_ci	__le32	tag;
47662306a36Sopenharmony_ci	__le32	status;
47762306a36Sopenharmony_ci	__le32	device_id;
47862306a36Sopenharmony_ci	u32	reserved[12];
47962306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
48062306a36Sopenharmony_ci
48162306a36Sopenharmony_ci/*
48262306a36Sopenharmony_ci * brief the data structure of Local PHY Control Command
48362306a36Sopenharmony_ci * use to issue PHY CONTROL to local phy (64 bytes)
48462306a36Sopenharmony_ci */
48562306a36Sopenharmony_cistruct local_phy_ctl_req {
48662306a36Sopenharmony_ci	__le32	tag;
48762306a36Sopenharmony_ci	__le32	phyop_phyid;
48862306a36Sopenharmony_ci	u32	reserved1[29];
48962306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
49062306a36Sopenharmony_ci
49162306a36Sopenharmony_ci/**
49262306a36Sopenharmony_ci * brief the data structure of Local Phy Control Response
49362306a36Sopenharmony_ci * use to describe MPI Local Phy Control Response (64 bytes)
49462306a36Sopenharmony_ci */
49562306a36Sopenharmony_ci struct local_phy_ctl_resp {
49662306a36Sopenharmony_ci	__le32	tag;
49762306a36Sopenharmony_ci	__le32	phyop_phyid;
49862306a36Sopenharmony_ci	__le32	status;
49962306a36Sopenharmony_ci	u32	reserved[12];
50062306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
50162306a36Sopenharmony_ci
50262306a36Sopenharmony_ci#define OP_BITS 0x0000FF00
50362306a36Sopenharmony_ci#define ID_BITS 0x000000FF
50462306a36Sopenharmony_ci
50562306a36Sopenharmony_ci/*
50662306a36Sopenharmony_ci * brief the data structure of PORT Control Command
50762306a36Sopenharmony_ci * use to control port properties (64 bytes)
50862306a36Sopenharmony_ci */
50962306a36Sopenharmony_ci
51062306a36Sopenharmony_cistruct port_ctl_req {
51162306a36Sopenharmony_ci	__le32	tag;
51262306a36Sopenharmony_ci	__le32	portop_portid;
51362306a36Sopenharmony_ci	__le32	param0;
51462306a36Sopenharmony_ci	__le32	param1;
51562306a36Sopenharmony_ci	u32	reserved1[27];
51662306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
51762306a36Sopenharmony_ci
51862306a36Sopenharmony_ci/*
51962306a36Sopenharmony_ci * brief the data structure of HW Event Ack Command
52062306a36Sopenharmony_ci * use to acknowledge receive HW event (64 bytes)
52162306a36Sopenharmony_ci */
52262306a36Sopenharmony_cistruct hw_event_ack_req {
52362306a36Sopenharmony_ci	__le32	tag;
52462306a36Sopenharmony_ci	__le32	phyid_sea_portid;
52562306a36Sopenharmony_ci	__le32	param0;
52662306a36Sopenharmony_ci	__le32	param1;
52762306a36Sopenharmony_ci	u32	reserved1[27];
52862306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
52962306a36Sopenharmony_ci
53062306a36Sopenharmony_ci/*
53162306a36Sopenharmony_ci * brief the data structure of PHY_START Response Command
53262306a36Sopenharmony_ci * indicates the completion of PHY_START command (64 bytes)
53362306a36Sopenharmony_ci */
53462306a36Sopenharmony_cistruct phy_start_resp {
53562306a36Sopenharmony_ci	__le32	tag;
53662306a36Sopenharmony_ci	__le32	status;
53762306a36Sopenharmony_ci	__le32	phyid;
53862306a36Sopenharmony_ci	u32	reserved[12];
53962306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
54062306a36Sopenharmony_ci
54162306a36Sopenharmony_ci/*
54262306a36Sopenharmony_ci * brief the data structure of PHY_STOP Response Command
54362306a36Sopenharmony_ci * indicates the completion of PHY_STOP command (64 bytes)
54462306a36Sopenharmony_ci */
54562306a36Sopenharmony_cistruct phy_stop_resp {
54662306a36Sopenharmony_ci	__le32	tag;
54762306a36Sopenharmony_ci	__le32	status;
54862306a36Sopenharmony_ci	__le32	phyid;
54962306a36Sopenharmony_ci	u32	reserved[12];
55062306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
55162306a36Sopenharmony_ci
55262306a36Sopenharmony_ci/*
55362306a36Sopenharmony_ci * brief the data structure of SSP Completion Response
55462306a36Sopenharmony_ci * use to indicate a SSP Completion (n bytes)
55562306a36Sopenharmony_ci */
55662306a36Sopenharmony_cistruct ssp_completion_resp {
55762306a36Sopenharmony_ci	__le32	tag;
55862306a36Sopenharmony_ci	__le32	status;
55962306a36Sopenharmony_ci	__le32	param;
56062306a36Sopenharmony_ci	__le32	ssptag_rescv_rescpad;
56162306a36Sopenharmony_ci	struct ssp_response_iu ssp_resp_iu;
56262306a36Sopenharmony_ci	__le32	residual_count;
56362306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
56462306a36Sopenharmony_ci
56562306a36Sopenharmony_ci#define SSP_RESCV_BIT	0x00010000
56662306a36Sopenharmony_ci
56762306a36Sopenharmony_ci/*
56862306a36Sopenharmony_ci * brief the data structure of SATA EVNET response
56962306a36Sopenharmony_ci * use to indicate a SATA Completion (64 bytes)
57062306a36Sopenharmony_ci */
57162306a36Sopenharmony_cistruct sata_event_resp {
57262306a36Sopenharmony_ci	__le32 tag;
57362306a36Sopenharmony_ci	__le32 event;
57462306a36Sopenharmony_ci	__le32 port_id;
57562306a36Sopenharmony_ci	__le32 device_id;
57662306a36Sopenharmony_ci	u32 reserved;
57762306a36Sopenharmony_ci	__le32 event_param0;
57862306a36Sopenharmony_ci	__le32 event_param1;
57962306a36Sopenharmony_ci	__le32 sata_addr_h32;
58062306a36Sopenharmony_ci	__le32 sata_addr_l32;
58162306a36Sopenharmony_ci	__le32 e_udt1_udt0_crc;
58262306a36Sopenharmony_ci	__le32 e_udt5_udt4_udt3_udt2;
58362306a36Sopenharmony_ci	__le32 a_udt1_udt0_crc;
58462306a36Sopenharmony_ci	__le32 a_udt5_udt4_udt3_udt2;
58562306a36Sopenharmony_ci	__le32 hwdevid_diferr;
58662306a36Sopenharmony_ci	__le32 err_framelen_byteoffset;
58762306a36Sopenharmony_ci	__le32 err_dataframe;
58862306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
58962306a36Sopenharmony_ci
59062306a36Sopenharmony_ci/*
59162306a36Sopenharmony_ci * brief the data structure of SSP EVNET esponse
59262306a36Sopenharmony_ci * use to indicate a SSP Completion (64 bytes)
59362306a36Sopenharmony_ci */
59462306a36Sopenharmony_cistruct ssp_event_resp {
59562306a36Sopenharmony_ci	__le32 tag;
59662306a36Sopenharmony_ci	__le32 event;
59762306a36Sopenharmony_ci	__le32 port_id;
59862306a36Sopenharmony_ci	__le32 device_id;
59962306a36Sopenharmony_ci	__le32 ssp_tag;
60062306a36Sopenharmony_ci	__le32 event_param0;
60162306a36Sopenharmony_ci	__le32 event_param1;
60262306a36Sopenharmony_ci	__le32 sas_addr_h32;
60362306a36Sopenharmony_ci	__le32 sas_addr_l32;
60462306a36Sopenharmony_ci	__le32 e_udt1_udt0_crc;
60562306a36Sopenharmony_ci	__le32 e_udt5_udt4_udt3_udt2;
60662306a36Sopenharmony_ci	__le32 a_udt1_udt0_crc;
60762306a36Sopenharmony_ci	__le32 a_udt5_udt4_udt3_udt2;
60862306a36Sopenharmony_ci	__le32 hwdevid_diferr;
60962306a36Sopenharmony_ci	__le32 err_framelen_byteoffset;
61062306a36Sopenharmony_ci	__le32 err_dataframe;
61162306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
61262306a36Sopenharmony_ci
61362306a36Sopenharmony_ci/**
61462306a36Sopenharmony_ci * brief the data structure of General Event Notification Response
61562306a36Sopenharmony_ci * use to describe MPI General Event Notification Response (64 bytes)
61662306a36Sopenharmony_ci */
61762306a36Sopenharmony_cistruct general_event_resp {
61862306a36Sopenharmony_ci	__le32	status;
61962306a36Sopenharmony_ci	__le32	inb_IOMB_payload[14];
62062306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
62162306a36Sopenharmony_ci
62262306a36Sopenharmony_ci#define GENERAL_EVENT_PAYLOAD	14
62362306a36Sopenharmony_ci#define OPCODE_BITS	0x00000fff
62462306a36Sopenharmony_ci
62562306a36Sopenharmony_ci/*
62662306a36Sopenharmony_ci * brief the data structure of SMP Request Command
62762306a36Sopenharmony_ci * use to describe MPI SMP REQUEST Command (64 bytes)
62862306a36Sopenharmony_ci */
62962306a36Sopenharmony_cistruct smp_req {
63062306a36Sopenharmony_ci	__le32	tag;
63162306a36Sopenharmony_ci	__le32	device_id;
63262306a36Sopenharmony_ci	__le32	len_ip_ir;
63362306a36Sopenharmony_ci	/* Bits [0] - Indirect response */
63462306a36Sopenharmony_ci	/* Bits [1] - Indirect Payload */
63562306a36Sopenharmony_ci	/* Bits [15:2] - Reserved */
63662306a36Sopenharmony_ci	/* Bits [23:16] - direct payload Len */
63762306a36Sopenharmony_ci	/* Bits [31:24] - Reserved */
63862306a36Sopenharmony_ci	u8	smp_req16[16];
63962306a36Sopenharmony_ci	union {
64062306a36Sopenharmony_ci		u8	smp_req[32];
64162306a36Sopenharmony_ci		struct {
64262306a36Sopenharmony_ci			__le64 long_req_addr;/* sg dma address, LE */
64362306a36Sopenharmony_ci			__le32 long_req_size;/* LE */
64462306a36Sopenharmony_ci			u32	_r_a;
64562306a36Sopenharmony_ci			__le64 long_resp_addr;/* sg dma address, LE */
64662306a36Sopenharmony_ci			__le32 long_resp_size;/* LE */
64762306a36Sopenharmony_ci			u32	_r_b;
64862306a36Sopenharmony_ci			} long_smp_req;/* sequencer extension */
64962306a36Sopenharmony_ci	};
65062306a36Sopenharmony_ci	__le32	rsvd[16];
65162306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
65262306a36Sopenharmony_ci/*
65362306a36Sopenharmony_ci * brief the data structure of SMP Completion Response
65462306a36Sopenharmony_ci * use to describe MPI SMP Completion Response (64 bytes)
65562306a36Sopenharmony_ci */
65662306a36Sopenharmony_cistruct smp_completion_resp {
65762306a36Sopenharmony_ci	__le32	tag;
65862306a36Sopenharmony_ci	__le32	status;
65962306a36Sopenharmony_ci	__le32	param;
66062306a36Sopenharmony_ci	u8	_r_a[252];
66162306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
66262306a36Sopenharmony_ci
66362306a36Sopenharmony_ci/*
66462306a36Sopenharmony_ci *brief the data structure of SSP SMP SATA Abort Command
66562306a36Sopenharmony_ci * use to describe MPI SSP SMP & SATA Abort Command (64 bytes)
66662306a36Sopenharmony_ci */
66762306a36Sopenharmony_cistruct task_abort_req {
66862306a36Sopenharmony_ci	__le32	tag;
66962306a36Sopenharmony_ci	__le32	device_id;
67062306a36Sopenharmony_ci	__le32	tag_to_abort;
67162306a36Sopenharmony_ci	__le32	abort_all;
67262306a36Sopenharmony_ci	u32	reserved[27];
67362306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
67462306a36Sopenharmony_ci
67562306a36Sopenharmony_ci/**
67662306a36Sopenharmony_ci * brief the data structure of SSP SATA SMP Abort Response
67762306a36Sopenharmony_ci * use to describe SSP SMP & SATA Abort Response ( 64 bytes)
67862306a36Sopenharmony_ci */
67962306a36Sopenharmony_cistruct task_abort_resp {
68062306a36Sopenharmony_ci	__le32	tag;
68162306a36Sopenharmony_ci	__le32	status;
68262306a36Sopenharmony_ci	__le32	scp;
68362306a36Sopenharmony_ci	u32	reserved[12];
68462306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
68562306a36Sopenharmony_ci
68662306a36Sopenharmony_ci/**
68762306a36Sopenharmony_ci * brief the data structure of SAS Diagnostic Start/End Command
68862306a36Sopenharmony_ci * use to describe MPI SAS Diagnostic Start/End Command (64 bytes)
68962306a36Sopenharmony_ci */
69062306a36Sopenharmony_cistruct sas_diag_start_end_req {
69162306a36Sopenharmony_ci	__le32	tag;
69262306a36Sopenharmony_ci	__le32	operation_phyid;
69362306a36Sopenharmony_ci	u32	reserved[29];
69462306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
69562306a36Sopenharmony_ci
69662306a36Sopenharmony_ci/**
69762306a36Sopenharmony_ci * brief the data structure of SAS Diagnostic Execute Command
69862306a36Sopenharmony_ci * use to describe MPI SAS Diagnostic Execute Command (64 bytes)
69962306a36Sopenharmony_ci */
70062306a36Sopenharmony_cistruct sas_diag_execute_req {
70162306a36Sopenharmony_ci	__le32	tag;
70262306a36Sopenharmony_ci	__le32	cmdtype_cmddesc_phyid;
70362306a36Sopenharmony_ci	__le32	pat1_pat2;
70462306a36Sopenharmony_ci	__le32	threshold;
70562306a36Sopenharmony_ci	__le32	codepat_errmsk;
70662306a36Sopenharmony_ci	__le32	pmon;
70762306a36Sopenharmony_ci	__le32	pERF1CTL;
70862306a36Sopenharmony_ci	u32	reserved[24];
70962306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
71062306a36Sopenharmony_ci
71162306a36Sopenharmony_ci#define SAS_DIAG_PARAM_BYTES 24
71262306a36Sopenharmony_ci
71362306a36Sopenharmony_ci/*
71462306a36Sopenharmony_ci * brief the data structure of Set Device State Command
71562306a36Sopenharmony_ci * use to describe MPI Set Device State Command (64 bytes)
71662306a36Sopenharmony_ci */
71762306a36Sopenharmony_cistruct set_dev_state_req {
71862306a36Sopenharmony_ci	__le32	tag;
71962306a36Sopenharmony_ci	__le32	device_id;
72062306a36Sopenharmony_ci	__le32	nds;
72162306a36Sopenharmony_ci	u32	reserved[28];
72262306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
72362306a36Sopenharmony_ci
72462306a36Sopenharmony_ci/*
72562306a36Sopenharmony_ci * brief the data structure of SATA Start Command
72662306a36Sopenharmony_ci * use to describe MPI SATA IO Start Command (64 bytes)
72762306a36Sopenharmony_ci * Note: This structure is common for normal / encryption I/O
72862306a36Sopenharmony_ci */
72962306a36Sopenharmony_ci
73062306a36Sopenharmony_cistruct sata_start_req {
73162306a36Sopenharmony_ci	__le32	tag;
73262306a36Sopenharmony_ci	__le32	device_id;
73362306a36Sopenharmony_ci	__le32	data_len;
73462306a36Sopenharmony_ci	__le32	retfis_ncqtag_atap_dir_m_dad;
73562306a36Sopenharmony_ci	struct host_to_dev_fis	sata_fis;
73662306a36Sopenharmony_ci	u32	reserved1;
73762306a36Sopenharmony_ci	u32	reserved2;	/* dword 11. rsvd for normal I/O. */
73862306a36Sopenharmony_ci				/* EPLE Descl for enc I/O */
73962306a36Sopenharmony_ci	u32	addr_low;	/* dword 12. rsvd for enc I/O */
74062306a36Sopenharmony_ci	u32	addr_high;	/* dword 13. reserved for enc I/O */
74162306a36Sopenharmony_ci	__le32	len;		/* dword 14: length for normal I/O. */
74262306a36Sopenharmony_ci				/* EPLE Desch for enc I/O */
74362306a36Sopenharmony_ci	__le32	esgl;		/* dword 15. rsvd for enc I/O */
74462306a36Sopenharmony_ci	__le32	atapi_scsi_cdb[4];	/* dword 16-19. rsvd for enc I/O */
74562306a36Sopenharmony_ci	/* The below fields are reserved for normal I/O */
74662306a36Sopenharmony_ci	__le32	key_index_mode;	/* dword 20 */
74762306a36Sopenharmony_ci	__le32	sector_cnt_enss;/* dword 21 */
74862306a36Sopenharmony_ci	__le32	keytagl;	/* dword 22 */
74962306a36Sopenharmony_ci	__le32	keytagh;	/* dword 23 */
75062306a36Sopenharmony_ci	__le32	twk_val0;	/* dword 24 */
75162306a36Sopenharmony_ci	__le32	twk_val1;	/* dword 25 */
75262306a36Sopenharmony_ci	__le32	twk_val2;	/* dword 26 */
75362306a36Sopenharmony_ci	__le32	twk_val3;	/* dword 27 */
75462306a36Sopenharmony_ci	__le32	enc_addr_low;	/* dword 28. Encryption SGL address high */
75562306a36Sopenharmony_ci	__le32	enc_addr_high;	/* dword 29. Encryption SGL address low */
75662306a36Sopenharmony_ci	__le32	enc_len;	/* dword 30. Encryption length */
75762306a36Sopenharmony_ci	__le32	enc_esgl;	/* dword 31. Encryption esgl bit */
75862306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
75962306a36Sopenharmony_ci
76062306a36Sopenharmony_ci/**
76162306a36Sopenharmony_ci * brief the data structure of SSP INI TM Start Command
76262306a36Sopenharmony_ci * use to describe MPI SSP INI TM Start Command (64 bytes)
76362306a36Sopenharmony_ci */
76462306a36Sopenharmony_cistruct ssp_ini_tm_start_req {
76562306a36Sopenharmony_ci	__le32	tag;
76662306a36Sopenharmony_ci	__le32	device_id;
76762306a36Sopenharmony_ci	__le32	relate_tag;
76862306a36Sopenharmony_ci	__le32	tmf;
76962306a36Sopenharmony_ci	u8	lun[8];
77062306a36Sopenharmony_ci	__le32	ds_ads_m;
77162306a36Sopenharmony_ci	u32	reserved[24];
77262306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
77362306a36Sopenharmony_ci
77462306a36Sopenharmony_cistruct ssp_info_unit {
77562306a36Sopenharmony_ci	u8	lun[8];/* SCSI Logical Unit Number */
77662306a36Sopenharmony_ci	u8	reserved1;/* reserved */
77762306a36Sopenharmony_ci	u8	efb_prio_attr;
77862306a36Sopenharmony_ci	/* B7 : enabledFirstBurst */
77962306a36Sopenharmony_ci	/* B6-3 : taskPriority */
78062306a36Sopenharmony_ci	/* B2-0 : taskAttribute */
78162306a36Sopenharmony_ci	u8	reserved2;	/* reserved */
78262306a36Sopenharmony_ci	u8	additional_cdb_len;
78362306a36Sopenharmony_ci	/* B7-2 : additional_cdb_len */
78462306a36Sopenharmony_ci	/* B1-0 : reserved */
78562306a36Sopenharmony_ci	u8	cdb[16];/* The SCSI CDB up to 16 bytes length */
78662306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
78762306a36Sopenharmony_ci
78862306a36Sopenharmony_ci/**
78962306a36Sopenharmony_ci * brief the data structure of SSP INI IO Start Command
79062306a36Sopenharmony_ci * use to describe MPI SSP INI IO Start Command (64 bytes)
79162306a36Sopenharmony_ci * Note: This structure is common for normal / encryption I/O
79262306a36Sopenharmony_ci */
79362306a36Sopenharmony_cistruct ssp_ini_io_start_req {
79462306a36Sopenharmony_ci	__le32	tag;
79562306a36Sopenharmony_ci	__le32	device_id;
79662306a36Sopenharmony_ci	__le32	data_len;
79762306a36Sopenharmony_ci	__le32	dad_dir_m_tlr;
79862306a36Sopenharmony_ci	struct ssp_info_unit	ssp_iu;
79962306a36Sopenharmony_ci	__le32	addr_low;	/* dword 12: sgl low for normal I/O. */
80062306a36Sopenharmony_ci				/* epl_descl for encryption I/O */
80162306a36Sopenharmony_ci	__le32	addr_high;	/* dword 13: sgl hi for normal I/O */
80262306a36Sopenharmony_ci				/* dpl_descl for encryption I/O */
80362306a36Sopenharmony_ci	__le32	len;		/* dword 14: len for normal I/O. */
80462306a36Sopenharmony_ci				/* edpl_desch for encryption I/O */
80562306a36Sopenharmony_ci	__le32	esgl;		/* dword 15: ESGL bit for normal I/O. */
80662306a36Sopenharmony_ci				/* user defined tag mask for enc I/O */
80762306a36Sopenharmony_ci	/* The below fields are reserved for normal I/O */
80862306a36Sopenharmony_ci	u8	udt[12];	/* dword 16-18 */
80962306a36Sopenharmony_ci	__le32	sectcnt_ios;	/* dword 19 */
81062306a36Sopenharmony_ci	__le32	key_cmode;	/* dword 20 */
81162306a36Sopenharmony_ci	__le32	ks_enss;	/* dword 21 */
81262306a36Sopenharmony_ci	__le32	keytagl;	/* dword 22 */
81362306a36Sopenharmony_ci	__le32	keytagh;	/* dword 23 */
81462306a36Sopenharmony_ci	__le32	twk_val0;	/* dword 24 */
81562306a36Sopenharmony_ci	__le32	twk_val1;	/* dword 25 */
81662306a36Sopenharmony_ci	__le32	twk_val2;	/* dword 26 */
81762306a36Sopenharmony_ci	__le32	twk_val3;	/* dword 27 */
81862306a36Sopenharmony_ci	__le32	enc_addr_low;	/* dword 28: Encryption sgl addr low */
81962306a36Sopenharmony_ci	__le32	enc_addr_high;	/* dword 29: Encryption sgl addr hi */
82062306a36Sopenharmony_ci	__le32	enc_len;	/* dword 30: Encryption length */
82162306a36Sopenharmony_ci	__le32	enc_esgl;	/* dword 31: ESGL bit for encryption */
82262306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
82362306a36Sopenharmony_ci
82462306a36Sopenharmony_ci/**
82562306a36Sopenharmony_ci * brief the data structure for SSP_INI_DIF_ENC_IO COMMAND
82662306a36Sopenharmony_ci * use to initiate SSP I/O operation with optional DIF/ENC
82762306a36Sopenharmony_ci */
82862306a36Sopenharmony_cistruct ssp_dif_enc_io_req {
82962306a36Sopenharmony_ci	__le32	tag;
83062306a36Sopenharmony_ci	__le32	device_id;
83162306a36Sopenharmony_ci	__le32	data_len;
83262306a36Sopenharmony_ci	__le32	dirMTlr;
83362306a36Sopenharmony_ci	__le32	sspiu0;
83462306a36Sopenharmony_ci	__le32	sspiu1;
83562306a36Sopenharmony_ci	__le32	sspiu2;
83662306a36Sopenharmony_ci	__le32	sspiu3;
83762306a36Sopenharmony_ci	__le32	sspiu4;
83862306a36Sopenharmony_ci	__le32	sspiu5;
83962306a36Sopenharmony_ci	__le32	sspiu6;
84062306a36Sopenharmony_ci	__le32	epl_des;
84162306a36Sopenharmony_ci	__le32	dpl_desl_ndplr;
84262306a36Sopenharmony_ci	__le32	dpl_desh;
84362306a36Sopenharmony_ci	__le32	uum_uuv_bss_difbits;
84462306a36Sopenharmony_ci	u8	udt[12];
84562306a36Sopenharmony_ci	__le32	sectcnt_ios;
84662306a36Sopenharmony_ci	__le32	key_cmode;
84762306a36Sopenharmony_ci	__le32	ks_enss;
84862306a36Sopenharmony_ci	__le32	keytagl;
84962306a36Sopenharmony_ci	__le32	keytagh;
85062306a36Sopenharmony_ci	__le32	twk_val0;
85162306a36Sopenharmony_ci	__le32	twk_val1;
85262306a36Sopenharmony_ci	__le32	twk_val2;
85362306a36Sopenharmony_ci	__le32	twk_val3;
85462306a36Sopenharmony_ci	__le32	addr_low;
85562306a36Sopenharmony_ci	__le32	addr_high;
85662306a36Sopenharmony_ci	__le32	len;
85762306a36Sopenharmony_ci	__le32	esgl;
85862306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
85962306a36Sopenharmony_ci
86062306a36Sopenharmony_ci/**
86162306a36Sopenharmony_ci * brief the data structure of Firmware download
86262306a36Sopenharmony_ci * use to describe MPI FW DOWNLOAD Command (64 bytes)
86362306a36Sopenharmony_ci */
86462306a36Sopenharmony_cistruct fw_flash_Update_req {
86562306a36Sopenharmony_ci	__le32	tag;
86662306a36Sopenharmony_ci	__le32	cur_image_offset;
86762306a36Sopenharmony_ci	__le32	cur_image_len;
86862306a36Sopenharmony_ci	__le32	total_image_len;
86962306a36Sopenharmony_ci	u32	reserved0[7];
87062306a36Sopenharmony_ci	__le32	sgl_addr_lo;
87162306a36Sopenharmony_ci	__le32	sgl_addr_hi;
87262306a36Sopenharmony_ci	__le32	len;
87362306a36Sopenharmony_ci	__le32	ext_reserved;
87462306a36Sopenharmony_ci	u32	reserved1[16];
87562306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
87662306a36Sopenharmony_ci
87762306a36Sopenharmony_ci#define FWFLASH_IOMB_RESERVED_LEN 0x07
87862306a36Sopenharmony_ci/**
87962306a36Sopenharmony_ci * brief the data structure of FW_FLASH_UPDATE Response
88062306a36Sopenharmony_ci * use to describe MPI FW_FLASH_UPDATE Response (64 bytes)
88162306a36Sopenharmony_ci *
88262306a36Sopenharmony_ci */
88362306a36Sopenharmony_ci struct fw_flash_Update_resp {
88462306a36Sopenharmony_ci	__le32	tag;
88562306a36Sopenharmony_ci	__le32	status;
88662306a36Sopenharmony_ci	u32	reserved[13];
88762306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
88862306a36Sopenharmony_ci
88962306a36Sopenharmony_ci/**
89062306a36Sopenharmony_ci * brief the data structure of Get NVM Data Command
89162306a36Sopenharmony_ci * use to get data from NVM in HBA(64 bytes)
89262306a36Sopenharmony_ci */
89362306a36Sopenharmony_cistruct get_nvm_data_req {
89462306a36Sopenharmony_ci	__le32	tag;
89562306a36Sopenharmony_ci	__le32	len_ir_vpdd;
89662306a36Sopenharmony_ci	__le32	vpd_offset;
89762306a36Sopenharmony_ci	u32	reserved[8];
89862306a36Sopenharmony_ci	__le32	resp_addr_lo;
89962306a36Sopenharmony_ci	__le32	resp_addr_hi;
90062306a36Sopenharmony_ci	__le32	resp_len;
90162306a36Sopenharmony_ci	u32	reserved1[17];
90262306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
90362306a36Sopenharmony_ci
90462306a36Sopenharmony_cistruct set_nvm_data_req {
90562306a36Sopenharmony_ci	__le32	tag;
90662306a36Sopenharmony_ci	__le32	len_ir_vpdd;
90762306a36Sopenharmony_ci	__le32	vpd_offset;
90862306a36Sopenharmony_ci	u32	reserved[8];
90962306a36Sopenharmony_ci	__le32	resp_addr_lo;
91062306a36Sopenharmony_ci	__le32	resp_addr_hi;
91162306a36Sopenharmony_ci	__le32	resp_len;
91262306a36Sopenharmony_ci	u32	reserved1[17];
91362306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
91462306a36Sopenharmony_ci
91562306a36Sopenharmony_ci/**
91662306a36Sopenharmony_ci * brief the data structure for SET CONTROLLER CONFIG COMMAND
91762306a36Sopenharmony_ci * use to modify controller configuration
91862306a36Sopenharmony_ci */
91962306a36Sopenharmony_cistruct set_ctrl_cfg_req {
92062306a36Sopenharmony_ci	__le32	tag;
92162306a36Sopenharmony_ci	__le32	cfg_pg[14];
92262306a36Sopenharmony_ci	u32	reserved[16];
92362306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
92462306a36Sopenharmony_ci
92562306a36Sopenharmony_ci/**
92662306a36Sopenharmony_ci * brief the data structure for GET CONTROLLER CONFIG COMMAND
92762306a36Sopenharmony_ci * use to get controller configuration page
92862306a36Sopenharmony_ci */
92962306a36Sopenharmony_cistruct get_ctrl_cfg_req {
93062306a36Sopenharmony_ci	__le32	tag;
93162306a36Sopenharmony_ci	__le32	pgcd;
93262306a36Sopenharmony_ci	__le32	int_vec;
93362306a36Sopenharmony_ci	u32	reserved[28];
93462306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
93562306a36Sopenharmony_ci
93662306a36Sopenharmony_ci/**
93762306a36Sopenharmony_ci * brief the data structure for KEK_MANAGEMENT COMMAND
93862306a36Sopenharmony_ci * use for KEK management
93962306a36Sopenharmony_ci */
94062306a36Sopenharmony_cistruct kek_mgmt_req {
94162306a36Sopenharmony_ci	__le32	tag;
94262306a36Sopenharmony_ci	__le32	new_curidx_ksop;
94362306a36Sopenharmony_ci	u32	reserved;
94462306a36Sopenharmony_ci	__le32	kblob[12];
94562306a36Sopenharmony_ci	u32	reserved1[16];
94662306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
94762306a36Sopenharmony_ci
94862306a36Sopenharmony_ci/**
94962306a36Sopenharmony_ci * brief the data structure for DEK_MANAGEMENT COMMAND
95062306a36Sopenharmony_ci * use for DEK management
95162306a36Sopenharmony_ci */
95262306a36Sopenharmony_cistruct dek_mgmt_req {
95362306a36Sopenharmony_ci	__le32	tag;
95462306a36Sopenharmony_ci	__le32	kidx_dsop;
95562306a36Sopenharmony_ci	__le32	dekidx;
95662306a36Sopenharmony_ci	__le32	addr_l;
95762306a36Sopenharmony_ci	__le32	addr_h;
95862306a36Sopenharmony_ci	__le32	nent;
95962306a36Sopenharmony_ci	__le32	dbf_tblsize;
96062306a36Sopenharmony_ci	u32	reserved[24];
96162306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
96262306a36Sopenharmony_ci
96362306a36Sopenharmony_ci/**
96462306a36Sopenharmony_ci * brief the data structure for SET PHY PROFILE COMMAND
96562306a36Sopenharmony_ci * use to retrive phy specific information
96662306a36Sopenharmony_ci */
96762306a36Sopenharmony_cistruct set_phy_profile_req {
96862306a36Sopenharmony_ci	__le32	tag;
96962306a36Sopenharmony_ci	__le32	ppc_phyid;
97062306a36Sopenharmony_ci	__le32	reserved[29];
97162306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
97262306a36Sopenharmony_ci
97362306a36Sopenharmony_ci/**
97462306a36Sopenharmony_ci * brief the data structure for GET PHY PROFILE COMMAND
97562306a36Sopenharmony_ci * use to retrive phy specific information
97662306a36Sopenharmony_ci */
97762306a36Sopenharmony_cistruct get_phy_profile_req {
97862306a36Sopenharmony_ci	__le32	tag;
97962306a36Sopenharmony_ci	__le32	ppc_phyid;
98062306a36Sopenharmony_ci	__le32	profile[29];
98162306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
98262306a36Sopenharmony_ci
98362306a36Sopenharmony_ci/**
98462306a36Sopenharmony_ci * brief the data structure for EXT FLASH PARTITION
98562306a36Sopenharmony_ci * use to manage ext flash partition
98662306a36Sopenharmony_ci */
98762306a36Sopenharmony_cistruct ext_flash_partition_req {
98862306a36Sopenharmony_ci	__le32	tag;
98962306a36Sopenharmony_ci	__le32	cmd;
99062306a36Sopenharmony_ci	__le32	offset;
99162306a36Sopenharmony_ci	__le32	len;
99262306a36Sopenharmony_ci	u32	reserved[7];
99362306a36Sopenharmony_ci	__le32	addr_low;
99462306a36Sopenharmony_ci	__le32	addr_high;
99562306a36Sopenharmony_ci	__le32	len1;
99662306a36Sopenharmony_ci	__le32	ext;
99762306a36Sopenharmony_ci	u32	reserved1[16];
99862306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
99962306a36Sopenharmony_ci
100062306a36Sopenharmony_ci#define TWI_DEVICE	0x0
100162306a36Sopenharmony_ci#define C_SEEPROM	0x1
100262306a36Sopenharmony_ci#define VPD_FLASH	0x4
100362306a36Sopenharmony_ci#define AAP1_RDUMP	0x5
100462306a36Sopenharmony_ci#define IOP_RDUMP	0x6
100562306a36Sopenharmony_ci#define EXPAN_ROM	0x7
100662306a36Sopenharmony_ci
100762306a36Sopenharmony_ci#define IPMode		0x80000000
100862306a36Sopenharmony_ci#define NVMD_TYPE	0x0000000F
100962306a36Sopenharmony_ci#define NVMD_STAT	0x0000FFFF
101062306a36Sopenharmony_ci#define NVMD_LEN	0xFF000000
101162306a36Sopenharmony_ci/**
101262306a36Sopenharmony_ci * brief the data structure of Get NVMD Data Response
101362306a36Sopenharmony_ci * use to describe MPI Get NVMD Data Response (64 bytes)
101462306a36Sopenharmony_ci */
101562306a36Sopenharmony_cistruct get_nvm_data_resp {
101662306a36Sopenharmony_ci	__le32		tag;
101762306a36Sopenharmony_ci	__le32		ir_tda_bn_dps_das_nvm;
101862306a36Sopenharmony_ci	__le32		dlen_status;
101962306a36Sopenharmony_ci	__le32		nvm_data[12];
102062306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
102162306a36Sopenharmony_ci
102262306a36Sopenharmony_ci/**
102362306a36Sopenharmony_ci * brief the data structure of SAS Diagnostic Start/End Response
102462306a36Sopenharmony_ci * use to describe MPI SAS Diagnostic Start/End Response (64 bytes)
102562306a36Sopenharmony_ci *
102662306a36Sopenharmony_ci */
102762306a36Sopenharmony_cistruct sas_diag_start_end_resp {
102862306a36Sopenharmony_ci	__le32		tag;
102962306a36Sopenharmony_ci	__le32		status;
103062306a36Sopenharmony_ci	u32		reserved[13];
103162306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
103262306a36Sopenharmony_ci
103362306a36Sopenharmony_ci/**
103462306a36Sopenharmony_ci * brief the data structure of SAS Diagnostic Execute Response
103562306a36Sopenharmony_ci * use to describe MPI SAS Diagnostic Execute Response (64 bytes)
103662306a36Sopenharmony_ci *
103762306a36Sopenharmony_ci */
103862306a36Sopenharmony_cistruct sas_diag_execute_resp {
103962306a36Sopenharmony_ci	__le32		tag;
104062306a36Sopenharmony_ci	__le32		cmdtype_cmddesc_phyid;
104162306a36Sopenharmony_ci	__le32		Status;
104262306a36Sopenharmony_ci	__le32		ReportData;
104362306a36Sopenharmony_ci	u32		reserved[11];
104462306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
104562306a36Sopenharmony_ci
104662306a36Sopenharmony_ci/**
104762306a36Sopenharmony_ci * brief the data structure of Set Device State Response
104862306a36Sopenharmony_ci * use to describe MPI Set Device State Response (64 bytes)
104962306a36Sopenharmony_ci *
105062306a36Sopenharmony_ci */
105162306a36Sopenharmony_cistruct set_dev_state_resp {
105262306a36Sopenharmony_ci	__le32		tag;
105362306a36Sopenharmony_ci	__le32		status;
105462306a36Sopenharmony_ci	__le32		device_id;
105562306a36Sopenharmony_ci	__le32		pds_nds;
105662306a36Sopenharmony_ci	u32		reserved[11];
105762306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
105862306a36Sopenharmony_ci
105962306a36Sopenharmony_ci/* new outbound structure for spcv - begins */
106062306a36Sopenharmony_ci/**
106162306a36Sopenharmony_ci * brief the data structure for SET CONTROLLER CONFIG COMMAND
106262306a36Sopenharmony_ci * use to modify controller configuration
106362306a36Sopenharmony_ci */
106462306a36Sopenharmony_cistruct set_ctrl_cfg_resp {
106562306a36Sopenharmony_ci	__le32 tag;
106662306a36Sopenharmony_ci	__le32 status;
106762306a36Sopenharmony_ci	__le32 err_qlfr_pgcd;
106862306a36Sopenharmony_ci	u32 reserved[12];
106962306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
107062306a36Sopenharmony_ci
107162306a36Sopenharmony_cistruct get_ctrl_cfg_resp {
107262306a36Sopenharmony_ci	__le32 tag;
107362306a36Sopenharmony_ci	__le32 status;
107462306a36Sopenharmony_ci	__le32 err_qlfr;
107562306a36Sopenharmony_ci	__le32 confg_page[12];
107662306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
107762306a36Sopenharmony_ci
107862306a36Sopenharmony_cistruct kek_mgmt_resp {
107962306a36Sopenharmony_ci	__le32 tag;
108062306a36Sopenharmony_ci	__le32 status;
108162306a36Sopenharmony_ci	__le32 kidx_new_curr_ksop;
108262306a36Sopenharmony_ci	__le32 err_qlfr;
108362306a36Sopenharmony_ci	u32 reserved[11];
108462306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
108562306a36Sopenharmony_ci
108662306a36Sopenharmony_cistruct dek_mgmt_resp {
108762306a36Sopenharmony_ci	__le32 tag;
108862306a36Sopenharmony_ci	__le32 status;
108962306a36Sopenharmony_ci	__le32 kekidx_tbls_dsop;
109062306a36Sopenharmony_ci	__le32 dekidx;
109162306a36Sopenharmony_ci	__le32 err_qlfr;
109262306a36Sopenharmony_ci	u32 reserved[10];
109362306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
109462306a36Sopenharmony_ci
109562306a36Sopenharmony_cistruct get_phy_profile_resp {
109662306a36Sopenharmony_ci	__le32 tag;
109762306a36Sopenharmony_ci	__le32 status;
109862306a36Sopenharmony_ci	__le32 ppc_phyid;
109962306a36Sopenharmony_ci	__le32 ppc_specific_rsp[12];
110062306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
110162306a36Sopenharmony_ci
110262306a36Sopenharmony_cistruct flash_op_ext_resp {
110362306a36Sopenharmony_ci	__le32 tag;
110462306a36Sopenharmony_ci	__le32 cmd;
110562306a36Sopenharmony_ci	__le32 status;
110662306a36Sopenharmony_ci	__le32 epart_size;
110762306a36Sopenharmony_ci	__le32 epart_sect_size;
110862306a36Sopenharmony_ci	u32 reserved[10];
110962306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
111062306a36Sopenharmony_ci
111162306a36Sopenharmony_cistruct set_phy_profile_resp {
111262306a36Sopenharmony_ci	__le32 tag;
111362306a36Sopenharmony_ci	__le32 status;
111462306a36Sopenharmony_ci	__le32 ppc_phyid;
111562306a36Sopenharmony_ci	__le32 ppc_specific_rsp[12];
111662306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
111762306a36Sopenharmony_ci
111862306a36Sopenharmony_cistruct ssp_coalesced_comp_resp {
111962306a36Sopenharmony_ci	__le32 coal_cnt;
112062306a36Sopenharmony_ci	__le32 tag0;
112162306a36Sopenharmony_ci	__le32 ssp_tag0;
112262306a36Sopenharmony_ci	__le32 tag1;
112362306a36Sopenharmony_ci	__le32 ssp_tag1;
112462306a36Sopenharmony_ci	__le32 add_tag_ssp_tag[10];
112562306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
112662306a36Sopenharmony_ci
112762306a36Sopenharmony_ci/* new outbound structure for spcv - ends */
112862306a36Sopenharmony_ci
112962306a36Sopenharmony_ci/* brief data structure for SAS protocol timer configuration page.
113062306a36Sopenharmony_ci *
113162306a36Sopenharmony_ci */
113262306a36Sopenharmony_cistruct SASProtocolTimerConfig {
113362306a36Sopenharmony_ci	__le32 pageCode;			/* 0 */
113462306a36Sopenharmony_ci	__le32 MST_MSI;				/* 1 */
113562306a36Sopenharmony_ci	__le32 STP_SSP_MCT_TMO;			/* 2 */
113662306a36Sopenharmony_ci	__le32 STP_FRM_TMO;			/* 3 */
113762306a36Sopenharmony_ci	__le32 STP_IDLE_TMO;			/* 4 */
113862306a36Sopenharmony_ci	__le32 OPNRJT_RTRY_INTVL;		/* 5 */
113962306a36Sopenharmony_ci	__le32 Data_Cmd_OPNRJT_RTRY_TMO;	/* 6 */
114062306a36Sopenharmony_ci	__le32 Data_Cmd_OPNRJT_RTRY_THR;	/* 7 */
114162306a36Sopenharmony_ci	__le32 MAX_AIP;				/* 8 */
114262306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
114362306a36Sopenharmony_ci
114462306a36Sopenharmony_citypedef struct SASProtocolTimerConfig SASProtocolTimerConfig_t;
114562306a36Sopenharmony_ci
114662306a36Sopenharmony_ci#define NDS_BITS 0x0F
114762306a36Sopenharmony_ci#define PDS_BITS 0xF0
114862306a36Sopenharmony_ci
114962306a36Sopenharmony_ci/*
115062306a36Sopenharmony_ci * HW Events type
115162306a36Sopenharmony_ci */
115262306a36Sopenharmony_ci
115362306a36Sopenharmony_ci#define HW_EVENT_RESET_START			0x01
115462306a36Sopenharmony_ci#define HW_EVENT_CHIP_RESET_COMPLETE		0x02
115562306a36Sopenharmony_ci#define HW_EVENT_PHY_STOP_STATUS		0x03
115662306a36Sopenharmony_ci#define HW_EVENT_SAS_PHY_UP			0x04
115762306a36Sopenharmony_ci#define HW_EVENT_SATA_PHY_UP			0x05
115862306a36Sopenharmony_ci#define HW_EVENT_SATA_SPINUP_HOLD		0x06
115962306a36Sopenharmony_ci#define HW_EVENT_PHY_DOWN			0x07
116062306a36Sopenharmony_ci#define HW_EVENT_PORT_INVALID			0x08
116162306a36Sopenharmony_ci#define HW_EVENT_BROADCAST_CHANGE		0x09
116262306a36Sopenharmony_ci#define HW_EVENT_PHY_ERROR			0x0A
116362306a36Sopenharmony_ci#define HW_EVENT_BROADCAST_SES			0x0B
116462306a36Sopenharmony_ci#define HW_EVENT_INBOUND_CRC_ERROR		0x0C
116562306a36Sopenharmony_ci#define HW_EVENT_HARD_RESET_RECEIVED		0x0D
116662306a36Sopenharmony_ci#define HW_EVENT_MALFUNCTION			0x0E
116762306a36Sopenharmony_ci#define HW_EVENT_ID_FRAME_TIMEOUT		0x0F
116862306a36Sopenharmony_ci#define HW_EVENT_BROADCAST_EXP			0x10
116962306a36Sopenharmony_ci#define HW_EVENT_PHY_START_STATUS		0x11
117062306a36Sopenharmony_ci#define HW_EVENT_LINK_ERR_INVALID_DWORD		0x12
117162306a36Sopenharmony_ci#define HW_EVENT_LINK_ERR_DISPARITY_ERROR	0x13
117262306a36Sopenharmony_ci#define HW_EVENT_LINK_ERR_CODE_VIOLATION	0x14
117362306a36Sopenharmony_ci#define HW_EVENT_LINK_ERR_LOSS_OF_DWORD_SYNCH	0x15
117462306a36Sopenharmony_ci#define HW_EVENT_LINK_ERR_PHY_RESET_FAILED	0x16
117562306a36Sopenharmony_ci#define HW_EVENT_PORT_RECOVERY_TIMER_TMO	0x17
117662306a36Sopenharmony_ci#define HW_EVENT_PORT_RECOVER			0x18
117762306a36Sopenharmony_ci#define HW_EVENT_PORT_RESET_TIMER_TMO		0x19
117862306a36Sopenharmony_ci#define HW_EVENT_PORT_RESET_COMPLETE		0x20
117962306a36Sopenharmony_ci#define EVENT_BROADCAST_ASYNCH_EVENT		0x21
118062306a36Sopenharmony_ci
118162306a36Sopenharmony_ci/* port state */
118262306a36Sopenharmony_ci#define PORT_NOT_ESTABLISHED			0x00
118362306a36Sopenharmony_ci#define PORT_VALID				0x01
118462306a36Sopenharmony_ci#define PORT_LOSTCOMM				0x02
118562306a36Sopenharmony_ci#define PORT_IN_RESET				0x04
118662306a36Sopenharmony_ci#define PORT_3RD_PARTY_RESET			0x07
118762306a36Sopenharmony_ci#define PORT_INVALID				0x08
118862306a36Sopenharmony_ci
118962306a36Sopenharmony_ci/*
119062306a36Sopenharmony_ci * SSP/SMP/SATA IO Completion Status values
119162306a36Sopenharmony_ci */
119262306a36Sopenharmony_ci
119362306a36Sopenharmony_ci#define IO_SUCCESS				0x00
119462306a36Sopenharmony_ci#define IO_ABORTED				0x01
119562306a36Sopenharmony_ci#define IO_OVERFLOW				0x02
119662306a36Sopenharmony_ci#define IO_UNDERFLOW				0x03
119762306a36Sopenharmony_ci#define IO_FAILED				0x04
119862306a36Sopenharmony_ci#define IO_ABORT_RESET				0x05
119962306a36Sopenharmony_ci#define IO_NOT_VALID				0x06
120062306a36Sopenharmony_ci#define IO_NO_DEVICE				0x07
120162306a36Sopenharmony_ci#define IO_ILLEGAL_PARAMETER			0x08
120262306a36Sopenharmony_ci#define IO_LINK_FAILURE				0x09
120362306a36Sopenharmony_ci#define IO_PROG_ERROR				0x0A
120462306a36Sopenharmony_ci
120562306a36Sopenharmony_ci#define IO_EDC_IN_ERROR				0x0B
120662306a36Sopenharmony_ci#define IO_EDC_OUT_ERROR			0x0C
120762306a36Sopenharmony_ci#define IO_ERROR_HW_TIMEOUT			0x0D
120862306a36Sopenharmony_ci#define IO_XFER_ERROR_BREAK			0x0E
120962306a36Sopenharmony_ci#define IO_XFER_ERROR_PHY_NOT_READY		0x0F
121062306a36Sopenharmony_ci#define IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED	0x10
121162306a36Sopenharmony_ci#define IO_OPEN_CNX_ERROR_ZONE_VIOLATION		0x11
121262306a36Sopenharmony_ci#define IO_OPEN_CNX_ERROR_BREAK				0x12
121362306a36Sopenharmony_ci#define IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS			0x13
121462306a36Sopenharmony_ci#define IO_OPEN_CNX_ERROR_BAD_DESTINATION		0x14
121562306a36Sopenharmony_ci#define IO_OPEN_CNX_ERROR_CONNECTION_RATE_NOT_SUPPORTED	0x15
121662306a36Sopenharmony_ci#define IO_OPEN_CNX_ERROR_STP_RESOURCES_BUSY		0x16
121762306a36Sopenharmony_ci#define IO_OPEN_CNX_ERROR_WRONG_DESTINATION		0x17
121862306a36Sopenharmony_ci/* This error code 0x18 is not used on SPCv */
121962306a36Sopenharmony_ci#define IO_OPEN_CNX_ERROR_UNKNOWN_ERROR			0x18
122062306a36Sopenharmony_ci#define IO_XFER_ERROR_NAK_RECEIVED			0x19
122162306a36Sopenharmony_ci#define IO_XFER_ERROR_ACK_NAK_TIMEOUT			0x1A
122262306a36Sopenharmony_ci#define IO_XFER_ERROR_PEER_ABORTED			0x1B
122362306a36Sopenharmony_ci#define IO_XFER_ERROR_RX_FRAME				0x1C
122462306a36Sopenharmony_ci#define IO_XFER_ERROR_DMA				0x1D
122562306a36Sopenharmony_ci#define IO_XFER_ERROR_CREDIT_TIMEOUT			0x1E
122662306a36Sopenharmony_ci#define IO_XFER_ERROR_SATA_LINK_TIMEOUT			0x1F
122762306a36Sopenharmony_ci#define IO_XFER_ERROR_SATA				0x20
122862306a36Sopenharmony_ci
122962306a36Sopenharmony_ci/* This error code 0x22 is not used on SPCv */
123062306a36Sopenharmony_ci#define IO_XFER_ERROR_ABORTED_DUE_TO_SRST		0x22
123162306a36Sopenharmony_ci#define IO_XFER_ERROR_REJECTED_NCQ_MODE			0x21
123262306a36Sopenharmony_ci#define IO_XFER_ERROR_ABORTED_NCQ_MODE			0x23
123362306a36Sopenharmony_ci#define IO_XFER_OPEN_RETRY_TIMEOUT			0x24
123462306a36Sopenharmony_ci/* This error code 0x25 is not used on SPCv */
123562306a36Sopenharmony_ci#define IO_XFER_SMP_RESP_CONNECTION_ERROR		0x25
123662306a36Sopenharmony_ci#define IO_XFER_ERROR_UNEXPECTED_PHASE			0x26
123762306a36Sopenharmony_ci#define IO_XFER_ERROR_XFER_RDY_OVERRUN			0x27
123862306a36Sopenharmony_ci#define IO_XFER_ERROR_XFER_RDY_NOT_EXPECTED		0x28
123962306a36Sopenharmony_ci#define IO_XFER_ERROR_CMD_ISSUE_ACK_NAK_TIMEOUT		0x30
124062306a36Sopenharmony_ci
124162306a36Sopenharmony_ci/* The following error code 0x31 and 0x32 are not using (obsolete) */
124262306a36Sopenharmony_ci#define IO_XFER_ERROR_CMD_ISSUE_BREAK_BEFORE_ACK_NAK	0x31
124362306a36Sopenharmony_ci#define IO_XFER_ERROR_CMD_ISSUE_PHY_DOWN_BEFORE_ACK_NAK	0x32
124462306a36Sopenharmony_ci
124562306a36Sopenharmony_ci#define IO_XFER_ERROR_OFFSET_MISMATCH			0x34
124662306a36Sopenharmony_ci#define IO_XFER_ERROR_XFER_ZERO_DATA_LEN		0x35
124762306a36Sopenharmony_ci#define IO_XFER_CMD_FRAME_ISSUED			0x36
124862306a36Sopenharmony_ci#define IO_ERROR_INTERNAL_SMP_RESOURCE			0x37
124962306a36Sopenharmony_ci#define IO_PORT_IN_RESET				0x38
125062306a36Sopenharmony_ci#define IO_DS_NON_OPERATIONAL				0x39
125162306a36Sopenharmony_ci#define IO_DS_IN_RECOVERY				0x3A
125262306a36Sopenharmony_ci#define IO_TM_TAG_NOT_FOUND				0x3B
125362306a36Sopenharmony_ci#define IO_XFER_PIO_SETUP_ERROR				0x3C
125462306a36Sopenharmony_ci#define IO_SSP_EXT_IU_ZERO_LEN_ERROR			0x3D
125562306a36Sopenharmony_ci#define IO_DS_IN_ERROR					0x3E
125662306a36Sopenharmony_ci#define IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY		0x3F
125762306a36Sopenharmony_ci#define IO_ABORT_IN_PROGRESS				0x40
125862306a36Sopenharmony_ci#define IO_ABORT_DELAYED				0x41
125962306a36Sopenharmony_ci#define IO_INVALID_LENGTH				0x42
126062306a36Sopenharmony_ci
126162306a36Sopenharmony_ci/********** additional response event values *****************/
126262306a36Sopenharmony_ci
126362306a36Sopenharmony_ci#define IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY_ALT		0x43
126462306a36Sopenharmony_ci#define IO_XFER_OPEN_RETRY_BACKOFF_THRESHOLD_REACHED	0x44
126562306a36Sopenharmony_ci#define IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_TMO	0x45
126662306a36Sopenharmony_ci#define IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_NO_DEST		0x46
126762306a36Sopenharmony_ci#define IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_COLLIDE	0x47
126862306a36Sopenharmony_ci#define IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_PATHWAY_BLOCKED	0x48
126962306a36Sopenharmony_ci#define IO_DS_INVALID					0x49
127062306a36Sopenharmony_ci#define IO_FATAL_ERROR					0x51
127162306a36Sopenharmony_ci/* WARNING: the value is not contiguous from here */
127262306a36Sopenharmony_ci#define IO_XFER_ERR_LAST_PIO_DATAIN_CRC_ERR	0x52
127362306a36Sopenharmony_ci#define IO_XFER_DMA_ACTIVATE_TIMEOUT		0x53
127462306a36Sopenharmony_ci#define IO_XFER_ERROR_INTERNAL_CRC_ERROR	0x54
127562306a36Sopenharmony_ci#define MPI_IO_RQE_BUSY_FULL			0x55
127662306a36Sopenharmony_ci#define IO_XFER_ERR_EOB_DATA_OVERRUN		0x56
127762306a36Sopenharmony_ci#define IO_XFER_ERROR_INVALID_SSP_RSP_FRAME	0x57
127862306a36Sopenharmony_ci#define IO_OPEN_CNX_ERROR_OPEN_PREEMPTED	0x58
127962306a36Sopenharmony_ci
128062306a36Sopenharmony_ci#define MPI_ERR_IO_RESOURCE_UNAVAILABLE		0x1004
128162306a36Sopenharmony_ci#define MPI_ERR_ATAPI_DEVICE_BUSY		0x1024
128262306a36Sopenharmony_ci
128362306a36Sopenharmony_ci#define IO_XFR_ERROR_DEK_KEY_CACHE_MISS		0x2040
128462306a36Sopenharmony_ci/*
128562306a36Sopenharmony_ci * An encryption IO request failed due to DEK Key Tag mismatch.
128662306a36Sopenharmony_ci * The key tag supplied in the encryption IOMB does not match with
128762306a36Sopenharmony_ci * the Key Tag in the referenced DEK Entry.
128862306a36Sopenharmony_ci */
128962306a36Sopenharmony_ci#define IO_XFR_ERROR_DEK_KEY_TAG_MISMATCH	0x2041
129062306a36Sopenharmony_ci#define IO_XFR_ERROR_CIPHER_MODE_INVALID	0x2042
129162306a36Sopenharmony_ci/*
129262306a36Sopenharmony_ci * An encryption I/O request failed because the initial value (IV)
129362306a36Sopenharmony_ci * in the unwrapped DEK blob didn't match the IV used to unwrap it.
129462306a36Sopenharmony_ci */
129562306a36Sopenharmony_ci#define IO_XFR_ERROR_DEK_IV_MISMATCH		0x2043
129662306a36Sopenharmony_ci/* An encryption I/O request failed due to an internal RAM ECC or
129762306a36Sopenharmony_ci * interface error while unwrapping the DEK. */
129862306a36Sopenharmony_ci#define IO_XFR_ERROR_DEK_RAM_INTERFACE_ERROR	0x2044
129962306a36Sopenharmony_ci/* An encryption I/O request failed due to an internal RAM ECC or
130062306a36Sopenharmony_ci * interface error while unwrapping the DEK. */
130162306a36Sopenharmony_ci#define IO_XFR_ERROR_INTERNAL_RAM		0x2045
130262306a36Sopenharmony_ci/*
130362306a36Sopenharmony_ci * An encryption I/O request failed
130462306a36Sopenharmony_ci * because the DEK index specified in the I/O was outside the bounds of
130562306a36Sopenharmony_ci * the total number of entries in the host DEK table.
130662306a36Sopenharmony_ci */
130762306a36Sopenharmony_ci#define IO_XFR_ERROR_DEK_INDEX_OUT_OF_BOUNDS0x2046
130862306a36Sopenharmony_ci
130962306a36Sopenharmony_ci/* define DIF IO response error status code */
131062306a36Sopenharmony_ci#define IO_XFR_ERROR_DIF_MISMATCH			0x3000
131162306a36Sopenharmony_ci#define IO_XFR_ERROR_DIF_APPLICATION_TAG_MISMATCH	0x3001
131262306a36Sopenharmony_ci#define IO_XFR_ERROR_DIF_REFERENCE_TAG_MISMATCH		0x3002
131362306a36Sopenharmony_ci#define IO_XFR_ERROR_DIF_CRC_MISMATCH			0x3003
131462306a36Sopenharmony_ci
131562306a36Sopenharmony_ci/* define operator management response status and error qualifier code */
131662306a36Sopenharmony_ci#define OPR_MGMT_OP_NOT_SUPPORTED			0x2060
131762306a36Sopenharmony_ci#define OPR_MGMT_MPI_ENC_ERR_OPR_PARAM_ILLEGAL		0x2061
131862306a36Sopenharmony_ci#define OPR_MGMT_MPI_ENC_ERR_OPR_ID_NOT_FOUND		0x2062
131962306a36Sopenharmony_ci#define OPR_MGMT_MPI_ENC_ERR_OPR_ROLE_NOT_MATCH		0x2063
132062306a36Sopenharmony_ci#define OPR_MGMT_MPI_ENC_ERR_OPR_MAX_NUM_EXCEEDED	0x2064
132162306a36Sopenharmony_ci#define OPR_MGMT_MPI_ENC_ERR_KEK_UNWRAP_FAIL		0x2022
132262306a36Sopenharmony_ci#define OPR_MGMT_MPI_ENC_ERR_NVRAM_OPERATION_FAILURE	0x2023
132362306a36Sopenharmony_ci/***************** additional response event values ***************/
132462306a36Sopenharmony_ci
132562306a36Sopenharmony_ci/* WARNING: This error code must always be the last number.
132662306a36Sopenharmony_ci * If you add error code, modify this code also
132762306a36Sopenharmony_ci * It is used as an index
132862306a36Sopenharmony_ci */
132962306a36Sopenharmony_ci#define IO_ERROR_UNKNOWN_GENERIC			0x2023
133062306a36Sopenharmony_ci
133162306a36Sopenharmony_ci/* MSGU CONFIGURATION TABLE*/
133262306a36Sopenharmony_ci
133362306a36Sopenharmony_ci#define SPCv_MSGU_CFG_TABLE_UPDATE		0x001
133462306a36Sopenharmony_ci#define SPCv_MSGU_CFG_TABLE_RESET		0x002
133562306a36Sopenharmony_ci#define SPCv_MSGU_CFG_TABLE_FREEZE		0x004
133662306a36Sopenharmony_ci#define SPCv_MSGU_CFG_TABLE_UNFREEZE		0x008
133762306a36Sopenharmony_ci#define MSGU_IBDB_SET				0x00
133862306a36Sopenharmony_ci#define MSGU_HOST_INT_STATUS			0x08
133962306a36Sopenharmony_ci#define MSGU_HOST_INT_MASK			0x0C
134062306a36Sopenharmony_ci#define MSGU_IOPIB_INT_STATUS			0x18
134162306a36Sopenharmony_ci#define MSGU_IOPIB_INT_MASK			0x1C
134262306a36Sopenharmony_ci#define MSGU_IBDB_CLEAR				0x20
134362306a36Sopenharmony_ci
134462306a36Sopenharmony_ci#define MSGU_MSGU_CONTROL			0x24
134562306a36Sopenharmony_ci#define MSGU_ODR				0x20
134662306a36Sopenharmony_ci#define MSGU_ODCR				0x28
134762306a36Sopenharmony_ci
134862306a36Sopenharmony_ci#define MSGU_ODMR				0x30
134962306a36Sopenharmony_ci#define MSGU_ODMR_U				0x34
135062306a36Sopenharmony_ci#define MSGU_ODMR_CLR				0x38
135162306a36Sopenharmony_ci#define MSGU_ODMR_CLR_U				0x3C
135262306a36Sopenharmony_ci#define MSGU_OD_RSVD				0x40
135362306a36Sopenharmony_ci
135462306a36Sopenharmony_ci#define MSGU_SCRATCH_PAD_0			0x44
135562306a36Sopenharmony_ci#define MSGU_SCRATCH_PAD_1			0x48
135662306a36Sopenharmony_ci#define MSGU_SCRATCH_PAD_2			0x4C
135762306a36Sopenharmony_ci#define MSGU_SCRATCH_PAD_3			0x50
135862306a36Sopenharmony_ci#define MSGU_HOST_SCRATCH_PAD_0			0x54
135962306a36Sopenharmony_ci#define MSGU_HOST_SCRATCH_PAD_1			0x58
136062306a36Sopenharmony_ci#define MSGU_HOST_SCRATCH_PAD_2			0x5C
136162306a36Sopenharmony_ci#define MSGU_HOST_SCRATCH_PAD_3			0x60
136262306a36Sopenharmony_ci#define MSGU_HOST_SCRATCH_PAD_4			0x64
136362306a36Sopenharmony_ci#define MSGU_HOST_SCRATCH_PAD_5			0x68
136462306a36Sopenharmony_ci#define MSGU_SCRATCH_PAD_RSVD_0			0x6C
136562306a36Sopenharmony_ci#define MSGU_SCRATCH_PAD_RSVD_1			0x70
136662306a36Sopenharmony_ci
136762306a36Sopenharmony_ci#define MSGU_SCRATCHPAD1_RAAE_STATE_ERR(x) ((x & 0x3) == 0x2)
136862306a36Sopenharmony_ci#define MSGU_SCRATCHPAD1_ILA_STATE_ERR(x) (((x >> 2) & 0x3) == 0x2)
136962306a36Sopenharmony_ci#define MSGU_SCRATCHPAD1_BOOTLDR_STATE_ERR(x) ((((x >> 4) & 0x7) == 0x7) || \
137062306a36Sopenharmony_ci						(((x >> 4) & 0x7) == 0x4))
137162306a36Sopenharmony_ci#define MSGU_SCRATCHPAD1_IOP0_STATE_ERR(x) (((x >> 10) & 0x3) == 0x2)
137262306a36Sopenharmony_ci#define MSGU_SCRATCHPAD1_IOP1_STATE_ERR(x) (((x >> 12) & 0x3) == 0x2)
137362306a36Sopenharmony_ci#define MSGU_SCRATCHPAD1_STATE_FATAL_ERROR(x)  \
137462306a36Sopenharmony_ci			(MSGU_SCRATCHPAD1_RAAE_STATE_ERR(x) ||      \
137562306a36Sopenharmony_ci			 MSGU_SCRATCHPAD1_ILA_STATE_ERR(x) ||       \
137662306a36Sopenharmony_ci			 MSGU_SCRATCHPAD1_BOOTLDR_STATE_ERR(x) ||   \
137762306a36Sopenharmony_ci			 MSGU_SCRATCHPAD1_IOP0_STATE_ERR(x) ||      \
137862306a36Sopenharmony_ci			 MSGU_SCRATCHPAD1_IOP1_STATE_ERR(x))
137962306a36Sopenharmony_ci
138062306a36Sopenharmony_ci/* bit definition for ODMR register */
138162306a36Sopenharmony_ci#define ODMR_MASK_ALL			0xFFFFFFFF/* mask all
138262306a36Sopenharmony_ci					interrupt vector */
138362306a36Sopenharmony_ci#define ODMR_CLEAR_ALL			0	/* clear all
138462306a36Sopenharmony_ci					interrupt vector */
138562306a36Sopenharmony_ci/* bit definition for ODCR register */
138662306a36Sopenharmony_ci#define ODCR_CLEAR_ALL			0xFFFFFFFF /* mask all
138762306a36Sopenharmony_ci					interrupt vector*/
138862306a36Sopenharmony_ci/* MSIX Interupts */
138962306a36Sopenharmony_ci#define MSIX_TABLE_OFFSET		0x2000
139062306a36Sopenharmony_ci#define MSIX_TABLE_ELEMENT_SIZE		0x10
139162306a36Sopenharmony_ci#define MSIX_INTERRUPT_CONTROL_OFFSET	0xC
139262306a36Sopenharmony_ci#define MSIX_TABLE_BASE			(MSIX_TABLE_OFFSET + \
139362306a36Sopenharmony_ci					MSIX_INTERRUPT_CONTROL_OFFSET)
139462306a36Sopenharmony_ci#define MSIX_INTERRUPT_DISABLE		0x1
139562306a36Sopenharmony_ci#define MSIX_INTERRUPT_ENABLE		0x0
139662306a36Sopenharmony_ci
139762306a36Sopenharmony_ci/* state definition for Scratch Pad1 register */
139862306a36Sopenharmony_ci#define SCRATCH_PAD_RAAE_READY		0x3
139962306a36Sopenharmony_ci#define SCRATCH_PAD_ILA_READY		0xC
140062306a36Sopenharmony_ci#define SCRATCH_PAD_BOOT_LOAD_SUCCESS	0x0
140162306a36Sopenharmony_ci#define SCRATCH_PAD_IOP0_READY		0xC00
140262306a36Sopenharmony_ci#define SCRATCH_PAD_IOP1_READY		0x3000
140362306a36Sopenharmony_ci#define SCRATCH_PAD_MIPSALL_READY_16PORT	(SCRATCH_PAD_IOP1_READY | \
140462306a36Sopenharmony_ci					SCRATCH_PAD_IOP0_READY | \
140562306a36Sopenharmony_ci					SCRATCH_PAD_ILA_READY | \
140662306a36Sopenharmony_ci					SCRATCH_PAD_RAAE_READY)
140762306a36Sopenharmony_ci#define SCRATCH_PAD_MIPSALL_READY_8PORT	(SCRATCH_PAD_IOP0_READY | \
140862306a36Sopenharmony_ci					SCRATCH_PAD_ILA_READY | \
140962306a36Sopenharmony_ci					SCRATCH_PAD_RAAE_READY)
141062306a36Sopenharmony_ci
141162306a36Sopenharmony_ci/* boot loader state */
141262306a36Sopenharmony_ci#define SCRATCH_PAD1_BOOTSTATE_MASK		0x70	/* Bit 4-6 */
141362306a36Sopenharmony_ci#define SCRATCH_PAD1_BOOTSTATE_SUCESS		0x0	/* Load successful */
141462306a36Sopenharmony_ci#define SCRATCH_PAD1_BOOTSTATE_HDA_SEEPROM	0x10	/* HDA SEEPROM */
141562306a36Sopenharmony_ci#define SCRATCH_PAD1_BOOTSTATE_HDA_BOOTSTRAP	0x20	/* HDA BootStrap Pins */
141662306a36Sopenharmony_ci#define SCRATCH_PAD1_BOOTSTATE_HDA_SOFTRESET	0x30	/* HDA Soft Reset */
141762306a36Sopenharmony_ci#define SCRATCH_PAD1_BOOTSTATE_CRIT_ERROR	0x40	/* HDA critical error */
141862306a36Sopenharmony_ci#define SCRATCH_PAD1_BOOTSTATE_R1		0x50	/* Reserved */
141962306a36Sopenharmony_ci#define SCRATCH_PAD1_BOOTSTATE_R2		0x60	/* Reserved */
142062306a36Sopenharmony_ci#define SCRATCH_PAD1_BOOTSTATE_FATAL		0x70	/* Fatal Error */
142162306a36Sopenharmony_ci
142262306a36Sopenharmony_ci /* state definition for Scratch Pad2 register */
142362306a36Sopenharmony_ci#define SCRATCH_PAD2_POR		0x00	/* power on state */
142462306a36Sopenharmony_ci#define SCRATCH_PAD2_SFR		0x01	/* soft reset state */
142562306a36Sopenharmony_ci#define SCRATCH_PAD2_ERR		0x02	/* error state */
142662306a36Sopenharmony_ci#define SCRATCH_PAD2_RDY		0x03	/* ready state */
142762306a36Sopenharmony_ci#define SCRATCH_PAD2_FWRDY_RST		0x04	/* FW rdy for soft reset flag */
142862306a36Sopenharmony_ci#define SCRATCH_PAD2_IOPRDY_RST		0x08	/* IOP ready for soft reset */
142962306a36Sopenharmony_ci#define SCRATCH_PAD2_STATE_MASK		0xFFFFFFF4 /* ScratchPad 2
143062306a36Sopenharmony_ci Mask, bit1-0 State */
143162306a36Sopenharmony_ci#define SCRATCH_PAD2_RESERVED		0x000003FC/* Scratch Pad1
143262306a36Sopenharmony_ci Reserved bit 2 to 9 */
143362306a36Sopenharmony_ci
143462306a36Sopenharmony_ci#define SCRATCH_PAD_ERROR_MASK		0xFFFFFC00 /* Error mask bits */
143562306a36Sopenharmony_ci#define SCRATCH_PAD_STATE_MASK		0x00000003 /* State Mask bits */
143662306a36Sopenharmony_ci
143762306a36Sopenharmony_ci/*state definition for Scratchpad Rsvd 0, Offset 0x6C, Non-fatal*/
143862306a36Sopenharmony_ci#define NON_FATAL_SPBC_LBUS_ECC_ERR	0x70000001
143962306a36Sopenharmony_ci#define NON_FATAL_BDMA_ERR		0xE0000001
144062306a36Sopenharmony_ci#define NON_FATAL_THERM_OVERTEMP_ERR	0x80000001
144162306a36Sopenharmony_ci
144262306a36Sopenharmony_ci/* main configuration offset - byte offset */
144362306a36Sopenharmony_ci#define MAIN_SIGNATURE_OFFSET		0x00 /* DWORD 0x00 */
144462306a36Sopenharmony_ci#define MAIN_INTERFACE_REVISION		0x04 /* DWORD 0x01 */
144562306a36Sopenharmony_ci#define MAIN_FW_REVISION		0x08 /* DWORD 0x02 */
144662306a36Sopenharmony_ci#define MAIN_MAX_OUTSTANDING_IO_OFFSET	0x0C /* DWORD 0x03 */
144762306a36Sopenharmony_ci#define MAIN_MAX_SGL_OFFSET		0x10 /* DWORD 0x04 */
144862306a36Sopenharmony_ci#define MAIN_CNTRL_CAP_OFFSET		0x14 /* DWORD 0x05 */
144962306a36Sopenharmony_ci#define MAIN_GST_OFFSET			0x18 /* DWORD 0x06 */
145062306a36Sopenharmony_ci#define MAIN_IBQ_OFFSET			0x1C /* DWORD 0x07 */
145162306a36Sopenharmony_ci#define MAIN_OBQ_OFFSET			0x20 /* DWORD 0x08 */
145262306a36Sopenharmony_ci#define MAIN_IQNPPD_HPPD_OFFSET		0x24 /* DWORD 0x09 */
145362306a36Sopenharmony_ci
145462306a36Sopenharmony_ci/* 0x28 - 0x4C - RSVD */
145562306a36Sopenharmony_ci#define MAIN_EVENT_CRC_CHECK		0x48 /* DWORD 0x12 */
145662306a36Sopenharmony_ci#define MAIN_EVENT_LOG_ADDR_HI		0x50 /* DWORD 0x14 */
145762306a36Sopenharmony_ci#define MAIN_EVENT_LOG_ADDR_LO		0x54 /* DWORD 0x15 */
145862306a36Sopenharmony_ci#define MAIN_EVENT_LOG_BUFF_SIZE	0x58 /* DWORD 0x16 */
145962306a36Sopenharmony_ci#define MAIN_EVENT_LOG_OPTION		0x5C /* DWORD 0x17 */
146062306a36Sopenharmony_ci#define MAIN_PCS_EVENT_LOG_ADDR_HI	0x60 /* DWORD 0x18 */
146162306a36Sopenharmony_ci#define MAIN_PCS_EVENT_LOG_ADDR_LO	0x64 /* DWORD 0x19 */
146262306a36Sopenharmony_ci#define MAIN_PCS_EVENT_LOG_BUFF_SIZE	0x68 /* DWORD 0x1A */
146362306a36Sopenharmony_ci#define MAIN_PCS_EVENT_LOG_OPTION	0x6C /* DWORD 0x1B */
146462306a36Sopenharmony_ci#define MAIN_FATAL_ERROR_INTERRUPT	0x70 /* DWORD 0x1C */
146562306a36Sopenharmony_ci#define MAIN_FATAL_ERROR_RDUMP0_OFFSET	0x74 /* DWORD 0x1D */
146662306a36Sopenharmony_ci#define MAIN_FATAL_ERROR_RDUMP0_LENGTH	0x78 /* DWORD 0x1E */
146762306a36Sopenharmony_ci#define MAIN_FATAL_ERROR_RDUMP1_OFFSET	0x7C /* DWORD 0x1F */
146862306a36Sopenharmony_ci#define MAIN_FATAL_ERROR_RDUMP1_LENGTH	0x80 /* DWORD 0x20 */
146962306a36Sopenharmony_ci#define MAIN_GPIO_LED_FLAGS_OFFSET	0x84 /* DWORD 0x21 */
147062306a36Sopenharmony_ci#define MAIN_ANALOG_SETUP_OFFSET	0x88 /* DWORD 0x22 */
147162306a36Sopenharmony_ci
147262306a36Sopenharmony_ci#define MAIN_INT_VECTOR_TABLE_OFFSET	0x8C /* DWORD 0x23 */
147362306a36Sopenharmony_ci#define MAIN_SAS_PHY_ATTR_TABLE_OFFSET	0x90 /* DWORD 0x24 */
147462306a36Sopenharmony_ci#define MAIN_PORT_RECOVERY_TIMER	0x94 /* DWORD 0x25 */
147562306a36Sopenharmony_ci#define MAIN_INT_REASSERTION_DELAY	0x98 /* DWORD 0x26 */
147662306a36Sopenharmony_ci#define MAIN_MPI_ILA_RELEASE_TYPE	0xA4 /* DWORD 0x29 */
147762306a36Sopenharmony_ci#define MAIN_MPI_INACTIVE_FW_VERSION	0XB0 /* DWORD 0x2C */
147862306a36Sopenharmony_ci
147962306a36Sopenharmony_ci/* Gereral Status Table offset - byte offset */
148062306a36Sopenharmony_ci#define GST_GSTLEN_MPIS_OFFSET		0x00
148162306a36Sopenharmony_ci#define GST_IQ_FREEZE_STATE0_OFFSET	0x04
148262306a36Sopenharmony_ci#define GST_IQ_FREEZE_STATE1_OFFSET	0x08
148362306a36Sopenharmony_ci#define GST_MSGUTCNT_OFFSET		0x0C
148462306a36Sopenharmony_ci#define GST_IOPTCNT_OFFSET		0x10
148562306a36Sopenharmony_ci/* 0x14 - 0x34 - RSVD */
148662306a36Sopenharmony_ci#define GST_GPIO_INPUT_VAL		0x38
148762306a36Sopenharmony_ci/* 0x3c - 0x40 - RSVD */
148862306a36Sopenharmony_ci#define GST_RERRINFO_OFFSET0		0x44
148962306a36Sopenharmony_ci#define GST_RERRINFO_OFFSET1		0x48
149062306a36Sopenharmony_ci#define GST_RERRINFO_OFFSET2		0x4c
149162306a36Sopenharmony_ci#define GST_RERRINFO_OFFSET3		0x50
149262306a36Sopenharmony_ci#define GST_RERRINFO_OFFSET4		0x54
149362306a36Sopenharmony_ci#define GST_RERRINFO_OFFSET5		0x58
149462306a36Sopenharmony_ci#define GST_RERRINFO_OFFSET6		0x5c
149562306a36Sopenharmony_ci#define GST_RERRINFO_OFFSET7		0x60
149662306a36Sopenharmony_ci
149762306a36Sopenharmony_ci/* General Status Table - MPI state */
149862306a36Sopenharmony_ci#define GST_MPI_STATE_UNINIT		0x00
149962306a36Sopenharmony_ci#define GST_MPI_STATE_INIT		0x01
150062306a36Sopenharmony_ci#define GST_MPI_STATE_TERMINATION	0x02
150162306a36Sopenharmony_ci#define GST_MPI_STATE_ERROR		0x03
150262306a36Sopenharmony_ci#define GST_MPI_STATE_MASK		0x07
150362306a36Sopenharmony_ci
150462306a36Sopenharmony_ci/* Per SAS PHY Attributes */
150562306a36Sopenharmony_ci
150662306a36Sopenharmony_ci#define PSPA_PHYSTATE0_OFFSET		0x00 /* Dword V */
150762306a36Sopenharmony_ci#define PSPA_OB_HW_EVENT_PID0_OFFSET	0x04 /* DWORD V+1 */
150862306a36Sopenharmony_ci#define PSPA_PHYSTATE1_OFFSET		0x08 /* Dword V+2 */
150962306a36Sopenharmony_ci#define PSPA_OB_HW_EVENT_PID1_OFFSET	0x0C /* DWORD V+3 */
151062306a36Sopenharmony_ci#define PSPA_PHYSTATE2_OFFSET		0x10 /* Dword V+4 */
151162306a36Sopenharmony_ci#define PSPA_OB_HW_EVENT_PID2_OFFSET	0x14 /* DWORD V+5 */
151262306a36Sopenharmony_ci#define PSPA_PHYSTATE3_OFFSET		0x18 /* Dword V+6 */
151362306a36Sopenharmony_ci#define PSPA_OB_HW_EVENT_PID3_OFFSET	0x1C /* DWORD V+7 */
151462306a36Sopenharmony_ci#define PSPA_PHYSTATE4_OFFSET		0x20 /* Dword V+8 */
151562306a36Sopenharmony_ci#define PSPA_OB_HW_EVENT_PID4_OFFSET	0x24 /* DWORD V+9 */
151662306a36Sopenharmony_ci#define PSPA_PHYSTATE5_OFFSET		0x28 /* Dword V+10 */
151762306a36Sopenharmony_ci#define PSPA_OB_HW_EVENT_PID5_OFFSET	0x2C /* DWORD V+11 */
151862306a36Sopenharmony_ci#define PSPA_PHYSTATE6_OFFSET		0x30 /* Dword V+12 */
151962306a36Sopenharmony_ci#define PSPA_OB_HW_EVENT_PID6_OFFSET	0x34 /* DWORD V+13 */
152062306a36Sopenharmony_ci#define PSPA_PHYSTATE7_OFFSET		0x38 /* Dword V+14 */
152162306a36Sopenharmony_ci#define PSPA_OB_HW_EVENT_PID7_OFFSET	0x3C /* DWORD V+15 */
152262306a36Sopenharmony_ci#define PSPA_PHYSTATE8_OFFSET		0x40 /* DWORD V+16 */
152362306a36Sopenharmony_ci#define PSPA_OB_HW_EVENT_PID8_OFFSET	0x44 /* DWORD V+17 */
152462306a36Sopenharmony_ci#define PSPA_PHYSTATE9_OFFSET		0x48 /* DWORD V+18 */
152562306a36Sopenharmony_ci#define PSPA_OB_HW_EVENT_PID9_OFFSET	0x4C /* DWORD V+19 */
152662306a36Sopenharmony_ci#define PSPA_PHYSTATE10_OFFSET		0x50 /* DWORD V+20 */
152762306a36Sopenharmony_ci#define PSPA_OB_HW_EVENT_PID10_OFFSET	0x54 /* DWORD V+21 */
152862306a36Sopenharmony_ci#define PSPA_PHYSTATE11_OFFSET		0x58 /* DWORD V+22 */
152962306a36Sopenharmony_ci#define PSPA_OB_HW_EVENT_PID11_OFFSET	0x5C /* DWORD V+23 */
153062306a36Sopenharmony_ci#define PSPA_PHYSTATE12_OFFSET		0x60 /* DWORD V+24 */
153162306a36Sopenharmony_ci#define PSPA_OB_HW_EVENT_PID12_OFFSET	0x64 /* DWORD V+25 */
153262306a36Sopenharmony_ci#define PSPA_PHYSTATE13_OFFSET		0x68 /* DWORD V+26 */
153362306a36Sopenharmony_ci#define PSPA_OB_HW_EVENT_PID13_OFFSET	0x6c /* DWORD V+27 */
153462306a36Sopenharmony_ci#define PSPA_PHYSTATE14_OFFSET		0x70 /* DWORD V+28 */
153562306a36Sopenharmony_ci#define PSPA_OB_HW_EVENT_PID14_OFFSET	0x74 /* DWORD V+29 */
153662306a36Sopenharmony_ci#define PSPA_PHYSTATE15_OFFSET		0x78 /* DWORD V+30 */
153762306a36Sopenharmony_ci#define PSPA_OB_HW_EVENT_PID15_OFFSET	0x7c /* DWORD V+31 */
153862306a36Sopenharmony_ci/* end PSPA */
153962306a36Sopenharmony_ci
154062306a36Sopenharmony_ci/* inbound queue configuration offset - byte offset */
154162306a36Sopenharmony_ci#define IB_PROPERITY_OFFSET		0x00
154262306a36Sopenharmony_ci#define IB_BASE_ADDR_HI_OFFSET		0x04
154362306a36Sopenharmony_ci#define IB_BASE_ADDR_LO_OFFSET		0x08
154462306a36Sopenharmony_ci#define IB_CI_BASE_ADDR_HI_OFFSET	0x0C
154562306a36Sopenharmony_ci#define IB_CI_BASE_ADDR_LO_OFFSET	0x10
154662306a36Sopenharmony_ci#define IB_PIPCI_BAR			0x14
154762306a36Sopenharmony_ci#define IB_PIPCI_BAR_OFFSET		0x18
154862306a36Sopenharmony_ci#define IB_RESERVED_OFFSET		0x1C
154962306a36Sopenharmony_ci
155062306a36Sopenharmony_ci/* outbound queue configuration offset - byte offset */
155162306a36Sopenharmony_ci#define OB_PROPERITY_OFFSET		0x00
155262306a36Sopenharmony_ci#define OB_BASE_ADDR_HI_OFFSET		0x04
155362306a36Sopenharmony_ci#define OB_BASE_ADDR_LO_OFFSET		0x08
155462306a36Sopenharmony_ci#define OB_PI_BASE_ADDR_HI_OFFSET	0x0C
155562306a36Sopenharmony_ci#define OB_PI_BASE_ADDR_LO_OFFSET	0x10
155662306a36Sopenharmony_ci#define OB_CIPCI_BAR			0x14
155762306a36Sopenharmony_ci#define OB_CIPCI_BAR_OFFSET		0x18
155862306a36Sopenharmony_ci#define OB_INTERRUPT_COALES_OFFSET	0x1C
155962306a36Sopenharmony_ci#define OB_DYNAMIC_COALES_OFFSET	0x20
156062306a36Sopenharmony_ci#define OB_PROPERTY_INT_ENABLE		0x40000000
156162306a36Sopenharmony_ci
156262306a36Sopenharmony_ci#define MBIC_NMI_ENABLE_VPE0_IOP	0x000418
156362306a36Sopenharmony_ci#define MBIC_NMI_ENABLE_VPE0_AAP1	0x000418
156462306a36Sopenharmony_ci/* PCIE registers - BAR2(0x18), BAR1(win) 0x010000 */
156562306a36Sopenharmony_ci#define PCIE_EVENT_INTERRUPT_ENABLE	0x003040
156662306a36Sopenharmony_ci#define PCIE_EVENT_INTERRUPT		0x003044
156762306a36Sopenharmony_ci#define PCIE_ERROR_INTERRUPT_ENABLE	0x003048
156862306a36Sopenharmony_ci#define PCIE_ERROR_INTERRUPT		0x00304C
156962306a36Sopenharmony_ci
157062306a36Sopenharmony_ci/* SPCV soft reset */
157162306a36Sopenharmony_ci#define SPC_REG_SOFT_RESET 0x00001000
157262306a36Sopenharmony_ci#define SPCv_NORMAL_RESET_VALUE		0x1
157362306a36Sopenharmony_ci
157462306a36Sopenharmony_ci#define SPCv_SOFT_RESET_READ_MASK		0xC0
157562306a36Sopenharmony_ci#define SPCv_SOFT_RESET_NO_RESET		0x0
157662306a36Sopenharmony_ci#define SPCv_SOFT_RESET_NORMAL_RESET_OCCURED	0x40
157762306a36Sopenharmony_ci#define SPCv_SOFT_RESET_HDA_MODE_OCCURED	0x80
157862306a36Sopenharmony_ci#define SPCv_SOFT_RESET_CHIP_RESET_OCCURED	0xC0
157962306a36Sopenharmony_ci
158062306a36Sopenharmony_ci/* signature definition for host scratch pad0 register */
158162306a36Sopenharmony_ci#define SPC_SOFT_RESET_SIGNATURE	0x252acbcd
158262306a36Sopenharmony_ci/* Signature for Soft Reset */
158362306a36Sopenharmony_ci
158462306a36Sopenharmony_ci/* SPC Reset register - BAR4(0x20), BAR2(win) (need dynamic mapping) */
158562306a36Sopenharmony_ci#define SPC_REG_RESET			0x000000/* reset register */
158662306a36Sopenharmony_ci
158762306a36Sopenharmony_ci/* bit definition for SPC_RESET register */
158862306a36Sopenharmony_ci#define SPC_REG_RESET_OSSP		0x00000001
158962306a36Sopenharmony_ci#define SPC_REG_RESET_RAAE		0x00000002
159062306a36Sopenharmony_ci#define SPC_REG_RESET_PCS_SPBC		0x00000004
159162306a36Sopenharmony_ci#define SPC_REG_RESET_PCS_IOP_SS	0x00000008
159262306a36Sopenharmony_ci#define SPC_REG_RESET_PCS_AAP1_SS	0x00000010
159362306a36Sopenharmony_ci#define SPC_REG_RESET_PCS_AAP2_SS	0x00000020
159462306a36Sopenharmony_ci#define SPC_REG_RESET_PCS_LM		0x00000040
159562306a36Sopenharmony_ci#define SPC_REG_RESET_PCS		0x00000080
159662306a36Sopenharmony_ci#define SPC_REG_RESET_GSM		0x00000100
159762306a36Sopenharmony_ci#define SPC_REG_RESET_DDR2		0x00010000
159862306a36Sopenharmony_ci#define SPC_REG_RESET_BDMA_CORE		0x00020000
159962306a36Sopenharmony_ci#define SPC_REG_RESET_BDMA_SXCBI	0x00040000
160062306a36Sopenharmony_ci#define SPC_REG_RESET_PCIE_AL_SXCBI	0x00080000
160162306a36Sopenharmony_ci#define SPC_REG_RESET_PCIE_PWR		0x00100000
160262306a36Sopenharmony_ci#define SPC_REG_RESET_PCIE_SFT		0x00200000
160362306a36Sopenharmony_ci#define SPC_REG_RESET_PCS_SXCBI		0x00400000
160462306a36Sopenharmony_ci#define SPC_REG_RESET_LMS_SXCBI		0x00800000
160562306a36Sopenharmony_ci#define SPC_REG_RESET_PMIC_SXCBI	0x01000000
160662306a36Sopenharmony_ci#define SPC_REG_RESET_PMIC_CORE		0x02000000
160762306a36Sopenharmony_ci#define SPC_REG_RESET_PCIE_PC_SXCBI	0x04000000
160862306a36Sopenharmony_ci#define SPC_REG_RESET_DEVICE		0x80000000
160962306a36Sopenharmony_ci
161062306a36Sopenharmony_ci/* registers for BAR Shifting - BAR2(0x18), BAR1(win) */
161162306a36Sopenharmony_ci#define SPCV_IBW_AXI_TRANSLATION_LOW	0x001010
161262306a36Sopenharmony_ci
161362306a36Sopenharmony_ci#define MBIC_AAP1_ADDR_BASE		0x060000
161462306a36Sopenharmony_ci#define MBIC_IOP_ADDR_BASE		0x070000
161562306a36Sopenharmony_ci#define GSM_ADDR_BASE			0x0700000
161662306a36Sopenharmony_ci/* Dynamic map through Bar4 - 0x00700000 */
161762306a36Sopenharmony_ci#define GSM_CONFIG_RESET		0x00000000
161862306a36Sopenharmony_ci#define RAM_ECC_DB_ERR			0x00000018
161962306a36Sopenharmony_ci#define GSM_READ_ADDR_PARITY_INDIC	0x00000058
162062306a36Sopenharmony_ci#define GSM_WRITE_ADDR_PARITY_INDIC	0x00000060
162162306a36Sopenharmony_ci#define GSM_WRITE_DATA_PARITY_INDIC	0x00000068
162262306a36Sopenharmony_ci#define GSM_READ_ADDR_PARITY_CHECK	0x00000038
162362306a36Sopenharmony_ci#define GSM_WRITE_ADDR_PARITY_CHECK	0x00000040
162462306a36Sopenharmony_ci#define GSM_WRITE_DATA_PARITY_CHECK	0x00000048
162562306a36Sopenharmony_ci
162662306a36Sopenharmony_ci#define RB6_ACCESS_REG			0x6A0000
162762306a36Sopenharmony_ci#define HDAC_EXEC_CMD			0x0002
162862306a36Sopenharmony_ci#define HDA_C_PA			0xcb
162962306a36Sopenharmony_ci#define HDA_SEQ_ID_BITS			0x00ff0000
163062306a36Sopenharmony_ci#define HDA_GSM_OFFSET_BITS		0x00FFFFFF
163162306a36Sopenharmony_ci#define HDA_GSM_CMD_OFFSET_BITS		0x42C0
163262306a36Sopenharmony_ci#define HDA_GSM_RSP_OFFSET_BITS		0x42E0
163362306a36Sopenharmony_ci
163462306a36Sopenharmony_ci#define MBIC_AAP1_ADDR_BASE		0x060000
163562306a36Sopenharmony_ci#define MBIC_IOP_ADDR_BASE		0x070000
163662306a36Sopenharmony_ci#define GSM_ADDR_BASE			0x0700000
163762306a36Sopenharmony_ci#define SPC_TOP_LEVEL_ADDR_BASE		0x000000
163862306a36Sopenharmony_ci#define GSM_CONFIG_RESET_VALUE		0x00003b00
163962306a36Sopenharmony_ci#define GPIO_ADDR_BASE			0x00090000
164062306a36Sopenharmony_ci#define GPIO_GPIO_0_0UTPUT_CTL_OFFSET	0x0000010c
164162306a36Sopenharmony_ci
164262306a36Sopenharmony_ci/* RB6 offset */
164362306a36Sopenharmony_ci#define SPC_RB6_OFFSET			0x80C0
164462306a36Sopenharmony_ci/* Magic number of soft reset for RB6 */
164562306a36Sopenharmony_ci#define RB6_MAGIC_NUMBER_RST		0x1234
164662306a36Sopenharmony_ci
164762306a36Sopenharmony_ci/* Device Register status */
164862306a36Sopenharmony_ci#define DEVREG_SUCCESS					0x00
164962306a36Sopenharmony_ci#define DEVREG_FAILURE_OUT_OF_RESOURCE			0x01
165062306a36Sopenharmony_ci#define DEVREG_FAILURE_DEVICE_ALREADY_REGISTERED	0x02
165162306a36Sopenharmony_ci#define DEVREG_FAILURE_INVALID_PHY_ID			0x03
165262306a36Sopenharmony_ci#define DEVREG_FAILURE_PHY_ID_ALREADY_REGISTERED	0x04
165362306a36Sopenharmony_ci#define DEVREG_FAILURE_PORT_ID_OUT_OF_RANGE		0x05
165462306a36Sopenharmony_ci#define DEVREG_FAILURE_PORT_NOT_VALID_STATE		0x06
165562306a36Sopenharmony_ci#define DEVREG_FAILURE_DEVICE_TYPE_NOT_VALID		0x07
165662306a36Sopenharmony_ci
165762306a36Sopenharmony_ci
165862306a36Sopenharmony_ci#define MEMBASE_II_SHIFT_REGISTER       0x1010
165962306a36Sopenharmony_ci#endif
166062306a36Sopenharmony_ci
166162306a36Sopenharmony_ci/**
166262306a36Sopenharmony_ci * As we know sleep (1~20) ms may result in sleep longer than ~20 ms, hence we
166362306a36Sopenharmony_ci * choose 20 ms interval.
166462306a36Sopenharmony_ci */
166562306a36Sopenharmony_ci#define FW_READY_INTERVAL	20
1666