acpi_pcib_pci.c (129093) | acpi_pcib_pci.c (129829) |
---|---|
1/*- 2 * Copyright (c) 2000 Michael Smith 3 * Copyright (c) 2000 BSDi 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2000 Michael Smith 3 * Copyright (c) 2000 BSDi 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: head/sys/dev/acpica/acpi_pcib_pci.c 129093 2004-05-10 18:26:22Z jhb $"); | 29__FBSDID("$FreeBSD: head/sys/dev/acpica/acpi_pcib_pci.c 129829 2004-05-29 04:32:50Z njl $"); |
30 31#include "opt_acpi.h" 32 33#include <sys/param.h> 34#include <sys/bus.h> | 30 31#include "opt_acpi.h" 32 33#include <sys/param.h> 34#include <sys/bus.h> |
35#include <sys/malloc.h> | |
36#include <sys/kernel.h> | 35#include <sys/kernel.h> |
36#include <sys/malloc.h> |
|
37 38#include "acpi.h" | 37 38#include "acpi.h" |
39 | |
40#include <dev/acpica/acpivar.h> 41#include <dev/acpica/acpi_pcibvar.h> 42 43#include <machine/pci_cfgreg.h> 44#include <dev/pci/pcivar.h> 45#include <dev/pci/pcireg.h> 46#include <dev/pci/pcib_private.h> | 39#include <dev/acpica/acpivar.h> 40#include <dev/acpica/acpi_pcibvar.h> 41 42#include <machine/pci_cfgreg.h> 43#include <dev/pci/pcivar.h> 44#include <dev/pci/pcireg.h> 45#include <dev/pci/pcib_private.h> |
47 | |
48#include "pcib_if.h" 49 | 46#include "pcib_if.h" 47 |
50/* 51 * Hooks for the ACPI CA debugging infrastructure 52 */ | 48/* Hooks for the ACPI CA debugging infrastructure. */ |
53#define _COMPONENT ACPI_BUS 54ACPI_MODULE_NAME("PCI_PCI") 55 56struct acpi_pcib_softc { 57 struct pcib_softc ap_pcibsc; 58 ACPI_HANDLE ap_handle; 59 ACPI_BUFFER ap_prt; /* interrupt routing table */ 60}; 61 62struct acpi_pcib_lookup_info { | 49#define _COMPONENT ACPI_BUS 50ACPI_MODULE_NAME("PCI_PCI") 51 52struct acpi_pcib_softc { 53 struct pcib_softc ap_pcibsc; 54 ACPI_HANDLE ap_handle; 55 ACPI_BUFFER ap_prt; /* interrupt routing table */ 56}; 57 58struct acpi_pcib_lookup_info { |
63 UINT32 address; 64 ACPI_HANDLE handle; | 59 UINT32 address; 60 ACPI_HANDLE handle; |
65}; 66 67static int acpi_pcib_pci_probe(device_t bus); 68static int acpi_pcib_pci_attach(device_t bus); 69static int acpi_pcib_pci_resume(device_t bus); | 61}; 62 63static int acpi_pcib_pci_probe(device_t bus); 64static int acpi_pcib_pci_attach(device_t bus); 65static int acpi_pcib_pci_resume(device_t bus); |
70static int acpi_pcib_read_ivar(device_t dev, device_t child, int which, uintptr_t *result); | 66static int acpi_pcib_read_ivar(device_t dev, device_t child, 67 int which, uintptr_t *result); |
71static int acpi_pcib_pci_route_interrupt(device_t pcib, | 68static int acpi_pcib_pci_route_interrupt(device_t pcib, |
72 device_t dev, int pin); | 69 device_t dev, int pin); |
73 74static device_method_t acpi_pcib_pci_methods[] = { 75 /* Device interface */ 76 DEVMETHOD(device_probe, acpi_pcib_pci_probe), 77 DEVMETHOD(device_attach, acpi_pcib_pci_attach), 78 DEVMETHOD(device_shutdown, bus_generic_shutdown), 79 DEVMETHOD(device_suspend, bus_generic_suspend), 80 DEVMETHOD(device_resume, acpi_pcib_pci_resume), --- 26 unchanged lines hidden (view full) --- 107 108DRIVER_MODULE(acpi_pcib, pci, acpi_pcib_pci_driver, pcib_devclass, 0, 0); 109MODULE_DEPEND(acpi_pcib, acpi, 1, 1, 1); 110 111static int 112acpi_pcib_pci_probe(device_t dev) 113{ 114 | 70 71static device_method_t acpi_pcib_pci_methods[] = { 72 /* Device interface */ 73 DEVMETHOD(device_probe, acpi_pcib_pci_probe), 74 DEVMETHOD(device_attach, acpi_pcib_pci_attach), 75 DEVMETHOD(device_shutdown, bus_generic_shutdown), 76 DEVMETHOD(device_suspend, bus_generic_suspend), 77 DEVMETHOD(device_resume, acpi_pcib_pci_resume), --- 26 unchanged lines hidden (view full) --- 104 105DRIVER_MODULE(acpi_pcib, pci, acpi_pcib_pci_driver, pcib_devclass, 0, 0); 106MODULE_DEPEND(acpi_pcib, acpi, 1, 1, 1); 107 108static int 109acpi_pcib_pci_probe(device_t dev) 110{ 111 |
115 if ((pci_get_class(dev) != PCIC_BRIDGE) || 116 (pci_get_subclass(dev) != PCIS_BRIDGE_PCI) || | 112 if (pci_get_class(dev) != PCIC_BRIDGE || 113 pci_get_subclass(dev) != PCIS_BRIDGE_PCI || |
117 acpi_disabled("pci")) 118 return (ENXIO); 119 if (acpi_get_handle(dev) == NULL) 120 return (ENXIO); | 114 acpi_disabled("pci")) 115 return (ENXIO); 116 if (acpi_get_handle(dev) == NULL) 117 return (ENXIO); |
121 if (!pci_cfgregopen()) | 118 if (pci_cfgregopen() == 0) |
122 return (ENXIO); 123 124 device_set_desc(dev, "ACPI PCI-PCI bridge"); 125 return (-1000); 126} 127 128static int 129acpi_pcib_pci_attach(device_t dev) --- 14 unchanged lines hidden (view full) --- 144 struct acpi_pcib_softc *sc = device_get_softc(dev); 145 146 return (acpi_pcib_resume(dev, &sc->ap_prt, sc->ap_pcibsc.secbus)); 147} 148 149static int 150acpi_pcib_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) 151{ | 119 return (ENXIO); 120 121 device_set_desc(dev, "ACPI PCI-PCI bridge"); 122 return (-1000); 123} 124 125static int 126acpi_pcib_pci_attach(device_t dev) --- 14 unchanged lines hidden (view full) --- 141 struct acpi_pcib_softc *sc = device_get_softc(dev); 142 143 return (acpi_pcib_resume(dev, &sc->ap_prt, sc->ap_pcibsc.secbus)); 144} 145 146static int 147acpi_pcib_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) 148{ |
152 struct acpi_pcib_softc *sc = device_get_softc(dev); | 149 struct acpi_pcib_softc *sc = device_get_softc(dev); |
153 154 switch (which) { | 150 151 switch (which) { |
155 case ACPI_IVAR_HANDLE: | 152 case ACPI_IVAR_HANDLE: |
156 *result = (uintptr_t)sc->ap_handle; | 153 *result = (uintptr_t)sc->ap_handle; |
157 return(0); | 154 return (0); |
158 } | 155 } |
159 return(pcib_read_ivar(dev, child, which, result)); | 156 return (pcib_read_ivar(dev, child, which, result)); |
160} 161 162static int 163acpi_pcib_pci_route_interrupt(device_t pcib, device_t dev, int pin) 164{ 165 struct acpi_pcib_softc *sc; 166 167 sc = device_get_softc(pcib); 168 169 /* 170 * If we don't have a _PRT, fall back to the swizzle method 171 * for routing interrupts. 172 */ 173 if (sc->ap_prt.Pointer == NULL) | 157} 158 159static int 160acpi_pcib_pci_route_interrupt(device_t pcib, device_t dev, int pin) 161{ 162 struct acpi_pcib_softc *sc; 163 164 sc = device_get_softc(pcib); 165 166 /* 167 * If we don't have a _PRT, fall back to the swizzle method 168 * for routing interrupts. 169 */ 170 if (sc->ap_prt.Pointer == NULL) |
174 return (pcib_route_interrupt(pcib, dev, pin)); | 171 return (pcib_route_interrupt(pcib, dev, pin)); |
175 else | 172 else |
176 return (acpi_pcib_route_interrupt(pcib, dev, pin, &sc->ap_prt)); | 173 return (acpi_pcib_route_interrupt(pcib, dev, pin, &sc->ap_prt)); |
177} | 174} |