xref: /titanic_51/usr/src/uts/common/sys/lombus.h (revision 3db86aab554edbb4244c8d1a1c90f152eee768af)
1*3db86aabSstevel /*
2*3db86aabSstevel  * CDDL HEADER START
3*3db86aabSstevel  *
4*3db86aabSstevel  * The contents of this file are subject to the terms of the
5*3db86aabSstevel  * Common Development and Distribution License, Version 1.0 only
6*3db86aabSstevel  * (the "License").  You may not use this file except in compliance
7*3db86aabSstevel  * with the License.
8*3db86aabSstevel  *
9*3db86aabSstevel  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*3db86aabSstevel  * or http://www.opensolaris.org/os/licensing.
11*3db86aabSstevel  * See the License for the specific language governing permissions
12*3db86aabSstevel  * and limitations under the License.
13*3db86aabSstevel  *
14*3db86aabSstevel  * When distributing Covered Code, include this CDDL HEADER in each
15*3db86aabSstevel  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*3db86aabSstevel  * If applicable, add the following below this CDDL HEADER, with the
17*3db86aabSstevel  * fields enclosed by brackets "[]" replaced with your own identifying
18*3db86aabSstevel  * information: Portions Copyright [yyyy] [name of copyright owner]
19*3db86aabSstevel  *
20*3db86aabSstevel  * CDDL HEADER END
21*3db86aabSstevel  */
22*3db86aabSstevel /*
23*3db86aabSstevel  * Copyright (c) 2001 by Sun Microsystems, Inc.
24*3db86aabSstevel  * All rights reserved.
25*3db86aabSstevel  */
26*3db86aabSstevel 
27*3db86aabSstevel #ifndef	_SYS_LOMBUS_H
28*3db86aabSstevel #define	_SYS_LOMBUS_H
29*3db86aabSstevel 
30*3db86aabSstevel #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*3db86aabSstevel 
32*3db86aabSstevel #ifdef	__cplusplus
33*3db86aabSstevel extern "C" {
34*3db86aabSstevel #endif
35*3db86aabSstevel 
36*3db86aabSstevel /*
37*3db86aabSstevel  * Information for client (child) drivers:
38*3db86aabSstevel  *
39*3db86aabSstevel  *	Register space definitions
40*3db86aabSstevel  *	Fault info access
41*3db86aabSstevel  *	Fault codes
42*3db86aabSstevel  *
43*3db86aabSstevel  * LOMbus child regspecs are triples, in the form
44*3db86aabSstevel  * 	<space>, <base>, <size>
45*3db86aabSstevel  */
46*3db86aabSstevel typedef struct {
47*3db86aabSstevel 	int lombus_space;
48*3db86aabSstevel 	int lombus_base;
49*3db86aabSstevel 	int lombus_size;
50*3db86aabSstevel } lombus_regspec_t;
51*3db86aabSstevel 
52*3db86aabSstevel #define	LOMBUS_REGSPEC_SIZE	3	/* words/regspec */
53*3db86aabSstevel 
54*3db86aabSstevel 
55*3db86aabSstevel /*
56*3db86aabSstevel  * Register spaces
57*3db86aabSstevel  *
58*3db86aabSstevel  *	Space	Size	Range		Meaning
59*3db86aabSstevel  *		(bits)
60*3db86aabSstevel  *
61*3db86aabSstevel  *	0	8	[0 .. 16383]	LOM virtual registers
62*3db86aabSstevel  *	1	8	[0]		Watchdog pat (on write)
63*3db86aabSstevel  *	2	16	[0]		Async event info (read only)
64*3db86aabSstevel  *	All	32	[-4 .. -12]	Access handle fault info
65*3db86aabSstevel  */
66*3db86aabSstevel #define	LOMBUS_VREG_SPACE	(0)
67*3db86aabSstevel #define	LOMBUS_PAT_SPACE	(1)
68*3db86aabSstevel #define	LOMBUS_EVENT_SPACE	(2)
69*3db86aabSstevel 
70*3db86aabSstevel #define	LOMBUS_MAX_REG		(16383)		/* space 0: [0..16383]	*/
71*3db86aabSstevel #define	LOMBUS_PAT_REG		(0)		/* space 1: [0]		*/
72*3db86aabSstevel #define	LOMBUS_EVENT_REG	(0)		/* space 2: [0]		*/
73*3db86aabSstevel 
74*3db86aabSstevel #define	LOMBUS_FAULT_REG	(-4)		/* 32-bit only, R/W	*/
75*3db86aabSstevel #define	LOMBUS_PROBE_REG	(-8)		/* 32-bit only, R/W	*/
76*3db86aabSstevel #define	LOMBUS_ASYNC_REG	(-12)		/* 32-bit only, R/O	*/
77*3db86aabSstevel 
78*3db86aabSstevel 
79*3db86aabSstevel /*
80*3db86aabSstevel  * Internally-generated errors
81*3db86aabSstevel  *
82*3db86aabSstevel  * Note: LOM-generated errors are 0x00-0x7f and SunVTS uses 0x80-0xff,
83*3db86aabSstevel  * so these start at 0x100
84*3db86aabSstevel  */
85*3db86aabSstevel enum lombus_errs {
86*3db86aabSstevel 	LOMBUS_ERR_BASE = 0x100,
87*3db86aabSstevel 
88*3db86aabSstevel 	/*
89*3db86aabSstevel 	 * Errors in the way the child is accessing the virtual registers.
90*3db86aabSstevel 	 * These are programming errors and won't go away on retry!
91*3db86aabSstevel 	 */
92*3db86aabSstevel 	LOMBUS_ERR_REG_NUM,		/* register number out of range	*/
93*3db86aabSstevel 	LOMBUS_ERR_REG_RO,		/* write to read-only register	*/
94*3db86aabSstevel 	LOMBUS_ERR_REG_SIZE,		/* access with invalid size	*/
95*3db86aabSstevel 
96*3db86aabSstevel 	/*
97*3db86aabSstevel 	 * Error accessing the underlying SIO hardware
98*3db86aabSstevel 	 * This is unlikely to be recoverable.
99*3db86aabSstevel 	 */
100*3db86aabSstevel 	LOMBUS_ERR_SIOHW = 0x110,
101*3db86aabSstevel 
102*3db86aabSstevel 	/*
103*3db86aabSstevel 	 * Errors in the LOMbus <-> LOM firmware protocol
104*3db86aabSstevel 	 * These may or may not be recoverable, depending
105*3db86aabSstevel 	 * on the state of the LOM.
106*3db86aabSstevel 	 */
107*3db86aabSstevel 	LOMBUS_ERR_TIMEOUT = 0x120,	/* no response from LOM		*/
108*3db86aabSstevel 	LOMBUS_ERR_OFLOW,		/* rcv buf oflo - LOM babbling?	*/
109*3db86aabSstevel 	LOMBUS_ERR_SEQUENCE,		/* cmd/reply sequence mismatch	*/
110*3db86aabSstevel 	LOMBUS_ERR_BADSTATUS,		/* bad status byte in reply pkt	*/
111*3db86aabSstevel 	LOMBUS_ERR_BADERRCODE		/* invalid error code in reply	*/
112*3db86aabSstevel };
113*3db86aabSstevel 
114*3db86aabSstevel 
115*3db86aabSstevel /*
116*3db86aabSstevel  * Time periods, in nanoseconds
117*3db86aabSstevel  */
118*3db86aabSstevel #define	LOMBUS_ONE_SEC		1000000000LL
119*3db86aabSstevel #define	LOMBUS_MIN_PAT		(LOMBUS_ONE_SEC/5)
120*3db86aabSstevel #define	LOMBUS_CMD_TIMEOUT	(LOMBUS_ONE_SEC*5)
121*3db86aabSstevel 
122*3db86aabSstevel 
123*3db86aabSstevel #ifdef	__cplusplus
124*3db86aabSstevel }
125*3db86aabSstevel #endif
126*3db86aabSstevel 
127*3db86aabSstevel #endif	/* _SYS_LOMBUS_H */
128