1169689Skan/*-
2169689Skan * Copyright (c) 1998 The NetBSD Foundation, Inc.
3169689Skan * All rights reserved.
4169689Skan *
5169689Skan * This code is derived from software contributed to The NetBSD Foundation
6169689Skan * by Paul Kranenburg.
7169689Skan *
8169689Skan * Redistribution and use in source and binary forms, with or without
9169689Skan * modification, are permitted provided that the following conditions
10169689Skan * are met:
11169689Skan * 1. Redistributions of source code must retain the above copyright
12169689Skan *    notice, this list of conditions and the following disclaimer.
13169689Skan * 2. Redistributions in binary form must reproduce the above copyright
14169689Skan *    notice, this list of conditions and the following disclaimer in the
15169689Skan *    documentation and/or other materials provided with the distribution.
16169689Skan *
17169689Skan * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18169689Skan * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19169689Skan * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20169689Skan * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21169689Skan * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22169689Skan * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23169689Skan * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24169689Skan * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25169689Skan * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26169689Skan * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27169689Skan * POSSIBILITY OF SUCH DAMAGE.
28169689Skan */
29169689Skan/*-
30169689Skan * Copyright (c) 1992, 1993
31169689Skan *	The Regents of the University of California.  All rights reserved.
32169689Skan *
33169689Skan * This software was developed by the Computer Systems Engineering group
34169689Skan * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
35169689Skan * contributed to Berkeley.
36169689Skan *
37169689Skan * All advertising materials mentioning features or use of this software
38169689Skan * must display the following acknowledgement:
39169689Skan *	This product includes software developed by the University of
40169689Skan *	California, Lawrence Berkeley Laboratory.
41169689Skan *
42169689Skan * Redistribution and use in source and binary forms, with or without
43169689Skan * modification, are permitted provided that the following conditions
44169689Skan * are met:
45169689Skan * 1. Redistributions of source code must retain the above copyright
46169689Skan *    notice, this list of conditions and the following disclaimer.
47 * 2. Redistributions in binary form must reproduce the above copyright
48 *    notice, this list of conditions and the following disclaimer in the
49 *    documentation and/or other materials provided with the distribution.
50 * 4. Neither the name of the University nor the names of its contributors
51 *    may be used to endorse or promote products derived from this software
52 *    without specific prior written permission.
53 *
54 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
55 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
56 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
57 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
58 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
59 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
60 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
61 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
62 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
63 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
64 * SUCH DAMAGE.
65 *
66 *	from: @(#)sbusvar.h	8.1 (Berkeley) 6/11/93
67 *	from: NetBSD: sbusvar.h,v 1.15 2008/04/28 20:23:36 martin Exp
68 *
69 * $FreeBSD: releng/10.3/sys/sparc64/sbus/sbusvar.h 219567 2011-03-12 14:33:32Z marius $
70 */
71
72#ifndef _SPARC64_SBUS_SBUSVAR_H_
73#define	_SPARC64_SBUS_SBUSVAR_H_
74
75/*
76 * Macros for probe order
77 */
78#define	SBUS_ORDER_FIRST	10
79#define	SBUS_ORDER_NORMAL	20
80
81/*
82 * PROM-reported DMA burst sizes for the SBus
83 */
84#define	SBUS_BURST_1		(1 << 0)
85#define	SBUS_BURST_2		(1 << 1)
86#define	SBUS_BURST_4		(1 << 2)
87#define	SBUS_BURST_8		(1 << 3)
88#define	SBUS_BURST_16		(1 << 4)
89#define	SBUS_BURST_32		(1 << 5)
90#define	SBUS_BURST_64		(1 << 6)
91#define	SBUS_BURST_MASK		((1 << SBUS_BURST_SIZE) - 1)
92#define	SBUS_BURST_SIZE		16
93#define	SBUS_BURST64_MASK	(SBUS_BURST_MASK << SBUS_BURST64_SHIFT)
94#define	SBUS_BURST64_SHIFT	16
95
96/* Used if no burst sizes are specified for the bus. */
97#define	SBUS_BURST_DEF \
98	(SBUS_BURST_1 | SBUS_BURST_2 | SBUS_BURST_4 | SBUS_BURST_8 | 	\
99	SBUS_BURST_16 | SBUS_BURST_32 | SBUS_BURST_64)
100#define	SBUS_BURST64_DEF \
101	(SBUS_BURST_8 | SBUS_BURST_16 | SBUS_BURST_32 | SBUS_BURST_64)
102
103enum sbus_device_ivars {
104	SBUS_IVAR_BURSTSZ,
105	SBUS_IVAR_CLOCKFREQ,
106	SBUS_IVAR_IGN,
107	SBUS_IVAR_SLOT,
108};
109
110/*
111 * Simplified accessors for sbus devices
112 */
113#define	SBUS_ACCESSOR(var, ivar, type) \
114	__BUS_ACCESSOR(sbus, var, SBUS, ivar, type)
115
116SBUS_ACCESSOR(burstsz,		BURSTSZ,	int)
117SBUS_ACCESSOR(clockfreq,	CLOCKFREQ,	int)
118SBUS_ACCESSOR(ign,		IGN,		int)
119SBUS_ACCESSOR(slot,		SLOT,		int)
120
121#undef SBUS_ACCESSOR
122
123#endif /* _SPARC64_SBUS_SBUSVAR_H_ */
124