bhnd_pcib.c revision 300015
1195609Smp/*- 259243Sobrien * Copyright (c) 2015 Landon Fuller <landon@landonf.org> 359243Sobrien * All rights reserved. 459243Sobrien * 559243Sobrien * Redistribution and use in source and binary forms, with or without 659243Sobrien * modification, are permitted provided that the following conditions 759243Sobrien * are met: 859243Sobrien * 1. Redistributions of source code must retain the above copyright 959243Sobrien * notice, this list of conditions and the following disclaimer, 1059243Sobrien * without modification. 1159243Sobrien * 2. Redistributions in binary form must reproduce at minimum a disclaimer 1259243Sobrien * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any 1359243Sobrien * redistribution must be conditioned upon including a substantially 1459243Sobrien * similar Disclaimer requirement for further binary redistribution. 1559243Sobrien * 1659243Sobrien * NO WARRANTY 17100616Smp * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1859243Sobrien * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1959243Sobrien * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY 2059243Sobrien * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 2159243Sobrien * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, 2259243Sobrien * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2359243Sobrien * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2459243Sobrien * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 2559243Sobrien * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2659243Sobrien * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 2759243Sobrien * THE POSSIBILITY OF SUCH DAMAGES. 2859243Sobrien */ 2959243Sobrien 3059243Sobrien#include <sys/cdefs.h> 3159243Sobrien__FBSDID("$FreeBSD: head/sys/dev/bhnd/cores/pci/bhnd_pcib.c 300015 2016-05-17 06:52:53Z adrian $"); 3259243Sobrien 3359243Sobrien/* 3459243Sobrien * Broadcom PCI/PCIe-Gen1 Host-PCI bridge. 3559243Sobrien * 3659243Sobrien * This driver handles all interactions with PCI bridge cores operating in 3759243Sobrien * root complex mode. 3859243Sobrien */ 3959243Sobrien 4059243Sobrien#include <sys/param.h> 4159243Sobrien#include <sys/kernel.h> 4269408Sache#include <sys/bus.h> 4359243Sobrien#include <sys/module.h> 4469408Sache 4559243Sobrien#include <machine/bus.h> 46195609Smp#include <sys/rman.h> 47195609Smp#include <machine/resource.h> 48195609Smp 49195609Smp#include <dev/bhnd/bhnd.h> 50195609Smp 5159243Sobrien#include "bhnd_pcireg.h" 5259243Sobrien#include "bhnd_pcibvar.h" 5359243Sobrien 5459243Sobrienstatic int 5559243Sobrienbhnd_pcib_attach(device_t dev) 5659243Sobrien{ 5759243Sobrien // TODO 5859243Sobrien return (bhnd_pci_generic_attach(dev)); 5959243Sobrien} 6059243Sobrien 61167465Smpstatic int 6259243Sobrienbhnd_pcib_detach(device_t dev) 6359243Sobrien{ 64145479Smp // TODO 6559243Sobrien return (bhnd_pci_generic_detach(dev)); 66145479Smp} 6759243Sobrien 6859243Sobrienstatic int 6959243Sobrienbhnd_pcib_suspend(device_t dev) 7059243Sobrien{ 7159243Sobrien return (bhnd_pci_generic_suspend(dev)); 7259243Sobrien} 7359243Sobrien 7459243Sobrienstatic int 7559243Sobrienbhnd_pcib_resume(device_t dev) 7659243Sobrien{ 7759243Sobrien return (bhnd_pci_generic_resume(dev)); 7859243Sobrien} 7959243Sobrien 8059243Sobrienstatic device_method_t bhnd_pcib_methods[] = { 8159243Sobrien /* Device interface */ 8259243Sobrien DEVMETHOD(device_attach, bhnd_pcib_attach), 8359243Sobrien DEVMETHOD(device_detach, bhnd_pcib_detach), 8459243Sobrien DEVMETHOD(device_suspend, bhnd_pcib_suspend), 8559243Sobrien DEVMETHOD(device_resume, bhnd_pcib_resume), 8659243Sobrien DEVMETHOD_END 8759243Sobrien}; 8859243Sobrien 8959243SobrienDEFINE_CLASS_1(pcib, bhnd_pcib_driver, bhnd_pcib_methods, sizeof(struct bhnd_pcib_softc), bhnd_pci_driver); 9059243Sobrien 9159243Sobrienstatic devclass_t pcib_devclass; 9259243SobrienDRIVER_MODULE(bhnd_pcib, bhnd, bhnd_pcib_driver, pcib_devclass, 0, 0); 9359243Sobrien 9459243SobrienMODULE_VERSION(bhnd_pcib, 1); 9559243SobrienMODULE_DEPEND(bhnd_pcib, bhnd, 1, 1, 1); 9659243SobrienMODULE_DEPEND(bhnd_pcib, bhnd_pci, 1, 1, 1); 9759243SobrienMODULE_DEPEND(bhnd_pcib, pci, 1, 1, 1); 9859243Sobrien