diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2018-07-04 20:46:23 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2018-07-04 20:46:23 +0000 |
commit | 5122a3c63dc86357891a0e94d2a3f20ae1098312 (patch) | |
tree | 450e14d17a4f288ad09664503fd9cf7e8141b621 /sys/arch | |
parent | 11362c6c7cabcf7e045553f2434744084bf45d08 (diff) |
Properly pass around the PCI "chipset tag" in acpi(4) and refactor
acpimcfg(4) to call an MD initialization functions that sets up a tag for
PCI ECAM.
ok guenther@, mlarkin@, krw@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/amd64/amd64/acpi_machdep.c | 3 | ||||
-rw-r--r-- | sys/arch/amd64/include/pci_machdep.h | 7 | ||||
-rw-r--r-- | sys/arch/amd64/pci/pci_machdep.c | 16 | ||||
-rw-r--r-- | sys/arch/i386/i386/acpi_machdep.c | 3 | ||||
-rw-r--r-- | sys/arch/i386/pci/pci_machdep.c | 13 | ||||
-rw-r--r-- | sys/arch/i386/pci/pci_machdep.h | 7 |
6 files changed, 35 insertions, 14 deletions
diff --git a/sys/arch/amd64/amd64/acpi_machdep.c b/sys/arch/amd64/amd64/acpi_machdep.c index 483a6fb10f9..9c820b718df 100644 --- a/sys/arch/amd64/amd64/acpi_machdep.c +++ b/sys/arch/amd64/amd64/acpi_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi_machdep.c,v 1.83 2018/07/01 15:52:12 kettenis Exp $ */ +/* $OpenBSD: acpi_machdep.c,v 1.84 2018/07/04 20:46:21 kettenis Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * @@ -97,6 +97,7 @@ acpi_attach(struct device *parent, struct device *self, void *aux) sc->sc_iot = ba->ba_iot; sc->sc_memt = ba->ba_memt; sc->sc_dmat = &pci_bus_dma_tag; + sc->sc_pc = NULL; /* Legacy 0xcf8/0xcfc access mechanism */ acpi_attach_common(sc, ba->ba_acpipbase); } diff --git a/sys/arch/amd64/include/pci_machdep.h b/sys/arch/amd64/include/pci_machdep.h index 27b833b52cc..a919dfd77e2 100644 --- a/sys/arch/amd64/include/pci_machdep.h +++ b/sys/arch/amd64/include/pci_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.h,v 1.25 2016/05/04 14:30:00 kettenis Exp $ */ +/* $OpenBSD: pci_machdep.h,v 1.26 2018/07/04 20:46:22 kettenis Exp $ */ /* $NetBSD: pci_machdep.h,v 1.1 2003/02/26 21:26:11 fvdl Exp $ */ /* @@ -59,9 +59,6 @@ typedef struct { * amd64-specific PCI variables and functions. * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE. */ -extern bus_addr_t pci_mcfg_addr; -extern int pci_mcfg_min_bus, pci_mcfg_max_bus; - struct pci_attach_args; extern struct extent *pciio_ex; @@ -98,6 +95,8 @@ void pci_dev_postattach(struct device *, struct pci_attach_args *); pcireg_t pci_min_powerstate(pci_chipset_tag_t, pcitag_t); void pci_set_powerstate_md(pci_chipset_tag_t, pcitag_t, int, int); +pci_chipset_tag_t pci_mcfg_init(bus_space_tag_t, bus_addr_t, int, int); + /* * ALL OF THE FOLLOWING ARE MACHINE-DEPENDENT, AND SHOULD NOT BE USED * BY PORTABLE CODE. diff --git a/sys/arch/amd64/pci/pci_machdep.c b/sys/arch/amd64/pci/pci_machdep.c index 2ea97e1ab36..5e05c750a0c 100644 --- a/sys/arch/amd64/pci/pci_machdep.c +++ b/sys/arch/amd64/pci/pci_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.c,v 1.67 2017/10/14 04:44:43 jsg Exp $ */ +/* $OpenBSD: pci_machdep.c,v 1.68 2018/07/04 20:46:22 kettenis Exp $ */ /* $NetBSD: pci_machdep.c,v 1.3 2003/05/07 21:33:58 fvdl Exp $ */ /*- @@ -99,9 +99,8 @@ */ bus_addr_t pci_mcfg_addr; int pci_mcfg_min_bus, pci_mcfg_max_bus; -bus_space_tag_t pci_mcfgt = X86_BUS_SPACE_MEM; +bus_space_tag_t pci_mcfgt; bus_space_handle_t pci_mcfgh[256]; -void pci_mcfg_map_bus(int); struct mutex pci_conf_lock = MUTEX_INITIALIZER(IPL_HIGH); @@ -141,6 +140,17 @@ struct bus_dma_tag pci_bus_dma_tag = { _bus_dmamem_mmap, }; +pci_chipset_tag_t +pci_mcfg_init(bus_space_tag_t iot, bus_addr_t addr, int min_bus, int max_bus) +{ + pci_mcfgt = iot; + pci_mcfg_addr = addr; + pci_mcfg_min_bus = min_bus; + pci_mcfg_max_bus = max_bus; + + return NULL; +} + void pci_attach_hook(struct device *parent, struct device *self, struct pcibus_attach_args *pba) diff --git a/sys/arch/i386/i386/acpi_machdep.c b/sys/arch/i386/i386/acpi_machdep.c index 3f2420cb51e..51c67d9267b 100644 --- a/sys/arch/i386/i386/acpi_machdep.c +++ b/sys/arch/i386/i386/acpi_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi_machdep.c,v 1.67 2018/07/01 15:52:12 kettenis Exp $ */ +/* $OpenBSD: acpi_machdep.c,v 1.68 2018/07/04 20:46:22 kettenis Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * @@ -107,6 +107,7 @@ acpi_attach(struct device *parent, struct device *self, void *aux) sc->sc_iot = ba->ba_iot; sc->sc_memt = ba->ba_memt; sc->sc_dmat = &pci_bus_dma_tag; + sc->sc_pc = NULL; /* Legacy 0xcf8/0xcfc access mechanism */ acpi_attach_common(sc, ba->ba_acpipbase); } diff --git a/sys/arch/i386/pci/pci_machdep.c b/sys/arch/i386/pci/pci_machdep.c index 231e6a984b9..5973a6100cc 100644 --- a/sys/arch/i386/pci/pci_machdep.c +++ b/sys/arch/i386/pci/pci_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.c,v 1.82 2017/09/08 05:36:51 deraadt Exp $ */ +/* $OpenBSD: pci_machdep.c,v 1.83 2018/07/04 20:46:22 kettenis Exp $ */ /* $NetBSD: pci_machdep.c,v 1.28 1997/06/06 23:29:17 thorpej Exp $ */ /*- @@ -191,6 +191,17 @@ struct bus_dma_tag pci_bus_dma_tag = { _bus_dmamem_mmap, }; +pci_chipset_tag_t +pci_mcfg_init(bus_space_tag_t iot, bus_addr_t addr, int min_bus, int max_bus) +{ + pci_mcfgt = iot; + pci_mcfg_addr = addr; + pci_mcfg_min_bus = min_bus; + pci_mcfg_max_bus = max_bus; + + return NULL; +} + void pci_attach_hook(struct device *parent, struct device *self, struct pcibus_attach_args *pba) diff --git a/sys/arch/i386/pci/pci_machdep.h b/sys/arch/i386/pci/pci_machdep.h index 283147033ca..682909eac28 100644 --- a/sys/arch/i386/pci/pci_machdep.h +++ b/sys/arch/i386/pci/pci_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.h,v 1.28 2016/05/04 14:30:00 kettenis Exp $ */ +/* $OpenBSD: pci_machdep.h,v 1.29 2018/07/04 20:46:22 kettenis Exp $ */ /* $NetBSD: pci_machdep.h,v 1.7 1997/06/06 23:29:18 thorpej Exp $ */ /* @@ -75,9 +75,6 @@ struct { * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE. */ extern int pci_mode; -extern bus_addr_t pci_mcfg_addr; -extern int pci_mcfg_min_bus, pci_mcfg_max_bus; - int pci_mode_detect(void); extern struct extent *pciio_ex; @@ -114,6 +111,8 @@ void pci_dev_postattach(struct device *, struct pci_attach_args *); pcireg_t pci_min_powerstate(pci_chipset_tag_t, pcitag_t); void pci_set_powerstate_md(pci_chipset_tag_t, pcitag_t, int, int); +pci_chipset_tag_t pci_mcfg_init(bus_space_tag_t, bus_addr_t, int, int); + /* * Section 6.2.4, `Miscellaneous Functions' of the PIC Specification, * says that 255 means `unknown' or `no connection' to the interrupt |