1296077Sadrian/*-
2296077Sadrian * Copyright (c) 2015 Landon Fuller <landon@landonf.org>
3296077Sadrian * All rights reserved.
4296077Sadrian *
5296077Sadrian * Redistribution and use in source and binary forms, with or without
6296077Sadrian * modification, are permitted provided that the following conditions
7296077Sadrian * are met:
8296077Sadrian * 1. Redistributions of source code must retain the above copyright
9296077Sadrian *    notice, this list of conditions and the following disclaimer,
10296077Sadrian *    without modification.
11296077Sadrian * 2. Redistributions in binary form must reproduce at minimum a disclaimer
12296077Sadrian *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
13296077Sadrian *    redistribution must be conditioned upon including a substantially
14296077Sadrian *    similar Disclaimer requirement for further binary redistribution.
15296077Sadrian *
16296077Sadrian * NO WARRANTY
17296077Sadrian * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18296077Sadrian * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19296077Sadrian * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
20296077Sadrian * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
21296077Sadrian * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
22296077Sadrian * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23296077Sadrian * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24296077Sadrian * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25296077Sadrian * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26296077Sadrian * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27296077Sadrian * THE POSSIBILITY OF SUCH DAMAGES.
28296077Sadrian */
29296077Sadrian
30296077Sadrian#include <sys/cdefs.h>
31296077Sadrian__FBSDID("$FreeBSD: releng/11.0/sys/dev/bhnd/cores/pci/bhnd_pcib.c 300015 2016-05-17 06:52:53Z adrian $");
32296077Sadrian
33296077Sadrian/*
34298479Sadrian * Broadcom PCI/PCIe-Gen1 Host-PCI bridge.
35296077Sadrian *
36298479Sadrian * This driver handles all interactions with PCI bridge cores operating in
37298479Sadrian * root complex mode.
38296077Sadrian */
39296077Sadrian
40296077Sadrian#include <sys/param.h>
41296077Sadrian#include <sys/kernel.h>
42296077Sadrian#include <sys/bus.h>
43296077Sadrian#include <sys/module.h>
44296077Sadrian
45296077Sadrian#include <machine/bus.h>
46296077Sadrian#include <sys/rman.h>
47296077Sadrian#include <machine/resource.h>
48296077Sadrian
49296077Sadrian#include <dev/bhnd/bhnd.h>
50296077Sadrian
51296077Sadrian#include "bhnd_pcireg.h"
52296077Sadrian#include "bhnd_pcibvar.h"
53296077Sadrian
54296077Sadrianstatic int
55296077Sadrianbhnd_pcib_attach(device_t dev)
56296077Sadrian{
57298479Sadrian	// TODO
58298479Sadrian	return (bhnd_pci_generic_attach(dev));
59296077Sadrian}
60296077Sadrian
61296077Sadrianstatic int
62296077Sadrianbhnd_pcib_detach(device_t dev)
63296077Sadrian{
64298479Sadrian	// TODO
65298479Sadrian	return (bhnd_pci_generic_detach(dev));
66296077Sadrian}
67296077Sadrian
68296077Sadrianstatic int
69296077Sadrianbhnd_pcib_suspend(device_t dev)
70296077Sadrian{
71298479Sadrian	return (bhnd_pci_generic_suspend(dev));
72296077Sadrian}
73296077Sadrian
74296077Sadrianstatic int
75296077Sadrianbhnd_pcib_resume(device_t dev)
76296077Sadrian{
77298479Sadrian	return (bhnd_pci_generic_resume(dev));
78296077Sadrian}
79296077Sadrian
80296077Sadrianstatic device_method_t bhnd_pcib_methods[] = {
81296077Sadrian	/* Device interface */
82296077Sadrian	DEVMETHOD(device_attach,	bhnd_pcib_attach),
83296077Sadrian	DEVMETHOD(device_detach,	bhnd_pcib_detach),
84296077Sadrian	DEVMETHOD(device_suspend,	bhnd_pcib_suspend),
85296077Sadrian	DEVMETHOD(device_resume,	bhnd_pcib_resume),
86296077Sadrian	DEVMETHOD_END
87296077Sadrian};
88296077Sadrian
89300015SadrianDEFINE_CLASS_1(pcib, bhnd_pcib_driver, bhnd_pcib_methods, sizeof(struct bhnd_pcib_softc), bhnd_pci_driver);
90296077Sadrian
91300015Sadrianstatic devclass_t pcib_devclass;
92300015SadrianDRIVER_MODULE(bhnd_pcib, bhnd, bhnd_pcib_driver, pcib_devclass, 0, 0);
93300015Sadrian
94296077SadrianMODULE_VERSION(bhnd_pcib, 1);
95298947SadrianMODULE_DEPEND(bhnd_pcib, bhnd, 1, 1, 1);
96298947SadrianMODULE_DEPEND(bhnd_pcib, bhnd_pci, 1, 1, 1);
97296077SadrianMODULE_DEPEND(bhnd_pcib, pci, 1, 1, 1);
98