18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * PMC-Sierra SPC 8001 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#ifndef _PMC8001_REG_H_
418c2ecf20Sopenharmony_ci#define _PMC8001_REG_H_
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci#include <linux/types.h>
448c2ecf20Sopenharmony_ci#include <scsi/libsas.h>
458c2ecf20Sopenharmony_ci
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#define OPC_INB_SSPINIEXTIOSTART		8	/* 0x008 */
548c2ecf20Sopenharmony_ci#define OPC_INB_DEV_HANDLE_ACCEPT		9	/* 0x009 */
558c2ecf20Sopenharmony_ci#define OPC_INB_SSPTGTIOSTART			10	/* 0x00A */
568c2ecf20Sopenharmony_ci#define OPC_INB_SSPTGTRSPSTART			11	/* 0x00B */
578c2ecf20Sopenharmony_ci#define OPC_INB_SSPINIEDCIOSTART		12	/* 0x00C */
588c2ecf20Sopenharmony_ci#define OPC_INB_SSPINIEXTEDCIOSTART		13	/* 0x00D */
598c2ecf20Sopenharmony_ci#define OPC_INB_SSPTGTEDCIOSTART		14	/* 0x00E */
608c2ecf20Sopenharmony_ci#define OPC_INB_SSP_ABORT			15	/* 0x00F */
618c2ecf20Sopenharmony_ci#define OPC_INB_DEREG_DEV_HANDLE		16	/* 0x010 */
628c2ecf20Sopenharmony_ci#define OPC_INB_GET_DEV_HANDLE			17	/* 0x011 */
638c2ecf20Sopenharmony_ci#define OPC_INB_SMP_REQUEST			18	/* 0x012 */
648c2ecf20Sopenharmony_ci/* SMP_RESPONSE is removed */
658c2ecf20Sopenharmony_ci#define OPC_INB_SMP_RESPONSE			19	/* 0x013 */
668c2ecf20Sopenharmony_ci#define OPC_INB_SMP_ABORT			20	/* 0x014 */
678c2ecf20Sopenharmony_ci#define OPC_INB_REG_DEV				22	/* 0x016 */
688c2ecf20Sopenharmony_ci#define OPC_INB_SATA_HOST_OPSTART		23	/* 0x017 */
698c2ecf20Sopenharmony_ci#define OPC_INB_SATA_ABORT			24	/* 0x018 */
708c2ecf20Sopenharmony_ci#define OPC_INB_LOCAL_PHY_CONTROL		25	/* 0x019 */
718c2ecf20Sopenharmony_ci#define OPC_INB_GET_DEV_INFO			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#define OPC_INB_SAS_HW_EVENT_ACK		37	/* 0x025 */
778c2ecf20Sopenharmony_ci#define OPC_INB_GET_TIME_STAMP			38	/* 0x026 */
788c2ecf20Sopenharmony_ci#define OPC_INB_PORT_CONTROL			39	/* 0x027 */
798c2ecf20Sopenharmony_ci#define OPC_INB_GET_NVMD_DATA			40	/* 0x028 */
808c2ecf20Sopenharmony_ci#define OPC_INB_SET_NVMD_DATA			41	/* 0x029 */
818c2ecf20Sopenharmony_ci#define OPC_INB_SET_DEVICE_STATE		42	/* 0x02A */
828c2ecf20Sopenharmony_ci#define OPC_INB_GET_DEVICE_STATE		43	/* 0x02B */
838c2ecf20Sopenharmony_ci#define OPC_INB_SET_DEV_INFO			44	/* 0x02C */
848c2ecf20Sopenharmony_ci#define OPC_INB_SAS_RE_INITIALIZE		45	/* 0x02D */
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci/* for Response Opcode of IOMB */
878c2ecf20Sopenharmony_ci#define OPC_OUB_ECHO				1	/* 0x001 */
888c2ecf20Sopenharmony_ci#define OPC_OUB_HW_EVENT			4	/* 0x004 */
898c2ecf20Sopenharmony_ci#define OPC_OUB_SSP_COMP			5	/* 0x005 */
908c2ecf20Sopenharmony_ci#define OPC_OUB_SMP_COMP			6	/* 0x006 */
918c2ecf20Sopenharmony_ci#define OPC_OUB_LOCAL_PHY_CNTRL			7	/* 0x007 */
928c2ecf20Sopenharmony_ci#define OPC_OUB_DEV_REGIST			10	/* 0x00A */
938c2ecf20Sopenharmony_ci#define OPC_OUB_DEREG_DEV			11	/* 0x00B */
948c2ecf20Sopenharmony_ci#define OPC_OUB_GET_DEV_HANDLE			12	/* 0x00C */
958c2ecf20Sopenharmony_ci#define OPC_OUB_SATA_COMP			13	/* 0x00D */
968c2ecf20Sopenharmony_ci#define OPC_OUB_SATA_EVENT			14	/* 0x00E */
978c2ecf20Sopenharmony_ci#define OPC_OUB_SSP_EVENT			15	/* 0x00F */
988c2ecf20Sopenharmony_ci#define OPC_OUB_DEV_HANDLE_ARRIV		16	/* 0x010 */
998c2ecf20Sopenharmony_ci/* SMP_RECEIVED Notification is removed */
1008c2ecf20Sopenharmony_ci#define OPC_OUB_SMP_RECV_EVENT			17	/* 0x011 */
1018c2ecf20Sopenharmony_ci#define OPC_OUB_SSP_RECV_EVENT			18	/* 0x012 */
1028c2ecf20Sopenharmony_ci#define OPC_OUB_DEV_INFO			19	/* 0x013 */
1038c2ecf20Sopenharmony_ci#define OPC_OUB_FW_FLASH_UPDATE			20	/* 0x014 */
1048c2ecf20Sopenharmony_ci#define OPC_OUB_GPIO_RESPONSE			22	/* 0x016 */
1058c2ecf20Sopenharmony_ci#define OPC_OUB_GPIO_EVENT			23	/* 0x017 */
1068c2ecf20Sopenharmony_ci#define OPC_OUB_GENERAL_EVENT			24	/* 0x018 */
1078c2ecf20Sopenharmony_ci#define OPC_OUB_SSP_ABORT_RSP			26	/* 0x01A */
1088c2ecf20Sopenharmony_ci#define OPC_OUB_SATA_ABORT_RSP			27	/* 0x01B */
1098c2ecf20Sopenharmony_ci#define OPC_OUB_SAS_DIAG_MODE_START_END		28	/* 0x01C */
1108c2ecf20Sopenharmony_ci#define OPC_OUB_SAS_DIAG_EXECUTE		29	/* 0x01D */
1118c2ecf20Sopenharmony_ci#define OPC_OUB_GET_TIME_STAMP			30	/* 0x01E */
1128c2ecf20Sopenharmony_ci#define OPC_OUB_SAS_HW_EVENT_ACK		31	/* 0x01F */
1138c2ecf20Sopenharmony_ci#define OPC_OUB_PORT_CONTROL			32	/* 0x020 */
1148c2ecf20Sopenharmony_ci#define OPC_OUB_SKIP_ENTRY			33	/* 0x021 */
1158c2ecf20Sopenharmony_ci#define OPC_OUB_SMP_ABORT_RSP			34	/* 0x022 */
1168c2ecf20Sopenharmony_ci#define OPC_OUB_GET_NVMD_DATA			35	/* 0x023 */
1178c2ecf20Sopenharmony_ci#define OPC_OUB_SET_NVMD_DATA			36	/* 0x024 */
1188c2ecf20Sopenharmony_ci#define OPC_OUB_DEVICE_HANDLE_REMOVAL		37	/* 0x025 */
1198c2ecf20Sopenharmony_ci#define OPC_OUB_SET_DEVICE_STATE		38	/* 0x026 */
1208c2ecf20Sopenharmony_ci#define OPC_OUB_GET_DEVICE_STATE		39	/* 0x027 */
1218c2ecf20Sopenharmony_ci#define OPC_OUB_SET_DEV_INFO			40	/* 0x028 */
1228c2ecf20Sopenharmony_ci#define OPC_OUB_SAS_RE_INITIALIZE		41	/* 0x029 */
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_ci/* for phy start*/
1258c2ecf20Sopenharmony_ci#define SPINHOLD_DISABLE		(0x00 << 14)
1268c2ecf20Sopenharmony_ci#define SPINHOLD_ENABLE			(0x01 << 14)
1278c2ecf20Sopenharmony_ci#define LINKMODE_SAS			(0x01 << 12)
1288c2ecf20Sopenharmony_ci#define LINKMODE_DSATA			(0x02 << 12)
1298c2ecf20Sopenharmony_ci#define LINKMODE_AUTO			(0x03 << 12)
1308c2ecf20Sopenharmony_ci#define LINKRATE_15			(0x01 << 8)
1318c2ecf20Sopenharmony_ci#define LINKRATE_30			(0x02 << 8)
1328c2ecf20Sopenharmony_ci#define LINKRATE_60			(0x04 << 8)
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci/* for new SPC controllers MEMBASE III is shared between BIOS and DATA */
1358c2ecf20Sopenharmony_ci#define GSM_SM_BASE			0x4F0000
1368c2ecf20Sopenharmony_cistruct mpi_msg_hdr{
1378c2ecf20Sopenharmony_ci	__le32	header;	/* Bits [11:0]  - Message operation code */
1388c2ecf20Sopenharmony_ci	/* Bits [15:12] - Message Category */
1398c2ecf20Sopenharmony_ci	/* Bits [21:16] - Outboundqueue ID for the
1408c2ecf20Sopenharmony_ci	operation completion message */
1418c2ecf20Sopenharmony_ci	/* Bits [23:22] - Reserved */
1428c2ecf20Sopenharmony_ci	/* Bits [28:24] - Buffer Count, indicates how
1438c2ecf20Sopenharmony_ci	many buffer are allocated for the massage */
1448c2ecf20Sopenharmony_ci	/* Bits [30:29] - Reserved */
1458c2ecf20Sopenharmony_ci	/* Bits [31] - Message Valid bit */
1468c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_ci/*
1508c2ecf20Sopenharmony_ci * brief the data structure of PHY Start Command
1518c2ecf20Sopenharmony_ci * use to describe enable the phy (64 bytes)
1528c2ecf20Sopenharmony_ci */
1538c2ecf20Sopenharmony_cistruct phy_start_req {
1548c2ecf20Sopenharmony_ci	__le32	tag;
1558c2ecf20Sopenharmony_ci	__le32	ase_sh_lm_slr_phyid;
1568c2ecf20Sopenharmony_ci	struct sas_identify_frame sas_identify;
1578c2ecf20Sopenharmony_ci	u32	reserved[5];
1588c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
1598c2ecf20Sopenharmony_ci
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_ci/*
1628c2ecf20Sopenharmony_ci * brief the data structure of PHY Start Command
1638c2ecf20Sopenharmony_ci * use to disable the phy (64 bytes)
1648c2ecf20Sopenharmony_ci */
1658c2ecf20Sopenharmony_cistruct phy_stop_req {
1668c2ecf20Sopenharmony_ci	__le32	tag;
1678c2ecf20Sopenharmony_ci	__le32	phy_id;
1688c2ecf20Sopenharmony_ci	u32	reserved[13];
1698c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
1708c2ecf20Sopenharmony_ci
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_ci/* set device bits fis - device to host */
1738c2ecf20Sopenharmony_cistruct  set_dev_bits_fis {
1748c2ecf20Sopenharmony_ci	u8	fis_type;	/* 0xA1*/
1758c2ecf20Sopenharmony_ci	u8	n_i_pmport;
1768c2ecf20Sopenharmony_ci	/* b7 : n Bit. Notification bit. If set device needs attention. */
1778c2ecf20Sopenharmony_ci	/* b6 : i Bit. Interrupt Bit */
1788c2ecf20Sopenharmony_ci	/* b5-b4: reserved2 */
1798c2ecf20Sopenharmony_ci	/* b3-b0: PM Port */
1808c2ecf20Sopenharmony_ci	u8 	status;
1818c2ecf20Sopenharmony_ci	u8	error;
1828c2ecf20Sopenharmony_ci	u32	_r_a;
1838c2ecf20Sopenharmony_ci} __attribute__ ((packed));
1848c2ecf20Sopenharmony_ci/* PIO setup FIS - device to host */
1858c2ecf20Sopenharmony_cistruct  pio_setup_fis {
1868c2ecf20Sopenharmony_ci	u8	fis_type;	/* 0x5f */
1878c2ecf20Sopenharmony_ci	u8	i_d_pmPort;
1888c2ecf20Sopenharmony_ci	/* b7 : reserved */
1898c2ecf20Sopenharmony_ci	/* b6 : i bit. Interrupt bit */
1908c2ecf20Sopenharmony_ci	/* b5 : d bit. data transfer direction. set to 1 for device to host
1918c2ecf20Sopenharmony_ci	xfer */
1928c2ecf20Sopenharmony_ci	/* b4 : reserved */
1938c2ecf20Sopenharmony_ci	/* b3-b0: PM Port */
1948c2ecf20Sopenharmony_ci	u8	status;
1958c2ecf20Sopenharmony_ci	u8	error;
1968c2ecf20Sopenharmony_ci	u8	lbal;
1978c2ecf20Sopenharmony_ci	u8	lbam;
1988c2ecf20Sopenharmony_ci	u8	lbah;
1998c2ecf20Sopenharmony_ci	u8	device;
2008c2ecf20Sopenharmony_ci	u8	lbal_exp;
2018c2ecf20Sopenharmony_ci	u8	lbam_exp;
2028c2ecf20Sopenharmony_ci	u8	lbah_exp;
2038c2ecf20Sopenharmony_ci	u8	_r_a;
2048c2ecf20Sopenharmony_ci	u8	sector_count;
2058c2ecf20Sopenharmony_ci	u8	sector_count_exp;
2068c2ecf20Sopenharmony_ci	u8	_r_b;
2078c2ecf20Sopenharmony_ci	u8	e_status;
2088c2ecf20Sopenharmony_ci	u8	_r_c[2];
2098c2ecf20Sopenharmony_ci	u8	transfer_count;
2108c2ecf20Sopenharmony_ci} __attribute__ ((packed));
2118c2ecf20Sopenharmony_ci
2128c2ecf20Sopenharmony_ci/*
2138c2ecf20Sopenharmony_ci * brief the data structure of SATA Completion Response
2148c2ecf20Sopenharmony_ci * use to describe the sata task response (64 bytes)
2158c2ecf20Sopenharmony_ci */
2168c2ecf20Sopenharmony_cistruct sata_completion_resp {
2178c2ecf20Sopenharmony_ci	__le32	tag;
2188c2ecf20Sopenharmony_ci	__le32	status;
2198c2ecf20Sopenharmony_ci	__le32	param;
2208c2ecf20Sopenharmony_ci	u32	sata_resp[12];
2218c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
2228c2ecf20Sopenharmony_ci
2238c2ecf20Sopenharmony_ci
2248c2ecf20Sopenharmony_ci/*
2258c2ecf20Sopenharmony_ci * brief the data structure of SAS HW Event Notification
2268c2ecf20Sopenharmony_ci * use to alert the host about the hardware event(64 bytes)
2278c2ecf20Sopenharmony_ci */
2288c2ecf20Sopenharmony_cistruct hw_event_resp {
2298c2ecf20Sopenharmony_ci	__le32	lr_evt_status_phyid_portid;
2308c2ecf20Sopenharmony_ci	__le32	evt_param;
2318c2ecf20Sopenharmony_ci	__le32	npip_portstate;
2328c2ecf20Sopenharmony_ci	struct sas_identify_frame	sas_identify;
2338c2ecf20Sopenharmony_ci	struct dev_to_host_fis	sata_fis;
2348c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
2358c2ecf20Sopenharmony_ci
2368c2ecf20Sopenharmony_ci
2378c2ecf20Sopenharmony_ci/*
2388c2ecf20Sopenharmony_ci * brief the data structure of  REGISTER DEVICE Command
2398c2ecf20Sopenharmony_ci * use to describe MPI REGISTER DEVICE Command (64 bytes)
2408c2ecf20Sopenharmony_ci */
2418c2ecf20Sopenharmony_ci
2428c2ecf20Sopenharmony_cistruct reg_dev_req {
2438c2ecf20Sopenharmony_ci	__le32	tag;
2448c2ecf20Sopenharmony_ci	__le32	phyid_portid;
2458c2ecf20Sopenharmony_ci	__le32	dtype_dlr_retry;
2468c2ecf20Sopenharmony_ci	__le32	firstburstsize_ITNexustimeout;
2478c2ecf20Sopenharmony_ci	u8	sas_addr[SAS_ADDR_SIZE];
2488c2ecf20Sopenharmony_ci	__le32	upper_device_id;
2498c2ecf20Sopenharmony_ci	u32	reserved[8];
2508c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
2518c2ecf20Sopenharmony_ci
2528c2ecf20Sopenharmony_ci
2538c2ecf20Sopenharmony_ci/*
2548c2ecf20Sopenharmony_ci * brief the data structure of  DEREGISTER DEVICE Command
2558c2ecf20Sopenharmony_ci * use to request spc to remove all internal resources associated
2568c2ecf20Sopenharmony_ci * with the device id (64 bytes)
2578c2ecf20Sopenharmony_ci */
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_cistruct dereg_dev_req {
2608c2ecf20Sopenharmony_ci	__le32	tag;
2618c2ecf20Sopenharmony_ci	__le32	device_id;
2628c2ecf20Sopenharmony_ci	u32	reserved[13];
2638c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
2648c2ecf20Sopenharmony_ci
2658c2ecf20Sopenharmony_ci
2668c2ecf20Sopenharmony_ci/*
2678c2ecf20Sopenharmony_ci * brief the data structure of DEVICE_REGISTRATION Response
2688c2ecf20Sopenharmony_ci * use to notify the completion of the device registration  (64 bytes)
2698c2ecf20Sopenharmony_ci */
2708c2ecf20Sopenharmony_ci
2718c2ecf20Sopenharmony_cistruct dev_reg_resp {
2728c2ecf20Sopenharmony_ci	__le32	tag;
2738c2ecf20Sopenharmony_ci	__le32	status;
2748c2ecf20Sopenharmony_ci	__le32	device_id;
2758c2ecf20Sopenharmony_ci	u32	reserved[12];
2768c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
2778c2ecf20Sopenharmony_ci
2788c2ecf20Sopenharmony_ci
2798c2ecf20Sopenharmony_ci/*
2808c2ecf20Sopenharmony_ci * brief the data structure of Local PHY Control Command
2818c2ecf20Sopenharmony_ci * use to issue PHY CONTROL to local phy (64 bytes)
2828c2ecf20Sopenharmony_ci */
2838c2ecf20Sopenharmony_cistruct local_phy_ctl_req {
2848c2ecf20Sopenharmony_ci	__le32	tag;
2858c2ecf20Sopenharmony_ci	__le32	phyop_phyid;
2868c2ecf20Sopenharmony_ci	u32	reserved1[13];
2878c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_ci
2908c2ecf20Sopenharmony_ci/**
2918c2ecf20Sopenharmony_ci * brief the data structure of Local Phy Control Response
2928c2ecf20Sopenharmony_ci * use to describe MPI Local Phy Control Response (64 bytes)
2938c2ecf20Sopenharmony_ci */
2948c2ecf20Sopenharmony_cistruct local_phy_ctl_resp {
2958c2ecf20Sopenharmony_ci	__le32	tag;
2968c2ecf20Sopenharmony_ci	__le32	phyop_phyid;
2978c2ecf20Sopenharmony_ci	__le32	status;
2988c2ecf20Sopenharmony_ci	u32	reserved[12];
2998c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
3008c2ecf20Sopenharmony_ci
3018c2ecf20Sopenharmony_ci
3028c2ecf20Sopenharmony_ci#define OP_BITS 0x0000FF00
3038c2ecf20Sopenharmony_ci#define ID_BITS 0x000000FF
3048c2ecf20Sopenharmony_ci
3058c2ecf20Sopenharmony_ci/*
3068c2ecf20Sopenharmony_ci * brief the data structure of PORT Control Command
3078c2ecf20Sopenharmony_ci * use to control port properties (64 bytes)
3088c2ecf20Sopenharmony_ci */
3098c2ecf20Sopenharmony_ci
3108c2ecf20Sopenharmony_cistruct port_ctl_req {
3118c2ecf20Sopenharmony_ci	__le32	tag;
3128c2ecf20Sopenharmony_ci	__le32	portop_portid;
3138c2ecf20Sopenharmony_ci	__le32	param0;
3148c2ecf20Sopenharmony_ci	__le32	param1;
3158c2ecf20Sopenharmony_ci	u32	reserved1[11];
3168c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
3178c2ecf20Sopenharmony_ci
3188c2ecf20Sopenharmony_ci
3198c2ecf20Sopenharmony_ci/*
3208c2ecf20Sopenharmony_ci * brief the data structure of HW Event Ack Command
3218c2ecf20Sopenharmony_ci * use to acknowledge receive HW event (64 bytes)
3228c2ecf20Sopenharmony_ci */
3238c2ecf20Sopenharmony_ci
3248c2ecf20Sopenharmony_cistruct hw_event_ack_req {
3258c2ecf20Sopenharmony_ci	__le32	tag;
3268c2ecf20Sopenharmony_ci	__le32	sea_phyid_portid;
3278c2ecf20Sopenharmony_ci	__le32	param0;
3288c2ecf20Sopenharmony_ci	__le32	param1;
3298c2ecf20Sopenharmony_ci	u32	reserved1[11];
3308c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
3318c2ecf20Sopenharmony_ci
3328c2ecf20Sopenharmony_ci
3338c2ecf20Sopenharmony_ci/*
3348c2ecf20Sopenharmony_ci * brief the data structure of SSP Completion Response
3358c2ecf20Sopenharmony_ci * use to indicate a SSP Completion  (n bytes)
3368c2ecf20Sopenharmony_ci */
3378c2ecf20Sopenharmony_cistruct ssp_completion_resp {
3388c2ecf20Sopenharmony_ci	__le32	tag;
3398c2ecf20Sopenharmony_ci	__le32	status;
3408c2ecf20Sopenharmony_ci	__le32	param;
3418c2ecf20Sopenharmony_ci	__le32	ssptag_rescv_rescpad;
3428c2ecf20Sopenharmony_ci	struct ssp_response_iu  ssp_resp_iu;
3438c2ecf20Sopenharmony_ci	__le32	residual_count;
3448c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
3458c2ecf20Sopenharmony_ci
3468c2ecf20Sopenharmony_ci
3478c2ecf20Sopenharmony_ci#define SSP_RESCV_BIT	0x00010000
3488c2ecf20Sopenharmony_ci
3498c2ecf20Sopenharmony_ci/*
3508c2ecf20Sopenharmony_ci * brief the data structure of SATA EVNET esponse
3518c2ecf20Sopenharmony_ci * use to indicate a SATA Completion  (64 bytes)
3528c2ecf20Sopenharmony_ci */
3538c2ecf20Sopenharmony_ci
3548c2ecf20Sopenharmony_cistruct sata_event_resp {
3558c2ecf20Sopenharmony_ci	__le32	tag;
3568c2ecf20Sopenharmony_ci	__le32	event;
3578c2ecf20Sopenharmony_ci	__le32	port_id;
3588c2ecf20Sopenharmony_ci	__le32	device_id;
3598c2ecf20Sopenharmony_ci	u32	reserved[11];
3608c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
3618c2ecf20Sopenharmony_ci
3628c2ecf20Sopenharmony_ci/*
3638c2ecf20Sopenharmony_ci * brief the data structure of SSP EVNET esponse
3648c2ecf20Sopenharmony_ci * use to indicate a SSP Completion  (64 bytes)
3658c2ecf20Sopenharmony_ci */
3668c2ecf20Sopenharmony_ci
3678c2ecf20Sopenharmony_cistruct ssp_event_resp {
3688c2ecf20Sopenharmony_ci	__le32	tag;
3698c2ecf20Sopenharmony_ci	__le32	event;
3708c2ecf20Sopenharmony_ci	__le32	port_id;
3718c2ecf20Sopenharmony_ci	__le32	device_id;
3728c2ecf20Sopenharmony_ci	u32	reserved[11];
3738c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
3748c2ecf20Sopenharmony_ci
3758c2ecf20Sopenharmony_ci/**
3768c2ecf20Sopenharmony_ci * brief the data structure of General Event Notification Response
3778c2ecf20Sopenharmony_ci * use to describe MPI General Event Notification Response (64 bytes)
3788c2ecf20Sopenharmony_ci */
3798c2ecf20Sopenharmony_cistruct general_event_resp {
3808c2ecf20Sopenharmony_ci	__le32	status;
3818c2ecf20Sopenharmony_ci	__le32	inb_IOMB_payload[14];
3828c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
3838c2ecf20Sopenharmony_ci
3848c2ecf20Sopenharmony_ci
3858c2ecf20Sopenharmony_ci#define GENERAL_EVENT_PAYLOAD	14
3868c2ecf20Sopenharmony_ci#define OPCODE_BITS	0x00000fff
3878c2ecf20Sopenharmony_ci
3888c2ecf20Sopenharmony_ci/*
3898c2ecf20Sopenharmony_ci * brief the data structure of SMP Request Command
3908c2ecf20Sopenharmony_ci * use to describe MPI SMP REQUEST Command (64 bytes)
3918c2ecf20Sopenharmony_ci */
3928c2ecf20Sopenharmony_cistruct smp_req {
3938c2ecf20Sopenharmony_ci	__le32	tag;
3948c2ecf20Sopenharmony_ci	__le32	device_id;
3958c2ecf20Sopenharmony_ci	__le32	len_ip_ir;
3968c2ecf20Sopenharmony_ci	/* Bits [0]  - Indirect response */
3978c2ecf20Sopenharmony_ci	/* Bits [1] - Indirect Payload */
3988c2ecf20Sopenharmony_ci	/* Bits [15:2] - Reserved */
3998c2ecf20Sopenharmony_ci	/* Bits [23:16] - direct payload Len */
4008c2ecf20Sopenharmony_ci	/* Bits [31:24] - Reserved */
4018c2ecf20Sopenharmony_ci	u8	smp_req16[16];
4028c2ecf20Sopenharmony_ci	union {
4038c2ecf20Sopenharmony_ci		u8	smp_req[32];
4048c2ecf20Sopenharmony_ci		struct {
4058c2ecf20Sopenharmony_ci			__le64 long_req_addr;/* sg dma address, LE */
4068c2ecf20Sopenharmony_ci			__le32 long_req_size;/* LE */
4078c2ecf20Sopenharmony_ci			u32	_r_a;
4088c2ecf20Sopenharmony_ci			__le64 long_resp_addr;/* sg dma address, LE */
4098c2ecf20Sopenharmony_ci			__le32 long_resp_size;/* LE */
4108c2ecf20Sopenharmony_ci			u32	_r_b;
4118c2ecf20Sopenharmony_ci			} long_smp_req;/* sequencer extension */
4128c2ecf20Sopenharmony_ci	};
4138c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
4148c2ecf20Sopenharmony_ci/*
4158c2ecf20Sopenharmony_ci * brief the data structure of SMP Completion Response
4168c2ecf20Sopenharmony_ci * use to describe MPI SMP Completion Response (64 bytes)
4178c2ecf20Sopenharmony_ci */
4188c2ecf20Sopenharmony_cistruct smp_completion_resp {
4198c2ecf20Sopenharmony_ci	__le32	tag;
4208c2ecf20Sopenharmony_ci	__le32	status;
4218c2ecf20Sopenharmony_ci	__le32	param;
4228c2ecf20Sopenharmony_ci	__le32	_r_a[12];
4238c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
4248c2ecf20Sopenharmony_ci
4258c2ecf20Sopenharmony_ci/*
4268c2ecf20Sopenharmony_ci *brief the data structure of SSP SMP SATA Abort Command
4278c2ecf20Sopenharmony_ci * use to describe MPI SSP SMP & SATA Abort Command (64 bytes)
4288c2ecf20Sopenharmony_ci */
4298c2ecf20Sopenharmony_cistruct task_abort_req {
4308c2ecf20Sopenharmony_ci	__le32	tag;
4318c2ecf20Sopenharmony_ci	__le32	device_id;
4328c2ecf20Sopenharmony_ci	__le32	tag_to_abort;
4338c2ecf20Sopenharmony_ci	__le32	abort_all;
4348c2ecf20Sopenharmony_ci	u32	reserved[11];
4358c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
4368c2ecf20Sopenharmony_ci
4378c2ecf20Sopenharmony_ci/* These flags used for SSP SMP & SATA Abort */
4388c2ecf20Sopenharmony_ci#define ABORT_MASK		0x3
4398c2ecf20Sopenharmony_ci#define ABORT_SINGLE		0x0
4408c2ecf20Sopenharmony_ci#define ABORT_ALL		0x1
4418c2ecf20Sopenharmony_ci
4428c2ecf20Sopenharmony_ci/**
4438c2ecf20Sopenharmony_ci * brief the data structure of SSP SATA SMP Abort Response
4448c2ecf20Sopenharmony_ci * use to describe SSP SMP & SATA Abort Response ( 64 bytes)
4458c2ecf20Sopenharmony_ci */
4468c2ecf20Sopenharmony_cistruct task_abort_resp {
4478c2ecf20Sopenharmony_ci	__le32	tag;
4488c2ecf20Sopenharmony_ci	__le32	status;
4498c2ecf20Sopenharmony_ci	__le32	scp;
4508c2ecf20Sopenharmony_ci	u32	reserved[12];
4518c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
4528c2ecf20Sopenharmony_ci
4538c2ecf20Sopenharmony_ci
4548c2ecf20Sopenharmony_ci/**
4558c2ecf20Sopenharmony_ci * brief the data structure of SAS Diagnostic Start/End Command
4568c2ecf20Sopenharmony_ci * use to describe MPI SAS Diagnostic Start/End Command (64 bytes)
4578c2ecf20Sopenharmony_ci */
4588c2ecf20Sopenharmony_cistruct sas_diag_start_end_req {
4598c2ecf20Sopenharmony_ci	__le32	tag;
4608c2ecf20Sopenharmony_ci	__le32	operation_phyid;
4618c2ecf20Sopenharmony_ci	u32	reserved[13];
4628c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
4638c2ecf20Sopenharmony_ci
4648c2ecf20Sopenharmony_ci
4658c2ecf20Sopenharmony_ci/**
4668c2ecf20Sopenharmony_ci * brief the data structure of SAS Diagnostic Execute Command
4678c2ecf20Sopenharmony_ci * use to describe MPI SAS Diagnostic Execute Command (64 bytes)
4688c2ecf20Sopenharmony_ci */
4698c2ecf20Sopenharmony_cistruct sas_diag_execute_req{
4708c2ecf20Sopenharmony_ci	__le32	tag;
4718c2ecf20Sopenharmony_ci	__le32	cmdtype_cmddesc_phyid;
4728c2ecf20Sopenharmony_ci	__le32	pat1_pat2;
4738c2ecf20Sopenharmony_ci	__le32	threshold;
4748c2ecf20Sopenharmony_ci	__le32	codepat_errmsk;
4758c2ecf20Sopenharmony_ci	__le32	pmon;
4768c2ecf20Sopenharmony_ci	__le32	pERF1CTL;
4778c2ecf20Sopenharmony_ci	u32	reserved[8];
4788c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
4798c2ecf20Sopenharmony_ci
4808c2ecf20Sopenharmony_ci
4818c2ecf20Sopenharmony_ci#define SAS_DIAG_PARAM_BYTES 24
4828c2ecf20Sopenharmony_ci
4838c2ecf20Sopenharmony_ci/*
4848c2ecf20Sopenharmony_ci * brief the data structure of Set Device State Command
4858c2ecf20Sopenharmony_ci * use to describe MPI Set Device State Command (64 bytes)
4868c2ecf20Sopenharmony_ci */
4878c2ecf20Sopenharmony_cistruct set_dev_state_req {
4888c2ecf20Sopenharmony_ci	__le32	tag;
4898c2ecf20Sopenharmony_ci	__le32	device_id;
4908c2ecf20Sopenharmony_ci	__le32	nds;
4918c2ecf20Sopenharmony_ci	u32	reserved[12];
4928c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
4938c2ecf20Sopenharmony_ci
4948c2ecf20Sopenharmony_ci/*
4958c2ecf20Sopenharmony_ci * brief the data structure of sas_re_initialization
4968c2ecf20Sopenharmony_ci */
4978c2ecf20Sopenharmony_cistruct sas_re_initialization_req {
4988c2ecf20Sopenharmony_ci
4998c2ecf20Sopenharmony_ci	__le32	tag;
5008c2ecf20Sopenharmony_ci	__le32	SSAHOLT;/* bit29-set max port;
5018c2ecf20Sopenharmony_ci			** bit28-set open reject cmd retries.
5028c2ecf20Sopenharmony_ci			** bit27-set open reject data retries.
5038c2ecf20Sopenharmony_ci			** bit26-set open reject option, remap:1 or not:0.
5048c2ecf20Sopenharmony_ci			** bit25-set sata head of line time out.
5058c2ecf20Sopenharmony_ci			*/
5068c2ecf20Sopenharmony_ci	__le32 reserved_maxPorts;
5078c2ecf20Sopenharmony_ci	__le32 open_reject_cmdretries_data_retries;/* cmd retries: 31-bit16;
5088c2ecf20Sopenharmony_ci						    * data retries: bit15-bit0.
5098c2ecf20Sopenharmony_ci						    */
5108c2ecf20Sopenharmony_ci	__le32	sata_hol_tmo;
5118c2ecf20Sopenharmony_ci	u32	reserved1[10];
5128c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
5138c2ecf20Sopenharmony_ci
5148c2ecf20Sopenharmony_ci/*
5158c2ecf20Sopenharmony_ci * brief the data structure of SATA Start Command
5168c2ecf20Sopenharmony_ci * use to describe MPI SATA IO Start Command (64 bytes)
5178c2ecf20Sopenharmony_ci */
5188c2ecf20Sopenharmony_ci
5198c2ecf20Sopenharmony_cistruct sata_start_req {
5208c2ecf20Sopenharmony_ci	__le32	tag;
5218c2ecf20Sopenharmony_ci	__le32	device_id;
5228c2ecf20Sopenharmony_ci	__le32	data_len;
5238c2ecf20Sopenharmony_ci	__le32	ncqtag_atap_dir_m;
5248c2ecf20Sopenharmony_ci	struct host_to_dev_fis	sata_fis;
5258c2ecf20Sopenharmony_ci	u32	reserved1;
5268c2ecf20Sopenharmony_ci	u32	reserved2;
5278c2ecf20Sopenharmony_ci	u32	addr_low;
5288c2ecf20Sopenharmony_ci	u32	addr_high;
5298c2ecf20Sopenharmony_ci	__le32	len;
5308c2ecf20Sopenharmony_ci	__le32	esgl;
5318c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
5328c2ecf20Sopenharmony_ci
5338c2ecf20Sopenharmony_ci/**
5348c2ecf20Sopenharmony_ci * brief the data structure of SSP INI TM Start Command
5358c2ecf20Sopenharmony_ci * use to describe MPI SSP INI TM Start Command (64 bytes)
5368c2ecf20Sopenharmony_ci */
5378c2ecf20Sopenharmony_cistruct ssp_ini_tm_start_req {
5388c2ecf20Sopenharmony_ci	__le32	tag;
5398c2ecf20Sopenharmony_ci	__le32	device_id;
5408c2ecf20Sopenharmony_ci	__le32	relate_tag;
5418c2ecf20Sopenharmony_ci	__le32	tmf;
5428c2ecf20Sopenharmony_ci	u8	lun[8];
5438c2ecf20Sopenharmony_ci	__le32	ds_ads_m;
5448c2ecf20Sopenharmony_ci	u32	reserved[8];
5458c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
5468c2ecf20Sopenharmony_ci
5478c2ecf20Sopenharmony_ci
5488c2ecf20Sopenharmony_cistruct ssp_info_unit {
5498c2ecf20Sopenharmony_ci	u8	lun[8];/* SCSI Logical Unit Number */
5508c2ecf20Sopenharmony_ci	u8	reserved1;/* reserved */
5518c2ecf20Sopenharmony_ci	u8	efb_prio_attr;
5528c2ecf20Sopenharmony_ci	/* B7   : enabledFirstBurst */
5538c2ecf20Sopenharmony_ci	/* B6-3 : taskPriority */
5548c2ecf20Sopenharmony_ci	/* B2-0 : taskAttribute */
5558c2ecf20Sopenharmony_ci	u8	reserved2;	/* reserved */
5568c2ecf20Sopenharmony_ci	u8	additional_cdb_len;
5578c2ecf20Sopenharmony_ci	/* B7-2 : additional_cdb_len */
5588c2ecf20Sopenharmony_ci	/* B1-0 : reserved */
5598c2ecf20Sopenharmony_ci	u8	cdb[16];/* The SCSI CDB up to 16 bytes length */
5608c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
5618c2ecf20Sopenharmony_ci
5628c2ecf20Sopenharmony_ci
5638c2ecf20Sopenharmony_ci/**
5648c2ecf20Sopenharmony_ci * brief the data structure of SSP INI IO Start Command
5658c2ecf20Sopenharmony_ci * use to describe MPI SSP INI IO Start Command (64 bytes)
5668c2ecf20Sopenharmony_ci */
5678c2ecf20Sopenharmony_cistruct ssp_ini_io_start_req {
5688c2ecf20Sopenharmony_ci	__le32	tag;
5698c2ecf20Sopenharmony_ci	__le32	device_id;
5708c2ecf20Sopenharmony_ci	__le32	data_len;
5718c2ecf20Sopenharmony_ci	__le32	dir_m_tlr;
5728c2ecf20Sopenharmony_ci	struct ssp_info_unit	ssp_iu;
5738c2ecf20Sopenharmony_ci	__le32	addr_low;
5748c2ecf20Sopenharmony_ci	__le32	addr_high;
5758c2ecf20Sopenharmony_ci	__le32	len;
5768c2ecf20Sopenharmony_ci	__le32	esgl;
5778c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
5788c2ecf20Sopenharmony_ci
5798c2ecf20Sopenharmony_ci
5808c2ecf20Sopenharmony_ci/**
5818c2ecf20Sopenharmony_ci * brief the data structure of Firmware download
5828c2ecf20Sopenharmony_ci * use to describe MPI FW DOWNLOAD Command (64 bytes)
5838c2ecf20Sopenharmony_ci */
5848c2ecf20Sopenharmony_cistruct fw_flash_Update_req {
5858c2ecf20Sopenharmony_ci	__le32	tag;
5868c2ecf20Sopenharmony_ci	__le32	cur_image_offset;
5878c2ecf20Sopenharmony_ci	__le32	cur_image_len;
5888c2ecf20Sopenharmony_ci	__le32	total_image_len;
5898c2ecf20Sopenharmony_ci	u32	reserved0[7];
5908c2ecf20Sopenharmony_ci	__le32	sgl_addr_lo;
5918c2ecf20Sopenharmony_ci	__le32	sgl_addr_hi;
5928c2ecf20Sopenharmony_ci	__le32	len;
5938c2ecf20Sopenharmony_ci	__le32	ext_reserved;
5948c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
5958c2ecf20Sopenharmony_ci
5968c2ecf20Sopenharmony_ci
5978c2ecf20Sopenharmony_ci#define FWFLASH_IOMB_RESERVED_LEN 0x07
5988c2ecf20Sopenharmony_ci/**
5998c2ecf20Sopenharmony_ci * brief the data structure of FW_FLASH_UPDATE Response
6008c2ecf20Sopenharmony_ci * use to describe MPI FW_FLASH_UPDATE Response (64 bytes)
6018c2ecf20Sopenharmony_ci *
6028c2ecf20Sopenharmony_ci */
6038c2ecf20Sopenharmony_cistruct fw_flash_Update_resp {
6048c2ecf20Sopenharmony_ci	__le32	tag;
6058c2ecf20Sopenharmony_ci	__le32	status;
6068c2ecf20Sopenharmony_ci	u32	reserved[13];
6078c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
6088c2ecf20Sopenharmony_ci
6098c2ecf20Sopenharmony_ci
6108c2ecf20Sopenharmony_ci/**
6118c2ecf20Sopenharmony_ci * brief the data structure of Get NVM Data Command
6128c2ecf20Sopenharmony_ci * use to get data from NVM in HBA(64 bytes)
6138c2ecf20Sopenharmony_ci */
6148c2ecf20Sopenharmony_cistruct get_nvm_data_req {
6158c2ecf20Sopenharmony_ci	__le32	tag;
6168c2ecf20Sopenharmony_ci	__le32	len_ir_vpdd;
6178c2ecf20Sopenharmony_ci	__le32	vpd_offset;
6188c2ecf20Sopenharmony_ci	u32	reserved[8];
6198c2ecf20Sopenharmony_ci	__le32	resp_addr_lo;
6208c2ecf20Sopenharmony_ci	__le32	resp_addr_hi;
6218c2ecf20Sopenharmony_ci	__le32	resp_len;
6228c2ecf20Sopenharmony_ci	u32	reserved1;
6238c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
6248c2ecf20Sopenharmony_ci
6258c2ecf20Sopenharmony_ci
6268c2ecf20Sopenharmony_cistruct set_nvm_data_req {
6278c2ecf20Sopenharmony_ci	__le32	tag;
6288c2ecf20Sopenharmony_ci	__le32	len_ir_vpdd;
6298c2ecf20Sopenharmony_ci	__le32	vpd_offset;
6308c2ecf20Sopenharmony_ci	__le32	reserved[8];
6318c2ecf20Sopenharmony_ci	__le32	resp_addr_lo;
6328c2ecf20Sopenharmony_ci	__le32	resp_addr_hi;
6338c2ecf20Sopenharmony_ci	__le32	resp_len;
6348c2ecf20Sopenharmony_ci	u32	reserved1;
6358c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
6368c2ecf20Sopenharmony_ci
6378c2ecf20Sopenharmony_ci
6388c2ecf20Sopenharmony_ci#define TWI_DEVICE	0x0
6398c2ecf20Sopenharmony_ci#define C_SEEPROM	0x1
6408c2ecf20Sopenharmony_ci#define VPD_FLASH	0x4
6418c2ecf20Sopenharmony_ci#define AAP1_RDUMP	0x5
6428c2ecf20Sopenharmony_ci#define IOP_RDUMP	0x6
6438c2ecf20Sopenharmony_ci#define EXPAN_ROM	0x7
6448c2ecf20Sopenharmony_ci
6458c2ecf20Sopenharmony_ci#define IPMode		0x80000000
6468c2ecf20Sopenharmony_ci#define NVMD_TYPE	0x0000000F
6478c2ecf20Sopenharmony_ci#define NVMD_STAT	0x0000FFFF
6488c2ecf20Sopenharmony_ci#define NVMD_LEN	0xFF000000
6498c2ecf20Sopenharmony_ci/**
6508c2ecf20Sopenharmony_ci * brief the data structure of Get NVMD Data Response
6518c2ecf20Sopenharmony_ci * use to describe MPI Get NVMD Data Response (64 bytes)
6528c2ecf20Sopenharmony_ci */
6538c2ecf20Sopenharmony_cistruct get_nvm_data_resp {
6548c2ecf20Sopenharmony_ci	__le32		tag;
6558c2ecf20Sopenharmony_ci	__le32		ir_tda_bn_dps_das_nvm;
6568c2ecf20Sopenharmony_ci	__le32		dlen_status;
6578c2ecf20Sopenharmony_ci	__le32		nvm_data[12];
6588c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
6598c2ecf20Sopenharmony_ci
6608c2ecf20Sopenharmony_ci
6618c2ecf20Sopenharmony_ci/**
6628c2ecf20Sopenharmony_ci * brief the data structure of SAS Diagnostic Start/End Response
6638c2ecf20Sopenharmony_ci * use to describe MPI SAS Diagnostic Start/End Response (64 bytes)
6648c2ecf20Sopenharmony_ci *
6658c2ecf20Sopenharmony_ci */
6668c2ecf20Sopenharmony_cistruct sas_diag_start_end_resp {
6678c2ecf20Sopenharmony_ci	__le32		tag;
6688c2ecf20Sopenharmony_ci	__le32		status;
6698c2ecf20Sopenharmony_ci	u32		reserved[13];
6708c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
6718c2ecf20Sopenharmony_ci
6728c2ecf20Sopenharmony_ci
6738c2ecf20Sopenharmony_ci/**
6748c2ecf20Sopenharmony_ci * brief the data structure of SAS Diagnostic Execute Response
6758c2ecf20Sopenharmony_ci * use to describe MPI SAS Diagnostic Execute Response (64 bytes)
6768c2ecf20Sopenharmony_ci *
6778c2ecf20Sopenharmony_ci */
6788c2ecf20Sopenharmony_cistruct sas_diag_execute_resp {
6798c2ecf20Sopenharmony_ci	__le32		tag;
6808c2ecf20Sopenharmony_ci	__le32		cmdtype_cmddesc_phyid;
6818c2ecf20Sopenharmony_ci	__le32		Status;
6828c2ecf20Sopenharmony_ci	__le32		ReportData;
6838c2ecf20Sopenharmony_ci	u32		reserved[11];
6848c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
6858c2ecf20Sopenharmony_ci
6868c2ecf20Sopenharmony_ci
6878c2ecf20Sopenharmony_ci/**
6888c2ecf20Sopenharmony_ci * brief the data structure of Set Device State Response
6898c2ecf20Sopenharmony_ci * use to describe MPI Set Device State Response (64 bytes)
6908c2ecf20Sopenharmony_ci *
6918c2ecf20Sopenharmony_ci */
6928c2ecf20Sopenharmony_cistruct set_dev_state_resp {
6938c2ecf20Sopenharmony_ci	__le32		tag;
6948c2ecf20Sopenharmony_ci	__le32		status;
6958c2ecf20Sopenharmony_ci	__le32		device_id;
6968c2ecf20Sopenharmony_ci	__le32		pds_nds;
6978c2ecf20Sopenharmony_ci	u32		reserved[11];
6988c2ecf20Sopenharmony_ci} __attribute__((packed, aligned(4)));
6998c2ecf20Sopenharmony_ci
7008c2ecf20Sopenharmony_ci
7018c2ecf20Sopenharmony_ci#define NDS_BITS 0x0F
7028c2ecf20Sopenharmony_ci#define PDS_BITS 0xF0
7038c2ecf20Sopenharmony_ci
7048c2ecf20Sopenharmony_ci/*
7058c2ecf20Sopenharmony_ci * HW Events type
7068c2ecf20Sopenharmony_ci */
7078c2ecf20Sopenharmony_ci
7088c2ecf20Sopenharmony_ci#define HW_EVENT_RESET_START			0x01
7098c2ecf20Sopenharmony_ci#define HW_EVENT_CHIP_RESET_COMPLETE		0x02
7108c2ecf20Sopenharmony_ci#define HW_EVENT_PHY_STOP_STATUS		0x03
7118c2ecf20Sopenharmony_ci#define HW_EVENT_SAS_PHY_UP			0x04
7128c2ecf20Sopenharmony_ci#define HW_EVENT_SATA_PHY_UP			0x05
7138c2ecf20Sopenharmony_ci#define HW_EVENT_SATA_SPINUP_HOLD		0x06
7148c2ecf20Sopenharmony_ci#define HW_EVENT_PHY_DOWN			0x07
7158c2ecf20Sopenharmony_ci#define HW_EVENT_PORT_INVALID			0x08
7168c2ecf20Sopenharmony_ci#define HW_EVENT_BROADCAST_CHANGE		0x09
7178c2ecf20Sopenharmony_ci#define HW_EVENT_PHY_ERROR			0x0A
7188c2ecf20Sopenharmony_ci#define HW_EVENT_BROADCAST_SES			0x0B
7198c2ecf20Sopenharmony_ci#define HW_EVENT_INBOUND_CRC_ERROR		0x0C
7208c2ecf20Sopenharmony_ci#define HW_EVENT_HARD_RESET_RECEIVED		0x0D
7218c2ecf20Sopenharmony_ci#define HW_EVENT_MALFUNCTION			0x0E
7228c2ecf20Sopenharmony_ci#define HW_EVENT_ID_FRAME_TIMEOUT		0x0F
7238c2ecf20Sopenharmony_ci#define HW_EVENT_BROADCAST_EXP			0x10
7248c2ecf20Sopenharmony_ci#define HW_EVENT_PHY_START_STATUS		0x11
7258c2ecf20Sopenharmony_ci#define HW_EVENT_LINK_ERR_INVALID_DWORD		0x12
7268c2ecf20Sopenharmony_ci#define HW_EVENT_LINK_ERR_DISPARITY_ERROR	0x13
7278c2ecf20Sopenharmony_ci#define HW_EVENT_LINK_ERR_CODE_VIOLATION	0x14
7288c2ecf20Sopenharmony_ci#define HW_EVENT_LINK_ERR_LOSS_OF_DWORD_SYNCH	0x15
7298c2ecf20Sopenharmony_ci#define HW_EVENT_LINK_ERR_PHY_RESET_FAILED	0x16
7308c2ecf20Sopenharmony_ci#define HW_EVENT_PORT_RECOVERY_TIMER_TMO	0x17
7318c2ecf20Sopenharmony_ci#define HW_EVENT_PORT_RECOVER			0x18
7328c2ecf20Sopenharmony_ci#define HW_EVENT_PORT_RESET_TIMER_TMO		0x19
7338c2ecf20Sopenharmony_ci#define HW_EVENT_PORT_RESET_COMPLETE		0x20
7348c2ecf20Sopenharmony_ci#define EVENT_BROADCAST_ASYNCH_EVENT		0x21
7358c2ecf20Sopenharmony_ci
7368c2ecf20Sopenharmony_ci/* port state */
7378c2ecf20Sopenharmony_ci#define PORT_NOT_ESTABLISHED			0x00
7388c2ecf20Sopenharmony_ci#define PORT_VALID				0x01
7398c2ecf20Sopenharmony_ci#define PORT_LOSTCOMM				0x02
7408c2ecf20Sopenharmony_ci#define PORT_IN_RESET				0x04
7418c2ecf20Sopenharmony_ci#define PORT_INVALID				0x08
7428c2ecf20Sopenharmony_ci
7438c2ecf20Sopenharmony_ci/*
7448c2ecf20Sopenharmony_ci * SSP/SMP/SATA IO Completion Status values
7458c2ecf20Sopenharmony_ci */
7468c2ecf20Sopenharmony_ci
7478c2ecf20Sopenharmony_ci#define IO_SUCCESS				0x00
7488c2ecf20Sopenharmony_ci#define IO_ABORTED				0x01
7498c2ecf20Sopenharmony_ci#define IO_OVERFLOW				0x02
7508c2ecf20Sopenharmony_ci#define IO_UNDERFLOW				0x03
7518c2ecf20Sopenharmony_ci#define IO_FAILED				0x04
7528c2ecf20Sopenharmony_ci#define IO_ABORT_RESET				0x05
7538c2ecf20Sopenharmony_ci#define IO_NOT_VALID				0x06
7548c2ecf20Sopenharmony_ci#define IO_NO_DEVICE				0x07
7558c2ecf20Sopenharmony_ci#define IO_ILLEGAL_PARAMETER			0x08
7568c2ecf20Sopenharmony_ci#define IO_LINK_FAILURE				0x09
7578c2ecf20Sopenharmony_ci#define IO_PROG_ERROR				0x0A
7588c2ecf20Sopenharmony_ci#define IO_EDC_IN_ERROR				0x0B
7598c2ecf20Sopenharmony_ci#define IO_EDC_OUT_ERROR			0x0C
7608c2ecf20Sopenharmony_ci#define IO_ERROR_HW_TIMEOUT			0x0D
7618c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_BREAK			0x0E
7628c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_PHY_NOT_READY		0x0F
7638c2ecf20Sopenharmony_ci#define IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED	0x10
7648c2ecf20Sopenharmony_ci#define IO_OPEN_CNX_ERROR_ZONE_VIOLATION		0x11
7658c2ecf20Sopenharmony_ci#define IO_OPEN_CNX_ERROR_BREAK				0x12
7668c2ecf20Sopenharmony_ci#define IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS			0x13
7678c2ecf20Sopenharmony_ci#define IO_OPEN_CNX_ERROR_BAD_DESTINATION		0x14
7688c2ecf20Sopenharmony_ci#define IO_OPEN_CNX_ERROR_CONNECTION_RATE_NOT_SUPPORTED	0x15
7698c2ecf20Sopenharmony_ci#define IO_OPEN_CNX_ERROR_STP_RESOURCES_BUSY		0x16
7708c2ecf20Sopenharmony_ci#define IO_OPEN_CNX_ERROR_WRONG_DESTINATION		0x17
7718c2ecf20Sopenharmony_ci#define IO_OPEN_CNX_ERROR_UNKNOWN_ERROR			0x18
7728c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_NAK_RECEIVED			0x19
7738c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_ACK_NAK_TIMEOUT			0x1A
7748c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_PEER_ABORTED			0x1B
7758c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_RX_FRAME				0x1C
7768c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_DMA				0x1D
7778c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_CREDIT_TIMEOUT			0x1E
7788c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_SATA_LINK_TIMEOUT			0x1F
7798c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_SATA				0x20
7808c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_ABORTED_DUE_TO_SRST		0x22
7818c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_REJECTED_NCQ_MODE			0x21
7828c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_ABORTED_NCQ_MODE			0x23
7838c2ecf20Sopenharmony_ci#define IO_XFER_OPEN_RETRY_TIMEOUT			0x24
7848c2ecf20Sopenharmony_ci#define IO_XFER_SMP_RESP_CONNECTION_ERROR		0x25
7858c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_UNEXPECTED_PHASE			0x26
7868c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_XFER_RDY_OVERRUN			0x27
7878c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_XFER_RDY_NOT_EXPECTED		0x28
7888c2ecf20Sopenharmony_ci
7898c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_CMD_ISSUE_ACK_NAK_TIMEOUT		0x30
7908c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_CMD_ISSUE_BREAK_BEFORE_ACK_NAK	0x31
7918c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_CMD_ISSUE_PHY_DOWN_BEFORE_ACK_NAK	0x32
7928c2ecf20Sopenharmony_ci
7938c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_OFFSET_MISMATCH			0x34
7948c2ecf20Sopenharmony_ci#define IO_XFER_ERROR_XFER_ZERO_DATA_LEN		0x35
7958c2ecf20Sopenharmony_ci#define IO_XFER_CMD_FRAME_ISSUED			0x36
7968c2ecf20Sopenharmony_ci#define IO_ERROR_INTERNAL_SMP_RESOURCE			0x37
7978c2ecf20Sopenharmony_ci#define IO_PORT_IN_RESET				0x38
7988c2ecf20Sopenharmony_ci#define IO_DS_NON_OPERATIONAL				0x39
7998c2ecf20Sopenharmony_ci#define IO_DS_IN_RECOVERY				0x3A
8008c2ecf20Sopenharmony_ci#define IO_TM_TAG_NOT_FOUND				0x3B
8018c2ecf20Sopenharmony_ci#define IO_XFER_PIO_SETUP_ERROR				0x3C
8028c2ecf20Sopenharmony_ci#define IO_SSP_EXT_IU_ZERO_LEN_ERROR			0x3D
8038c2ecf20Sopenharmony_ci#define IO_DS_IN_ERROR					0x3E
8048c2ecf20Sopenharmony_ci#define IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY		0x3F
8058c2ecf20Sopenharmony_ci#define IO_ABORT_IN_PROGRESS				0x40
8068c2ecf20Sopenharmony_ci#define IO_ABORT_DELAYED				0x41
8078c2ecf20Sopenharmony_ci#define IO_INVALID_LENGTH				0x42
8088c2ecf20Sopenharmony_ci
8098c2ecf20Sopenharmony_ci/* WARNING: This error code must always be the last number.
8108c2ecf20Sopenharmony_ci * If you add error code, modify this code also
8118c2ecf20Sopenharmony_ci * It is used as an index
8128c2ecf20Sopenharmony_ci */
8138c2ecf20Sopenharmony_ci#define IO_ERROR_UNKNOWN_GENERIC			0x43
8148c2ecf20Sopenharmony_ci
8158c2ecf20Sopenharmony_ci/* MSGU CONFIGURATION  TABLE*/
8168c2ecf20Sopenharmony_ci
8178c2ecf20Sopenharmony_ci#define SPC_MSGU_CFG_TABLE_UPDATE		0x01/* Inbound doorbell bit0 */
8188c2ecf20Sopenharmony_ci#define SPC_MSGU_CFG_TABLE_RESET		0x02/* Inbound doorbell bit1 */
8198c2ecf20Sopenharmony_ci#define SPC_MSGU_CFG_TABLE_FREEZE		0x04/* Inbound doorbell bit2 */
8208c2ecf20Sopenharmony_ci#define SPC_MSGU_CFG_TABLE_UNFREEZE		0x08/* Inbound doorbell bit4 */
8218c2ecf20Sopenharmony_ci#define MSGU_IBDB_SET				0x04
8228c2ecf20Sopenharmony_ci#define MSGU_HOST_INT_STATUS			0x08
8238c2ecf20Sopenharmony_ci#define MSGU_HOST_INT_MASK			0x0C
8248c2ecf20Sopenharmony_ci#define MSGU_IOPIB_INT_STATUS			0x18
8258c2ecf20Sopenharmony_ci#define MSGU_IOPIB_INT_MASK			0x1C
8268c2ecf20Sopenharmony_ci#define MSGU_IBDB_CLEAR				0x20/* RevB - Host not use */
8278c2ecf20Sopenharmony_ci#define MSGU_MSGU_CONTROL			0x24
8288c2ecf20Sopenharmony_ci#define MSGU_ODR				0x3C/* RevB */
8298c2ecf20Sopenharmony_ci#define MSGU_ODCR				0x40/* RevB */
8308c2ecf20Sopenharmony_ci#define MSGU_SCRATCH_PAD_0			0x44
8318c2ecf20Sopenharmony_ci#define MSGU_SCRATCH_PAD_1			0x48
8328c2ecf20Sopenharmony_ci#define MSGU_SCRATCH_PAD_2			0x4C
8338c2ecf20Sopenharmony_ci#define MSGU_SCRATCH_PAD_3			0x50
8348c2ecf20Sopenharmony_ci#define MSGU_HOST_SCRATCH_PAD_0			0x54
8358c2ecf20Sopenharmony_ci#define MSGU_HOST_SCRATCH_PAD_1			0x58
8368c2ecf20Sopenharmony_ci#define MSGU_HOST_SCRATCH_PAD_2			0x5C
8378c2ecf20Sopenharmony_ci#define MSGU_HOST_SCRATCH_PAD_3			0x60
8388c2ecf20Sopenharmony_ci#define MSGU_HOST_SCRATCH_PAD_4			0x64
8398c2ecf20Sopenharmony_ci#define MSGU_HOST_SCRATCH_PAD_5			0x68
8408c2ecf20Sopenharmony_ci#define MSGU_HOST_SCRATCH_PAD_6			0x6C
8418c2ecf20Sopenharmony_ci#define MSGU_HOST_SCRATCH_PAD_7			0x70
8428c2ecf20Sopenharmony_ci#define MSGU_ODMR				0x74/* RevB */
8438c2ecf20Sopenharmony_ci
8448c2ecf20Sopenharmony_ci/* bit definition for ODMR register */
8458c2ecf20Sopenharmony_ci#define ODMR_MASK_ALL				0xFFFFFFFF/* mask all
8468c2ecf20Sopenharmony_ci					interrupt vector */
8478c2ecf20Sopenharmony_ci#define ODMR_CLEAR_ALL				0/* clear all
8488c2ecf20Sopenharmony_ci					interrupt vector */
8498c2ecf20Sopenharmony_ci/* bit definition for ODCR register */
8508c2ecf20Sopenharmony_ci#define ODCR_CLEAR_ALL		0xFFFFFFFF   /* mask all
8518c2ecf20Sopenharmony_ci					interrupt vector*/
8528c2ecf20Sopenharmony_ci/* MSIX Interupts */
8538c2ecf20Sopenharmony_ci#define MSIX_TABLE_OFFSET		0x2000
8548c2ecf20Sopenharmony_ci#define MSIX_TABLE_ELEMENT_SIZE		0x10
8558c2ecf20Sopenharmony_ci#define MSIX_INTERRUPT_CONTROL_OFFSET	0xC
8568c2ecf20Sopenharmony_ci#define MSIX_TABLE_BASE	  (MSIX_TABLE_OFFSET + MSIX_INTERRUPT_CONTROL_OFFSET)
8578c2ecf20Sopenharmony_ci#define MSIX_INTERRUPT_DISABLE		0x1
8588c2ecf20Sopenharmony_ci#define MSIX_INTERRUPT_ENABLE		0x0
8598c2ecf20Sopenharmony_ci
8608c2ecf20Sopenharmony_ci
8618c2ecf20Sopenharmony_ci/* state definition for Scratch Pad1 register */
8628c2ecf20Sopenharmony_ci#define SCRATCH_PAD1_POR		0x00  /* power on reset state */
8638c2ecf20Sopenharmony_ci#define SCRATCH_PAD1_SFR		0x01  /* soft reset state */
8648c2ecf20Sopenharmony_ci#define SCRATCH_PAD1_ERR		0x02  /* error state */
8658c2ecf20Sopenharmony_ci#define SCRATCH_PAD1_RDY		0x03  /* ready state */
8668c2ecf20Sopenharmony_ci#define SCRATCH_PAD1_RST		0x04  /* soft reset toggle flag */
8678c2ecf20Sopenharmony_ci#define SCRATCH_PAD1_AAP1RDY_RST	0x08  /* AAP1 ready for soft reset */
8688c2ecf20Sopenharmony_ci#define SCRATCH_PAD1_STATE_MASK		0xFFFFFFF0   /* ScratchPad1
8698c2ecf20Sopenharmony_ci Mask, bit1-0 State, bit2 Soft Reset, bit3 FW RDY for Soft Reset */
8708c2ecf20Sopenharmony_ci#define SCRATCH_PAD1_RESERVED		0x000003F8   /* Scratch Pad1
8718c2ecf20Sopenharmony_ci Reserved bit 3 to 9 */
8728c2ecf20Sopenharmony_ci
8738c2ecf20Sopenharmony_ci /* state definition for Scratch Pad2 register */
8748c2ecf20Sopenharmony_ci#define SCRATCH_PAD2_POR		0x00  /* power on state */
8758c2ecf20Sopenharmony_ci#define SCRATCH_PAD2_SFR		0x01  /* soft reset state */
8768c2ecf20Sopenharmony_ci#define SCRATCH_PAD2_ERR		0x02  /* error state */
8778c2ecf20Sopenharmony_ci#define SCRATCH_PAD2_RDY		0x03  /* ready state */
8788c2ecf20Sopenharmony_ci#define SCRATCH_PAD2_FWRDY_RST		0x04  /* FW ready for soft reset flag*/
8798c2ecf20Sopenharmony_ci#define SCRATCH_PAD2_IOPRDY_RST		0x08  /* IOP ready for soft reset */
8808c2ecf20Sopenharmony_ci#define SCRATCH_PAD2_STATE_MASK		0xFFFFFFF4 /* ScratchPad 2
8818c2ecf20Sopenharmony_ci Mask, bit1-0 State */
8828c2ecf20Sopenharmony_ci#define SCRATCH_PAD2_RESERVED		0x000003FC   /* Scratch Pad1
8838c2ecf20Sopenharmony_ci Reserved bit 2 to 9 */
8848c2ecf20Sopenharmony_ci
8858c2ecf20Sopenharmony_ci#define SCRATCH_PAD_ERROR_MASK		0xFFFFFC00   /* Error mask bits */
8868c2ecf20Sopenharmony_ci#define SCRATCH_PAD_STATE_MASK		0x00000003   /* State Mask bits */
8878c2ecf20Sopenharmony_ci
8888c2ecf20Sopenharmony_ci/* main configuration offset - byte offset */
8898c2ecf20Sopenharmony_ci#define MAIN_SIGNATURE_OFFSET		0x00/* DWORD 0x00 */
8908c2ecf20Sopenharmony_ci#define MAIN_INTERFACE_REVISION		0x04/* DWORD 0x01 */
8918c2ecf20Sopenharmony_ci#define MAIN_FW_REVISION		0x08/* DWORD 0x02 */
8928c2ecf20Sopenharmony_ci#define MAIN_MAX_OUTSTANDING_IO_OFFSET	0x0C/* DWORD 0x03 */
8938c2ecf20Sopenharmony_ci#define MAIN_MAX_SGL_OFFSET		0x10/* DWORD 0x04 */
8948c2ecf20Sopenharmony_ci#define MAIN_CNTRL_CAP_OFFSET		0x14/* DWORD 0x05 */
8958c2ecf20Sopenharmony_ci#define MAIN_GST_OFFSET			0x18/* DWORD 0x06 */
8968c2ecf20Sopenharmony_ci#define MAIN_IBQ_OFFSET			0x1C/* DWORD 0x07 */
8978c2ecf20Sopenharmony_ci#define MAIN_OBQ_OFFSET			0x20/* DWORD 0x08 */
8988c2ecf20Sopenharmony_ci#define MAIN_IQNPPD_HPPD_OFFSET		0x24/* DWORD 0x09 */
8998c2ecf20Sopenharmony_ci#define MAIN_OB_HW_EVENT_PID03_OFFSET	0x28/* DWORD 0x0A */
9008c2ecf20Sopenharmony_ci#define MAIN_OB_HW_EVENT_PID47_OFFSET	0x2C/* DWORD 0x0B */
9018c2ecf20Sopenharmony_ci#define MAIN_OB_NCQ_EVENT_PID03_OFFSET	0x30/* DWORD 0x0C */
9028c2ecf20Sopenharmony_ci#define MAIN_OB_NCQ_EVENT_PID47_OFFSET	0x34/* DWORD 0x0D */
9038c2ecf20Sopenharmony_ci#define MAIN_TITNX_EVENT_PID03_OFFSET	0x38/* DWORD 0x0E */
9048c2ecf20Sopenharmony_ci#define MAIN_TITNX_EVENT_PID47_OFFSET	0x3C/* DWORD 0x0F */
9058c2ecf20Sopenharmony_ci#define MAIN_OB_SSP_EVENT_PID03_OFFSET	0x40/* DWORD 0x10 */
9068c2ecf20Sopenharmony_ci#define MAIN_OB_SSP_EVENT_PID47_OFFSET	0x44/* DWORD 0x11 */
9078c2ecf20Sopenharmony_ci#define MAIN_OB_SMP_EVENT_PID03_OFFSET	0x48/* DWORD 0x12 */
9088c2ecf20Sopenharmony_ci#define MAIN_OB_SMP_EVENT_PID47_OFFSET	0x4C/* DWORD 0x13 */
9098c2ecf20Sopenharmony_ci#define MAIN_EVENT_LOG_ADDR_HI		0x50/* DWORD 0x14 */
9108c2ecf20Sopenharmony_ci#define MAIN_EVENT_LOG_ADDR_LO		0x54/* DWORD 0x15 */
9118c2ecf20Sopenharmony_ci#define MAIN_EVENT_LOG_BUFF_SIZE	0x58/* DWORD 0x16 */
9128c2ecf20Sopenharmony_ci#define MAIN_EVENT_LOG_OPTION		0x5C/* DWORD 0x17 */
9138c2ecf20Sopenharmony_ci#define MAIN_IOP_EVENT_LOG_ADDR_HI	0x60/* DWORD 0x18 */
9148c2ecf20Sopenharmony_ci#define MAIN_IOP_EVENT_LOG_ADDR_LO	0x64/* DWORD 0x19 */
9158c2ecf20Sopenharmony_ci#define MAIN_IOP_EVENT_LOG_BUFF_SIZE	0x68/* DWORD 0x1A */
9168c2ecf20Sopenharmony_ci#define MAIN_IOP_EVENT_LOG_OPTION	0x6C/* DWORD 0x1B */
9178c2ecf20Sopenharmony_ci#define MAIN_FATAL_ERROR_INTERRUPT	0x70/* DWORD 0x1C */
9188c2ecf20Sopenharmony_ci#define MAIN_FATAL_ERROR_RDUMP0_OFFSET	0x74/* DWORD 0x1D */
9198c2ecf20Sopenharmony_ci#define MAIN_FATAL_ERROR_RDUMP0_LENGTH	0x78/* DWORD 0x1E */
9208c2ecf20Sopenharmony_ci#define MAIN_FATAL_ERROR_RDUMP1_OFFSET	0x7C/* DWORD 0x1F */
9218c2ecf20Sopenharmony_ci#define MAIN_FATAL_ERROR_RDUMP1_LENGTH	0x80/* DWORD 0x20 */
9228c2ecf20Sopenharmony_ci#define MAIN_HDA_FLAGS_OFFSET		0x84/* DWORD 0x21 */
9238c2ecf20Sopenharmony_ci#define MAIN_ANALOG_SETUP_OFFSET	0x88/* DWORD 0x22 */
9248c2ecf20Sopenharmony_ci
9258c2ecf20Sopenharmony_ci/* Gereral Status Table offset - byte offset */
9268c2ecf20Sopenharmony_ci#define GST_GSTLEN_MPIS_OFFSET		0x00
9278c2ecf20Sopenharmony_ci#define GST_IQ_FREEZE_STATE0_OFFSET	0x04
9288c2ecf20Sopenharmony_ci#define GST_IQ_FREEZE_STATE1_OFFSET	0x08
9298c2ecf20Sopenharmony_ci#define GST_MSGUTCNT_OFFSET		0x0C
9308c2ecf20Sopenharmony_ci#define GST_IOPTCNT_OFFSET		0x10
9318c2ecf20Sopenharmony_ci#define GST_PHYSTATE_OFFSET		0x18
9328c2ecf20Sopenharmony_ci#define GST_PHYSTATE0_OFFSET		0x18
9338c2ecf20Sopenharmony_ci#define GST_PHYSTATE1_OFFSET		0x1C
9348c2ecf20Sopenharmony_ci#define GST_PHYSTATE2_OFFSET		0x20
9358c2ecf20Sopenharmony_ci#define GST_PHYSTATE3_OFFSET		0x24
9368c2ecf20Sopenharmony_ci#define GST_PHYSTATE4_OFFSET		0x28
9378c2ecf20Sopenharmony_ci#define GST_PHYSTATE5_OFFSET		0x2C
9388c2ecf20Sopenharmony_ci#define GST_PHYSTATE6_OFFSET		0x30
9398c2ecf20Sopenharmony_ci#define GST_PHYSTATE7_OFFSET		0x34
9408c2ecf20Sopenharmony_ci#define GST_RERRINFO_OFFSET		0x44
9418c2ecf20Sopenharmony_ci
9428c2ecf20Sopenharmony_ci/* General Status Table - MPI state */
9438c2ecf20Sopenharmony_ci#define GST_MPI_STATE_UNINIT		0x00
9448c2ecf20Sopenharmony_ci#define GST_MPI_STATE_INIT		0x01
9458c2ecf20Sopenharmony_ci#define GST_MPI_STATE_TERMINATION	0x02
9468c2ecf20Sopenharmony_ci#define GST_MPI_STATE_ERROR		0x03
9478c2ecf20Sopenharmony_ci#define GST_MPI_STATE_MASK		0x07
9488c2ecf20Sopenharmony_ci
9498c2ecf20Sopenharmony_ci#define MBIC_NMI_ENABLE_VPE0_IOP	0x000418
9508c2ecf20Sopenharmony_ci#define MBIC_NMI_ENABLE_VPE0_AAP1	0x000418
9518c2ecf20Sopenharmony_ci/* PCIE registers - BAR2(0x18), BAR1(win) 0x010000 */
9528c2ecf20Sopenharmony_ci#define PCIE_EVENT_INTERRUPT_ENABLE	0x003040
9538c2ecf20Sopenharmony_ci#define PCIE_EVENT_INTERRUPT		0x003044
9548c2ecf20Sopenharmony_ci#define PCIE_ERROR_INTERRUPT_ENABLE	0x003048
9558c2ecf20Sopenharmony_ci#define PCIE_ERROR_INTERRUPT		0x00304C
9568c2ecf20Sopenharmony_ci/* signature definition for host scratch pad0 register */
9578c2ecf20Sopenharmony_ci#define SPC_SOFT_RESET_SIGNATURE	0x252acbcd
9588c2ecf20Sopenharmony_ci/* Signature for Soft Reset */
9598c2ecf20Sopenharmony_ci
9608c2ecf20Sopenharmony_ci/* SPC Reset register - BAR4(0x20), BAR2(win) (need dynamic mapping) */
9618c2ecf20Sopenharmony_ci#define SPC_REG_RESET			0x000000/* reset register */
9628c2ecf20Sopenharmony_ci
9638c2ecf20Sopenharmony_ci/* bit difination for SPC_RESET register */
9648c2ecf20Sopenharmony_ci#define   SPC_REG_RESET_OSSP		0x00000001
9658c2ecf20Sopenharmony_ci#define   SPC_REG_RESET_RAAE		0x00000002
9668c2ecf20Sopenharmony_ci#define   SPC_REG_RESET_PCS_SPBC	0x00000004
9678c2ecf20Sopenharmony_ci#define   SPC_REG_RESET_PCS_IOP_SS	0x00000008
9688c2ecf20Sopenharmony_ci#define   SPC_REG_RESET_PCS_AAP1_SS	0x00000010
9698c2ecf20Sopenharmony_ci#define   SPC_REG_RESET_PCS_AAP2_SS	0x00000020
9708c2ecf20Sopenharmony_ci#define   SPC_REG_RESET_PCS_LM		0x00000040
9718c2ecf20Sopenharmony_ci#define   SPC_REG_RESET_PCS		0x00000080
9728c2ecf20Sopenharmony_ci#define   SPC_REG_RESET_GSM		0x00000100
9738c2ecf20Sopenharmony_ci#define   SPC_REG_RESET_DDR2		0x00010000
9748c2ecf20Sopenharmony_ci#define   SPC_REG_RESET_BDMA_CORE	0x00020000
9758c2ecf20Sopenharmony_ci#define   SPC_REG_RESET_BDMA_SXCBI	0x00040000
9768c2ecf20Sopenharmony_ci#define   SPC_REG_RESET_PCIE_AL_SXCBI	0x00080000
9778c2ecf20Sopenharmony_ci#define   SPC_REG_RESET_PCIE_PWR	0x00100000
9788c2ecf20Sopenharmony_ci#define   SPC_REG_RESET_PCIE_SFT	0x00200000
9798c2ecf20Sopenharmony_ci#define   SPC_REG_RESET_PCS_SXCBI	0x00400000
9808c2ecf20Sopenharmony_ci#define   SPC_REG_RESET_LMS_SXCBI	0x00800000
9818c2ecf20Sopenharmony_ci#define   SPC_REG_RESET_PMIC_SXCBI	0x01000000
9828c2ecf20Sopenharmony_ci#define   SPC_REG_RESET_PMIC_CORE	0x02000000
9838c2ecf20Sopenharmony_ci#define   SPC_REG_RESET_PCIE_PC_SXCBI	0x04000000
9848c2ecf20Sopenharmony_ci#define   SPC_REG_RESET_DEVICE		0x80000000
9858c2ecf20Sopenharmony_ci
9868c2ecf20Sopenharmony_ci/* registers for BAR Shifting - BAR2(0x18), BAR1(win) */
9878c2ecf20Sopenharmony_ci#define SPC_IBW_AXI_TRANSLATION_LOW	0x003258
9888c2ecf20Sopenharmony_ci
9898c2ecf20Sopenharmony_ci#define MBIC_AAP1_ADDR_BASE		0x060000
9908c2ecf20Sopenharmony_ci#define MBIC_IOP_ADDR_BASE		0x070000
9918c2ecf20Sopenharmony_ci#define GSM_ADDR_BASE			0x0700000
9928c2ecf20Sopenharmony_ci/* Dynamic map through Bar4 - 0x00700000 */
9938c2ecf20Sopenharmony_ci#define GSM_CONFIG_RESET		0x00000000
9948c2ecf20Sopenharmony_ci#define RAM_ECC_DB_ERR			0x00000018
9958c2ecf20Sopenharmony_ci#define GSM_READ_ADDR_PARITY_INDIC	0x00000058
9968c2ecf20Sopenharmony_ci#define GSM_WRITE_ADDR_PARITY_INDIC	0x00000060
9978c2ecf20Sopenharmony_ci#define GSM_WRITE_DATA_PARITY_INDIC	0x00000068
9988c2ecf20Sopenharmony_ci#define GSM_READ_ADDR_PARITY_CHECK	0x00000038
9998c2ecf20Sopenharmony_ci#define GSM_WRITE_ADDR_PARITY_CHECK	0x00000040
10008c2ecf20Sopenharmony_ci#define GSM_WRITE_DATA_PARITY_CHECK	0x00000048
10018c2ecf20Sopenharmony_ci
10028c2ecf20Sopenharmony_ci#define RB6_ACCESS_REG			0x6A0000
10038c2ecf20Sopenharmony_ci#define HDAC_EXEC_CMD			0x0002
10048c2ecf20Sopenharmony_ci#define HDA_C_PA			0xcb
10058c2ecf20Sopenharmony_ci#define HDA_SEQ_ID_BITS			0x00ff0000
10068c2ecf20Sopenharmony_ci#define HDA_GSM_OFFSET_BITS		0x00FFFFFF
10078c2ecf20Sopenharmony_ci#define MBIC_AAP1_ADDR_BASE		0x060000
10088c2ecf20Sopenharmony_ci#define MBIC_IOP_ADDR_BASE		0x070000
10098c2ecf20Sopenharmony_ci#define GSM_ADDR_BASE			0x0700000
10108c2ecf20Sopenharmony_ci#define SPC_TOP_LEVEL_ADDR_BASE		0x000000
10118c2ecf20Sopenharmony_ci#define GSM_CONFIG_RESET_VALUE          0x00003b00
10128c2ecf20Sopenharmony_ci#define GPIO_ADDR_BASE                  0x00090000
10138c2ecf20Sopenharmony_ci#define GPIO_GPIO_0_0UTPUT_CTL_OFFSET   0x0000010c
10148c2ecf20Sopenharmony_ci
10158c2ecf20Sopenharmony_ci/* RB6 offset */
10168c2ecf20Sopenharmony_ci#define SPC_RB6_OFFSET			0x80C0
10178c2ecf20Sopenharmony_ci/* Magic number of  soft reset for RB6 */
10188c2ecf20Sopenharmony_ci#define RB6_MAGIC_NUMBER_RST		0x1234
10198c2ecf20Sopenharmony_ci
10208c2ecf20Sopenharmony_ci/* Device Register status */
10218c2ecf20Sopenharmony_ci#define DEVREG_SUCCESS					0x00
10228c2ecf20Sopenharmony_ci#define DEVREG_FAILURE_OUT_OF_RESOURCE			0x01
10238c2ecf20Sopenharmony_ci#define DEVREG_FAILURE_DEVICE_ALREADY_REGISTERED	0x02
10248c2ecf20Sopenharmony_ci#define DEVREG_FAILURE_INVALID_PHY_ID			0x03
10258c2ecf20Sopenharmony_ci#define DEVREG_FAILURE_PHY_ID_ALREADY_REGISTERED	0x04
10268c2ecf20Sopenharmony_ci#define DEVREG_FAILURE_PORT_ID_OUT_OF_RANGE		0x05
10278c2ecf20Sopenharmony_ci#define DEVREG_FAILURE_PORT_NOT_VALID_STATE		0x06
10288c2ecf20Sopenharmony_ci#define DEVREG_FAILURE_DEVICE_TYPE_NOT_VALID		0x07
10298c2ecf20Sopenharmony_ci
10308c2ecf20Sopenharmony_ci#define GSM_BASE					0x4F0000
10318c2ecf20Sopenharmony_ci#define SHIFT_REG_64K_MASK				0xffff0000
10328c2ecf20Sopenharmony_ci#define SHIFT_REG_BIT_SHIFT				8
10338c2ecf20Sopenharmony_ci#endif
10348c2ecf20Sopenharmony_ci
1035