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 2010 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
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  * Scratch area has to hold Max SMP Request and Max SMP Response,
53  * plus some slop.
54  */
55 #define	PMCS_SCRATCH_SIZE	2304
56 #define	PMCS_INITIAL_DMA_OFF	PMCS_INDICES_SIZE+PMCS_SCRATCH_SIZE
57 #define	PMCS_CONTROL_SIZE	ptob(1)
58 
59 /*
60  * 2M bytes was allocated to firmware log and split between two logs
61  */
62 #define	PMCS_FWLOG_SIZE		(2 << 20)
63 #define	PMCS_FWLOG_MAX		5	/* maximum logging level */
64 #define	PMCS_FWLOG_THRESH	75	/* Write to file when log this % full */
65 
66 #define	SATLSIZE		1024
67 
68 /*
69  * PMCS_NQENTRY is tunable by setting pmcs-num-io-qentries
70  */
71 #define	PMCS_NQENTRY		512	/* 512 entries per queue */
72 #define	PMCS_MIN_NQENTRY	32	/* No less than 32 entries per queue */
73 #define	PMCS_QENTRY_SIZE	64	/* 64 bytes per entry */
74 #define	PMCS_MSG_SIZE		(PMCS_QENTRY_SIZE >> 2)
75 
76 /*
77  * Watchdog interval, in usecs.
78  * NB: Needs to be evenly divisible by 10
79  */
80 #define	PMCS_WATCH_INTERVAL	250000	/* watchdog interval in us */
81 
82 /*
83  * Forward progress trigger. This is the number of times we run through
84  * watchdog before checking for forward progress.  Implicitly bound to
85  * PMCS_WATCH_INTERVAL above. For example, with a PMCS_WATCH_INTERVAL of
86  * 250000, the watchdog will run every quarter second, so forward progress
87  * will be checked every 16th watchdog fire, or every four seconds.
88  */
89 #define	PMCS_FWD_PROG_TRIGGER	16
90 
91 /*
92  * Inbound Queue definitions
93  */
94 #define	PMCS_NIQ		9	/* 9 Inbound Queues */
95 #define	PMCS_IO_IQ_MASK		7	/* IO queues are 0..7 */
96 #define	PMCS_IQ_OTHER		8	/* "Other" queue is 8 (HiPri) */
97 #define	PMCS_NON_HIPRI_QUEUES	PMCS_IO_IQ_MASK
98 
99 /*
100  * Outbound Queue definitions
101  *
102  * Note that the OQ definitions map to bits set in
103  * the Outbound Doorbell register to indicate service
104  * is needed on one of these queues.
105  */
106 #define	PMCS_NOQ		3	/* 3 Outbound Queues */
107 
108 #define	PMCS_OQ_IODONE		0	/* I/O completion Outbound Queue */
109 #define	PMCS_OQ_GENERAL		1	/* General Outbound Queue */
110 #define	PMCS_OQ_EVENTS		2	/* Event Outbound Queue */
111 
112 
113 /*
114  * External Scatter Gather come in chunks- each this many deep.
115  */
116 #define	PMCS_SGL_NCHUNKS	16	/* S/G List Chunk Size */
117 #define	PMCS_MAX_CHUNKS		32	/* max chunks per command */
118 
119 /*
120  * MSI/MSI-X related definitions.
121  *
122  * These are the maximum number of interrupt vectors we could use.
123  */
124 #define	PMCS_MAX_MSIX		(PMCS_NOQ + 1)
125 #define	PMCS_MAX_MSI		PMCS_MAX_MSIX
126 #define	PMCS_MAX_FIXED		1
127 
128 #define	PMCS_MSIX_IODONE	PMCS_OQ_IODONE	/* I/O Interrupt vector */
129 #define	PMCS_MSIX_GENERAL	PMCS_OQ_GENERAL	/* General Interrupt vector */
130 #define	PMCS_MSIX_EVENTS	PMCS_OQ_EVENTS	/* Events Interrupt vector */
131 #define	PMCS_MSIX_FATAL		(PMCS_MAX_MSIX-1)	/* Fatal Int vector */
132 
133 #define	PMCS_FATAL_INTERRUPT	15	/* fatal interrupt OBDB bit */
134 
135 /*
136  * Blessed firmware version
137  */
138 #define	PMCS_FIRMWARE_CODE_NAME		"firmware"
139 #define	PMCS_FIRMWARE_ILA_NAME		"ila"
140 #define	PMCS_FIRMWARE_SPCBOOT_NAME	"SPCBoot"
141 #define	PMCS_FIRMWARE_START_SUF		".bin_start"
142 #define	PMCS_FIRMWARE_END_SUF		".bin_end"
143 #define	PMCS_FIRMWARE_FILENAME		"misc/pmcs/pmcs8001fw"
144 #define	PMCS_FIRMWARE_VERSION_NAME	"pmcs8001_fwversion"
145 
146 /*
147  * These are offsets from the end of the image
148  */
149 #define	PMCS_FW_VER_OFFSET		528
150 #define	PMCS_ILA_VER_OFFSET		528
151 
152 #ifdef	__cplusplus
153 }
154 #endif
155 #endif	/* _PMCS_PARAM_H */
156