Deleted Added
full compact
acpi_pci.c (246128) acpi_pci.c (257251)
1/*-
2 * Copyright (c) 1997, Stefan Esser <se@freebsd.org>
3 * Copyright (c) 2000, Michael Smith <msmith@freebsd.org>
4 * Copyright (c) 2000, BSDi
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 13 unchanged lines hidden (view full) ---

22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1997, Stefan Esser <se@freebsd.org>
3 * Copyright (c) 2000, Michael Smith <msmith@freebsd.org>
4 * Copyright (c) 2000, BSDi
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 13 unchanged lines hidden (view full) ---

22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: head/sys/dev/acpica/acpi_pci.c 246128 2013-01-30 18:01:20Z sbz $");
30__FBSDID("$FreeBSD: head/sys/dev/acpica/acpi_pci.c 257251 2013-10-28 13:33:29Z kib $");
31
31
32#include "opt_acpi.h"
33
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/bus.h>
35#include <sys/kernel.h>
36#include <sys/malloc.h>
37#include <sys/module.h>
38
39#include <contrib/dev/acpica/include/acpi.h>

--- 35 unchanged lines hidden (view full) ---

75 uintptr_t *result);
76static int acpi_pci_write_ivar(device_t dev, device_t child, int which,
77 uintptr_t value);
78static ACPI_STATUS acpi_pci_save_handle(ACPI_HANDLE handle, UINT32 level,
79 void *context, void **status);
80static int acpi_pci_set_powerstate_method(device_t dev, device_t child,
81 int state);
82static void acpi_pci_update_device(ACPI_HANDLE handle, device_t pci_child);
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/bus.h>
37#include <sys/kernel.h>
38#include <sys/malloc.h>
39#include <sys/module.h>
40
41#include <contrib/dev/acpica/include/acpi.h>

--- 35 unchanged lines hidden (view full) ---

77 uintptr_t *result);
78static int acpi_pci_write_ivar(device_t dev, device_t child, int which,
79 uintptr_t value);
80static ACPI_STATUS acpi_pci_save_handle(ACPI_HANDLE handle, UINT32 level,
81 void *context, void **status);
82static int acpi_pci_set_powerstate_method(device_t dev, device_t child,
83 int state);
84static void acpi_pci_update_device(ACPI_HANDLE handle, device_t pci_child);
85static bus_dma_tag_t acpi_pci_get_dma_tag(device_t bus, device_t child);
83
84static device_method_t acpi_pci_methods[] = {
85 /* Device interface */
86 DEVMETHOD(device_probe, acpi_pci_probe),
87 DEVMETHOD(device_attach, acpi_pci_attach),
88
89 /* Bus interface */
90 DEVMETHOD(bus_read_ivar, acpi_pci_read_ivar),
91 DEVMETHOD(bus_write_ivar, acpi_pci_write_ivar),
92 DEVMETHOD(bus_child_location_str, acpi_pci_child_location_str_method),
86
87static device_method_t acpi_pci_methods[] = {
88 /* Device interface */
89 DEVMETHOD(device_probe, acpi_pci_probe),
90 DEVMETHOD(device_attach, acpi_pci_attach),
91
92 /* Bus interface */
93 DEVMETHOD(bus_read_ivar, acpi_pci_read_ivar),
94 DEVMETHOD(bus_write_ivar, acpi_pci_write_ivar),
95 DEVMETHOD(bus_child_location_str, acpi_pci_child_location_str_method),
96 DEVMETHOD(bus_get_dma_tag, acpi_pci_get_dma_tag),
93
94 /* PCI interface */
95 DEVMETHOD(pci_set_powerstate, acpi_pci_set_powerstate_method),
96
97 DEVMETHOD_END
98};
99
100static devclass_t pci_devclass;

--- 202 unchanged lines hidden (view full) ---

303 * these devices.
304 */
305 pci_add_children(dev, domain, busno, sizeof(struct acpi_pci_devinfo));
306 AcpiWalkNamespace(ACPI_TYPE_DEVICE, acpi_get_handle(dev), 1,
307 acpi_pci_save_handle, NULL, dev, NULL);
308
309 return (bus_generic_attach(dev));
310}
97
98 /* PCI interface */
99 DEVMETHOD(pci_set_powerstate, acpi_pci_set_powerstate_method),
100
101 DEVMETHOD_END
102};
103
104static devclass_t pci_devclass;

--- 202 unchanged lines hidden (view full) ---

307 * these devices.
308 */
309 pci_add_children(dev, domain, busno, sizeof(struct acpi_pci_devinfo));
310 AcpiWalkNamespace(ACPI_TYPE_DEVICE, acpi_get_handle(dev), 1,
311 acpi_pci_save_handle, NULL, dev, NULL);
312
313 return (bus_generic_attach(dev));
314}
315
316#ifdef ACPI_DMAR
317bus_dma_tag_t dmar_get_dma_tag(device_t dev, device_t child);
318static bus_dma_tag_t
319acpi_pci_get_dma_tag(device_t bus, device_t child)
320{
321 bus_dma_tag_t tag;
322
323 if (device_get_parent(child) == bus) {
324 /* try dmar and return if it works */
325 tag = dmar_get_dma_tag(bus, child);
326 } else
327 tag = NULL;
328 if (tag == NULL)
329 tag = pci_get_dma_tag(bus, child);
330 return (tag);
331}
332#else
333static bus_dma_tag_t
334acpi_pci_get_dma_tag(device_t bus, device_t child)
335{
336
337 return (pci_get_dma_tag(bus, child));
338}
339#endif