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