1*dd2488a8Smatt /* $NetBSD: pci_machdep.h,v 1.7 2011/06/22 18:06:34 matt Exp $ */ 2107803a3Smatt 3107803a3Smatt /* 4107803a3Smatt * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. 5107803a3Smatt * Copyright (c) 1994 Charles M. Hannum. All rights reserved. 6107803a3Smatt * 7107803a3Smatt * Redistribution and use in source and binary forms, with or without 8107803a3Smatt * modification, are permitted provided that the following conditions 9107803a3Smatt * are met: 10107803a3Smatt * 1. Redistributions of source code must retain the above copyright 11107803a3Smatt * notice, this list of conditions and the following disclaimer. 12107803a3Smatt * 2. Redistributions in binary form must reproduce the above copyright 13107803a3Smatt * notice, this list of conditions and the following disclaimer in the 14107803a3Smatt * documentation and/or other materials provided with the distribution. 15107803a3Smatt * 3. All advertising materials mentioning features or use of this software 16107803a3Smatt * must display the following acknowledgement: 17107803a3Smatt * This product includes software developed by Charles M. Hannum. 18107803a3Smatt * 4. The name of the author may not be used to endorse or promote products 19107803a3Smatt * derived from this software without specific prior written permission. 20107803a3Smatt * 21107803a3Smatt * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22107803a3Smatt * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23107803a3Smatt * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24107803a3Smatt * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 25107803a3Smatt * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 26107803a3Smatt * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27107803a3Smatt * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28107803a3Smatt * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29107803a3Smatt * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30107803a3Smatt * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31107803a3Smatt */ 32107803a3Smatt 33107803a3Smatt /* 34107803a3Smatt * Machine-specific definitions for PCI autoconfiguration. 35107803a3Smatt */ 36107803a3Smatt 37107803a3Smatt #define __HAVE_PCI_CONF_HOOK 38107803a3Smatt 39*dd2488a8Smatt #include <dev/pci/pcivar.h> 40*dd2488a8Smatt #include <powerpc/pci_machdep.h> 41*dd2488a8Smatt 42107803a3Smatt /* 43107803a3Smatt * Forward declarations. 44107803a3Smatt */ 45107803a3Smatt struct pci_attach_args; 46107803a3Smatt 47107803a3Smatt /* 48*dd2488a8Smatt * ibm4xx-specific PCI structure and type definitions. 49107803a3Smatt * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE. 50107803a3Smatt * 51107803a3Smatt * Configuration tag; created from a {bus,device,function} triplet by 52107803a3Smatt * pci_make_tag(), and passed to pci_conf_read() and pci_conf_write(). 53107803a3Smatt * We could instead always pass the {bus,device,function} triplet to 54107803a3Smatt * the read and write routines, but this would cause extra overhead. 55107803a3Smatt */ 56107803a3Smatt 57107803a3Smatt /* 58107803a3Smatt * Functions provided to machine-independent PCI code. 59107803a3Smatt */ 60*dd2488a8Smatt void ibm4xx_pci_attach_hook(device_t, device_t, 61107803a3Smatt struct pcibus_attach_args *); 62*dd2488a8Smatt int ibm4xx_pci_bus_maxdevs(void *, int); 63*dd2488a8Smatt pcitag_t ibm4xx_pci_make_tag(void *, int, int, int); 64*dd2488a8Smatt void ibm4xx_pci_decompose_tag(void *, pcitag_t, int *, int *, int *); 65*dd2488a8Smatt pcireg_t ibm4xx_pci_conf_read(void *, pcitag_t, int); 66*dd2488a8Smatt void ibm4xx_pci_conf_write(void *, pcitag_t, int, pcireg_t); 67107803a3Smatt 68*dd2488a8Smatt int ibm4xx_pci_intr_map(const struct pci_attach_args *, 69*dd2488a8Smatt pci_intr_handle_t *); 70*dd2488a8Smatt int ibm4xx_pci_intr_setattr(void *, pci_intr_handle_t *, 71*dd2488a8Smatt int, uint64_t); 72*dd2488a8Smatt 73*dd2488a8Smatt void ibm4xx_pci_conf_interrupt(void *, int, int, int, int, int *); 74*dd2488a8Smatt int ibm4xx_pci_conf_hook(void *, int, int, int, pcireg_t); 75*dd2488a8Smatt 76*dd2488a8Smatt void ibm4xx_pci_machdep_init(void); 77*dd2488a8Smatt pci_chipset_tag_t 78*dd2488a8Smatt ibm4xx_get_pci_chipset_tag(void); 79107803a3Smatt 80107803a3Smatt 81107803a3Smatt /* 82107803a3Smatt * Internal functions. 83107803a3Smatt */ 84*dd2488a8Smatt void ibm4xx_pci_init(int); 85