xref: /titanic_51/usr/src/uts/common/sys/scsi/adapters/pmcs/pmcs_param.h (revision 1f81b46471e38fdeb9ab74c25510b2f903f8af12)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
23  */
24 
25 /*
26  * PMC Compile Time Tunable Parameters
27  */
28 #ifndef	_PMCS_PARAM_H
29 #define	_PMCS_PARAM_H
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 /*
35  * Maximum number of microseconds we will try to configure a PHY
36  */
37 #define	PMCS_MAX_CONFIG_TIME	(60 * 1000000)
38 
39 #define	PMCS_MAX_OQ		64	/* maximum number of OutBound Queues */
40 #define	PMCS_MAX_IQ		64	/* maximum number of InBound Queues */
41 
42 #define	PMCS_MAX_PORTS		16	/* maximum port contexts */
43 
44 #define	PMCS_MAX_XPND		16	/* 16 levels of expansion */
45 
46 #define	PMCS_INDICES_SIZE	512
47 
48 #define	PMCS_MIN_CHUNK_PAGES	512
49 #define	PMCS_ADDTL_CHUNK_PAGES	8
50 
51 /*
52  * Maximum amount of time (in milliseconds) we'll wait for writing one chunk
53  * of firmware image data to the chip
54  */
55 #define	PMCS_FLASH_WAIT_TIME	10000	/* 10 seconds */
56 
57 /*
58  * Scratch area has to hold Max SMP Request and Max SMP Response,
59  * plus some slop.
60  */
61 #define	PMCS_SCRATCH_SIZE	2304
62 #define	PMCS_INITIAL_DMA_OFF	PMCS_INDICES_SIZE+PMCS_SCRATCH_SIZE
63 #define	PMCS_CONTROL_SIZE	ptob(1)
64 
65 /*
66  * 2M bytes was allocated to firmware log and split between two logs
67  */
68 #define	PMCS_FWLOG_SIZE		(2 << 20)
69 #define	PMCS_FWLOG_MAX		5	/* maximum logging level */
70 #define	PMCS_FWLOG_THRESH	75	/* Write to file when log this % full */
71 
72 #define	SATLSIZE		1024
73 
74 /*
75  * PMCS_NQENTRY is tunable by setting pmcs-num-io-qentries
76  */
77 #define	PMCS_NQENTRY		512	/* 512 entries per queue */
78 #define	PMCS_MIN_NQENTRY	32	/* No less than 32 entries per queue */
79 #define	PMCS_QENTRY_SIZE	64	/* 64 bytes per entry */
80 #define	PMCS_MSG_SIZE		(PMCS_QENTRY_SIZE >> 2)
81 
82 /*
83  * Watchdog interval, in usecs.
84  * NB: Needs to be evenly divisible by 10
85  */
86 #define	PMCS_WATCH_INTERVAL	250000	/* watchdog interval in us */
87 
88 /*
89  * Forward progress trigger. This is the number of times we run through
90  * watchdog before checking for forward progress.  Implicitly bound to
91  * PMCS_WATCH_INTERVAL above. For example, with a PMCS_WATCH_INTERVAL of
92  * 250000, the watchdog will run every quarter second, so forward progress
93  * will be checked every 16th watchdog fire, or every four seconds.
94  */
95 #define	PMCS_FWD_PROG_TRIGGER	16
96 
97 /*
98  * Inbound Queue definitions
99  */
100 #define	PMCS_NIQ		9	/* 9 Inbound Queues */
101 #define	PMCS_IO_IQ_MASK		7	/* IO queues are 0..7 */
102 #define	PMCS_IQ_OTHER		8	/* "Other" queue is 8 (HiPri) */
103 #define	PMCS_NON_HIPRI_QUEUES	PMCS_IO_IQ_MASK
104 
105 /*
106  * Outbound Queue definitions
107  *
108  * Note that the OQ definitions map to bits set in
109  * the Outbound Doorbell register to indicate service
110  * is needed on one of these queues.
111  */
112 #define	PMCS_NOQ		3	/* 3 Outbound Queues */
113 
114 #define	PMCS_OQ_IODONE		0	/* I/O completion Outbound Queue */
115 #define	PMCS_OQ_GENERAL		1	/* General Outbound Queue */
116 #define	PMCS_OQ_EVENTS		2	/* Event Outbound Queue */
117 
118 
119 /*
120  * External Scatter Gather come in chunks- each this many deep.
121  */
122 #define	PMCS_SGL_NCHUNKS	16	/* S/G List Chunk Size */
123 #define	PMCS_MAX_CHUNKS		32	/* max chunks per command */
124 
125 /*
126  * MSI/MSI-X related definitions.
127  *
128  * These are the maximum number of interrupt vectors we could use.
129  */
130 #define	PMCS_MAX_MSIX		(PMCS_NOQ + 1)
131 #define	PMCS_MAX_MSI		PMCS_MAX_MSIX
132 #define	PMCS_MAX_FIXED		1
133 
134 #define	PMCS_MSIX_IODONE	PMCS_OQ_IODONE	/* I/O Interrupt vector */
135 #define	PMCS_MSIX_GENERAL	PMCS_OQ_GENERAL	/* General Interrupt vector */
136 #define	PMCS_MSIX_EVENTS	PMCS_OQ_EVENTS	/* Events Interrupt vector */
137 #define	PMCS_MSIX_FATAL		(PMCS_MAX_MSIX-1)	/* Fatal Int vector */
138 
139 #define	PMCS_FATAL_INTERRUPT	15	/* fatal interrupt OBDB bit */
140 
141 /*
142  * Blessed firmware version
143  */
144 #define	PMCS_FIRMWARE_CODE_NAME		"firmware"
145 #define	PMCS_FIRMWARE_ILA_NAME		"ila"
146 #define	PMCS_FIRMWARE_SPCBOOT_NAME	"SPCBoot"
147 #define	PMCS_FIRMWARE_START_SUF		".bin_start"
148 #define	PMCS_FIRMWARE_END_SUF		".bin_end"
149 #define	PMCS_FIRMWARE_FILENAME		"misc/pmcs/pmcs8001fw"
150 #define	PMCS_FIRMWARE_VERSION_NAME	"pmcs8001_fwversion"
151 
152 /*
153  * These are offsets from the end of the image
154  */
155 #define	PMCS_FW_VER_OFFSET		528
156 #define	PMCS_ILA_VER_OFFSET		528
157 
158 #ifdef	__cplusplus
159 }
160 #endif
161 #endif	/* _PMCS_PARAM_H */
162