xref: /illumos-gate/usr/src/uts/common/sys/lombus.h (revision 2d6eb4a5)
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 #ifdef	__cplusplus
31*3db86aabSstevel extern "C" {
32*3db86aabSstevel #endif
33*3db86aabSstevel 
34*3db86aabSstevel /*
35*3db86aabSstevel  * Information for client (child) drivers:
36*3db86aabSstevel  *
37*3db86aabSstevel  *	Register space definitions
38*3db86aabSstevel  *	Fault info access
39*3db86aabSstevel  *	Fault codes
40*3db86aabSstevel  *
41*3db86aabSstevel  * LOMbus child regspecs are triples, in the form
42*3db86aabSstevel  * 	<space>, <base>, <size>
43*3db86aabSstevel  */
44*3db86aabSstevel typedef struct {
45*3db86aabSstevel 	int lombus_space;
46*3db86aabSstevel 	int lombus_base;
47*3db86aabSstevel 	int lombus_size;
48*3db86aabSstevel } lombus_regspec_t;
49*3db86aabSstevel 
50*3db86aabSstevel #define	LOMBUS_REGSPEC_SIZE	3	/* words/regspec */
51*3db86aabSstevel 
52*3db86aabSstevel 
53*3db86aabSstevel /*
54*3db86aabSstevel  * Register spaces
55*3db86aabSstevel  *
56*3db86aabSstevel  *	Space	Size	Range		Meaning
57*3db86aabSstevel  *		(bits)
58*3db86aabSstevel  *
59*3db86aabSstevel  *	0	8	[0 .. 16383]	LOM virtual registers
60*3db86aabSstevel  *	1	8	[0]		Watchdog pat (on write)
61*3db86aabSstevel  *	2	16	[0]		Async event info (read only)
62*3db86aabSstevel  *	All	32	[-4 .. -12]	Access handle fault info
63*3db86aabSstevel  */
64*3db86aabSstevel #define	LOMBUS_VREG_SPACE	(0)
65*3db86aabSstevel #define	LOMBUS_PAT_SPACE	(1)
66*3db86aabSstevel #define	LOMBUS_EVENT_SPACE	(2)
67*3db86aabSstevel 
68*3db86aabSstevel #define	LOMBUS_MAX_REG		(16383)		/* space 0: [0..16383]	*/
69*3db86aabSstevel #define	LOMBUS_PAT_REG		(0)		/* space 1: [0]		*/
70*3db86aabSstevel #define	LOMBUS_EVENT_REG	(0)		/* space 2: [0]		*/
71*3db86aabSstevel 
72*3db86aabSstevel #define	LOMBUS_FAULT_REG	(-4)		/* 32-bit only, R/W	*/
73*3db86aabSstevel #define	LOMBUS_PROBE_REG	(-8)		/* 32-bit only, R/W	*/
74*3db86aabSstevel #define	LOMBUS_ASYNC_REG	(-12)		/* 32-bit only, R/O	*/
75*3db86aabSstevel 
76*3db86aabSstevel 
77*3db86aabSstevel /*
78*3db86aabSstevel  * Internally-generated errors
79*3db86aabSstevel  *
80*3db86aabSstevel  * Note: LOM-generated errors are 0x00-0x7f and SunVTS uses 0x80-0xff,
81*3db86aabSstevel  * so these start at 0x100
82*3db86aabSstevel  */
83*3db86aabSstevel enum lombus_errs {
84*3db86aabSstevel 	LOMBUS_ERR_BASE = 0x100,
85*3db86aabSstevel 
86*3db86aabSstevel 	/*
87*3db86aabSstevel 	 * Errors in the way the child is accessing the virtual registers.
88*3db86aabSstevel 	 * These are programming errors and won't go away on retry!
89*3db86aabSstevel 	 */
90*3db86aabSstevel 	LOMBUS_ERR_REG_NUM,		/* register number out of range	*/
91*3db86aabSstevel 	LOMBUS_ERR_REG_RO,		/* write to read-only register	*/
92*3db86aabSstevel 	LOMBUS_ERR_REG_SIZE,		/* access with invalid size	*/
93*3db86aabSstevel 
94*3db86aabSstevel 	/*
95*3db86aabSstevel 	 * Error accessing the underlying SIO hardware
96*3db86aabSstevel 	 * This is unlikely to be recoverable.
97*3db86aabSstevel 	 */
98*3db86aabSstevel 	LOMBUS_ERR_SIOHW = 0x110,
99*3db86aabSstevel 
100*3db86aabSstevel 	/*
101*3db86aabSstevel 	 * Errors in the LOMbus <-> LOM firmware protocol
102*3db86aabSstevel 	 * These may or may not be recoverable, depending
103*3db86aabSstevel 	 * on the state of the LOM.
104*3db86aabSstevel 	 */
105*3db86aabSstevel 	LOMBUS_ERR_TIMEOUT = 0x120,	/* no response from LOM		*/
106*3db86aabSstevel 	LOMBUS_ERR_OFLOW,		/* rcv buf oflo - LOM babbling?	*/
107*3db86aabSstevel 	LOMBUS_ERR_SEQUENCE,		/* cmd/reply sequence mismatch	*/
108*3db86aabSstevel 	LOMBUS_ERR_BADSTATUS,		/* bad status byte in reply pkt	*/
109*3db86aabSstevel 	LOMBUS_ERR_BADERRCODE		/* invalid error code in reply	*/
110*3db86aabSstevel };
111*3db86aabSstevel 
112*3db86aabSstevel 
113*3db86aabSstevel /*
114*3db86aabSstevel  * Time periods, in nanoseconds
115*3db86aabSstevel  */
116*3db86aabSstevel #define	LOMBUS_ONE_SEC		1000000000LL
117*3db86aabSstevel #define	LOMBUS_MIN_PAT		(LOMBUS_ONE_SEC/5)
118*3db86aabSstevel #define	LOMBUS_CMD_TIMEOUT	(LOMBUS_ONE_SEC*5)
119*3db86aabSstevel 
120*3db86aabSstevel 
121*3db86aabSstevel #ifdef	__cplusplus
122*3db86aabSstevel }
123*3db86aabSstevel #endif
124*3db86aabSstevel 
125*3db86aabSstevel #endif	/* _SYS_LOMBUS_H */
126