1230993Snwhitehorn/*-
2230993Snwhitehorn * Copyright (c) 2011 Nathan Whitehorn
3230993Snwhitehorn * All rights reserved.
4230993Snwhitehorn *
5230993Snwhitehorn * Redistribution and use in source and binary forms, with or without
6230993Snwhitehorn * modification, are permitted provided that the following conditions
7230993Snwhitehorn * are met:
8230993Snwhitehorn * 1. Redistributions of source code must retain the above copyright
9230993Snwhitehorn *    notice, this list of conditions and the following disclaimer.
10230993Snwhitehorn * 2. Redistributions in binary form must reproduce the above copyright
11230993Snwhitehorn *    notice, this list of conditions and the following disclaimer in the
12230993Snwhitehorn *    documentation and/or other materials provided with the distribution.
13230993Snwhitehorn *
14230993Snwhitehorn * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15230993Snwhitehorn * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16230993Snwhitehorn * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17230993Snwhitehorn * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18230993Snwhitehorn * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19230993Snwhitehorn * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20230993Snwhitehorn * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21230993Snwhitehorn * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22230993Snwhitehorn * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23230993Snwhitehorn * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24230993Snwhitehorn * SUCH DAMAGE.
25230993Snwhitehorn *
26230993Snwhitehorn * $FreeBSD$
27230993Snwhitehorn */
28230993Snwhitehorn
29230993Snwhitehorn#ifndef POWERPC_OFW_OFW_PCI_H
30230993Snwhitehorn#define POWERPC_OFW_OFW_PCI_H
31230993Snwhitehorn
32230993Snwhitehorn/*
33230993Snwhitehorn * Export class definition for inheritance purposes
34230993Snwhitehorn */
35230993SnwhitehornDECLARE_CLASS(ofw_pci_driver);
36230993Snwhitehorn
37230993Snwhitehornstruct ofw_pci_range {
38230993Snwhitehorn	uint32_t	pci_hi;
39230993Snwhitehorn	uint64_t	pci;
40230993Snwhitehorn	uint64_t	host;
41230993Snwhitehorn	uint64_t	size;
42230993Snwhitehorn};
43230993Snwhitehorn
44230993Snwhitehorn/*
45230993Snwhitehorn * Quirks for some adapters
46230993Snwhitehorn */
47230993Snwhitehornenum {
48230993Snwhitehorn	OFW_PCI_QUIRK_RANGES_ON_CHILDREN = 1,
49230993Snwhitehorn};
50230993Snwhitehorn
51230993Snwhitehornstruct ofw_pci_softc {
52230993Snwhitehorn	device_t		sc_dev;
53230993Snwhitehorn	phandle_t		sc_node;
54230993Snwhitehorn	int			sc_bus;
55256846Snwhitehorn	int			sc_initialized;
56230993Snwhitehorn
57230993Snwhitehorn	int			sc_quirks;
58230993Snwhitehorn
59230993Snwhitehorn	struct ofw_pci_range	*sc_range;
60230993Snwhitehorn	int			sc_nrange;
61230993Snwhitehorn
62230993Snwhitehorn	struct rman		sc_io_rman;
63230993Snwhitehorn	struct rman		sc_mem_rman;
64230993Snwhitehorn	bus_space_tag_t		sc_memt;
65230993Snwhitehorn	bus_dma_tag_t		sc_dmat;
66230993Snwhitehorn
67230993Snwhitehorn	struct ofw_bus_iinfo    sc_pci_iinfo;
68230993Snwhitehorn};
69230993Snwhitehorn
70256846Snwhitehornint ofw_pci_init(device_t dev);
71230993Snwhitehornint ofw_pci_attach(device_t dev);
72230993Snwhitehorn
73230993Snwhitehorn#endif // POWERPC_OFW_OFW_PCI_H
74230993Snwhitehorn
75