xref: /freebsd/sys/dev/bhnd/cores/pci/bhnd_pcib.c (revision 685dc743)
14ad7e9b0SAdrian Chadd /*-
24d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
36e778a7eSPedro F. Giffuni  *
44ad7e9b0SAdrian Chadd  * Copyright (c) 2015 Landon Fuller <landon@landonf.org>
54ad7e9b0SAdrian Chadd  * All rights reserved.
64ad7e9b0SAdrian Chadd  *
74ad7e9b0SAdrian Chadd  * Redistribution and use in source and binary forms, with or without
84ad7e9b0SAdrian Chadd  * modification, are permitted provided that the following conditions
94ad7e9b0SAdrian Chadd  * are met:
104ad7e9b0SAdrian Chadd  * 1. Redistributions of source code must retain the above copyright
114ad7e9b0SAdrian Chadd  *    notice, this list of conditions and the following disclaimer,
124ad7e9b0SAdrian Chadd  *    without modification.
134ad7e9b0SAdrian Chadd  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
144ad7e9b0SAdrian Chadd  *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
154ad7e9b0SAdrian Chadd  *    redistribution must be conditioned upon including a substantially
164ad7e9b0SAdrian Chadd  *    similar Disclaimer requirement for further binary redistribution.
174ad7e9b0SAdrian Chadd  *
184ad7e9b0SAdrian Chadd  * NO WARRANTY
194ad7e9b0SAdrian Chadd  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
204ad7e9b0SAdrian Chadd  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
214ad7e9b0SAdrian Chadd  * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
224ad7e9b0SAdrian Chadd  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
234ad7e9b0SAdrian Chadd  * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
244ad7e9b0SAdrian Chadd  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
254ad7e9b0SAdrian Chadd  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
264ad7e9b0SAdrian Chadd  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
274ad7e9b0SAdrian Chadd  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
284ad7e9b0SAdrian Chadd  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
294ad7e9b0SAdrian Chadd  * THE POSSIBILITY OF SUCH DAMAGES.
304ad7e9b0SAdrian Chadd  */
314ad7e9b0SAdrian Chadd 
324ad7e9b0SAdrian Chadd #include <sys/cdefs.h>
334ad7e9b0SAdrian Chadd /*
34bb64eeccSAdrian Chadd  * Broadcom PCI/PCIe-Gen1 Host-PCI bridge.
354ad7e9b0SAdrian Chadd  *
36bb64eeccSAdrian Chadd  * This driver handles all interactions with PCI bridge cores operating in
37bb64eeccSAdrian Chadd  * root complex mode.
384ad7e9b0SAdrian Chadd  */
394ad7e9b0SAdrian Chadd 
404ad7e9b0SAdrian Chadd #include <sys/param.h>
414ad7e9b0SAdrian Chadd #include <sys/kernel.h>
424ad7e9b0SAdrian Chadd #include <sys/bus.h>
434ad7e9b0SAdrian Chadd #include <sys/module.h>
444ad7e9b0SAdrian Chadd 
454ad7e9b0SAdrian Chadd #include <machine/bus.h>
464ad7e9b0SAdrian Chadd #include <sys/rman.h>
474ad7e9b0SAdrian Chadd #include <machine/resource.h>
484ad7e9b0SAdrian Chadd 
494ad7e9b0SAdrian Chadd #include <dev/bhnd/bhnd.h>
504ad7e9b0SAdrian Chadd 
514ad7e9b0SAdrian Chadd #include "bhnd_pcireg.h"
524ad7e9b0SAdrian Chadd #include "bhnd_pcibvar.h"
534ad7e9b0SAdrian Chadd 
544ad7e9b0SAdrian Chadd static int
bhnd_pcib_attach(device_t dev)554ad7e9b0SAdrian Chadd bhnd_pcib_attach(device_t dev)
564ad7e9b0SAdrian Chadd {
57bb64eeccSAdrian Chadd 	// TODO
58bb64eeccSAdrian Chadd 	return (bhnd_pci_generic_attach(dev));
594ad7e9b0SAdrian Chadd }
604ad7e9b0SAdrian Chadd 
614ad7e9b0SAdrian Chadd static int
bhnd_pcib_detach(device_t dev)624ad7e9b0SAdrian Chadd bhnd_pcib_detach(device_t dev)
634ad7e9b0SAdrian Chadd {
64bb64eeccSAdrian Chadd 	// TODO
65bb64eeccSAdrian Chadd 	return (bhnd_pci_generic_detach(dev));
664ad7e9b0SAdrian Chadd }
674ad7e9b0SAdrian Chadd 
684ad7e9b0SAdrian Chadd static int
bhnd_pcib_suspend(device_t dev)694ad7e9b0SAdrian Chadd bhnd_pcib_suspend(device_t dev)
704ad7e9b0SAdrian Chadd {
71bb64eeccSAdrian Chadd 	return (bhnd_pci_generic_suspend(dev));
724ad7e9b0SAdrian Chadd }
734ad7e9b0SAdrian Chadd 
744ad7e9b0SAdrian Chadd static int
bhnd_pcib_resume(device_t dev)754ad7e9b0SAdrian Chadd bhnd_pcib_resume(device_t dev)
764ad7e9b0SAdrian Chadd {
77bb64eeccSAdrian Chadd 	return (bhnd_pci_generic_resume(dev));
784ad7e9b0SAdrian Chadd }
794ad7e9b0SAdrian Chadd 
804ad7e9b0SAdrian Chadd static device_method_t bhnd_pcib_methods[] = {
814ad7e9b0SAdrian Chadd 	/* Device interface */
824ad7e9b0SAdrian Chadd 	DEVMETHOD(device_attach,	bhnd_pcib_attach),
834ad7e9b0SAdrian Chadd 	DEVMETHOD(device_detach,	bhnd_pcib_detach),
844ad7e9b0SAdrian Chadd 	DEVMETHOD(device_suspend,	bhnd_pcib_suspend),
854ad7e9b0SAdrian Chadd 	DEVMETHOD(device_resume,	bhnd_pcib_resume),
864ad7e9b0SAdrian Chadd 	DEVMETHOD_END
874ad7e9b0SAdrian Chadd };
884ad7e9b0SAdrian Chadd 
898ef24a0dSAdrian Chadd DEFINE_CLASS_1(pcib, bhnd_pcib_driver, bhnd_pcib_methods, sizeof(struct bhnd_pcib_softc), bhnd_pci_driver);
908ef24a0dSAdrian Chadd 
91162c26adSJohn Baldwin DRIVER_MODULE(bhnd_pcib, bhnd, bhnd_pcib_driver, 0, 0);
924ad7e9b0SAdrian Chadd 
934ad7e9b0SAdrian Chadd MODULE_VERSION(bhnd_pcib, 1);
94eaddb807SAdrian Chadd MODULE_DEPEND(bhnd_pcib, bhnd, 1, 1, 1);
95eaddb807SAdrian Chadd MODULE_DEPEND(bhnd_pcib, bhnd_pci, 1, 1, 1);
964ad7e9b0SAdrian Chadd MODULE_DEPEND(bhnd_pcib, pci, 1, 1, 1);
97