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