18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * PMC-Sierra SPCv/ve 8088/8089 SAS/SATA based host adapters driver
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Copyright (c) 2008-2009 USI Co., Ltd.
58c2ecf20Sopenharmony_ci * All rights reserved.
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Redistribution and use in source and binary forms, with or without
88c2ecf20Sopenharmony_ci * modification, are permitted provided that the following conditions
98c2ecf20Sopenharmony_ci * are met:
108c2ecf20Sopenharmony_ci * 1. Redistributions of source code must retain the above copyright
118c2ecf20Sopenharmony_ci *	notice, this list of conditions, and the following disclaimer,
128c2ecf20Sopenharmony_ci *	without modification.
138c2ecf20Sopenharmony_ci * 2. Redistributions in binary form must reproduce at minimum a disclaimer
148c2ecf20Sopenharmony_ci *	substantially similar to the "NO WARRANTY" disclaimer below
158c2ecf20Sopenharmony_ci *	("Disclaimer") and any redistribution must be conditioned upon
168c2ecf20Sopenharmony_ci *	including a substantially similar Disclaimer requirement for further
178c2ecf20Sopenharmony_ci *	binary redistribution.
188c2ecf20Sopenharmony_ci * 3. Neither the names of the above-listed copyright holders nor the names
198c2ecf20Sopenharmony_ci *	of any contributors may be used to endorse or promote products derived
208c2ecf20Sopenharmony_ci *	from this software without specific prior written permission.
218c2ecf20Sopenharmony_ci *
228c2ecf20Sopenharmony_ci * Alternatively, this software may be distributed under the terms of the
238c2ecf20Sopenharmony_ci * GNU General Public License ("GPL") version 2 as published by the Free
248c2ecf20Sopenharmony_ci * Software Foundation.
258c2ecf20Sopenharmony_ci *
268c2ecf20Sopenharmony_ci * NO WARRANTY
278c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
288c2ecf20Sopenharmony_ci * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
298c2ecf20Sopenharmony_ci * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
308c2ecf20Sopenharmony_ci * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
318c2ecf20Sopenharmony_ci * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
328c2ecf20Sopenharmony_ci * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
338c2ecf20Sopenharmony_ci * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
348c2ecf20Sopenharmony_ci * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
358c2ecf20Sopenharmony_ci * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
368c2ecf20Sopenharmony_ci * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
378c2ecf20Sopenharmony_ci * POSSIBILITY OF SUCH DAMAGES.
388c2ecf20Sopenharmony_ci *
398c2ecf20Sopenharmony_ci */
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci#ifndef _PMC8001_REG_H_
428c2ecf20Sopenharmony_ci#define _PMC8001_REG_H_
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci#include <linux/types.h>
458c2ecf20Sopenharmony_ci#include <scsi/libsas.h>
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci/* for Request Opcode of IOMB */
488c2ecf20Sopenharmony_ci#define OPC_INB_ECHO				1	/* 0x000 */
498c2ecf20Sopenharmony_ci#define OPC_INB_PHYSTART			4	/* 0x004 */
508c2ecf20Sopenharmony_ci#define OPC_INB_PHYSTOP				5	/* 0x005 */
518c2ecf20Sopenharmony_ci#define OPC_INB_SSPINIIOSTART			6	/* 0x006 */
528c2ecf20Sopenharmony_ci#define OPC_INB_SSPINITMSTART			7	/* 0x007 */
538c2ecf20Sopenharmony_ci/* 0x8 RESV IN SPCv */
548c2ecf20Sopenharmony_ci#define OPC_INB_RSVD				8	/* 0x008 */
558c2ecf20Sopenharmony_ci#define OPC_INB_DEV_HANDLE_ACCEPT		9	/* 0x009 */
568c2ecf20Sopenharmony_ci#define OPC_INB_SSPTGTIOSTART			10	/* 0x00A */
578c2ecf20Sopenharmony_ci#define OPC_INB_SSPTGTRSPSTART			11	/* 0x00B */
588c2ecf20Sopenharmony_ci/* 0xC, 0xD, 0xE removed in SPCv */
598c2ecf20Sopenharmony_ci#define OPC_INB_SSP_ABORT			15	/* 0x00F */
608c2ecf20Sopenharmony_ci#define OPC_INB_DEREG_DEV_HANDLE		16	/* 0x010 */
618c2ecf20Sopenharmony_ci#define OPC_INB_GET_DEV_HANDLE			17	/* 0x011 */
628c2ecf20Sopenharmony_ci#define OPC_INB_SMP_REQUEST			18	/* 0x012 */
638c2ecf20Sopenharmony_ci/* 0x13 SMP_RESPONSE is removed in SPCv */
648c2ecf20Sopenharmony_ci#define OPC_INB_SMP_ABORT			20	/* 0x014 */
658c2ecf20Sopenharmony_ci/* 0x16 RESV IN SPCv */
668c2ecf20Sopenharmony_ci#define OPC_INB_RSVD1				22	/* 0x016 */
678c2ecf20Sopenharmony_ci#define OPC_INB_SATA_HOST_OPSTART		23	/* 0x017 */
688c2ecf20Sopenharmony_ci#define OPC_INB_SATA_ABORT			24	/* 0x018 */
698c2ecf20Sopenharmony_ci#define OPC_INB_LOCAL_PHY_CONTROL		25	/* 0x019 */
708c2ecf20Sopenharmony_ci/* 0x1A RESV IN SPCv */
718c2ecf20Sopenharmony_ci#define OPC_INB_RSVD2				26	/* 0x01A */
728c2ecf20Sopenharmony_ci#define OPC_INB_FW_FLASH_UPDATE			32	/* 0x020 */
738c2ecf20Sopenharmony_ci#define OPC_INB_GPIO				34	/* 0x022 */
748c2ecf20Sopenharmony_ci#define OPC_INB_SAS_DIAG_MODE_START_END		35	/* 0x023 */
758c2ecf20Sopenharmony_ci#define OPC_INB_SAS_DIAG_EXECUTE		36	/* 0x024 */
768c2ecf20Sopenharmony_ci/* 0x25 RESV IN SPCv */
778c2ecf20Sopenharmony_ci#define OPC_INB_RSVD3				37	/* 0x025 */
788c2ecf20Sopenharmony_ci#define OPC_INB_GET_TIME_STAMP			38	/* 0x026 */
798c2ecf20Sopenharmony_ci#define OPC_INB_PORT_CONTROL			39	/* 0x027 */
808c2ecf20Sopenharmony_ci#define OPC_INB_GET_NVMD_DATA			40	/* 0x028 */
818c2ecf20Sopenharmony_ci#define OPC_INB_SET_NVMD_DATA			41	/* 0x029 */
828c2ecf20Sopenharmony_ci#define OPC_INB_SET_DEVICE_STATE		42	/* 0x02A */
838c2ecf20Sopenharmony_ci#define OPC_INB_GET_DEVICE_STATE		43	/* 0x02B */
848c2ecf20Sopenharmony_ci#define OPC_INB_SET_DEV_INFO			44	/* 0x02C */
858c2ecf20Sopenharmony_ci/* 0x2D RESV IN SPCv */
868c2ecf20Sopenharmony_ci#define OPC_INB_RSVD4				45	/* 0x02D */
878c2ecf20Sopenharmony_ci#define OPC_INB_SGPIO_REGISTER			46	/* 0x02E */
888c2ecf20Sopenharmony_ci#define OPC_INB_PCIE_DIAG_EXEC			47	/* 0x02F */
898c2ecf20Sopenharmony_ci#define OPC_INB_SET_CONTROLLER_CONFIG		48	/* 0x030 */
908c2ecf20Sopenharmony_ci#define OPC_INB_GET_CONTROLLER_CONFIG		49	/* 0x031 */
918c2ecf20Sopenharmony_ci#define OPC_INB_REG_DEV				50	/* 0x032 */
928c2ecf20Sopenharmony_ci#define OPC_INB_SAS_HW_EVENT_ACK		51	/* 0x033 */
938c2ecf20Sopenharmony_ci#define OPC_INB_GET_DEVICE_INFO			52	/* 0x034 */
948c2ecf20Sopenharmony_ci#define OPC_INB_GET_PHY_PROFILE			53	/* 0x035 */
958c2ecf20Sopenharmony_ci#define OPC_INB_FLASH_OP_EXT			54	/* 0x036 */
968c2ecf20Sopenharmony_ci#define OPC_INB_SET_PHY_PROFILE			55	/* 0x037 */
978c2ecf20Sopenharmony_ci#define OPC_INB_KEK_MANAGEMENT			256	/* 0x100 */
988c2ecf20Sopenharmony_ci#define OPC_INB_DEK_MANAGEMENT			257	/* 0x101 */
998c2ecf20Sopenharmony_ci#define OPC_INB_SSP_INI_DIF_ENC_IO		258	/* 0x102 */
1008c2ecf20Sopenharmony_ci#define OPC_INB_SATA_DIF_ENC_IO			259	/* 0x103 */
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ci/* for Response Opcode of IOMB */
1038c2ecf20Sopenharmony_ci#define OPC_OUB_ECHO					1	/* 0x001 */
1048c2ecf20Sopenharmony_ci#define OPC_OUB_RSVD					4	/* 0x004 */
1058c2ecf20Sopenharmony_ci#define OPC_OUB_SSP_COMP				5	/* 0x005 */
1068c2ecf20Sopenharmony_ci#define OPC_OUB_SMP_COMP				6	/* 0x006 */
1078c2ecf20Sopenharmony_ci#define OPC_OUB_LOCAL_PHY_CNTRL				7	/* 0x007 */
1088c2ecf20Sopenharmony_ci#define OPC_OUB_RSVD1					10	/* 0x00A */
1098c2ecf20Sopenharmony_ci#define OPC_OUB_DEREG_DEV				11	/* 0x00B */
1108c2ecf20Sopenharmony_ci#define OPC_OUB_GET_DEV_HANDLE				12	/* 0x00C */
1118c2ecf20Sopenharmony_ci#define OPC_OUB_SATA_COMP				13	/* 0x00D */
1128c2ecf20Sopenharmony_ci#define OPC_OUB_SATA_EVENT				14	/* 0x00E */
1138c2ecf20Sopenharmony_ci#define OPC_OUB_SSP_EVENT				15	/* 0x00F */
1148c2ecf20Sopenharmony_ci#define OPC_OUB_RSVD2					16	/* 0x010 */
1158c2ecf20Sopenharmony_ci/* 0x11 - SMP_RECEIVED Notification removed in SPCv*/
1168c2ecf20Sopenharmony_ci#define OPC_OUB_SSP_RECV_EVENT				18	/* 0x012 */
1178c2ecf20Sopenharmony_ci#define OPC_OUB_RSVD3					19	/* 0x013 */
1188c2ecf20Sopenharmony_ci#define OPC_OUB_FW_FLASH_UPDATE				20	/* 0x014 */
1198c2ecf20Sopenharmony_ci#define OPC_OUB_GPIO_RESPONSE				22	/* 0x016 */
1208c2ecf20Sopenharmony_ci#define OPC_OUB_GPIO_EVENT				23	/* 0x017 */
1218c2ecf20Sopenharmony_ci#define OPC_OUB_GENERAL_EVENT				24	/* 0x018 */
1228c2ecf20Sopenharmony_ci#define OPC_OUB_SSP_ABORT_RSP				26	/* 0x01A */
1238c2ecf20Sopenharmony_ci#define OPC_OUB_SATA_ABORT_RSP				27	/* 0x01B */
1248c2ecf20Sopenharmony_ci#define OPC_OUB_SAS_DIAG_MODE_START_END			28	/* 0x01C */
1258c2ecf20Sopenharmony_ci#define OPC_OUB_SAS_DIAG_EXECUTE			29	/* 0x01D */
1268c2ecf20Sopenharmony_ci#define OPC_OUB_GET_TIME_STAMP				30	/* 0x01E */
1278c2ecf20Sopenharmony_ci#define OPC_OUB_RSVD4					31	/* 0x01F */
1288c2ecf20Sopenharmony_ci#define OPC_OUB_PORT_CONTROL				32	/* 0x020 */
1298c2ecf20Sopenharmony_ci#define OPC_OUB_SKIP_ENTRY				33	/* 0x021 */
1308c2ecf20Sopenharmony_ci#define OPC_OUB_SMP_ABORT_RSP				34	/* 0x022 */
1318c2ecf20Sopenharmony_ci#define OPC_OUB_GET_NVMD_DATA				35	/* 0x023 */
1328c2ecf20Sopenharmony_ci#define OPC_OUB_SET_NVMD_DATA				36	/* 0x024 */
1338c2ecf20Sopenharmony_ci#define OPC_OUB_DEVICE_HANDLE_REMOVAL			37	/* 0x025 */
1348c2ecf20Sopenharmony_ci#define OPC_OUB_SET_DEVICE_STATE			38	/* 0x026 */
1358c2ecf20Sopenharmony_ci#define OPC_OUB_GET_DEVICE_STATE			39	/* 0x027 */
1368c2ecf20Sopenharmony_ci#define OPC_OUB_SET_DEV_INFO				40	/* 0x028 */
1378c2ecf20Sopenharmony_ci#define OPC_OUB_RSVD5					41	/* 0x029 */
1388c2ecf20Sopenharmony_ci#define OPC_OUB_HW_EVENT				1792	/* 0x700 */
1398c2ecf20Sopenharmony_ci#define OPC_OUB_DEV_HANDLE_ARRIV			1824	/* 0x720 */
1408c2ecf20Sopenharmony_ci#define OPC_OUB_THERM_HW_EVENT				1840	/* 0x730 */
1418c2ecf20Sopenharmony_ci#define OPC_OUB_SGPIO_RESP				2094	/* 0x82E */
1428c2ecf20Sopenharmony_ci#define OPC_OUB_PCIE_DIAG_EXECUTE			2095	/* 0x82F */
1438c2ecf20Sopenharmony_ci#define OPC_OUB_DEV_REGIST				2098	/* 0x832 */
1448c2ecf20Sopenharmony_ci#define OPC_OUB_SAS_HW_EVENT_ACK			2099	/* 0x833 */
1458c2ecf20Sopenharmony_ci#define OPC_OUB_GET_DEVICE_INFO				2100	/* 0x834 */
1468c2ecf20Sopenharmony_ci/* spcv specific commands */
1478c2ecf20Sopenharmony_ci#define OPC_OUB_PHY_START_RESP				2052	/* 0x804 */
1488c2ecf20Sopenharmony_ci#define OPC_OUB_PHY_STOP_RESP				2053	/* 0x805 */
1498c2ecf20Sopenharmony_ci#define OPC_OUB_SET_CONTROLLER_CONFIG			2096	/* 0x830 */
1508c2ecf20Sopenharmony_ci#define OPC_OUB_GET_CONTROLLER_CONFIG			2097	/* 0x831 */
1518c2ecf20Sopenharmony_ci#define OPC_OUB_GET_PHY_PROFILE				2101	/* 0x835 */
1528c2ecf20Sopenharmony_ci#define OPC_OUB_FLASH_OP_EXT				2102	/* 0x836 */
1538c2ecf20Sopenharmony_ci#define OPC_OUB_SET_PHY_PROFILE				2103	/* 0x837 */
1548c2ecf20Sopenharmony_ci#define OPC_OUB_KEK_MANAGEMENT_RESP			2304	/* 0x900 */
1558c2ecf20Sopenharmony_ci#define OPC_OUB_DEK_MANAGEMENT_RESP			2305	/* 0x901 */
1568c2ecf20Sopenharmony_ci#define OPC_OUB_SSP_COALESCED_COMP_RESP			2306	/* 0x902 */
1578c2ecf20Sopenharmony_ci
1588c2ecf20Sopenharmony_ci/* for phy start*/
1598c2ecf20Sopenharmony_ci#define SSC_DISABLE_15			(0x01 << 16)
1608c2ecf20Sopenharmony_ci#define SSC_DISABLE_30			(0x02 << 16)
1618c2ecf20Sopenharmony_ci#define SSC_DISABLE_60			(0x04 << 16)
1628c2ecf20Sopenharmony_ci#define SAS_ASE				(0x01 << 15)
1638c2ecf20Sopenharmony_ci#define SPINHOLD_DISABLE		(0x00 << 14)
1648c2ecf20Sopenharmony_ci#define SPINHOLD_ENABLE			(0x01 << 14)
1658c2ecf20Sopenharmony_ci#define LINKMODE_SAS			(0x01 << 12)
1668c2ecf20Sopenharmony_ci#define LINKMODE_DSATA			(0x02 << 12)
1678c2ecf20Sopenharmony_ci#define LINKMODE_AUTO			(0x03 << 12)
1688c2ecf20Sopenharmony_ci#define LINKRATE_15			(0x01 << 8)
1698c2ecf20Sopenharmony_ci#define LINKRATE_30			(0x02 << 8)
1708c2ecf20Sopenharmony_ci#define LINKRATE_60			(0x04 << 8)
1718c2ecf20Sopenharmony_ci#define LINKRATE_120			(0x08 << 8)
1728c2ecf20Sopenharmony_ci
1738c2ecf20Sopenharmony_ci/*phy_stop*/
1748c2ecf20Sopenharmony_ci#define PHY_STOP_SUCCESS		0x00
1758c2ecf20Sopenharmony_ci#define PHY_STOP_ERR_DEVICE_ATTACHED	0x1046
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_ci/* phy_profile */
1788c2ecf20Sopenharmony_ci#define SAS_PHY_ANALOG_SETTINGS_PAGE	0x04
1798c2ecf20Sopenharmony_ci#define PHY_DWORD_LENGTH		0xC
1808c2ecf20Sopenharmony_ci
1818c2ecf20Sopenharmony_ci/* Thermal related */
1828c2ecf20Sopenharmony_ci#define	THERMAL_ENABLE			0x1
1838c2ecf20Sopenharmony_ci#define	THERMAL_LOG_ENABLE		0x1
1848c2ecf20Sopenharmony_ci#define THERMAL_PAGE_CODE_7H		0x6
1858c2ecf20Sopenharmony_ci#define THERMAL_PAGE_CODE_8H		0x7
1868c2ecf20Sopenharmony_ci#define LTEMPHIL			 70
1878c2ecf20Sopenharmony_ci#define RTEMPHIL			100
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_ci/* Encryption info */
1908c2ecf20Sopenharmony_ci#define SCRATCH_PAD3_ENC_DISABLED	0x00000000
1918c2ecf20Sopenharmony_ci#define SCRATCH_PAD3_ENC_DIS_ERR	0x00000001
1928c2ecf20Sopenharmony_ci#define SCRATCH_PAD3_ENC_ENA_ERR	0x00000002
1938c2ecf20Sopenharmony_ci#define SCRATCH_PAD3_ENC_READY		0x00000003
1948c2ecf20Sopenharmony_ci#define SCRATCH_PAD3_ENC_MASK		SCRATCH_PAD3_ENC_READY
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_ci#define SCRATCH_PAD3_XTS_ENABLED		(1 << 14)
1978c2ecf20Sopenharmony_ci#define SCRATCH_PAD3_SMA_ENABLED		(1 << 4)
1988c2ecf20Sopenharmony_ci#define SCRATCH_PAD3_SMB_ENABLED		(1 << 5)
1998c2ecf20Sopenharmony_ci#define SCRATCH_PAD3_SMF_ENABLED		0
2008c2ecf20Sopenharmony_ci#define SCRATCH_PAD3_SM_MASK			0x000000F0
2018c2ecf20Sopenharmony_ci#define SCRATCH_PAD3_ERR_CODE			0x00FF0000
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_ci#define SEC_MODE_SMF				0x0
2048c2ecf20Sopenharmony_ci#define SEC_MODE_SMA				0x100
2058c2ecf20Sopenharmony_ci#define SEC_MODE_SMB				0x200
2068c2ecf20Sopenharmony_ci#define CIPHER_MODE_ECB				0x00000001
2078c2ecf20Sopenharmony_ci#define CIPHER_MODE_XTS				0x00000002
2088c2ecf20Sopenharmony_ci#define KEK_MGMT_SUBOP_KEYCARDUPDATE		0x4
2098c2ecf20Sopenharmony_ci
2108c2ecf20Sopenharmony_ci/* SAS protocol timer configuration page */
2118c2ecf20Sopenharmony_ci#define SAS_PROTOCOL_TIMER_CONFIG_PAGE  0x04
2128c2ecf20Sopenharmony_ci#define STP_MCT_TMO                     32
2138c2ecf20Sopenharmony_ci#define SSP_MCT_TMO                     32
2148c2ecf20Sopenharmony_ci#define SAS_MAX_OPEN_TIME				5
2158c2ecf20Sopenharmony_ci#define SMP_MAX_CONN_TIMER              0xFF
2168c2ecf20Sopenharmony_ci#define STP_FRM_TIMER                   0
2178c2ecf20Sopenharmony_ci#define STP_IDLE_TIME                   5 /* 5 us; controller default */
2188c2ecf20Sopenharmony_ci#define SAS_MFD                         0
2198c2ecf20Sopenharmony_ci#define SAS_OPNRJT_RTRY_INTVL           2
2208c2ecf20Sopenharmony_ci#define SAS_DOPNRJT_RTRY_TMO            128
2218c2ecf20Sopenharmony_ci#define SAS_COPNRJT_RTRY_TMO            128
2228c2ecf20Sopenharmony_ci
2238c2ecf20Sopenharmony_ci#define SPCV_DOORBELL_CLEAR_TIMEOUT	(30 * 1000 * 1000) /* 30 sec */
2248c2ecf20Sopenharmony_ci#define SPC_DOORBELL_CLEAR_TIMEOUT	(15 * 1000 * 1000) /* 15 sec */
2258c2ecf20Sopenharmony_ci
2268c2ecf20Sopenharmony_ci/*
2278c2ecf20Sopenharmony_ci  Making ORR bigger than IT NEXUS LOSS which is 2000000us = 2 second.
2288c2ecf20Sopenharmony_ci  Assuming a bigger value 3 second, 3000000/128 = 23437.5 where 128
2298c2ecf20Sopenharmony_ci  is DOPNRJT_RTRY_TMO
2308c2ecf20Sopenharmony_ci*/
2318c2ecf20Sopenharmony_ci#define SAS_DOPNRJT_RTRY_THR            23438
2328c2ecf20Sopenharmony_ci#define SAS_COPNRJT_RTRY_THR            23438
2338c2ecf20Sopenharmony_ci#define SAS_MAX_AIP                     0x200000
2348c2ecf20Sopenharmony_ci#define IT_NEXUS_TIMEOUT       0x7D0
2358c2ecf20Sopenharmony_ci#define PORT_RECOVERY_TIMEOUT  ((IT_NEXUS_TIMEOUT/100) + 30)
2368c2ecf20Sopenharmony_ci/* Port recovery timeout, 10000 ms for PM8006 controller */
2378c2ecf20Sopenharmony_ci#define CHIP_8006_PORT_RECOVERY_TIMEOUT 0x640000
2388c2ecf20Sopenharmony_ci
2398c2ecf20Sopenharmony_ci#ifdef __LITTLE_ENDIAN_BITFIELD
2408c2ecf20Sopenharmony_cistruct sas_identify_frame_local {
2418c2ecf20Sopenharmony_ci	/* Byte 0 */
2428c2ecf20Sopenharmony_ci	u8  frame_type:4;
2438c2ecf20Sopenharmony_ci	u8  dev_type:3;
2448c2ecf20Sopenharmony_ci	u8  _un0:1;
2458c2ecf20Sopenharmony_ci
2468c2ecf20Sopenharmony_ci	/* Byte 1 */
2478c2ecf20Sopenharmony_ci	u8  _un1;
2488c2ecf20Sopenharmony_ci
2498c2ecf20Sopenharmony_ci	/* Byte 2 */
2508c2ecf20Sopenharmony_ci	union {
2518c2ecf20Sopenharmony_ci		struct {
2528c2ecf20Sopenharmony_ci			u8  _un20:1;
2538c2ecf20Sopenharmony_ci			u8  smp_iport:1;
2548c2ecf20Sopenharmony_ci			u8  stp_iport:1;
2558c2ecf20Sopenharmony_ci			u8  ssp_iport:1;
2568c2ecf20Sopenharmony_ci			u8  _un247:4;
2578c2ecf20Sopenharmony_ci		};
2588c2ecf20Sopenharmony_ci		u8 initiator_bits;
2598c2ecf20Sopenharmony_ci	};
2608c2ecf20Sopenharmony_ci
2618c2ecf20Sopenharmony_ci	/* Byte 3 */
2628c2ecf20Sopenharmony_ci	union {
2638c2ecf20Sopenharmony_ci		struct {
2648c2ecf20Sopenharmony_ci			u8  _un30:1;
2658c2ecf20Sopenharmony_ci			u8 smp_tport:1;
2668c2ecf20Sopenharmony_ci			u8 stp_tport:1;
2678c2ecf20Sopenharmony_ci			u8 ssp_tport:1;
2688c2ecf20Sopenharmony_ci			u8 _un347:4;
2698c2ecf20Sopenharmony_ci		};
2708c2ecf20Sopenharmony_ci		u8 target_bits;
2718c2ecf20Sopenharmony_ci	};
2728c2ecf20Sopenharmony_ci
2738c2ecf20Sopenharmony_ci	/* Byte 4 - 11 */
2748c2ecf20Sopenharmony_ci	u8 _un4_11[8];
2758c2ecf20Sopenharmony_ci
2768c2ecf20Sopenharmony_ci	/* Byte 12 - 19 */
2778c2ecf20Sopenharmony_ci	u8 sas_addr[SAS_ADDR_SIZE];
2788c2ecf20Sopenharmony_ci
2798c2ecf20Sopenharmony_ci	/* Byte 20 */
2808c2ecf20Sopenharmony_ci	u8 phy_id;
2818c2ecf20Sopenharmony_ci
2828c2ecf20Sopenharmony_ci	u8 _un21_27[7];
2838c2ecf20Sopenharmony_ci
2848c2ecf20Sopenharmony_ci} __packed;
2858c2ecf20Sopenharmony_ci
2868c2ecf20Sopenharmony_ci#elif defined(__BIG_ENDIAN_BITFIELD)
2878c2ecf20Sopenharmony_cistruct sas_identify_frame_local {
2888c2ecf20Sopenharmony_ci	/* Byte 0 */
2898c2ecf20Sopenharmony_ci	u8  _un0:1;
2908c2ecf20Sopenharmony_ci	u8  dev_type:3;
2918c2ecf20Sopenharmony_ci	u8  frame_type:4;
2928c2ecf20Sopenharmony_ci
2938c2ecf20Sopenharmony_ci	/* Byte 1 */
2948c2ecf20Sopenharmony_ci	u8  _un1;
2958c2ecf20Sopenharmony_ci
2968c2ecf20Sopenharmony_ci	/* Byte 2 */
2978c2ecf20Sopenharmony_ci	union {
2988c2ecf20Sopenharmony_ci		struct {
2998c2ecf20Sopenharmony_ci			u8  _un247:4;
3008c2ecf20Sopenharmony_ci			u8  ssp_iport:1;
3018c2ecf20Sopenharmony_ci			u8  stp_iport:1;
3028c2ecf20Sopenharmony_ci			u8  smp_iport:1;
3038c2ecf20Sopenharmony_ci			u8  _un20:1;
3048c2ecf20Sopenharmony_ci		};
3058c2ecf20Sopenharmony_ci		u8 initiator_bits;
3068c2ecf20Sopenharmony_ci	};
3078c2ecf20Sopenharmony_ci
3088c2ecf20Sopenharmony_ci	/* Byte 3 */
3098c2ecf20Sopenharmony_ci	union {
3108c2ecf20Sopenharmony_ci		struct {
3118c2ecf20Sopenharmony_ci			u8 _un347:4;
3128c2ecf20Sopenharmony_ci			u8 ssp_tport:1;
3138c2ecf20Sopenharmony_ci			u8 stp_tport:1;
3148c2ecf20Sopenharmony_ci			u8 smp_tport:1;
3158c2ecf20Sopenharmony_ci			u8 _un30:1;
3168c2ecf20Sopenharmony_ci		};
3178c2ecf20Sopenharmony_ci		u8 target_bits;
3188c2ecf20Sopenharmony_ci	};
3198c2ecf20Sopenharmony_ci
3208c2ecf20Sopenharmony_ci	/* Byte 4 - 11 */
3218c2ecf20Sopenharmony_ci	u8 _un4_11[8];
3228c2ecf20Sopenharmony_ci
3238c2ecf20Sopenharmony_ci	/* Byte 12 - 19 */
3248c2ecf20Sopenharmony_ci	u8 sas_addr[SAS_ADDR_SIZE];
3258c2ecf20Sopenharmony_ci
3268c2ecf20Sopenharmony_ci	/* Byte 20 */
3278c2ecf20Sopenharmony_ci	u8 phy_id;
3288c2ecf20Sopenharmony_ci
3298c2ecf20Sopenharmony_ci	u8 _un21_27[7];
3308c2ecf20Sopenharmony_ci} __packed;
3318c2ecf20Sopenharmony_ci#else
3328c2ecf20Sopenharmony_ci#error "Bitfield order not defined!"
3338c2ecf20Sopenharmony_ci#endif
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_cistruct mpi_msg_hdr {
3368c2ecf20Sopenharmony_ci	__le32	header;	/* Bits [11:0] - Message operation code */
3378c2ecf20Sopenharmony_ci	/* Bits [15:12] - Message Category */
3388c2ecf20Sopenharmony_ci	/* Bits [21:16] - Outboundqueue ID for the
3398c2ecf20Sopenharmony_ci	operation completion message */
3408c2ecf20Sopenharmony_ci	/* Bits [23:22] - Reserved */
3418c2ecf20Sopenharmony_ci	/* Bits [28:24] - Buffer Count, indicates how
3428c2ecf20Sopenharmony_ci	many buffer are allocated for the massage */
3438c2ecf20Sopenharmony_ci	/* Bits [30:29] - Reserved */
3448c2ecf20Sopenharmony_ci	/* Bits [31] - Message Valid bit */
3458c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
3468c2ecf20Sopenharmony_ci
3478c2ecf20Sopenharmony_ci/*
3488c2ecf20Sopenharmony_ci * brief the data structure of PHY Start Command
3498c2ecf20Sopenharmony_ci * use to describe enable the phy (128 bytes)
3508c2ecf20Sopenharmony_ci */
3518c2ecf20Sopenharmony_cistruct phy_start_req {
3528c2ecf20Sopenharmony_ci	__le32	tag;
3538c2ecf20Sopenharmony_ci	__le32	ase_sh_lm_slr_phyid;
3548c2ecf20Sopenharmony_ci	struct sas_identify_frame_local sas_identify; /* 28 Bytes */
3558c2ecf20Sopenharmony_ci	__le32 spasti;
3568c2ecf20Sopenharmony_ci	u32	reserved[21];
3578c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
3588c2ecf20Sopenharmony_ci
3598c2ecf20Sopenharmony_ci/*
3608c2ecf20Sopenharmony_ci * brief the data structure of PHY Start Command
3618c2ecf20Sopenharmony_ci * use to disable the phy (128 bytes)
3628c2ecf20Sopenharmony_ci */
3638c2ecf20Sopenharmony_cistruct phy_stop_req {
3648c2ecf20Sopenharmony_ci	__le32	tag;
3658c2ecf20Sopenharmony_ci	__le32	phy_id;
3668c2ecf20Sopenharmony_ci	u32	reserved[29];
3678c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
3688c2ecf20Sopenharmony_ci
3698c2ecf20Sopenharmony_ci/* set device bits fis - device to host */
3708c2ecf20Sopenharmony_cistruct set_dev_bits_fis {
3718c2ecf20Sopenharmony_ci	u8	fis_type;	/* 0xA1*/
3728c2ecf20Sopenharmony_ci	u8	n_i_pmport;
3738c2ecf20Sopenharmony_ci	/* b7 : n Bit. Notification bit. If set device needs attention. */
3748c2ecf20Sopenharmony_ci	/* b6 : i Bit. Interrupt Bit */
3758c2ecf20Sopenharmony_ci	/* b5-b4: reserved2 */
3768c2ecf20Sopenharmony_ci	/* b3-b0: PM Port */
3778c2ecf20Sopenharmony_ci	u8	status;
3788c2ecf20Sopenharmony_ci	u8	error;
3798c2ecf20Sopenharmony_ci	u32	_r_a;
3808c2ecf20Sopenharmony_ci} __attribute__ ((packed));
3818c2ecf20Sopenharmony_ci/* PIO setup FIS - device to host */
3828c2ecf20Sopenharmony_cistruct pio_setup_fis {
3838c2ecf20Sopenharmony_ci	u8	fis_type;	/* 0x5f */
3848c2ecf20Sopenharmony_ci	u8	i_d_pmPort;
3858c2ecf20Sopenharmony_ci	/* b7 : reserved */
3868c2ecf20Sopenharmony_ci	/* b6 : i bit. Interrupt bit */
3878c2ecf20Sopenharmony_ci	/* b5 : d bit. data transfer direction. set to 1 for device to host
3888c2ecf20Sopenharmony_ci	xfer */
3898c2ecf20Sopenharmony_ci	/* b4 : reserved */
3908c2ecf20Sopenharmony_ci	/* b3-b0: PM Port */
3918c2ecf20Sopenharmony_ci	u8	status;
3928c2ecf20Sopenharmony_ci	u8	error;
3938c2ecf20Sopenharmony_ci	u8	lbal;
3948c2ecf20Sopenharmony_ci	u8	lbam;
3958c2ecf20Sopenharmony_ci	u8	lbah;
3968c2ecf20Sopenharmony_ci	u8	device;
3978c2ecf20Sopenharmony_ci	u8	lbal_exp;
3988c2ecf20Sopenharmony_ci	u8	lbam_exp;
3998c2ecf20Sopenharmony_ci	u8	lbah_exp;
4008c2ecf20Sopenharmony_ci	u8	_r_a;
4018c2ecf20Sopenharmony_ci	u8	sector_count;
4028c2ecf20Sopenharmony_ci	u8	sector_count_exp;
4038c2ecf20Sopenharmony_ci	u8	_r_b;
4048c2ecf20Sopenharmony_ci	u8	e_status;
4058c2ecf20Sopenharmony_ci	u8	_r_c[2];
4068c2ecf20Sopenharmony_ci	u8	transfer_count;
4078c2ecf20Sopenharmony_ci} __attribute__ ((packed));
4088c2ecf20Sopenharmony_ci
4098c2ecf20Sopenharmony_ci/*
4108c2ecf20Sopenharmony_ci * brief the data structure of SATA Completion Response
4118c2ecf20Sopenharmony_ci * use to describe the sata task response (64 bytes)
4128c2ecf20Sopenharmony_ci */
4138c2ecf20Sopenharmony_cistruct sata_completion_resp {
4148c2ecf20Sopenharmony_ci	__le32	tag;
4158c2ecf20Sopenharmony_ci	__le32	status;
4168c2ecf20Sopenharmony_ci	__le32	param;
4178c2ecf20Sopenharmony_ci	u32	sata_resp[12];
4188c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
4198c2ecf20Sopenharmony_ci
4208c2ecf20Sopenharmony_ci/*
4218c2ecf20Sopenharmony_ci * brief the data structure of SAS HW Event Notification
4228c2ecf20Sopenharmony_ci * use to alert the host about the hardware event(64 bytes)
4238c2ecf20Sopenharmony_ci */
4248c2ecf20Sopenharmony_ci/* updated outbound struct for spcv */
4258c2ecf20Sopenharmony_ci
4268c2ecf20Sopenharmony_cistruct hw_event_resp {
4278c2ecf20Sopenharmony_ci	__le32	lr_status_evt_portid;
4288c2ecf20Sopenharmony_ci	__le32	evt_param;
4298c2ecf20Sopenharmony_ci	__le32	phyid_npip_portstate;
4308c2ecf20Sopenharmony_ci	struct sas_identify_frame	sas_identify;
4318c2ecf20Sopenharmony_ci	struct dev_to_host_fis	sata_fis;
4328c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
4338c2ecf20Sopenharmony_ci
4348c2ecf20Sopenharmony_ci/*
4358c2ecf20Sopenharmony_ci * brief the data structure for thermal event notification
4368c2ecf20Sopenharmony_ci */
4378c2ecf20Sopenharmony_ci
4388c2ecf20Sopenharmony_cistruct thermal_hw_event {
4398c2ecf20Sopenharmony_ci	__le32	thermal_event;
4408c2ecf20Sopenharmony_ci	__le32	rht_lht;
4418c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
4428c2ecf20Sopenharmony_ci
4438c2ecf20Sopenharmony_ci/*
4448c2ecf20Sopenharmony_ci * brief the data structure of REGISTER DEVICE Command
4458c2ecf20Sopenharmony_ci * use to describe MPI REGISTER DEVICE Command (64 bytes)
4468c2ecf20Sopenharmony_ci */
4478c2ecf20Sopenharmony_ci
4488c2ecf20Sopenharmony_cistruct reg_dev_req {
4498c2ecf20Sopenharmony_ci	__le32	tag;
4508c2ecf20Sopenharmony_ci	__le32	phyid_portid;
4518c2ecf20Sopenharmony_ci	__le32	dtype_dlr_mcn_ir_retry;
4528c2ecf20Sopenharmony_ci	__le32	firstburstsize_ITNexustimeout;
4538c2ecf20Sopenharmony_ci	u8	sas_addr[SAS_ADDR_SIZE];
4548c2ecf20Sopenharmony_ci	__le32	upper_device_id;
4558c2ecf20Sopenharmony_ci	u32	reserved[24];
4568c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
4578c2ecf20Sopenharmony_ci
4588c2ecf20Sopenharmony_ci/*
4598c2ecf20Sopenharmony_ci * brief the data structure of DEREGISTER DEVICE Command
4608c2ecf20Sopenharmony_ci * use to request spc to remove all internal resources associated
4618c2ecf20Sopenharmony_ci * with the device id (64 bytes)
4628c2ecf20Sopenharmony_ci */
4638c2ecf20Sopenharmony_ci
4648c2ecf20Sopenharmony_cistruct dereg_dev_req {
4658c2ecf20Sopenharmony_ci	__le32	tag;
4668c2ecf20Sopenharmony_ci	__le32	device_id;
4678c2ecf20Sopenharmony_ci	u32	reserved[29];
4688c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
4698c2ecf20Sopenharmony_ci
4708c2ecf20Sopenharmony_ci/*
4718c2ecf20Sopenharmony_ci * brief the data structure of DEVICE_REGISTRATION Response
4728c2ecf20Sopenharmony_ci * use to notify the completion of the device registration (64 bytes)
4738c2ecf20Sopenharmony_ci */
4748c2ecf20Sopenharmony_cistruct dev_reg_resp {
4758c2ecf20Sopenharmony_ci	__le32	tag;
4768c2ecf20Sopenharmony_ci	__le32	status;
4778c2ecf20Sopenharmony_ci	__le32	device_id;
4788c2ecf20Sopenharmony_ci	u32	reserved[12];
4798c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
4808c2ecf20Sopenharmony_ci
4818c2ecf20Sopenharmony_ci/*
4828c2ecf20Sopenharmony_ci * brief the data structure of Local PHY Control Command
4838c2ecf20Sopenharmony_ci * use to issue PHY CONTROL to local phy (64 bytes)
4848c2ecf20Sopenharmony_ci */
4858c2ecf20Sopenharmony_cistruct local_phy_ctl_req {
4868c2ecf20Sopenharmony_ci	__le32	tag;
4878c2ecf20Sopenharmony_ci	__le32	phyop_phyid;
4888c2ecf20Sopenharmony_ci	u32	reserved1[29];
4898c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
4908c2ecf20Sopenharmony_ci
4918c2ecf20Sopenharmony_ci/**
4928c2ecf20Sopenharmony_ci * brief the data structure of Local Phy Control Response
4938c2ecf20Sopenharmony_ci * use to describe MPI Local Phy Control Response (64 bytes)
4948c2ecf20Sopenharmony_ci */
4958c2ecf20Sopenharmony_ci struct local_phy_ctl_resp {
4968c2ecf20Sopenharmony_ci	__le32	tag;
4978c2ecf20Sopenharmony_ci	__le32	phyop_phyid;
4988c2ecf20Sopenharmony_ci	__le32	status;
4998c2ecf20Sopenharmony_ci	u32	reserved[12];
5008c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
5018c2ecf20Sopenharmony_ci
5028c2ecf20Sopenharmony_ci#define OP_BITS 0x0000FF00
5038c2ecf20Sopenharmony_ci#define ID_BITS 0x000000FF
5048c2ecf20Sopenharmony_ci
5058c2ecf20Sopenharmony_ci/*
5068c2ecf20Sopenharmony_ci * brief the data structure of PORT Control Command
5078c2ecf20Sopenharmony_ci * use to control port properties (64 bytes)
5088c2ecf20Sopenharmony_ci */
5098c2ecf20Sopenharmony_ci
5108c2ecf20Sopenharmony_cistruct port_ctl_req {
5118c2ecf20Sopenharmony_ci	__le32	tag;
5128c2ecf20Sopenharmony_ci	__le32	portop_portid;
5138c2ecf20Sopenharmony_ci	__le32	param0;
5148c2ecf20Sopenharmony_ci	__le32	param1;
5158c2ecf20Sopenharmony_ci	u32	reserved1[27];
5168c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
5178c2ecf20Sopenharmony_ci
5188c2ecf20Sopenharmony_ci/*
5198c2ecf20Sopenharmony_ci * brief the data structure of HW Event Ack Command
5208c2ecf20Sopenharmony_ci * use to acknowledge receive HW event (64 bytes)
5218c2ecf20Sopenharmony_ci */
5228c2ecf20Sopenharmony_cistruct hw_event_ack_req {
5238c2ecf20Sopenharmony_ci	__le32	tag;
5248c2ecf20Sopenharmony_ci	__le32	phyid_sea_portid;
5258c2ecf20Sopenharmony_ci	__le32	param0;
5268c2ecf20Sopenharmony_ci	__le32	param1;
5278c2ecf20Sopenharmony_ci	u32	reserved1[27];
5288c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
5298c2ecf20Sopenharmony_ci
5308c2ecf20Sopenharmony_ci/*
5318c2ecf20Sopenharmony_ci * brief the data structure of PHY_START Response Command
5328c2ecf20Sopenharmony_ci * indicates the completion of PHY_START command (64 bytes)
5338c2ecf20Sopenharmony_ci */
5348c2ecf20Sopenharmony_cistruct phy_start_resp {
5358c2ecf20Sopenharmony_ci	__le32	tag;
5368c2ecf20Sopenharmony_ci	__le32	status;
5378c2ecf20Sopenharmony_ci	__le32	phyid;
5388c2ecf20Sopenharmony_ci	u32	reserved[12];
5398c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
5408c2ecf20Sopenharmony_ci
5418c2ecf20Sopenharmony_ci/*
5428c2ecf20Sopenharmony_ci * brief the data structure of PHY_STOP Response Command
5438c2ecf20Sopenharmony_ci * indicates the completion of PHY_STOP command (64 bytes)
5448c2ecf20Sopenharmony_ci */
5458c2ecf20Sopenharmony_cistruct phy_stop_resp {
5468c2ecf20Sopenharmony_ci	__le32	tag;
5478c2ecf20Sopenharmony_ci	__le32	status;
5488c2ecf20Sopenharmony_ci	__le32	phyid;
5498c2ecf20Sopenharmony_ci	u32	reserved[12];
5508c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
5518c2ecf20Sopenharmony_ci
5528c2ecf20Sopenharmony_ci/*
5538c2ecf20Sopenharmony_ci * brief the data structure of SSP Completion Response
5548c2ecf20Sopenharmony_ci * use to indicate a SSP Completion (n bytes)
5558c2ecf20Sopenharmony_ci */
5568c2ecf20Sopenharmony_cistruct ssp_completion_resp {
5578c2ecf20Sopenharmony_ci	__le32	tag;
5588c2ecf20Sopenharmony_ci	__le32	status;
5598c2ecf20Sopenharmony_ci	__le32	param;
5608c2ecf20Sopenharmony_ci	__le32	ssptag_rescv_rescpad;
5618c2ecf20Sopenharmony_ci	struct ssp_response_iu ssp_resp_iu;
5628c2ecf20Sopenharmony_ci	__le32	residual_count;
5638c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
5648c2ecf20Sopenharmony_ci
5658c2ecf20Sopenharmony_ci#define SSP_RESCV_BIT	0x00010000
5668c2ecf20Sopenharmony_ci
5678c2ecf20Sopenharmony_ci/*
5688c2ecf20Sopenharmony_ci * brief the data structure of SATA EVNET response
5698c2ecf20Sopenharmony_ci * use to indicate a SATA Completion (64 bytes)
5708c2ecf20Sopenharmony_ci */
5718c2ecf20Sopenharmony_cistruct sata_event_resp {
5728c2ecf20Sopenharmony_ci	__le32 tag;
5738c2ecf20Sopenharmony_ci	__le32 event;
5748c2ecf20Sopenharmony_ci	__le32 port_id;
5758c2ecf20Sopenharmony_ci	__le32 device_id;
5768c2ecf20Sopenharmony_ci	u32 reserved;
5778c2ecf20Sopenharmony_ci	__le32 event_param0;
5788c2ecf20Sopenharmony_ci	__le32 event_param1;
5798c2ecf20Sopenharmony_ci	__le32 sata_addr_h32;
5808c2ecf20Sopenharmony_ci	__le32 sata_addr_l32;
5818c2ecf20Sopenharmony_ci	__le32 e_udt1_udt0_crc;
5828c2ecf20Sopenharmony_ci	__le32 e_udt5_udt4_udt3_udt2;
5838c2ecf20Sopenharmony_ci	__le32 a_udt1_udt0_crc;
5848c2ecf20Sopenharmony_ci	__le32 a_udt5_udt4_udt3_udt2;
5858c2ecf20Sopenharmony_ci	__le32 hwdevid_diferr;
5868c2ecf20Sopenharmony_ci	__le32 err_framelen_byteoffset;
5878c2ecf20Sopenharmony_ci	__le32 err_dataframe;
5888c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
5898c2ecf20Sopenharmony_ci
5908c2ecf20Sopenharmony_ci/*
5918c2ecf20Sopenharmony_ci * brief the data structure of SSP EVNET esponse
5928c2ecf20Sopenharmony_ci * use to indicate a SSP Completion (64 bytes)
5938c2ecf20Sopenharmony_ci */
5948c2ecf20Sopenharmony_cistruct ssp_event_resp {
5958c2ecf20Sopenharmony_ci	__le32 tag;
5968c2ecf20Sopenharmony_ci	__le32 event;
5978c2ecf20Sopenharmony_ci	__le32 port_id;
5988c2ecf20Sopenharmony_ci	__le32 device_id;
5998c2ecf20Sopenharmony_ci	__le32 ssp_tag;
6008c2ecf20Sopenharmony_ci	__le32 event_param0;
6018c2ecf20Sopenharmony_ci	__le32 event_param1;
6028c2ecf20Sopenharmony_ci	__le32 sas_addr_h32;
6038c2ecf20Sopenharmony_ci	__le32 sas_addr_l32;
6048c2ecf20Sopenharmony_ci	__le32 e_udt1_udt0_crc;
6058c2ecf20Sopenharmony_ci	__le32 e_udt5_udt4_udt3_udt2;
6068c2ecf20Sopenharmony_ci	__le32 a_udt1_udt0_crc;
6078c2ecf20Sopenharmony_ci	__le32 a_udt5_udt4_udt3_udt2;
6088c2ecf20Sopenharmony_ci	__le32 hwdevid_diferr;
6098c2ecf20Sopenharmony_ci	__le32 err_framelen_byteoffset;
6108c2ecf20Sopenharmony_ci	__le32 err_dataframe;
6118c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
6128c2ecf20Sopenharmony_ci
6138c2ecf20Sopenharmony_ci/**
6148c2ecf20Sopenharmony_ci * brief the data structure of General Event Notification Response
6158c2ecf20Sopenharmony_ci * use to describe MPI General Event Notification Response (64 bytes)
6168c2ecf20Sopenharmony_ci */
6178c2ecf20Sopenharmony_cistruct general_event_resp {
6188c2ecf20Sopenharmony_ci	__le32	status;
6198c2ecf20Sopenharmony_ci	__le32	inb_IOMB_payload[14];
6208c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
6218c2ecf20Sopenharmony_ci
6228c2ecf20Sopenharmony_ci#define GENERAL_EVENT_PAYLOAD	14
6238c2ecf20Sopenharmony_ci#define OPCODE_BITS	0x00000fff
6248c2ecf20Sopenharmony_ci
6258c2ecf20Sopenharmony_ci/*
6268c2ecf20Sopenharmony_ci * brief the data structure of SMP Request Command
6278c2ecf20Sopenharmony_ci * use to describe MPI SMP REQUEST Command (64 bytes)
6288c2ecf20Sopenharmony_ci */
6298c2ecf20Sopenharmony_cistruct smp_req {
6308c2ecf20Sopenharmony_ci	__le32	tag;
6318c2ecf20Sopenharmony_ci	__le32	device_id;
6328c2ecf20Sopenharmony_ci	__le32	len_ip_ir;
6338c2ecf20Sopenharmony_ci	/* Bits [0] - Indirect response */
6348c2ecf20Sopenharmony_ci	/* Bits [1] - Indirect Payload */
6358c2ecf20Sopenharmony_ci	/* Bits [15:2] - Reserved */
6368c2ecf20Sopenharmony_ci	/* Bits [23:16] - direct payload Len */
6378c2ecf20Sopenharmony_ci	/* Bits [31:24] - Reserved */
6388c2ecf20Sopenharmony_ci	u8	smp_req16[16];
6398c2ecf20Sopenharmony_ci	union {
6408c2ecf20Sopenharmony_ci		u8	smp_req[32];
6418c2ecf20Sopenharmony_ci		struct {
6428c2ecf20Sopenharmony_ci			__le64 long_req_addr;/* sg dma address, LE */
6438c2ecf20Sopenharmony_ci			__le32 long_req_size;/* LE */
6448c2ecf20Sopenharmony_ci			u32	_r_a;
6458c2ecf20Sopenharmony_ci			__le64 long_resp_addr;/* sg dma address, LE */
6468c2ecf20Sopenharmony_ci			__le32 long_resp_size;/* LE */
6478c2ecf20Sopenharmony_ci			u32	_r_b;
6488c2ecf20Sopenharmony_ci			} long_smp_req;/* sequencer extension */
6498c2ecf20Sopenharmony_ci	};
6508c2ecf20Sopenharmony_ci	__le32	rsvd[16];
6518c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
6528c2ecf20Sopenharmony_ci/*
6538c2ecf20Sopenharmony_ci * brief the data structure of SMP Completion Response
6548c2ecf20Sopenharmony_ci * use to describe MPI SMP Completion Response (64 bytes)
6558c2ecf20Sopenharmony_ci */
6568c2ecf20Sopenharmony_cistruct smp_completion_resp {
6578c2ecf20Sopenharmony_ci	__le32	tag;
6588c2ecf20Sopenharmony_ci	__le32	status;
6598c2ecf20Sopenharmony_ci	__le32	param;
6608c2ecf20Sopenharmony_ci	u8	_r_a[252];
6618c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
6628c2ecf20Sopenharmony_ci
6638c2ecf20Sopenharmony_ci/*
6648c2ecf20Sopenharmony_ci *brief the data structure of SSP SMP SATA Abort Command
6658c2ecf20Sopenharmony_ci * use to describe MPI SSP SMP & SATA Abort Command (64 bytes)
6668c2ecf20Sopenharmony_ci */
6678c2ecf20Sopenharmony_cistruct task_abort_req {
6688c2ecf20Sopenharmony_ci	__le32	tag;
6698c2ecf20Sopenharmony_ci	__le32	device_id;
6708c2ecf20Sopenharmony_ci	__le32	tag_to_abort;
6718c2ecf20Sopenharmony_ci	__le32	abort_all;
6728c2ecf20Sopenharmony_ci	u32	reserved[27];
6738c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
6748c2ecf20Sopenharmony_ci
6758c2ecf20Sopenharmony_ci/* These flags used for SSP SMP & SATA Abort */
6768c2ecf20Sopenharmony_ci#define ABORT_MASK		0x3
6778c2ecf20Sopenharmony_ci#define ABORT_SINGLE		0x0
6788c2ecf20Sopenharmony_ci#define ABORT_ALL		0x1
6798c2ecf20Sopenharmony_ci
6808c2ecf20Sopenharmony_ci/**
6818c2ecf20Sopenharmony_ci * brief the data structure of SSP SATA SMP Abort Response
6828c2ecf20Sopenharmony_ci * use to describe SSP SMP & SATA Abort Response ( 64 bytes)
6838c2ecf20Sopenharmony_ci */
6848c2ecf20Sopenharmony_cistruct task_abort_resp {
6858c2ecf20Sopenharmony_ci	__le32	tag;
6868c2ecf20Sopenharmony_ci	__le32	status;
6878c2ecf20Sopenharmony_ci	__le32	scp;
6888c2ecf20Sopenharmony_ci	u32	reserved[12];
6898c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
6908c2ecf20Sopenharmony_ci
6918c2ecf20Sopenharmony_ci/**
6928c2ecf20Sopenharmony_ci * brief the data structure of SAS Diagnostic Start/End Command
6938c2ecf20Sopenharmony_ci * use to describe MPI SAS Diagnostic Start/End Command (64 bytes)
6948c2ecf20Sopenharmony_ci */
6958c2ecf20Sopenharmony_cistruct sas_diag_start_end_req {
6968c2ecf20Sopenharmony_ci	__le32	tag;
6978c2ecf20Sopenharmony_ci	__le32	operation_phyid;
6988c2ecf20Sopenharmony_ci	u32	reserved[29];
6998c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
7008c2ecf20Sopenharmony_ci
7018c2ecf20Sopenharmony_ci/**
7028c2ecf20Sopenharmony_ci * brief the data structure of SAS Diagnostic Execute Command
7038c2ecf20Sopenharmony_ci * use to describe MPI SAS Diagnostic Execute Command (64 bytes)
7048c2ecf20Sopenharmony_ci */
7058c2ecf20Sopenharmony_cistruct sas_diag_execute_req {
7068c2ecf20Sopenharmony_ci	__le32	tag;
7078c2ecf20Sopenharmony_ci	__le32	cmdtype_cmddesc_phyid;
7088c2ecf20Sopenharmony_ci	__le32	pat1_pat2;
7098c2ecf20Sopenharmony_ci	__le32	threshold;
7108c2ecf20Sopenharmony_ci	__le32	codepat_errmsk;
7118c2ecf20Sopenharmony_ci	__le32	pmon;
7128c2ecf20Sopenharmony_ci	__le32	pERF1CTL;
7138c2ecf20Sopenharmony_ci	u32	reserved[24];
7148c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
7158c2ecf20Sopenharmony_ci
7168c2ecf20Sopenharmony_ci#define SAS_DIAG_PARAM_BYTES 24
7178c2ecf20Sopenharmony_ci
7188c2ecf20Sopenharmony_ci/*
7198c2ecf20Sopenharmony_ci * brief the data structure of Set Device State Command
7208c2ecf20Sopenharmony_ci * use to describe MPI Set Device State Command (64 bytes)
7218c2ecf20Sopenharmony_ci */
7228c2ecf20Sopenharmony_cistruct set_dev_state_req {
7238c2ecf20Sopenharmony_ci	__le32	tag;
7248c2ecf20Sopenharmony_ci	__le32	device_id;
7258c2ecf20Sopenharmony_ci	__le32	nds;
7268c2ecf20Sopenharmony_ci	u32	reserved[28];
7278c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
7288c2ecf20Sopenharmony_ci
7298c2ecf20Sopenharmony_ci/*
7308c2ecf20Sopenharmony_ci * brief the data structure of SATA Start Command
7318c2ecf20Sopenharmony_ci * use to describe MPI SATA IO Start Command (64 bytes)
7328c2ecf20Sopenharmony_ci * Note: This structure is common for normal / encryption I/O
7338c2ecf20Sopenharmony_ci */
7348c2ecf20Sopenharmony_ci
7358c2ecf20Sopenharmony_cistruct sata_start_req {
7368c2ecf20Sopenharmony_ci	__le32	tag;
7378c2ecf20Sopenharmony_ci	__le32	device_id;
7388c2ecf20Sopenharmony_ci	__le32	data_len;
7398c2ecf20Sopenharmony_ci	__le32	ncqtag_atap_dir_m_dad;
7408c2ecf20Sopenharmony_ci	struct host_to_dev_fis	sata_fis;
7418c2ecf20Sopenharmony_ci	u32	reserved1;
7428c2ecf20Sopenharmony_ci	u32	reserved2;	/* dword 11. rsvd for normal I/O. */
7438c2ecf20Sopenharmony_ci				/* EPLE Descl for enc I/O */
7448c2ecf20Sopenharmony_ci	u32	addr_low;	/* dword 12. rsvd for enc I/O */
7458c2ecf20Sopenharmony_ci	u32	addr_high;	/* dword 13. reserved for enc I/O */
7468c2ecf20Sopenharmony_ci	__le32	len;		/* dword 14: length for normal I/O. */
7478c2ecf20Sopenharmony_ci				/* EPLE Desch for enc I/O */
7488c2ecf20Sopenharmony_ci	__le32	esgl;		/* dword 15. rsvd for enc I/O */
7498c2ecf20Sopenharmony_ci	__le32	atapi_scsi_cdb[4];	/* dword 16-19. rsvd for enc I/O */
7508c2ecf20Sopenharmony_ci	/* The below fields are reserved for normal I/O */
7518c2ecf20Sopenharmony_ci	__le32	key_index_mode;	/* dword 20 */
7528c2ecf20Sopenharmony_ci	__le32	sector_cnt_enss;/* dword 21 */
7538c2ecf20Sopenharmony_ci	__le32	keytagl;	/* dword 22 */
7548c2ecf20Sopenharmony_ci	__le32	keytagh;	/* dword 23 */
7558c2ecf20Sopenharmony_ci	__le32	twk_val0;	/* dword 24 */
7568c2ecf20Sopenharmony_ci	__le32	twk_val1;	/* dword 25 */
7578c2ecf20Sopenharmony_ci	__le32	twk_val2;	/* dword 26 */
7588c2ecf20Sopenharmony_ci	__le32	twk_val3;	/* dword 27 */
7598c2ecf20Sopenharmony_ci	__le32	enc_addr_low;	/* dword 28. Encryption SGL address high */
7608c2ecf20Sopenharmony_ci	__le32	enc_addr_high;	/* dword 29. Encryption SGL address low */
7618c2ecf20Sopenharmony_ci	__le32	enc_len;	/* dword 30. Encryption length */
7628c2ecf20Sopenharmony_ci	__le32	enc_esgl;	/* dword 31. Encryption esgl bit */
7638c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
7648c2ecf20Sopenharmony_ci
7658c2ecf20Sopenharmony_ci/**
7668c2ecf20Sopenharmony_ci * brief the data structure of SSP INI TM Start Command
7678c2ecf20Sopenharmony_ci * use to describe MPI SSP INI TM Start Command (64 bytes)
7688c2ecf20Sopenharmony_ci */
7698c2ecf20Sopenharmony_cistruct ssp_ini_tm_start_req {
7708c2ecf20Sopenharmony_ci	__le32	tag;
7718c2ecf20Sopenharmony_ci	__le32	device_id;
7728c2ecf20Sopenharmony_ci	__le32	relate_tag;
7738c2ecf20Sopenharmony_ci	__le32	tmf;
7748c2ecf20Sopenharmony_ci	u8	lun[8];
7758c2ecf20Sopenharmony_ci	__le32	ds_ads_m;
7768c2ecf20Sopenharmony_ci	u32	reserved[24];
7778c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
7788c2ecf20Sopenharmony_ci
7798c2ecf20Sopenharmony_cistruct ssp_info_unit {
7808c2ecf20Sopenharmony_ci	u8	lun[8];/* SCSI Logical Unit Number */
7818c2ecf20Sopenharmony_ci	u8	reserved1;/* reserved */
7828c2ecf20Sopenharmony_ci	u8	efb_prio_attr;
7838c2ecf20Sopenharmony_ci	/* B7 : enabledFirstBurst */
7848c2ecf20Sopenharmony_ci	/* B6-3 : taskPriority */
7858c2ecf20Sopenharmony_ci	/* B2-0 : taskAttribute */
7868c2ecf20Sopenharmony_ci	u8	reserved2;	/* reserved */
7878c2ecf20Sopenharmony_ci	u8	additional_cdb_len;
7888c2ecf20Sopenharmony_ci	/* B7-2 : additional_cdb_len */
7898c2ecf20Sopenharmony_ci	/* B1-0 : reserved */
7908c2ecf20Sopenharmony_ci	u8	cdb[16];/* The SCSI CDB up to 16 bytes length */
7918c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
7928c2ecf20Sopenharmony_ci
7938c2ecf20Sopenharmony_ci/**
7948c2ecf20Sopenharmony_ci * brief the data structure of SSP INI IO Start Command
7958c2ecf20Sopenharmony_ci * use to describe MPI SSP INI IO Start Command (64 bytes)
7968c2ecf20Sopenharmony_ci * Note: This structure is common for normal / encryption I/O
7978c2ecf20Sopenharmony_ci */
7988c2ecf20Sopenharmony_cistruct ssp_ini_io_start_req {
7998c2ecf20Sopenharmony_ci	__le32	tag;
8008c2ecf20Sopenharmony_ci	__le32	device_id;
8018c2ecf20Sopenharmony_ci	__le32	data_len;
8028c2ecf20Sopenharmony_ci	__le32	dad_dir_m_tlr;
8038c2ecf20Sopenharmony_ci	struct ssp_info_unit	ssp_iu;
8048c2ecf20Sopenharmony_ci	__le32	addr_low;	/* dword 12: sgl low for normal I/O. */
8058c2ecf20Sopenharmony_ci				/* epl_descl for encryption I/O */
8068c2ecf20Sopenharmony_ci	__le32	addr_high;	/* dword 13: sgl hi for normal I/O */
8078c2ecf20Sopenharmony_ci				/* dpl_descl for encryption I/O */
8088c2ecf20Sopenharmony_ci	__le32	len;		/* dword 14: len for normal I/O. */
8098c2ecf20Sopenharmony_ci				/* edpl_desch for encryption I/O */
8108c2ecf20Sopenharmony_ci	__le32	esgl;		/* dword 15: ESGL bit for normal I/O. */
8118c2ecf20Sopenharmony_ci				/* user defined tag mask for enc I/O */
8128c2ecf20Sopenharmony_ci	/* The below fields are reserved for normal I/O */
8138c2ecf20Sopenharmony_ci	u8	udt[12];	/* dword 16-18 */
8148c2ecf20Sopenharmony_ci	__le32	sectcnt_ios;	/* dword 19 */
8158c2ecf20Sopenharmony_ci	__le32	key_cmode;	/* dword 20 */
8168c2ecf20Sopenharmony_ci	__le32	ks_enss;	/* dword 21 */
8178c2ecf20Sopenharmony_ci	__le32	keytagl;	/* dword 22 */
8188c2ecf20Sopenharmony_ci	__le32	keytagh;	/* dword 23 */
8198c2ecf20Sopenharmony_ci	__le32	twk_val0;	/* dword 24 */
8208c2ecf20Sopenharmony_ci	__le32	twk_val1;	/* dword 25 */
8218c2ecf20Sopenharmony_ci	__le32	twk_val2;	/* dword 26 */
8228c2ecf20Sopenharmony_ci	__le32	twk_val3;	/* dword 27 */
8238c2ecf20Sopenharmony_ci	__le32	enc_addr_low;	/* dword 28: Encryption sgl addr low */
8248c2ecf20Sopenharmony_ci	__le32	enc_addr_high;	/* dword 29: Encryption sgl addr hi */
8258c2ecf20Sopenharmony_ci	__le32	enc_len;	/* dword 30: Encryption length */
8268c2ecf20Sopenharmony_ci	__le32	enc_esgl;	/* dword 31: ESGL bit for encryption */
8278c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
8288c2ecf20Sopenharmony_ci
8298c2ecf20Sopenharmony_ci/**
8308c2ecf20Sopenharmony_ci * brief the data structure for SSP_INI_DIF_ENC_IO COMMAND
8318c2ecf20Sopenharmony_ci * use to initiate SSP I/O operation with optional DIF/ENC
8328c2ecf20Sopenharmony_ci */
8338c2ecf20Sopenharmony_cistruct ssp_dif_enc_io_req {
8348c2ecf20Sopenharmony_ci	__le32	tag;
8358c2ecf20Sopenharmony_ci	__le32	device_id;
8368c2ecf20Sopenharmony_ci	__le32	data_len;
8378c2ecf20Sopenharmony_ci	__le32	dirMTlr;
8388c2ecf20Sopenharmony_ci	__le32	sspiu0;
8398c2ecf20Sopenharmony_ci	__le32	sspiu1;
8408c2ecf20Sopenharmony_ci	__le32	sspiu2;
8418c2ecf20Sopenharmony_ci	__le32	sspiu3;
8428c2ecf20Sopenharmony_ci	__le32	sspiu4;
8438c2ecf20Sopenharmony_ci	__le32	sspiu5;
8448c2ecf20Sopenharmony_ci	__le32	sspiu6;
8458c2ecf20Sopenharmony_ci	__le32	epl_des;
8468c2ecf20Sopenharmony_ci	__le32	dpl_desl_ndplr;
8478c2ecf20Sopenharmony_ci	__le32	dpl_desh;
8488c2ecf20Sopenharmony_ci	__le32	uum_uuv_bss_difbits;
8498c2ecf20Sopenharmony_ci	u8	udt[12];
8508c2ecf20Sopenharmony_ci	__le32	sectcnt_ios;
8518c2ecf20Sopenharmony_ci	__le32	key_cmode;
8528c2ecf20Sopenharmony_ci	__le32	ks_enss;
8538c2ecf20Sopenharmony_ci	__le32	keytagl;
8548c2ecf20Sopenharmony_ci	__le32	keytagh;
8558c2ecf20Sopenharmony_ci	__le32	twk_val0;
8568c2ecf20Sopenharmony_ci	__le32	twk_val1;
8578c2ecf20Sopenharmony_ci	__le32	twk_val2;
8588c2ecf20Sopenharmony_ci	__le32	twk_val3;
8598c2ecf20Sopenharmony_ci	__le32	addr_low;
8608c2ecf20Sopenharmony_ci	__le32	addr_high;
8618c2ecf20Sopenharmony_ci	__le32	len;
8628c2ecf20Sopenharmony_ci	__le32	esgl;
8638c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
8648c2ecf20Sopenharmony_ci
8658c2ecf20Sopenharmony_ci/**
8668c2ecf20Sopenharmony_ci * brief the data structure of Firmware download
8678c2ecf20Sopenharmony_ci * use to describe MPI FW DOWNLOAD Command (64 bytes)
8688c2ecf20Sopenharmony_ci */
8698c2ecf20Sopenharmony_cistruct fw_flash_Update_req {
8708c2ecf20Sopenharmony_ci	__le32	tag;
8718c2ecf20Sopenharmony_ci	__le32	cur_image_offset;
8728c2ecf20Sopenharmony_ci	__le32	cur_image_len;
8738c2ecf20Sopenharmony_ci	__le32	total_image_len;
8748c2ecf20Sopenharmony_ci	u32	reserved0[7];
8758c2ecf20Sopenharmony_ci	__le32	sgl_addr_lo;
8768c2ecf20Sopenharmony_ci	__le32	sgl_addr_hi;
8778c2ecf20Sopenharmony_ci	__le32	len;
8788c2ecf20Sopenharmony_ci	__le32	ext_reserved;
8798c2ecf20Sopenharmony_ci	u32	reserved1[16];
8808c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
8818c2ecf20Sopenharmony_ci
8828c2ecf20Sopenharmony_ci#define FWFLASH_IOMB_RESERVED_LEN 0x07
8838c2ecf20Sopenharmony_ci/**
8848c2ecf20Sopenharmony_ci * brief the data structure of FW_FLASH_UPDATE Response
8858c2ecf20Sopenharmony_ci * use to describe MPI FW_FLASH_UPDATE Response (64 bytes)
8868c2ecf20Sopenharmony_ci *
8878c2ecf20Sopenharmony_ci */
8888c2ecf20Sopenharmony_ci struct fw_flash_Update_resp {
8898c2ecf20Sopenharmony_ci	__le32	tag;
8908c2ecf20Sopenharmony_ci	__le32	status;
8918c2ecf20Sopenharmony_ci	u32	reserved[13];
8928c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
8938c2ecf20Sopenharmony_ci
8948c2ecf20Sopenharmony_ci/**
8958c2ecf20Sopenharmony_ci * brief the data structure of Get NVM Data Command
8968c2ecf20Sopenharmony_ci * use to get data from NVM in HBA(64 bytes)
8978c2ecf20Sopenharmony_ci */
8988c2ecf20Sopenharmony_cistruct get_nvm_data_req {
8998c2ecf20Sopenharmony_ci	__le32	tag;
9008c2ecf20Sopenharmony_ci	__le32	len_ir_vpdd;
9018c2ecf20Sopenharmony_ci	__le32	vpd_offset;
9028c2ecf20Sopenharmony_ci	u32	reserved[8];
9038c2ecf20Sopenharmony_ci	__le32	resp_addr_lo;
9048c2ecf20Sopenharmony_ci	__le32	resp_addr_hi;
9058c2ecf20Sopenharmony_ci	__le32	resp_len;
9068c2ecf20Sopenharmony_ci	u32	reserved1[17];
9078c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
9088c2ecf20Sopenharmony_ci
9098c2ecf20Sopenharmony_cistruct set_nvm_data_req {
9108c2ecf20Sopenharmony_ci	__le32	tag;
9118c2ecf20Sopenharmony_ci	__le32	len_ir_vpdd;
9128c2ecf20Sopenharmony_ci	__le32	vpd_offset;
9138c2ecf20Sopenharmony_ci	u32	reserved[8];
9148c2ecf20Sopenharmony_ci	__le32	resp_addr_lo;
9158c2ecf20Sopenharmony_ci	__le32	resp_addr_hi;
9168c2ecf20Sopenharmony_ci	__le32	resp_len;
9178c2ecf20Sopenharmony_ci	u32	reserved1[17];
9188c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
9198c2ecf20Sopenharmony_ci
9208c2ecf20Sopenharmony_ci/**
9218c2ecf20Sopenharmony_ci * brief the data structure for SET CONTROLLER CONFIG COMMAND
9228c2ecf20Sopenharmony_ci * use to modify controller configuration
9238c2ecf20Sopenharmony_ci */
9248c2ecf20Sopenharmony_cistruct set_ctrl_cfg_req {
9258c2ecf20Sopenharmony_ci	__le32	tag;
9268c2ecf20Sopenharmony_ci	__le32	cfg_pg[14];
9278c2ecf20Sopenharmony_ci	u32	reserved[16];
9288c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
9298c2ecf20Sopenharmony_ci
9308c2ecf20Sopenharmony_ci/**
9318c2ecf20Sopenharmony_ci * brief the data structure for GET CONTROLLER CONFIG COMMAND
9328c2ecf20Sopenharmony_ci * use to get controller configuration page
9338c2ecf20Sopenharmony_ci */
9348c2ecf20Sopenharmony_cistruct get_ctrl_cfg_req {
9358c2ecf20Sopenharmony_ci	__le32	tag;
9368c2ecf20Sopenharmony_ci	__le32	pgcd;
9378c2ecf20Sopenharmony_ci	__le32	int_vec;
9388c2ecf20Sopenharmony_ci	u32	reserved[28];
9398c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
9408c2ecf20Sopenharmony_ci
9418c2ecf20Sopenharmony_ci/**
9428c2ecf20Sopenharmony_ci * brief the data structure for KEK_MANAGEMENT COMMAND
9438c2ecf20Sopenharmony_ci * use for KEK management
9448c2ecf20Sopenharmony_ci */
9458c2ecf20Sopenharmony_cistruct kek_mgmt_req {
9468c2ecf20Sopenharmony_ci	__le32	tag;
9478c2ecf20Sopenharmony_ci	__le32	new_curidx_ksop;
9488c2ecf20Sopenharmony_ci	u32	reserved;
9498c2ecf20Sopenharmony_ci	__le32	kblob[12];
9508c2ecf20Sopenharmony_ci	u32	reserved1[16];
9518c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
9528c2ecf20Sopenharmony_ci
9538c2ecf20Sopenharmony_ci/**
9548c2ecf20Sopenharmony_ci * brief the data structure for DEK_MANAGEMENT COMMAND
9558c2ecf20Sopenharmony_ci * use for DEK management
9568c2ecf20Sopenharmony_ci */
9578c2ecf20Sopenharmony_cistruct dek_mgmt_req {
9588c2ecf20Sopenharmony_ci	__le32	tag;
9598c2ecf20Sopenharmony_ci	__le32	kidx_dsop;
9608c2ecf20Sopenharmony_ci	__le32	dekidx;
9618c2ecf20Sopenharmony_ci	__le32	addr_l;
9628c2ecf20Sopenharmony_ci	__le32	addr_h;
9638c2ecf20Sopenharmony_ci	__le32	nent;
9648c2ecf20Sopenharmony_ci	__le32	dbf_tblsize;
9658c2ecf20Sopenharmony_ci	u32	reserved[24];
9668c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
9678c2ecf20Sopenharmony_ci
9688c2ecf20Sopenharmony_ci/**
9698c2ecf20Sopenharmony_ci * brief the data structure for SET PHY PROFILE COMMAND
9708c2ecf20Sopenharmony_ci * use to retrive phy specific information
9718c2ecf20Sopenharmony_ci */
9728c2ecf20Sopenharmony_cistruct set_phy_profile_req {
9738c2ecf20Sopenharmony_ci	__le32	tag;
9748c2ecf20Sopenharmony_ci	__le32	ppc_phyid;
9758c2ecf20Sopenharmony_ci	u32	reserved[29];
9768c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
9778c2ecf20Sopenharmony_ci
9788c2ecf20Sopenharmony_ci/**
9798c2ecf20Sopenharmony_ci * brief the data structure for GET PHY PROFILE COMMAND
9808c2ecf20Sopenharmony_ci * use to retrive phy specific information
9818c2ecf20Sopenharmony_ci */
9828c2ecf20Sopenharmony_cistruct get_phy_profile_req {
9838c2ecf20Sopenharmony_ci	__le32	tag;
9848c2ecf20Sopenharmony_ci	__le32	ppc_phyid;
9858c2ecf20Sopenharmony_ci	__le32	profile[29];
9868c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
9878c2ecf20Sopenharmony_ci
9888c2ecf20Sopenharmony_ci/**
9898c2ecf20Sopenharmony_ci * brief the data structure for EXT FLASH PARTITION
9908c2ecf20Sopenharmony_ci * use to manage ext flash partition
9918c2ecf20Sopenharmony_ci */
9928c2ecf20Sopenharmony_cistruct ext_flash_partition_req {
9938c2ecf20Sopenharmony_ci	__le32	tag;
9948c2ecf20Sopenharmony_ci	__le32	cmd;
9958c2ecf20Sopenharmony_ci	__le32	offset;
9968c2ecf20Sopenharmony_ci	__le32	len;
9978c2ecf20Sopenharmony_ci	u32	reserved[7];
9988c2ecf20Sopenharmony_ci	__le32	addr_low;
9998c2ecf20Sopenharmony_ci	__le32	addr_high;
10008c2ecf20Sopenharmony_ci	__le32	len1;
10018c2ecf20Sopenharmony_ci	__le32	ext;
10028c2ecf20Sopenharmony_ci	u32	reserved1[16];
10038c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
10048c2ecf20Sopenharmony_ci
10058c2ecf20Sopenharmony_ci#define TWI_DEVICE	0x0
10068c2ecf20Sopenharmony_ci#define C_SEEPROM	0x1
10078c2ecf20Sopenharmony_ci#define VPD_FLASH	0x4
10088c2ecf20Sopenharmony_ci#define AAP1_RDUMP	0x5
10098c2ecf20Sopenharmony_ci#define IOP_RDUMP	0x6
10108c2ecf20Sopenharmony_ci#define EXPAN_ROM	0x7
10118c2ecf20Sopenharmony_ci
10128c2ecf20Sopenharmony_ci#define IPMode		0x80000000
10138c2ecf20Sopenharmony_ci#define NVMD_TYPE	0x0000000F
10148c2ecf20Sopenharmony_ci#define NVMD_STAT	0x0000FFFF
10158c2ecf20Sopenharmony_ci#define NVMD_LEN	0xFF000000
10168c2ecf20Sopenharmony_ci/**
10178c2ecf20Sopenharmony_ci * brief the data structure of Get NVMD Data Response
10188c2ecf20Sopenharmony_ci * use to describe MPI Get NVMD Data Response (64 bytes)
10198c2ecf20Sopenharmony_ci */
10208c2ecf20Sopenharmony_cistruct get_nvm_data_resp {
10218c2ecf20Sopenharmony_ci	__le32		tag;
10228c2ecf20Sopenharmony_ci	__le32		ir_tda_bn_dps_das_nvm;
10238c2ecf20Sopenharmony_ci	__le32		dlen_status;
10248c2ecf20Sopenharmony_ci	__le32		nvm_data[12];
10258c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
10268c2ecf20Sopenharmony_ci
10278c2ecf20Sopenharmony_ci/**
10288c2ecf20Sopenharmony_ci * brief the data structure of SAS Diagnostic Start/End Response
10298c2ecf20Sopenharmony_ci * use to describe MPI SAS Diagnostic Start/End Response (64 bytes)
10308c2ecf20Sopenharmony_ci *
10318c2ecf20Sopenharmony_ci */
10328c2ecf20Sopenharmony_cistruct sas_diag_start_end_resp {
10338c2ecf20Sopenharmony_ci	__le32		tag;
10348c2ecf20Sopenharmony_ci	__le32		status;
10358c2ecf20Sopenharmony_ci	u32		reserved[13];
10368c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
10378c2ecf20Sopenharmony_ci
10388c2ecf20Sopenharmony_ci/**
10398c2ecf20Sopenharmony_ci * brief the data structure of SAS Diagnostic Execute Response
10408c2ecf20Sopenharmony_ci * use to describe MPI SAS Diagnostic Execute Response (64 bytes)
10418c2ecf20Sopenharmony_ci *
10428c2ecf20Sopenharmony_ci */
10438c2ecf20Sopenharmony_cistruct sas_diag_execute_resp {
10448c2ecf20Sopenharmony_ci	__le32		tag;
10458c2ecf20Sopenharmony_ci	__le32		cmdtype_cmddesc_phyid;
10468c2ecf20Sopenharmony_ci	__le32		Status;
10478c2ecf20Sopenharmony_ci	__le32		ReportData;
10488c2ecf20Sopenharmony_ci	u32		reserved[11];
10498c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
10508c2ecf20Sopenharmony_ci
10518c2ecf20Sopenharmony_ci/**
10528c2ecf20Sopenharmony_ci * brief the data structure of Set Device State Response
10538c2ecf20Sopenharmony_ci * use to describe MPI Set Device State Response (64 bytes)
10548c2ecf20Sopenharmony_ci *
10558c2ecf20Sopenharmony_ci */
10568c2ecf20Sopenharmony_cistruct set_dev_state_resp {
10578c2ecf20Sopenharmony_ci	__le32		tag;
10588c2ecf20Sopenharmony_ci	__le32		status;
10598c2ecf20Sopenharmony_ci	__le32		device_id;
10608c2ecf20Sopenharmony_ci	__le32		pds_nds;
10618c2ecf20Sopenharmony_ci	u32		reserved[11];
10628c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
10638c2ecf20Sopenharmony_ci
10648c2ecf20Sopenharmony_ci/* new outbound structure for spcv - begins */
10658c2ecf20Sopenharmony_ci/**
10668c2ecf20Sopenharmony_ci * brief the data structure for SET CONTROLLER CONFIG COMMAND
10678c2ecf20Sopenharmony_ci * use to modify controller configuration
10688c2ecf20Sopenharmony_ci */
10698c2ecf20Sopenharmony_cistruct set_ctrl_cfg_resp {
10708c2ecf20Sopenharmony_ci	__le32 tag;
10718c2ecf20Sopenharmony_ci	__le32 status;
10728c2ecf20Sopenharmony_ci	__le32 err_qlfr_pgcd;
10738c2ecf20Sopenharmony_ci	u32 reserved[12];
10748c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
10758c2ecf20Sopenharmony_ci
10768c2ecf20Sopenharmony_cistruct get_ctrl_cfg_resp {
10778c2ecf20Sopenharmony_ci	__le32 tag;
10788c2ecf20Sopenharmony_ci	__le32 status;
10798c2ecf20Sopenharmony_ci	__le32 err_qlfr;
10808c2ecf20Sopenharmony_ci	__le32 confg_page[12];
10818c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
10828c2ecf20Sopenharmony_ci
10838c2ecf20Sopenharmony_cistruct kek_mgmt_resp {
10848c2ecf20Sopenharmony_ci	__le32 tag;
10858c2ecf20Sopenharmony_ci	__le32 status;
10868c2ecf20Sopenharmony_ci	__le32 kidx_new_curr_ksop;
10878c2ecf20Sopenharmony_ci	__le32 err_qlfr;
10888c2ecf20Sopenharmony_ci	u32 reserved[11];
10898c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
10908c2ecf20Sopenharmony_ci
10918c2ecf20Sopenharmony_cistruct dek_mgmt_resp {
10928c2ecf20Sopenharmony_ci	__le32 tag;
10938c2ecf20Sopenharmony_ci	__le32 status;
10948c2ecf20Sopenharmony_ci	__le32 kekidx_tbls_dsop;
10958c2ecf20Sopenharmony_ci	__le32 dekidx;
10968c2ecf20Sopenharmony_ci	__le32 err_qlfr;
10978c2ecf20Sopenharmony_ci	u32 reserved[10];
10988c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
10998c2ecf20Sopenharmony_ci
11008c2ecf20Sopenharmony_cistruct get_phy_profile_resp {
11018c2ecf20Sopenharmony_ci	__le32 tag;
11028c2ecf20Sopenharmony_ci	__le32 status;
11038c2ecf20Sopenharmony_ci	__le32 ppc_phyid;
11048c2ecf20Sopenharmony_ci	__le32 ppc_specific_rsp[12];
11058c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
11068c2ecf20Sopenharmony_ci
11078c2ecf20Sopenharmony_cistruct flash_op_ext_resp {
11088c2ecf20Sopenharmony_ci	__le32 tag;
11098c2ecf20Sopenharmony_ci	__le32 cmd;
11108c2ecf20Sopenharmony_ci	__le32 status;
11118c2ecf20Sopenharmony_ci	__le32 epart_size;
11128c2ecf20Sopenharmony_ci	__le32 epart_sect_size;
11138c2ecf20Sopenharmony_ci	u32 reserved[10];
11148c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
11158c2ecf20Sopenharmony_ci
11168c2ecf20Sopenharmony_cistruct set_phy_profile_resp {
11178c2ecf20Sopenharmony_ci	__le32 tag;
11188c2ecf20Sopenharmony_ci	__le32 status;
11198c2ecf20Sopenharmony_ci	__le32 ppc_phyid;
11208c2ecf20Sopenharmony_ci	__le32 ppc_specific_rsp[12];
11218c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
11228c2ecf20Sopenharmony_ci
11238c2ecf20Sopenharmony_cistruct ssp_coalesced_comp_resp {
11248c2ecf20Sopenharmony_ci	__le32 coal_cnt;
11258c2ecf20Sopenharmony_ci	__le32 tag0;
11268c2ecf20Sopenharmony_ci	__le32 ssp_tag0;
11278c2ecf20Sopenharmony_ci	__le32 tag1;
11288c2ecf20Sopenharmony_ci	__le32 ssp_tag1;
11298c2ecf20Sopenharmony_ci	__le32 add_tag_ssp_tag[10];
11308c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
11318c2ecf20Sopenharmony_ci
11328c2ecf20Sopenharmony_ci/* new outbound structure for spcv - ends */
11338c2ecf20Sopenharmony_ci
11348c2ecf20Sopenharmony_ci/* brief data structure for SAS protocol timer configuration page.
11358c2ecf20Sopenharmony_ci *
11368c2ecf20Sopenharmony_ci */
11378c2ecf20Sopenharmony_cistruct SASProtocolTimerConfig {
11388c2ecf20Sopenharmony_ci	__le32 pageCode;			/* 0 */
11398c2ecf20Sopenharmony_ci	__le32 MST_MSI;				/* 1 */
11408c2ecf20Sopenharmony_ci	__le32 STP_SSP_MCT_TMO;			/* 2 */
11418c2ecf20Sopenharmony_ci	__le32 STP_FRM_TMO;			/* 3 */
11428c2ecf20Sopenharmony_ci	__le32 STP_IDLE_TMO;			/* 4 */
11438c2ecf20Sopenharmony_ci	__le32 OPNRJT_RTRY_INTVL;		/* 5 */
11448c2ecf20Sopenharmony_ci	__le32 Data_Cmd_OPNRJT_RTRY_TMO;	/* 6 */
11458c2ecf20Sopenharmony_ci	__le32 Data_Cmd_OPNRJT_RTRY_THR;	/* 7 */
11468c2ecf20Sopenharmony_ci	__le32 MAX_AIP;				/* 8 */
11478c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
11488c2ecf20Sopenharmony_ci
11498c2ecf20Sopenharmony_citypedef struct SASProtocolTimerConfig SASProtocolTimerConfig_t;
11508c2ecf20Sopenharmony_ci
11518c2ecf20Sopenharmony_ci#define NDS_BITS 0x0F
11528c2ecf20Sopenharmony_ci#define PDS_BITS 0xF0
11538c2ecf20Sopenharmony_ci
11548c2ecf20Sopenharmony_ci/*
11558c2ecf20Sopenharmony_ci * HW Events type
11568c2ecf20Sopenharmony_ci */
11578c2ecf20Sopenharmony_ci
11588c2ecf20Sopenharmony_ci#define HW_EVENT_RESET_START			0x01
11598c2ecf20Sopenharmony_ci#define HW_EVENT_CHIP_RESET_COMPLETE		0x02
11608c2ecf20Sopenharmony_ci#define HW_EVENT_PHY_STOP_STATUS		0x03
11618c2ecf20Sopenharmony_ci#define HW_EVENT_SAS_PHY_UP			0x04
11628c2ecf20Sopenharmony_ci#define HW_EVENT_SATA_PHY_UP			0x05
11638c2ecf20Sopenharmony_ci#define HW_EVENT_SATA_SPINUP_HOLD		0x06
11648c2ecf20Sopenharmony_ci#define HW_EVENT_PHY_DOWN			0x07
11658c2ecf20Sopenharmony_ci#define HW_EVENT_PORT_INVALID			0x08
11668c2ecf20Sopenharmony_ci#define HW_EVENT_BROADCAST_CHANGE		0x09
11678c2ecf20Sopenharmony_ci#define HW_EVENT_PHY_ERROR			0x0A
11688c2ecf20Sopenharmony_ci#define HW_EVENT_BROADCAST_SES			0x0B
11698c2ecf20Sopenharmony_ci#define HW_EVENT_INBOUND_CRC_ERROR		0x0C
11708c2ecf20Sopenharmony_ci#define HW_EVENT_HARD_RESET_RECEIVED		0x0D
11718c2ecf20Sopenharmony_ci#define HW_EVENT_MALFUNCTION			0x0E
11728c2ecf20Sopenharmony_ci#define HW_EVENT_ID_FRAME_TIMEOUT		0x0F
11738c2ecf20Sopenharmony_ci#define HW_EVENT_BROADCAST_EXP			0x10
11748c2ecf20Sopenharmony_ci#define HW_EVENT_PHY_START_STATUS		0x11
11758c2ecf20Sopenharmony_ci#define HW_EVENT_LINK_ERR_INVALID_DWORD		0x12
11768c2ecf20Sopenharmony_ci#define HW_EVENT_LINK_ERR_DISPARITY_ERROR	0x13
11778c2ecf20Sopenharmony_ci#define HW_EVENT_LINK_ERR_CODE_VIOLATION	0x14
11788c2ecf20Sopenharmony_ci#define HW_EVENT_LINK_ERR_LOSS_OF_DWORD_SYNCH	0x15
11798c2ecf20Sopenharmony_ci#define HW_EVENT_LINK_ERR_PHY_RESET_FAILED	0x16
11808c2ecf20Sopenharmony_ci#define HW_EVENT_PORT_RECOVERY_TIMER_TMO	0x17
11818c2ecf20Sopenharmony_ci#define HW_EVENT_PORT_RECOVER			0x18
11828c2ecf20Sopenharmony_ci#define HW_EVENT_PORT_RESET_TIMER_TMO		0x19
11838c2ecf20Sopenharmony_ci#define HW_EVENT_PORT_RESET_COMPLETE		0x20
11848c2ecf20Sopenharmony_ci#define EVENT_BROADCAST_ASYNCH_EVENT		0x21
11858c2ecf20Sopenharmony_ci
11868c2ecf20Sopenharmony_ci/* port state */
11878c2ecf20Sopenharmony_ci#define PORT_NOT_ESTABLISHED			0x00
11888c2ecf20Sopenharmony_ci#define PORT_VALID				0x01
11898c2ecf20Sopenharmony_ci#define PORT_LOSTCOMM				0x02
11908c2ecf20Sopenharmony_ci#define PORT_IN_RESET				0x04
11918c2ecf20Sopenharmony_ci#define PORT_3RD_PARTY_RESET			0x07
11928c2ecf20Sopenharmony_ci#define PORT_INVALID				0x08
11938c2ecf20Sopenharmony_ci
11948c2ecf20Sopenharmony_ci/*
11958c2ecf20Sopenharmony_ci * SSP/SMP/SATA IO Completion Status values
11968c2ecf20Sopenharmony_ci */
11978c2ecf20Sopenharmony_ci
11988c2ecf20Sopenharmony_ci#define IO_SUCCESS				0x00
11998c2ecf20Sopenharmony_ci#define IO_ABORTED				0x01
12008c2ecf20Sopenharmony_ci#define IO_OVERFLOW				0x02
12018c2ecf20Sopenharmony_ci#define IO_UNDERFLOW				0x03
12028c2ecf20Sopenharmony_ci#define IO_FAILED				0x04
12038c2ecf20Sopenharmony_ci#define IO_ABORT_RESET				0x05
12048c2ecf20Sopenharmony_ci#define IO_NOT_VALID				0x06
12058c2ecf20Sopenharmony_ci#define IO_NO_DEVICE				0x07
12068c2ecf20Sopenharmony_ci#define IO_ILLEGAL_PARAMETER			0x08
12078c2ecf20Sopenharmony_ci#define IO_LINK_FAILURE				0x09
12088c2ecf20Sopenharmony_ci#define IO_PROG_ERROR				0x0A
12098c2ecf20Sopenharmony_ci
12108c2ecf20Sopenharmony_ci#define IO_EDC_IN_ERROR				0x0B
12118c2ecf20Sopenharmony_ci#define IO_EDC_OUT_ERROR			0x0C
12128c2ecf20Sopenharmony_ci#define IO_ERROR_HW_TIMEOUT			0x0D
12138c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_BREAK			0x0E
12148c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_PHY_NOT_READY		0x0F
12158c2ecf20Sopenharmony_ci#define IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED	0x10
12168c2ecf20Sopenharmony_ci#define IO_OPEN_CNX_ERROR_ZONE_VIOLATION		0x11
12178c2ecf20Sopenharmony_ci#define IO_OPEN_CNX_ERROR_BREAK				0x12
12188c2ecf20Sopenharmony_ci#define IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS			0x13
12198c2ecf20Sopenharmony_ci#define IO_OPEN_CNX_ERROR_BAD_DESTINATION		0x14
12208c2ecf20Sopenharmony_ci#define IO_OPEN_CNX_ERROR_CONNECTION_RATE_NOT_SUPPORTED	0x15
12218c2ecf20Sopenharmony_ci#define IO_OPEN_CNX_ERROR_STP_RESOURCES_BUSY		0x16
12228c2ecf20Sopenharmony_ci#define IO_OPEN_CNX_ERROR_WRONG_DESTINATION		0x17
12238c2ecf20Sopenharmony_ci/* This error code 0x18 is not used on SPCv */
12248c2ecf20Sopenharmony_ci#define IO_OPEN_CNX_ERROR_UNKNOWN_ERROR			0x18
12258c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_NAK_RECEIVED			0x19
12268c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_ACK_NAK_TIMEOUT			0x1A
12278c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_PEER_ABORTED			0x1B
12288c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_RX_FRAME				0x1C
12298c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_DMA				0x1D
12308c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_CREDIT_TIMEOUT			0x1E
12318c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_SATA_LINK_TIMEOUT			0x1F
12328c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_SATA				0x20
12338c2ecf20Sopenharmony_ci
12348c2ecf20Sopenharmony_ci/* This error code 0x22 is not used on SPCv */
12358c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_ABORTED_DUE_TO_SRST		0x22
12368c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_REJECTED_NCQ_MODE			0x21
12378c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_ABORTED_NCQ_MODE			0x23
12388c2ecf20Sopenharmony_ci#define IO_XFER_OPEN_RETRY_TIMEOUT			0x24
12398c2ecf20Sopenharmony_ci/* This error code 0x25 is not used on SPCv */
12408c2ecf20Sopenharmony_ci#define IO_XFER_SMP_RESP_CONNECTION_ERROR		0x25
12418c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_UNEXPECTED_PHASE			0x26
12428c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_XFER_RDY_OVERRUN			0x27
12438c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_XFER_RDY_NOT_EXPECTED		0x28
12448c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_CMD_ISSUE_ACK_NAK_TIMEOUT		0x30
12458c2ecf20Sopenharmony_ci
12468c2ecf20Sopenharmony_ci/* The following error code 0x31 and 0x32 are not using (obsolete) */
12478c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_CMD_ISSUE_BREAK_BEFORE_ACK_NAK	0x31
12488c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_CMD_ISSUE_PHY_DOWN_BEFORE_ACK_NAK	0x32
12498c2ecf20Sopenharmony_ci
12508c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_OFFSET_MISMATCH			0x34
12518c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_XFER_ZERO_DATA_LEN		0x35
12528c2ecf20Sopenharmony_ci#define IO_XFER_CMD_FRAME_ISSUED			0x36
12538c2ecf20Sopenharmony_ci#define IO_ERROR_INTERNAL_SMP_RESOURCE			0x37
12548c2ecf20Sopenharmony_ci#define IO_PORT_IN_RESET				0x38
12558c2ecf20Sopenharmony_ci#define IO_DS_NON_OPERATIONAL				0x39
12568c2ecf20Sopenharmony_ci#define IO_DS_IN_RECOVERY				0x3A
12578c2ecf20Sopenharmony_ci#define IO_TM_TAG_NOT_FOUND				0x3B
12588c2ecf20Sopenharmony_ci#define IO_XFER_PIO_SETUP_ERROR				0x3C
12598c2ecf20Sopenharmony_ci#define IO_SSP_EXT_IU_ZERO_LEN_ERROR			0x3D
12608c2ecf20Sopenharmony_ci#define IO_DS_IN_ERROR					0x3E
12618c2ecf20Sopenharmony_ci#define IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY		0x3F
12628c2ecf20Sopenharmony_ci#define IO_ABORT_IN_PROGRESS				0x40
12638c2ecf20Sopenharmony_ci#define IO_ABORT_DELAYED				0x41
12648c2ecf20Sopenharmony_ci#define IO_INVALID_LENGTH				0x42
12658c2ecf20Sopenharmony_ci
12668c2ecf20Sopenharmony_ci/********** additional response event values *****************/
12678c2ecf20Sopenharmony_ci
12688c2ecf20Sopenharmony_ci#define IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY_ALT		0x43
12698c2ecf20Sopenharmony_ci#define IO_XFER_OPEN_RETRY_BACKOFF_THRESHOLD_REACHED	0x44
12708c2ecf20Sopenharmony_ci#define IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_TMO	0x45
12718c2ecf20Sopenharmony_ci#define IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_NO_DEST		0x46
12728c2ecf20Sopenharmony_ci#define IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_COLLIDE	0x47
12738c2ecf20Sopenharmony_ci#define IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_PATHWAY_BLOCKED	0x48
12748c2ecf20Sopenharmony_ci#define IO_DS_INVALID					0x49
12758c2ecf20Sopenharmony_ci/* WARNING: the value is not contiguous from here */
12768c2ecf20Sopenharmony_ci#define IO_XFER_ERR_LAST_PIO_DATAIN_CRC_ERR	0x52
12778c2ecf20Sopenharmony_ci#define IO_XFER_DMA_ACTIVATE_TIMEOUT		0x53
12788c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_INTERNAL_CRC_ERROR	0x54
12798c2ecf20Sopenharmony_ci#define MPI_IO_RQE_BUSY_FULL			0x55
12808c2ecf20Sopenharmony_ci#define IO_XFER_ERR_EOB_DATA_OVERRUN		0x56
12818c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_INVALID_SSP_RSP_FRAME	0x57
12828c2ecf20Sopenharmony_ci#define IO_OPEN_CNX_ERROR_OPEN_PREEMPTED	0x58
12838c2ecf20Sopenharmony_ci
12848c2ecf20Sopenharmony_ci#define MPI_ERR_IO_RESOURCE_UNAVAILABLE		0x1004
12858c2ecf20Sopenharmony_ci#define MPI_ERR_ATAPI_DEVICE_BUSY		0x1024
12868c2ecf20Sopenharmony_ci
12878c2ecf20Sopenharmony_ci#define IO_XFR_ERROR_DEK_KEY_CACHE_MISS		0x2040
12888c2ecf20Sopenharmony_ci/*
12898c2ecf20Sopenharmony_ci * An encryption IO request failed due to DEK Key Tag mismatch.
12908c2ecf20Sopenharmony_ci * The key tag supplied in the encryption IOMB does not match with
12918c2ecf20Sopenharmony_ci * the Key Tag in the referenced DEK Entry.
12928c2ecf20Sopenharmony_ci */
12938c2ecf20Sopenharmony_ci#define IO_XFR_ERROR_DEK_KEY_TAG_MISMATCH	0x2041
12948c2ecf20Sopenharmony_ci#define IO_XFR_ERROR_CIPHER_MODE_INVALID	0x2042
12958c2ecf20Sopenharmony_ci/*
12968c2ecf20Sopenharmony_ci * An encryption I/O request failed because the initial value (IV)
12978c2ecf20Sopenharmony_ci * in the unwrapped DEK blob didn't match the IV used to unwrap it.
12988c2ecf20Sopenharmony_ci */
12998c2ecf20Sopenharmony_ci#define IO_XFR_ERROR_DEK_IV_MISMATCH		0x2043
13008c2ecf20Sopenharmony_ci/* An encryption I/O request failed due to an internal RAM ECC or
13018c2ecf20Sopenharmony_ci * interface error while unwrapping the DEK. */
13028c2ecf20Sopenharmony_ci#define IO_XFR_ERROR_DEK_RAM_INTERFACE_ERROR	0x2044
13038c2ecf20Sopenharmony_ci/* An encryption I/O request failed due to an internal RAM ECC or
13048c2ecf20Sopenharmony_ci * interface error while unwrapping the DEK. */
13058c2ecf20Sopenharmony_ci#define IO_XFR_ERROR_INTERNAL_RAM		0x2045
13068c2ecf20Sopenharmony_ci/*
13078c2ecf20Sopenharmony_ci * An encryption I/O request failed
13088c2ecf20Sopenharmony_ci * because the DEK index specified in the I/O was outside the bounds of
13098c2ecf20Sopenharmony_ci * the total number of entries in the host DEK table.
13108c2ecf20Sopenharmony_ci */
13118c2ecf20Sopenharmony_ci#define IO_XFR_ERROR_DEK_INDEX_OUT_OF_BOUNDS0x2046
13128c2ecf20Sopenharmony_ci
13138c2ecf20Sopenharmony_ci/* define DIF IO response error status code */
13148c2ecf20Sopenharmony_ci#define IO_XFR_ERROR_DIF_MISMATCH			0x3000
13158c2ecf20Sopenharmony_ci#define IO_XFR_ERROR_DIF_APPLICATION_TAG_MISMATCH	0x3001
13168c2ecf20Sopenharmony_ci#define IO_XFR_ERROR_DIF_REFERENCE_TAG_MISMATCH		0x3002
13178c2ecf20Sopenharmony_ci#define IO_XFR_ERROR_DIF_CRC_MISMATCH			0x3003
13188c2ecf20Sopenharmony_ci
13198c2ecf20Sopenharmony_ci/* define operator management response status and error qualifier code */
13208c2ecf20Sopenharmony_ci#define OPR_MGMT_OP_NOT_SUPPORTED			0x2060
13218c2ecf20Sopenharmony_ci#define OPR_MGMT_MPI_ENC_ERR_OPR_PARAM_ILLEGAL		0x2061
13228c2ecf20Sopenharmony_ci#define OPR_MGMT_MPI_ENC_ERR_OPR_ID_NOT_FOUND		0x2062
13238c2ecf20Sopenharmony_ci#define OPR_MGMT_MPI_ENC_ERR_OPR_ROLE_NOT_MATCH		0x2063
13248c2ecf20Sopenharmony_ci#define OPR_MGMT_MPI_ENC_ERR_OPR_MAX_NUM_EXCEEDED	0x2064
13258c2ecf20Sopenharmony_ci#define OPR_MGMT_MPI_ENC_ERR_KEK_UNWRAP_FAIL		0x2022
13268c2ecf20Sopenharmony_ci#define OPR_MGMT_MPI_ENC_ERR_NVRAM_OPERATION_FAILURE	0x2023
13278c2ecf20Sopenharmony_ci/***************** additional response event values ***************/
13288c2ecf20Sopenharmony_ci
13298c2ecf20Sopenharmony_ci/* WARNING: This error code must always be the last number.
13308c2ecf20Sopenharmony_ci * If you add error code, modify this code also
13318c2ecf20Sopenharmony_ci * It is used as an index
13328c2ecf20Sopenharmony_ci */
13338c2ecf20Sopenharmony_ci#define IO_ERROR_UNKNOWN_GENERIC			0x2023
13348c2ecf20Sopenharmony_ci
13358c2ecf20Sopenharmony_ci/* MSGU CONFIGURATION TABLE*/
13368c2ecf20Sopenharmony_ci
13378c2ecf20Sopenharmony_ci#define SPCv_MSGU_CFG_TABLE_UPDATE		0x001
13388c2ecf20Sopenharmony_ci#define SPCv_MSGU_CFG_TABLE_RESET		0x002
13398c2ecf20Sopenharmony_ci#define SPCv_MSGU_CFG_TABLE_FREEZE		0x004
13408c2ecf20Sopenharmony_ci#define SPCv_MSGU_CFG_TABLE_UNFREEZE		0x008
13418c2ecf20Sopenharmony_ci#define MSGU_IBDB_SET				0x00
13428c2ecf20Sopenharmony_ci#define MSGU_HOST_INT_STATUS			0x08
13438c2ecf20Sopenharmony_ci#define MSGU_HOST_INT_MASK			0x0C
13448c2ecf20Sopenharmony_ci#define MSGU_IOPIB_INT_STATUS			0x18
13458c2ecf20Sopenharmony_ci#define MSGU_IOPIB_INT_MASK			0x1C
13468c2ecf20Sopenharmony_ci#define MSGU_IBDB_CLEAR				0x20
13478c2ecf20Sopenharmony_ci
13488c2ecf20Sopenharmony_ci#define MSGU_MSGU_CONTROL			0x24
13498c2ecf20Sopenharmony_ci#define MSGU_ODR				0x20
13508c2ecf20Sopenharmony_ci#define MSGU_ODCR				0x28
13518c2ecf20Sopenharmony_ci
13528c2ecf20Sopenharmony_ci#define MSGU_ODMR				0x30
13538c2ecf20Sopenharmony_ci#define MSGU_ODMR_U				0x34
13548c2ecf20Sopenharmony_ci#define MSGU_ODMR_CLR				0x38
13558c2ecf20Sopenharmony_ci#define MSGU_ODMR_CLR_U				0x3C
13568c2ecf20Sopenharmony_ci#define MSGU_OD_RSVD				0x40
13578c2ecf20Sopenharmony_ci
13588c2ecf20Sopenharmony_ci#define MSGU_SCRATCH_PAD_0			0x44
13598c2ecf20Sopenharmony_ci#define MSGU_SCRATCH_PAD_1			0x48
13608c2ecf20Sopenharmony_ci#define MSGU_SCRATCH_PAD_2			0x4C
13618c2ecf20Sopenharmony_ci#define MSGU_SCRATCH_PAD_3			0x50
13628c2ecf20Sopenharmony_ci#define MSGU_HOST_SCRATCH_PAD_0			0x54
13638c2ecf20Sopenharmony_ci#define MSGU_HOST_SCRATCH_PAD_1			0x58
13648c2ecf20Sopenharmony_ci#define MSGU_HOST_SCRATCH_PAD_2			0x5C
13658c2ecf20Sopenharmony_ci#define MSGU_HOST_SCRATCH_PAD_3			0x60
13668c2ecf20Sopenharmony_ci#define MSGU_HOST_SCRATCH_PAD_4			0x64
13678c2ecf20Sopenharmony_ci#define MSGU_HOST_SCRATCH_PAD_5			0x68
13688c2ecf20Sopenharmony_ci#define MSGU_HOST_SCRATCH_PAD_6			0x6C
13698c2ecf20Sopenharmony_ci#define MSGU_HOST_SCRATCH_PAD_7			0x70
13708c2ecf20Sopenharmony_ci
13718c2ecf20Sopenharmony_ci/* bit definition for ODMR register */
13728c2ecf20Sopenharmony_ci#define ODMR_MASK_ALL			0xFFFFFFFF/* mask all
13738c2ecf20Sopenharmony_ci					interrupt vector */
13748c2ecf20Sopenharmony_ci#define ODMR_CLEAR_ALL			0	/* clear all
13758c2ecf20Sopenharmony_ci					interrupt vector */
13768c2ecf20Sopenharmony_ci/* bit definition for ODCR register */
13778c2ecf20Sopenharmony_ci#define ODCR_CLEAR_ALL			0xFFFFFFFF /* mask all
13788c2ecf20Sopenharmony_ci					interrupt vector*/
13798c2ecf20Sopenharmony_ci/* MSIX Interupts */
13808c2ecf20Sopenharmony_ci#define MSIX_TABLE_OFFSET		0x2000
13818c2ecf20Sopenharmony_ci#define MSIX_TABLE_ELEMENT_SIZE		0x10
13828c2ecf20Sopenharmony_ci#define MSIX_INTERRUPT_CONTROL_OFFSET	0xC
13838c2ecf20Sopenharmony_ci#define MSIX_TABLE_BASE			(MSIX_TABLE_OFFSET + \
13848c2ecf20Sopenharmony_ci					MSIX_INTERRUPT_CONTROL_OFFSET)
13858c2ecf20Sopenharmony_ci#define MSIX_INTERRUPT_DISABLE		0x1
13868c2ecf20Sopenharmony_ci#define MSIX_INTERRUPT_ENABLE		0x0
13878c2ecf20Sopenharmony_ci
13888c2ecf20Sopenharmony_ci/* state definition for Scratch Pad1 register */
13898c2ecf20Sopenharmony_ci#define SCRATCH_PAD_RAAE_READY		0x3
13908c2ecf20Sopenharmony_ci#define SCRATCH_PAD_ILA_READY		0xC
13918c2ecf20Sopenharmony_ci#define SCRATCH_PAD_BOOT_LOAD_SUCCESS	0x0
13928c2ecf20Sopenharmony_ci#define SCRATCH_PAD_IOP0_READY		0xC00
13938c2ecf20Sopenharmony_ci#define SCRATCH_PAD_IOP1_READY		0x3000
13948c2ecf20Sopenharmony_ci#define SCRATCH_PAD_MIPSALL_READY_16PORT	(SCRATCH_PAD_IOP1_READY | \
13958c2ecf20Sopenharmony_ci					SCRATCH_PAD_IOP0_READY | \
13968c2ecf20Sopenharmony_ci					SCRATCH_PAD_ILA_READY | \
13978c2ecf20Sopenharmony_ci					SCRATCH_PAD_RAAE_READY)
13988c2ecf20Sopenharmony_ci#define SCRATCH_PAD_MIPSALL_READY_8PORT	(SCRATCH_PAD_IOP0_READY | \
13998c2ecf20Sopenharmony_ci					SCRATCH_PAD_ILA_READY | \
14008c2ecf20Sopenharmony_ci					SCRATCH_PAD_RAAE_READY)
14018c2ecf20Sopenharmony_ci
14028c2ecf20Sopenharmony_ci/* boot loader state */
14038c2ecf20Sopenharmony_ci#define SCRATCH_PAD1_BOOTSTATE_MASK		0x70	/* Bit 4-6 */
14048c2ecf20Sopenharmony_ci#define SCRATCH_PAD1_BOOTSTATE_SUCESS		0x0	/* Load successful */
14058c2ecf20Sopenharmony_ci#define SCRATCH_PAD1_BOOTSTATE_HDA_SEEPROM	0x10	/* HDA SEEPROM */
14068c2ecf20Sopenharmony_ci#define SCRATCH_PAD1_BOOTSTATE_HDA_BOOTSTRAP	0x20	/* HDA BootStrap Pins */
14078c2ecf20Sopenharmony_ci#define SCRATCH_PAD1_BOOTSTATE_HDA_SOFTRESET	0x30	/* HDA Soft Reset */
14088c2ecf20Sopenharmony_ci#define SCRATCH_PAD1_BOOTSTATE_CRIT_ERROR	0x40	/* HDA critical error */
14098c2ecf20Sopenharmony_ci#define SCRATCH_PAD1_BOOTSTATE_R1		0x50	/* Reserved */
14108c2ecf20Sopenharmony_ci#define SCRATCH_PAD1_BOOTSTATE_R2		0x60	/* Reserved */
14118c2ecf20Sopenharmony_ci#define SCRATCH_PAD1_BOOTSTATE_FATAL		0x70	/* Fatal Error */
14128c2ecf20Sopenharmony_ci
14138c2ecf20Sopenharmony_ci /* state definition for Scratch Pad2 register */
14148c2ecf20Sopenharmony_ci#define SCRATCH_PAD2_POR		0x00	/* power on state */
14158c2ecf20Sopenharmony_ci#define SCRATCH_PAD2_SFR		0x01	/* soft reset state */
14168c2ecf20Sopenharmony_ci#define SCRATCH_PAD2_ERR		0x02	/* error state */
14178c2ecf20Sopenharmony_ci#define SCRATCH_PAD2_RDY		0x03	/* ready state */
14188c2ecf20Sopenharmony_ci#define SCRATCH_PAD2_FWRDY_RST		0x04	/* FW rdy for soft reset flag */
14198c2ecf20Sopenharmony_ci#define SCRATCH_PAD2_IOPRDY_RST		0x08	/* IOP ready for soft reset */
14208c2ecf20Sopenharmony_ci#define SCRATCH_PAD2_STATE_MASK		0xFFFFFFF4 /* ScratchPad 2
14218c2ecf20Sopenharmony_ci Mask, bit1-0 State */
14228c2ecf20Sopenharmony_ci#define SCRATCH_PAD2_RESERVED		0x000003FC/* Scratch Pad1
14238c2ecf20Sopenharmony_ci Reserved bit 2 to 9 */
14248c2ecf20Sopenharmony_ci
14258c2ecf20Sopenharmony_ci#define SCRATCH_PAD_ERROR_MASK		0xFFFFFC00 /* Error mask bits */
14268c2ecf20Sopenharmony_ci#define SCRATCH_PAD_STATE_MASK		0x00000003 /* State Mask bits */
14278c2ecf20Sopenharmony_ci
14288c2ecf20Sopenharmony_ci/* main configuration offset - byte offset */
14298c2ecf20Sopenharmony_ci#define MAIN_SIGNATURE_OFFSET		0x00 /* DWORD 0x00 */
14308c2ecf20Sopenharmony_ci#define MAIN_INTERFACE_REVISION		0x04 /* DWORD 0x01 */
14318c2ecf20Sopenharmony_ci#define MAIN_FW_REVISION		0x08 /* DWORD 0x02 */
14328c2ecf20Sopenharmony_ci#define MAIN_MAX_OUTSTANDING_IO_OFFSET	0x0C /* DWORD 0x03 */
14338c2ecf20Sopenharmony_ci#define MAIN_MAX_SGL_OFFSET		0x10 /* DWORD 0x04 */
14348c2ecf20Sopenharmony_ci#define MAIN_CNTRL_CAP_OFFSET		0x14 /* DWORD 0x05 */
14358c2ecf20Sopenharmony_ci#define MAIN_GST_OFFSET			0x18 /* DWORD 0x06 */
14368c2ecf20Sopenharmony_ci#define MAIN_IBQ_OFFSET			0x1C /* DWORD 0x07 */
14378c2ecf20Sopenharmony_ci#define MAIN_OBQ_OFFSET			0x20 /* DWORD 0x08 */
14388c2ecf20Sopenharmony_ci#define MAIN_IQNPPD_HPPD_OFFSET		0x24 /* DWORD 0x09 */
14398c2ecf20Sopenharmony_ci
14408c2ecf20Sopenharmony_ci/* 0x28 - 0x4C - RSVD */
14418c2ecf20Sopenharmony_ci#define MAIN_EVENT_CRC_CHECK		0x48 /* DWORD 0x12 */
14428c2ecf20Sopenharmony_ci#define MAIN_EVENT_LOG_ADDR_HI		0x50 /* DWORD 0x14 */
14438c2ecf20Sopenharmony_ci#define MAIN_EVENT_LOG_ADDR_LO		0x54 /* DWORD 0x15 */
14448c2ecf20Sopenharmony_ci#define MAIN_EVENT_LOG_BUFF_SIZE	0x58 /* DWORD 0x16 */
14458c2ecf20Sopenharmony_ci#define MAIN_EVENT_LOG_OPTION		0x5C /* DWORD 0x17 */
14468c2ecf20Sopenharmony_ci#define MAIN_PCS_EVENT_LOG_ADDR_HI	0x60 /* DWORD 0x18 */
14478c2ecf20Sopenharmony_ci#define MAIN_PCS_EVENT_LOG_ADDR_LO	0x64 /* DWORD 0x19 */
14488c2ecf20Sopenharmony_ci#define MAIN_PCS_EVENT_LOG_BUFF_SIZE	0x68 /* DWORD 0x1A */
14498c2ecf20Sopenharmony_ci#define MAIN_PCS_EVENT_LOG_OPTION	0x6C /* DWORD 0x1B */
14508c2ecf20Sopenharmony_ci#define MAIN_FATAL_ERROR_INTERRUPT	0x70 /* DWORD 0x1C */
14518c2ecf20Sopenharmony_ci#define MAIN_FATAL_ERROR_RDUMP0_OFFSET	0x74 /* DWORD 0x1D */
14528c2ecf20Sopenharmony_ci#define MAIN_FATAL_ERROR_RDUMP0_LENGTH	0x78 /* DWORD 0x1E */
14538c2ecf20Sopenharmony_ci#define MAIN_FATAL_ERROR_RDUMP1_OFFSET	0x7C /* DWORD 0x1F */
14548c2ecf20Sopenharmony_ci#define MAIN_FATAL_ERROR_RDUMP1_LENGTH	0x80 /* DWORD 0x20 */
14558c2ecf20Sopenharmony_ci#define MAIN_GPIO_LED_FLAGS_OFFSET	0x84 /* DWORD 0x21 */
14568c2ecf20Sopenharmony_ci#define MAIN_ANALOG_SETUP_OFFSET	0x88 /* DWORD 0x22 */
14578c2ecf20Sopenharmony_ci
14588c2ecf20Sopenharmony_ci#define MAIN_INT_VECTOR_TABLE_OFFSET	0x8C /* DWORD 0x23 */
14598c2ecf20Sopenharmony_ci#define MAIN_SAS_PHY_ATTR_TABLE_OFFSET	0x90 /* DWORD 0x24 */
14608c2ecf20Sopenharmony_ci#define MAIN_PORT_RECOVERY_TIMER	0x94 /* DWORD 0x25 */
14618c2ecf20Sopenharmony_ci#define MAIN_INT_REASSERTION_DELAY	0x98 /* DWORD 0x26 */
14628c2ecf20Sopenharmony_ci#define MAIN_MPI_ILA_RELEASE_TYPE	0xA4 /* DWORD 0x29 */
14638c2ecf20Sopenharmony_ci#define MAIN_MPI_INACTIVE_FW_VERSION	0XB0 /* DWORD 0x2C */
14648c2ecf20Sopenharmony_ci
14658c2ecf20Sopenharmony_ci/* Gereral Status Table offset - byte offset */
14668c2ecf20Sopenharmony_ci#define GST_GSTLEN_MPIS_OFFSET		0x00
14678c2ecf20Sopenharmony_ci#define GST_IQ_FREEZE_STATE0_OFFSET	0x04
14688c2ecf20Sopenharmony_ci#define GST_IQ_FREEZE_STATE1_OFFSET	0x08
14698c2ecf20Sopenharmony_ci#define GST_MSGUTCNT_OFFSET		0x0C
14708c2ecf20Sopenharmony_ci#define GST_IOPTCNT_OFFSET		0x10
14718c2ecf20Sopenharmony_ci/* 0x14 - 0x34 - RSVD */
14728c2ecf20Sopenharmony_ci#define GST_GPIO_INPUT_VAL		0x38
14738c2ecf20Sopenharmony_ci/* 0x3c - 0x40 - RSVD */
14748c2ecf20Sopenharmony_ci#define GST_RERRINFO_OFFSET0		0x44
14758c2ecf20Sopenharmony_ci#define GST_RERRINFO_OFFSET1		0x48
14768c2ecf20Sopenharmony_ci#define GST_RERRINFO_OFFSET2		0x4c
14778c2ecf20Sopenharmony_ci#define GST_RERRINFO_OFFSET3		0x50
14788c2ecf20Sopenharmony_ci#define GST_RERRINFO_OFFSET4		0x54
14798c2ecf20Sopenharmony_ci#define GST_RERRINFO_OFFSET5		0x58
14808c2ecf20Sopenharmony_ci#define GST_RERRINFO_OFFSET6		0x5c
14818c2ecf20Sopenharmony_ci#define GST_RERRINFO_OFFSET7		0x60
14828c2ecf20Sopenharmony_ci
14838c2ecf20Sopenharmony_ci/* General Status Table - MPI state */
14848c2ecf20Sopenharmony_ci#define GST_MPI_STATE_UNINIT		0x00
14858c2ecf20Sopenharmony_ci#define GST_MPI_STATE_INIT		0x01
14868c2ecf20Sopenharmony_ci#define GST_MPI_STATE_TERMINATION	0x02
14878c2ecf20Sopenharmony_ci#define GST_MPI_STATE_ERROR		0x03
14888c2ecf20Sopenharmony_ci#define GST_MPI_STATE_MASK		0x07
14898c2ecf20Sopenharmony_ci
14908c2ecf20Sopenharmony_ci/* Per SAS PHY Attributes */
14918c2ecf20Sopenharmony_ci
14928c2ecf20Sopenharmony_ci#define PSPA_PHYSTATE0_OFFSET		0x00 /* Dword V */
14938c2ecf20Sopenharmony_ci#define PSPA_OB_HW_EVENT_PID0_OFFSET	0x04 /* DWORD V+1 */
14948c2ecf20Sopenharmony_ci#define PSPA_PHYSTATE1_OFFSET		0x08 /* Dword V+2 */
14958c2ecf20Sopenharmony_ci#define PSPA_OB_HW_EVENT_PID1_OFFSET	0x0C /* DWORD V+3 */
14968c2ecf20Sopenharmony_ci#define PSPA_PHYSTATE2_OFFSET		0x10 /* Dword V+4 */
14978c2ecf20Sopenharmony_ci#define PSPA_OB_HW_EVENT_PID2_OFFSET	0x14 /* DWORD V+5 */
14988c2ecf20Sopenharmony_ci#define PSPA_PHYSTATE3_OFFSET		0x18 /* Dword V+6 */
14998c2ecf20Sopenharmony_ci#define PSPA_OB_HW_EVENT_PID3_OFFSET	0x1C /* DWORD V+7 */
15008c2ecf20Sopenharmony_ci#define PSPA_PHYSTATE4_OFFSET		0x20 /* Dword V+8 */
15018c2ecf20Sopenharmony_ci#define PSPA_OB_HW_EVENT_PID4_OFFSET	0x24 /* DWORD V+9 */
15028c2ecf20Sopenharmony_ci#define PSPA_PHYSTATE5_OFFSET		0x28 /* Dword V+10 */
15038c2ecf20Sopenharmony_ci#define PSPA_OB_HW_EVENT_PID5_OFFSET	0x2C /* DWORD V+11 */
15048c2ecf20Sopenharmony_ci#define PSPA_PHYSTATE6_OFFSET		0x30 /* Dword V+12 */
15058c2ecf20Sopenharmony_ci#define PSPA_OB_HW_EVENT_PID6_OFFSET	0x34 /* DWORD V+13 */
15068c2ecf20Sopenharmony_ci#define PSPA_PHYSTATE7_OFFSET		0x38 /* Dword V+14 */
15078c2ecf20Sopenharmony_ci#define PSPA_OB_HW_EVENT_PID7_OFFSET	0x3C /* DWORD V+15 */
15088c2ecf20Sopenharmony_ci#define PSPA_PHYSTATE8_OFFSET		0x40 /* DWORD V+16 */
15098c2ecf20Sopenharmony_ci#define PSPA_OB_HW_EVENT_PID8_OFFSET	0x44 /* DWORD V+17 */
15108c2ecf20Sopenharmony_ci#define PSPA_PHYSTATE9_OFFSET		0x48 /* DWORD V+18 */
15118c2ecf20Sopenharmony_ci#define PSPA_OB_HW_EVENT_PID9_OFFSET	0x4C /* DWORD V+19 */
15128c2ecf20Sopenharmony_ci#define PSPA_PHYSTATE10_OFFSET		0x50 /* DWORD V+20 */
15138c2ecf20Sopenharmony_ci#define PSPA_OB_HW_EVENT_PID10_OFFSET	0x54 /* DWORD V+21 */
15148c2ecf20Sopenharmony_ci#define PSPA_PHYSTATE11_OFFSET		0x58 /* DWORD V+22 */
15158c2ecf20Sopenharmony_ci#define PSPA_OB_HW_EVENT_PID11_OFFSET	0x5C /* DWORD V+23 */
15168c2ecf20Sopenharmony_ci#define PSPA_PHYSTATE12_OFFSET		0x60 /* DWORD V+24 */
15178c2ecf20Sopenharmony_ci#define PSPA_OB_HW_EVENT_PID12_OFFSET	0x64 /* DWORD V+25 */
15188c2ecf20Sopenharmony_ci#define PSPA_PHYSTATE13_OFFSET		0x68 /* DWORD V+26 */
15198c2ecf20Sopenharmony_ci#define PSPA_OB_HW_EVENT_PID13_OFFSET	0x6c /* DWORD V+27 */
15208c2ecf20Sopenharmony_ci#define PSPA_PHYSTATE14_OFFSET		0x70 /* DWORD V+28 */
15218c2ecf20Sopenharmony_ci#define PSPA_OB_HW_EVENT_PID14_OFFSET	0x74 /* DWORD V+29 */
15228c2ecf20Sopenharmony_ci#define PSPA_PHYSTATE15_OFFSET		0x78 /* DWORD V+30 */
15238c2ecf20Sopenharmony_ci#define PSPA_OB_HW_EVENT_PID15_OFFSET	0x7c /* DWORD V+31 */
15248c2ecf20Sopenharmony_ci/* end PSPA */
15258c2ecf20Sopenharmony_ci
15268c2ecf20Sopenharmony_ci/* inbound queue configuration offset - byte offset */
15278c2ecf20Sopenharmony_ci#define IB_PROPERITY_OFFSET		0x00
15288c2ecf20Sopenharmony_ci#define IB_BASE_ADDR_HI_OFFSET		0x04
15298c2ecf20Sopenharmony_ci#define IB_BASE_ADDR_LO_OFFSET		0x08
15308c2ecf20Sopenharmony_ci#define IB_CI_BASE_ADDR_HI_OFFSET	0x0C
15318c2ecf20Sopenharmony_ci#define IB_CI_BASE_ADDR_LO_OFFSET	0x10
15328c2ecf20Sopenharmony_ci#define IB_PIPCI_BAR			0x14
15338c2ecf20Sopenharmony_ci#define IB_PIPCI_BAR_OFFSET		0x18
15348c2ecf20Sopenharmony_ci#define IB_RESERVED_OFFSET		0x1C
15358c2ecf20Sopenharmony_ci
15368c2ecf20Sopenharmony_ci/* outbound queue configuration offset - byte offset */
15378c2ecf20Sopenharmony_ci#define OB_PROPERITY_OFFSET		0x00
15388c2ecf20Sopenharmony_ci#define OB_BASE_ADDR_HI_OFFSET		0x04
15398c2ecf20Sopenharmony_ci#define OB_BASE_ADDR_LO_OFFSET		0x08
15408c2ecf20Sopenharmony_ci#define OB_PI_BASE_ADDR_HI_OFFSET	0x0C
15418c2ecf20Sopenharmony_ci#define OB_PI_BASE_ADDR_LO_OFFSET	0x10
15428c2ecf20Sopenharmony_ci#define OB_CIPCI_BAR			0x14
15438c2ecf20Sopenharmony_ci#define OB_CIPCI_BAR_OFFSET		0x18
15448c2ecf20Sopenharmony_ci#define OB_INTERRUPT_COALES_OFFSET	0x1C
15458c2ecf20Sopenharmony_ci#define OB_DYNAMIC_COALES_OFFSET	0x20
15468c2ecf20Sopenharmony_ci#define OB_PROPERTY_INT_ENABLE		0x40000000
15478c2ecf20Sopenharmony_ci
15488c2ecf20Sopenharmony_ci#define MBIC_NMI_ENABLE_VPE0_IOP	0x000418
15498c2ecf20Sopenharmony_ci#define MBIC_NMI_ENABLE_VPE0_AAP1	0x000418
15508c2ecf20Sopenharmony_ci/* PCIE registers - BAR2(0x18), BAR1(win) 0x010000 */
15518c2ecf20Sopenharmony_ci#define PCIE_EVENT_INTERRUPT_ENABLE	0x003040
15528c2ecf20Sopenharmony_ci#define PCIE_EVENT_INTERRUPT		0x003044
15538c2ecf20Sopenharmony_ci#define PCIE_ERROR_INTERRUPT_ENABLE	0x003048
15548c2ecf20Sopenharmony_ci#define PCIE_ERROR_INTERRUPT		0x00304C
15558c2ecf20Sopenharmony_ci
15568c2ecf20Sopenharmony_ci/* SPCV soft reset */
15578c2ecf20Sopenharmony_ci#define SPC_REG_SOFT_RESET 0x00001000
15588c2ecf20Sopenharmony_ci#define SPCv_NORMAL_RESET_VALUE		0x1
15598c2ecf20Sopenharmony_ci
15608c2ecf20Sopenharmony_ci#define SPCv_SOFT_RESET_READ_MASK		0xC0
15618c2ecf20Sopenharmony_ci#define SPCv_SOFT_RESET_NO_RESET		0x0
15628c2ecf20Sopenharmony_ci#define SPCv_SOFT_RESET_NORMAL_RESET_OCCURED	0x40
15638c2ecf20Sopenharmony_ci#define SPCv_SOFT_RESET_HDA_MODE_OCCURED	0x80
15648c2ecf20Sopenharmony_ci#define SPCv_SOFT_RESET_CHIP_RESET_OCCURED	0xC0
15658c2ecf20Sopenharmony_ci
15668c2ecf20Sopenharmony_ci/* signature definition for host scratch pad0 register */
15678c2ecf20Sopenharmony_ci#define SPC_SOFT_RESET_SIGNATURE	0x252acbcd
15688c2ecf20Sopenharmony_ci/* Signature for Soft Reset */
15698c2ecf20Sopenharmony_ci
15708c2ecf20Sopenharmony_ci/* SPC Reset register - BAR4(0x20), BAR2(win) (need dynamic mapping) */
15718c2ecf20Sopenharmony_ci#define SPC_REG_RESET			0x000000/* reset register */
15728c2ecf20Sopenharmony_ci
15738c2ecf20Sopenharmony_ci/* bit definition for SPC_RESET register */
15748c2ecf20Sopenharmony_ci#define SPC_REG_RESET_OSSP		0x00000001
15758c2ecf20Sopenharmony_ci#define SPC_REG_RESET_RAAE		0x00000002
15768c2ecf20Sopenharmony_ci#define SPC_REG_RESET_PCS_SPBC		0x00000004
15778c2ecf20Sopenharmony_ci#define SPC_REG_RESET_PCS_IOP_SS	0x00000008
15788c2ecf20Sopenharmony_ci#define SPC_REG_RESET_PCS_AAP1_SS	0x00000010
15798c2ecf20Sopenharmony_ci#define SPC_REG_RESET_PCS_AAP2_SS	0x00000020
15808c2ecf20Sopenharmony_ci#define SPC_REG_RESET_PCS_LM		0x00000040
15818c2ecf20Sopenharmony_ci#define SPC_REG_RESET_PCS		0x00000080
15828c2ecf20Sopenharmony_ci#define SPC_REG_RESET_GSM		0x00000100
15838c2ecf20Sopenharmony_ci#define SPC_REG_RESET_DDR2		0x00010000
15848c2ecf20Sopenharmony_ci#define SPC_REG_RESET_BDMA_CORE		0x00020000
15858c2ecf20Sopenharmony_ci#define SPC_REG_RESET_BDMA_SXCBI	0x00040000
15868c2ecf20Sopenharmony_ci#define SPC_REG_RESET_PCIE_AL_SXCBI	0x00080000
15878c2ecf20Sopenharmony_ci#define SPC_REG_RESET_PCIE_PWR		0x00100000
15888c2ecf20Sopenharmony_ci#define SPC_REG_RESET_PCIE_SFT		0x00200000
15898c2ecf20Sopenharmony_ci#define SPC_REG_RESET_PCS_SXCBI		0x00400000
15908c2ecf20Sopenharmony_ci#define SPC_REG_RESET_LMS_SXCBI		0x00800000
15918c2ecf20Sopenharmony_ci#define SPC_REG_RESET_PMIC_SXCBI	0x01000000
15928c2ecf20Sopenharmony_ci#define SPC_REG_RESET_PMIC_CORE		0x02000000
15938c2ecf20Sopenharmony_ci#define SPC_REG_RESET_PCIE_PC_SXCBI	0x04000000
15948c2ecf20Sopenharmony_ci#define SPC_REG_RESET_DEVICE		0x80000000
15958c2ecf20Sopenharmony_ci
15968c2ecf20Sopenharmony_ci/* registers for BAR Shifting - BAR2(0x18), BAR1(win) */
15978c2ecf20Sopenharmony_ci#define SPCV_IBW_AXI_TRANSLATION_LOW	0x001010
15988c2ecf20Sopenharmony_ci
15998c2ecf20Sopenharmony_ci#define MBIC_AAP1_ADDR_BASE		0x060000
16008c2ecf20Sopenharmony_ci#define MBIC_IOP_ADDR_BASE		0x070000
16018c2ecf20Sopenharmony_ci#define GSM_ADDR_BASE			0x0700000
16028c2ecf20Sopenharmony_ci/* Dynamic map through Bar4 - 0x00700000 */
16038c2ecf20Sopenharmony_ci#define GSM_CONFIG_RESET		0x00000000
16048c2ecf20Sopenharmony_ci#define RAM_ECC_DB_ERR			0x00000018
16058c2ecf20Sopenharmony_ci#define GSM_READ_ADDR_PARITY_INDIC	0x00000058
16068c2ecf20Sopenharmony_ci#define GSM_WRITE_ADDR_PARITY_INDIC	0x00000060
16078c2ecf20Sopenharmony_ci#define GSM_WRITE_DATA_PARITY_INDIC	0x00000068
16088c2ecf20Sopenharmony_ci#define GSM_READ_ADDR_PARITY_CHECK	0x00000038
16098c2ecf20Sopenharmony_ci#define GSM_WRITE_ADDR_PARITY_CHECK	0x00000040
16108c2ecf20Sopenharmony_ci#define GSM_WRITE_DATA_PARITY_CHECK	0x00000048
16118c2ecf20Sopenharmony_ci
16128c2ecf20Sopenharmony_ci#define RB6_ACCESS_REG			0x6A0000
16138c2ecf20Sopenharmony_ci#define HDAC_EXEC_CMD			0x0002
16148c2ecf20Sopenharmony_ci#define HDA_C_PA			0xcb
16158c2ecf20Sopenharmony_ci#define HDA_SEQ_ID_BITS			0x00ff0000
16168c2ecf20Sopenharmony_ci#define HDA_GSM_OFFSET_BITS		0x00FFFFFF
16178c2ecf20Sopenharmony_ci#define HDA_GSM_CMD_OFFSET_BITS		0x42C0
16188c2ecf20Sopenharmony_ci#define HDA_GSM_RSP_OFFSET_BITS		0x42E0
16198c2ecf20Sopenharmony_ci
16208c2ecf20Sopenharmony_ci#define MBIC_AAP1_ADDR_BASE		0x060000
16218c2ecf20Sopenharmony_ci#define MBIC_IOP_ADDR_BASE		0x070000
16228c2ecf20Sopenharmony_ci#define GSM_ADDR_BASE			0x0700000
16238c2ecf20Sopenharmony_ci#define SPC_TOP_LEVEL_ADDR_BASE		0x000000
16248c2ecf20Sopenharmony_ci#define GSM_CONFIG_RESET_VALUE		0x00003b00
16258c2ecf20Sopenharmony_ci#define GPIO_ADDR_BASE			0x00090000
16268c2ecf20Sopenharmony_ci#define GPIO_GPIO_0_0UTPUT_CTL_OFFSET	0x0000010c
16278c2ecf20Sopenharmony_ci
16288c2ecf20Sopenharmony_ci/* RB6 offset */
16298c2ecf20Sopenharmony_ci#define SPC_RB6_OFFSET			0x80C0
16308c2ecf20Sopenharmony_ci/* Magic number of soft reset for RB6 */
16318c2ecf20Sopenharmony_ci#define RB6_MAGIC_NUMBER_RST		0x1234
16328c2ecf20Sopenharmony_ci
16338c2ecf20Sopenharmony_ci/* Device Register status */
16348c2ecf20Sopenharmony_ci#define DEVREG_SUCCESS					0x00
16358c2ecf20Sopenharmony_ci#define DEVREG_FAILURE_OUT_OF_RESOURCE			0x01
16368c2ecf20Sopenharmony_ci#define DEVREG_FAILURE_DEVICE_ALREADY_REGISTERED	0x02
16378c2ecf20Sopenharmony_ci#define DEVREG_FAILURE_INVALID_PHY_ID			0x03
16388c2ecf20Sopenharmony_ci#define DEVREG_FAILURE_PHY_ID_ALREADY_REGISTERED	0x04
16398c2ecf20Sopenharmony_ci#define DEVREG_FAILURE_PORT_ID_OUT_OF_RANGE		0x05
16408c2ecf20Sopenharmony_ci#define DEVREG_FAILURE_PORT_NOT_VALID_STATE		0x06
16418c2ecf20Sopenharmony_ci#define DEVREG_FAILURE_DEVICE_TYPE_NOT_VALID		0x07
16428c2ecf20Sopenharmony_ci
16438c2ecf20Sopenharmony_ci
16448c2ecf20Sopenharmony_ci#define MEMBASE_II_SHIFT_REGISTER       0x1010
16458c2ecf20Sopenharmony_ci#endif
1646