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