bus_common.h revision 90619
188699Stmm/*
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 * All advertising materials mentioning features or use of this software
1088699Stmm * must display the following acknowledgement:
1188699Stmm *	This product includes software developed by the University of
1288699Stmm *	California, Lawrence Berkeley Laboratory.
1388699Stmm *
1488699Stmm * Redistribution and use in source and binary forms, with or without
1588699Stmm * modification, are permitted provided that the following conditions
1688699Stmm * are met:
1788699Stmm * 1. Redistributions of source code must retain the above copyright
1888699Stmm *    notice, this list of conditions and the following disclaimer.
1988699Stmm * 2. Redistributions in binary form must reproduce the above copyright
2088699Stmm *    notice, this list of conditions and the following disclaimer in the
2188699Stmm *    documentation and/or other materials provided with the distribution.
2288699Stmm * 3. All advertising materials mentioning features or use of this software
2388699Stmm *    must display the following acknowledgement:
2488699Stmm *	This product includes software developed by the University of
2588699Stmm *	California, Berkeley and its contributors.
2688699Stmm * 4. Neither the name of the University nor the names of its contributors
2788699Stmm *    may be used to endorse or promote products derived from this software
2888699Stmm *    without specific prior written permission.
2988699Stmm *
3088699Stmm * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
3188699Stmm * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
3288699Stmm * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
3388699Stmm * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
3488699Stmm * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3588699Stmm * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3688699Stmm * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3788699Stmm * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3888699Stmm * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3988699Stmm * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
4088699Stmm * SUCH DAMAGE.
4188699Stmm *
4288699Stmm *	form: @(#)sbusreg.h	8.1 (Berkeley) 6/11/93
4388699Stmm *	from: NetBSD: iommureg.h,v 1.6 2001/07/20 00:07:13 eeh Exp
4488699Stmm *
4588699Stmm * $FreeBSD: head/sys/sparc64/include/bus_common.h 90619 2002-02-13 16:16:36Z tmm $
4688699Stmm */
4788699Stmm
4888699Stmm#ifndef _MACHINE_BUS_COMMON_H_
4988699Stmm#define _MACHINE_BUS_COMMON_H_
5088699Stmm
5188699Stmm#define INTMAP_V	0x080000000LL	/* Interrupt valid (enabled) */
5288699Stmm#define INTMAP_TID	0x07c000000LL	/* UPA target ID mask */
5388699Stmm#define INTMAP_IGN	0x0000007c0LL	/* Interrupt group no (sbus only). */
5488699Stmm#define INTMAP_INO	0x00000003fLL	/* Interrupt number */
5588699Stmm#define INTMAP_INR	(INTMAP_IGN | INTMAP_INO)
5688699Stmm#define INTMAP_SBUSSLOT	0x000000018LL	/* SBUS slot # */
5788699Stmm#define INTMAP_PCIBUS	0x000000010LL	/* PCI bus number (A or B) */
5888699Stmm#define INTMAP_PCISLOT	0x00000000cLL	/* PCI slot # */
5988699Stmm#define INTMAP_PCIINT	0x000000003LL	/* PCI interrupt #A,#B,#C,#D */
6088699Stmm#define INTMAP_OBIO	0x000000020LL	/* Onboard device */
6188699Stmm#define INTMAP_LSHIFT	11		/* Encode level in vector */
6288699Stmm#define	INTLEVENCODE(x)	(((x) & 0x0f) << INTMAP_LSHIFT)
6388699Stmm#define INTLEV(x)	(((x) >> INTMAP_LSHIFT) & 0x0f)
6488699Stmm#define INTVEC(x)	((x) & INTMAP_INR)
6588699Stmm#define INTSLOT(x)	(((x) >> 3) & 0x7)
6688699Stmm#define	INTPRI(x)	((x) & 0x7)
6788699Stmm#define	INTINO(x)	((x) & INTMAP_INO)
6888699Stmm
6990619Stmm/* counter-timer support. */
7090619Stmmvoid sparc64_counter_init(bus_space_tag_t tag, bus_space_handle_t handle,
7190619Stmm    bus_addr_t offset);
7290619Stmm
7388699Stmm#endif	/* !_MACHINE_BUS_COMMON_H_ */
74