diff -urN --exclude *.orig ./sys/amd64/pci/pci_bus.c ../src-patched/sys/amd64/pci/pci_bus.c --- ./sys/amd64/pci/pci_bus.c Sun Sep 18 04:55:10 2005 +++ ../src-patched/sys/amd64/pci/pci_bus.c Thu May 25 13:03:32 2006 @@ -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 diff -urN --exclude *.orig ./sys/conf/files ../src-patched/sys/conf/files --- ./sys/conf/files Wed Apr 12 19:45:24 2006 +++ ../src-patched/sys/conf/files Thu May 25 13:03:32 2006 @@ -723,6 +723,7 @@ dev/pccbb/pccbb_pci.c optional cbb pci 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 @@ -730,6 +731,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 fea eisa nowerror diff -urN --exclude *.orig ./sys/dev/acpica/acpi_pci.c ../src-patched/sys/dev/acpica/acpi_pci.c --- ./sys/dev/acpica/acpi_pci.c Mon Nov 7 10:53:22 2005 +++ ../src-patched/sys/dev/acpica/acpi_pci.c Thu May 25 13:03:32 2006 @@ -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 } }; diff -urN --exclude *.orig ./sys/dev/acpica/acpi_video.c ../src-patched/sys/dev/acpica/acpi_video.c --- ./sys/dev/acpica/acpi_video.c Mon Nov 7 10:53:23 2005 +++ ../src-patched/sys/dev/acpica/acpi_video.c Thu May 25 13:03:32 2006 @@ -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); diff -urN --exclude *.orig ./sys/dev/drm/drm_agpsupport.c ../src-patched/sys/dev/drm/drm_agpsupport.c --- ./sys/dev/drm/drm_agpsupport.c Wed May 17 09:40:11 2006 +++ ../src-patched/sys/dev/drm/drm_agpsupport.c Thu May 25 13:13:30 2006 @@ -46,39 +46,9 @@ drm_device_find_capability(drm_device_t *dev, int cap) { #ifdef __FreeBSD__ -#if __FreeBSD_version >= 700010 return (pci_find_extcap(dev->device, cap, NULL) == 0); -#else - /* 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; -#endif #else /* XXX: fill me in for non-FreeBSD */ return 1; diff -urN --exclude *.orig ./sys/dev/drm/i915_drv.c ../src-patched/sys/dev/drm/i915_drv.c --- ./sys/dev/drm/i915_drv.c Wed May 17 09:40:11 2006 +++ ../src-patched/sys/dev/drm/i915_drv.c Thu May 25 13:29:57 2006 @@ -100,7 +100,7 @@ }; static driver_t i915_driver = { -#if __FreeBSD_version >= 700010 +#if __FreeBSD_version >= 600010 "drm", #else "drmsub", @@ -110,7 +110,7 @@ }; extern devclass_t drm_devclass; -#if __FreeBSD_version >= 700010 +#if __FreeBSD_version >= 600010 DRIVER_MODULE(i915, vgapci, i915_driver, drm_devclass, 0, 0); #else DRIVER_MODULE(i915, agp, i915_driver, drm_devclass, 0, 0); diff -urN --exclude *.orig ./sys/dev/drm/mach64_drv.c ../src-patched/sys/dev/drm/mach64_drv.c --- ./sys/dev/drm/mach64_drv.c Wed May 17 09:40:11 2006 +++ ../src-patched/sys/dev/drm/mach64_drv.c Thu May 25 13:29:57 2006 @@ -109,7 +109,7 @@ }; extern devclass_t drm_devclass; -#if __FreeBSD_version >= 700010 +#if __FreeBSD_version >= 600010 DRIVER_MODULE(mach64, vgapci, mach64_driver, drm_devclass, 0, 0); #else DRIVER_MODULE(mach64, pci, mach64_driver, drm_devclass, 0, 0); diff -urN --exclude *.orig ./sys/dev/drm/mga_drv.c ../src-patched/sys/dev/drm/mga_drv.c --- ./sys/dev/drm/mga_drv.c Wed May 17 09:40:11 2006 +++ ../src-patched/sys/dev/drm/mga_drv.c Thu May 25 13:29:57 2006 @@ -155,7 +155,7 @@ }; extern devclass_t drm_devclass; -#if __FreeBSD_version >= 700010 +#if __FreeBSD_version >= 600010 DRIVER_MODULE(mga, vgapci, mga_driver, drm_devclass, 0, 0); #else DRIVER_MODULE(mga, pci, mga_driver, drm_devclass, 0, 0); diff -urN --exclude *.orig ./sys/dev/drm/r128_drv.c ../src-patched/sys/dev/drm/r128_drv.c --- ./sys/dev/drm/r128_drv.c Wed May 17 09:40:11 2006 +++ ../src-patched/sys/dev/drm/r128_drv.c Thu May 25 13:29:57 2006 @@ -109,7 +109,7 @@ }; extern devclass_t drm_devclass; -#if __FreeBSD_version >= 700010 +#if __FreeBSD_version >= 600010 DRIVER_MODULE(r128, vgapci, r128_driver, drm_devclass, 0, 0); #else DRIVER_MODULE(r128, pci, r128_driver, drm_devclass, 0, 0); diff -urN --exclude *.orig ./sys/dev/drm/radeon_drv.c ../src-patched/sys/dev/drm/radeon_drv.c --- ./sys/dev/drm/radeon_drv.c Wed May 17 09:40:11 2006 +++ ../src-patched/sys/dev/drm/radeon_drv.c Thu May 25 13:29:57 2006 @@ -114,7 +114,7 @@ }; extern devclass_t drm_devclass; -#if __FreeBSD_version >= 700010 +#if __FreeBSD_version >= 600010 DRIVER_MODULE(radeon, vgapci, radeon_driver, drm_devclass, 0, 0); #else DRIVER_MODULE(radeon, pci, radeon_driver, drm_devclass, 0, 0); diff -urN --exclude *.orig ./sys/dev/drm/savage_drv.c ../src-patched/sys/dev/drm/savage_drv.c --- ./sys/dev/drm/savage_drv.c Wed May 17 09:40:11 2006 +++ ../src-patched/sys/dev/drm/savage_drv.c Thu May 25 13:29:57 2006 @@ -99,7 +99,7 @@ }; extern devclass_t drm_devclass; -#if __FreeBSD_version >= 700010 +#if __FreeBSD_version >= 600010 DRIVER_MODULE(savage, vgapci, savage_driver, drm_devclass, 0, 0); #else DRIVER_MODULE(savage, pci, savage_driver, drm_devclass, 0, 0); diff -urN --exclude *.orig ./sys/dev/drm/sis_drv.c ../src-patched/sys/dev/drm/sis_drv.c --- ./sys/dev/drm/sis_drv.c Wed May 17 09:40:11 2006 +++ ../src-patched/sys/dev/drm/sis_drv.c Thu May 25 13:29:57 2006 @@ -92,7 +92,7 @@ }; extern devclass_t drm_devclass; -#if __FreeBSD_version >= 700010 +#if __FreeBSD_version >= 600010 DRIVER_MODULE(sisdrm, vgapci, sis_driver, drm_devclass, 0, 0); #else DRIVER_MODULE(sisdrm, pci, sis_driver, drm_devclass, 0, 0); diff -urN --exclude *.orig ./sys/dev/drm/tdfx_drv.c ../src-patched/sys/dev/drm/tdfx_drv.c --- ./sys/dev/drm/tdfx_drv.c Wed May 17 09:40:11 2006 +++ ../src-patched/sys/dev/drm/tdfx_drv.c Thu May 25 13:29:57 2006 @@ -93,7 +93,7 @@ }; extern devclass_t drm_devclass; -#if __FreeBSD_version >= 700010 +#if __FreeBSD_version >= 600010 DRIVER_MODULE(tdfx, vgapci, tdfx_driver, drm_devclass, 0, 0); #else DRIVER_MODULE(tdfx, pci, tdfx_driver, drm_devclass, 0, 0); diff -urN --exclude *.orig ./sys/dev/pci/hostb_pci.c ../src-patched/sys/dev/pci/hostb_pci.c --- ./sys/dev/pci/hostb_pci.c Thu Jan 1 01:00:00 1970 +++ ../src-patched/sys/dev/pci/hostb_pci.c Thu May 25 13:03:32 2006 @@ -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); diff -urN --exclude *.orig ./sys/dev/pci/pci.c ../src-patched/sys/dev/pci/pci.c --- ./sys/dev/pci/pci.c Tue Jan 31 15:42:43 2006 +++ ../src-patched/sys/dev/pci/pci.c Thu May 25 13:03:32 2006 @@ -131,6 +131,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 } }; @@ -447,10 +448,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); @@ -473,6 +474,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 */ diff -urN --exclude *.orig ./sys/dev/pci/pci_if.m ../src-patched/sys/dev/pci/pci_if.m --- ./sys/dev/pci/pci_if.m Thu Jan 6 02:43:05 2005 +++ ../src-patched/sys/dev/pci/pci_if.m Thu May 25 13:03:32 2006 @@ -82,3 +82,10 @@ device_t dev; device_t child; }; + +METHOD int find_extcap { + device_t dev; + device_t child; + int capability; + int *capreg; +}; diff -urN --exclude *.orig ./sys/dev/pci/pci_private.h ../src-patched/sys/dev/pci/pci_private.h --- ./sys/dev/pci/pci_private.h Mon Jan 30 19:38:08 2006 +++ ../src-patched/sys/dev/pci/pci_private.h Thu May 25 13:03:32 2006 @@ -61,6 +61,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); diff -urN --exclude *.orig ./sys/dev/pci/pcivar.h ../src-patched/sys/dev/pci/pcivar.h --- ./sys/dev/pci/pcivar.h Mon Jan 30 19:34:41 2006 +++ ../src-patched/sys/dev/pci/pcivar.h Thu May 25 13:03:32 2006 @@ -343,6 +343,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_ */ diff -urN --exclude *.orig ./sys/dev/pci/vga_pci.c ../src-patched/sys/dev/pci/vga_pci.c --- ./sys/dev/pci/vga_pci.c Thu Jan 1 01:00:00 1970 +++ ../src-patched/sys/dev/pci/vga_pci.c Thu May 25 13:03:32 2006 @@ -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); diff -urN --exclude *.orig ./sys/i386/pci/pci_bus.c ../src-patched/sys/i386/pci/pci_bus.c --- ./sys/i386/pci/pci_bus.c Sun Sep 18 04:55:10 2005 +++ ../src-patched/sys/i386/pci/pci_bus.c Thu May 25 13:03:32 2006 @@ -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 diff -urN --exclude *.orig ./sys/pci/agp.c ../src-patched/sys/pci/agp.c --- ./sys/pci/agp.c Wed Dec 28 17:52:45 2005 +++ ../src-patched/sys/pci/agp.c Thu May 25 13:03:32 2006 @@ -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; @@ -852,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 @@ -873,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; } diff -urN --exclude *.orig ./sys/pci/agp_ali.c ../src-patched/sys/pci/agp_ali.c --- ./sys/pci/agp_ali.c Sun Feb 27 14:05:34 2005 +++ ../src-patched/sys/pci/agp_ali.c Thu May 25 13:03:32 2006 @@ -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); diff -urN --exclude *.orig ./sys/pci/agp_amd.c ../src-patched/sys/pci/agp_amd.c --- ./sys/pci/agp_amd.c Thu Feb 24 22:32:55 2005 +++ ../src-patched/sys/pci/agp_amd.c Thu May 25 13:03:32 2006 @@ -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); diff -urN --exclude *.orig ./sys/pci/agp_amd64.c ../src-patched/sys/pci/agp_amd64.c --- ./sys/pci/agp_amd64.c Mon Nov 14 23:48:30 2005 +++ ../src-patched/sys/pci/agp_amd64.c Thu May 25 13:03:32 2006 @@ -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); diff -urN --exclude *.orig ./sys/pci/agp_ati.c ../src-patched/sys/pci/agp_ati.c --- ./sys/pci/agp_ati.c Mon Nov 14 22:14:14 2005 +++ ../src-patched/sys/pci/agp_ati.c Thu May 25 13:03:32 2006 @@ -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); diff -urN --exclude *.orig ./sys/pci/agp_i810.c ../src-patched/sys/pci/agp_i810.c --- ./sys/pci/agp_i810.c Wed Dec 14 01:47:25 2005 +++ ../src-patched/sys/pci/agp_i810.c Thu May 25 13:03:32 2006 @@ -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 @@ -464,7 +460,6 @@ { struct agp_i810_softc *sc = device_get_softc(dev); int error; - device_t child; error = agp_generic_detach(dev); if (error) @@ -498,10 +493,6 @@ sc->regs); } - child = device_find_child( dev, "drmsub", 0 ); - if (child) - device_delete_child( dev, child ); - return 0; } @@ -806,26 +797,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 +815,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 +826,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); diff -urN --exclude *.orig ./sys/pci/agp_intel.c ../src-patched/sys/pci/agp_intel.c --- ./sys/pci/agp_intel.c Wed Dec 14 01:46:23 2005 +++ ../src-patched/sys/pci/agp_intel.c Thu May 25 13:03:32 2006 @@ -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); diff -urN --exclude *.orig ./sys/pci/agp_nvidia.c ../src-patched/sys/pci/agp_nvidia.c --- ./sys/pci/agp_nvidia.c Mon Nov 14 22:10:39 2005 +++ ../src-patched/sys/pci/agp_nvidia.c Thu May 25 13:03:32 2006 @@ -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); diff -urN --exclude *.orig ./sys/pci/agp_sis.c ../src-patched/sys/pci/agp_sis.c --- ./sys/pci/agp_sis.c Thu Feb 24 22:32:55 2005 +++ ../src-patched/sys/pci/agp_sis.c Thu May 25 13:03:32 2006 @@ -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); diff -urN --exclude *.orig ./sys/pci/agp_via.c ../src-patched/sys/pci/agp_via.c --- ./sys/pci/agp_via.c Sun Jun 26 06:01:11 2005 +++ ../src-patched/sys/pci/agp_via.c Thu May 25 13:03:32 2006 @@ -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); diff -urN --exclude *.orig ./sys/pci/agpreg.h ../src-patched/sys/pci/agpreg.h --- ./sys/pci/agpreg.h Wed Dec 14 01:47:25 2005 +++ ../src-patched/sys/pci/agpreg.h Thu May 25 13:03:32 2006 @@ -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 diff -urN --exclude *.orig ./sys/pci/agpvar.h ../src-patched/sys/pci/agpvar.h --- ./sys/pci/agpvar.h Wed Dec 19 09:54:29 2001 +++ ../src-patched/sys/pci/agpvar.h Thu May 25 13:03:32 2006 @@ -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; diff -urN --exclude *.orig ./sys/sparc64/pci/ofw_pcibus.c ../src-patched/sys/sparc64/pci/ofw_pcibus.c --- ./sys/sparc64/pci/ofw_pcibus.c Wed Mar 23 19:16:26 2005 +++ ../src-patched/sys/sparc64/pci/ofw_pcibus.c Thu May 25 13:03:32 2006 @@ -108,6 +108,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_compat, ofw_pcibus_get_compat),