Index: amd64/pci/pci_bus.c =================================================================== RCS file: /usr/cvs/src/sys/amd64/pci/pci_bus.c,v retrieving revision 1.114 diff -u -r1.114 pci_bus.c --- amd64/pci/pci_bus.c 18 Sep 2005 01:42:43 -0000 1.114 +++ amd64/pci/pci_bus.c 14 Dec 2005 22:10:25 -0000 @@ -336,64 +336,6 @@ /* - * Provide a device to "eat" the host->pci bridges that we dug up above - * and stop them showing up twice on the probes. This also stops them - * showing up as 'none' in pciconf -l. - */ -static int -pci_hostb_probe(device_t dev) -{ - u_int32_t id; - - id = pci_get_devid(dev); - - switch (id) { - - /* VIA VT82C596 Power Managment Function */ - case 0x30501106: - return ENXIO; - - default: - break; - } - - if (pci_get_class(dev) == PCIC_BRIDGE && - pci_get_subclass(dev) == PCIS_BRIDGE_HOST) { - device_set_desc(dev, "Host to PCI bridge"); - device_quiet(dev); - return -10000; - } - return ENXIO; -} - -static int -pci_hostb_attach(device_t dev) -{ - - return 0; -} - -static device_method_t pci_hostb_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, pci_hostb_probe), - DEVMETHOD(device_attach, pci_hostb_attach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), - - { 0, 0 } -}; -static driver_t pci_hostb_driver = { - "hostb", - pci_hostb_methods, - 1, -}; -static devclass_t pci_hostb_devclass; - -DRIVER_MODULE(hostb, pci, pci_hostb_driver, pci_hostb_devclass, 0, 0); - - -/* * Install placeholder to claim the resources owned by the * PCI bus interface. This could be used to extract the * config space registers in the extreme case where the PnP Index: conf/files =================================================================== RCS file: /usr/cvs/src/sys/conf/files,v retrieving revision 1.1076 diff -u -r1.1076 files --- conf/files 12 Dec 2005 01:14:59 -0000 1.1076 +++ conf/files 14 Dec 2005 22:10:25 -0000 @@ -751,6 +751,7 @@ dev/pcf/pcf.c optional pcf dev/pci/eisa_pci.c optional pci eisa dev/pci/fixup_pci.c optional pci +dev/pci/hostb_pci.c optional pci dev/pci/ignore_pci.c optional pci dev/pci/isa_pci.c optional pci isa dev/pci/pci.c optional pci @@ -758,6 +759,7 @@ dev/pci/pci_pci.c optional pci dev/pci/pci_user.c optional pci dev/pci/pcib_if.m standard +dev/pci/vga_pci.c optional pci dev/pdq/if_fea.c optional fea eisa dev/pdq/if_fpa.c optional fpa pci dev/pdq/pdq.c optional nowerror fea eisa | fpa pci Index: dev/acpica/acpi_pci.c =================================================================== RCS file: /usr/cvs/src/sys/dev/acpica/acpi_pci.c,v retrieving revision 1.27 diff -u -r1.27 acpi_pci.c --- dev/acpica/acpi_pci.c 11 Sep 2005 18:39:01 -0000 1.27 +++ dev/acpica/acpi_pci.c 14 Dec 2005 22:10:25 -0000 @@ -117,6 +117,7 @@ DEVMETHOD(pci_get_powerstate, pci_get_powerstate_method), DEVMETHOD(pci_set_powerstate, acpi_pci_set_powerstate_method), DEVMETHOD(pci_assign_interrupt, pci_assign_interrupt_method), + DEVMETHOD(pci_find_extcap, pci_find_extcap_method), { 0, 0 } }; Index: dev/acpica/acpi_video.c =================================================================== RCS file: /usr/cvs/src/sys/dev/acpica/acpi_video.c,v retrieving revision 1.11 diff -u -r1.11 acpi_video.c --- dev/acpica/acpi_video.c 11 Sep 2005 18:39:01 -0000 1.11 +++ dev/acpica/acpi_video.c 14 Dec 2005 22:10:25 -0000 @@ -70,6 +70,7 @@ /* interfaces */ static int acpi_video_modevent(struct module*, int, void *); +static void acpi_video_identify(driver_t *driver, device_t parent); static int acpi_video_probe(device_t); static int acpi_video_attach(device_t); static int acpi_video_detach(device_t); @@ -137,6 +138,7 @@ #define DSS_COMMIT (1 << 31) static device_method_t acpi_video_methods[] = { + DEVMETHOD(device_identify, acpi_video_identify), DEVMETHOD(device_probe, acpi_video_probe), DEVMETHOD(device_attach, acpi_video_attach), DEVMETHOD(device_detach, acpi_video_detach), @@ -152,7 +154,7 @@ static devclass_t acpi_video_devclass; -DRIVER_MODULE(acpi_video, pci, acpi_video_driver, acpi_video_devclass, +DRIVER_MODULE(acpi_video, vgapci, acpi_video_driver, acpi_video_devclass, acpi_video_modevent, NULL); MODULE_DEPEND(acpi_video, acpi, 1, 1, 1); @@ -189,19 +191,26 @@ return (err); } -static int -acpi_video_probe(device_t dev) +static void +acpi_video_identify(driver_t *driver, device_t parent) { ACPI_HANDLE devh, h; ACPI_OBJECT_TYPE t_dos; - devh = acpi_get_handle(dev); + devh = acpi_get_handle(parent); if (acpi_disabled("video") || ACPI_FAILURE(AcpiGetHandle(devh, "_DOD", &h)) || ACPI_FAILURE(AcpiGetHandle(devh, "_DOS", &h)) || ACPI_FAILURE(AcpiGetType(h, &t_dos)) || t_dos != ACPI_TYPE_METHOD) - return (ENXIO); + return; + + device_add_child(parent, "acpi_video", -1); +} + +static int +acpi_video_probe(device_t dev) +{ device_set_desc(dev, "ACPI video extension"); return (0); Index: dev/drm/drm_agpsupport.c =================================================================== RCS file: /usr/cvs/src/sys/dev/drm/drm_agpsupport.c,v retrieving revision 1.3 diff -u -r1.3 drm_agpsupport.c --- dev/drm/drm_agpsupport.c 28 Nov 2005 23:13:52 -0000 1.3 +++ dev/drm/drm_agpsupport.c 14 Dec 2005 22:10:25 -0000 @@ -56,34 +56,8 @@ } #ifdef __FreeBSD__ - /* Code taken from agp.c. IWBNI that was a public interface. */ - u_int32_t status; - u_int8_t ptr, next; - - /* - * Check the CAP_LIST bit of the PCI status register first. - */ - status = pci_read_config(dev->device, PCIR_STATUS, 2); - if (!(status & 0x10)) - return 0; - - /* - * Traverse the capabilities list. - */ - for (ptr = pci_read_config(dev->device, AGP_CAPPTR, 1); - ptr != 0; - ptr = next) { - u_int32_t capid = pci_read_config(dev->device, ptr, 4); - next = AGP_CAPID_GET_NEXT_PTR(capid); - - /* - * If this capability entry ID is cap, then we are done. - */ - if (AGP_CAPID_GET_CAP_ID(capid) == cap) - return 1; - } - return 0; + return (pci_find_extcap(dev->device, cap, NULL) == 0); #else /* XXX: fill me in for non-FreeBSD */ return 1; Index: dev/drm/drm_drv.c =================================================================== RCS file: /usr/cvs/src/sys/dev/drm/drm_drv.c,v retrieving revision 1.4 diff -u -r1.4 drm_drv.c --- dev/drm/drm_drv.c 3 Dec 2005 01:23:50 -0000 1.4 +++ dev/drm/drm_drv.c 14 Dec 2005 22:10:25 -0000 @@ -153,14 +153,9 @@ { drm_pci_id_list_t *id_entry; int vendor, device; - device_t realdev; - if (!strcmp(device_get_name(dev), "drmsub")) - realdev = device_get_parent(dev); - else - realdev = dev; - vendor = pci_get_vendor(realdev); - device = pci_get_device(realdev); + vendor = pci_get_vendor(dev); + device = pci_get_device(dev); id_entry = drm_find_description(vendor, device, idlist); if (id_entry != NULL) { @@ -180,11 +175,7 @@ unit = device_get_unit(nbdev); dev = device_get_softc(nbdev); - if (!strcmp(device_get_name(nbdev), "drmsub")) - dev->device = device_get_parent(nbdev); - else - dev->device = nbdev; - + dev->device = nbdev; dev->devnode = make_dev(&drm_cdevsw, unit, DRM_DEV_UID, Index: dev/drm/i915_drv.c =================================================================== RCS file: /usr/cvs/src/sys/dev/drm/i915_drv.c,v retrieving revision 1.3 diff -u -r1.3 i915_drv.c --- dev/drm/i915_drv.c 3 Dec 2005 01:23:50 -0000 1.3 +++ dev/drm/i915_drv.c 14 Dec 2005 22:10:25 -0000 @@ -98,13 +98,13 @@ }; static driver_t i915_driver = { - "drmsub", + "drm", i915_methods, sizeof(drm_device_t) }; extern devclass_t drm_devclass; -DRIVER_MODULE(i915, agp, i915_driver, drm_devclass, 0, 0); +DRIVER_MODULE(i915, vgapci, i915_driver, drm_devclass, 0, 0); MODULE_DEPEND(i915, drm, 1, 1, 1); #elif defined(__NetBSD__) || defined(__OpenBSD__) Index: dev/drm/mach64_drv.c =================================================================== RCS file: /usr/cvs/src/sys/dev/drm/mach64_drv.c,v retrieving revision 1.2 diff -u -r1.2 mach64_drv.c --- dev/drm/mach64_drv.c 28 Nov 2005 23:13:53 -0000 1.2 +++ dev/drm/mach64_drv.c 14 Dec 2005 22:10:25 -0000 @@ -109,7 +109,7 @@ }; extern devclass_t drm_devclass; -DRIVER_MODULE(mach64, pci, mach64_driver, drm_devclass, 0, 0); +DRIVER_MODULE(mach64, vgapci, mach64_driver, drm_devclass, 0, 0); MODULE_DEPEND(mach64, drm, 1, 1, 1); #elif defined(__NetBSD__) || defined(__OpenBSD__) Index: dev/drm/mga_drv.c =================================================================== RCS file: /usr/cvs/src/sys/dev/drm/mga_drv.c,v retrieving revision 1.10 diff -u -r1.10 mga_drv.c --- dev/drm/mga_drv.c 28 Nov 2005 23:13:53 -0000 1.10 +++ dev/drm/mga_drv.c 14 Dec 2005 22:10:25 -0000 @@ -64,6 +64,8 @@ */ static int mga_driver_device_is_agp(drm_device_t * dev) { + device_t bus; + /* There are PCI versions of the G450. These cards have the * same PCI ID as the AGP G450, but have an additional PCI-to-PCI * bridge chip. We detect these cards, which are not currently @@ -72,9 +74,10 @@ * device is 0x0021 (HB6 Universal PCI-PCI bridge), we reject the * device. */ + bus = device_get_parent(device_get_parent(dev->device)); if (pci_get_device(dev->device) == 0x0525 && - pci_get_vendor(device_get_parent(dev->device)) == 0x3388 && - pci_get_device(device_get_parent(dev->device)) == 0x0021) + pci_get_vendor(bus) == 0x3388 && + pci_get_device(bus) == 0x0021) return 0; else return 2; @@ -148,7 +151,7 @@ }; extern devclass_t drm_devclass; -DRIVER_MODULE(mga, pci, mga_driver, drm_devclass, 0, 0); +DRIVER_MODULE(mga, vgapci, mga_driver, drm_devclass, 0, 0); MODULE_DEPEND(mga, drm, 1, 1, 1); #elif defined(__NetBSD__) || defined(__OpenBSD__) Index: dev/drm/r128_drv.c =================================================================== RCS file: /usr/cvs/src/sys/dev/drm/r128_drv.c,v retrieving revision 1.10 diff -u -r1.10 r128_drv.c --- dev/drm/r128_drv.c 28 Nov 2005 23:13:53 -0000 1.10 +++ dev/drm/r128_drv.c 14 Dec 2005 22:10:25 -0000 @@ -109,7 +109,7 @@ }; extern devclass_t drm_devclass; -DRIVER_MODULE(r128, pci, r128_driver, drm_devclass, 0, 0); +DRIVER_MODULE(r128, vgapci, r128_driver, drm_devclass, 0, 0); MODULE_DEPEND(r128, drm, 1, 1, 1); #elif defined(__NetBSD__) || defined(__OpenBSD__) Index: dev/drm/radeon_drv.c =================================================================== RCS file: /usr/cvs/src/sys/dev/drm/radeon_drv.c,v retrieving revision 1.13 diff -u -r1.13 radeon_drv.c --- dev/drm/radeon_drv.c 28 Nov 2005 23:13:54 -0000 1.13 +++ dev/drm/radeon_drv.c 14 Dec 2005 22:10:25 -0000 @@ -114,7 +114,7 @@ }; extern devclass_t drm_devclass; -DRIVER_MODULE(radeon, pci, radeon_driver, drm_devclass, 0, 0); +DRIVER_MODULE(radeon, vgapci, radeon_driver, drm_devclass, 0, 0); MODULE_DEPEND(radeon, drm, 1, 1, 1); #elif defined(__NetBSD__) || defined(__OpenBSD__) Index: dev/drm/savage_drv.c =================================================================== RCS file: /usr/cvs/src/sys/dev/drm/savage_drv.c,v retrieving revision 1.2 diff -u -r1.2 savage_drv.c --- dev/drm/savage_drv.c 28 Nov 2005 23:13:55 -0000 1.2 +++ dev/drm/savage_drv.c 14 Dec 2005 22:10:25 -0000 @@ -99,7 +99,7 @@ }; extern devclass_t drm_devclass; -DRIVER_MODULE(savage, pci, savage_driver, drm_devclass, 0, 0); +DRIVER_MODULE(savage, vgapci, savage_driver, drm_devclass, 0, 0); MODULE_DEPEND(savage, drm, 1, 1, 1); #elif defined(__NetBSD__) || defined(__OpenBSD__) Index: dev/drm/sis_drv.c =================================================================== RCS file: /usr/cvs/src/sys/dev/drm/sis_drv.c,v retrieving revision 1.6 diff -u -r1.6 sis_drv.c --- dev/drm/sis_drv.c 28 Nov 2005 23:13:55 -0000 1.6 +++ dev/drm/sis_drv.c 14 Dec 2005 22:10:25 -0000 @@ -92,7 +92,7 @@ }; extern devclass_t drm_devclass; -DRIVER_MODULE(sisdrm, pci, sis_driver, drm_devclass, 0, 0); +DRIVER_MODULE(sisdrm, vgapci, sis_driver, drm_devclass, 0, 0); MODULE_DEPEND(sisdrm, drm, 1, 1, 1); #elif defined(__NetBSD__) || defined(__OpenBSD__) Index: dev/drm/tdfx_drv.c =================================================================== RCS file: /usr/cvs/src/sys/dev/drm/tdfx_drv.c,v retrieving revision 1.9 diff -u -r1.9 tdfx_drv.c --- dev/drm/tdfx_drv.c 28 Nov 2005 23:13:55 -0000 1.9 +++ dev/drm/tdfx_drv.c 14 Dec 2005 22:10:25 -0000 @@ -93,7 +93,7 @@ }; extern devclass_t drm_devclass; -DRIVER_MODULE(tdfx, pci, tdfx_driver, drm_devclass, 0, 0); +DRIVER_MODULE(tdfx, vgapci, tdfx_driver, drm_devclass, 0, 0); MODULE_DEPEND(tdfx, drm, 1, 1, 1); #elif defined(__NetBSD__) || defined(__OpenBSD__) Index: dev/pci/hostb_pci.c =================================================================== RCS file: dev/pci/hostb_pci.c diff -N dev/pci/hostb_pci.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ dev/pci/hostb_pci.c 14 Dec 2005 22:00:40 -0000 @@ -0,0 +1,249 @@ +/* + * Copyright (c) 1997, Stefan Esser + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include +#include + +/* + * Provide a device to "eat" the host->pci bridge devices that show up + * on PCI busses and stop them showing up twice on the probes. This also + * stops them showing up as 'none' in pciconf -l. If the host bridge + * provides an AGP capability then we create a child agp device for the + * agp GART driver to attach to. + */ +static int +pci_hostb_probe(device_t dev) +{ + u_int32_t id; + + id = pci_get_devid(dev); + + switch (id) { + + /* VIA VT82C596 Power Managment Function */ + case 0x30501106: + return (ENXIO); + + default: + break; + } + + if (pci_get_class(dev) == PCIC_BRIDGE && + pci_get_subclass(dev) == PCIS_BRIDGE_HOST) { + device_set_desc(dev, "Host to PCI bridge"); + device_quiet(dev); + return (-10000); + } + return (ENXIO); +} + +static int +pci_hostb_attach(device_t dev) +{ + + bus_generic_probe(dev); + + /* + * If AGP capabilities are present on this device, then create + * an AGP child. + */ + if (pci_find_extcap(dev, PCIY_AGP, NULL) == 0) + device_add_child(dev, "agp", -1); + bus_generic_attach(dev); + return (0); +} + +/* Bus interface. */ + +static int +pci_hostb_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) +{ + + return (BUS_READ_IVAR(device_get_parent(dev), dev, which, result)); +} + +static int +pci_hostb_write_ivar(device_t dev, device_t child, int which, uintptr_t value) +{ + + return (EINVAL); +} + +static struct resource * +pci_hostb_alloc_resource(device_t dev, device_t child, int type, int *rid, + u_long start, u_long end, u_long count, u_int flags) +{ + + return (bus_alloc_resource(dev, type, rid, start, end, count, flags)); +} + +static int +pci_hostb_release_resource(device_t dev, device_t child, int type, int rid, + struct resource *r) +{ + + return (bus_release_resource(dev, type, rid, r)); +} + +/* PCI interface. */ + +static uint32_t +pci_hostb_read_config(device_t dev, device_t child, int reg, int width) +{ + + return (pci_read_config(dev, reg, width)); +} + +static void +pci_hostb_write_config(device_t dev, device_t child, int reg, + uint32_t val, int width) +{ + + pci_write_config(dev, reg, val, width); +} + +static int +pci_hostb_enable_busmaster(device_t dev, device_t child) +{ + + device_printf(dev, "child %s requested pci_enable_busmaster\n", + device_get_nameunit(child)); + return (pci_enable_busmaster(dev)); +} + +static int +pci_hostb_disable_busmaster(device_t dev, device_t child) +{ + + device_printf(dev, "child %s requested pci_disable_busmaster\n", + device_get_nameunit(child)); + return (pci_disable_busmaster(dev)); +} + +static int +pci_hostb_enable_io(device_t dev, device_t child, int space) +{ + + device_printf(dev, "child %s requested pci_enable_io\n", + device_get_nameunit(child)); + return (pci_enable_io(dev, space)); +} + +static int +pci_hostb_disable_io(device_t dev, device_t child, int space) +{ + + device_printf(dev, "child %s requested pci_disable_io\n", + device_get_nameunit(child)); + return (pci_disable_io(dev, space)); +} + +static int +pci_hostb_set_powerstate(device_t dev, device_t child, int state) +{ + + device_printf(dev, "child %s requested pci_set_powerstate\n", + device_get_nameunit(child)); + return (pci_set_powerstate(dev, state)); +} + +static int +pci_hostb_get_powerstate(device_t dev, device_t child) +{ + + device_printf(dev, "child %s requested pci_get_powerstate\n", + device_get_nameunit(child)); + return (pci_get_powerstate(dev)); +} + +static int +pci_hostb_assign_interrupt(device_t dev, device_t child) +{ + + device_printf(dev, "child %s requested pci_assign_interrupt\n", + device_get_nameunit(child)); + return (PCI_ASSIGN_INTERRUPT(device_get_parent(dev), dev)); +} + +static int +pci_hostb_find_extcap(device_t dev, device_t child, int capability, + int *capreg) +{ + + return (pci_find_extcap(dev, capability, capreg)); +} + +static device_method_t pci_hostb_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, pci_hostb_probe), + DEVMETHOD(device_attach, pci_hostb_attach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + + /* Bus interface */ + DEVMETHOD(bus_read_ivar, pci_hostb_read_ivar), + DEVMETHOD(bus_write_ivar, pci_hostb_write_ivar), + DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + + DEVMETHOD(bus_alloc_resource, pci_hostb_alloc_resource), + DEVMETHOD(bus_release_resource, pci_hostb_release_resource), + DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), + DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + + /* PCI interface */ + DEVMETHOD(pci_read_config, pci_hostb_read_config), + DEVMETHOD(pci_write_config, pci_hostb_write_config), + DEVMETHOD(pci_enable_busmaster, pci_hostb_enable_busmaster), + DEVMETHOD(pci_disable_busmaster, pci_hostb_disable_busmaster), + DEVMETHOD(pci_enable_io, pci_hostb_enable_io), + DEVMETHOD(pci_disable_io, pci_hostb_disable_io), + DEVMETHOD(pci_get_powerstate, pci_hostb_get_powerstate), + DEVMETHOD(pci_set_powerstate, pci_hostb_set_powerstate), + DEVMETHOD(pci_assign_interrupt, pci_hostb_assign_interrupt), + DEVMETHOD(pci_find_extcap, pci_hostb_find_extcap), + + { 0, 0 } +}; + +static driver_t pci_hostb_driver = { + "hostb", + pci_hostb_methods, + 1, +}; + +static devclass_t pci_hostb_devclass; + +DRIVER_MODULE(hostb, pci, pci_hostb_driver, pci_hostb_devclass, 0, 0); Index: dev/pci/pci.c =================================================================== RCS file: /usr/cvs/src/sys/dev/pci/pci.c,v retrieving revision 1.304 diff -u -r1.304 pci.c --- dev/pci/pci.c 9 Nov 2005 03:37:52 -0000 1.304 +++ dev/pci/pci.c 14 Dec 2005 22:10:25 -0000 @@ -133,6 +133,7 @@ DEVMETHOD(pci_get_powerstate, pci_get_powerstate_method), DEVMETHOD(pci_set_powerstate, pci_set_powerstate_method), DEVMETHOD(pci_assign_interrupt, pci_assign_interrupt_method), + DEVMETHOD(pci_find_extcap, pci_find_extcap_method), { 0, 0 } }; @@ -449,10 +450,10 @@ } /* Find the next entry */ ptr = nextptr; - nextptr = REG(ptr + 1, 1); + nextptr = REG(ptr + PCICAP_NEXTPTR, 1); /* Process this entry */ - switch (REG(ptr, 1)) { + switch (REG(ptr + PCICAP_ID, 1)) { case PCIY_PMG: /* PCI power management */ if (cfg->pp.pp_cap == 0) { cfg->pp.pp_cap = REG(ptr + PCIR_POWER_CAP, 2); @@ -477,6 +478,57 @@ #undef REG } +/* + * Return the offset in configuration space of the requested extended + * capability entry or 0 if the specified capability was not found. + */ +int +pci_find_extcap_method(device_t dev, device_t child, int capability, + int *capreg) +{ + struct pci_devinfo *dinfo = device_get_ivars(child); + pcicfgregs *cfg = &dinfo->cfg; + u_int32_t status; + u_int8_t ptr; + + /* + * Check the CAP_LIST bit of the PCI status register first. + */ + status = pci_read_config(child, PCIR_STATUS, 2); + if (!(status & PCIM_STATUS_CAPPRESENT)) + return (ENXIO); + + /* + * Determine the start pointer of the capabilities list. + */ + switch (cfg->hdrtype & PCIM_HDRTYPE) { + case 0: + ptr = PCIR_CAP_PTR; + break; + case 2: + ptr = PCIR_CAP_PTR_2; + break; + default: + /* XXX: panic? */ + return (ENXIO); /* no extended capabilities support */ + } + ptr = pci_read_config(child, ptr, 1); + + /* + * Traverse the capabilities list. + */ + while (ptr != 0) { + if (pci_read_config(child, ptr + PCICAP_ID, 1) == capability) { + if (capreg != NULL) + *capreg = ptr; + return (0); + } + ptr = pci_read_config(child, ptr + PCICAP_NEXTPTR, 1); + } + + return (ENOENT); +} + /* free pcicfgregs structure and all depending data structures */ int Index: dev/pci/pci_if.m =================================================================== RCS file: /usr/cvs/src/sys/dev/pci/pci_if.m,v retrieving revision 1.7 diff -u -r1.7 pci_if.m --- dev/pci/pci_if.m 6 Jan 2005 01:43:05 -0000 1.7 +++ dev/pci/pci_if.m 14 Dec 2005 22:10:25 -0000 @@ -82,3 +82,10 @@ device_t dev; device_t child; }; + +METHOD int find_extcap { + device_t dev; + device_t child; + int capability; + int *capreg; +}; Index: dev/pci/pci_private.h =================================================================== RCS file: /usr/cvs/src/sys/dev/pci/pci_private.h,v retrieving revision 1.14 diff -u -r1.14 pci_private.h --- dev/pci/pci_private.h 28 Feb 2005 01:14:15 -0000 1.14 +++ dev/pci/pci_private.h 14 Dec 2005 22:10:25 -0000 @@ -59,6 +59,8 @@ int pci_disable_busmaster_method(device_t dev, device_t child); int pci_enable_io_method(device_t dev, device_t child, int space); int pci_disable_io_method(device_t dev, device_t child, int space); +int pci_find_extcap_method(device_t dev, device_t child, + int capability, int *capreg); struct resource *pci_alloc_resource(device_t dev, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags); Index: dev/pci/pcireg.h =================================================================== RCS file: /usr/cvs/src/sys/dev/pci/pcireg.h,v retrieving revision 1.48 diff -u -r1.48 pcireg.h --- dev/pci/pcireg.h 29 Oct 2005 05:49:06 -0000 1.48 +++ dev/pci/pcireg.h 14 Dec 2005 22:10:25 -0000 @@ -88,6 +88,11 @@ #define PCIM_MFDEV 0x80 #define PCIR_BIST 0x0f +/* Capability Register Offsets */ + +#define PCICAP_ID 0x0 +#define PCICAP_NEXTPTR 0x1 + /* Capability Identification Numbers */ #define PCIY_PMG 0x01 /* PCI Power Management */ Index: dev/pci/pcivar.h =================================================================== RCS file: /usr/cvs/src/sys/dev/pci/pcivar.h,v retrieving revision 1.67 diff -u -r1.67 pcivar.h --- dev/pci/pcivar.h 11 Sep 2005 03:22:03 -0000 1.67 +++ dev/pci/pcivar.h 14 Dec 2005 22:10:25 -0000 @@ -348,6 +348,12 @@ return PCI_GET_POWERSTATE(device_get_parent(dev), dev); } +static __inline int +pci_find_extcap(device_t dev, int capability, int *capreg) +{ + return PCI_FIND_EXTCAP(device_get_parent(dev), dev, capability, capreg); +} + device_t pci_find_bsf(uint8_t, uint8_t, uint8_t); device_t pci_find_device(uint16_t, uint16_t); #endif /* _SYS_BUS_H_ */ Index: dev/pci/vga_pci.c =================================================================== RCS file: dev/pci/vga_pci.c diff -N dev/pci/vga_pci.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ dev/pci/vga_pci.c 1 Dec 2005 21:49:30 -0000 @@ -0,0 +1,262 @@ +/*- + * Copyright (c) 2005 John Baldwin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * Simple driver for PCI VGA display devices. Drivers such as agp(4) and + * drm(4) should attach as children of this device. + * + * XXX: The vgapci name is a hack until we somehow merge the isa vga driver + * in or rename it. + */ + +#include +#include +#include +#include + +#include +#include + +static int +vga_pci_probe(device_t dev) +{ + + switch (pci_get_class(dev)) { + case PCIC_DISPLAY: + break; + case PCIC_OLD: + if (pci_get_subclass(dev) != PCIS_OLD_VGA) + return (ENXIO); + break; + default: + return (ENXIO); + } + device_set_desc(dev, "VGA-compatible display"); + return (0); +} + +static int +vga_pci_attach(device_t dev) +{ + + bus_generic_probe(dev); + + /* + * If AGP capabilities are present on this device, then create + * an AGP child. + */ + if (pci_find_extcap(dev, PCIY_AGP, NULL) == 0) + device_add_child(dev, "agp", -1); + + /* Always create a drm child for now to make it easier on drm. */ + device_add_child(dev, "drm", -1); + bus_generic_attach(dev); + return (0); +} + +static int +vga_pci_suspend(device_t dev) +{ + + return (bus_generic_suspend(dev)); +} + +static int +vga_pci_resume(device_t dev) +{ + + return (bus_generic_resume(dev)); +} + +/* Bus interface. */ + +static int +vga_pci_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) +{ + + return (BUS_READ_IVAR(device_get_parent(dev), dev, which, result)); +} + +static int +vga_pci_write_ivar(device_t dev, device_t child, int which, uintptr_t value) +{ + + return (EINVAL); +} + +static struct resource * +vga_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, + u_long start, u_long end, u_long count, u_int flags) +{ + + return (bus_alloc_resource(dev, type, rid, start, end, count, flags)); +} + +static int +vga_pci_release_resource(device_t dev, device_t child, int type, int rid, + struct resource *r) +{ + + return (bus_release_resource(dev, type, rid, r)); +} + +/* PCI interface. */ + +static uint32_t +vga_pci_read_config(device_t dev, device_t child, int reg, int width) +{ + + return (pci_read_config(dev, reg, width)); +} + +static void +vga_pci_write_config(device_t dev, device_t child, int reg, + uint32_t val, int width) +{ + + pci_write_config(dev, reg, val, width); +} + +static int +vga_pci_enable_busmaster(device_t dev, device_t child) +{ + + device_printf(dev, "child %s requested pci_enable_busmaster\n", + device_get_nameunit(child)); + return (pci_enable_busmaster(dev)); +} + +static int +vga_pci_disable_busmaster(device_t dev, device_t child) +{ + + device_printf(dev, "child %s requested pci_disable_busmaster\n", + device_get_nameunit(child)); + return (pci_disable_busmaster(dev)); +} + +static int +vga_pci_enable_io(device_t dev, device_t child, int space) +{ + + device_printf(dev, "child %s requested pci_enable_io\n", + device_get_nameunit(child)); + return (pci_enable_io(dev, space)); +} + +static int +vga_pci_disable_io(device_t dev, device_t child, int space) +{ + + device_printf(dev, "child %s requested pci_disable_io\n", + device_get_nameunit(child)); + return (pci_disable_io(dev, space)); +} + +static int +vga_pci_set_powerstate(device_t dev, device_t child, int state) +{ + + device_printf(dev, "child %s requested pci_set_powerstate\n", + device_get_nameunit(child)); + return (pci_set_powerstate(dev, state)); +} + +static int +vga_pci_get_powerstate(device_t dev, device_t child) +{ + + device_printf(dev, "child %s requested pci_get_powerstate\n", + device_get_nameunit(child)); + return (pci_get_powerstate(dev)); +} + +static int +vga_pci_assign_interrupt(device_t dev, device_t child) +{ + + device_printf(dev, "child %s requested pci_assign_interrupt\n", + device_get_nameunit(child)); + return (PCI_ASSIGN_INTERRUPT(device_get_parent(dev), dev)); +} + +static int +vga_pci_find_extcap(device_t dev, device_t child, int capability, + int *capreg) +{ + + return (pci_find_extcap(dev, capability, capreg)); +} + +static device_method_t vga_pci_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, vga_pci_probe), + DEVMETHOD(device_attach, vga_pci_attach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + DEVMETHOD(device_suspend, vga_pci_suspend), + DEVMETHOD(device_resume, vga_pci_resume), + + /* Bus interface */ + DEVMETHOD(bus_read_ivar, vga_pci_read_ivar), + DEVMETHOD(bus_write_ivar, vga_pci_write_ivar), + DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + + DEVMETHOD(bus_alloc_resource, vga_pci_alloc_resource), + DEVMETHOD(bus_release_resource, vga_pci_release_resource), + DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), + DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + + /* PCI interface */ + DEVMETHOD(pci_read_config, vga_pci_read_config), + DEVMETHOD(pci_write_config, vga_pci_write_config), + DEVMETHOD(pci_enable_busmaster, vga_pci_enable_busmaster), + DEVMETHOD(pci_disable_busmaster, vga_pci_disable_busmaster), + DEVMETHOD(pci_enable_io, vga_pci_enable_io), + DEVMETHOD(pci_disable_io, vga_pci_disable_io), + DEVMETHOD(pci_get_powerstate, vga_pci_get_powerstate), + DEVMETHOD(pci_set_powerstate, vga_pci_set_powerstate), + DEVMETHOD(pci_assign_interrupt, vga_pci_assign_interrupt), + DEVMETHOD(pci_find_extcap, vga_pci_find_extcap), + + { 0, 0 } +}; + +static driver_t vga_pci_driver = { + "vgapci", + vga_pci_methods, + 1, +}; + +static devclass_t vga_devclass; + +DRIVER_MODULE(vgapci, pci, vga_pci_driver, vga_devclass, 0, 0); Index: i386/pci/pci_bus.c =================================================================== RCS file: /usr/cvs/src/sys/i386/pci/pci_bus.c,v retrieving revision 1.121 diff -u -r1.121 pci_bus.c --- i386/pci/pci_bus.c 17 Sep 2005 23:57:53 -0000 1.121 +++ i386/pci/pci_bus.c 14 Dec 2005 22:10:25 -0000 @@ -548,64 +548,6 @@ /* - * Provide a device to "eat" the host->pci bridges that we dug up above - * and stop them showing up twice on the probes. This also stops them - * showing up as 'none' in pciconf -l. - */ -static int -pci_hostb_probe(device_t dev) -{ - u_int32_t id; - - id = pci_get_devid(dev); - - switch (id) { - - /* VIA VT82C596 Power Managment Function */ - case 0x30501106: - return ENXIO; - - default: - break; - } - - if (pci_get_class(dev) == PCIC_BRIDGE && - pci_get_subclass(dev) == PCIS_BRIDGE_HOST) { - device_set_desc(dev, "Host to PCI bridge"); - device_quiet(dev); - return -10000; - } - return ENXIO; -} - -static int -pci_hostb_attach(device_t dev) -{ - - return 0; -} - -static device_method_t pci_hostb_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, pci_hostb_probe), - DEVMETHOD(device_attach, pci_hostb_attach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), - - { 0, 0 } -}; -static driver_t pci_hostb_driver = { - "hostb", - pci_hostb_methods, - 1, -}; -static devclass_t pci_hostb_devclass; - -DRIVER_MODULE(hostb, pci, pci_hostb_driver, pci_hostb_devclass, 0, 0); - - -/* * Install placeholder to claim the resources owned by the * PCI bus interface. This could be used to extract the * config space registers in the extreme case where the PnP Index: pci/agp.c =================================================================== RCS file: /usr/cvs/src/sys/pci/agp.c,v retrieving revision 1.46 diff -u -r1.46 agp.c --- pci/agp.c 24 Oct 2004 07:12:13 -0000 1.46 +++ pci/agp.c 14 Dec 2005 22:10:25 -0000 @@ -101,33 +101,12 @@ u_int8_t agp_find_caps(device_t dev) { - u_int32_t status; - u_int8_t ptr, next; + int capreg; - /* - * Check the CAP_LIST bit of the PCI status register first. - */ - status = pci_read_config(dev, PCIR_STATUS, 2); - if (!(status & 0x10)) - return 0; - - /* - * Traverse the capabilities list. - */ - for (ptr = pci_read_config(dev, AGP_CAPPTR, 1); - ptr != 0; - ptr = next) { - u_int32_t capid = pci_read_config(dev, ptr, 4); - next = AGP_CAPID_GET_NEXT_PTR(capid); - - /* - * If this capability entry ID is 2, then we are done. - */ - if (AGP_CAPID_GET_CAP_ID(capid) == 2) - return ptr; - } - return 0; + if (pci_find_extcap(dev, PCIY_AGP, &capreg) != 0) + capreg = 0; + return (capreg); } /* @@ -230,8 +209,7 @@ * Find and map the aperture. */ rid = AGP_APBASE; - sc->as_aperture = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, - RF_ACTIVE); + sc->as_aperture = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, 0); if (!sc->as_aperture) return ENOMEM; @@ -274,9 +252,10 @@ agp_generic_detach(device_t dev) { struct agp_softc *sc = device_get_softc(dev); + + destroy_dev(sc->as_devnode); bus_release_resource(dev, SYS_RES_MEMORY, AGP_APBASE, sc->as_aperture); mtx_destroy(&sc->as_lock); - destroy_dev(sc->as_devnode); agp_flush_cache(); return 0; } @@ -851,9 +830,18 @@ device_t agp_find_device() { + device_t *children; + int i, count; + if (!agp_devclass) - return 0; - return devclass_get_device(agp_devclass, 0); + return NULL; + if (devclass_get_devices(agp_devclass, &children, &count) != 0) + return NULL; + for (i = 0; i < count; i++) { + if (device_is_attached(children[i])) + return (children[i]); + } + return NULL; } enum agp_acquire_state @@ -872,7 +860,6 @@ pci_read_config(dev, agp_find_caps(dev) + AGP_STATUS, 4); info->ai_aperture_base = rman_get_start(sc->as_aperture); info->ai_aperture_size = rman_get_size(sc->as_aperture); - info->ai_aperture_va = (vm_offset_t) rman_get_virtual(sc->as_aperture); info->ai_memory_allowed = sc->as_maxmem; info->ai_memory_used = sc->as_allocated; } Index: pci/agp_ali.c =================================================================== RCS file: /usr/cvs/src/sys/pci/agp_ali.c,v retrieving revision 1.17 diff -u -r1.17 agp_ali.c --- pci/agp_ali.c 27 Feb 2005 13:05:34 -0000 1.17 +++ pci/agp_ali.c 14 Dec 2005 22:10:25 -0000 @@ -85,7 +85,6 @@ return (ENXIO); desc = agp_ali_match(dev); if (desc) { - device_verbose(dev); device_set_desc(dev, desc); return BUS_PROBE_DEFAULT; } @@ -271,6 +270,6 @@ static devclass_t agp_devclass; -DRIVER_MODULE(agp_ali, pci, agp_ali_driver, agp_devclass, 0, 0); +DRIVER_MODULE(agp_ali, hostb, agp_ali_driver, agp_devclass, 0, 0); MODULE_DEPEND(agp_ali, agp, 1, 1, 1); MODULE_DEPEND(agp_ali, pci, 1, 1, 1); Index: pci/agp_amd.c =================================================================== RCS file: /usr/cvs/src/sys/pci/agp_amd.c,v retrieving revision 1.22 diff -u -r1.22 agp_amd.c --- pci/agp_amd.c 24 Feb 2005 21:32:55 -0000 1.22 +++ pci/agp_amd.c 14 Dec 2005 22:10:25 -0000 @@ -207,7 +207,6 @@ return (ENXIO); desc = agp_amd_match(dev); if (desc) { - device_verbose(dev); device_set_desc(dev, desc); return BUS_PROBE_DEFAULT; } @@ -415,6 +414,6 @@ static devclass_t agp_devclass; -DRIVER_MODULE(agp_amd, pci, agp_amd_driver, agp_devclass, 0, 0); +DRIVER_MODULE(agp_amd, hostb, agp_amd_driver, agp_devclass, 0, 0); MODULE_DEPEND(agp_amd, agp, 1, 1, 1); MODULE_DEPEND(agp_amd, pci, 1, 1, 1); Index: pci/agp_amd64.c =================================================================== RCS file: /usr/cvs/src/sys/pci/agp_amd64.c,v retrieving revision 1.9 diff -u -r1.9 agp_amd64.c --- pci/agp_amd64.c 14 Nov 2005 21:54:20 -0000 1.9 +++ pci/agp_amd64.c 14 Dec 2005 22:10:25 -0000 @@ -155,7 +155,6 @@ if (resource_disabled("agp", device_get_unit(dev))) return ENXIO; if ((desc = agp_amd64_match(dev))) { - device_verbose(dev); device_set_desc(dev, desc); return BUS_PROBE_DEFAULT; } @@ -515,6 +514,6 @@ static devclass_t agp_devclass; -DRIVER_MODULE(agp_amd64, pci, agp_amd64_driver, agp_devclass, 0, 0); +DRIVER_MODULE(agp_amd64, hostb, agp_amd64_driver, agp_devclass, 0, 0); MODULE_DEPEND(agp_amd64, agp, 1, 1, 1); MODULE_DEPEND(agp_amd64, pci, 1, 1, 1); Index: pci/agp_ati.c =================================================================== RCS file: /usr/cvs/src/sys/pci/agp_ati.c,v retrieving revision 1.1 diff -u -r1.1 agp_ati.c --- pci/agp_ati.c 17 Sep 2005 03:36:47 -0000 1.1 +++ pci/agp_ati.c 14 Dec 2005 22:10:25 -0000 @@ -111,7 +111,6 @@ desc = agp_ati_match(dev); if (desc) { - device_verbose(dev); device_set_desc(dev, desc); return 0; } @@ -381,6 +380,6 @@ static devclass_t agp_devclass; -DRIVER_MODULE(agp_ati, pci, agp_ati_driver, agp_devclass, 0, 0); +DRIVER_MODULE(agp_ati, hostb, agp_ati_driver, agp_devclass, 0, 0); MODULE_DEPEND(agp_ati, agp, 1, 1, 1); MODULE_DEPEND(agp_ati, pci, 1, 1, 1); Index: pci/agp_i810.c =================================================================== RCS file: /usr/cvs/src/sys/pci/agp_i810.c,v retrieving revision 1.33 diff -u -r1.33 agp_i810.c --- pci/agp_i810.c 2 Dec 2005 23:51:36 -0000 1.33 +++ pci/agp_i810.c 14 Dec 2005 22:10:25 -0000 @@ -178,7 +178,8 @@ devid -= 0x20000; break; }; - if (device_get_children(device_get_parent(dev), &children, &nchildren)) + if (device_get_children(device_get_parent(device_get_parent(dev)), + &children, &nchildren)) return 0; for (i = 0; i < nchildren; i++) { @@ -261,7 +262,6 @@ return ENXIO; } - device_verbose(dev); device_set_desc(dev, desc); return BUS_PROBE_DEFAULT; } @@ -452,11 +452,7 @@ gatt->ag_physical = pgtblctl & ~1; } - /* Add a device for the drm to attach to */ - if (!device_add_child( dev, "drmsub", -1 )) - printf("out of memory...\n"); - - return bus_generic_attach(dev); + return 0; } static int @@ -498,10 +494,6 @@ sc->regs); } - child = device_find_child( dev, "drmsub", 0 ); - if (child) - device_delete_child( dev, child ); - return 0; } @@ -806,26 +798,11 @@ return 0; } -static int -agp_i810_print_child(device_t dev, device_t child) -{ - int retval = 0; - - retval += bus_print_child_header(dev, child); - retval += printf(": (child of agp_i810.c)"); - retval += bus_print_child_footer(dev, child); - - return retval; -} - static device_method_t agp_i810_methods[] = { /* Device interface */ DEVMETHOD(device_probe, agp_i810_probe), DEVMETHOD(device_attach, agp_i810_attach), DEVMETHOD(device_detach, agp_i810_detach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), /* AGP interface */ DEVMETHOD(agp_get_aperture, agp_i810_get_aperture), @@ -839,14 +816,6 @@ DEVMETHOD(agp_bind_memory, agp_i810_bind_memory), DEVMETHOD(agp_unbind_memory, agp_i810_unbind_memory), - /* bus methods */ - DEVMETHOD(bus_print_child, agp_i810_print_child), - DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), - DEVMETHOD(bus_release_resource, bus_generic_release_resource), - DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), - DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), { 0, 0 } }; @@ -858,6 +827,6 @@ static devclass_t agp_devclass; -DRIVER_MODULE(agp_i810, pci, agp_i810_driver, agp_devclass, 0, 0); +DRIVER_MODULE(agp_i810, vgapci, agp_i810_driver, agp_devclass, 0, 0); MODULE_DEPEND(agp_i810, agp, 1, 1, 1); MODULE_DEPEND(agp_i810, pci, 1, 1, 1); Index: pci/agp_intel.c =================================================================== RCS file: /usr/cvs/src/sys/pci/agp_intel.c,v retrieving revision 1.28 diff -u -r1.28 agp_intel.c --- pci/agp_intel.c 29 Nov 2005 04:53:22 -0000 1.28 +++ pci/agp_intel.c 14 Dec 2005 22:10:25 -0000 @@ -134,7 +134,6 @@ return (ENXIO); desc = agp_intel_match(dev); if (desc) { - device_verbose(dev); device_set_desc(dev, desc); return BUS_PROBE_DEFAULT; } @@ -425,6 +424,6 @@ static devclass_t agp_devclass; -DRIVER_MODULE(agp_intel, pci, agp_intel_driver, agp_devclass, 0, 0); +DRIVER_MODULE(agp_intel, hostb, agp_intel_driver, agp_devclass, 0, 0); MODULE_DEPEND(agp_intel, agp, 1, 1, 1); MODULE_DEPEND(agp_intel, pci, 1, 1, 1); Index: pci/agp_nvidia.c =================================================================== RCS file: /usr/cvs/src/sys/pci/agp_nvidia.c,v retrieving revision 1.10 diff -u -r1.10 agp_nvidia.c --- pci/agp_nvidia.c 16 Sep 2005 22:59:47 -0000 1.10 +++ pci/agp_nvidia.c 14 Dec 2005 22:10:25 -0000 @@ -121,7 +121,6 @@ return (ENXIO); desc = agp_nvidia_match(dev); if (desc) { - device_verbose(dev); device_set_desc(dev, desc); return (BUS_PROBE_DEFAULT); } @@ -460,6 +459,6 @@ static devclass_t agp_devclass; -DRIVER_MODULE(agp_nvidia, pci, agp_nvidia_driver, agp_devclass, 0, 0); +DRIVER_MODULE(agp_nvidia, hostb, agp_nvidia_driver, agp_devclass, 0, 0); MODULE_DEPEND(agp_nvidia, agp, 1, 1, 1); MODULE_DEPEND(agp_nvidia, pci, 1, 1, 1); Index: pci/agp_sis.c =================================================================== RCS file: /usr/cvs/src/sys/pci/agp_sis.c,v retrieving revision 1.18 diff -u -r1.18 agp_sis.c --- pci/agp_sis.c 24 Feb 2005 21:32:55 -0000 1.18 +++ pci/agp_sis.c 14 Dec 2005 22:10:25 -0000 @@ -119,7 +119,6 @@ return (ENXIO); desc = agp_sis_match(dev); if (desc) { - device_verbose(dev); device_set_desc(dev, desc); return BUS_PROBE_DEFAULT; } @@ -293,6 +292,6 @@ static devclass_t agp_devclass; -DRIVER_MODULE(agp_sis, pci, agp_sis_driver, agp_devclass, 0, 0); +DRIVER_MODULE(agp_sis, hostb, agp_sis_driver, agp_devclass, 0, 0); MODULE_DEPEND(agp_sis, agp, 1, 1, 1); MODULE_DEPEND(agp_sis, pci, 1, 1, 1); Index: pci/agp_via.c =================================================================== RCS file: /usr/cvs/src/sys/pci/agp_via.c,v retrieving revision 1.22 diff -u -r1.22 agp_via.c --- pci/agp_via.c 26 Jun 2005 04:01:11 -0000 1.22 +++ pci/agp_via.c 14 Dec 2005 22:10:25 -0000 @@ -143,7 +143,6 @@ return (ENXIO); desc = agp_via_match(dev); if (desc) { - device_verbose(dev); device_set_desc(dev, desc); return BUS_PROBE_DEFAULT; } @@ -363,6 +362,6 @@ static devclass_t agp_devclass; -DRIVER_MODULE(agp_via, pci, agp_via_driver, agp_devclass, 0, 0); +DRIVER_MODULE(agp_via, hostb, agp_via_driver, agp_devclass, 0, 0); MODULE_DEPEND(agp_via, agp, 1, 1, 1); MODULE_DEPEND(agp_via, pci, 1, 1, 1); Index: pci/agpreg.h =================================================================== RCS file: /usr/cvs/src/sys/pci/agpreg.h,v retrieving revision 1.16 diff -u -r1.16 agpreg.h --- pci/agpreg.h 2 Dec 2005 23:51:36 -0000 1.16 +++ pci/agpreg.h 14 Dec 2005 22:10:25 -0000 @@ -32,18 +32,12 @@ /* * Offsets for various AGP configuration registers. */ -#define AGP_APBASE 0x10 -#define AGP_CAPPTR 0x34 +#define AGP_APBASE PCIR_BAR(0) /* * Offsets from the AGP Capability pointer. */ #define AGP_CAPID 0x0 -#define AGP_CAPID_GET_MAJOR(x) (((x) & 0x00f00000U) >> 20) -#define AGP_CAPID_GET_MINOR(x) (((x) & 0x000f0000U) >> 16) -#define AGP_CAPID_GET_NEXT_PTR(x) (((x) & 0x0000ff00U) >> 8) -#define AGP_CAPID_GET_CAP_ID(x) (((x) & 0x000000ffU) >> 0) - #define AGP_STATUS 0x4 #define AGP_COMMAND 0x8 #define AGP_STATUS_AGP3 0x0008 Index: pci/agpvar.h =================================================================== RCS file: /usr/cvs/src/sys/pci/agpvar.h,v retrieving revision 1.2 diff -u -r1.2 agpvar.h --- pci/agpvar.h 19 Dec 2001 08:54:29 -0000 1.2 +++ pci/agpvar.h 14 Dec 2005 22:10:25 -0000 @@ -47,7 +47,6 @@ u_int32_t ai_mode; vm_offset_t ai_aperture_base; vm_size_t ai_aperture_size; - vm_offset_t ai_aperture_va; vm_size_t ai_memory_allowed; vm_size_t ai_memory_used; u_int32_t ai_devid; Index: sparc64/pci/ofw_pcibus.c =================================================================== RCS file: /usr/cvs/src/sys/sparc64/pci/ofw_pcibus.c,v retrieving revision 1.8 diff -u -r1.8 ofw_pcibus.c --- sparc64/pci/ofw_pcibus.c 3 Dec 2005 18:11:26 -0000 1.8 +++ sparc64/pci/ofw_pcibus.c 14 Dec 2005 22:10:25 -0000 @@ -106,6 +106,7 @@ DEVMETHOD(pci_get_powerstate, pci_get_powerstate_method), DEVMETHOD(pci_set_powerstate, pci_set_powerstate_method), DEVMETHOD(pci_assign_interrupt, ofw_pcibus_assign_interrupt), + DEVMETHOD(pci_find_extcap, pci_find_extcap_method), /* ofw_bus interface */ DEVMETHOD(ofw_bus_get_devinfo, ofw_pcibus_get_devinfo),