summaryrefslogtreecommitdiffstats
path: root/sys/pci/agp_i810.c
diff options
context:
space:
mode:
authoranholt <anholt@FreeBSD.org>2003-10-02 19:49:15 +0000
committeranholt <anholt@FreeBSD.org>2003-10-02 19:49:15 +0000
commit42456adc1b32005e92d93becf52ccdb2ffc55346 (patch)
treed04e60494cc5bb35dd6e1837865df38dbacdd2cd /sys/pci/agp_i810.c
parent835c0f8d8c3c988ae507c0f509f543dc79f7c1dd (diff)
downloadFreeBSD-src-42456adc1b32005e92d93becf52ccdb2ffc55346.zip
FreeBSD-src-42456adc1b32005e92d93becf52ccdb2ffc55346.tar.gz
Make the i810 AGP device create a "drmsub" child device. This will be attached
to by the DRM for i8xx devices. Submitted by: Keith Whitwell <keith@tungstengraphics.com>
Diffstat (limited to 'sys/pci/agp_i810.c')
-rw-r--r--sys/pci/agp_i810.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/sys/pci/agp_i810.c b/sys/pci/agp_i810.c
index aaf6d13..edbaff6 100644
--- a/sys/pci/agp_i810.c
+++ b/sys/pci/agp_i810.c
@@ -337,7 +337,7 @@ agp_i810_attach(device_t dev)
gatt->ag_physical = pgtblctl & ~1;
} else { /* CHIP_I855 */
- /* The 855GM automatically initializes the 128k gatt on boot. */
+ /* The i855 automatically initializes the 128k gatt on boot. */
unsigned int gcc1, pgtblctl;
gcc1 = pci_read_config(sc->bdev, AGP_I855_GCC1, 1);
@@ -375,7 +375,11 @@ agp_i810_attach(device_t dev)
gatt->ag_physical = pgtblctl & ~1;
}
- return 0;
+ /* 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);
}
static int
@@ -383,6 +387,7 @@ 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)
@@ -409,6 +414,10 @@ agp_i810_detach(device_t dev)
bus_release_resource(dev, SYS_RES_MEMORY,
AGP_I810_MMADR, sc->regs);
+ child = device_find_child( dev, "drmsub", 0 );
+ if (child)
+ device_delete_child( dev, child );
+
return 0;
}
@@ -676,6 +685,18 @@ 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),
@@ -697,6 +718,14 @@ 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 }
};
OpenPOWER on IntegriCloud