1297392Szbb/*- 2297392Szbb * Copyright (c) 2011 Nathan Whitehorn 3297392Szbb * All rights reserved. 4297392Szbb * 5297392Szbb * Redistribution and use in source and binary forms, with or without 6297392Szbb * modification, are permitted provided that the following conditions 7297392Szbb * are met: 8297392Szbb * 1. Redistributions of source code must retain the above copyright 9297392Szbb * notice, this list of conditions and the following disclaimer. 10297392Szbb * 2. Redistributions in binary form must reproduce the above copyright 11297392Szbb * notice, this list of conditions and the following disclaimer in the 12297392Szbb * documentation and/or other materials provided with the distribution. 13297392Szbb * 14297392Szbb * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15297392Szbb * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16297392Szbb * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17297392Szbb * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18297392Szbb * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19297392Szbb * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20297392Szbb * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21297392Szbb * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22297392Szbb * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23297392Szbb * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24297392Szbb * SUCH DAMAGE. 25297392Szbb * 26297392Szbb * $FreeBSD: stable/11/sys/dev/ofw/ofwpci.h 307347 2016-10-15 09:09:25Z mmel $ 27297392Szbb */ 28297392Szbb 29297392Szbb#ifndef _DEV_OFW_OFWPCI_H_ 30297392Szbb#define _DEV_OFW_OFWPCI_H_ 31297392Szbb 32297392Szbb/* 33297392Szbb * Export class definition for inheritance purposes 34297392Szbb */ 35297392SzbbDECLARE_CLASS(ofw_pci_driver); 36297392Szbb 37297392Szbbstruct ofw_pci_cell_info { 38297392Szbb pcell_t host_address_cells; 39297392Szbb pcell_t pci_address_cell; 40297392Szbb pcell_t size_cells; 41297392Szbb }; 42297392Szbb 43297392Szbbstruct ofw_pci_range { 44297392Szbb uint32_t pci_hi; 45297392Szbb uint64_t pci; 46297392Szbb uint64_t host; 47297392Szbb uint64_t size; 48297392Szbb}; 49297392Szbb 50297392Szbb/* 51297392Szbb * Quirks for some adapters 52297392Szbb */ 53297392Szbbenum { 54297392Szbb OFW_PCI_QUIRK_RANGES_ON_CHILDREN = 1, 55297392Szbb}; 56297392Szbb 57297392Szbbstruct ofw_pci_softc { 58297392Szbb device_t sc_dev; 59297392Szbb phandle_t sc_node; 60297392Szbb int sc_bus; 61297392Szbb int sc_initialized; 62297392Szbb int sc_quirks; 63307347Smmel int sc_have_pmem; 64297392Szbb 65297392Szbb struct ofw_pci_range *sc_range; 66297392Szbb int sc_nrange; 67307347Smmel uint64_t sc_range_mask; 68297392Szbb struct ofw_pci_cell_info *sc_cell_info; 69297392Szbb 70297392Szbb struct rman sc_io_rman; 71297392Szbb struct rman sc_mem_rman; 72307347Smmel struct rman sc_pmem_rman; 73297392Szbb bus_space_tag_t sc_memt; 74297392Szbb bus_dma_tag_t sc_dmat; 75307347Smmel int sc_pci_domain; 76297392Szbb 77297392Szbb struct ofw_bus_iinfo sc_pci_iinfo; 78297392Szbb}; 79297392Szbb 80297392Szbbint ofw_pci_init(device_t); 81297392Szbbint ofw_pci_attach(device_t); 82297392Szbbint ofw_pci_read_ivar(device_t, device_t, int, uintptr_t *); 83297392Szbbint ofw_pci_write_ivar(device_t, device_t, int, uintptr_t); 84297392Szbbint ofw_pci_route_interrupt(device_t, device_t, int); 85297392Szbbint ofw_pci_nranges(phandle_t, struct ofw_pci_cell_info *); 86297392Szbb 87297392Szbb#endif /* _DEV_OFW_OFWPCI_H_ */ 88