- Bump FreeBSD version for the hostb(4) and vgapci(4) drivers as well as
the addition of pci_find_extcap(). - Change the drm drivers to attach to vgapci. This is #ifdef'd so the code can be shared across branches. - Use pci_find_extcap() to look for AGP and PCIE capabilities in drm. - GC all the drmsub stuff for i810/i830/i915. The agp and drm devices are now both children of vgapci.
This commit is contained in:
parent
55a8727781
commit
1bbc1eaa87
@ -178,7 +178,8 @@ agp_i810_find_bridge(device_t dev)
|
||||
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 @@ agp_i810_probe(device_t dev)
|
||||
return ENXIO;
|
||||
}
|
||||
|
||||
device_verbose(dev);
|
||||
device_set_desc(dev, desc);
|
||||
return BUS_PROBE_DEFAULT;
|
||||
}
|
||||
@ -452,11 +452,7 @@ agp_i810_attach(device_t dev)
|
||||
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 @@ agp_i810_detach(device_t dev)
|
||||
{
|
||||
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 @@ agp_i810_detach(device_t dev)
|
||||
sc->regs);
|
||||
}
|
||||
|
||||
child = device_find_child( dev, "drmsub", 0 );
|
||||
if (child)
|
||||
device_delete_child( dev, child );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -806,26 +797,11 @@ agp_i810_unbind_memory(device_t dev, struct agp_memory *mem)
|
||||
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 @@ static device_method_t agp_i810_methods[] = {
|
||||
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 driver_t agp_i810_driver = {
|
||||
|
||||
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);
|
||||
|
@ -56,6 +56,10 @@ 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;
|
||||
@ -84,6 +88,7 @@ drm_device_find_capability(drm_device_t *dev, int cap)
|
||||
}
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
#else
|
||||
/* XXX: fill me in for non-FreeBSD */
|
||||
return 1;
|
||||
|
@ -153,6 +153,7 @@ int drm_probe(device_t dev, drm_pci_id_list_t *idlist)
|
||||
{
|
||||
drm_pci_id_list_t *id_entry;
|
||||
int vendor, device;
|
||||
#if __FreeBSD_version < 700010
|
||||
device_t realdev;
|
||||
|
||||
if (!strcmp(device_get_name(dev), "drmsub"))
|
||||
@ -161,6 +162,10 @@ int drm_probe(device_t dev, drm_pci_id_list_t *idlist)
|
||||
realdev = dev;
|
||||
vendor = pci_get_vendor(realdev);
|
||||
device = pci_get_device(realdev);
|
||||
#else
|
||||
vendor = pci_get_vendor(dev);
|
||||
device = pci_get_device(dev);
|
||||
#endif
|
||||
|
||||
id_entry = drm_find_description(vendor, device, idlist);
|
||||
if (id_entry != NULL) {
|
||||
@ -180,11 +185,14 @@ int drm_attach(device_t nbdev, drm_pci_id_list_t *idlist)
|
||||
unit = device_get_unit(nbdev);
|
||||
dev = device_get_softc(nbdev);
|
||||
|
||||
#if __FreeBSD_version < 700010
|
||||
if (!strcmp(device_get_name(nbdev), "drmsub"))
|
||||
dev->device = device_get_parent(nbdev);
|
||||
else
|
||||
dev->device = nbdev;
|
||||
|
||||
#else
|
||||
dev->device = nbdev;
|
||||
#endif
|
||||
dev->devnode = make_dev(&drm_cdevsw,
|
||||
unit,
|
||||
DRM_DEV_UID,
|
||||
|
@ -98,13 +98,21 @@ static device_method_t i915_methods[] = {
|
||||
};
|
||||
|
||||
static driver_t i915_driver = {
|
||||
#if __FreeBSD_version >= 700010
|
||||
"drm",
|
||||
#else
|
||||
"drmsub",
|
||||
#endif
|
||||
i915_methods,
|
||||
sizeof(drm_device_t)
|
||||
};
|
||||
|
||||
extern devclass_t drm_devclass;
|
||||
#if __FreeBSD_version >= 700010
|
||||
DRIVER_MODULE(i915, vgapci, i915_driver, drm_devclass, 0, 0);
|
||||
#else
|
||||
DRIVER_MODULE(i915, agp, i915_driver, drm_devclass, 0, 0);
|
||||
#endif
|
||||
MODULE_DEPEND(i915, drm, 1, 1, 1);
|
||||
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
|
@ -109,7 +109,11 @@ static driver_t mach64_driver = {
|
||||
};
|
||||
|
||||
extern devclass_t drm_devclass;
|
||||
#if __FreeBSD_version >= 700010
|
||||
DRIVER_MODULE(mach64, vgapci, mach64_driver, drm_devclass, 0, 0);
|
||||
#else
|
||||
DRIVER_MODULE(mach64, pci, mach64_driver, drm_devclass, 0, 0);
|
||||
#endif
|
||||
MODULE_DEPEND(mach64, drm, 1, 1, 1);
|
||||
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
|
@ -64,6 +64,8 @@ static drm_pci_id_list_t mga_pciidlist[] = {
|
||||
*/
|
||||
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,14 @@ static int mga_driver_device_is_agp(drm_device_t * dev)
|
||||
* device is 0x0021 (HB6 Universal PCI-PCI bridge), we reject the
|
||||
* device.
|
||||
*/
|
||||
#if __FreeBSD_version >= 700010
|
||||
bus = device_get_parent(device_get_parent(dev->device));
|
||||
#else
|
||||
bus = device_get_parent(dev->device);
|
||||
#endif
|
||||
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 +155,11 @@ static driver_t mga_driver = {
|
||||
};
|
||||
|
||||
extern devclass_t drm_devclass;
|
||||
#if __FreeBSD_version >= 700010
|
||||
DRIVER_MODULE(mga, vgapci, mga_driver, drm_devclass, 0, 0);
|
||||
#else
|
||||
DRIVER_MODULE(mga, pci, mga_driver, drm_devclass, 0, 0);
|
||||
#endif
|
||||
MODULE_DEPEND(mga, drm, 1, 1, 1);
|
||||
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
|
@ -109,7 +109,11 @@ static driver_t r128_driver = {
|
||||
};
|
||||
|
||||
extern devclass_t drm_devclass;
|
||||
#if __FreeBSD_version >= 700010
|
||||
DRIVER_MODULE(r128, vgapci, r128_driver, drm_devclass, 0, 0);
|
||||
#else
|
||||
DRIVER_MODULE(r128, pci, r128_driver, drm_devclass, 0, 0);
|
||||
#endif
|
||||
MODULE_DEPEND(r128, drm, 1, 1, 1);
|
||||
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
|
@ -114,7 +114,11 @@ static driver_t radeon_driver = {
|
||||
};
|
||||
|
||||
extern devclass_t drm_devclass;
|
||||
#if __FreeBSD_version >= 700010
|
||||
DRIVER_MODULE(radeon, vgapci, radeon_driver, drm_devclass, 0, 0);
|
||||
#else
|
||||
DRIVER_MODULE(radeon, pci, radeon_driver, drm_devclass, 0, 0);
|
||||
#endif
|
||||
MODULE_DEPEND(radeon, drm, 1, 1, 1);
|
||||
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
|
@ -99,7 +99,11 @@ static driver_t savage_driver = {
|
||||
};
|
||||
|
||||
extern devclass_t drm_devclass;
|
||||
#if __FreeBSD_version >= 700010
|
||||
DRIVER_MODULE(savage, vgapci, savage_driver, drm_devclass, 0, 0);
|
||||
#else
|
||||
DRIVER_MODULE(savage, pci, savage_driver, drm_devclass, 0, 0);
|
||||
#endif
|
||||
MODULE_DEPEND(savage, drm, 1, 1, 1);
|
||||
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
|
@ -92,7 +92,11 @@ static driver_t sis_driver = {
|
||||
};
|
||||
|
||||
extern devclass_t drm_devclass;
|
||||
#if __FreeBSD_version >= 700010
|
||||
DRIVER_MODULE(sisdrm, vgapci, sis_driver, drm_devclass, 0, 0);
|
||||
#else
|
||||
DRIVER_MODULE(sisdrm, pci, sis_driver, drm_devclass, 0, 0);
|
||||
#endif
|
||||
MODULE_DEPEND(sisdrm, drm, 1, 1, 1);
|
||||
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
|
@ -93,7 +93,11 @@ static driver_t tdfx_driver = {
|
||||
};
|
||||
|
||||
extern devclass_t drm_devclass;
|
||||
#if __FreeBSD_version >= 700010
|
||||
DRIVER_MODULE(tdfx, vgapci, tdfx_driver, drm_devclass, 0, 0);
|
||||
#else
|
||||
DRIVER_MODULE(tdfx, pci, tdfx_driver, drm_devclass, 0, 0);
|
||||
#endif
|
||||
MODULE_DEPEND(tdfx, drm, 1, 1, 1);
|
||||
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
|
@ -178,7 +178,8 @@ agp_i810_find_bridge(device_t dev)
|
||||
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 @@ agp_i810_probe(device_t dev)
|
||||
return ENXIO;
|
||||
}
|
||||
|
||||
device_verbose(dev);
|
||||
device_set_desc(dev, desc);
|
||||
return BUS_PROBE_DEFAULT;
|
||||
}
|
||||
@ -452,11 +452,7 @@ agp_i810_attach(device_t dev)
|
||||
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 @@ agp_i810_detach(device_t dev)
|
||||
{
|
||||
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 @@ agp_i810_detach(device_t dev)
|
||||
sc->regs);
|
||||
}
|
||||
|
||||
child = device_find_child( dev, "drmsub", 0 );
|
||||
if (child)
|
||||
device_delete_child( dev, child );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -806,26 +797,11 @@ agp_i810_unbind_memory(device_t dev, struct agp_memory *mem)
|
||||
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 @@ static device_method_t agp_i810_methods[] = {
|
||||
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 driver_t agp_i810_driver = {
|
||||
|
||||
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);
|
||||
|
@ -57,7 +57,7 @@
|
||||
* is created, otherwise 1.
|
||||
*/
|
||||
#undef __FreeBSD_version
|
||||
#define __FreeBSD_version 700009 /* Master, propagated to newvers */
|
||||
#define __FreeBSD_version 700010 /* Master, propagated to newvers */
|
||||
|
||||
#ifndef LOCORE
|
||||
#include <sys/types.h>
|
||||
|
Loading…
Reference in New Issue
Block a user