bus_common.h revision 139825
1139825Simp/*-
288699Stmm * Copyright (c) 1992, 1993
388699Stmm *	The Regents of the University of California.  All rights reserved.
488699Stmm *
588699Stmm * This software was developed by the Computer Systems Engineering group
688699Stmm * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
788699Stmm * contributed to Berkeley.
888699Stmm *
988699Stmm * Redistribution and use in source and binary forms, with or without
1088699Stmm * modification, are permitted provided that the following conditions
1188699Stmm * are met:
1288699Stmm * 1. Redistributions of source code must retain the above copyright
1388699Stmm *    notice, this list of conditions and the following disclaimer.
1488699Stmm * 2. Redistributions in binary form must reproduce the above copyright
1588699Stmm *    notice, this list of conditions and the following disclaimer in the
1688699Stmm *    documentation and/or other materials provided with the distribution.
1788699Stmm * 4. Neither the name of the University nor the names of its contributors
1888699Stmm *    may be used to endorse or promote products derived from this software
1988699Stmm *    without specific prior written permission.
2088699Stmm *
2188699Stmm * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2288699Stmm * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2388699Stmm * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2488699Stmm * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2588699Stmm * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2688699Stmm * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2788699Stmm * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2888699Stmm * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2988699Stmm * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3088699Stmm * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3188699Stmm * SUCH DAMAGE.
3288699Stmm *
3388699Stmm *	form: @(#)sbusreg.h	8.1 (Berkeley) 6/11/93
3488699Stmm *	from: NetBSD: iommureg.h,v 1.6 2001/07/20 00:07:13 eeh Exp
3588699Stmm *
3688699Stmm * $FreeBSD: head/sys/sparc64/include/bus_common.h 139825 2005-01-07 02:29:27Z imp $
3788699Stmm */
3888699Stmm
3988699Stmm#ifndef _MACHINE_BUS_COMMON_H_
4088699Stmm#define _MACHINE_BUS_COMMON_H_
4188699Stmm
42107477Stmm#define INTMAP_V		0x080000000LL	/* Interrupt valid (enabled) */
43107477Stmm#define INTMAP_TID_MASK		0x07c000000LL	/* UPA target ID */
44107477Stmm#define INTMAP_TID_SHIFT	26
45107477Stmm#define INTMAP_IGN_MASK		0x0000007c0LL	/* Interrupt group no. */
46107477Stmm#define INTMAP_IGN_SHIFT	6
47107477Stmm#define INTMAP_INO_MASK		0x00000003fLL	/* Interrupt number */
48107477Stmm#define INTMAP_INR_MASK		(INTMAP_IGN_MASK | INTMAP_INO_MASK)
49107477Stmm#define INTMAP_SBUSSLOT_MASK	0x000000018LL	/* SBUS slot # */
50107477Stmm#define INTMAP_PCIBUS_MASK	0x000000010LL	/* PCI bus number (A or B) */
51107477Stmm#define INTMAP_PCISLOT_MASK	0x00000000cLL	/* PCI slot # */
52107477Stmm#define INTMAP_PCIINT_MASK	0x000000003LL	/* PCI interrupt #A,#B,#C,#D */
53107477Stmm#define INTMAP_OBIO_MASK	0x000000020LL	/* Onboard device */
54107477Stmm#define INTVEC(x)		((x) & INTMAP_INR_MASK)
55107477Stmm#define INTSLOT(x)		(((x) >> 3) & 0x7)
56107477Stmm#define	INTPRI(x)		((x) & 0x7)
57107477Stmm#define	INTINO(x)		((x) & INTMAP_INO_MASK)
58107477Stmm#define	INTMAP_ENABLE(mr, mid) \
59107477Stmm	(((mr) & ~INTMAP_TID_MASK) | ((mid) << INTMAP_TID_SHIFT) | INTMAP_V)
6088699Stmm
6190619Stmm/* counter-timer support. */
6290619Stmmvoid sparc64_counter_init(bus_space_tag_t tag, bus_space_handle_t handle,
6390619Stmm    bus_addr_t offset);
6490619Stmm
6588699Stmm#endif	/* !_MACHINE_BUS_COMMON_H_ */
66