bus_common.h revision 178840
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 178840 2008-05-07 21:22:15Z marius $ 3788699Stmm */ 3888699Stmm 3988699Stmm#ifndef _MACHINE_BUS_COMMON_H_ 40172064Smarius#define _MACHINE_BUS_COMMON_H_ 4188699Stmm 42172064Smarius#define INTMAP_V 0x080000000LL /* Interrupt valid (enabled) */ 43172064Smarius#define INTMAP_TID_MASK 0x07c000000LL /* UPA target ID */ 44172064Smarius#define INTMAP_TID_SHIFT 26 45172064Smarius#define INTMAP_IGN_MASK 0x0000007c0LL /* Interrupt group no. */ 46172064Smarius#define INTMAP_IGN_SHIFT 6 47172064Smarius#define INTMAP_INO_MASK 0x00000003fLL /* Interrupt number */ 48172064Smarius#define INTMAP_INR_MASK (INTMAP_IGN_MASK | INTMAP_INO_MASK) 49172064Smarius#define INTMAP_SBUSSLOT_MASK 0x000000018LL /* SBus slot # */ 50172064Smarius#define INTMAP_PCIBUS_MASK 0x000000010LL /* PCI bus number (A or B) */ 51172064Smarius#define INTMAP_PCISLOT_MASK 0x00000000cLL /* PCI slot # */ 52172064Smarius#define INTMAP_PCIINT_MASK 0x000000003LL /* PCI interrupt #A,#B,#C,#D */ 53172064Smarius#define INTMAP_OBIO_MASK 0x000000020LL /* Onboard device */ 54172066Smarius#define INTIGN(x) (((x) & INTMAP_IGN_MASK) >> INTMAP_IGN_SHIFT) 55172064Smarius#define INTVEC(x) ((x) & INTMAP_INR_MASK) 56172064Smarius#define INTSLOT(x) (((x) >> 3) & 0x7) 57107477Stmm#define INTPRI(x) ((x) & 0x7) 58107477Stmm#define INTINO(x) ((x) & INTMAP_INO_MASK) 59178443Smarius#define INTMAP_ENABLE(mr, mid) \ 60178443Smarius (INTMAP_TID((mr), (mid)) | INTMAP_V) 61178443Smarius#define INTMAP_TID(mr, mid) \ 62178443Smarius (((mr) & ~INTMAP_TID_MASK) | ((mid) << INTMAP_TID_SHIFT)) 63178443Smarius#define INTMAP_VEC(ign, inr) \ 64178443Smarius ((((ign) << INTMAP_IGN_SHIFT) & INTMAP_IGN_MASK) | \ 65178443Smarius ((inr) & INTMAP_INR_MASK)) 6688699Stmm 6790619Stmm/* counter-timer support. */ 68178840Smariusvoid sparc64_counter_init(const char *name, bus_space_tag_t tag, 69178840Smarius bus_space_handle_t handle, bus_addr_t offset); 7090619Stmm 7188699Stmm#endif /* !_MACHINE_BUS_COMMON_H_ */ 72