1139825Simp/*-
286232Stmm * Copyright (c) 1999, 2000 Matthew R. Green
3219567Smarius * All rights reserved.
4219567Smarius *
5219567Smarius * Redistribution and use in source and binary forms, with or without
6219567Smarius * modification, are permitted provided that the following conditions
7219567Smarius * are met:
8219567Smarius * 1. Redistributions of source code must retain the above copyright
9219567Smarius *    notice, this list of conditions and the following disclaimer.
10219567Smarius * 2. Redistributions in binary form must reproduce the above copyright
11219567Smarius *    notice, this list of conditions and the following disclaimer in the
12219567Smarius *    documentation and/or other materials provided with the distribution.
13219567Smarius * 3. The name of the author may not be used to endorse or promote products
14219567Smarius *    derived from this software without specific prior written permission.
15219567Smarius *
16219567Smarius * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17219567Smarius * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18219567Smarius * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19219567Smarius * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20219567Smarius * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21219567Smarius * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22219567Smarius * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23219567Smarius * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24219567Smarius * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25219567Smarius * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26219567Smarius * SUCH DAMAGE.
27219567Smarius *
28219567Smarius *	from: NetBSD: ebus.c,v 1.52 2008/05/29 14:51:26 mrg Exp
29219567Smarius */
30219567Smarius/*-
3186232Stmm * Copyright (c) 2001 Thomas Moestl <tmm@FreeBSD.org>
3286232Stmm * All rights reserved.
3386232Stmm *
3486232Stmm * Redistribution and use in source and binary forms, with or without
3586232Stmm * modification, are permitted provided that the following conditions
3686232Stmm * are met:
3786232Stmm * 1. Redistributions of source code must retain the above copyright
3886232Stmm *    notice, this list of conditions and the following disclaimer.
3986232Stmm * 2. Redistributions in binary form must reproduce the above copyright
4086232Stmm *    notice, this list of conditions and the following disclaimer in the
4186232Stmm *    documentation and/or other materials provided with the distribution.
4286232Stmm * 3. The name of the author may not be used to endorse or promote products
4386232Stmm *    derived from this software without specific prior written permission.
4486232Stmm *
4586232Stmm * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
4686232Stmm * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
4786232Stmm * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
4886232Stmm * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
4986232Stmm * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
5086232Stmm * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
5186232Stmm * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
5286232Stmm * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
5386232Stmm * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
5486232Stmm * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
5586232Stmm * SUCH DAMAGE.
5686232Stmm *
5786232Stmm * $FreeBSD: releng/11.0/sys/sparc64/isa/ofw_isa.h 219567 2011-03-12 14:33:32Z marius $
5886232Stmm */
5986232Stmm
6086232Stmm#ifndef _SPARC64_ISA_OFW_ISA_H_
6186232Stmm#define _SPARC64_ISA_OFW_ISA_H_
6286232Stmm
6386232Stmm/*
6486232Stmm * ISA PROM structures
6586232Stmm */
6686232Stmmstruct isa_regs {
6786232Stmm	u_int32_t	phys_hi;	/* high bits of physaddr */
6886232Stmm	u_int32_t	phys_lo;
6986232Stmm	u_int32_t	size;
7086232Stmm};
7186232Stmm
7286232Stmm#define	ISA_REG_PHYS(r) \
7386232Stmm	((((u_int64_t)((r)->phys_hi)) << 32) | ((u_int64_t)(r)->phys_lo))
7486232Stmm
7586232Stmm/* XXX: this is a guess. Verify... */
7686232Stmmstruct isa_ranges {
7786232Stmm	u_int32_t	child_hi;
7886232Stmm	u_int32_t	child_lo;
7986232Stmm	u_int32_t	phys_hi;
8086232Stmm	u_int32_t	phys_mid;
8186232Stmm	u_int32_t	phys_lo;
8286232Stmm	u_int32_t	size;
8386232Stmm};
8486232Stmm
8586232Stmm#define	ISA_RANGE_CHILD(r) \
8686232Stmm	((((u_int64_t)((r)->child_hi)) << 32) | ((u_int64_t)(r)->child_lo))
8786232Stmm#define	ISA_RANGE_PS(r)	(((r)->phys_hi >> 24) & 0x03)
88128712Stmm#define	ISA_RANGE_PHYS(r) \
89128712Stmm	((((u_int64_t)(r)->phys_mid) << 32) | ((u_int64_t)(r)->phys_lo))
9086232Stmm
91117119Stmmtypedef u_int32_t ofw_isa_intr_t;
92117119Stmm
93128712Stmmint ofw_isa_range_restype(struct isa_ranges *);
9486232Stmm/* Map an IO range. Returns the resource type of the range. */
95128712Stmmint ofw_isa_range_map(struct isa_ranges *, int, u_long *, u_long *, int *);
9686232Stmm
97117119Stmmofw_pci_intr_t ofw_isa_route_intr(device_t, phandle_t, struct ofw_bus_iinfo *,
98117119Stmm    ofw_isa_intr_t);
99117119Stmm
10086232Stmm#endif /* !_SPARC64_ISA_OFW_ISA_H_ */
101