xref: /freebsd/sys/dev/isp/ispreg.h (revision 10ed63fc06cb9902cc783ce8d0086c9aa97ed1e1)
1098ca2bdSWarner Losh /*-
24d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3718cf2ccSPedro F. Giffuni  *
41b760be4SAlexander Motin  *  Copyright (c) 2009-2020 Alexander Motin <mav@FreeBSD.org>
52df76c16SMatt Jacob  *  Copyright (c) 1997-2009 by Matthew Jacob
66054c3f6SMatt Jacob  *  All rights reserved.
74394c92fSMatt Jacob  *
86054c3f6SMatt Jacob  *  Redistribution and use in source and binary forms, with or without
96054c3f6SMatt Jacob  *  modification, are permitted provided that the following conditions
106054c3f6SMatt Jacob  *  are met:
116054c3f6SMatt Jacob  *
12e48b2487SMatt Jacob  *  1. Redistributions of source code must retain the above copyright
13e48b2487SMatt Jacob  *     notice, this list of conditions and the following disclaimer.
14e48b2487SMatt Jacob  *  2. Redistributions in binary form must reproduce the above copyright
15e48b2487SMatt Jacob  *     notice, this list of conditions and the following disclaimer in the
16e48b2487SMatt Jacob  *     documentation and/or other materials provided with the distribution.
17e48b2487SMatt Jacob  *
18e48b2487SMatt Jacob  *  THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
196054c3f6SMatt Jacob  *  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
206054c3f6SMatt Jacob  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21e48b2487SMatt Jacob  *  ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
22e48b2487SMatt Jacob  *  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
236054c3f6SMatt Jacob  *  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
246054c3f6SMatt Jacob  *  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
256054c3f6SMatt Jacob  *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
266054c3f6SMatt Jacob  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
276054c3f6SMatt Jacob  *  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
286054c3f6SMatt Jacob  *  SUCH DAMAGE.
292df76c16SMatt Jacob  *
306054c3f6SMatt Jacob  */
31e48b2487SMatt Jacob /*
32e48b2487SMatt Jacob  * Machine Independent (well, as best as possible) register
33e48b2487SMatt Jacob  * definitions for Qlogic ISP SCSI adapters.
34e48b2487SMatt Jacob  */
356054c3f6SMatt Jacob #ifndef	_ISPREG_H
366054c3f6SMatt Jacob #define	_ISPREG_H
376054c3f6SMatt Jacob 
386054c3f6SMatt Jacob /*
396054c3f6SMatt Jacob  * Hardware definitions for the Qlogic ISP  registers.
406054c3f6SMatt Jacob  */
416054c3f6SMatt Jacob 
426054c3f6SMatt Jacob /*
436054c3f6SMatt Jacob  * This defines types of access to various registers.
446054c3f6SMatt Jacob  *
456054c3f6SMatt Jacob  *  	R:		Read Only
466054c3f6SMatt Jacob  *	W:		Write Only
476054c3f6SMatt Jacob  *	RW:		Read/Write
486054c3f6SMatt Jacob  *
496054c3f6SMatt Jacob  *	R*, W*, RW*:	Read Only, Write Only, Read/Write, but only
506054c3f6SMatt Jacob  *			if RISC processor in ISP is paused.
516054c3f6SMatt Jacob  */
526054c3f6SMatt Jacob 
536054c3f6SMatt Jacob /*
546054c3f6SMatt Jacob  * NB:	The *_BLOCK definitions have no specific hardware meaning.
556054c3f6SMatt Jacob  *	They serve simply to note to the MD layer which block of
566054c3f6SMatt Jacob  *	registers offsets are being accessed.
576054c3f6SMatt Jacob  */
581b760be4SAlexander Motin #define	_NREG_BLKS	2
591b760be4SAlexander Motin #define	_BLK_REG_SHFT	7
601b760be4SAlexander Motin #define	_BLK_REG_MASK	(1 << _BLK_REG_SHFT)
6157c801f5SMatt Jacob #define	BIU_BLOCK	(0 << _BLK_REG_SHFT)
6257c801f5SMatt Jacob #define	MBOX_BLOCK	(1 << _BLK_REG_SHFT)
63126ec864SMatt Jacob 
64126ec864SMatt Jacob #define	BIU_R2HST_INTR		(1 << 15)	/* RISC to Host Interrupt */
65126ec864SMatt Jacob #define	BIU_R2HST_PAUSED	(1 <<  8)	/* RISC paused */
666ce548a1SAlexander Motin #define	BIU_R2HST_ISTAT_MASK	0xff		/* intr information && status */
67126ec864SMatt Jacob #define		ISPR2HST_ROM_MBX_OK	0x1	/* ROM mailbox cmd done ok */
68126ec864SMatt Jacob #define		ISPR2HST_ROM_MBX_FAIL	0x2	/* ROM mailbox cmd done fail */
69126ec864SMatt Jacob #define		ISPR2HST_MBX_OK		0x10	/* mailbox cmd done ok */
70126ec864SMatt Jacob #define		ISPR2HST_MBX_FAIL	0x11	/* mailbox cmd done fail */
71126ec864SMatt Jacob #define		ISPR2HST_ASYNC_EVENT	0x12	/* Async Event */
72126ec864SMatt Jacob #define		ISPR2HST_RSPQ_UPDATE	0x13	/* Response Queue Update */
736ce548a1SAlexander Motin #define		ISPR2HST_RSPQ_UPDATE2	0x14	/* Response Queue Update */
74126ec864SMatt Jacob #define		ISPR2HST_RIO_16		0x15	/* RIO 1-16 */
75126ec864SMatt Jacob #define		ISPR2HST_FPOST		0x16	/* Low 16 bits fast post */
76126ec864SMatt Jacob #define		ISPR2HST_FPOST_CTIO	0x17	/* Low 16 bits fast post ctio */
776ce548a1SAlexander Motin #define		ISPR2HST_ATIO_UPDATE	0x1C	/* ATIO Queue Update */
786ce548a1SAlexander Motin #define		ISPR2HST_ATIO_RSPQ_UPDATE 0x1D	/* ATIO & Request Update */
796ce548a1SAlexander Motin #define		ISPR2HST_ATIO_UPDATE2	0x1E	/* ATIO Queue Update */
80126ec864SMatt Jacob 
816054c3f6SMatt Jacob /*
8210365e5aSMatt Jacob  * 2400 Interface Offsets and Register Definitions
8310365e5aSMatt Jacob  *
8410365e5aSMatt Jacob  * The 2400 looks quite different in terms of registers from other QLogic cards.
8510365e5aSMatt Jacob  * It is getting to be a genuine pain and challenge to keep the same model
8610365e5aSMatt Jacob  * for all.
8710365e5aSMatt Jacob  */
881b760be4SAlexander Motin #define	BIU2400_FLASH_ADDR	(BIU_BLOCK+0x00) /* Flash Access Address */
891b760be4SAlexander Motin #define	BIU2400_FLASH_DATA	(BIU_BLOCK+0x04) /* Flash Data */
901b760be4SAlexander Motin #define	BIU2400_CSR		(BIU_BLOCK+0x08) /* ISP Control/Status */
911b760be4SAlexander Motin #define	BIU2400_ICR		(BIU_BLOCK+0x0C) /* ISP to PCI Interrupt Control */
921b760be4SAlexander Motin #define	BIU2400_ISR		(BIU_BLOCK+0x10) /* ISP to PCI Interrupt Status */
9310365e5aSMatt Jacob 
9410365e5aSMatt Jacob #define	BIU2400_REQINP		(BIU_BLOCK+0x1C) /* Request Queue In */
9510365e5aSMatt Jacob #define	BIU2400_REQOUTP		(BIU_BLOCK+0x20) /* Request Queue Out */
9610365e5aSMatt Jacob #define	BIU2400_RSPINP		(BIU_BLOCK+0x24) /* Response Queue In */
9710365e5aSMatt Jacob #define	BIU2400_RSPOUTP		(BIU_BLOCK+0x28) /* Response Queue Out */
982df76c16SMatt Jacob 
992df76c16SMatt Jacob #define	BIU2400_PRI_REQINP 	(BIU_BLOCK+0x2C) /* Priority Request Q In */
1002df76c16SMatt Jacob #define	BIU2400_PRI_REQOUTP 	(BIU_BLOCK+0x30) /* Priority Request Q Out */
10110365e5aSMatt Jacob 
10210365e5aSMatt Jacob #define	BIU2400_ATIO_RSPINP	(BIU_BLOCK+0x3C) /* ATIO Queue In */
1032df76c16SMatt Jacob #define	BIU2400_ATIO_RSPOUTP	(BIU_BLOCK+0x40) /* ATIO Queue Out */
10410365e5aSMatt Jacob 
1051b760be4SAlexander Motin #define	BIU2400_R2HSTS		(BIU_BLOCK+0x44) /* RISC to Host Status */
10610365e5aSMatt Jacob 
1071b760be4SAlexander Motin #define	BIU2400_HCCR		(BIU_BLOCK+0x48) /* Host Command and Control Status */
1081b760be4SAlexander Motin #define	BIU2400_GPIOD		(BIU_BLOCK+0x4C) /* General Purpose I/O Data */
1091b760be4SAlexander Motin #define	BIU2400_GPIOE		(BIU_BLOCK+0x50) /* General Purpose I/O Enable */
1101b760be4SAlexander Motin #define	BIU2400_IOBBA		(BIU_BLOCK+0x54) /* I/O Bus Base Address */
1111b760be4SAlexander Motin #define	BIU2400_HSEMA		(BIU_BLOCK+0x58) /* Host-to-Host Semaphore */
11210365e5aSMatt Jacob 
11310365e5aSMatt Jacob /* BIU2400_FLASH_ADDR definitions */
11410365e5aSMatt Jacob #define	BIU2400_FLASH_DFLAG	(1 << 30)
11510365e5aSMatt Jacob 
11610365e5aSMatt Jacob /* BIU2400_CSR definitions */
11710365e5aSMatt Jacob #define	BIU2400_NVERR		(1 << 18)
11810365e5aSMatt Jacob #define	BIU2400_DMA_ACTIVE	(1 << 17)		/* RO */
11910365e5aSMatt Jacob #define	BIU2400_DMA_STOP	(1 << 16)
12010365e5aSMatt Jacob #define	BIU2400_FUNCTION	(1 << 15)		/* RO */
12110365e5aSMatt Jacob #define	BIU2400_PCIX_MODE(x)	(((x) >> 8) & 0xf)	/* RO */
12210365e5aSMatt Jacob #define	BIU2400_CSR_64BIT	(1 << 2)		/* RO */
12310365e5aSMatt Jacob #define	BIU2400_FLASH_ENABLE	(1 << 1)
12410365e5aSMatt Jacob #define	BIU2400_SOFT_RESET	(1 << 0)
12510365e5aSMatt Jacob 
12610365e5aSMatt Jacob /* BIU2400_ICR definitions */
12710365e5aSMatt Jacob #define	BIU2400_ICR_ENA_RISC_INT	0x8
12810365e5aSMatt Jacob #define	BIU2400_IMASK			(BIU2400_ICR_ENA_RISC_INT)
12910365e5aSMatt Jacob 
13010365e5aSMatt Jacob /* BIU2400_ISR definitions */
13110365e5aSMatt Jacob #define	BIU2400_ISR_RISC_INT		0x8
13210365e5aSMatt Jacob 
13310365e5aSMatt Jacob /* BIU2400_HCCR definitions */
134af4394d4SMatt Jacob #define	HCCR_2400_CMD_NOP		0x00000000
135af4394d4SMatt Jacob #define	HCCR_2400_CMD_RESET		0x10000000
136af4394d4SMatt Jacob #define	HCCR_2400_CMD_CLEAR_RESET	0x20000000
137af4394d4SMatt Jacob #define	HCCR_2400_CMD_PAUSE		0x30000000
138af4394d4SMatt Jacob #define	HCCR_2400_CMD_RELEASE		0x40000000
139af4394d4SMatt Jacob #define	HCCR_2400_CMD_SET_HOST_INT	0x50000000
140af4394d4SMatt Jacob #define	HCCR_2400_CMD_CLEAR_HOST_INT	0x60000000
141af4394d4SMatt Jacob #define	HCCR_2400_CMD_CLEAR_RISC_INT	0xA0000000
14210365e5aSMatt Jacob 
14310365e5aSMatt Jacob #define	HCCR_2400_RISC_ERR(x)		(((x) >> 12) & 0x7)	/* RO */
14410365e5aSMatt Jacob #define	HCCR_2400_RISC2HOST_INT		(1 << 6)		/* RO */
14510365e5aSMatt Jacob #define	HCCR_2400_RISC_RESET		(1 << 5)		/* RO */
14610365e5aSMatt Jacob 
14710365e5aSMatt Jacob 
14810365e5aSMatt Jacob /*
1496054c3f6SMatt Jacob  * Mailbox Block Register Offsets
1506054c3f6SMatt Jacob  */
15122e1dc85SMatt Jacob #define	INMAILBOX0	(MBOX_BLOCK+0x0)
15222e1dc85SMatt Jacob #define	INMAILBOX1	(MBOX_BLOCK+0x2)
15322e1dc85SMatt Jacob #define	INMAILBOX2	(MBOX_BLOCK+0x4)
15422e1dc85SMatt Jacob #define	INMAILBOX3	(MBOX_BLOCK+0x6)
15522e1dc85SMatt Jacob #define	INMAILBOX4	(MBOX_BLOCK+0x8)
15622e1dc85SMatt Jacob #define	INMAILBOX5	(MBOX_BLOCK+0xA)
15722e1dc85SMatt Jacob #define	INMAILBOX6	(MBOX_BLOCK+0xC)
15822e1dc85SMatt Jacob #define	INMAILBOX7	(MBOX_BLOCK+0xE)
1596054c3f6SMatt Jacob 
16022e1dc85SMatt Jacob #define	OUTMAILBOX0	(MBOX_BLOCK+0x0)
16122e1dc85SMatt Jacob #define	OUTMAILBOX1	(MBOX_BLOCK+0x2)
16222e1dc85SMatt Jacob #define	OUTMAILBOX2	(MBOX_BLOCK+0x4)
16322e1dc85SMatt Jacob #define	OUTMAILBOX3	(MBOX_BLOCK+0x6)
16422e1dc85SMatt Jacob #define	OUTMAILBOX4	(MBOX_BLOCK+0x8)
16522e1dc85SMatt Jacob #define	OUTMAILBOX5	(MBOX_BLOCK+0xA)
16622e1dc85SMatt Jacob #define	OUTMAILBOX6	(MBOX_BLOCK+0xC)
16722e1dc85SMatt Jacob #define	OUTMAILBOX7	(MBOX_BLOCK+0xE)
1686054c3f6SMatt Jacob 
16940e88de6SMatt Jacob #define	MBOX_OFF(n)	(MBOX_BLOCK + ((n) << 1))
1701b760be4SAlexander Motin #define	ISP_NMBOX(isp)	32
171ad0ab753SMatt Jacob #define	MAX_MAILBOX	32
1721b760be4SAlexander Motin 
17310365e5aSMatt Jacob /* if timeout == 0, then default timeout is picked */
17410365e5aSMatt Jacob #define	MBCMD_DEFAULT_TIMEOUT	100000	/* 100 ms */
175e5265237SMatt Jacob typedef struct {
176ad0ab753SMatt Jacob 	uint16_t param[MAX_MAILBOX];
17722629d29SMatt Jacob 	uint32_t ibits;	/* bits to add for register copyin */
17822629d29SMatt Jacob 	uint32_t obits;	/* bits to add for register copyout */
17922629d29SMatt Jacob 	uint32_t ibitm;	/* bits to mask for register copyin */
18022629d29SMatt Jacob 	uint32_t obitm;	/* bits to mask for register copyout */
1812e6beaf1SAlexander Motin 	uint32_t logval;	/* Bitmask of status codes to log */
18210365e5aSMatt Jacob 	uint32_t timeout;
1832e6beaf1SAlexander Motin 	uint32_t lineno;
1842df76c16SMatt Jacob 	const char *func;
185e5265237SMatt Jacob } mbreg_t;
1862df76c16SMatt Jacob #define	MBSINIT(mbxp, code, loglev, timo)	\
1872df76c16SMatt Jacob 	ISP_MEMZERO((mbxp), sizeof (mbreg_t));	\
18822629d29SMatt Jacob 	(mbxp)->ibitm = ~0;			\
18922629d29SMatt Jacob 	(mbxp)->obitm = ~0;			\
1902df76c16SMatt Jacob 	(mbxp)->param[0] = code;		\
1912df76c16SMatt Jacob 	(mbxp)->lineno = __LINE__;		\
1922df76c16SMatt Jacob 	(mbxp)->func = __func__;		\
1932df76c16SMatt Jacob 	(mbxp)->logval = loglev;		\
1942df76c16SMatt Jacob 	(mbxp)->timeout = timo
1952df76c16SMatt Jacob 
196478f8a96SJustin T. Gibbs /*
19710365e5aSMatt Jacob  * Defines for Interrupts
19810365e5aSMatt Jacob  */
19910365e5aSMatt Jacob #define	ISP_INTS_ENABLED(isp)						\
2001b760be4SAlexander Motin    (ISP_READ(isp, BIU2400_ICR) & BIU2400_IMASK)
20110365e5aSMatt Jacob 
20210365e5aSMatt Jacob #define	ISP_ENABLE_INTS(isp)						\
2031b760be4SAlexander Motin     ISP_WRITE(isp, BIU2400_ICR, BIU2400_IMASK)
20410365e5aSMatt Jacob 
20510365e5aSMatt Jacob #define	ISP_DISABLE_INTS(isp)						\
2061b760be4SAlexander Motin     ISP_WRITE(isp, BIU2400_ICR, 0)
20710365e5aSMatt Jacob 
20810365e5aSMatt Jacob /*
209981e6b25SMatt Jacob  * NVRAM Definitions (PCI cards only)
210981e6b25SMatt Jacob  */
211981e6b25SMatt Jacob 
212b8941882SMatt Jacob /*
21310365e5aSMatt Jacob  * Qlogic 2400 NVRAM is an array of 512 bytes with a 32 bit checksum.
21410365e5aSMatt Jacob  */
215483e464eSAlexander Motin #define	ISP2400_NVRAM_PORT_ADDR(c)	(0x100 * (c) + 0x80)
21610365e5aSMatt Jacob #define	ISP2400_NVRAM_SIZE		512
21710365e5aSMatt Jacob 
21810365e5aSMatt Jacob #define	ISP2400_NVRAM_VERSION(c)		((c)[4] | ((c)[5] << 8))
21910365e5aSMatt Jacob #define	ISP2400_NVRAM_MAXFRAMELENGTH(c)		(((c)[12]) | ((c)[13] << 8))
22010365e5aSMatt Jacob #define	ISP2400_NVRAM_HARDLOOPID(c)		((c)[18] | ((c)[19] << 8))
22110365e5aSMatt Jacob 
22210365e5aSMatt Jacob #define	ISP2400_NVRAM_PORT_NAME(c)	(\
22310365e5aSMatt Jacob 		(((uint64_t)(c)[20]) << 56) | \
22410365e5aSMatt Jacob 		(((uint64_t)(c)[21]) << 48) | \
22510365e5aSMatt Jacob 		(((uint64_t)(c)[22]) << 40) | \
22610365e5aSMatt Jacob 		(((uint64_t)(c)[23]) << 32) | \
22710365e5aSMatt Jacob 		(((uint64_t)(c)[24]) << 24) | \
22810365e5aSMatt Jacob 		(((uint64_t)(c)[25]) << 16) | \
22910365e5aSMatt Jacob 		(((uint64_t)(c)[26]) <<  8) | \
23010365e5aSMatt Jacob 		(((uint64_t)(c)[27]) <<  0))
23110365e5aSMatt Jacob 
23210365e5aSMatt Jacob #define	ISP2400_NVRAM_NODE_NAME(c)	(\
23310365e5aSMatt Jacob 		(((uint64_t)(c)[28]) << 56) | \
23410365e5aSMatt Jacob 		(((uint64_t)(c)[29]) << 48) | \
23510365e5aSMatt Jacob 		(((uint64_t)(c)[30]) << 40) | \
23610365e5aSMatt Jacob 		(((uint64_t)(c)[31]) << 32) | \
23710365e5aSMatt Jacob 		(((uint64_t)(c)[32]) << 24) | \
23810365e5aSMatt Jacob 		(((uint64_t)(c)[33]) << 16) | \
23910365e5aSMatt Jacob 		(((uint64_t)(c)[34]) <<  8) | \
24010365e5aSMatt Jacob 		(((uint64_t)(c)[35]) <<  0))
24110365e5aSMatt Jacob 
24210365e5aSMatt Jacob #define	ISP2400_NVRAM_LOGIN_RETRY_CNT(c)	((c)[36] | ((c)[37] << 8))
24310365e5aSMatt Jacob #define	ISP2400_NVRAM_LINK_DOWN_ON_NOS(c)	((c)[38] | ((c)[39] << 8))
24410365e5aSMatt Jacob #define	ISP2400_NVRAM_INTERRUPT_DELAY(c)	((c)[40] | ((c)[41] << 8))
24510365e5aSMatt Jacob #define	ISP2400_NVRAM_LOGIN_TIMEOUT(c)		((c)[42] | ((c)[43] << 8))
24610365e5aSMatt Jacob 
24710365e5aSMatt Jacob #define	ISP2400_NVRAM_FIRMWARE_OPTIONS1(c)	\
24810365e5aSMatt Jacob 	((c)[44] | ((c)[45] << 8) | ((c)[46] << 16) | ((c)[47] << 24))
24910365e5aSMatt Jacob #define	ISP2400_NVRAM_FIRMWARE_OPTIONS2(c)	\
25010365e5aSMatt Jacob 	((c)[48] | ((c)[49] << 8) | ((c)[50] << 16) | ((c)[51] << 24))
25110365e5aSMatt Jacob #define	ISP2400_NVRAM_FIRMWARE_OPTIONS3(c)	\
25210365e5aSMatt Jacob 	((c)[52] | ((c)[53] << 8) | ((c)[54] << 16) | ((c)[55] << 24))
25310365e5aSMatt Jacob 
25427b4a1b7SJoerg Pulz /*
25527b4a1b7SJoerg Pulz  * Qlogic FLT
25627b4a1b7SJoerg Pulz  */
25727b4a1b7SJoerg Pulz #define ISP24XX_BASE_ADDR	0x7ff00000
25827b4a1b7SJoerg Pulz #define ISP24XX_FLT_ADDR	0x11400
25927b4a1b7SJoerg Pulz 
26027b4a1b7SJoerg Pulz #define ISP25XX_BASE_ADDR	ISP24XX_BASE_ADDR
26127b4a1b7SJoerg Pulz #define ISP25XX_FLT_ADDR	0x50400
26227b4a1b7SJoerg Pulz 
26327b4a1b7SJoerg Pulz #define ISP27XX_BASE_ADDR	0x7f800000
26427b4a1b7SJoerg Pulz #define ISP27XX_FLT_ADDR	(0x3F1000 / 4)
26527b4a1b7SJoerg Pulz 
26627b4a1b7SJoerg Pulz #define ISP28XX_BASE_ADDR	0x7f7d0000
26727b4a1b7SJoerg Pulz #define ISP28XX_FLT_ADDR	(0x11000 / 4)
26827b4a1b7SJoerg Pulz 
26927b4a1b7SJoerg Pulz #define FLT_HEADER_SIZE		8
27027b4a1b7SJoerg Pulz #define FLT_REGION_SIZE		16
27127b4a1b7SJoerg Pulz #define FLT_MAX_REGIONS		0xFF
27227b4a1b7SJoerg Pulz #define FLT_REGIONS_SIZE	(FLT_REGION_SIZE * FLT_MAX_REGIONS)
27327b4a1b7SJoerg Pulz 
274707e4d1bSJoerg Pulz #define ISP2XXX_FLT_VERSION(c)		((c)[0] | ((c)[1] << 8))
275707e4d1bSJoerg Pulz #define ISP2XXX_FLT_LENGTH(c)		((c)[2] | ((c)[3] << 8))
276707e4d1bSJoerg Pulz #define ISP2XXX_FLT_CSUM(c)		((c)[4] | ((c)[5] << 8))
277707e4d1bSJoerg Pulz #define ISP2XXX_FLT_REG_CODE(c, o)	\
27827b4a1b7SJoerg Pulz 	((c)[0 + FLT_REGION_SIZE * o] | ((c)[1 + FLT_REGION_SIZE * o] << 8))
279707e4d1bSJoerg Pulz #define ISP2XXX_FLT_REG_ATTR(c, o)	((c)[2 + FLT_REGION_SIZE * o])
280707e4d1bSJoerg Pulz #define ISP2XXX_FLT_REG_RES(c, o)	((c)[3 + FLT_REGION_SIZE * o])
281707e4d1bSJoerg Pulz #define ISP2XXX_FLT_REG_SIZE(c, o)	(\
28227b4a1b7SJoerg Pulz 		((uint32_t)(c)[4 + FLT_REGION_SIZE * o] << 0) | \
28327b4a1b7SJoerg Pulz 		((uint32_t)(c)[5 + FLT_REGION_SIZE * o] << 8) | \
28427b4a1b7SJoerg Pulz 		((uint32_t)(c)[6 + FLT_REGION_SIZE * o] << 16) | \
28527b4a1b7SJoerg Pulz 		((uint32_t)(c)[7 + FLT_REGION_SIZE * o] << 24))
286707e4d1bSJoerg Pulz #define ISP2XXX_FLT_REG_START(c, o)	(\
28727b4a1b7SJoerg Pulz 		((uint32_t)(c)[8 + FLT_REGION_SIZE * o] << 0) | \
28827b4a1b7SJoerg Pulz 		((uint32_t)(c)[9 + FLT_REGION_SIZE * o] << 8) | \
28927b4a1b7SJoerg Pulz 		((uint32_t)(c)[10 + FLT_REGION_SIZE * o] << 16) | \
29027b4a1b7SJoerg Pulz 		((uint32_t)(c)[11 + FLT_REGION_SIZE * o] << 24))
291707e4d1bSJoerg Pulz #define ISP2XXX_FLT_REG_END(c, o)	(\
29227b4a1b7SJoerg Pulz 		((uint32_t)(c)[12 + FLT_REGION_SIZE * o] << 0) | \
29327b4a1b7SJoerg Pulz 		((uint32_t)(c)[13 + FLT_REGION_SIZE * o] << 8) | \
29427b4a1b7SJoerg Pulz 		((uint32_t)(c)[14 + FLT_REGION_SIZE * o] << 16) | \
29527b4a1b7SJoerg Pulz 		((uint32_t)(c)[15 + FLT_REGION_SIZE * o] << 24))
29627b4a1b7SJoerg Pulz 
29727b4a1b7SJoerg Pulz struct flt_region {
29827b4a1b7SJoerg Pulz 	uint16_t  code;
29927b4a1b7SJoerg Pulz 	uint8_t attribute;
30027b4a1b7SJoerg Pulz 	uint8_t reserved;
30127b4a1b7SJoerg Pulz 	uint32_t size;
30227b4a1b7SJoerg Pulz 	uint32_t start;
30327b4a1b7SJoerg Pulz 	uint32_t end;
30427b4a1b7SJoerg Pulz };
30527b4a1b7SJoerg Pulz 
30627b4a1b7SJoerg Pulz #define FLT_REG_FW		0x01
30727b4a1b7SJoerg Pulz #define FLT_REG_BOOT_CODE	0x07
30827b4a1b7SJoerg Pulz #define FLT_REG_VPD_0		0x14
30927b4a1b7SJoerg Pulz #define FLT_REG_NVRAM_0		0x15
31027b4a1b7SJoerg Pulz #define FLT_REG_VPD_1		0x16
31127b4a1b7SJoerg Pulz #define FLT_REG_NVRAM_1		0x17
31227b4a1b7SJoerg Pulz #define FLT_REG_VPD_2		0xd4
31327b4a1b7SJoerg Pulz #define FLT_REG_NVRAM_2		0xd5
31427b4a1b7SJoerg Pulz #define FLT_REG_VPD_3		0xd6
31527b4a1b7SJoerg Pulz #define FLT_REG_NVRAM_3		0xd7
31627b4a1b7SJoerg Pulz #define FLT_REG_FDT		0x1a
31727b4a1b7SJoerg Pulz #define FLT_REG_FLT		0x1c
31827b4a1b7SJoerg Pulz #define FLT_REG_NPIV_CONF_0	0x29
31927b4a1b7SJoerg Pulz #define FLT_REG_NPIV_CONF_1	0x2a
32027b4a1b7SJoerg Pulz #define FLT_REG_GOLD_FW		0x2f
32127b4a1b7SJoerg Pulz #define FLT_REG_FCP_PRIO_0	0x87
32227b4a1b7SJoerg Pulz #define FLT_REG_FCP_PRIO_1	0x88
32327b4a1b7SJoerg Pulz 
324707e4d1bSJoerg Pulz /* 27xx */
325707e4d1bSJoerg Pulz #define FLT_REG_IMG_PRI_27XX	0x95
326707e4d1bSJoerg Pulz #define FLT_REG_IMG_SEC_27XX	0x96
327707e4d1bSJoerg Pulz #define FLT_REG_FW_SEC_27XX	0x02
328707e4d1bSJoerg Pulz #define FLT_REG_BOOTLOAD_SEC_27XX	0x9
329707e4d1bSJoerg Pulz #define FLT_REG_VPD_SEC_27XX_0	0x50
330707e4d1bSJoerg Pulz #define FLT_REG_VPD_SEC_27XX_1	0x52
331707e4d1bSJoerg Pulz #define FLT_REG_VPD_SEC_27XX_2	0xd8
332707e4d1bSJoerg Pulz #define FLT_REG_VPD_SEC_27XX_3	0xda
333707e4d1bSJoerg Pulz 
334707e4d1bSJoerg Pulz /* 28xx */
33527b4a1b7SJoerg Pulz #define FLT_REG_AUX_IMG_PRI_28XX	0x125
33627b4a1b7SJoerg Pulz #define FLT_REG_AUX_IMG_SEC_28XX	0x126
33727b4a1b7SJoerg Pulz #define FLT_REG_NVRAM_SEC_28XX_0	0x10d
33827b4a1b7SJoerg Pulz #define FLT_REG_NVRAM_SEC_28XX_1	0x10f
33927b4a1b7SJoerg Pulz #define FLT_REG_NVRAM_SEC_28XX_2	0x111
34027b4a1b7SJoerg Pulz #define FLT_REG_NVRAM_SEC_28XX_3	0x113
34127b4a1b7SJoerg Pulz #define FLT_REG_VPD_SEC_28XX_0		0x10c
34227b4a1b7SJoerg Pulz #define FLT_REG_VPD_SEC_28XX_1		0x10e
34327b4a1b7SJoerg Pulz #define FLT_REG_VPD_SEC_28XX_2		0x110
34427b4a1b7SJoerg Pulz #define FLT_REG_VPD_SEC_28XX_3		0x112
34527b4a1b7SJoerg Pulz 
346*10ed63fcSJoerg Pulz #define ISP27XX_IMG_STATUS_VER_MAJOR	0x01
347*10ed63fcSJoerg Pulz #define ISP27XX_IMG_STATUS_VER_MINOR	0x00
348*10ed63fcSJoerg Pulz #define ISP27XX_IMG_STATUS_SIGN		0xfacefade
349*10ed63fcSJoerg Pulz #define ISP28XX_IMG_STATUS_SIGN		0xfacefadf
350*10ed63fcSJoerg Pulz #define ISP28XX_AUX_IMG_STATUS_SIGN	0xfacefaed
351*10ed63fcSJoerg Pulz #define ISP27XX_DEFAULT_IMAGE		0
352*10ed63fcSJoerg Pulz #define ISP27XX_PRIMARY_IMAGE		1
353*10ed63fcSJoerg Pulz #define ISP27XX_SECONDARY_IMAGE		2
354*10ed63fcSJoerg Pulz 
355*10ed63fcSJoerg Pulz #define ISP_RISC_CODE_SEGMENTS	2
356*10ed63fcSJoerg Pulz 
3576054c3f6SMatt Jacob #endif	/* _ISPREG_H */
358