ofw_pci_if.m revision 86234
186234Stmm# Copyright (c) 2001 by Thomas Moestl <tmm@FreeBSD.org>.
286234Stmm# All rights reserved.
386234Stmm#
486234Stmm# Redistribution and use in source and binary forms, with or without
586234Stmm# modification, are permitted provided that the following conditions
686234Stmm# are met:
786234Stmm# 1. Redistributions of source code must retain the above copyright
886234Stmm#    notice, this list of conditions and the following disclaimer.
986234Stmm# 2. Redistributions in binary form must reproduce the above copyright
1086234Stmm#    notice, this list of conditions and the following disclaimer in the
1186234Stmm#    documentation and/or other materials provided with the distribution.
1286234Stmm#
1386234Stmm# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1486234Stmm# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1586234Stmm# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1686234Stmm# IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
1786234Stmm# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
1886234Stmm# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1986234Stmm# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2086234Stmm# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2186234Stmm# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
2286234Stmm# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2386234Stmm#
2486234Stmm# $FreeBSD: head/sys/sparc64/pci/ofw_pci_if.m 86234 2001-11-09 20:43:44Z tmm $
2586234Stmm
2686234Stmm#include <sys/bus.h>
2786234Stmm#include <machine/bus.h>
2886234Stmm
2986234StmmINTERFACE sparcbus;
3086234Stmm
3186234StmmHEADER {
3286234Stmm	/* Bus tag types for the get_bustag method */
3386234Stmm	enum sbbt_id {
3486234Stmm		SBBT_IO,
3586234Stmm		SBBT_MEM,
3686234Stmm	};
3786234Stmm};
3886234Stmm
3986234StmmCODE {
4086234Stmm	static int sparcbus_default_intr_pending(device_t, int);
4186234Stmm	static bus_space_handle_t sparcbus_default_get_bus_handle(device_t,
4286234Stmm	    enum sbbt_id, bus_space_handle_t childhdl, bus_space_tag_t *tag);
4386234Stmm
4486234Stmm	static int
4586234Stmm	sparcbus_default_intr_pending(device_t dev, int intr)
4686234Stmm	{
4786234Stmm
4886234Stmm		return (SPARCBUS_INTR_PENDING(device_get_parent(dev), intr));
4986234Stmm	}
5086234Stmm
5186234Stmm	static bus_space_handle_t
5286234Stmm	sparcbus_default_get_bus_handle(device_t dev, enum sbbt_id id,
5386234Stmm	    bus_space_handle_t childhdl, bus_space_tag_t *tag)
5486234Stmm	{
5586234Stmm
5686234Stmm		return (SPARCBUS_GET_BUS_HANDLE(device_get_parent(dev), id,
5786234Stmm		    childhdl, tag));
5886234Stmm	}
5986234Stmm};
6086234Stmm
6186234Stmm# Return whether an interrupt request is pending for the INO intr.
6286234StmmMETHOD int intr_pending {
6386234Stmm	device_t dev;
6486234Stmm	int intr;
6586234Stmm} DEFAULT sparcbus_default_intr_pending;
6686234Stmm
6786234Stmm# Get the bustag for the root bus. This is needed for ISA old-stlye
6886234Stmm# in[bwl]()/out[bwl]() support, where no tag retrieved from a resource is
6986234Stmm# passed. The returned tag is used to construct a tag for the whole ISA bus.
7086234StmmMETHOD bus_space_handle_t get_bus_handle {
7186234Stmm	device_t dev;
7286234Stmm	enum sbbt_id id;
7386234Stmm	bus_space_handle_t childhdl;
7486234Stmm	bus_space_tag_t *tag;
7586234Stmm} DEFAULT sparcbus_default_get_bus_handle;
76