1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 1998 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Paul Kranenburg.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 *    notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 *    notice, this list of conditions and the following disclaimer in the
17 *    documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31/*-
32 * Copyright (c) 1992, 1993
33 *	The Regents of the University of California.  All rights reserved.
34 *
35 * This software was developed by the Computer Systems Engineering group
36 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
37 * contributed to Berkeley.
38 *
39 * All advertising materials mentioning features or use of this software
40 * must display the following acknowledgement:
41 *	This product includes software developed by the University of
42 *	California, Lawrence Berkeley Laboratory.
43 *
44 * Redistribution and use in source and binary forms, with or without
45 * modification, are permitted provided that the following conditions
46 * are met:
47 * 1. Redistributions of source code must retain the above copyright
48 *    notice, this list of conditions and the following disclaimer.
49 * 2. Redistributions in binary form must reproduce the above copyright
50 *    notice, this list of conditions and the following disclaimer in the
51 *    documentation and/or other materials provided with the distribution.
52 * 3. Neither the name of the University nor the names of its contributors
53 *    may be used to endorse or promote products derived from this software
54 *    without specific prior written permission.
55 *
56 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
57 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
58 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
59 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
60 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
61 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
62 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
63 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
64 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
65 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
66 * SUCH DAMAGE.
67 *
68 *	from: @(#)sbusvar.h	8.1 (Berkeley) 6/11/93
69 *	from: NetBSD: sbusvar.h,v 1.15 2008/04/28 20:23:36 martin Exp
70 *
71 * $FreeBSD$
72 */
73
74#ifndef _SPARC64_SBUS_SBUSVAR_H_
75#define	_SPARC64_SBUS_SBUSVAR_H_
76
77/*
78 * Macros for probe order
79 */
80#define	SBUS_ORDER_FIRST	10
81#define	SBUS_ORDER_NORMAL	20
82
83/*
84 * PROM-reported DMA burst sizes for the SBus
85 */
86#define	SBUS_BURST_1		(1 << 0)
87#define	SBUS_BURST_2		(1 << 1)
88#define	SBUS_BURST_4		(1 << 2)
89#define	SBUS_BURST_8		(1 << 3)
90#define	SBUS_BURST_16		(1 << 4)
91#define	SBUS_BURST_32		(1 << 5)
92#define	SBUS_BURST_64		(1 << 6)
93#define	SBUS_BURST_MASK		((1 << SBUS_BURST_SIZE) - 1)
94#define	SBUS_BURST_SIZE		16
95#define	SBUS_BURST64_MASK	(SBUS_BURST_MASK << SBUS_BURST64_SHIFT)
96#define	SBUS_BURST64_SHIFT	16
97
98/* Used if no burst sizes are specified for the bus. */
99#define	SBUS_BURST_DEF \
100	(SBUS_BURST_1 | SBUS_BURST_2 | SBUS_BURST_4 | SBUS_BURST_8 | 	\
101	SBUS_BURST_16 | SBUS_BURST_32 | SBUS_BURST_64)
102#define	SBUS_BURST64_DEF \
103	(SBUS_BURST_8 | SBUS_BURST_16 | SBUS_BURST_32 | SBUS_BURST_64)
104
105enum sbus_device_ivars {
106	SBUS_IVAR_BURSTSZ,
107	SBUS_IVAR_CLOCKFREQ,
108	SBUS_IVAR_IGN,
109	SBUS_IVAR_SLOT,
110};
111
112/*
113 * Simplified accessors for sbus devices
114 */
115#define	SBUS_ACCESSOR(var, ivar, type) \
116	__BUS_ACCESSOR(sbus, var, SBUS, ivar, type)
117
118SBUS_ACCESSOR(burstsz,		BURSTSZ,	int)
119SBUS_ACCESSOR(clockfreq,	CLOCKFREQ,	int)
120SBUS_ACCESSOR(ign,		IGN,		int)
121SBUS_ACCESSOR(slot,		SLOT,		int)
122
123#undef SBUS_ACCESSOR
124
125#endif /* _SPARC64_SBUS_SBUSVAR_H_ */
126