162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * PMC-Sierra SPC 8001 SAS/SATA based host adapters driver
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Copyright (c) 2008-2009 USI Co., Ltd.
562306a36Sopenharmony_ci * All rights reserved.
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci * Redistribution and use in source and binary forms, with or without
862306a36Sopenharmony_ci * modification, are permitted provided that the following conditions
962306a36Sopenharmony_ci * are met:
1062306a36Sopenharmony_ci * 1. Redistributions of source code must retain the above copyright
1162306a36Sopenharmony_ci *    notice, this list of conditions, and the following disclaimer,
1262306a36Sopenharmony_ci *    without modification.
1362306a36Sopenharmony_ci * 2. Redistributions in binary form must reproduce at minimum a disclaimer
1462306a36Sopenharmony_ci *    substantially similar to the "NO WARRANTY" disclaimer below
1562306a36Sopenharmony_ci *    ("Disclaimer") and any redistribution must be conditioned upon
1662306a36Sopenharmony_ci *    including a substantially similar Disclaimer requirement for further
1762306a36Sopenharmony_ci *    binary redistribution.
1862306a36Sopenharmony_ci * 3. Neither the names of the above-listed copyright holders nor the names
1962306a36Sopenharmony_ci *    of any contributors may be used to endorse or promote products derived
2062306a36Sopenharmony_ci *    from this software without specific prior written permission.
2162306a36Sopenharmony_ci *
2262306a36Sopenharmony_ci * Alternatively, this software may be distributed under the terms of the
2362306a36Sopenharmony_ci * GNU General Public License ("GPL") version 2 as published by the Free
2462306a36Sopenharmony_ci * Software Foundation.
2562306a36Sopenharmony_ci *
2662306a36Sopenharmony_ci * NO WARRANTY
2762306a36Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2862306a36Sopenharmony_ci * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2962306a36Sopenharmony_ci * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
3062306a36Sopenharmony_ci * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3162306a36Sopenharmony_ci * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3262306a36Sopenharmony_ci * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3362306a36Sopenharmony_ci * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3462306a36Sopenharmony_ci * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
3562306a36Sopenharmony_ci * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
3662306a36Sopenharmony_ci * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3762306a36Sopenharmony_ci * POSSIBILITY OF SUCH DAMAGES.
3862306a36Sopenharmony_ci *
3962306a36Sopenharmony_ci */
4062306a36Sopenharmony_ci#ifndef _PMC8001_REG_H_
4162306a36Sopenharmony_ci#define _PMC8001_REG_H_
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci#include <linux/types.h>
4462306a36Sopenharmony_ci#include <scsi/libsas.h>
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci/* for Request Opcode of IOMB */
4862306a36Sopenharmony_ci#define OPC_INB_ECHO				1	/* 0x000 */
4962306a36Sopenharmony_ci#define OPC_INB_PHYSTART			4	/* 0x004 */
5062306a36Sopenharmony_ci#define OPC_INB_PHYSTOP				5	/* 0x005 */
5162306a36Sopenharmony_ci#define OPC_INB_SSPINIIOSTART			6	/* 0x006 */
5262306a36Sopenharmony_ci#define OPC_INB_SSPINITMSTART			7	/* 0x007 */
5362306a36Sopenharmony_ci#define OPC_INB_SSPINIEXTIOSTART		8	/* 0x008 */
5462306a36Sopenharmony_ci#define OPC_INB_DEV_HANDLE_ACCEPT		9	/* 0x009 */
5562306a36Sopenharmony_ci#define OPC_INB_SSPTGTIOSTART			10	/* 0x00A */
5662306a36Sopenharmony_ci#define OPC_INB_SSPTGTRSPSTART			11	/* 0x00B */
5762306a36Sopenharmony_ci#define OPC_INB_SSPINIEDCIOSTART		12	/* 0x00C */
5862306a36Sopenharmony_ci#define OPC_INB_SSPINIEXTEDCIOSTART		13	/* 0x00D */
5962306a36Sopenharmony_ci#define OPC_INB_SSPTGTEDCIOSTART		14	/* 0x00E */
6062306a36Sopenharmony_ci#define OPC_INB_SSP_ABORT			15	/* 0x00F */
6162306a36Sopenharmony_ci#define OPC_INB_DEREG_DEV_HANDLE		16	/* 0x010 */
6262306a36Sopenharmony_ci#define OPC_INB_GET_DEV_HANDLE			17	/* 0x011 */
6362306a36Sopenharmony_ci#define OPC_INB_SMP_REQUEST			18	/* 0x012 */
6462306a36Sopenharmony_ci/* SMP_RESPONSE is removed */
6562306a36Sopenharmony_ci#define OPC_INB_SMP_RESPONSE			19	/* 0x013 */
6662306a36Sopenharmony_ci#define OPC_INB_SMP_ABORT			20	/* 0x014 */
6762306a36Sopenharmony_ci#define OPC_INB_REG_DEV				22	/* 0x016 */
6862306a36Sopenharmony_ci#define OPC_INB_SATA_HOST_OPSTART		23	/* 0x017 */
6962306a36Sopenharmony_ci#define OPC_INB_SATA_ABORT			24	/* 0x018 */
7062306a36Sopenharmony_ci#define OPC_INB_LOCAL_PHY_CONTROL		25	/* 0x019 */
7162306a36Sopenharmony_ci#define OPC_INB_GET_DEV_INFO			26	/* 0x01A */
7262306a36Sopenharmony_ci#define OPC_INB_FW_FLASH_UPDATE			32	/* 0x020 */
7362306a36Sopenharmony_ci#define OPC_INB_GPIO				34	/* 0x022 */
7462306a36Sopenharmony_ci#define OPC_INB_SAS_DIAG_MODE_START_END		35	/* 0x023 */
7562306a36Sopenharmony_ci#define OPC_INB_SAS_DIAG_EXECUTE		36	/* 0x024 */
7662306a36Sopenharmony_ci#define OPC_INB_SAS_HW_EVENT_ACK		37	/* 0x025 */
7762306a36Sopenharmony_ci#define OPC_INB_GET_TIME_STAMP			38	/* 0x026 */
7862306a36Sopenharmony_ci#define OPC_INB_PORT_CONTROL			39	/* 0x027 */
7962306a36Sopenharmony_ci#define OPC_INB_GET_NVMD_DATA			40	/* 0x028 */
8062306a36Sopenharmony_ci#define OPC_INB_SET_NVMD_DATA			41	/* 0x029 */
8162306a36Sopenharmony_ci#define OPC_INB_SET_DEVICE_STATE		42	/* 0x02A */
8262306a36Sopenharmony_ci#define OPC_INB_GET_DEVICE_STATE		43	/* 0x02B */
8362306a36Sopenharmony_ci#define OPC_INB_SET_DEV_INFO			44	/* 0x02C */
8462306a36Sopenharmony_ci#define OPC_INB_SAS_RE_INITIALIZE		45	/* 0x02D */
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ci/* for Response Opcode of IOMB */
8762306a36Sopenharmony_ci#define OPC_OUB_ECHO				1	/* 0x001 */
8862306a36Sopenharmony_ci#define OPC_OUB_HW_EVENT			4	/* 0x004 */
8962306a36Sopenharmony_ci#define OPC_OUB_SSP_COMP			5	/* 0x005 */
9062306a36Sopenharmony_ci#define OPC_OUB_SMP_COMP			6	/* 0x006 */
9162306a36Sopenharmony_ci#define OPC_OUB_LOCAL_PHY_CNTRL			7	/* 0x007 */
9262306a36Sopenharmony_ci#define OPC_OUB_DEV_REGIST			10	/* 0x00A */
9362306a36Sopenharmony_ci#define OPC_OUB_DEREG_DEV			11	/* 0x00B */
9462306a36Sopenharmony_ci#define OPC_OUB_GET_DEV_HANDLE			12	/* 0x00C */
9562306a36Sopenharmony_ci#define OPC_OUB_SATA_COMP			13	/* 0x00D */
9662306a36Sopenharmony_ci#define OPC_OUB_SATA_EVENT			14	/* 0x00E */
9762306a36Sopenharmony_ci#define OPC_OUB_SSP_EVENT			15	/* 0x00F */
9862306a36Sopenharmony_ci#define OPC_OUB_DEV_HANDLE_ARRIV		16	/* 0x010 */
9962306a36Sopenharmony_ci/* SMP_RECEIVED Notification is removed */
10062306a36Sopenharmony_ci#define OPC_OUB_SMP_RECV_EVENT			17	/* 0x011 */
10162306a36Sopenharmony_ci#define OPC_OUB_SSP_RECV_EVENT			18	/* 0x012 */
10262306a36Sopenharmony_ci#define OPC_OUB_DEV_INFO			19	/* 0x013 */
10362306a36Sopenharmony_ci#define OPC_OUB_FW_FLASH_UPDATE			20	/* 0x014 */
10462306a36Sopenharmony_ci#define OPC_OUB_GPIO_RESPONSE			22	/* 0x016 */
10562306a36Sopenharmony_ci#define OPC_OUB_GPIO_EVENT			23	/* 0x017 */
10662306a36Sopenharmony_ci#define OPC_OUB_GENERAL_EVENT			24	/* 0x018 */
10762306a36Sopenharmony_ci#define OPC_OUB_SSP_ABORT_RSP			26	/* 0x01A */
10862306a36Sopenharmony_ci#define OPC_OUB_SATA_ABORT_RSP			27	/* 0x01B */
10962306a36Sopenharmony_ci#define OPC_OUB_SAS_DIAG_MODE_START_END		28	/* 0x01C */
11062306a36Sopenharmony_ci#define OPC_OUB_SAS_DIAG_EXECUTE		29	/* 0x01D */
11162306a36Sopenharmony_ci#define OPC_OUB_GET_TIME_STAMP			30	/* 0x01E */
11262306a36Sopenharmony_ci#define OPC_OUB_SAS_HW_EVENT_ACK		31	/* 0x01F */
11362306a36Sopenharmony_ci#define OPC_OUB_PORT_CONTROL			32	/* 0x020 */
11462306a36Sopenharmony_ci#define OPC_OUB_SKIP_ENTRY			33	/* 0x021 */
11562306a36Sopenharmony_ci#define OPC_OUB_SMP_ABORT_RSP			34	/* 0x022 */
11662306a36Sopenharmony_ci#define OPC_OUB_GET_NVMD_DATA			35	/* 0x023 */
11762306a36Sopenharmony_ci#define OPC_OUB_SET_NVMD_DATA			36	/* 0x024 */
11862306a36Sopenharmony_ci#define OPC_OUB_DEVICE_HANDLE_REMOVAL		37	/* 0x025 */
11962306a36Sopenharmony_ci#define OPC_OUB_SET_DEVICE_STATE		38	/* 0x026 */
12062306a36Sopenharmony_ci#define OPC_OUB_GET_DEVICE_STATE		39	/* 0x027 */
12162306a36Sopenharmony_ci#define OPC_OUB_SET_DEV_INFO			40	/* 0x028 */
12262306a36Sopenharmony_ci#define OPC_OUB_SAS_RE_INITIALIZE		41	/* 0x029 */
12362306a36Sopenharmony_ci
12462306a36Sopenharmony_ci/* for phy start*/
12562306a36Sopenharmony_ci#define SPINHOLD_DISABLE		(0x00 << 14)
12662306a36Sopenharmony_ci#define SPINHOLD_ENABLE			(0x01 << 14)
12762306a36Sopenharmony_ci#define LINKMODE_SAS			(0x01 << 12)
12862306a36Sopenharmony_ci#define LINKMODE_DSATA			(0x02 << 12)
12962306a36Sopenharmony_ci#define LINKMODE_AUTO			(0x03 << 12)
13062306a36Sopenharmony_ci#define LINKRATE_15			(0x01 << 8)
13162306a36Sopenharmony_ci#define LINKRATE_30			(0x02 << 8)
13262306a36Sopenharmony_ci#define LINKRATE_60			(0x04 << 8)
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_ci/* for new SPC controllers MEMBASE III is shared between BIOS and DATA */
13562306a36Sopenharmony_ci#define GSM_SM_BASE			0x4F0000
13662306a36Sopenharmony_cistruct mpi_msg_hdr{
13762306a36Sopenharmony_ci	__le32	header;	/* Bits [11:0]  - Message operation code */
13862306a36Sopenharmony_ci	/* Bits [15:12] - Message Category */
13962306a36Sopenharmony_ci	/* Bits [21:16] - Outboundqueue ID for the
14062306a36Sopenharmony_ci	operation completion message */
14162306a36Sopenharmony_ci	/* Bits [23:22] - Reserved */
14262306a36Sopenharmony_ci	/* Bits [28:24] - Buffer Count, indicates how
14362306a36Sopenharmony_ci	many buffer are allocated for the massage */
14462306a36Sopenharmony_ci	/* Bits [30:29] - Reserved */
14562306a36Sopenharmony_ci	/* Bits [31] - Message Valid bit */
14662306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
14762306a36Sopenharmony_ci
14862306a36Sopenharmony_ci
14962306a36Sopenharmony_ci/*
15062306a36Sopenharmony_ci * brief the data structure of PHY Start Command
15162306a36Sopenharmony_ci * use to describe enable the phy (64 bytes)
15262306a36Sopenharmony_ci */
15362306a36Sopenharmony_cistruct phy_start_req {
15462306a36Sopenharmony_ci	__le32	tag;
15562306a36Sopenharmony_ci	__le32	ase_sh_lm_slr_phyid;
15662306a36Sopenharmony_ci	struct sas_identify_frame sas_identify;
15762306a36Sopenharmony_ci	u32	reserved[5];
15862306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ci
16162306a36Sopenharmony_ci/*
16262306a36Sopenharmony_ci * brief the data structure of PHY Start Command
16362306a36Sopenharmony_ci * use to disable the phy (64 bytes)
16462306a36Sopenharmony_ci */
16562306a36Sopenharmony_cistruct phy_stop_req {
16662306a36Sopenharmony_ci	__le32	tag;
16762306a36Sopenharmony_ci	__le32	phy_id;
16862306a36Sopenharmony_ci	u32	reserved[13];
16962306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
17062306a36Sopenharmony_ci
17162306a36Sopenharmony_ci
17262306a36Sopenharmony_ci/* set device bits fis - device to host */
17362306a36Sopenharmony_cistruct  set_dev_bits_fis {
17462306a36Sopenharmony_ci	u8	fis_type;	/* 0xA1*/
17562306a36Sopenharmony_ci	u8	n_i_pmport;
17662306a36Sopenharmony_ci	/* b7 : n Bit. Notification bit. If set device needs attention. */
17762306a36Sopenharmony_ci	/* b6 : i Bit. Interrupt Bit */
17862306a36Sopenharmony_ci	/* b5-b4: reserved2 */
17962306a36Sopenharmony_ci	/* b3-b0: PM Port */
18062306a36Sopenharmony_ci	u8 	status;
18162306a36Sopenharmony_ci	u8	error;
18262306a36Sopenharmony_ci	u32	_r_a;
18362306a36Sopenharmony_ci} __attribute__ ((packed));
18462306a36Sopenharmony_ci/* PIO setup FIS - device to host */
18562306a36Sopenharmony_cistruct  pio_setup_fis {
18662306a36Sopenharmony_ci	u8	fis_type;	/* 0x5f */
18762306a36Sopenharmony_ci	u8	i_d_pmPort;
18862306a36Sopenharmony_ci	/* b7 : reserved */
18962306a36Sopenharmony_ci	/* b6 : i bit. Interrupt bit */
19062306a36Sopenharmony_ci	/* b5 : d bit. data transfer direction. set to 1 for device to host
19162306a36Sopenharmony_ci	xfer */
19262306a36Sopenharmony_ci	/* b4 : reserved */
19362306a36Sopenharmony_ci	/* b3-b0: PM Port */
19462306a36Sopenharmony_ci	u8	status;
19562306a36Sopenharmony_ci	u8	error;
19662306a36Sopenharmony_ci	u8	lbal;
19762306a36Sopenharmony_ci	u8	lbam;
19862306a36Sopenharmony_ci	u8	lbah;
19962306a36Sopenharmony_ci	u8	device;
20062306a36Sopenharmony_ci	u8	lbal_exp;
20162306a36Sopenharmony_ci	u8	lbam_exp;
20262306a36Sopenharmony_ci	u8	lbah_exp;
20362306a36Sopenharmony_ci	u8	_r_a;
20462306a36Sopenharmony_ci	u8	sector_count;
20562306a36Sopenharmony_ci	u8	sector_count_exp;
20662306a36Sopenharmony_ci	u8	_r_b;
20762306a36Sopenharmony_ci	u8	e_status;
20862306a36Sopenharmony_ci	u8	_r_c[2];
20962306a36Sopenharmony_ci	u8	transfer_count;
21062306a36Sopenharmony_ci} __attribute__ ((packed));
21162306a36Sopenharmony_ci
21262306a36Sopenharmony_ci/*
21362306a36Sopenharmony_ci * brief the data structure of SATA Completion Response
21462306a36Sopenharmony_ci * use to describe the sata task response (64 bytes)
21562306a36Sopenharmony_ci */
21662306a36Sopenharmony_cistruct sata_completion_resp {
21762306a36Sopenharmony_ci	__le32	tag;
21862306a36Sopenharmony_ci	__le32	status;
21962306a36Sopenharmony_ci	__le32	param;
22062306a36Sopenharmony_ci	u32	sata_resp[12];
22162306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
22262306a36Sopenharmony_ci
22362306a36Sopenharmony_ci
22462306a36Sopenharmony_ci/*
22562306a36Sopenharmony_ci * brief the data structure of SAS HW Event Notification
22662306a36Sopenharmony_ci * use to alert the host about the hardware event(64 bytes)
22762306a36Sopenharmony_ci */
22862306a36Sopenharmony_cistruct hw_event_resp {
22962306a36Sopenharmony_ci	__le32	lr_evt_status_phyid_portid;
23062306a36Sopenharmony_ci	__le32	evt_param;
23162306a36Sopenharmony_ci	__le32	npip_portstate;
23262306a36Sopenharmony_ci	struct sas_identify_frame	sas_identify;
23362306a36Sopenharmony_ci	struct dev_to_host_fis	sata_fis;
23462306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
23562306a36Sopenharmony_ci
23662306a36Sopenharmony_ci
23762306a36Sopenharmony_ci/*
23862306a36Sopenharmony_ci * brief the data structure of  REGISTER DEVICE Command
23962306a36Sopenharmony_ci * use to describe MPI REGISTER DEVICE Command (64 bytes)
24062306a36Sopenharmony_ci */
24162306a36Sopenharmony_ci
24262306a36Sopenharmony_cistruct reg_dev_req {
24362306a36Sopenharmony_ci	__le32	tag;
24462306a36Sopenharmony_ci	__le32	phyid_portid;
24562306a36Sopenharmony_ci	__le32	dtype_dlr_retry;
24662306a36Sopenharmony_ci	__le32	firstburstsize_ITNexustimeout;
24762306a36Sopenharmony_ci	u8	sas_addr[SAS_ADDR_SIZE];
24862306a36Sopenharmony_ci	__le32	upper_device_id;
24962306a36Sopenharmony_ci	u32	reserved[8];
25062306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
25162306a36Sopenharmony_ci
25262306a36Sopenharmony_ci
25362306a36Sopenharmony_ci/*
25462306a36Sopenharmony_ci * brief the data structure of  DEREGISTER DEVICE Command
25562306a36Sopenharmony_ci * use to request spc to remove all internal resources associated
25662306a36Sopenharmony_ci * with the device id (64 bytes)
25762306a36Sopenharmony_ci */
25862306a36Sopenharmony_ci
25962306a36Sopenharmony_cistruct dereg_dev_req {
26062306a36Sopenharmony_ci	__le32	tag;
26162306a36Sopenharmony_ci	__le32	device_id;
26262306a36Sopenharmony_ci	u32	reserved[13];
26362306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
26462306a36Sopenharmony_ci
26562306a36Sopenharmony_ci
26662306a36Sopenharmony_ci/*
26762306a36Sopenharmony_ci * brief the data structure of DEVICE_REGISTRATION Response
26862306a36Sopenharmony_ci * use to notify the completion of the device registration  (64 bytes)
26962306a36Sopenharmony_ci */
27062306a36Sopenharmony_ci
27162306a36Sopenharmony_cistruct dev_reg_resp {
27262306a36Sopenharmony_ci	__le32	tag;
27362306a36Sopenharmony_ci	__le32	status;
27462306a36Sopenharmony_ci	__le32	device_id;
27562306a36Sopenharmony_ci	u32	reserved[12];
27662306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
27762306a36Sopenharmony_ci
27862306a36Sopenharmony_ci
27962306a36Sopenharmony_ci/*
28062306a36Sopenharmony_ci * brief the data structure of Local PHY Control Command
28162306a36Sopenharmony_ci * use to issue PHY CONTROL to local phy (64 bytes)
28262306a36Sopenharmony_ci */
28362306a36Sopenharmony_cistruct local_phy_ctl_req {
28462306a36Sopenharmony_ci	__le32	tag;
28562306a36Sopenharmony_ci	__le32	phyop_phyid;
28662306a36Sopenharmony_ci	u32	reserved1[13];
28762306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
28862306a36Sopenharmony_ci
28962306a36Sopenharmony_ci
29062306a36Sopenharmony_ci/**
29162306a36Sopenharmony_ci * brief the data structure of Local Phy Control Response
29262306a36Sopenharmony_ci * use to describe MPI Local Phy Control Response (64 bytes)
29362306a36Sopenharmony_ci */
29462306a36Sopenharmony_cistruct local_phy_ctl_resp {
29562306a36Sopenharmony_ci	__le32	tag;
29662306a36Sopenharmony_ci	__le32	phyop_phyid;
29762306a36Sopenharmony_ci	__le32	status;
29862306a36Sopenharmony_ci	u32	reserved[12];
29962306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
30062306a36Sopenharmony_ci
30162306a36Sopenharmony_ci
30262306a36Sopenharmony_ci#define OP_BITS 0x0000FF00
30362306a36Sopenharmony_ci#define ID_BITS 0x000000FF
30462306a36Sopenharmony_ci
30562306a36Sopenharmony_ci/*
30662306a36Sopenharmony_ci * brief the data structure of PORT Control Command
30762306a36Sopenharmony_ci * use to control port properties (64 bytes)
30862306a36Sopenharmony_ci */
30962306a36Sopenharmony_ci
31062306a36Sopenharmony_cistruct port_ctl_req {
31162306a36Sopenharmony_ci	__le32	tag;
31262306a36Sopenharmony_ci	__le32	portop_portid;
31362306a36Sopenharmony_ci	__le32	param0;
31462306a36Sopenharmony_ci	__le32	param1;
31562306a36Sopenharmony_ci	u32	reserved1[11];
31662306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
31762306a36Sopenharmony_ci
31862306a36Sopenharmony_ci
31962306a36Sopenharmony_ci/*
32062306a36Sopenharmony_ci * brief the data structure of HW Event Ack Command
32162306a36Sopenharmony_ci * use to acknowledge receive HW event (64 bytes)
32262306a36Sopenharmony_ci */
32362306a36Sopenharmony_ci
32462306a36Sopenharmony_cistruct hw_event_ack_req {
32562306a36Sopenharmony_ci	__le32	tag;
32662306a36Sopenharmony_ci	__le32	sea_phyid_portid;
32762306a36Sopenharmony_ci	__le32	param0;
32862306a36Sopenharmony_ci	__le32	param1;
32962306a36Sopenharmony_ci	u32	reserved1[11];
33062306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
33162306a36Sopenharmony_ci
33262306a36Sopenharmony_ci
33362306a36Sopenharmony_ci/*
33462306a36Sopenharmony_ci * brief the data structure of SSP Completion Response
33562306a36Sopenharmony_ci * use to indicate a SSP Completion  (n bytes)
33662306a36Sopenharmony_ci */
33762306a36Sopenharmony_cistruct ssp_completion_resp {
33862306a36Sopenharmony_ci	__le32	tag;
33962306a36Sopenharmony_ci	__le32	status;
34062306a36Sopenharmony_ci	__le32	param;
34162306a36Sopenharmony_ci	__le32	ssptag_rescv_rescpad;
34262306a36Sopenharmony_ci	struct ssp_response_iu  ssp_resp_iu;
34362306a36Sopenharmony_ci	__le32	residual_count;
34462306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
34562306a36Sopenharmony_ci
34662306a36Sopenharmony_ci
34762306a36Sopenharmony_ci#define SSP_RESCV_BIT	0x00010000
34862306a36Sopenharmony_ci
34962306a36Sopenharmony_ci/*
35062306a36Sopenharmony_ci * brief the data structure of SATA EVNET esponse
35162306a36Sopenharmony_ci * use to indicate a SATA Completion  (64 bytes)
35262306a36Sopenharmony_ci */
35362306a36Sopenharmony_ci
35462306a36Sopenharmony_cistruct sata_event_resp {
35562306a36Sopenharmony_ci	__le32	tag;
35662306a36Sopenharmony_ci	__le32	event;
35762306a36Sopenharmony_ci	__le32	port_id;
35862306a36Sopenharmony_ci	__le32	device_id;
35962306a36Sopenharmony_ci	u32	reserved[11];
36062306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
36162306a36Sopenharmony_ci
36262306a36Sopenharmony_ci/*
36362306a36Sopenharmony_ci * brief the data structure of SSP EVNET esponse
36462306a36Sopenharmony_ci * use to indicate a SSP Completion  (64 bytes)
36562306a36Sopenharmony_ci */
36662306a36Sopenharmony_ci
36762306a36Sopenharmony_cistruct ssp_event_resp {
36862306a36Sopenharmony_ci	__le32	tag;
36962306a36Sopenharmony_ci	__le32	event;
37062306a36Sopenharmony_ci	__le32	port_id;
37162306a36Sopenharmony_ci	__le32	device_id;
37262306a36Sopenharmony_ci	u32	reserved[11];
37362306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
37462306a36Sopenharmony_ci
37562306a36Sopenharmony_ci/**
37662306a36Sopenharmony_ci * brief the data structure of General Event Notification Response
37762306a36Sopenharmony_ci * use to describe MPI General Event Notification Response (64 bytes)
37862306a36Sopenharmony_ci */
37962306a36Sopenharmony_cistruct general_event_resp {
38062306a36Sopenharmony_ci	__le32	status;
38162306a36Sopenharmony_ci	__le32	inb_IOMB_payload[14];
38262306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
38362306a36Sopenharmony_ci
38462306a36Sopenharmony_ci
38562306a36Sopenharmony_ci#define GENERAL_EVENT_PAYLOAD	14
38662306a36Sopenharmony_ci#define OPCODE_BITS	0x00000fff
38762306a36Sopenharmony_ci
38862306a36Sopenharmony_ci/*
38962306a36Sopenharmony_ci * brief the data structure of SMP Request Command
39062306a36Sopenharmony_ci * use to describe MPI SMP REQUEST Command (64 bytes)
39162306a36Sopenharmony_ci */
39262306a36Sopenharmony_cistruct smp_req {
39362306a36Sopenharmony_ci	__le32	tag;
39462306a36Sopenharmony_ci	__le32	device_id;
39562306a36Sopenharmony_ci	__le32	len_ip_ir;
39662306a36Sopenharmony_ci	/* Bits [0]  - Indirect response */
39762306a36Sopenharmony_ci	/* Bits [1] - Indirect Payload */
39862306a36Sopenharmony_ci	/* Bits [15:2] - Reserved */
39962306a36Sopenharmony_ci	/* Bits [23:16] - direct payload Len */
40062306a36Sopenharmony_ci	/* Bits [31:24] - Reserved */
40162306a36Sopenharmony_ci	u8	smp_req16[16];
40262306a36Sopenharmony_ci	union {
40362306a36Sopenharmony_ci		u8	smp_req[32];
40462306a36Sopenharmony_ci		struct {
40562306a36Sopenharmony_ci			__le64 long_req_addr;/* sg dma address, LE */
40662306a36Sopenharmony_ci			__le32 long_req_size;/* LE */
40762306a36Sopenharmony_ci			u32	_r_a;
40862306a36Sopenharmony_ci			__le64 long_resp_addr;/* sg dma address, LE */
40962306a36Sopenharmony_ci			__le32 long_resp_size;/* LE */
41062306a36Sopenharmony_ci			u32	_r_b;
41162306a36Sopenharmony_ci			} long_smp_req;/* sequencer extension */
41262306a36Sopenharmony_ci	};
41362306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
41462306a36Sopenharmony_ci/*
41562306a36Sopenharmony_ci * brief the data structure of SMP Completion Response
41662306a36Sopenharmony_ci * use to describe MPI SMP Completion Response (64 bytes)
41762306a36Sopenharmony_ci */
41862306a36Sopenharmony_cistruct smp_completion_resp {
41962306a36Sopenharmony_ci	__le32	tag;
42062306a36Sopenharmony_ci	__le32	status;
42162306a36Sopenharmony_ci	__le32	param;
42262306a36Sopenharmony_ci	__le32	_r_a[12];
42362306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
42462306a36Sopenharmony_ci
42562306a36Sopenharmony_ci/*
42662306a36Sopenharmony_ci *brief the data structure of SSP SMP SATA Abort Command
42762306a36Sopenharmony_ci * use to describe MPI SSP SMP & SATA Abort Command (64 bytes)
42862306a36Sopenharmony_ci */
42962306a36Sopenharmony_cistruct task_abort_req {
43062306a36Sopenharmony_ci	__le32	tag;
43162306a36Sopenharmony_ci	__le32	device_id;
43262306a36Sopenharmony_ci	__le32	tag_to_abort;
43362306a36Sopenharmony_ci	__le32	abort_all;
43462306a36Sopenharmony_ci	u32	reserved[11];
43562306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
43662306a36Sopenharmony_ci
43762306a36Sopenharmony_ci/**
43862306a36Sopenharmony_ci * brief the data structure of SSP SATA SMP Abort Response
43962306a36Sopenharmony_ci * use to describe SSP SMP & SATA Abort Response ( 64 bytes)
44062306a36Sopenharmony_ci */
44162306a36Sopenharmony_cistruct task_abort_resp {
44262306a36Sopenharmony_ci	__le32	tag;
44362306a36Sopenharmony_ci	__le32	status;
44462306a36Sopenharmony_ci	__le32	scp;
44562306a36Sopenharmony_ci	u32	reserved[12];
44662306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
44762306a36Sopenharmony_ci
44862306a36Sopenharmony_ci
44962306a36Sopenharmony_ci/**
45062306a36Sopenharmony_ci * brief the data structure of SAS Diagnostic Start/End Command
45162306a36Sopenharmony_ci * use to describe MPI SAS Diagnostic Start/End Command (64 bytes)
45262306a36Sopenharmony_ci */
45362306a36Sopenharmony_cistruct sas_diag_start_end_req {
45462306a36Sopenharmony_ci	__le32	tag;
45562306a36Sopenharmony_ci	__le32	operation_phyid;
45662306a36Sopenharmony_ci	u32	reserved[13];
45762306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
45862306a36Sopenharmony_ci
45962306a36Sopenharmony_ci
46062306a36Sopenharmony_ci/**
46162306a36Sopenharmony_ci * brief the data structure of SAS Diagnostic Execute Command
46262306a36Sopenharmony_ci * use to describe MPI SAS Diagnostic Execute Command (64 bytes)
46362306a36Sopenharmony_ci */
46462306a36Sopenharmony_cistruct sas_diag_execute_req{
46562306a36Sopenharmony_ci	__le32	tag;
46662306a36Sopenharmony_ci	__le32	cmdtype_cmddesc_phyid;
46762306a36Sopenharmony_ci	__le32	pat1_pat2;
46862306a36Sopenharmony_ci	__le32	threshold;
46962306a36Sopenharmony_ci	__le32	codepat_errmsk;
47062306a36Sopenharmony_ci	__le32	pmon;
47162306a36Sopenharmony_ci	__le32	pERF1CTL;
47262306a36Sopenharmony_ci	u32	reserved[8];
47362306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
47462306a36Sopenharmony_ci
47562306a36Sopenharmony_ci
47662306a36Sopenharmony_ci#define SAS_DIAG_PARAM_BYTES 24
47762306a36Sopenharmony_ci
47862306a36Sopenharmony_ci/*
47962306a36Sopenharmony_ci * brief the data structure of Set Device State Command
48062306a36Sopenharmony_ci * use to describe MPI Set Device State Command (64 bytes)
48162306a36Sopenharmony_ci */
48262306a36Sopenharmony_cistruct set_dev_state_req {
48362306a36Sopenharmony_ci	__le32	tag;
48462306a36Sopenharmony_ci	__le32	device_id;
48562306a36Sopenharmony_ci	__le32	nds;
48662306a36Sopenharmony_ci	u32	reserved[12];
48762306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
48862306a36Sopenharmony_ci
48962306a36Sopenharmony_ci/*
49062306a36Sopenharmony_ci * brief the data structure of sas_re_initialization
49162306a36Sopenharmony_ci */
49262306a36Sopenharmony_cistruct sas_re_initialization_req {
49362306a36Sopenharmony_ci
49462306a36Sopenharmony_ci	__le32	tag;
49562306a36Sopenharmony_ci	__le32	SSAHOLT;/* bit29-set max port;
49662306a36Sopenharmony_ci			** bit28-set open reject cmd retries.
49762306a36Sopenharmony_ci			** bit27-set open reject data retries.
49862306a36Sopenharmony_ci			** bit26-set open reject option, remap:1 or not:0.
49962306a36Sopenharmony_ci			** bit25-set sata head of line time out.
50062306a36Sopenharmony_ci			*/
50162306a36Sopenharmony_ci	__le32 reserved_maxPorts;
50262306a36Sopenharmony_ci	__le32 open_reject_cmdretries_data_retries;/* cmd retries: 31-bit16;
50362306a36Sopenharmony_ci						    * data retries: bit15-bit0.
50462306a36Sopenharmony_ci						    */
50562306a36Sopenharmony_ci	__le32	sata_hol_tmo;
50662306a36Sopenharmony_ci	u32	reserved1[10];
50762306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
50862306a36Sopenharmony_ci
50962306a36Sopenharmony_ci/*
51062306a36Sopenharmony_ci * brief the data structure of SATA Start Command
51162306a36Sopenharmony_ci * use to describe MPI SATA IO Start Command (64 bytes)
51262306a36Sopenharmony_ci */
51362306a36Sopenharmony_ci
51462306a36Sopenharmony_cistruct sata_start_req {
51562306a36Sopenharmony_ci	__le32	tag;
51662306a36Sopenharmony_ci	__le32	device_id;
51762306a36Sopenharmony_ci	__le32	data_len;
51862306a36Sopenharmony_ci	__le32	retfis_ncqtag_atap_dir_m;
51962306a36Sopenharmony_ci	struct host_to_dev_fis	sata_fis;
52062306a36Sopenharmony_ci	u32	reserved1;
52162306a36Sopenharmony_ci	u32	reserved2;
52262306a36Sopenharmony_ci	u32	addr_low;
52362306a36Sopenharmony_ci	u32	addr_high;
52462306a36Sopenharmony_ci	__le32	len;
52562306a36Sopenharmony_ci	__le32	esgl;
52662306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
52762306a36Sopenharmony_ci
52862306a36Sopenharmony_ci/**
52962306a36Sopenharmony_ci * brief the data structure of SSP INI TM Start Command
53062306a36Sopenharmony_ci * use to describe MPI SSP INI TM Start Command (64 bytes)
53162306a36Sopenharmony_ci */
53262306a36Sopenharmony_cistruct ssp_ini_tm_start_req {
53362306a36Sopenharmony_ci	__le32	tag;
53462306a36Sopenharmony_ci	__le32	device_id;
53562306a36Sopenharmony_ci	__le32	relate_tag;
53662306a36Sopenharmony_ci	__le32	tmf;
53762306a36Sopenharmony_ci	u8	lun[8];
53862306a36Sopenharmony_ci	__le32	ds_ads_m;
53962306a36Sopenharmony_ci	u32	reserved[8];
54062306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
54162306a36Sopenharmony_ci
54262306a36Sopenharmony_ci
54362306a36Sopenharmony_cistruct ssp_info_unit {
54462306a36Sopenharmony_ci	u8	lun[8];/* SCSI Logical Unit Number */
54562306a36Sopenharmony_ci	u8	reserved1;/* reserved */
54662306a36Sopenharmony_ci	u8	efb_prio_attr;
54762306a36Sopenharmony_ci	/* B7   : enabledFirstBurst */
54862306a36Sopenharmony_ci	/* B6-3 : taskPriority */
54962306a36Sopenharmony_ci	/* B2-0 : taskAttribute */
55062306a36Sopenharmony_ci	u8	reserved2;	/* reserved */
55162306a36Sopenharmony_ci	u8	additional_cdb_len;
55262306a36Sopenharmony_ci	/* B7-2 : additional_cdb_len */
55362306a36Sopenharmony_ci	/* B1-0 : reserved */
55462306a36Sopenharmony_ci	u8	cdb[16];/* The SCSI CDB up to 16 bytes length */
55562306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
55662306a36Sopenharmony_ci
55762306a36Sopenharmony_ci
55862306a36Sopenharmony_ci/**
55962306a36Sopenharmony_ci * brief the data structure of SSP INI IO Start Command
56062306a36Sopenharmony_ci * use to describe MPI SSP INI IO Start Command (64 bytes)
56162306a36Sopenharmony_ci */
56262306a36Sopenharmony_cistruct ssp_ini_io_start_req {
56362306a36Sopenharmony_ci	__le32	tag;
56462306a36Sopenharmony_ci	__le32	device_id;
56562306a36Sopenharmony_ci	__le32	data_len;
56662306a36Sopenharmony_ci	__le32	dir_m_tlr;
56762306a36Sopenharmony_ci	struct ssp_info_unit	ssp_iu;
56862306a36Sopenharmony_ci	__le32	addr_low;
56962306a36Sopenharmony_ci	__le32	addr_high;
57062306a36Sopenharmony_ci	__le32	len;
57162306a36Sopenharmony_ci	__le32	esgl;
57262306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
57362306a36Sopenharmony_ci
57462306a36Sopenharmony_ci
57562306a36Sopenharmony_ci/**
57662306a36Sopenharmony_ci * brief the data structure of Firmware download
57762306a36Sopenharmony_ci * use to describe MPI FW DOWNLOAD Command (64 bytes)
57862306a36Sopenharmony_ci */
57962306a36Sopenharmony_cistruct fw_flash_Update_req {
58062306a36Sopenharmony_ci	__le32	tag;
58162306a36Sopenharmony_ci	__le32	cur_image_offset;
58262306a36Sopenharmony_ci	__le32	cur_image_len;
58362306a36Sopenharmony_ci	__le32	total_image_len;
58462306a36Sopenharmony_ci	u32	reserved0[7];
58562306a36Sopenharmony_ci	__le32	sgl_addr_lo;
58662306a36Sopenharmony_ci	__le32	sgl_addr_hi;
58762306a36Sopenharmony_ci	__le32	len;
58862306a36Sopenharmony_ci	__le32	ext_reserved;
58962306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
59062306a36Sopenharmony_ci
59162306a36Sopenharmony_ci
59262306a36Sopenharmony_ci#define FWFLASH_IOMB_RESERVED_LEN 0x07
59362306a36Sopenharmony_ci/**
59462306a36Sopenharmony_ci * brief the data structure of FW_FLASH_UPDATE Response
59562306a36Sopenharmony_ci * use to describe MPI FW_FLASH_UPDATE Response (64 bytes)
59662306a36Sopenharmony_ci *
59762306a36Sopenharmony_ci */
59862306a36Sopenharmony_cistruct fw_flash_Update_resp {
59962306a36Sopenharmony_ci	__le32	tag;
60062306a36Sopenharmony_ci	__le32	status;
60162306a36Sopenharmony_ci	u32	reserved[13];
60262306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
60362306a36Sopenharmony_ci
60462306a36Sopenharmony_ci
60562306a36Sopenharmony_ci/**
60662306a36Sopenharmony_ci * brief the data structure of Get NVM Data Command
60762306a36Sopenharmony_ci * use to get data from NVM in HBA(64 bytes)
60862306a36Sopenharmony_ci */
60962306a36Sopenharmony_cistruct get_nvm_data_req {
61062306a36Sopenharmony_ci	__le32	tag;
61162306a36Sopenharmony_ci	__le32	len_ir_vpdd;
61262306a36Sopenharmony_ci	__le32	vpd_offset;
61362306a36Sopenharmony_ci	u32	reserved[8];
61462306a36Sopenharmony_ci	__le32	resp_addr_lo;
61562306a36Sopenharmony_ci	__le32	resp_addr_hi;
61662306a36Sopenharmony_ci	__le32	resp_len;
61762306a36Sopenharmony_ci	u32	reserved1;
61862306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
61962306a36Sopenharmony_ci
62062306a36Sopenharmony_ci
62162306a36Sopenharmony_cistruct set_nvm_data_req {
62262306a36Sopenharmony_ci	__le32	tag;
62362306a36Sopenharmony_ci	__le32	len_ir_vpdd;
62462306a36Sopenharmony_ci	__le32	vpd_offset;
62562306a36Sopenharmony_ci	__le32	reserved[8];
62662306a36Sopenharmony_ci	__le32	resp_addr_lo;
62762306a36Sopenharmony_ci	__le32	resp_addr_hi;
62862306a36Sopenharmony_ci	__le32	resp_len;
62962306a36Sopenharmony_ci	u32	reserved1;
63062306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
63162306a36Sopenharmony_ci
63262306a36Sopenharmony_ci
63362306a36Sopenharmony_ci#define TWI_DEVICE	0x0
63462306a36Sopenharmony_ci#define C_SEEPROM	0x1
63562306a36Sopenharmony_ci#define VPD_FLASH	0x4
63662306a36Sopenharmony_ci#define AAP1_RDUMP	0x5
63762306a36Sopenharmony_ci#define IOP_RDUMP	0x6
63862306a36Sopenharmony_ci#define EXPAN_ROM	0x7
63962306a36Sopenharmony_ci
64062306a36Sopenharmony_ci#define IPMode		0x80000000
64162306a36Sopenharmony_ci#define NVMD_TYPE	0x0000000F
64262306a36Sopenharmony_ci#define NVMD_STAT	0x0000FFFF
64362306a36Sopenharmony_ci#define NVMD_LEN	0xFF000000
64462306a36Sopenharmony_ci/**
64562306a36Sopenharmony_ci * brief the data structure of Get NVMD Data Response
64662306a36Sopenharmony_ci * use to describe MPI Get NVMD Data Response (64 bytes)
64762306a36Sopenharmony_ci */
64862306a36Sopenharmony_cistruct get_nvm_data_resp {
64962306a36Sopenharmony_ci	__le32		tag;
65062306a36Sopenharmony_ci	__le32		ir_tda_bn_dps_das_nvm;
65162306a36Sopenharmony_ci	__le32		dlen_status;
65262306a36Sopenharmony_ci	__le32		nvm_data[12];
65362306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
65462306a36Sopenharmony_ci
65562306a36Sopenharmony_ci
65662306a36Sopenharmony_ci/**
65762306a36Sopenharmony_ci * brief the data structure of SAS Diagnostic Start/End Response
65862306a36Sopenharmony_ci * use to describe MPI SAS Diagnostic Start/End Response (64 bytes)
65962306a36Sopenharmony_ci *
66062306a36Sopenharmony_ci */
66162306a36Sopenharmony_cistruct sas_diag_start_end_resp {
66262306a36Sopenharmony_ci	__le32		tag;
66362306a36Sopenharmony_ci	__le32		status;
66462306a36Sopenharmony_ci	u32		reserved[13];
66562306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
66662306a36Sopenharmony_ci
66762306a36Sopenharmony_ci
66862306a36Sopenharmony_ci/**
66962306a36Sopenharmony_ci * brief the data structure of SAS Diagnostic Execute Response
67062306a36Sopenharmony_ci * use to describe MPI SAS Diagnostic Execute Response (64 bytes)
67162306a36Sopenharmony_ci *
67262306a36Sopenharmony_ci */
67362306a36Sopenharmony_cistruct sas_diag_execute_resp {
67462306a36Sopenharmony_ci	__le32		tag;
67562306a36Sopenharmony_ci	__le32		cmdtype_cmddesc_phyid;
67662306a36Sopenharmony_ci	__le32		Status;
67762306a36Sopenharmony_ci	__le32		ReportData;
67862306a36Sopenharmony_ci	u32		reserved[11];
67962306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
68062306a36Sopenharmony_ci
68162306a36Sopenharmony_ci
68262306a36Sopenharmony_ci/**
68362306a36Sopenharmony_ci * brief the data structure of Set Device State Response
68462306a36Sopenharmony_ci * use to describe MPI Set Device State Response (64 bytes)
68562306a36Sopenharmony_ci *
68662306a36Sopenharmony_ci */
68762306a36Sopenharmony_cistruct set_dev_state_resp {
68862306a36Sopenharmony_ci	__le32		tag;
68962306a36Sopenharmony_ci	__le32		status;
69062306a36Sopenharmony_ci	__le32		device_id;
69162306a36Sopenharmony_ci	__le32		pds_nds;
69262306a36Sopenharmony_ci	u32		reserved[11];
69362306a36Sopenharmony_ci} __attribute__((packed, aligned(4)));
69462306a36Sopenharmony_ci
69562306a36Sopenharmony_ci
69662306a36Sopenharmony_ci#define NDS_BITS 0x0F
69762306a36Sopenharmony_ci#define PDS_BITS 0xF0
69862306a36Sopenharmony_ci
69962306a36Sopenharmony_ci/*
70062306a36Sopenharmony_ci * HW Events type
70162306a36Sopenharmony_ci */
70262306a36Sopenharmony_ci
70362306a36Sopenharmony_ci#define HW_EVENT_RESET_START			0x01
70462306a36Sopenharmony_ci#define HW_EVENT_CHIP_RESET_COMPLETE		0x02
70562306a36Sopenharmony_ci#define HW_EVENT_PHY_STOP_STATUS		0x03
70662306a36Sopenharmony_ci#define HW_EVENT_SAS_PHY_UP			0x04
70762306a36Sopenharmony_ci#define HW_EVENT_SATA_PHY_UP			0x05
70862306a36Sopenharmony_ci#define HW_EVENT_SATA_SPINUP_HOLD		0x06
70962306a36Sopenharmony_ci#define HW_EVENT_PHY_DOWN			0x07
71062306a36Sopenharmony_ci#define HW_EVENT_PORT_INVALID			0x08
71162306a36Sopenharmony_ci#define HW_EVENT_BROADCAST_CHANGE		0x09
71262306a36Sopenharmony_ci#define HW_EVENT_PHY_ERROR			0x0A
71362306a36Sopenharmony_ci#define HW_EVENT_BROADCAST_SES			0x0B
71462306a36Sopenharmony_ci#define HW_EVENT_INBOUND_CRC_ERROR		0x0C
71562306a36Sopenharmony_ci#define HW_EVENT_HARD_RESET_RECEIVED		0x0D
71662306a36Sopenharmony_ci#define HW_EVENT_MALFUNCTION			0x0E
71762306a36Sopenharmony_ci#define HW_EVENT_ID_FRAME_TIMEOUT		0x0F
71862306a36Sopenharmony_ci#define HW_EVENT_BROADCAST_EXP			0x10
71962306a36Sopenharmony_ci#define HW_EVENT_PHY_START_STATUS		0x11
72062306a36Sopenharmony_ci#define HW_EVENT_LINK_ERR_INVALID_DWORD		0x12
72162306a36Sopenharmony_ci#define HW_EVENT_LINK_ERR_DISPARITY_ERROR	0x13
72262306a36Sopenharmony_ci#define HW_EVENT_LINK_ERR_CODE_VIOLATION	0x14
72362306a36Sopenharmony_ci#define HW_EVENT_LINK_ERR_LOSS_OF_DWORD_SYNCH	0x15
72462306a36Sopenharmony_ci#define HW_EVENT_LINK_ERR_PHY_RESET_FAILED	0x16
72562306a36Sopenharmony_ci#define HW_EVENT_PORT_RECOVERY_TIMER_TMO	0x17
72662306a36Sopenharmony_ci#define HW_EVENT_PORT_RECOVER			0x18
72762306a36Sopenharmony_ci#define HW_EVENT_PORT_RESET_TIMER_TMO		0x19
72862306a36Sopenharmony_ci#define HW_EVENT_PORT_RESET_COMPLETE		0x20
72962306a36Sopenharmony_ci#define EVENT_BROADCAST_ASYNCH_EVENT		0x21
73062306a36Sopenharmony_ci
73162306a36Sopenharmony_ci/* port state */
73262306a36Sopenharmony_ci#define PORT_NOT_ESTABLISHED			0x00
73362306a36Sopenharmony_ci#define PORT_VALID				0x01
73462306a36Sopenharmony_ci#define PORT_LOSTCOMM				0x02
73562306a36Sopenharmony_ci#define PORT_IN_RESET				0x04
73662306a36Sopenharmony_ci#define PORT_INVALID				0x08
73762306a36Sopenharmony_ci
73862306a36Sopenharmony_ci/*
73962306a36Sopenharmony_ci * SSP/SMP/SATA IO Completion Status values
74062306a36Sopenharmony_ci */
74162306a36Sopenharmony_ci
74262306a36Sopenharmony_ci#define IO_SUCCESS				0x00
74362306a36Sopenharmony_ci#define IO_ABORTED				0x01
74462306a36Sopenharmony_ci#define IO_OVERFLOW				0x02
74562306a36Sopenharmony_ci#define IO_UNDERFLOW				0x03
74662306a36Sopenharmony_ci#define IO_FAILED				0x04
74762306a36Sopenharmony_ci#define IO_ABORT_RESET				0x05
74862306a36Sopenharmony_ci#define IO_NOT_VALID				0x06
74962306a36Sopenharmony_ci#define IO_NO_DEVICE				0x07
75062306a36Sopenharmony_ci#define IO_ILLEGAL_PARAMETER			0x08
75162306a36Sopenharmony_ci#define IO_LINK_FAILURE				0x09
75262306a36Sopenharmony_ci#define IO_PROG_ERROR				0x0A
75362306a36Sopenharmony_ci#define IO_EDC_IN_ERROR				0x0B
75462306a36Sopenharmony_ci#define IO_EDC_OUT_ERROR			0x0C
75562306a36Sopenharmony_ci#define IO_ERROR_HW_TIMEOUT			0x0D
75662306a36Sopenharmony_ci#define IO_XFER_ERROR_BREAK			0x0E
75762306a36Sopenharmony_ci#define IO_XFER_ERROR_PHY_NOT_READY		0x0F
75862306a36Sopenharmony_ci#define IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED	0x10
75962306a36Sopenharmony_ci#define IO_OPEN_CNX_ERROR_ZONE_VIOLATION		0x11
76062306a36Sopenharmony_ci#define IO_OPEN_CNX_ERROR_BREAK				0x12
76162306a36Sopenharmony_ci#define IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS			0x13
76262306a36Sopenharmony_ci#define IO_OPEN_CNX_ERROR_BAD_DESTINATION		0x14
76362306a36Sopenharmony_ci#define IO_OPEN_CNX_ERROR_CONNECTION_RATE_NOT_SUPPORTED	0x15
76462306a36Sopenharmony_ci#define IO_OPEN_CNX_ERROR_STP_RESOURCES_BUSY		0x16
76562306a36Sopenharmony_ci#define IO_OPEN_CNX_ERROR_WRONG_DESTINATION		0x17
76662306a36Sopenharmony_ci#define IO_OPEN_CNX_ERROR_UNKNOWN_ERROR			0x18
76762306a36Sopenharmony_ci#define IO_XFER_ERROR_NAK_RECEIVED			0x19
76862306a36Sopenharmony_ci#define IO_XFER_ERROR_ACK_NAK_TIMEOUT			0x1A
76962306a36Sopenharmony_ci#define IO_XFER_ERROR_PEER_ABORTED			0x1B
77062306a36Sopenharmony_ci#define IO_XFER_ERROR_RX_FRAME				0x1C
77162306a36Sopenharmony_ci#define IO_XFER_ERROR_DMA				0x1D
77262306a36Sopenharmony_ci#define IO_XFER_ERROR_CREDIT_TIMEOUT			0x1E
77362306a36Sopenharmony_ci#define IO_XFER_ERROR_SATA_LINK_TIMEOUT			0x1F
77462306a36Sopenharmony_ci#define IO_XFER_ERROR_SATA				0x20
77562306a36Sopenharmony_ci#define IO_XFER_ERROR_ABORTED_DUE_TO_SRST		0x22
77662306a36Sopenharmony_ci#define IO_XFER_ERROR_REJECTED_NCQ_MODE			0x21
77762306a36Sopenharmony_ci#define IO_XFER_ERROR_ABORTED_NCQ_MODE			0x23
77862306a36Sopenharmony_ci#define IO_XFER_OPEN_RETRY_TIMEOUT			0x24
77962306a36Sopenharmony_ci#define IO_XFER_SMP_RESP_CONNECTION_ERROR		0x25
78062306a36Sopenharmony_ci#define IO_XFER_ERROR_UNEXPECTED_PHASE			0x26
78162306a36Sopenharmony_ci#define IO_XFER_ERROR_XFER_RDY_OVERRUN			0x27
78262306a36Sopenharmony_ci#define IO_XFER_ERROR_XFER_RDY_NOT_EXPECTED		0x28
78362306a36Sopenharmony_ci
78462306a36Sopenharmony_ci#define IO_XFER_ERROR_CMD_ISSUE_ACK_NAK_TIMEOUT		0x30
78562306a36Sopenharmony_ci#define IO_XFER_ERROR_CMD_ISSUE_BREAK_BEFORE_ACK_NAK	0x31
78662306a36Sopenharmony_ci#define IO_XFER_ERROR_CMD_ISSUE_PHY_DOWN_BEFORE_ACK_NAK	0x32
78762306a36Sopenharmony_ci
78862306a36Sopenharmony_ci#define IO_XFER_ERROR_OFFSET_MISMATCH			0x34
78962306a36Sopenharmony_ci#define IO_XFER_ERROR_XFER_ZERO_DATA_LEN		0x35
79062306a36Sopenharmony_ci#define IO_XFER_CMD_FRAME_ISSUED			0x36
79162306a36Sopenharmony_ci#define IO_ERROR_INTERNAL_SMP_RESOURCE			0x37
79262306a36Sopenharmony_ci#define IO_PORT_IN_RESET				0x38
79362306a36Sopenharmony_ci#define IO_DS_NON_OPERATIONAL				0x39
79462306a36Sopenharmony_ci#define IO_DS_IN_RECOVERY				0x3A
79562306a36Sopenharmony_ci#define IO_TM_TAG_NOT_FOUND				0x3B
79662306a36Sopenharmony_ci#define IO_XFER_PIO_SETUP_ERROR				0x3C
79762306a36Sopenharmony_ci#define IO_SSP_EXT_IU_ZERO_LEN_ERROR			0x3D
79862306a36Sopenharmony_ci#define IO_DS_IN_ERROR					0x3E
79962306a36Sopenharmony_ci#define IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY		0x3F
80062306a36Sopenharmony_ci#define IO_ABORT_IN_PROGRESS				0x40
80162306a36Sopenharmony_ci#define IO_ABORT_DELAYED				0x41
80262306a36Sopenharmony_ci#define IO_INVALID_LENGTH				0x42
80362306a36Sopenharmony_ci#define IO_FATAL_ERROR					0x51
80462306a36Sopenharmony_ci
80562306a36Sopenharmony_ci/* WARNING: This error code must always be the last number.
80662306a36Sopenharmony_ci * If you add error code, modify this code also
80762306a36Sopenharmony_ci * It is used as an index
80862306a36Sopenharmony_ci */
80962306a36Sopenharmony_ci#define IO_ERROR_UNKNOWN_GENERIC			0x43
81062306a36Sopenharmony_ci
81162306a36Sopenharmony_ci/* MSGU CONFIGURATION  TABLE*/
81262306a36Sopenharmony_ci
81362306a36Sopenharmony_ci#define SPC_MSGU_CFG_TABLE_UPDATE		0x01/* Inbound doorbell bit0 */
81462306a36Sopenharmony_ci#define SPC_MSGU_CFG_TABLE_RESET		0x02/* Inbound doorbell bit1 */
81562306a36Sopenharmony_ci#define SPC_MSGU_CFG_TABLE_FREEZE		0x04/* Inbound doorbell bit2 */
81662306a36Sopenharmony_ci#define SPC_MSGU_CFG_TABLE_UNFREEZE		0x08/* Inbound doorbell bit4 */
81762306a36Sopenharmony_ci#define MSGU_IBDB_SET				0x04
81862306a36Sopenharmony_ci#define MSGU_HOST_INT_STATUS			0x08
81962306a36Sopenharmony_ci#define MSGU_HOST_INT_MASK			0x0C
82062306a36Sopenharmony_ci#define MSGU_IOPIB_INT_STATUS			0x18
82162306a36Sopenharmony_ci#define MSGU_IOPIB_INT_MASK			0x1C
82262306a36Sopenharmony_ci#define MSGU_IBDB_CLEAR				0x20/* RevB - Host not use */
82362306a36Sopenharmony_ci#define MSGU_MSGU_CONTROL			0x24
82462306a36Sopenharmony_ci#define MSGU_ODR				0x3C/* RevB */
82562306a36Sopenharmony_ci#define MSGU_ODCR				0x40/* RevB */
82662306a36Sopenharmony_ci#define MSGU_SCRATCH_PAD_0			0x44
82762306a36Sopenharmony_ci#define MSGU_SCRATCH_PAD_1			0x48
82862306a36Sopenharmony_ci#define MSGU_SCRATCH_PAD_2			0x4C
82962306a36Sopenharmony_ci#define MSGU_SCRATCH_PAD_3			0x50
83062306a36Sopenharmony_ci#define MSGU_HOST_SCRATCH_PAD_0			0x54
83162306a36Sopenharmony_ci#define MSGU_HOST_SCRATCH_PAD_1			0x58
83262306a36Sopenharmony_ci#define MSGU_HOST_SCRATCH_PAD_2			0x5C
83362306a36Sopenharmony_ci#define MSGU_HOST_SCRATCH_PAD_3			0x60
83462306a36Sopenharmony_ci#define MSGU_HOST_SCRATCH_PAD_4			0x64
83562306a36Sopenharmony_ci#define MSGU_HOST_SCRATCH_PAD_5			0x68
83662306a36Sopenharmony_ci#define MSGU_HOST_SCRATCH_PAD_6			0x6C
83762306a36Sopenharmony_ci#define MSGU_HOST_SCRATCH_PAD_7			0x70
83862306a36Sopenharmony_ci#define MSGU_ODMR				0x74/* RevB */
83962306a36Sopenharmony_ci
84062306a36Sopenharmony_ci/* bit definition for ODMR register */
84162306a36Sopenharmony_ci#define ODMR_MASK_ALL				0xFFFFFFFF/* mask all
84262306a36Sopenharmony_ci					interrupt vector */
84362306a36Sopenharmony_ci#define ODMR_CLEAR_ALL				0/* clear all
84462306a36Sopenharmony_ci					interrupt vector */
84562306a36Sopenharmony_ci/* bit definition for ODCR register */
84662306a36Sopenharmony_ci#define ODCR_CLEAR_ALL		0xFFFFFFFF   /* mask all
84762306a36Sopenharmony_ci					interrupt vector*/
84862306a36Sopenharmony_ci/* MSIX Interupts */
84962306a36Sopenharmony_ci#define MSIX_TABLE_OFFSET		0x2000
85062306a36Sopenharmony_ci#define MSIX_TABLE_ELEMENT_SIZE		0x10
85162306a36Sopenharmony_ci#define MSIX_INTERRUPT_CONTROL_OFFSET	0xC
85262306a36Sopenharmony_ci#define MSIX_TABLE_BASE	  (MSIX_TABLE_OFFSET + MSIX_INTERRUPT_CONTROL_OFFSET)
85362306a36Sopenharmony_ci#define MSIX_INTERRUPT_DISABLE		0x1
85462306a36Sopenharmony_ci#define MSIX_INTERRUPT_ENABLE		0x0
85562306a36Sopenharmony_ci
85662306a36Sopenharmony_ci
85762306a36Sopenharmony_ci/* state definition for Scratch Pad1 register */
85862306a36Sopenharmony_ci#define SCRATCH_PAD1_POR		0x00  /* power on reset state */
85962306a36Sopenharmony_ci#define SCRATCH_PAD1_SFR		0x01  /* soft reset state */
86062306a36Sopenharmony_ci#define SCRATCH_PAD1_ERR		0x02  /* error state */
86162306a36Sopenharmony_ci#define SCRATCH_PAD1_RDY		0x03  /* ready state */
86262306a36Sopenharmony_ci#define SCRATCH_PAD1_RST		0x04  /* soft reset toggle flag */
86362306a36Sopenharmony_ci#define SCRATCH_PAD1_AAP1RDY_RST	0x08  /* AAP1 ready for soft reset */
86462306a36Sopenharmony_ci#define SCRATCH_PAD1_STATE_MASK		0xFFFFFFF0   /* ScratchPad1
86562306a36Sopenharmony_ci Mask, bit1-0 State, bit2 Soft Reset, bit3 FW RDY for Soft Reset */
86662306a36Sopenharmony_ci#define SCRATCH_PAD1_RESERVED		0x000003F8   /* Scratch Pad1
86762306a36Sopenharmony_ci Reserved bit 3 to 9 */
86862306a36Sopenharmony_ci
86962306a36Sopenharmony_ci /* state definition for Scratch Pad2 register */
87062306a36Sopenharmony_ci#define SCRATCH_PAD2_POR		0x00  /* power on state */
87162306a36Sopenharmony_ci#define SCRATCH_PAD2_SFR		0x01  /* soft reset state */
87262306a36Sopenharmony_ci#define SCRATCH_PAD2_ERR		0x02  /* error state */
87362306a36Sopenharmony_ci#define SCRATCH_PAD2_RDY		0x03  /* ready state */
87462306a36Sopenharmony_ci#define SCRATCH_PAD2_FWRDY_RST		0x04  /* FW ready for soft reset flag*/
87562306a36Sopenharmony_ci#define SCRATCH_PAD2_IOPRDY_RST		0x08  /* IOP ready for soft reset */
87662306a36Sopenharmony_ci#define SCRATCH_PAD2_STATE_MASK		0xFFFFFFF4 /* ScratchPad 2
87762306a36Sopenharmony_ci Mask, bit1-0 State */
87862306a36Sopenharmony_ci#define SCRATCH_PAD2_RESERVED		0x000003FC   /* Scratch Pad1
87962306a36Sopenharmony_ci Reserved bit 2 to 9 */
88062306a36Sopenharmony_ci
88162306a36Sopenharmony_ci#define SCRATCH_PAD_ERROR_MASK		0xFFFFFC00   /* Error mask bits */
88262306a36Sopenharmony_ci#define SCRATCH_PAD_STATE_MASK		0x00000003   /* State Mask bits */
88362306a36Sopenharmony_ci
88462306a36Sopenharmony_ci/* main configuration offset - byte offset */
88562306a36Sopenharmony_ci#define MAIN_SIGNATURE_OFFSET		0x00/* DWORD 0x00 */
88662306a36Sopenharmony_ci#define MAIN_INTERFACE_REVISION		0x04/* DWORD 0x01 */
88762306a36Sopenharmony_ci#define MAIN_FW_REVISION		0x08/* DWORD 0x02 */
88862306a36Sopenharmony_ci#define MAIN_MAX_OUTSTANDING_IO_OFFSET	0x0C/* DWORD 0x03 */
88962306a36Sopenharmony_ci#define MAIN_MAX_SGL_OFFSET		0x10/* DWORD 0x04 */
89062306a36Sopenharmony_ci#define MAIN_CNTRL_CAP_OFFSET		0x14/* DWORD 0x05 */
89162306a36Sopenharmony_ci#define MAIN_GST_OFFSET			0x18/* DWORD 0x06 */
89262306a36Sopenharmony_ci#define MAIN_IBQ_OFFSET			0x1C/* DWORD 0x07 */
89362306a36Sopenharmony_ci#define MAIN_OBQ_OFFSET			0x20/* DWORD 0x08 */
89462306a36Sopenharmony_ci#define MAIN_IQNPPD_HPPD_OFFSET		0x24/* DWORD 0x09 */
89562306a36Sopenharmony_ci#define MAIN_OB_HW_EVENT_PID03_OFFSET	0x28/* DWORD 0x0A */
89662306a36Sopenharmony_ci#define MAIN_OB_HW_EVENT_PID47_OFFSET	0x2C/* DWORD 0x0B */
89762306a36Sopenharmony_ci#define MAIN_OB_NCQ_EVENT_PID03_OFFSET	0x30/* DWORD 0x0C */
89862306a36Sopenharmony_ci#define MAIN_OB_NCQ_EVENT_PID47_OFFSET	0x34/* DWORD 0x0D */
89962306a36Sopenharmony_ci#define MAIN_TITNX_EVENT_PID03_OFFSET	0x38/* DWORD 0x0E */
90062306a36Sopenharmony_ci#define MAIN_TITNX_EVENT_PID47_OFFSET	0x3C/* DWORD 0x0F */
90162306a36Sopenharmony_ci#define MAIN_OB_SSP_EVENT_PID03_OFFSET	0x40/* DWORD 0x10 */
90262306a36Sopenharmony_ci#define MAIN_OB_SSP_EVENT_PID47_OFFSET	0x44/* DWORD 0x11 */
90362306a36Sopenharmony_ci#define MAIN_OB_SMP_EVENT_PID03_OFFSET	0x48/* DWORD 0x12 */
90462306a36Sopenharmony_ci#define MAIN_OB_SMP_EVENT_PID47_OFFSET	0x4C/* DWORD 0x13 */
90562306a36Sopenharmony_ci#define MAIN_EVENT_LOG_ADDR_HI		0x50/* DWORD 0x14 */
90662306a36Sopenharmony_ci#define MAIN_EVENT_LOG_ADDR_LO		0x54/* DWORD 0x15 */
90762306a36Sopenharmony_ci#define MAIN_EVENT_LOG_BUFF_SIZE	0x58/* DWORD 0x16 */
90862306a36Sopenharmony_ci#define MAIN_EVENT_LOG_OPTION		0x5C/* DWORD 0x17 */
90962306a36Sopenharmony_ci#define MAIN_IOP_EVENT_LOG_ADDR_HI	0x60/* DWORD 0x18 */
91062306a36Sopenharmony_ci#define MAIN_IOP_EVENT_LOG_ADDR_LO	0x64/* DWORD 0x19 */
91162306a36Sopenharmony_ci#define MAIN_IOP_EVENT_LOG_BUFF_SIZE	0x68/* DWORD 0x1A */
91262306a36Sopenharmony_ci#define MAIN_IOP_EVENT_LOG_OPTION	0x6C/* DWORD 0x1B */
91362306a36Sopenharmony_ci#define MAIN_FATAL_ERROR_INTERRUPT	0x70/* DWORD 0x1C */
91462306a36Sopenharmony_ci#define MAIN_FATAL_ERROR_RDUMP0_OFFSET	0x74/* DWORD 0x1D */
91562306a36Sopenharmony_ci#define MAIN_FATAL_ERROR_RDUMP0_LENGTH	0x78/* DWORD 0x1E */
91662306a36Sopenharmony_ci#define MAIN_FATAL_ERROR_RDUMP1_OFFSET	0x7C/* DWORD 0x1F */
91762306a36Sopenharmony_ci#define MAIN_FATAL_ERROR_RDUMP1_LENGTH	0x80/* DWORD 0x20 */
91862306a36Sopenharmony_ci#define MAIN_HDA_FLAGS_OFFSET		0x84/* DWORD 0x21 */
91962306a36Sopenharmony_ci#define MAIN_ANALOG_SETUP_OFFSET	0x88/* DWORD 0x22 */
92062306a36Sopenharmony_ci
92162306a36Sopenharmony_ci/* Gereral Status Table offset - byte offset */
92262306a36Sopenharmony_ci#define GST_GSTLEN_MPIS_OFFSET		0x00
92362306a36Sopenharmony_ci#define GST_IQ_FREEZE_STATE0_OFFSET	0x04
92462306a36Sopenharmony_ci#define GST_IQ_FREEZE_STATE1_OFFSET	0x08
92562306a36Sopenharmony_ci#define GST_MSGUTCNT_OFFSET		0x0C
92662306a36Sopenharmony_ci#define GST_IOPTCNT_OFFSET		0x10
92762306a36Sopenharmony_ci#define GST_PHYSTATE_OFFSET		0x18
92862306a36Sopenharmony_ci#define GST_PHYSTATE0_OFFSET		0x18
92962306a36Sopenharmony_ci#define GST_PHYSTATE1_OFFSET		0x1C
93062306a36Sopenharmony_ci#define GST_PHYSTATE2_OFFSET		0x20
93162306a36Sopenharmony_ci#define GST_PHYSTATE3_OFFSET		0x24
93262306a36Sopenharmony_ci#define GST_PHYSTATE4_OFFSET		0x28
93362306a36Sopenharmony_ci#define GST_PHYSTATE5_OFFSET		0x2C
93462306a36Sopenharmony_ci#define GST_PHYSTATE6_OFFSET		0x30
93562306a36Sopenharmony_ci#define GST_PHYSTATE7_OFFSET		0x34
93662306a36Sopenharmony_ci#define GST_RERRINFO_OFFSET		0x44
93762306a36Sopenharmony_ci
93862306a36Sopenharmony_ci/* General Status Table - MPI state */
93962306a36Sopenharmony_ci#define GST_MPI_STATE_UNINIT		0x00
94062306a36Sopenharmony_ci#define GST_MPI_STATE_INIT		0x01
94162306a36Sopenharmony_ci#define GST_MPI_STATE_TERMINATION	0x02
94262306a36Sopenharmony_ci#define GST_MPI_STATE_ERROR		0x03
94362306a36Sopenharmony_ci#define GST_MPI_STATE_MASK		0x07
94462306a36Sopenharmony_ci
94562306a36Sopenharmony_ci#define MBIC_NMI_ENABLE_VPE0_IOP	0x000418
94662306a36Sopenharmony_ci#define MBIC_NMI_ENABLE_VPE0_AAP1	0x000418
94762306a36Sopenharmony_ci/* PCIE registers - BAR2(0x18), BAR1(win) 0x010000 */
94862306a36Sopenharmony_ci#define PCIE_EVENT_INTERRUPT_ENABLE	0x003040
94962306a36Sopenharmony_ci#define PCIE_EVENT_INTERRUPT		0x003044
95062306a36Sopenharmony_ci#define PCIE_ERROR_INTERRUPT_ENABLE	0x003048
95162306a36Sopenharmony_ci#define PCIE_ERROR_INTERRUPT		0x00304C
95262306a36Sopenharmony_ci/* signature definition for host scratch pad0 register */
95362306a36Sopenharmony_ci#define SPC_SOFT_RESET_SIGNATURE	0x252acbcd
95462306a36Sopenharmony_ci/* Signature for Soft Reset */
95562306a36Sopenharmony_ci
95662306a36Sopenharmony_ci/* SPC Reset register - BAR4(0x20), BAR2(win) (need dynamic mapping) */
95762306a36Sopenharmony_ci#define SPC_REG_RESET			0x000000/* reset register */
95862306a36Sopenharmony_ci
95962306a36Sopenharmony_ci/* bit difination for SPC_RESET register */
96062306a36Sopenharmony_ci#define   SPC_REG_RESET_OSSP		0x00000001
96162306a36Sopenharmony_ci#define   SPC_REG_RESET_RAAE		0x00000002
96262306a36Sopenharmony_ci#define   SPC_REG_RESET_PCS_SPBC	0x00000004
96362306a36Sopenharmony_ci#define   SPC_REG_RESET_PCS_IOP_SS	0x00000008
96462306a36Sopenharmony_ci#define   SPC_REG_RESET_PCS_AAP1_SS	0x00000010
96562306a36Sopenharmony_ci#define   SPC_REG_RESET_PCS_AAP2_SS	0x00000020
96662306a36Sopenharmony_ci#define   SPC_REG_RESET_PCS_LM		0x00000040
96762306a36Sopenharmony_ci#define   SPC_REG_RESET_PCS		0x00000080
96862306a36Sopenharmony_ci#define   SPC_REG_RESET_GSM		0x00000100
96962306a36Sopenharmony_ci#define   SPC_REG_RESET_DDR2		0x00010000
97062306a36Sopenharmony_ci#define   SPC_REG_RESET_BDMA_CORE	0x00020000
97162306a36Sopenharmony_ci#define   SPC_REG_RESET_BDMA_SXCBI	0x00040000
97262306a36Sopenharmony_ci#define   SPC_REG_RESET_PCIE_AL_SXCBI	0x00080000
97362306a36Sopenharmony_ci#define   SPC_REG_RESET_PCIE_PWR	0x00100000
97462306a36Sopenharmony_ci#define   SPC_REG_RESET_PCIE_SFT	0x00200000
97562306a36Sopenharmony_ci#define   SPC_REG_RESET_PCS_SXCBI	0x00400000
97662306a36Sopenharmony_ci#define   SPC_REG_RESET_LMS_SXCBI	0x00800000
97762306a36Sopenharmony_ci#define   SPC_REG_RESET_PMIC_SXCBI	0x01000000
97862306a36Sopenharmony_ci#define   SPC_REG_RESET_PMIC_CORE	0x02000000
97962306a36Sopenharmony_ci#define   SPC_REG_RESET_PCIE_PC_SXCBI	0x04000000
98062306a36Sopenharmony_ci#define   SPC_REG_RESET_DEVICE		0x80000000
98162306a36Sopenharmony_ci
98262306a36Sopenharmony_ci/* registers for BAR Shifting - BAR2(0x18), BAR1(win) */
98362306a36Sopenharmony_ci#define SPC_IBW_AXI_TRANSLATION_LOW	0x003258
98462306a36Sopenharmony_ci
98562306a36Sopenharmony_ci#define MBIC_AAP1_ADDR_BASE		0x060000
98662306a36Sopenharmony_ci#define MBIC_IOP_ADDR_BASE		0x070000
98762306a36Sopenharmony_ci#define GSM_ADDR_BASE			0x0700000
98862306a36Sopenharmony_ci/* Dynamic map through Bar4 - 0x00700000 */
98962306a36Sopenharmony_ci#define GSM_CONFIG_RESET		0x00000000
99062306a36Sopenharmony_ci#define RAM_ECC_DB_ERR			0x00000018
99162306a36Sopenharmony_ci#define GSM_READ_ADDR_PARITY_INDIC	0x00000058
99262306a36Sopenharmony_ci#define GSM_WRITE_ADDR_PARITY_INDIC	0x00000060
99362306a36Sopenharmony_ci#define GSM_WRITE_DATA_PARITY_INDIC	0x00000068
99462306a36Sopenharmony_ci#define GSM_READ_ADDR_PARITY_CHECK	0x00000038
99562306a36Sopenharmony_ci#define GSM_WRITE_ADDR_PARITY_CHECK	0x00000040
99662306a36Sopenharmony_ci#define GSM_WRITE_DATA_PARITY_CHECK	0x00000048
99762306a36Sopenharmony_ci
99862306a36Sopenharmony_ci#define RB6_ACCESS_REG			0x6A0000
99962306a36Sopenharmony_ci#define HDAC_EXEC_CMD			0x0002
100062306a36Sopenharmony_ci#define HDA_C_PA			0xcb
100162306a36Sopenharmony_ci#define HDA_SEQ_ID_BITS			0x00ff0000
100262306a36Sopenharmony_ci#define HDA_GSM_OFFSET_BITS		0x00FFFFFF
100362306a36Sopenharmony_ci#define MBIC_AAP1_ADDR_BASE		0x060000
100462306a36Sopenharmony_ci#define MBIC_IOP_ADDR_BASE		0x070000
100562306a36Sopenharmony_ci#define GSM_ADDR_BASE			0x0700000
100662306a36Sopenharmony_ci#define SPC_TOP_LEVEL_ADDR_BASE		0x000000
100762306a36Sopenharmony_ci#define GSM_CONFIG_RESET_VALUE          0x00003b00
100862306a36Sopenharmony_ci#define GPIO_ADDR_BASE                  0x00090000
100962306a36Sopenharmony_ci#define GPIO_GPIO_0_0UTPUT_CTL_OFFSET   0x0000010c
101062306a36Sopenharmony_ci
101162306a36Sopenharmony_ci/* RB6 offset */
101262306a36Sopenharmony_ci#define SPC_RB6_OFFSET			0x80C0
101362306a36Sopenharmony_ci/* Magic number of  soft reset for RB6 */
101462306a36Sopenharmony_ci#define RB6_MAGIC_NUMBER_RST		0x1234
101562306a36Sopenharmony_ci
101662306a36Sopenharmony_ci/* Device Register status */
101762306a36Sopenharmony_ci#define DEVREG_SUCCESS					0x00
101862306a36Sopenharmony_ci#define DEVREG_FAILURE_OUT_OF_RESOURCE			0x01
101962306a36Sopenharmony_ci#define DEVREG_FAILURE_DEVICE_ALREADY_REGISTERED	0x02
102062306a36Sopenharmony_ci#define DEVREG_FAILURE_INVALID_PHY_ID			0x03
102162306a36Sopenharmony_ci#define DEVREG_FAILURE_PHY_ID_ALREADY_REGISTERED	0x04
102262306a36Sopenharmony_ci#define DEVREG_FAILURE_PORT_ID_OUT_OF_RANGE		0x05
102362306a36Sopenharmony_ci#define DEVREG_FAILURE_PORT_NOT_VALID_STATE		0x06
102462306a36Sopenharmony_ci#define DEVREG_FAILURE_DEVICE_TYPE_NOT_VALID		0x07
102562306a36Sopenharmony_ci
102662306a36Sopenharmony_ci#define GSM_BASE					0x4F0000
102762306a36Sopenharmony_ci#define SHIFT_REG_64K_MASK				0xffff0000
102862306a36Sopenharmony_ci#define SHIFT_REG_BIT_SHIFT				8
102962306a36Sopenharmony_ci#endif
103062306a36Sopenharmony_ci
1031