115e32d5dSMike Smith /*- 215e32d5dSMike Smith * Copyright (c) 2000 Michael Smith 315e32d5dSMike Smith * Copyright (c) 2000 BSDi 415e32d5dSMike Smith * All rights reserved. 515e32d5dSMike Smith * 615e32d5dSMike Smith * Redistribution and use in source and binary forms, with or without 715e32d5dSMike Smith * modification, are permitted provided that the following conditions 815e32d5dSMike Smith * are met: 915e32d5dSMike Smith * 1. Redistributions of source code must retain the above copyright 1015e32d5dSMike Smith * notice, this list of conditions and the following disclaimer. 1115e32d5dSMike Smith * 2. Redistributions in binary form must reproduce the above copyright 1215e32d5dSMike Smith * notice, this list of conditions and the following disclaimer in the 1315e32d5dSMike Smith * documentation and/or other materials provided with the distribution. 1415e32d5dSMike Smith * 1515e32d5dSMike Smith * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1615e32d5dSMike Smith * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1715e32d5dSMike Smith * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1815e32d5dSMike Smith * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1915e32d5dSMike Smith * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2015e32d5dSMike Smith * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2115e32d5dSMike Smith * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2215e32d5dSMike Smith * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2315e32d5dSMike Smith * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2415e32d5dSMike Smith * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2515e32d5dSMike Smith * SUCH DAMAGE. 2615e32d5dSMike Smith */ 27dad97feeSDavid E. O'Brien 28dad97feeSDavid E. O'Brien #include <sys/cdefs.h> 29dad97feeSDavid E. O'Brien __FBSDID("$FreeBSD$"); 30dad97feeSDavid E. O'Brien 3115e32d5dSMike Smith #include "opt_acpi.h" 3215e32d5dSMike Smith #include <sys/param.h> 3315e32d5dSMike Smith #include <sys/bus.h> 344fa387b6SMike Smith #include <sys/kernel.h> 35e3aa81b8SNate Lawson #include <sys/malloc.h> 36fe12f24bSPoul-Henning Kamp #include <sys/module.h> 37fd492ee0SWarner Losh #include <sys/sysctl.h> 3815e32d5dSMike Smith 392a191126SDavid E. O'Brien #include <contrib/dev/acpica/acpi.h> 4015e32d5dSMike Smith #include <dev/acpica/acpivar.h> 4115e32d5dSMike Smith 4215e32d5dSMike Smith #include <machine/pci_cfgreg.h> 43cace7a2aSWarner Losh #include <dev/pci/pcivar.h> 44cace7a2aSWarner Losh #include <dev/pci/pcib_private.h> 4515e32d5dSMike Smith #include "pcib_if.h" 4615e32d5dSMike Smith 472ccfc932SJohn Baldwin #include <dev/acpica/acpi_pcibvar.h> 482ccfc932SJohn Baldwin 49e3aa81b8SNate Lawson /* Hooks for the ACPI CA debugging infrastructure. */ 50e71b6381SMike Smith #define _COMPONENT ACPI_BUS 512ccfc932SJohn Baldwin ACPI_MODULE_NAME("PCI_ACPI") 520ae55423SMike Smith 532ccfc932SJohn Baldwin struct acpi_hpcib_softc { 5415e32d5dSMike Smith device_t ap_dev; 5515e32d5dSMike Smith ACPI_HANDLE ap_handle; 56d4b9ff91SNate Lawson int ap_flags; 5715e32d5dSMike Smith 5815e32d5dSMike Smith int ap_segment; /* analagous to Alpha 'hose' */ 5915e32d5dSMike Smith int ap_bus; /* bios-assigned bus number */ 604fa387b6SMike Smith 614fa387b6SMike Smith ACPI_BUFFER ap_prt; /* interrupt routing table */ 6215e32d5dSMike Smith }; 6315e32d5dSMike Smith 642ccfc932SJohn Baldwin static int acpi_pcib_acpi_probe(device_t bus); 652ccfc932SJohn Baldwin static int acpi_pcib_acpi_attach(device_t bus); 66ba835e3fSMitsuru IWASAKI static int acpi_pcib_acpi_resume(device_t bus); 67e3aa81b8SNate Lawson static int acpi_pcib_read_ivar(device_t dev, device_t child, 68e3aa81b8SNate Lawson int which, uintptr_t *result); 69e3aa81b8SNate Lawson static int acpi_pcib_write_ivar(device_t dev, device_t child, 70e3aa81b8SNate Lawson int which, uintptr_t value); 71e3aa81b8SNate Lawson static uint32_t acpi_pcib_read_config(device_t dev, int bus, int slot, 72e3aa81b8SNate Lawson int func, int reg, int bytes); 73e3aa81b8SNate Lawson static void acpi_pcib_write_config(device_t dev, int bus, int slot, 74e3aa81b8SNate Lawson int func, int reg, uint32_t data, int bytes); 752ccfc932SJohn Baldwin static int acpi_pcib_acpi_route_interrupt(device_t pcib, 762ccfc932SJohn Baldwin device_t dev, int pin); 778964299aSJohn Baldwin static int acpi_pcib_alloc_msi(device_t pcib, device_t dev, 788964299aSJohn Baldwin int count, int maxcount, int *irqs); 798964299aSJohn Baldwin static int acpi_pcib_alloc_msix(device_t pcib, device_t dev, 808964299aSJohn Baldwin int index, int *irq); 81cd8b53edSWarner Losh static struct resource *acpi_pcib_acpi_alloc_resource(device_t dev, 82cd8b53edSWarner Losh device_t child, int type, int *rid, 83cd8b53edSWarner Losh u_long start, u_long end, u_long count, 84cd8b53edSWarner Losh u_int flags); 8515e32d5dSMike Smith 862ccfc932SJohn Baldwin static device_method_t acpi_pcib_acpi_methods[] = { 8715e32d5dSMike Smith /* Device interface */ 882ccfc932SJohn Baldwin DEVMETHOD(device_probe, acpi_pcib_acpi_probe), 892ccfc932SJohn Baldwin DEVMETHOD(device_attach, acpi_pcib_acpi_attach), 9015e32d5dSMike Smith DEVMETHOD(device_shutdown, bus_generic_shutdown), 9115e32d5dSMike Smith DEVMETHOD(device_suspend, bus_generic_suspend), 92ba835e3fSMitsuru IWASAKI DEVMETHOD(device_resume, acpi_pcib_acpi_resume), 9315e32d5dSMike Smith 9415e32d5dSMike Smith /* Bus interface */ 9515e32d5dSMike Smith DEVMETHOD(bus_print_child, bus_generic_print_child), 9615e32d5dSMike Smith DEVMETHOD(bus_read_ivar, acpi_pcib_read_ivar), 9715e32d5dSMike Smith DEVMETHOD(bus_write_ivar, acpi_pcib_write_ivar), 98cd8b53edSWarner Losh DEVMETHOD(bus_alloc_resource, acpi_pcib_acpi_alloc_resource), 9915e32d5dSMike Smith DEVMETHOD(bus_release_resource, bus_generic_release_resource), 10015e32d5dSMike Smith DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), 10115e32d5dSMike Smith DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), 10215e32d5dSMike Smith DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), 10315e32d5dSMike Smith DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), 10415e32d5dSMike Smith 10515e32d5dSMike Smith /* pcib interface */ 1062ccfc932SJohn Baldwin DEVMETHOD(pcib_maxslots, pcib_maxslots), 10715e32d5dSMike Smith DEVMETHOD(pcib_read_config, acpi_pcib_read_config), 10815e32d5dSMike Smith DEVMETHOD(pcib_write_config, acpi_pcib_write_config), 1092ccfc932SJohn Baldwin DEVMETHOD(pcib_route_interrupt, acpi_pcib_acpi_route_interrupt), 1108964299aSJohn Baldwin DEVMETHOD(pcib_alloc_msi, acpi_pcib_alloc_msi), 1119bf4c9c1SJohn Baldwin DEVMETHOD(pcib_release_msi, pcib_release_msi), 1128964299aSJohn Baldwin DEVMETHOD(pcib_alloc_msix, acpi_pcib_alloc_msix), 1139bf4c9c1SJohn Baldwin DEVMETHOD(pcib_release_msix, pcib_release_msix), 11415e32d5dSMike Smith 11515e32d5dSMike Smith {0, 0} 11615e32d5dSMike Smith }; 11715e32d5dSMike Smith 11804dda605SJohn Baldwin static devclass_t pcib_devclass; 11915e32d5dSMike Smith 12004dda605SJohn Baldwin DEFINE_CLASS_0(pcib, acpi_pcib_acpi_driver, acpi_pcib_acpi_methods, 12104dda605SJohn Baldwin sizeof(struct acpi_hpcib_softc)); 1222ccfc932SJohn Baldwin DRIVER_MODULE(acpi_pcib, acpi, acpi_pcib_acpi_driver, pcib_devclass, 0, 0); 12364278df5SNate Lawson MODULE_DEPEND(acpi_pcib, acpi, 1, 1, 1); 12415e32d5dSMike Smith 12515e32d5dSMike Smith static int 1262ccfc932SJohn Baldwin acpi_pcib_acpi_probe(device_t dev) 12715e32d5dSMike Smith { 1285fcc8a58SNate Lawson static char *pcib_ids[] = { "PNP0A03", NULL }; 12915e32d5dSMike Smith 1305fcc8a58SNate Lawson if (acpi_disabled("pcib") || 1315fcc8a58SNate Lawson ACPI_ID_PROBE(device_get_parent(dev), dev, pcib_ids) == NULL) 1325fcc8a58SNate Lawson return (ENXIO); 13315e32d5dSMike Smith 134e3aa81b8SNate Lawson if (pci_cfgregopen() == 0) 1355e0ca577SMitsuru IWASAKI return (ENXIO); 1362ccfc932SJohn Baldwin device_set_desc(dev, "ACPI Host-PCI bridge"); 13715e32d5dSMike Smith return (0); 13815e32d5dSMike Smith } 13915e32d5dSMike Smith 14015e32d5dSMike Smith static int 1412ccfc932SJohn Baldwin acpi_pcib_acpi_attach(device_t dev) 14215e32d5dSMike Smith { 1432ccfc932SJohn Baldwin struct acpi_hpcib_softc *sc; 14415e32d5dSMike Smith ACPI_STATUS status; 1458b149b51SJohn Baldwin u_int addr, slot, func, busok; 1469debb532SJohn Baldwin uint8_t busno; 1470ae55423SMike Smith 148b4a05238SPeter Wemm ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); 14915e32d5dSMike Smith 15015e32d5dSMike Smith sc = device_get_softc(dev); 15115e32d5dSMike Smith sc->ap_dev = dev; 15215e32d5dSMike Smith sc->ap_handle = acpi_get_handle(dev); 15315e32d5dSMike Smith 15415e32d5dSMike Smith /* 1559debb532SJohn Baldwin * Get our base bus number by evaluating _BBN. 156c1b1f787SMike Smith * If this doesn't work, we assume we're bus number 0. 15715e32d5dSMike Smith * 15815e32d5dSMike Smith * XXX note that it may also not exist in the case where we are 15915e32d5dSMike Smith * meant to use a private configuration space mechanism for this bus, 16015e32d5dSMike Smith * so we should dig out our resources and check to see if we have 16115e32d5dSMike Smith * anything like that. How do we do this? 162042283a6SMike Smith * XXX If we have the requisite information, and if we don't think the 163042283a6SMike Smith * default PCI configuration space handlers can deal with this bus, 164042283a6SMike Smith * we should attach our own handler. 165042283a6SMike Smith * XXX invoke _REG on this for the PCI config space address space? 1669debb532SJohn Baldwin * XXX It seems many BIOS's with multiple Host-PCI bridges do not set 1679debb532SJohn Baldwin * _BBN correctly. They set _BBN to zero for all bridges. Thus, 1689debb532SJohn Baldwin * if _BBN is zero and pcib0 already exists, we try to read our 1699debb532SJohn Baldwin * bus number from the configuration registers at address _ADR. 17015e32d5dSMike Smith */ 171c310653eSNate Lawson status = acpi_GetInteger(sc->ap_handle, "_BBN", &sc->ap_bus); 1729debb532SJohn Baldwin if (ACPI_FAILURE(status)) { 17315e32d5dSMike Smith if (status != AE_NOT_FOUND) { 1749debb532SJohn Baldwin device_printf(dev, "could not evaluate _BBN - %s\n", 1759debb532SJohn Baldwin AcpiFormatException(status)); 176c1b1f787SMike Smith return_VALUE (ENXIO); 177c1b1f787SMike Smith } else { 178e3aa81b8SNate Lawson /* If it's not found, assume 0. */ 17915e32d5dSMike Smith sc->ap_bus = 0; 18015e32d5dSMike Smith } 1818745ec57SJohn Baldwin } 1829debb532SJohn Baldwin 1839debb532SJohn Baldwin /* 1849debb532SJohn Baldwin * If the bus is zero and pcib0 already exists, read the bus number 1859debb532SJohn Baldwin * via PCI config space. 1869debb532SJohn Baldwin */ 1879debb532SJohn Baldwin busok = 1; 1889debb532SJohn Baldwin if (sc->ap_bus == 0 && devclass_get_device(pcib_devclass, 0) != dev) { 1898745ec57SJohn Baldwin busok = 0; 190c310653eSNate Lawson status = acpi_GetInteger(sc->ap_handle, "_ADR", &addr); 1919debb532SJohn Baldwin if (ACPI_FAILURE(status)) { 1929debb532SJohn Baldwin if (status != AE_NOT_FOUND) { 1939debb532SJohn Baldwin device_printf(dev, "could not evaluate _ADR - %s\n", 1949debb532SJohn Baldwin AcpiFormatException(status)); 1959debb532SJohn Baldwin return_VALUE (ENXIO); 1968745ec57SJohn Baldwin } else 197e3aa81b8SNate Lawson device_printf(dev, "couldn't find _ADR\n"); 1989debb532SJohn Baldwin } else { 1999debb532SJohn Baldwin /* XXX: We assume bus 0. */ 200e0a93586SJohn Baldwin slot = ACPI_ADR_PCI_SLOT(addr); 201e0a93586SJohn Baldwin func = ACPI_ADR_PCI_FUNC(addr); 2029debb532SJohn Baldwin if (bootverbose) 2039debb532SJohn Baldwin device_printf(dev, "reading config registers from 0:%d:%d\n", 2049debb532SJohn Baldwin slot, func); 2058745ec57SJohn Baldwin if (host_pcib_get_busno(pci_cfgregread, 0, slot, func, &busno) == 0) 206e3aa81b8SNate Lawson device_printf(dev, "couldn't read bus number from cfg space\n"); 2078745ec57SJohn Baldwin else { 2089debb532SJohn Baldwin sc->ap_bus = busno; 2098745ec57SJohn Baldwin busok = 1; 2109debb532SJohn Baldwin } 2119debb532SJohn Baldwin } 2129debb532SJohn Baldwin } 2139debb532SJohn Baldwin 2149debb532SJohn Baldwin /* 2159debb532SJohn Baldwin * If nothing else worked, hope that ACPI at least lays out the 2169debb532SJohn Baldwin * host-PCI bridges in order and that as a result our unit number 2179debb532SJohn Baldwin * is actually our bus number. There are several reasons this 2189debb532SJohn Baldwin * might not be true. 2199debb532SJohn Baldwin */ 2209debb532SJohn Baldwin if (busok == 0) { 2219debb532SJohn Baldwin sc->ap_bus = device_get_unit(dev); 2229debb532SJohn Baldwin device_printf(dev, "trying bus number %d\n", sc->ap_bus); 223c1b1f787SMike Smith } 22415e32d5dSMike Smith 22515e32d5dSMike Smith /* 2262ccfc932SJohn Baldwin * Get our segment number by evaluating _SEG 2272ccfc932SJohn Baldwin * It's OK for this to not exist. 228042283a6SMike Smith */ 229e3aa81b8SNate Lawson status = acpi_GetInteger(sc->ap_handle, "_SEG", &sc->ap_segment); 230e3aa81b8SNate Lawson if (ACPI_FAILURE(status)) { 2312ccfc932SJohn Baldwin if (status != AE_NOT_FOUND) { 232e3aa81b8SNate Lawson device_printf(dev, "could not evaluate _SEG - %s\n", 233e3aa81b8SNate Lawson AcpiFormatException(status)); 2340ae55423SMike Smith return_VALUE (ENXIO); 23515e32d5dSMike Smith } 236e3aa81b8SNate Lawson /* If it's not found, assume 0. */ 2372ccfc932SJohn Baldwin sc->ap_segment = 0; 23815e32d5dSMike Smith } 23915e32d5dSMike Smith 2402ccfc932SJohn Baldwin return (acpi_pcib_attach(dev, &sc->ap_prt, sc->ap_bus)); 24115e32d5dSMike Smith } 24215e32d5dSMike Smith 243ba835e3fSMitsuru IWASAKI static int 244ba835e3fSMitsuru IWASAKI acpi_pcib_acpi_resume(device_t dev) 245ba835e3fSMitsuru IWASAKI { 246ba835e3fSMitsuru IWASAKI 247e4116e93SNate Lawson return (acpi_pcib_resume(dev)); 248ba835e3fSMitsuru IWASAKI } 249ba835e3fSMitsuru IWASAKI 2504fa387b6SMike Smith /* 2514fa387b6SMike Smith * Support for standard PCI bridge ivars. 2524fa387b6SMike Smith */ 25315e32d5dSMike Smith static int 25415e32d5dSMike Smith acpi_pcib_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) 25515e32d5dSMike Smith { 2562ccfc932SJohn Baldwin struct acpi_hpcib_softc *sc = device_get_softc(dev); 25715e32d5dSMike Smith 25815e32d5dSMike Smith switch (which) { 25915e32d5dSMike Smith case PCIB_IVAR_BUS: 26015e32d5dSMike Smith *result = sc->ap_bus; 26115e32d5dSMike Smith return (0); 2622ccfc932SJohn Baldwin case ACPI_IVAR_HANDLE: 2632ccfc932SJohn Baldwin *result = (uintptr_t)sc->ap_handle; 2642ccfc932SJohn Baldwin return (0); 265d4b9ff91SNate Lawson case ACPI_IVAR_FLAGS: 266d4b9ff91SNate Lawson *result = (uintptr_t)sc->ap_flags; 267d4b9ff91SNate Lawson return (0); 26815e32d5dSMike Smith } 26915e32d5dSMike Smith return (ENOENT); 27015e32d5dSMike Smith } 27115e32d5dSMike Smith 27215e32d5dSMike Smith static int 27315e32d5dSMike Smith acpi_pcib_write_ivar(device_t dev, device_t child, int which, uintptr_t value) 27415e32d5dSMike Smith { 2752ccfc932SJohn Baldwin struct acpi_hpcib_softc *sc = device_get_softc(dev); 27615e32d5dSMike Smith 27715e32d5dSMike Smith switch (which) { 27815e32d5dSMike Smith case PCIB_IVAR_BUS: 27915e32d5dSMike Smith sc->ap_bus = value; 28015e32d5dSMike Smith return (0); 281d4b9ff91SNate Lawson case ACPI_IVAR_HANDLE: 282d4b9ff91SNate Lawson sc->ap_handle = (ACPI_HANDLE)value; 283d4b9ff91SNate Lawson return (0); 284d4b9ff91SNate Lawson case ACPI_IVAR_FLAGS: 285d4b9ff91SNate Lawson sc->ap_flags = (int)value; 286d4b9ff91SNate Lawson return (0); 28715e32d5dSMike Smith } 28815e32d5dSMike Smith return (ENOENT); 28915e32d5dSMike Smith } 29015e32d5dSMike Smith 291e3aa81b8SNate Lawson static uint32_t 292e3aa81b8SNate Lawson acpi_pcib_read_config(device_t dev, int bus, int slot, int func, int reg, 293e3aa81b8SNate Lawson int bytes) 29415e32d5dSMike Smith { 29515e32d5dSMike Smith return (pci_cfgregread(bus, slot, func, reg, bytes)); 29615e32d5dSMike Smith } 29715e32d5dSMike Smith 29815e32d5dSMike Smith static void 299e3aa81b8SNate Lawson acpi_pcib_write_config(device_t dev, int bus, int slot, int func, int reg, 300e3aa81b8SNate Lawson uint32_t data, int bytes) 30115e32d5dSMike Smith { 30215e32d5dSMike Smith pci_cfgregwrite(bus, slot, func, reg, data, bytes); 30315e32d5dSMike Smith } 30415e32d5dSMike Smith 30515e32d5dSMike Smith static int 3062ccfc932SJohn Baldwin acpi_pcib_acpi_route_interrupt(device_t pcib, device_t dev, int pin) 30715e32d5dSMike Smith { 3085e1ba6d4SJohn Baldwin struct acpi_hpcib_softc *sc = device_get_softc(pcib); 3094fa387b6SMike Smith 3105e1ba6d4SJohn Baldwin return (acpi_pcib_route_interrupt(pcib, dev, pin, &sc->ap_prt)); 31115e32d5dSMike Smith } 312cd8b53edSWarner Losh 3138964299aSJohn Baldwin static int 3148964299aSJohn Baldwin acpi_pcib_alloc_msi(device_t pcib, device_t dev, int count, int maxcount, 3158964299aSJohn Baldwin int *irqs) 3168964299aSJohn Baldwin { 3178964299aSJohn Baldwin device_t bus; 3188964299aSJohn Baldwin 3198964299aSJohn Baldwin bus = device_get_parent(pcib); 3208964299aSJohn Baldwin return (PCIB_ALLOC_MSI(device_get_parent(bus), dev, count, maxcount, 3218964299aSJohn Baldwin irqs)); 3228964299aSJohn Baldwin } 3238964299aSJohn Baldwin 3248964299aSJohn Baldwin static int 3258964299aSJohn Baldwin acpi_pcib_alloc_msix(device_t pcib, device_t dev, int index, int *irq) 3268964299aSJohn Baldwin { 3278964299aSJohn Baldwin device_t bus; 3288964299aSJohn Baldwin 3298964299aSJohn Baldwin bus = device_get_parent(pcib); 3308964299aSJohn Baldwin return (PCIB_ALLOC_MSIX(device_get_parent(bus), dev, index, irq)); 3318964299aSJohn Baldwin } 3328964299aSJohn Baldwin 3335b8c4719SNate Lawson static u_long acpi_host_mem_start = 0x80000000; 334b0e1e474SDag-Erling Smørgrav TUNABLE_ULONG("hw.acpi.host_mem_start", &acpi_host_mem_start); 335fd492ee0SWarner Losh 336cd8b53edSWarner Losh struct resource * 337cd8b53edSWarner Losh acpi_pcib_acpi_alloc_resource(device_t dev, device_t child, int type, int *rid, 338cd8b53edSWarner Losh u_long start, u_long end, u_long count, u_int flags) 339cd8b53edSWarner Losh { 340cd8b53edSWarner Losh /* 3415cee9db3SWarner Losh * If no memory preference is given, use upper 32MB slot most 342cd8b53edSWarner Losh * bioses use for their memory window. Typically other bridges 343cd8b53edSWarner Losh * before us get in the way to assert their preferences on memory. 344cd8b53edSWarner Losh * Hardcoding like this sucks, so a more MD/MI way needs to be 345dfbaec0aSWarner Losh * found to do it. This is typically only used on older laptops 3465cee9db3SWarner Losh * that don't have pci busses behind pci bridge, so assuming > 32MB 347dfbaec0aSWarner Losh * is liekly OK. 348cd8b53edSWarner Losh */ 349cd8b53edSWarner Losh if (type == SYS_RES_MEMORY && start == 0UL && end == ~0UL) 350fd492ee0SWarner Losh start = acpi_host_mem_start; 351dca20690SWarner Losh if (type == SYS_RES_IOPORT && start == 0UL && end == ~0UL) 352dca20690SWarner Losh start = 0x1000; 353cd8b53edSWarner Losh return (bus_generic_alloc_resource(dev, child, type, rid, start, end, 354cd8b53edSWarner Losh count, flags)); 355cd8b53edSWarner Losh } 356