18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci*******************************************************************************
38c2ecf20Sopenharmony_ci**        O.S   : Linux
48c2ecf20Sopenharmony_ci**   FILE NAME  : arcmsr.h
58c2ecf20Sopenharmony_ci**        BY    : Nick Cheng
68c2ecf20Sopenharmony_ci**   Description: SCSI RAID Device Driver for
78c2ecf20Sopenharmony_ci**                ARECA RAID Host adapter
88c2ecf20Sopenharmony_ci*******************************************************************************
98c2ecf20Sopenharmony_ci** Copyright (C) 2002 - 2005, Areca Technology Corporation All rights reserved.
108c2ecf20Sopenharmony_ci**
118c2ecf20Sopenharmony_ci**     Web site: www.areca.com.tw
128c2ecf20Sopenharmony_ci**       E-mail: support@areca.com.tw
138c2ecf20Sopenharmony_ci**
148c2ecf20Sopenharmony_ci** This program is free software; you can redistribute it and/or modify
158c2ecf20Sopenharmony_ci** it under the terms of the GNU General Public License version 2 as
168c2ecf20Sopenharmony_ci** published by the Free Software Foundation.
178c2ecf20Sopenharmony_ci** This program is distributed in the hope that it will be useful,
188c2ecf20Sopenharmony_ci** but WITHOUT ANY WARRANTY; without even the implied warranty of
198c2ecf20Sopenharmony_ci** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
208c2ecf20Sopenharmony_ci** GNU General Public License for more details.
218c2ecf20Sopenharmony_ci*******************************************************************************
228c2ecf20Sopenharmony_ci** Redistribution and use in source and binary forms, with or without
238c2ecf20Sopenharmony_ci** modification, are permitted provided that the following conditions
248c2ecf20Sopenharmony_ci** are met:
258c2ecf20Sopenharmony_ci** 1. Redistributions of source code must retain the above copyright
268c2ecf20Sopenharmony_ci**    notice, this list of conditions and the following disclaimer.
278c2ecf20Sopenharmony_ci** 2. Redistributions in binary form must reproduce the above copyright
288c2ecf20Sopenharmony_ci**    notice, this list of conditions and the following disclaimer in the
298c2ecf20Sopenharmony_ci**    documentation and/or other materials provided with the distribution.
308c2ecf20Sopenharmony_ci** 3. The name of the author may not be used to endorse or promote products
318c2ecf20Sopenharmony_ci**    derived from this software without specific prior written permission.
328c2ecf20Sopenharmony_ci**
338c2ecf20Sopenharmony_ci** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
348c2ecf20Sopenharmony_ci** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
358c2ecf20Sopenharmony_ci** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
368c2ecf20Sopenharmony_ci** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
378c2ecf20Sopenharmony_ci** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT
388c2ecf20Sopenharmony_ci** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
398c2ecf20Sopenharmony_ci** DATA, OR PROFITS; OR BUSINESS INTERRUPTION)HOWEVER CAUSED AND ON ANY
408c2ecf20Sopenharmony_ci** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
418c2ecf20Sopenharmony_ci**(INCLUDING NEGLIGENCE OR OTHERWISE)ARISING IN ANY WAY OUT OF THE USE OF
428c2ecf20Sopenharmony_ci** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
438c2ecf20Sopenharmony_ci*******************************************************************************
448c2ecf20Sopenharmony_ci*/
458c2ecf20Sopenharmony_ci#include <linux/interrupt.h>
468c2ecf20Sopenharmony_cistruct device_attribute;
478c2ecf20Sopenharmony_ci/*The limit of outstanding scsi command that firmware can handle*/
488c2ecf20Sopenharmony_ci#define ARCMSR_MAX_FREECCB_NUM		1024
498c2ecf20Sopenharmony_ci#define ARCMSR_MAX_OUTSTANDING_CMD	1024
508c2ecf20Sopenharmony_ci#define ARCMSR_DEFAULT_OUTSTANDING_CMD	128
518c2ecf20Sopenharmony_ci#define ARCMSR_MIN_OUTSTANDING_CMD	32
528c2ecf20Sopenharmony_ci#define ARCMSR_DRIVER_VERSION		"v1.50.00.02-20200819"
538c2ecf20Sopenharmony_ci#define ARCMSR_SCSI_INITIATOR_ID	255
548c2ecf20Sopenharmony_ci#define ARCMSR_MAX_XFER_SECTORS		512
558c2ecf20Sopenharmony_ci#define ARCMSR_MAX_XFER_SECTORS_B	4096
568c2ecf20Sopenharmony_ci#define ARCMSR_MAX_XFER_SECTORS_C	304
578c2ecf20Sopenharmony_ci#define ARCMSR_MAX_TARGETID		17
588c2ecf20Sopenharmony_ci#define ARCMSR_MAX_TARGETLUN		8
598c2ecf20Sopenharmony_ci#define ARCMSR_MAX_CMD_PERLUN		128
608c2ecf20Sopenharmony_ci#define ARCMSR_DEFAULT_CMD_PERLUN	32
618c2ecf20Sopenharmony_ci#define ARCMSR_MIN_CMD_PERLUN		1
628c2ecf20Sopenharmony_ci#define ARCMSR_MAX_QBUFFER		4096
638c2ecf20Sopenharmony_ci#define ARCMSR_DEFAULT_SG_ENTRIES	38
648c2ecf20Sopenharmony_ci#define ARCMSR_MAX_HBB_POSTQUEUE	264
658c2ecf20Sopenharmony_ci#define ARCMSR_MAX_ARC1214_POSTQUEUE	256
668c2ecf20Sopenharmony_ci#define ARCMSR_MAX_ARC1214_DONEQUEUE	257
678c2ecf20Sopenharmony_ci#define ARCMSR_MAX_HBE_DONEQUEUE	512
688c2ecf20Sopenharmony_ci#define ARCMSR_MAX_XFER_LEN		0x26000 /* 152K */
698c2ecf20Sopenharmony_ci#define ARCMSR_CDB_SG_PAGE_LENGTH	256
708c2ecf20Sopenharmony_ci#define ARCMST_NUM_MSIX_VECTORS		4
718c2ecf20Sopenharmony_ci#ifndef PCI_DEVICE_ID_ARECA_1880
728c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_ARECA_1880	0x1880
738c2ecf20Sopenharmony_ci#endif
748c2ecf20Sopenharmony_ci#ifndef PCI_DEVICE_ID_ARECA_1214
758c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_ARECA_1214	0x1214
768c2ecf20Sopenharmony_ci#endif
778c2ecf20Sopenharmony_ci#ifndef PCI_DEVICE_ID_ARECA_1203
788c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_ARECA_1203	0x1203
798c2ecf20Sopenharmony_ci#endif
808c2ecf20Sopenharmony_ci#ifndef PCI_DEVICE_ID_ARECA_1883
818c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_ARECA_1883	0x1883
828c2ecf20Sopenharmony_ci#endif
838c2ecf20Sopenharmony_ci#ifndef PCI_DEVICE_ID_ARECA_1884
848c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_ARECA_1884	0x1884
858c2ecf20Sopenharmony_ci#endif
868c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_ARECA_1886_0	0x1886
878c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_ARECA_1886	0x188A
888c2ecf20Sopenharmony_ci#define	ARCMSR_HOURS			(1000 * 60 * 60 * 4)
898c2ecf20Sopenharmony_ci#define	ARCMSR_MINUTES			(1000 * 60 * 60)
908c2ecf20Sopenharmony_ci/*
918c2ecf20Sopenharmony_ci**********************************************************************************
928c2ecf20Sopenharmony_ci**
938c2ecf20Sopenharmony_ci**********************************************************************************
948c2ecf20Sopenharmony_ci*/
958c2ecf20Sopenharmony_ci#define ARC_SUCCESS	0
968c2ecf20Sopenharmony_ci#define ARC_FAILURE	1
978c2ecf20Sopenharmony_ci/*
988c2ecf20Sopenharmony_ci*******************************************************************************
998c2ecf20Sopenharmony_ci**        split 64bits dma addressing
1008c2ecf20Sopenharmony_ci*******************************************************************************
1018c2ecf20Sopenharmony_ci*/
1028c2ecf20Sopenharmony_ci#define dma_addr_hi32(addr)	(uint32_t) ((addr>>16)>>16)
1038c2ecf20Sopenharmony_ci#define dma_addr_lo32(addr)	(uint32_t) (addr & 0xffffffff)
1048c2ecf20Sopenharmony_ci/*
1058c2ecf20Sopenharmony_ci*******************************************************************************
1068c2ecf20Sopenharmony_ci**        MESSAGE CONTROL CODE
1078c2ecf20Sopenharmony_ci*******************************************************************************
1088c2ecf20Sopenharmony_ci*/
1098c2ecf20Sopenharmony_cistruct CMD_MESSAGE
1108c2ecf20Sopenharmony_ci{
1118c2ecf20Sopenharmony_ci      uint32_t HeaderLength;
1128c2ecf20Sopenharmony_ci      uint8_t  Signature[8];
1138c2ecf20Sopenharmony_ci      uint32_t Timeout;
1148c2ecf20Sopenharmony_ci      uint32_t ControlCode;
1158c2ecf20Sopenharmony_ci      uint32_t ReturnCode;
1168c2ecf20Sopenharmony_ci      uint32_t Length;
1178c2ecf20Sopenharmony_ci};
1188c2ecf20Sopenharmony_ci/*
1198c2ecf20Sopenharmony_ci*******************************************************************************
1208c2ecf20Sopenharmony_ci**        IOP Message Transfer Data for user space
1218c2ecf20Sopenharmony_ci*******************************************************************************
1228c2ecf20Sopenharmony_ci*/
1238c2ecf20Sopenharmony_ci#define	ARCMSR_API_DATA_BUFLEN	1032
1248c2ecf20Sopenharmony_cistruct CMD_MESSAGE_FIELD
1258c2ecf20Sopenharmony_ci{
1268c2ecf20Sopenharmony_ci    struct CMD_MESSAGE			cmdmessage;
1278c2ecf20Sopenharmony_ci    uint8_t				messagedatabuffer[ARCMSR_API_DATA_BUFLEN];
1288c2ecf20Sopenharmony_ci};
1298c2ecf20Sopenharmony_ci/* IOP message transfer */
1308c2ecf20Sopenharmony_ci#define ARCMSR_MESSAGE_FAIL			0x0001
1318c2ecf20Sopenharmony_ci/* DeviceType */
1328c2ecf20Sopenharmony_ci#define ARECA_SATA_RAID				0x90000000
1338c2ecf20Sopenharmony_ci/* FunctionCode */
1348c2ecf20Sopenharmony_ci#define FUNCTION_READ_RQBUFFER			0x0801
1358c2ecf20Sopenharmony_ci#define FUNCTION_WRITE_WQBUFFER			0x0802
1368c2ecf20Sopenharmony_ci#define FUNCTION_CLEAR_RQBUFFER			0x0803
1378c2ecf20Sopenharmony_ci#define FUNCTION_CLEAR_WQBUFFER			0x0804
1388c2ecf20Sopenharmony_ci#define FUNCTION_CLEAR_ALLQBUFFER		0x0805
1398c2ecf20Sopenharmony_ci#define FUNCTION_RETURN_CODE_3F			0x0806
1408c2ecf20Sopenharmony_ci#define FUNCTION_SAY_HELLO			0x0807
1418c2ecf20Sopenharmony_ci#define FUNCTION_SAY_GOODBYE			0x0808
1428c2ecf20Sopenharmony_ci#define FUNCTION_FLUSH_ADAPTER_CACHE		0x0809
1438c2ecf20Sopenharmony_ci#define FUNCTION_GET_FIRMWARE_STATUS		0x080A
1448c2ecf20Sopenharmony_ci#define FUNCTION_HARDWARE_RESET			0x080B
1458c2ecf20Sopenharmony_ci/* ARECA IO CONTROL CODE*/
1468c2ecf20Sopenharmony_ci#define ARCMSR_MESSAGE_READ_RQBUFFER       \
1478c2ecf20Sopenharmony_ci	ARECA_SATA_RAID | FUNCTION_READ_RQBUFFER
1488c2ecf20Sopenharmony_ci#define ARCMSR_MESSAGE_WRITE_WQBUFFER      \
1498c2ecf20Sopenharmony_ci	ARECA_SATA_RAID | FUNCTION_WRITE_WQBUFFER
1508c2ecf20Sopenharmony_ci#define ARCMSR_MESSAGE_CLEAR_RQBUFFER      \
1518c2ecf20Sopenharmony_ci	ARECA_SATA_RAID | FUNCTION_CLEAR_RQBUFFER
1528c2ecf20Sopenharmony_ci#define ARCMSR_MESSAGE_CLEAR_WQBUFFER      \
1538c2ecf20Sopenharmony_ci	ARECA_SATA_RAID | FUNCTION_CLEAR_WQBUFFER
1548c2ecf20Sopenharmony_ci#define ARCMSR_MESSAGE_CLEAR_ALLQBUFFER    \
1558c2ecf20Sopenharmony_ci	ARECA_SATA_RAID | FUNCTION_CLEAR_ALLQBUFFER
1568c2ecf20Sopenharmony_ci#define ARCMSR_MESSAGE_RETURN_CODE_3F      \
1578c2ecf20Sopenharmony_ci	ARECA_SATA_RAID | FUNCTION_RETURN_CODE_3F
1588c2ecf20Sopenharmony_ci#define ARCMSR_MESSAGE_SAY_HELLO           \
1598c2ecf20Sopenharmony_ci	ARECA_SATA_RAID | FUNCTION_SAY_HELLO
1608c2ecf20Sopenharmony_ci#define ARCMSR_MESSAGE_SAY_GOODBYE         \
1618c2ecf20Sopenharmony_ci	ARECA_SATA_RAID | FUNCTION_SAY_GOODBYE
1628c2ecf20Sopenharmony_ci#define ARCMSR_MESSAGE_FLUSH_ADAPTER_CACHE \
1638c2ecf20Sopenharmony_ci	ARECA_SATA_RAID | FUNCTION_FLUSH_ADAPTER_CACHE
1648c2ecf20Sopenharmony_ci/* ARECA IOCTL ReturnCode */
1658c2ecf20Sopenharmony_ci#define ARCMSR_MESSAGE_RETURNCODE_OK		0x00000001
1668c2ecf20Sopenharmony_ci#define ARCMSR_MESSAGE_RETURNCODE_ERROR		0x00000006
1678c2ecf20Sopenharmony_ci#define ARCMSR_MESSAGE_RETURNCODE_3F		0x0000003F
1688c2ecf20Sopenharmony_ci#define ARCMSR_MESSAGE_RETURNCODE_BUS_HANG_ON	0x00000088
1698c2ecf20Sopenharmony_ci/*
1708c2ecf20Sopenharmony_ci*************************************************************
1718c2ecf20Sopenharmony_ci**   structure for holding DMA address data
1728c2ecf20Sopenharmony_ci*************************************************************
1738c2ecf20Sopenharmony_ci*/
1748c2ecf20Sopenharmony_ci#define IS_DMA64	(sizeof(dma_addr_t) == 8)
1758c2ecf20Sopenharmony_ci#define IS_SG64_ADDR	0x01000000 /* bit24 */
1768c2ecf20Sopenharmony_cistruct  SG32ENTRY
1778c2ecf20Sopenharmony_ci{
1788c2ecf20Sopenharmony_ci	__le32		length;
1798c2ecf20Sopenharmony_ci	__le32		address;
1808c2ecf20Sopenharmony_ci}__attribute__ ((packed));
1818c2ecf20Sopenharmony_cistruct  SG64ENTRY
1828c2ecf20Sopenharmony_ci{
1838c2ecf20Sopenharmony_ci	__le32		length;
1848c2ecf20Sopenharmony_ci	__le32		address;
1858c2ecf20Sopenharmony_ci	__le32		addresshigh;
1868c2ecf20Sopenharmony_ci}__attribute__ ((packed));
1878c2ecf20Sopenharmony_ci/*
1888c2ecf20Sopenharmony_ci********************************************************************
1898c2ecf20Sopenharmony_ci**      Q Buffer of IOP Message Transfer
1908c2ecf20Sopenharmony_ci********************************************************************
1918c2ecf20Sopenharmony_ci*/
1928c2ecf20Sopenharmony_cistruct QBUFFER
1938c2ecf20Sopenharmony_ci{
1948c2ecf20Sopenharmony_ci	uint32_t      data_len;
1958c2ecf20Sopenharmony_ci	uint8_t       data[124];
1968c2ecf20Sopenharmony_ci};
1978c2ecf20Sopenharmony_ci/*
1988c2ecf20Sopenharmony_ci*******************************************************************************
1998c2ecf20Sopenharmony_ci**      FIRMWARE INFO for Intel IOP R 80331 processor (Type A)
2008c2ecf20Sopenharmony_ci*******************************************************************************
2018c2ecf20Sopenharmony_ci*/
2028c2ecf20Sopenharmony_cistruct FIRMWARE_INFO
2038c2ecf20Sopenharmony_ci{
2048c2ecf20Sopenharmony_ci	uint32_t	signature;		/*0, 00-03*/
2058c2ecf20Sopenharmony_ci	uint32_t	request_len;		/*1, 04-07*/
2068c2ecf20Sopenharmony_ci	uint32_t	numbers_queue;		/*2, 08-11*/
2078c2ecf20Sopenharmony_ci	uint32_t	sdram_size;		/*3, 12-15*/
2088c2ecf20Sopenharmony_ci	uint32_t	ide_channels;		/*4, 16-19*/
2098c2ecf20Sopenharmony_ci	char		vendor[40];		/*5, 20-59*/
2108c2ecf20Sopenharmony_ci	char		model[8];		/*15, 60-67*/
2118c2ecf20Sopenharmony_ci	char		firmware_ver[16];     	/*17, 68-83*/
2128c2ecf20Sopenharmony_ci	char		device_map[16];		/*21, 84-99*/
2138c2ecf20Sopenharmony_ci	uint32_t	cfgVersion;		/*25,100-103 Added for checking of new firmware capability*/
2148c2ecf20Sopenharmony_ci	uint8_t		cfgSerial[16];		/*26,104-119*/
2158c2ecf20Sopenharmony_ci	uint32_t	cfgPicStatus;		/*30,120-123*/
2168c2ecf20Sopenharmony_ci};
2178c2ecf20Sopenharmony_ci/* signature of set and get firmware config */
2188c2ecf20Sopenharmony_ci#define ARCMSR_SIGNATURE_GET_CONFIG		0x87974060
2198c2ecf20Sopenharmony_ci#define ARCMSR_SIGNATURE_SET_CONFIG		0x87974063
2208c2ecf20Sopenharmony_ci/* message code of inbound message register */
2218c2ecf20Sopenharmony_ci#define ARCMSR_INBOUND_MESG0_NOP		0x00000000
2228c2ecf20Sopenharmony_ci#define ARCMSR_INBOUND_MESG0_GET_CONFIG		0x00000001
2238c2ecf20Sopenharmony_ci#define ARCMSR_INBOUND_MESG0_SET_CONFIG		0x00000002
2248c2ecf20Sopenharmony_ci#define ARCMSR_INBOUND_MESG0_ABORT_CMD		0x00000003
2258c2ecf20Sopenharmony_ci#define ARCMSR_INBOUND_MESG0_STOP_BGRB		0x00000004
2268c2ecf20Sopenharmony_ci#define ARCMSR_INBOUND_MESG0_FLUSH_CACHE	0x00000005
2278c2ecf20Sopenharmony_ci#define ARCMSR_INBOUND_MESG0_START_BGRB		0x00000006
2288c2ecf20Sopenharmony_ci#define ARCMSR_INBOUND_MESG0_CHK331PENDING	0x00000007
2298c2ecf20Sopenharmony_ci#define ARCMSR_INBOUND_MESG0_SYNC_TIMER		0x00000008
2308c2ecf20Sopenharmony_ci/* doorbell interrupt generator */
2318c2ecf20Sopenharmony_ci#define ARCMSR_INBOUND_DRIVER_DATA_WRITE_OK	0x00000001
2328c2ecf20Sopenharmony_ci#define ARCMSR_INBOUND_DRIVER_DATA_READ_OK	0x00000002
2338c2ecf20Sopenharmony_ci#define ARCMSR_OUTBOUND_IOP331_DATA_WRITE_OK	0x00000001
2348c2ecf20Sopenharmony_ci#define ARCMSR_OUTBOUND_IOP331_DATA_READ_OK	0x00000002
2358c2ecf20Sopenharmony_ci/* ccb areca cdb flag */
2368c2ecf20Sopenharmony_ci#define ARCMSR_CCBPOST_FLAG_SGL_BSIZE		0x80000000
2378c2ecf20Sopenharmony_ci#define ARCMSR_CCBPOST_FLAG_IAM_BIOS		0x40000000
2388c2ecf20Sopenharmony_ci#define ARCMSR_CCBREPLY_FLAG_IAM_BIOS		0x40000000
2398c2ecf20Sopenharmony_ci#define ARCMSR_CCBREPLY_FLAG_ERROR_MODE0	0x10000000
2408c2ecf20Sopenharmony_ci#define ARCMSR_CCBREPLY_FLAG_ERROR_MODE1	0x00000001
2418c2ecf20Sopenharmony_ci/* outbound firmware ok */
2428c2ecf20Sopenharmony_ci#define ARCMSR_OUTBOUND_MESG1_FIRMWARE_OK	0x80000000
2438c2ecf20Sopenharmony_ci/* ARC-1680 Bus Reset*/
2448c2ecf20Sopenharmony_ci#define ARCMSR_ARC1680_BUS_RESET		0x00000003
2458c2ecf20Sopenharmony_ci/* ARC-1880 Bus Reset*/
2468c2ecf20Sopenharmony_ci#define ARCMSR_ARC1880_RESET_ADAPTER		0x00000024
2478c2ecf20Sopenharmony_ci#define ARCMSR_ARC1880_DiagWrite_ENABLE		0x00000080
2488c2ecf20Sopenharmony_ci
2498c2ecf20Sopenharmony_ci/*
2508c2ecf20Sopenharmony_ci************************************************************************
2518c2ecf20Sopenharmony_ci**                SPEC. for Areca Type B adapter
2528c2ecf20Sopenharmony_ci************************************************************************
2538c2ecf20Sopenharmony_ci*/
2548c2ecf20Sopenharmony_ci/* ARECA HBB COMMAND for its FIRMWARE */
2558c2ecf20Sopenharmony_ci/* window of "instruction flags" from driver to iop */
2568c2ecf20Sopenharmony_ci#define ARCMSR_DRV2IOP_DOORBELL                       0x00020400
2578c2ecf20Sopenharmony_ci#define ARCMSR_DRV2IOP_DOORBELL_MASK                  0x00020404
2588c2ecf20Sopenharmony_ci/* window of "instruction flags" from iop to driver */
2598c2ecf20Sopenharmony_ci#define ARCMSR_IOP2DRV_DOORBELL                       0x00020408
2608c2ecf20Sopenharmony_ci#define ARCMSR_IOP2DRV_DOORBELL_MASK                  0x0002040C
2618c2ecf20Sopenharmony_ci/* window of "instruction flags" from iop to driver */
2628c2ecf20Sopenharmony_ci#define ARCMSR_IOP2DRV_DOORBELL_1203                  0x00021870
2638c2ecf20Sopenharmony_ci#define ARCMSR_IOP2DRV_DOORBELL_MASK_1203             0x00021874
2648c2ecf20Sopenharmony_ci/* window of "instruction flags" from driver to iop */
2658c2ecf20Sopenharmony_ci#define ARCMSR_DRV2IOP_DOORBELL_1203                  0x00021878
2668c2ecf20Sopenharmony_ci#define ARCMSR_DRV2IOP_DOORBELL_MASK_1203             0x0002187C
2678c2ecf20Sopenharmony_ci/* ARECA FLAG LANGUAGE */
2688c2ecf20Sopenharmony_ci/* ioctl transfer */
2698c2ecf20Sopenharmony_ci#define ARCMSR_IOP2DRV_DATA_WRITE_OK                  0x00000001
2708c2ecf20Sopenharmony_ci/* ioctl transfer */
2718c2ecf20Sopenharmony_ci#define ARCMSR_IOP2DRV_DATA_READ_OK                   0x00000002
2728c2ecf20Sopenharmony_ci#define ARCMSR_IOP2DRV_CDB_DONE                       0x00000004
2738c2ecf20Sopenharmony_ci#define ARCMSR_IOP2DRV_MESSAGE_CMD_DONE               0x00000008
2748c2ecf20Sopenharmony_ci
2758c2ecf20Sopenharmony_ci#define ARCMSR_DOORBELL_HANDLE_INT		      0x0000000F
2768c2ecf20Sopenharmony_ci#define ARCMSR_DOORBELL_INT_CLEAR_PATTERN   	      0xFF00FFF0
2778c2ecf20Sopenharmony_ci#define ARCMSR_MESSAGE_INT_CLEAR_PATTERN	      0xFF00FFF7
2788c2ecf20Sopenharmony_ci/* (ARCMSR_INBOUND_MESG0_GET_CONFIG<<16)|ARCMSR_DRV2IOP_MESSAGE_CMD_POSTED) */
2798c2ecf20Sopenharmony_ci#define ARCMSR_MESSAGE_GET_CONFIG		      0x00010008
2808c2ecf20Sopenharmony_ci/* (ARCMSR_INBOUND_MESG0_SET_CONFIG<<16)|ARCMSR_DRV2IOP_MESSAGE_CMD_POSTED) */
2818c2ecf20Sopenharmony_ci#define ARCMSR_MESSAGE_SET_CONFIG		      0x00020008
2828c2ecf20Sopenharmony_ci/* (ARCMSR_INBOUND_MESG0_ABORT_CMD<<16)|ARCMSR_DRV2IOP_MESSAGE_CMD_POSTED) */
2838c2ecf20Sopenharmony_ci#define ARCMSR_MESSAGE_ABORT_CMD		      0x00030008
2848c2ecf20Sopenharmony_ci/* (ARCMSR_INBOUND_MESG0_STOP_BGRB<<16)|ARCMSR_DRV2IOP_MESSAGE_CMD_POSTED) */
2858c2ecf20Sopenharmony_ci#define ARCMSR_MESSAGE_STOP_BGRB		      0x00040008
2868c2ecf20Sopenharmony_ci/* (ARCMSR_INBOUND_MESG0_FLUSH_CACHE<<16)|ARCMSR_DRV2IOP_MESSAGE_CMD_POSTED) */
2878c2ecf20Sopenharmony_ci#define ARCMSR_MESSAGE_FLUSH_CACHE                    0x00050008
2888c2ecf20Sopenharmony_ci/* (ARCMSR_INBOUND_MESG0_START_BGRB<<16)|ARCMSR_DRV2IOP_MESSAGE_CMD_POSTED) */
2898c2ecf20Sopenharmony_ci#define ARCMSR_MESSAGE_START_BGRB		      0x00060008
2908c2ecf20Sopenharmony_ci#define ARCMSR_MESSAGE_SYNC_TIMER		      0x00080008
2918c2ecf20Sopenharmony_ci#define ARCMSR_MESSAGE_START_DRIVER_MODE	      0x000E0008
2928c2ecf20Sopenharmony_ci#define ARCMSR_MESSAGE_SET_POST_WINDOW		      0x000F0008
2938c2ecf20Sopenharmony_ci#define ARCMSR_MESSAGE_ACTIVE_EOI_MODE		      0x00100008
2948c2ecf20Sopenharmony_ci/* ARCMSR_OUTBOUND_MESG1_FIRMWARE_OK */
2958c2ecf20Sopenharmony_ci#define ARCMSR_MESSAGE_FIRMWARE_OK		      0x80000000
2968c2ecf20Sopenharmony_ci/* ioctl transfer */
2978c2ecf20Sopenharmony_ci#define ARCMSR_DRV2IOP_DATA_WRITE_OK                  0x00000001
2988c2ecf20Sopenharmony_ci/* ioctl transfer */
2998c2ecf20Sopenharmony_ci#define ARCMSR_DRV2IOP_DATA_READ_OK                   0x00000002
3008c2ecf20Sopenharmony_ci#define ARCMSR_DRV2IOP_CDB_POSTED                     0x00000004
3018c2ecf20Sopenharmony_ci#define ARCMSR_DRV2IOP_MESSAGE_CMD_POSTED             0x00000008
3028c2ecf20Sopenharmony_ci#define ARCMSR_DRV2IOP_END_OF_INTERRUPT	              0x00000010
3038c2ecf20Sopenharmony_ci
3048c2ecf20Sopenharmony_ci/* data tunnel buffer between user space program and its firmware */
3058c2ecf20Sopenharmony_ci/* user space data to iop 128bytes */
3068c2ecf20Sopenharmony_ci#define ARCMSR_MESSAGE_WBUFFER			      0x0000fe00
3078c2ecf20Sopenharmony_ci/* iop data to user space 128bytes */
3088c2ecf20Sopenharmony_ci#define ARCMSR_MESSAGE_RBUFFER			      0x0000ff00
3098c2ecf20Sopenharmony_ci/* iop message_rwbuffer for message command */
3108c2ecf20Sopenharmony_ci#define ARCMSR_MESSAGE_RWBUFFER			      0x0000fa00
3118c2ecf20Sopenharmony_ci
3128c2ecf20Sopenharmony_ci#define MEM_BASE0(x)	(u32 __iomem *)((unsigned long)acb->mem_base0 + x)
3138c2ecf20Sopenharmony_ci#define MEM_BASE1(x)	(u32 __iomem *)((unsigned long)acb->mem_base1 + x)
3148c2ecf20Sopenharmony_ci/*
3158c2ecf20Sopenharmony_ci************************************************************************
3168c2ecf20Sopenharmony_ci**                SPEC. for Areca HBC adapter
3178c2ecf20Sopenharmony_ci************************************************************************
3188c2ecf20Sopenharmony_ci*/
3198c2ecf20Sopenharmony_ci#define ARCMSR_HBC_ISR_THROTTLING_LEVEL		12
3208c2ecf20Sopenharmony_ci#define ARCMSR_HBC_ISR_MAX_DONE_QUEUE		20
3218c2ecf20Sopenharmony_ci/* Host Interrupt Mask */
3228c2ecf20Sopenharmony_ci#define ARCMSR_HBCMU_UTILITY_A_ISR_MASK		0x00000001 /* When clear, the Utility_A interrupt routes to the host.*/
3238c2ecf20Sopenharmony_ci#define ARCMSR_HBCMU_OUTBOUND_DOORBELL_ISR_MASK	0x00000004 /* When clear, the General Outbound Doorbell interrupt routes to the host.*/
3248c2ecf20Sopenharmony_ci#define ARCMSR_HBCMU_OUTBOUND_POSTQUEUE_ISR_MASK	0x00000008 /* When clear, the Outbound Post List FIFO Not Empty interrupt routes to the host.*/
3258c2ecf20Sopenharmony_ci#define ARCMSR_HBCMU_ALL_INTMASKENABLE		0x0000000D /* disable all ISR */
3268c2ecf20Sopenharmony_ci/* Host Interrupt Status */
3278c2ecf20Sopenharmony_ci#define ARCMSR_HBCMU_UTILITY_A_ISR		0x00000001
3288c2ecf20Sopenharmony_ci	/*
3298c2ecf20Sopenharmony_ci	** Set when the Utility_A Interrupt bit is set in the Outbound Doorbell Register.
3308c2ecf20Sopenharmony_ci	** It clears by writing a 1 to the Utility_A bit in the Outbound Doorbell Clear Register or through automatic clearing (if enabled).
3318c2ecf20Sopenharmony_ci	*/
3328c2ecf20Sopenharmony_ci#define ARCMSR_HBCMU_OUTBOUND_DOORBELL_ISR	0x00000004
3338c2ecf20Sopenharmony_ci	/*
3348c2ecf20Sopenharmony_ci	** Set if Outbound Doorbell register bits 30:1 have a non-zero
3358c2ecf20Sopenharmony_ci	** value. This bit clears only when Outbound Doorbell bits
3368c2ecf20Sopenharmony_ci	** 30:1 are ALL clear. Only a write to the Outbound Doorbell
3378c2ecf20Sopenharmony_ci	** Clear register clears bits in the Outbound Doorbell register.
3388c2ecf20Sopenharmony_ci	*/
3398c2ecf20Sopenharmony_ci#define ARCMSR_HBCMU_OUTBOUND_POSTQUEUE_ISR	0x00000008
3408c2ecf20Sopenharmony_ci	/*
3418c2ecf20Sopenharmony_ci	** Set whenever the Outbound Post List Producer/Consumer
3428c2ecf20Sopenharmony_ci	** Register (FIFO) is not empty. It clears when the Outbound
3438c2ecf20Sopenharmony_ci	** Post List FIFO is empty.
3448c2ecf20Sopenharmony_ci	*/
3458c2ecf20Sopenharmony_ci#define ARCMSR_HBCMU_SAS_ALL_INT		0x00000010
3468c2ecf20Sopenharmony_ci	/*
3478c2ecf20Sopenharmony_ci	** This bit indicates a SAS interrupt from a source external to
3488c2ecf20Sopenharmony_ci	** the PCIe core. This bit is not maskable.
3498c2ecf20Sopenharmony_ci	*/
3508c2ecf20Sopenharmony_ci	/* DoorBell*/
3518c2ecf20Sopenharmony_ci#define ARCMSR_HBCMU_DRV2IOP_DATA_WRITE_OK			0x00000002
3528c2ecf20Sopenharmony_ci#define ARCMSR_HBCMU_DRV2IOP_DATA_READ_OK			0x00000004
3538c2ecf20Sopenharmony_ci	/*inbound message 0 ready*/
3548c2ecf20Sopenharmony_ci#define ARCMSR_HBCMU_DRV2IOP_MESSAGE_CMD_DONE			0x00000008
3558c2ecf20Sopenharmony_ci	/*more than 12 request completed in a time*/
3568c2ecf20Sopenharmony_ci#define ARCMSR_HBCMU_DRV2IOP_POSTQUEUE_THROTTLING		0x00000010
3578c2ecf20Sopenharmony_ci#define ARCMSR_HBCMU_IOP2DRV_DATA_WRITE_OK			0x00000002
3588c2ecf20Sopenharmony_ci	/*outbound DATA WRITE isr door bell clear*/
3598c2ecf20Sopenharmony_ci#define ARCMSR_HBCMU_IOP2DRV_DATA_WRITE_DOORBELL_CLEAR		0x00000002
3608c2ecf20Sopenharmony_ci#define ARCMSR_HBCMU_IOP2DRV_DATA_READ_OK			0x00000004
3618c2ecf20Sopenharmony_ci	/*outbound DATA READ isr door bell clear*/
3628c2ecf20Sopenharmony_ci#define ARCMSR_HBCMU_IOP2DRV_DATA_READ_DOORBELL_CLEAR		0x00000004
3638c2ecf20Sopenharmony_ci	/*outbound message 0 ready*/
3648c2ecf20Sopenharmony_ci#define ARCMSR_HBCMU_IOP2DRV_MESSAGE_CMD_DONE			0x00000008
3658c2ecf20Sopenharmony_ci	/*outbound message cmd isr door bell clear*/
3668c2ecf20Sopenharmony_ci#define ARCMSR_HBCMU_IOP2DRV_MESSAGE_CMD_DONE_DOORBELL_CLEAR	0x00000008
3678c2ecf20Sopenharmony_ci	/*ARCMSR_HBAMU_MESSAGE_FIRMWARE_OK*/
3688c2ecf20Sopenharmony_ci#define ARCMSR_HBCMU_MESSAGE_FIRMWARE_OK			0x80000000
3698c2ecf20Sopenharmony_ci/*
3708c2ecf20Sopenharmony_ci*******************************************************************************
3718c2ecf20Sopenharmony_ci**                SPEC. for Areca Type D adapter
3728c2ecf20Sopenharmony_ci*******************************************************************************
3738c2ecf20Sopenharmony_ci*/
3748c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_CHIP_ID				0x00004
3758c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_CPU_MEMORY_CONFIGURATION		0x00008
3768c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_I2_HOST_INTERRUPT_MASK		0x00034
3778c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_SAMPLE_RESET			0x00100
3788c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_RESET_REQUEST			0x00108
3798c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_MAIN_INTERRUPT_STATUS		0x00200
3808c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_PCIE_F0_INTERRUPT_ENABLE		0x0020C
3818c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_INBOUND_MESSAGE0			0x00400
3828c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_INBOUND_MESSAGE1			0x00404
3838c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_OUTBOUND_MESSAGE0		0x00420
3848c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_OUTBOUND_MESSAGE1		0x00424
3858c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_INBOUND_DOORBELL			0x00460
3868c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_OUTBOUND_DOORBELL		0x00480
3878c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_OUTBOUND_DOORBELL_ENABLE		0x00484
3888c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_INBOUND_LIST_BASE_LOW		0x01000
3898c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_INBOUND_LIST_BASE_HIGH		0x01004
3908c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_INBOUND_LIST_WRITE_POINTER	0x01018
3918c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_OUTBOUND_LIST_BASE_LOW		0x01060
3928c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_OUTBOUND_LIST_BASE_HIGH		0x01064
3938c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_OUTBOUND_LIST_COPY_POINTER	0x0106C
3948c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_OUTBOUND_LIST_READ_POINTER	0x01070
3958c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_OUTBOUND_INTERRUPT_CAUSE		0x01088
3968c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_OUTBOUND_INTERRUPT_ENABLE	0x0108C
3978c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_MESSAGE_WBUFFER			0x02000
3988c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_MESSAGE_RBUFFER			0x02100
3998c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_MESSAGE_RWBUFFER			0x02200
4008c2ecf20Sopenharmony_ci/* Host Interrupt Mask */
4018c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_ALL_INT_ENABLE			0x00001010
4028c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_ALL_INT_DISABLE			0x00000000
4038c2ecf20Sopenharmony_ci/* Host Interrupt Status */
4048c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_OUTBOUND_DOORBELL_ISR		0x00001000
4058c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_OUTBOUND_POSTQUEUE_ISR		0x00000010
4068c2ecf20Sopenharmony_ci/* DoorBell*/
4078c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_DRV2IOP_DATA_IN_READY		0x00000001
4088c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_DRV2IOP_DATA_OUT_READ		0x00000002
4098c2ecf20Sopenharmony_ci/*inbound message 0 ready*/
4108c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_IOP2DRV_DATA_WRITE_OK		0x00000001
4118c2ecf20Sopenharmony_ci/*outbound DATA WRITE isr door bell clear*/
4128c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_IOP2DRV_DATA_READ_OK		0x00000002
4138c2ecf20Sopenharmony_ci/*outbound message 0 ready*/
4148c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_IOP2DRV_MESSAGE_CMD_DONE		0x02000000
4158c2ecf20Sopenharmony_ci/*outbound message cmd isr door bell clear*/
4168c2ecf20Sopenharmony_ci/*ARCMSR_HBAMU_MESSAGE_FIRMWARE_OK*/
4178c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_MESSAGE_FIRMWARE_OK		0x80000000
4188c2ecf20Sopenharmony_ci#define ARCMSR_ARC1214_OUTBOUND_LIST_INTERRUPT_CLEAR	0x00000001
4198c2ecf20Sopenharmony_ci/*
4208c2ecf20Sopenharmony_ci*******************************************************************************
4218c2ecf20Sopenharmony_ci**                SPEC. for Areca Type E adapter
4228c2ecf20Sopenharmony_ci*******************************************************************************
4238c2ecf20Sopenharmony_ci*/
4248c2ecf20Sopenharmony_ci#define ARCMSR_SIGNATURE_1884			0x188417D3
4258c2ecf20Sopenharmony_ci
4268c2ecf20Sopenharmony_ci#define ARCMSR_HBEMU_DRV2IOP_DATA_WRITE_OK	0x00000002
4278c2ecf20Sopenharmony_ci#define ARCMSR_HBEMU_DRV2IOP_DATA_READ_OK	0x00000004
4288c2ecf20Sopenharmony_ci#define ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE	0x00000008
4298c2ecf20Sopenharmony_ci
4308c2ecf20Sopenharmony_ci#define ARCMSR_HBEMU_IOP2DRV_DATA_WRITE_OK	0x00000002
4318c2ecf20Sopenharmony_ci#define ARCMSR_HBEMU_IOP2DRV_DATA_READ_OK	0x00000004
4328c2ecf20Sopenharmony_ci#define ARCMSR_HBEMU_IOP2DRV_MESSAGE_CMD_DONE	0x00000008
4338c2ecf20Sopenharmony_ci
4348c2ecf20Sopenharmony_ci#define ARCMSR_HBEMU_MESSAGE_FIRMWARE_OK	0x80000000
4358c2ecf20Sopenharmony_ci
4368c2ecf20Sopenharmony_ci#define ARCMSR_HBEMU_OUTBOUND_DOORBELL_ISR	0x00000001
4378c2ecf20Sopenharmony_ci#define ARCMSR_HBEMU_OUTBOUND_POSTQUEUE_ISR	0x00000008
4388c2ecf20Sopenharmony_ci#define ARCMSR_HBEMU_ALL_INTMASKENABLE		0x00000009
4398c2ecf20Sopenharmony_ci
4408c2ecf20Sopenharmony_ci/* ARC-1884 doorbell sync */
4418c2ecf20Sopenharmony_ci#define ARCMSR_HBEMU_DOORBELL_SYNC		0x100
4428c2ecf20Sopenharmony_ci#define ARCMSR_ARC188X_RESET_ADAPTER		0x00000004
4438c2ecf20Sopenharmony_ci#define ARCMSR_ARC1884_DiagWrite_ENABLE		0x00000080
4448c2ecf20Sopenharmony_ci
4458c2ecf20Sopenharmony_ci/*
4468c2ecf20Sopenharmony_ci*******************************************************************************
4478c2ecf20Sopenharmony_ci**                SPEC. for Areca Type F adapter
4488c2ecf20Sopenharmony_ci*******************************************************************************
4498c2ecf20Sopenharmony_ci*/
4508c2ecf20Sopenharmony_ci#define ARCMSR_SIGNATURE_1886			0x188617D3
4518c2ecf20Sopenharmony_ci// Doorbell and interrupt definition are same as Type E adapter
4528c2ecf20Sopenharmony_ci/* ARC-1886 doorbell sync */
4538c2ecf20Sopenharmony_ci#define ARCMSR_HBFMU_DOORBELL_SYNC		0x100
4548c2ecf20Sopenharmony_ci//set host rw buffer physical address at inbound message 0, 1 (low,high)
4558c2ecf20Sopenharmony_ci#define ARCMSR_HBFMU_DOORBELL_SYNC1		0x300
4568c2ecf20Sopenharmony_ci#define ARCMSR_HBFMU_MESSAGE_FIRMWARE_OK	0x80000000
4578c2ecf20Sopenharmony_ci#define ARCMSR_HBFMU_MESSAGE_NO_VOLUME_CHANGE	0x20000000
4588c2ecf20Sopenharmony_ci
4598c2ecf20Sopenharmony_ci/*
4608c2ecf20Sopenharmony_ci*******************************************************************************
4618c2ecf20Sopenharmony_ci**    ARECA SCSI COMMAND DESCRIPTOR BLOCK size 0x1F8 (504)
4628c2ecf20Sopenharmony_ci*******************************************************************************
4638c2ecf20Sopenharmony_ci*/
4648c2ecf20Sopenharmony_cistruct ARCMSR_CDB
4658c2ecf20Sopenharmony_ci{
4668c2ecf20Sopenharmony_ci	uint8_t		Bus;
4678c2ecf20Sopenharmony_ci	uint8_t		TargetID;
4688c2ecf20Sopenharmony_ci	uint8_t		LUN;
4698c2ecf20Sopenharmony_ci	uint8_t		Function;
4708c2ecf20Sopenharmony_ci	uint8_t		CdbLength;
4718c2ecf20Sopenharmony_ci	uint8_t		sgcount;
4728c2ecf20Sopenharmony_ci	uint8_t		Flags;
4738c2ecf20Sopenharmony_ci#define ARCMSR_CDB_FLAG_SGL_BSIZE          0x01
4748c2ecf20Sopenharmony_ci#define ARCMSR_CDB_FLAG_BIOS               0x02
4758c2ecf20Sopenharmony_ci#define ARCMSR_CDB_FLAG_WRITE              0x04
4768c2ecf20Sopenharmony_ci#define ARCMSR_CDB_FLAG_SIMPLEQ            0x00
4778c2ecf20Sopenharmony_ci#define ARCMSR_CDB_FLAG_HEADQ              0x08
4788c2ecf20Sopenharmony_ci#define ARCMSR_CDB_FLAG_ORDEREDQ           0x10
4798c2ecf20Sopenharmony_ci
4808c2ecf20Sopenharmony_ci	uint8_t		msgPages;
4818c2ecf20Sopenharmony_ci	uint32_t	msgContext;
4828c2ecf20Sopenharmony_ci	uint32_t	DataLength;
4838c2ecf20Sopenharmony_ci	uint8_t		Cdb[16];
4848c2ecf20Sopenharmony_ci	uint8_t		DeviceStatus;
4858c2ecf20Sopenharmony_ci#define ARCMSR_DEV_CHECK_CONDITION	    0x02
4868c2ecf20Sopenharmony_ci#define ARCMSR_DEV_SELECT_TIMEOUT	    0xF0
4878c2ecf20Sopenharmony_ci#define ARCMSR_DEV_ABORTED		    0xF1
4888c2ecf20Sopenharmony_ci#define ARCMSR_DEV_INIT_FAIL		    0xF2
4898c2ecf20Sopenharmony_ci
4908c2ecf20Sopenharmony_ci	uint8_t		SenseData[15];
4918c2ecf20Sopenharmony_ci	union
4928c2ecf20Sopenharmony_ci	{
4938c2ecf20Sopenharmony_ci		struct SG32ENTRY	sg32entry[1];
4948c2ecf20Sopenharmony_ci		struct SG64ENTRY	sg64entry[1];
4958c2ecf20Sopenharmony_ci	} u;
4968c2ecf20Sopenharmony_ci};
4978c2ecf20Sopenharmony_ci/*
4988c2ecf20Sopenharmony_ci*******************************************************************************
4998c2ecf20Sopenharmony_ci**     Messaging Unit (MU) of the Intel R 80331 I/O processor(Type A) and Type B processor
5008c2ecf20Sopenharmony_ci*******************************************************************************
5018c2ecf20Sopenharmony_ci*/
5028c2ecf20Sopenharmony_cistruct MessageUnit_A
5038c2ecf20Sopenharmony_ci{
5048c2ecf20Sopenharmony_ci	uint32_t	resrved0[4];			/*0000 000F*/
5058c2ecf20Sopenharmony_ci	uint32_t	inbound_msgaddr0;		/*0010 0013*/
5068c2ecf20Sopenharmony_ci	uint32_t	inbound_msgaddr1;		/*0014 0017*/
5078c2ecf20Sopenharmony_ci	uint32_t	outbound_msgaddr0;		/*0018 001B*/
5088c2ecf20Sopenharmony_ci	uint32_t	outbound_msgaddr1;		/*001C 001F*/
5098c2ecf20Sopenharmony_ci	uint32_t	inbound_doorbell;		/*0020 0023*/
5108c2ecf20Sopenharmony_ci	uint32_t	inbound_intstatus;		/*0024 0027*/
5118c2ecf20Sopenharmony_ci	uint32_t	inbound_intmask;		/*0028 002B*/
5128c2ecf20Sopenharmony_ci	uint32_t	outbound_doorbell;		/*002C 002F*/
5138c2ecf20Sopenharmony_ci	uint32_t	outbound_intstatus;		/*0030 0033*/
5148c2ecf20Sopenharmony_ci	uint32_t	outbound_intmask;		/*0034 0037*/
5158c2ecf20Sopenharmony_ci	uint32_t	reserved1[2];			/*0038 003F*/
5168c2ecf20Sopenharmony_ci	uint32_t	inbound_queueport;		/*0040 0043*/
5178c2ecf20Sopenharmony_ci	uint32_t	outbound_queueport;     	/*0044 0047*/
5188c2ecf20Sopenharmony_ci	uint32_t	reserved2[2];			/*0048 004F*/
5198c2ecf20Sopenharmony_ci	uint32_t	reserved3[492];			/*0050 07FF 492*/
5208c2ecf20Sopenharmony_ci	uint32_t	reserved4[128];			/*0800 09FF 128*/
5218c2ecf20Sopenharmony_ci	uint32_t	message_rwbuffer[256];		/*0a00 0DFF 256*/
5228c2ecf20Sopenharmony_ci	uint32_t	message_wbuffer[32];		/*0E00 0E7F  32*/
5238c2ecf20Sopenharmony_ci	uint32_t	reserved5[32];			/*0E80 0EFF  32*/
5248c2ecf20Sopenharmony_ci	uint32_t	message_rbuffer[32];		/*0F00 0F7F  32*/
5258c2ecf20Sopenharmony_ci	uint32_t	reserved6[32];			/*0F80 0FFF  32*/
5268c2ecf20Sopenharmony_ci};
5278c2ecf20Sopenharmony_ci
5288c2ecf20Sopenharmony_cistruct MessageUnit_B
5298c2ecf20Sopenharmony_ci{
5308c2ecf20Sopenharmony_ci	uint32_t	post_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE];
5318c2ecf20Sopenharmony_ci	uint32_t	done_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE];
5328c2ecf20Sopenharmony_ci	uint32_t	postq_index;
5338c2ecf20Sopenharmony_ci	uint32_t	doneq_index;
5348c2ecf20Sopenharmony_ci	uint32_t	__iomem *drv2iop_doorbell;
5358c2ecf20Sopenharmony_ci	uint32_t	__iomem *drv2iop_doorbell_mask;
5368c2ecf20Sopenharmony_ci	uint32_t	__iomem *iop2drv_doorbell;
5378c2ecf20Sopenharmony_ci	uint32_t	__iomem *iop2drv_doorbell_mask;
5388c2ecf20Sopenharmony_ci	uint32_t	__iomem *message_rwbuffer;
5398c2ecf20Sopenharmony_ci	uint32_t	__iomem *message_wbuffer;
5408c2ecf20Sopenharmony_ci	uint32_t	__iomem *message_rbuffer;
5418c2ecf20Sopenharmony_ci};
5428c2ecf20Sopenharmony_ci/*
5438c2ecf20Sopenharmony_ci*********************************************************************
5448c2ecf20Sopenharmony_ci** LSI
5458c2ecf20Sopenharmony_ci*********************************************************************
5468c2ecf20Sopenharmony_ci*/
5478c2ecf20Sopenharmony_cistruct MessageUnit_C{
5488c2ecf20Sopenharmony_ci	uint32_t	message_unit_status;			/*0000 0003*/
5498c2ecf20Sopenharmony_ci	uint32_t	slave_error_attribute;			/*0004 0007*/
5508c2ecf20Sopenharmony_ci	uint32_t	slave_error_address;			/*0008 000B*/
5518c2ecf20Sopenharmony_ci	uint32_t	posted_outbound_doorbell;		/*000C 000F*/
5528c2ecf20Sopenharmony_ci	uint32_t	master_error_attribute;			/*0010 0013*/
5538c2ecf20Sopenharmony_ci	uint32_t	master_error_address_low;		/*0014 0017*/
5548c2ecf20Sopenharmony_ci	uint32_t	master_error_address_high;		/*0018 001B*/
5558c2ecf20Sopenharmony_ci	uint32_t	hcb_size;				/*001C 001F*/
5568c2ecf20Sopenharmony_ci	uint32_t	inbound_doorbell;			/*0020 0023*/
5578c2ecf20Sopenharmony_ci	uint32_t	diagnostic_rw_data;			/*0024 0027*/
5588c2ecf20Sopenharmony_ci	uint32_t	diagnostic_rw_address_low;		/*0028 002B*/
5598c2ecf20Sopenharmony_ci	uint32_t	diagnostic_rw_address_high;		/*002C 002F*/
5608c2ecf20Sopenharmony_ci	uint32_t	host_int_status;			/*0030 0033*/
5618c2ecf20Sopenharmony_ci	uint32_t	host_int_mask;				/*0034 0037*/
5628c2ecf20Sopenharmony_ci	uint32_t	dcr_data;				/*0038 003B*/
5638c2ecf20Sopenharmony_ci	uint32_t	dcr_address;				/*003C 003F*/
5648c2ecf20Sopenharmony_ci	uint32_t	inbound_queueport;			/*0040 0043*/
5658c2ecf20Sopenharmony_ci	uint32_t	outbound_queueport;			/*0044 0047*/
5668c2ecf20Sopenharmony_ci	uint32_t	hcb_pci_address_low;			/*0048 004B*/
5678c2ecf20Sopenharmony_ci	uint32_t	hcb_pci_address_high;			/*004C 004F*/
5688c2ecf20Sopenharmony_ci	uint32_t	iop_int_status;				/*0050 0053*/
5698c2ecf20Sopenharmony_ci	uint32_t	iop_int_mask;				/*0054 0057*/
5708c2ecf20Sopenharmony_ci	uint32_t	iop_inbound_queue_port;			/*0058 005B*/
5718c2ecf20Sopenharmony_ci	uint32_t	iop_outbound_queue_port;		/*005C 005F*/
5728c2ecf20Sopenharmony_ci	uint32_t	inbound_free_list_index;		/*0060 0063*/
5738c2ecf20Sopenharmony_ci	uint32_t	inbound_post_list_index;		/*0064 0067*/
5748c2ecf20Sopenharmony_ci	uint32_t	outbound_free_list_index;		/*0068 006B*/
5758c2ecf20Sopenharmony_ci	uint32_t	outbound_post_list_index;		/*006C 006F*/
5768c2ecf20Sopenharmony_ci	uint32_t	inbound_doorbell_clear;			/*0070 0073*/
5778c2ecf20Sopenharmony_ci	uint32_t	i2o_message_unit_control;		/*0074 0077*/
5788c2ecf20Sopenharmony_ci	uint32_t	last_used_message_source_address_low;	/*0078 007B*/
5798c2ecf20Sopenharmony_ci	uint32_t	last_used_message_source_address_high;	/*007C 007F*/
5808c2ecf20Sopenharmony_ci	uint32_t	pull_mode_data_byte_count[4];		/*0080 008F*/
5818c2ecf20Sopenharmony_ci	uint32_t	message_dest_address_index;		/*0090 0093*/
5828c2ecf20Sopenharmony_ci	uint32_t	done_queue_not_empty_int_counter_timer;	/*0094 0097*/
5838c2ecf20Sopenharmony_ci	uint32_t	utility_A_int_counter_timer;		/*0098 009B*/
5848c2ecf20Sopenharmony_ci	uint32_t	outbound_doorbell;			/*009C 009F*/
5858c2ecf20Sopenharmony_ci	uint32_t	outbound_doorbell_clear;		/*00A0 00A3*/
5868c2ecf20Sopenharmony_ci	uint32_t	message_source_address_index;		/*00A4 00A7*/
5878c2ecf20Sopenharmony_ci	uint32_t	message_done_queue_index;		/*00A8 00AB*/
5888c2ecf20Sopenharmony_ci	uint32_t	reserved0;				/*00AC 00AF*/
5898c2ecf20Sopenharmony_ci	uint32_t	inbound_msgaddr0;			/*00B0 00B3*/
5908c2ecf20Sopenharmony_ci	uint32_t	inbound_msgaddr1;			/*00B4 00B7*/
5918c2ecf20Sopenharmony_ci	uint32_t	outbound_msgaddr0;			/*00B8 00BB*/
5928c2ecf20Sopenharmony_ci	uint32_t	outbound_msgaddr1;			/*00BC 00BF*/
5938c2ecf20Sopenharmony_ci	uint32_t	inbound_queueport_low;			/*00C0 00C3*/
5948c2ecf20Sopenharmony_ci	uint32_t	inbound_queueport_high;			/*00C4 00C7*/
5958c2ecf20Sopenharmony_ci	uint32_t	outbound_queueport_low;			/*00C8 00CB*/
5968c2ecf20Sopenharmony_ci	uint32_t	outbound_queueport_high;		/*00CC 00CF*/
5978c2ecf20Sopenharmony_ci	uint32_t	iop_inbound_queue_port_low;		/*00D0 00D3*/
5988c2ecf20Sopenharmony_ci	uint32_t	iop_inbound_queue_port_high;		/*00D4 00D7*/
5998c2ecf20Sopenharmony_ci	uint32_t	iop_outbound_queue_port_low;		/*00D8 00DB*/
6008c2ecf20Sopenharmony_ci	uint32_t	iop_outbound_queue_port_high;		/*00DC 00DF*/
6018c2ecf20Sopenharmony_ci	uint32_t	message_dest_queue_port_low;		/*00E0 00E3*/
6028c2ecf20Sopenharmony_ci	uint32_t	message_dest_queue_port_high;		/*00E4 00E7*/
6038c2ecf20Sopenharmony_ci	uint32_t	last_used_message_dest_address_low;	/*00E8 00EB*/
6048c2ecf20Sopenharmony_ci	uint32_t	last_used_message_dest_address_high;	/*00EC 00EF*/
6058c2ecf20Sopenharmony_ci	uint32_t	message_done_queue_base_address_low;	/*00F0 00F3*/
6068c2ecf20Sopenharmony_ci	uint32_t	message_done_queue_base_address_high;	/*00F4 00F7*/
6078c2ecf20Sopenharmony_ci	uint32_t	host_diagnostic;			/*00F8 00FB*/
6088c2ecf20Sopenharmony_ci	uint32_t	write_sequence;				/*00FC 00FF*/
6098c2ecf20Sopenharmony_ci	uint32_t	reserved1[34];				/*0100 0187*/
6108c2ecf20Sopenharmony_ci	uint32_t	reserved2[1950];			/*0188 1FFF*/
6118c2ecf20Sopenharmony_ci	uint32_t	message_wbuffer[32];			/*2000 207F*/
6128c2ecf20Sopenharmony_ci	uint32_t	reserved3[32];				/*2080 20FF*/
6138c2ecf20Sopenharmony_ci	uint32_t	message_rbuffer[32];			/*2100 217F*/
6148c2ecf20Sopenharmony_ci	uint32_t	reserved4[32];				/*2180 21FF*/
6158c2ecf20Sopenharmony_ci	uint32_t	msgcode_rwbuffer[256];			/*2200 23FF*/
6168c2ecf20Sopenharmony_ci};
6178c2ecf20Sopenharmony_ci/*
6188c2ecf20Sopenharmony_ci*********************************************************************
6198c2ecf20Sopenharmony_ci**     Messaging Unit (MU) of Type D processor
6208c2ecf20Sopenharmony_ci*********************************************************************
6218c2ecf20Sopenharmony_ci*/
6228c2ecf20Sopenharmony_cistruct InBound_SRB {
6238c2ecf20Sopenharmony_ci	uint32_t addressLow; /* pointer to SRB block */
6248c2ecf20Sopenharmony_ci	uint32_t addressHigh;
6258c2ecf20Sopenharmony_ci	uint32_t length; /* in DWORDs */
6268c2ecf20Sopenharmony_ci	uint32_t reserved0;
6278c2ecf20Sopenharmony_ci};
6288c2ecf20Sopenharmony_ci
6298c2ecf20Sopenharmony_cistruct OutBound_SRB {
6308c2ecf20Sopenharmony_ci	uint32_t addressLow; /* pointer to SRB block */
6318c2ecf20Sopenharmony_ci	uint32_t addressHigh;
6328c2ecf20Sopenharmony_ci};
6338c2ecf20Sopenharmony_ci
6348c2ecf20Sopenharmony_cistruct MessageUnit_D {
6358c2ecf20Sopenharmony_ci	struct InBound_SRB	post_qbuffer[ARCMSR_MAX_ARC1214_POSTQUEUE];
6368c2ecf20Sopenharmony_ci	volatile struct OutBound_SRB
6378c2ecf20Sopenharmony_ci				done_qbuffer[ARCMSR_MAX_ARC1214_DONEQUEUE];
6388c2ecf20Sopenharmony_ci	u16 postq_index;
6398c2ecf20Sopenharmony_ci	volatile u16 doneq_index;
6408c2ecf20Sopenharmony_ci	u32 __iomem *chip_id;			/* 0x00004 */
6418c2ecf20Sopenharmony_ci	u32 __iomem *cpu_mem_config;		/* 0x00008 */
6428c2ecf20Sopenharmony_ci	u32 __iomem *i2o_host_interrupt_mask;	/* 0x00034 */
6438c2ecf20Sopenharmony_ci	u32 __iomem *sample_at_reset;		/* 0x00100 */
6448c2ecf20Sopenharmony_ci	u32 __iomem *reset_request;		/* 0x00108 */
6458c2ecf20Sopenharmony_ci	u32 __iomem *host_int_status;		/* 0x00200 */
6468c2ecf20Sopenharmony_ci	u32 __iomem *pcief0_int_enable;		/* 0x0020C */
6478c2ecf20Sopenharmony_ci	u32 __iomem *inbound_msgaddr0;		/* 0x00400 */
6488c2ecf20Sopenharmony_ci	u32 __iomem *inbound_msgaddr1;		/* 0x00404 */
6498c2ecf20Sopenharmony_ci	u32 __iomem *outbound_msgaddr0;		/* 0x00420 */
6508c2ecf20Sopenharmony_ci	u32 __iomem *outbound_msgaddr1;		/* 0x00424 */
6518c2ecf20Sopenharmony_ci	u32 __iomem *inbound_doorbell;		/* 0x00460 */
6528c2ecf20Sopenharmony_ci	u32 __iomem *outbound_doorbell;		/* 0x00480 */
6538c2ecf20Sopenharmony_ci	u32 __iomem *outbound_doorbell_enable;	/* 0x00484 */
6548c2ecf20Sopenharmony_ci	u32 __iomem *inboundlist_base_low;	/* 0x01000 */
6558c2ecf20Sopenharmony_ci	u32 __iomem *inboundlist_base_high;	/* 0x01004 */
6568c2ecf20Sopenharmony_ci	u32 __iomem *inboundlist_write_pointer;	/* 0x01018 */
6578c2ecf20Sopenharmony_ci	u32 __iomem *outboundlist_base_low;	/* 0x01060 */
6588c2ecf20Sopenharmony_ci	u32 __iomem *outboundlist_base_high;	/* 0x01064 */
6598c2ecf20Sopenharmony_ci	u32 __iomem *outboundlist_copy_pointer;	/* 0x0106C */
6608c2ecf20Sopenharmony_ci	u32 __iomem *outboundlist_read_pointer;	/* 0x01070 0x01072 */
6618c2ecf20Sopenharmony_ci	u32 __iomem *outboundlist_interrupt_cause;	/* 0x1088 */
6628c2ecf20Sopenharmony_ci	u32 __iomem *outboundlist_interrupt_enable;	/* 0x108C */
6638c2ecf20Sopenharmony_ci	u32 __iomem *message_wbuffer;		/* 0x2000 */
6648c2ecf20Sopenharmony_ci	u32 __iomem *message_rbuffer;		/* 0x2100 */
6658c2ecf20Sopenharmony_ci	u32 __iomem *msgcode_rwbuffer;		/* 0x2200 */
6668c2ecf20Sopenharmony_ci};
6678c2ecf20Sopenharmony_ci/*
6688c2ecf20Sopenharmony_ci*********************************************************************
6698c2ecf20Sopenharmony_ci**     Messaging Unit (MU) of Type E processor(LSI)
6708c2ecf20Sopenharmony_ci*********************************************************************
6718c2ecf20Sopenharmony_ci*/
6728c2ecf20Sopenharmony_cistruct MessageUnit_E{
6738c2ecf20Sopenharmony_ci	uint32_t	iobound_doorbell;			/*0000 0003*/
6748c2ecf20Sopenharmony_ci	uint32_t	write_sequence_3xxx;			/*0004 0007*/
6758c2ecf20Sopenharmony_ci	uint32_t	host_diagnostic_3xxx;			/*0008 000B*/
6768c2ecf20Sopenharmony_ci	uint32_t	posted_outbound_doorbell;		/*000C 000F*/
6778c2ecf20Sopenharmony_ci	uint32_t	master_error_attribute;			/*0010 0013*/
6788c2ecf20Sopenharmony_ci	uint32_t	master_error_address_low;		/*0014 0017*/
6798c2ecf20Sopenharmony_ci	uint32_t	master_error_address_high;		/*0018 001B*/
6808c2ecf20Sopenharmony_ci	uint32_t	hcb_size;				/*001C 001F*/
6818c2ecf20Sopenharmony_ci	uint32_t	inbound_doorbell;			/*0020 0023*/
6828c2ecf20Sopenharmony_ci	uint32_t	diagnostic_rw_data;			/*0024 0027*/
6838c2ecf20Sopenharmony_ci	uint32_t	diagnostic_rw_address_low;		/*0028 002B*/
6848c2ecf20Sopenharmony_ci	uint32_t	diagnostic_rw_address_high;		/*002C 002F*/
6858c2ecf20Sopenharmony_ci	uint32_t	host_int_status;			/*0030 0033*/
6868c2ecf20Sopenharmony_ci	uint32_t	host_int_mask;				/*0034 0037*/
6878c2ecf20Sopenharmony_ci	uint32_t	dcr_data;				/*0038 003B*/
6888c2ecf20Sopenharmony_ci	uint32_t	dcr_address;				/*003C 003F*/
6898c2ecf20Sopenharmony_ci	uint32_t	inbound_queueport;			/*0040 0043*/
6908c2ecf20Sopenharmony_ci	uint32_t	outbound_queueport;			/*0044 0047*/
6918c2ecf20Sopenharmony_ci	uint32_t	hcb_pci_address_low;			/*0048 004B*/
6928c2ecf20Sopenharmony_ci	uint32_t	hcb_pci_address_high;			/*004C 004F*/
6938c2ecf20Sopenharmony_ci	uint32_t	iop_int_status;				/*0050 0053*/
6948c2ecf20Sopenharmony_ci	uint32_t	iop_int_mask;				/*0054 0057*/
6958c2ecf20Sopenharmony_ci	uint32_t	iop_inbound_queue_port;			/*0058 005B*/
6968c2ecf20Sopenharmony_ci	uint32_t	iop_outbound_queue_port;		/*005C 005F*/
6978c2ecf20Sopenharmony_ci	uint32_t	inbound_free_list_index;		/*0060 0063*/
6988c2ecf20Sopenharmony_ci	uint32_t	inbound_post_list_index;		/*0064 0067*/
6998c2ecf20Sopenharmony_ci	uint32_t	reply_post_producer_index;		/*0068 006B*/
7008c2ecf20Sopenharmony_ci	uint32_t	reply_post_consumer_index;		/*006C 006F*/
7018c2ecf20Sopenharmony_ci	uint32_t	inbound_doorbell_clear;			/*0070 0073*/
7028c2ecf20Sopenharmony_ci	uint32_t	i2o_message_unit_control;		/*0074 0077*/
7038c2ecf20Sopenharmony_ci	uint32_t	last_used_message_source_address_low;	/*0078 007B*/
7048c2ecf20Sopenharmony_ci	uint32_t	last_used_message_source_address_high;	/*007C 007F*/
7058c2ecf20Sopenharmony_ci	uint32_t	pull_mode_data_byte_count[4];		/*0080 008F*/
7068c2ecf20Sopenharmony_ci	uint32_t	message_dest_address_index;		/*0090 0093*/
7078c2ecf20Sopenharmony_ci	uint32_t	done_queue_not_empty_int_counter_timer;	/*0094 0097*/
7088c2ecf20Sopenharmony_ci	uint32_t	utility_A_int_counter_timer;		/*0098 009B*/
7098c2ecf20Sopenharmony_ci	uint32_t	outbound_doorbell;			/*009C 009F*/
7108c2ecf20Sopenharmony_ci	uint32_t	outbound_doorbell_clear;		/*00A0 00A3*/
7118c2ecf20Sopenharmony_ci	uint32_t	message_source_address_index;		/*00A4 00A7*/
7128c2ecf20Sopenharmony_ci	uint32_t	message_done_queue_index;		/*00A8 00AB*/
7138c2ecf20Sopenharmony_ci	uint32_t	reserved0;				/*00AC 00AF*/
7148c2ecf20Sopenharmony_ci	uint32_t	inbound_msgaddr0;			/*00B0 00B3*/
7158c2ecf20Sopenharmony_ci	uint32_t	inbound_msgaddr1;			/*00B4 00B7*/
7168c2ecf20Sopenharmony_ci	uint32_t	outbound_msgaddr0;			/*00B8 00BB*/
7178c2ecf20Sopenharmony_ci	uint32_t	outbound_msgaddr1;			/*00BC 00BF*/
7188c2ecf20Sopenharmony_ci	uint32_t	inbound_queueport_low;			/*00C0 00C3*/
7198c2ecf20Sopenharmony_ci	uint32_t	inbound_queueport_high;			/*00C4 00C7*/
7208c2ecf20Sopenharmony_ci	uint32_t	outbound_queueport_low;			/*00C8 00CB*/
7218c2ecf20Sopenharmony_ci	uint32_t	outbound_queueport_high;		/*00CC 00CF*/
7228c2ecf20Sopenharmony_ci	uint32_t	iop_inbound_queue_port_low;		/*00D0 00D3*/
7238c2ecf20Sopenharmony_ci	uint32_t	iop_inbound_queue_port_high;		/*00D4 00D7*/
7248c2ecf20Sopenharmony_ci	uint32_t	iop_outbound_queue_port_low;		/*00D8 00DB*/
7258c2ecf20Sopenharmony_ci	uint32_t	iop_outbound_queue_port_high;		/*00DC 00DF*/
7268c2ecf20Sopenharmony_ci	uint32_t	message_dest_queue_port_low;		/*00E0 00E3*/
7278c2ecf20Sopenharmony_ci	uint32_t	message_dest_queue_port_high;		/*00E4 00E7*/
7288c2ecf20Sopenharmony_ci	uint32_t	last_used_message_dest_address_low;	/*00E8 00EB*/
7298c2ecf20Sopenharmony_ci	uint32_t	last_used_message_dest_address_high;	/*00EC 00EF*/
7308c2ecf20Sopenharmony_ci	uint32_t	message_done_queue_base_address_low;	/*00F0 00F3*/
7318c2ecf20Sopenharmony_ci	uint32_t	message_done_queue_base_address_high;	/*00F4 00F7*/
7328c2ecf20Sopenharmony_ci	uint32_t	host_diagnostic;			/*00F8 00FB*/
7338c2ecf20Sopenharmony_ci	uint32_t	write_sequence;				/*00FC 00FF*/
7348c2ecf20Sopenharmony_ci	uint32_t	reserved1[34];				/*0100 0187*/
7358c2ecf20Sopenharmony_ci	uint32_t	reserved2[1950];			/*0188 1FFF*/
7368c2ecf20Sopenharmony_ci	uint32_t	message_wbuffer[32];			/*2000 207F*/
7378c2ecf20Sopenharmony_ci	uint32_t	reserved3[32];				/*2080 20FF*/
7388c2ecf20Sopenharmony_ci	uint32_t	message_rbuffer[32];			/*2100 217F*/
7398c2ecf20Sopenharmony_ci	uint32_t	reserved4[32];				/*2180 21FF*/
7408c2ecf20Sopenharmony_ci	uint32_t	msgcode_rwbuffer[256];			/*2200 23FF*/
7418c2ecf20Sopenharmony_ci};
7428c2ecf20Sopenharmony_ci
7438c2ecf20Sopenharmony_ci/*
7448c2ecf20Sopenharmony_ci*********************************************************************
7458c2ecf20Sopenharmony_ci**     Messaging Unit (MU) of Type F processor(LSI)
7468c2ecf20Sopenharmony_ci*********************************************************************
7478c2ecf20Sopenharmony_ci*/
7488c2ecf20Sopenharmony_cistruct MessageUnit_F {
7498c2ecf20Sopenharmony_ci	uint32_t	iobound_doorbell;			/*0000 0003*/
7508c2ecf20Sopenharmony_ci	uint32_t	write_sequence_3xxx;			/*0004 0007*/
7518c2ecf20Sopenharmony_ci	uint32_t	host_diagnostic_3xxx;			/*0008 000B*/
7528c2ecf20Sopenharmony_ci	uint32_t	posted_outbound_doorbell;		/*000C 000F*/
7538c2ecf20Sopenharmony_ci	uint32_t	master_error_attribute;			/*0010 0013*/
7548c2ecf20Sopenharmony_ci	uint32_t	master_error_address_low;		/*0014 0017*/
7558c2ecf20Sopenharmony_ci	uint32_t	master_error_address_high;		/*0018 001B*/
7568c2ecf20Sopenharmony_ci	uint32_t	hcb_size;				/*001C 001F*/
7578c2ecf20Sopenharmony_ci	uint32_t	inbound_doorbell;			/*0020 0023*/
7588c2ecf20Sopenharmony_ci	uint32_t	diagnostic_rw_data;			/*0024 0027*/
7598c2ecf20Sopenharmony_ci	uint32_t	diagnostic_rw_address_low;		/*0028 002B*/
7608c2ecf20Sopenharmony_ci	uint32_t	diagnostic_rw_address_high;		/*002C 002F*/
7618c2ecf20Sopenharmony_ci	uint32_t	host_int_status;			/*0030 0033*/
7628c2ecf20Sopenharmony_ci	uint32_t	host_int_mask;				/*0034 0037*/
7638c2ecf20Sopenharmony_ci	uint32_t	dcr_data;				/*0038 003B*/
7648c2ecf20Sopenharmony_ci	uint32_t	dcr_address;				/*003C 003F*/
7658c2ecf20Sopenharmony_ci	uint32_t	inbound_queueport;			/*0040 0043*/
7668c2ecf20Sopenharmony_ci	uint32_t	outbound_queueport;			/*0044 0047*/
7678c2ecf20Sopenharmony_ci	uint32_t	hcb_pci_address_low;			/*0048 004B*/
7688c2ecf20Sopenharmony_ci	uint32_t	hcb_pci_address_high;			/*004C 004F*/
7698c2ecf20Sopenharmony_ci	uint32_t	iop_int_status;				/*0050 0053*/
7708c2ecf20Sopenharmony_ci	uint32_t	iop_int_mask;				/*0054 0057*/
7718c2ecf20Sopenharmony_ci	uint32_t	iop_inbound_queue_port;			/*0058 005B*/
7728c2ecf20Sopenharmony_ci	uint32_t	iop_outbound_queue_port;		/*005C 005F*/
7738c2ecf20Sopenharmony_ci	uint32_t	inbound_free_list_index;		/*0060 0063*/
7748c2ecf20Sopenharmony_ci	uint32_t	inbound_post_list_index;		/*0064 0067*/
7758c2ecf20Sopenharmony_ci	uint32_t	reply_post_producer_index;		/*0068 006B*/
7768c2ecf20Sopenharmony_ci	uint32_t	reply_post_consumer_index;		/*006C 006F*/
7778c2ecf20Sopenharmony_ci	uint32_t	inbound_doorbell_clear;			/*0070 0073*/
7788c2ecf20Sopenharmony_ci	uint32_t	i2o_message_unit_control;		/*0074 0077*/
7798c2ecf20Sopenharmony_ci	uint32_t	last_used_message_source_address_low;	/*0078 007B*/
7808c2ecf20Sopenharmony_ci	uint32_t	last_used_message_source_address_high;	/*007C 007F*/
7818c2ecf20Sopenharmony_ci	uint32_t	pull_mode_data_byte_count[4];		/*0080 008F*/
7828c2ecf20Sopenharmony_ci	uint32_t	message_dest_address_index;		/*0090 0093*/
7838c2ecf20Sopenharmony_ci	uint32_t	done_queue_not_empty_int_counter_timer;	/*0094 0097*/
7848c2ecf20Sopenharmony_ci	uint32_t	utility_A_int_counter_timer;		/*0098 009B*/
7858c2ecf20Sopenharmony_ci	uint32_t	outbound_doorbell;			/*009C 009F*/
7868c2ecf20Sopenharmony_ci	uint32_t	outbound_doorbell_clear;		/*00A0 00A3*/
7878c2ecf20Sopenharmony_ci	uint32_t	message_source_address_index;		/*00A4 00A7*/
7888c2ecf20Sopenharmony_ci	uint32_t	message_done_queue_index;		/*00A8 00AB*/
7898c2ecf20Sopenharmony_ci	uint32_t	reserved0;				/*00AC 00AF*/
7908c2ecf20Sopenharmony_ci	uint32_t	inbound_msgaddr0;			/*00B0 00B3*/
7918c2ecf20Sopenharmony_ci	uint32_t	inbound_msgaddr1;			/*00B4 00B7*/
7928c2ecf20Sopenharmony_ci	uint32_t	outbound_msgaddr0;			/*00B8 00BB*/
7938c2ecf20Sopenharmony_ci	uint32_t	outbound_msgaddr1;			/*00BC 00BF*/
7948c2ecf20Sopenharmony_ci	uint32_t	inbound_queueport_low;			/*00C0 00C3*/
7958c2ecf20Sopenharmony_ci	uint32_t	inbound_queueport_high;			/*00C4 00C7*/
7968c2ecf20Sopenharmony_ci	uint32_t	outbound_queueport_low;			/*00C8 00CB*/
7978c2ecf20Sopenharmony_ci	uint32_t	outbound_queueport_high;		/*00CC 00CF*/
7988c2ecf20Sopenharmony_ci	uint32_t	iop_inbound_queue_port_low;		/*00D0 00D3*/
7998c2ecf20Sopenharmony_ci	uint32_t	iop_inbound_queue_port_high;		/*00D4 00D7*/
8008c2ecf20Sopenharmony_ci	uint32_t	iop_outbound_queue_port_low;		/*00D8 00DB*/
8018c2ecf20Sopenharmony_ci	uint32_t	iop_outbound_queue_port_high;		/*00DC 00DF*/
8028c2ecf20Sopenharmony_ci	uint32_t	message_dest_queue_port_low;		/*00E0 00E3*/
8038c2ecf20Sopenharmony_ci	uint32_t	message_dest_queue_port_high;		/*00E4 00E7*/
8048c2ecf20Sopenharmony_ci	uint32_t	last_used_message_dest_address_low;	/*00E8 00EB*/
8058c2ecf20Sopenharmony_ci	uint32_t	last_used_message_dest_address_high;	/*00EC 00EF*/
8068c2ecf20Sopenharmony_ci	uint32_t	message_done_queue_base_address_low;	/*00F0 00F3*/
8078c2ecf20Sopenharmony_ci	uint32_t	message_done_queue_base_address_high;	/*00F4 00F7*/
8088c2ecf20Sopenharmony_ci	uint32_t	host_diagnostic;			/*00F8 00FB*/
8098c2ecf20Sopenharmony_ci	uint32_t	write_sequence;				/*00FC 00FF*/
8108c2ecf20Sopenharmony_ci	uint32_t	reserved1[46];				/*0100 01B7*/
8118c2ecf20Sopenharmony_ci	uint32_t	reply_post_producer_index1;		/*01B8 01BB*/
8128c2ecf20Sopenharmony_ci	uint32_t	reply_post_consumer_index1;		/*01BC 01BF*/
8138c2ecf20Sopenharmony_ci};
8148c2ecf20Sopenharmony_ci
8158c2ecf20Sopenharmony_ci#define	MESG_RW_BUFFER_SIZE	(256 * 3)
8168c2ecf20Sopenharmony_ci
8178c2ecf20Sopenharmony_citypedef struct deliver_completeQ {
8188c2ecf20Sopenharmony_ci	uint16_t	cmdFlag;
8198c2ecf20Sopenharmony_ci	uint16_t	cmdSMID;
8208c2ecf20Sopenharmony_ci	uint16_t	cmdLMID;        // reserved (0)
8218c2ecf20Sopenharmony_ci	uint16_t	cmdFlag2;       // reserved (0)
8228c2ecf20Sopenharmony_ci} DeliverQ, CompletionQ, *pDeliver_Q, *pCompletion_Q;
8238c2ecf20Sopenharmony_ci/*
8248c2ecf20Sopenharmony_ci*******************************************************************************
8258c2ecf20Sopenharmony_ci**                 Adapter Control Block
8268c2ecf20Sopenharmony_ci*******************************************************************************
8278c2ecf20Sopenharmony_ci*/
8288c2ecf20Sopenharmony_cistruct AdapterControlBlock
8298c2ecf20Sopenharmony_ci{
8308c2ecf20Sopenharmony_ci	uint32_t		adapter_type;		/* adapter A,B..... */
8318c2ecf20Sopenharmony_ci#define ACB_ADAPTER_TYPE_A		0x00000000	/* hba I IOP */
8328c2ecf20Sopenharmony_ci#define ACB_ADAPTER_TYPE_B		0x00000001	/* hbb M IOP */
8338c2ecf20Sopenharmony_ci#define ACB_ADAPTER_TYPE_C		0x00000002	/* hbc L IOP */
8348c2ecf20Sopenharmony_ci#define ACB_ADAPTER_TYPE_D		0x00000003	/* hbd M IOP */
8358c2ecf20Sopenharmony_ci#define ACB_ADAPTER_TYPE_E		0x00000004	/* hba L IOP */
8368c2ecf20Sopenharmony_ci#define ACB_ADAPTER_TYPE_F		0x00000005	/* hba L IOP */
8378c2ecf20Sopenharmony_ci	u32			ioqueue_size;
8388c2ecf20Sopenharmony_ci	struct pci_dev *	pdev;
8398c2ecf20Sopenharmony_ci	struct Scsi_Host *	host;
8408c2ecf20Sopenharmony_ci	unsigned long		vir2phy_offset;
8418c2ecf20Sopenharmony_ci	/* Offset is used in making arc cdb physical to virtual calculations */
8428c2ecf20Sopenharmony_ci	uint32_t		outbound_int_enable;
8438c2ecf20Sopenharmony_ci	uint32_t		cdb_phyaddr_hi32;
8448c2ecf20Sopenharmony_ci	uint32_t		reg_mu_acc_handle0;
8458c2ecf20Sopenharmony_ci	uint64_t		cdb_phyadd_hipart;
8468c2ecf20Sopenharmony_ci	spinlock_t		eh_lock;
8478c2ecf20Sopenharmony_ci	spinlock_t		ccblist_lock;
8488c2ecf20Sopenharmony_ci	spinlock_t		postq_lock;
8498c2ecf20Sopenharmony_ci	spinlock_t		doneq_lock;
8508c2ecf20Sopenharmony_ci	spinlock_t		rqbuffer_lock;
8518c2ecf20Sopenharmony_ci	spinlock_t		wqbuffer_lock;
8528c2ecf20Sopenharmony_ci	union {
8538c2ecf20Sopenharmony_ci		struct MessageUnit_A __iomem *pmuA;
8548c2ecf20Sopenharmony_ci		struct MessageUnit_B 	*pmuB;
8558c2ecf20Sopenharmony_ci		struct MessageUnit_C __iomem *pmuC;
8568c2ecf20Sopenharmony_ci		struct MessageUnit_D 	*pmuD;
8578c2ecf20Sopenharmony_ci		struct MessageUnit_E __iomem *pmuE;
8588c2ecf20Sopenharmony_ci		struct MessageUnit_F __iomem *pmuF;
8598c2ecf20Sopenharmony_ci	};
8608c2ecf20Sopenharmony_ci	/* message unit ATU inbound base address0 */
8618c2ecf20Sopenharmony_ci	void __iomem		*mem_base0;
8628c2ecf20Sopenharmony_ci	void __iomem		*mem_base1;
8638c2ecf20Sopenharmony_ci	//0x000 - COMPORT_IN  (Host sent to ROC)
8648c2ecf20Sopenharmony_ci	uint32_t		*message_wbuffer;
8658c2ecf20Sopenharmony_ci	//0x100 - COMPORT_OUT (ROC sent to Host)
8668c2ecf20Sopenharmony_ci	uint32_t		*message_rbuffer;
8678c2ecf20Sopenharmony_ci	uint32_t		*msgcode_rwbuffer;	//0x200 - BIOS_AREA
8688c2ecf20Sopenharmony_ci	uint32_t		acb_flags;
8698c2ecf20Sopenharmony_ci	u16			dev_id;
8708c2ecf20Sopenharmony_ci	uint8_t			adapter_index;
8718c2ecf20Sopenharmony_ci#define ACB_F_SCSISTOPADAPTER         	0x0001
8728c2ecf20Sopenharmony_ci#define ACB_F_MSG_STOP_BGRB     	0x0002
8738c2ecf20Sopenharmony_ci/* stop RAID background rebuild */
8748c2ecf20Sopenharmony_ci#define ACB_F_MSG_START_BGRB          	0x0004
8758c2ecf20Sopenharmony_ci/* stop RAID background rebuild */
8768c2ecf20Sopenharmony_ci#define ACB_F_IOPDATA_OVERFLOW        	0x0008
8778c2ecf20Sopenharmony_ci/* iop message data rqbuffer overflow */
8788c2ecf20Sopenharmony_ci#define ACB_F_MESSAGE_WQBUFFER_CLEARED	0x0010
8798c2ecf20Sopenharmony_ci/* message clear wqbuffer */
8808c2ecf20Sopenharmony_ci#define ACB_F_MESSAGE_RQBUFFER_CLEARED  0x0020
8818c2ecf20Sopenharmony_ci/* message clear rqbuffer */
8828c2ecf20Sopenharmony_ci#define ACB_F_MESSAGE_WQBUFFER_READED   0x0040
8838c2ecf20Sopenharmony_ci#define ACB_F_BUS_RESET               	0x0080
8848c2ecf20Sopenharmony_ci
8858c2ecf20Sopenharmony_ci#define ACB_F_IOP_INITED              	0x0100
8868c2ecf20Sopenharmony_ci/* iop init */
8878c2ecf20Sopenharmony_ci#define ACB_F_ABORT			0x0200
8888c2ecf20Sopenharmony_ci#define ACB_F_FIRMWARE_TRAP           	0x0400
8898c2ecf20Sopenharmony_ci#define ACB_F_ADAPTER_REMOVED		0x0800
8908c2ecf20Sopenharmony_ci#define ACB_F_MSG_GET_CONFIG		0x1000
8918c2ecf20Sopenharmony_ci	struct CommandControlBlock *	pccb_pool[ARCMSR_MAX_FREECCB_NUM];
8928c2ecf20Sopenharmony_ci	/* used for memory free */
8938c2ecf20Sopenharmony_ci	struct list_head	ccb_free_list;
8948c2ecf20Sopenharmony_ci	/* head of free ccb list */
8958c2ecf20Sopenharmony_ci
8968c2ecf20Sopenharmony_ci	atomic_t		ccboutstandingcount;
8978c2ecf20Sopenharmony_ci	/*The present outstanding command number that in the IOP that
8988c2ecf20Sopenharmony_ci					waiting for being handled by FW*/
8998c2ecf20Sopenharmony_ci
9008c2ecf20Sopenharmony_ci	void *			dma_coherent;
9018c2ecf20Sopenharmony_ci	/* dma_coherent used for memory free */
9028c2ecf20Sopenharmony_ci	dma_addr_t		dma_coherent_handle;
9038c2ecf20Sopenharmony_ci	/* dma_coherent_handle used for memory free */
9048c2ecf20Sopenharmony_ci	dma_addr_t		dma_coherent_handle2;
9058c2ecf20Sopenharmony_ci	void			*dma_coherent2;
9068c2ecf20Sopenharmony_ci	unsigned int		uncache_size;
9078c2ecf20Sopenharmony_ci	uint8_t			rqbuffer[ARCMSR_MAX_QBUFFER];
9088c2ecf20Sopenharmony_ci	/* data collection buffer for read from 80331 */
9098c2ecf20Sopenharmony_ci	int32_t			rqbuf_getIndex;
9108c2ecf20Sopenharmony_ci	/* first of read buffer  */
9118c2ecf20Sopenharmony_ci	int32_t			rqbuf_putIndex;
9128c2ecf20Sopenharmony_ci	/* last of read buffer   */
9138c2ecf20Sopenharmony_ci	uint8_t			wqbuffer[ARCMSR_MAX_QBUFFER];
9148c2ecf20Sopenharmony_ci	/* data collection buffer for write to 80331  */
9158c2ecf20Sopenharmony_ci	int32_t			wqbuf_getIndex;
9168c2ecf20Sopenharmony_ci	/* first of write buffer */
9178c2ecf20Sopenharmony_ci	int32_t			wqbuf_putIndex;
9188c2ecf20Sopenharmony_ci	/* last of write buffer  */
9198c2ecf20Sopenharmony_ci	uint8_t			devstate[ARCMSR_MAX_TARGETID][ARCMSR_MAX_TARGETLUN];
9208c2ecf20Sopenharmony_ci	/* id0 ..... id15, lun0...lun7 */
9218c2ecf20Sopenharmony_ci#define ARECA_RAID_GONE			0x55
9228c2ecf20Sopenharmony_ci#define ARECA_RAID_GOOD			0xaa
9238c2ecf20Sopenharmony_ci	uint32_t		num_resets;
9248c2ecf20Sopenharmony_ci	uint32_t		num_aborts;
9258c2ecf20Sopenharmony_ci	uint32_t		signature;
9268c2ecf20Sopenharmony_ci	uint32_t		firm_request_len;
9278c2ecf20Sopenharmony_ci	uint32_t		firm_numbers_queue;
9288c2ecf20Sopenharmony_ci	uint32_t		firm_sdram_size;
9298c2ecf20Sopenharmony_ci	uint32_t		firm_hd_channels;
9308c2ecf20Sopenharmony_ci	uint32_t		firm_cfg_version;
9318c2ecf20Sopenharmony_ci	char			firm_model[12];
9328c2ecf20Sopenharmony_ci	char			firm_version[20];
9338c2ecf20Sopenharmony_ci	char			device_map[20];			/*21,84-99*/
9348c2ecf20Sopenharmony_ci	struct work_struct 	arcmsr_do_message_isr_bh;
9358c2ecf20Sopenharmony_ci	struct timer_list	eternal_timer;
9368c2ecf20Sopenharmony_ci	unsigned short		fw_flag;
9378c2ecf20Sopenharmony_ci#define	FW_NORMAL			0x0000
9388c2ecf20Sopenharmony_ci#define	FW_BOG				0x0001
9398c2ecf20Sopenharmony_ci#define	FW_DEADLOCK			0x0010
9408c2ecf20Sopenharmony_ci	uint32_t		maxOutstanding;
9418c2ecf20Sopenharmony_ci	int			vector_count;
9428c2ecf20Sopenharmony_ci	uint32_t		maxFreeCCB;
9438c2ecf20Sopenharmony_ci	struct timer_list	refresh_timer;
9448c2ecf20Sopenharmony_ci	uint32_t		doneq_index;
9458c2ecf20Sopenharmony_ci	uint32_t		ccbsize;
9468c2ecf20Sopenharmony_ci	uint32_t		in_doorbell;
9478c2ecf20Sopenharmony_ci	uint32_t		out_doorbell;
9488c2ecf20Sopenharmony_ci	uint32_t		completionQ_entry;
9498c2ecf20Sopenharmony_ci	pCompletion_Q		pCompletionQ;
9508c2ecf20Sopenharmony_ci	uint32_t		completeQ_size;
9518c2ecf20Sopenharmony_ci};/* HW_DEVICE_EXTENSION */
9528c2ecf20Sopenharmony_ci/*
9538c2ecf20Sopenharmony_ci*******************************************************************************
9548c2ecf20Sopenharmony_ci**                   Command Control Block
9558c2ecf20Sopenharmony_ci**             this CCB length must be 32 bytes boundary
9568c2ecf20Sopenharmony_ci*******************************************************************************
9578c2ecf20Sopenharmony_ci*/
9588c2ecf20Sopenharmony_cistruct CommandControlBlock{
9598c2ecf20Sopenharmony_ci	/*x32:sizeof struct_CCB=(64+60)byte, x64:sizeof struct_CCB=(64+60)byte*/
9608c2ecf20Sopenharmony_ci	struct list_head		list;		/*x32: 8byte, x64: 16byte*/
9618c2ecf20Sopenharmony_ci	struct scsi_cmnd		*pcmd;		/*8 bytes pointer of linux scsi command */
9628c2ecf20Sopenharmony_ci	struct AdapterControlBlock	*acb;		/*x32: 4byte, x64: 8byte*/
9638c2ecf20Sopenharmony_ci	unsigned long			cdb_phyaddr;	/*x32: 4byte, x64: 8byte*/
9648c2ecf20Sopenharmony_ci	uint32_t			arc_cdb_size;	/*x32:4byte,x64:4byte*/
9658c2ecf20Sopenharmony_ci	uint16_t			ccb_flags;	/*x32: 2byte, x64: 2byte*/
9668c2ecf20Sopenharmony_ci#define	CCB_FLAG_READ		0x0000
9678c2ecf20Sopenharmony_ci#define	CCB_FLAG_WRITE		0x0001
9688c2ecf20Sopenharmony_ci#define	CCB_FLAG_ERROR		0x0002
9698c2ecf20Sopenharmony_ci#define	CCB_FLAG_FLUSHCACHE	0x0004
9708c2ecf20Sopenharmony_ci#define	CCB_FLAG_MASTER_ABORTED	0x0008
9718c2ecf20Sopenharmony_ci	uint16_t                        startdone;	/*x32:2byte,x32:2byte*/
9728c2ecf20Sopenharmony_ci#define	ARCMSR_CCB_DONE		0x0000
9738c2ecf20Sopenharmony_ci#define	ARCMSR_CCB_START	0x55AA
9748c2ecf20Sopenharmony_ci#define	ARCMSR_CCB_ABORTED	0xAA55
9758c2ecf20Sopenharmony_ci#define	ARCMSR_CCB_ILLEGAL	0xFFFF
9768c2ecf20Sopenharmony_ci	uint32_t			smid;
9778c2ecf20Sopenharmony_ci#if BITS_PER_LONG == 64
9788c2ecf20Sopenharmony_ci	/*  ======================512+64 bytes========================  */
9798c2ecf20Sopenharmony_ci		uint32_t		reserved[3];	/*12 byte*/
9808c2ecf20Sopenharmony_ci#else
9818c2ecf20Sopenharmony_ci	/*  ======================512+32 bytes========================  */
9828c2ecf20Sopenharmony_ci		uint32_t		reserved[8];	/*32  byte*/
9838c2ecf20Sopenharmony_ci#endif
9848c2ecf20Sopenharmony_ci	/*  =======================================================   */
9858c2ecf20Sopenharmony_ci	struct ARCMSR_CDB		arcmsr_cdb;
9868c2ecf20Sopenharmony_ci};
9878c2ecf20Sopenharmony_ci/*
9888c2ecf20Sopenharmony_ci*******************************************************************************
9898c2ecf20Sopenharmony_ci**    ARECA SCSI sense data
9908c2ecf20Sopenharmony_ci*******************************************************************************
9918c2ecf20Sopenharmony_ci*/
9928c2ecf20Sopenharmony_cistruct SENSE_DATA
9938c2ecf20Sopenharmony_ci{
9948c2ecf20Sopenharmony_ci	uint8_t				ErrorCode:7;
9958c2ecf20Sopenharmony_ci#define SCSI_SENSE_CURRENT_ERRORS	0x70
9968c2ecf20Sopenharmony_ci#define SCSI_SENSE_DEFERRED_ERRORS	0x71
9978c2ecf20Sopenharmony_ci	uint8_t				Valid:1;
9988c2ecf20Sopenharmony_ci	uint8_t				SegmentNumber;
9998c2ecf20Sopenharmony_ci	uint8_t				SenseKey:4;
10008c2ecf20Sopenharmony_ci	uint8_t				Reserved:1;
10018c2ecf20Sopenharmony_ci	uint8_t				IncorrectLength:1;
10028c2ecf20Sopenharmony_ci	uint8_t				EndOfMedia:1;
10038c2ecf20Sopenharmony_ci	uint8_t				FileMark:1;
10048c2ecf20Sopenharmony_ci	uint8_t				Information[4];
10058c2ecf20Sopenharmony_ci	uint8_t				AdditionalSenseLength;
10068c2ecf20Sopenharmony_ci	uint8_t				CommandSpecificInformation[4];
10078c2ecf20Sopenharmony_ci	uint8_t				AdditionalSenseCode;
10088c2ecf20Sopenharmony_ci	uint8_t				AdditionalSenseCodeQualifier;
10098c2ecf20Sopenharmony_ci	uint8_t				FieldReplaceableUnitCode;
10108c2ecf20Sopenharmony_ci	uint8_t				SenseKeySpecific[3];
10118c2ecf20Sopenharmony_ci};
10128c2ecf20Sopenharmony_ci/*
10138c2ecf20Sopenharmony_ci*******************************************************************************
10148c2ecf20Sopenharmony_ci**  Outbound Interrupt Status Register - OISR
10158c2ecf20Sopenharmony_ci*******************************************************************************
10168c2ecf20Sopenharmony_ci*/
10178c2ecf20Sopenharmony_ci#define	ARCMSR_MU_OUTBOUND_INTERRUPT_STATUS_REG	0x30
10188c2ecf20Sopenharmony_ci#define	ARCMSR_MU_OUTBOUND_PCI_INT		0x10
10198c2ecf20Sopenharmony_ci#define	ARCMSR_MU_OUTBOUND_POSTQUEUE_INT	0x08
10208c2ecf20Sopenharmony_ci#define	ARCMSR_MU_OUTBOUND_DOORBELL_INT		0x04
10218c2ecf20Sopenharmony_ci#define	ARCMSR_MU_OUTBOUND_MESSAGE1_INT		0x02
10228c2ecf20Sopenharmony_ci#define	ARCMSR_MU_OUTBOUND_MESSAGE0_INT		0x01
10238c2ecf20Sopenharmony_ci#define	ARCMSR_MU_OUTBOUND_HANDLE_INT                     \
10248c2ecf20Sopenharmony_ci                    (ARCMSR_MU_OUTBOUND_MESSAGE0_INT      \
10258c2ecf20Sopenharmony_ci                     |ARCMSR_MU_OUTBOUND_MESSAGE1_INT     \
10268c2ecf20Sopenharmony_ci                     |ARCMSR_MU_OUTBOUND_DOORBELL_INT     \
10278c2ecf20Sopenharmony_ci                     |ARCMSR_MU_OUTBOUND_POSTQUEUE_INT    \
10288c2ecf20Sopenharmony_ci                     |ARCMSR_MU_OUTBOUND_PCI_INT)
10298c2ecf20Sopenharmony_ci/*
10308c2ecf20Sopenharmony_ci*******************************************************************************
10318c2ecf20Sopenharmony_ci**  Outbound Interrupt Mask Register - OIMR
10328c2ecf20Sopenharmony_ci*******************************************************************************
10338c2ecf20Sopenharmony_ci*/
10348c2ecf20Sopenharmony_ci#define	ARCMSR_MU_OUTBOUND_INTERRUPT_MASK_REG		0x34
10358c2ecf20Sopenharmony_ci#define	ARCMSR_MU_OUTBOUND_PCI_INTMASKENABLE		0x10
10368c2ecf20Sopenharmony_ci#define	ARCMSR_MU_OUTBOUND_POSTQUEUE_INTMASKENABLE	0x08
10378c2ecf20Sopenharmony_ci#define	ARCMSR_MU_OUTBOUND_DOORBELL_INTMASKENABLE	0x04
10388c2ecf20Sopenharmony_ci#define	ARCMSR_MU_OUTBOUND_MESSAGE1_INTMASKENABLE	0x02
10398c2ecf20Sopenharmony_ci#define	ARCMSR_MU_OUTBOUND_MESSAGE0_INTMASKENABLE	0x01
10408c2ecf20Sopenharmony_ci#define	ARCMSR_MU_OUTBOUND_ALL_INTMASKENABLE		0x1F
10418c2ecf20Sopenharmony_ci
10428c2ecf20Sopenharmony_ciextern void arcmsr_write_ioctldata2iop(struct AdapterControlBlock *);
10438c2ecf20Sopenharmony_ciextern uint32_t arcmsr_Read_iop_rqbuffer_data(struct AdapterControlBlock *,
10448c2ecf20Sopenharmony_ci	struct QBUFFER __iomem *);
10458c2ecf20Sopenharmony_ciextern void arcmsr_clear_iop2drv_rqueue_buffer(struct AdapterControlBlock *);
10468c2ecf20Sopenharmony_ciextern struct QBUFFER __iomem *arcmsr_get_iop_rqbuffer(struct AdapterControlBlock *);
10478c2ecf20Sopenharmony_ciextern struct device_attribute *arcmsr_host_attrs[];
10488c2ecf20Sopenharmony_ciextern int arcmsr_alloc_sysfs_attr(struct AdapterControlBlock *);
10498c2ecf20Sopenharmony_civoid arcmsr_free_sysfs_attr(struct AdapterControlBlock *acb);
1050