After loosing some hairs trying to figure out where I screw up in
mmaping the AGP aperture, here's a trivial fix.

Diff below corrects the first argument of the agpmmap() function that
should be a dev_t and not a pointer to the driver's descriptor.

Ok?

Index: agp.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/agp.c,v
retrieving revision 1.34
diff -u -p -r1.34 agp.c
--- agp.c       26 Dec 2010 15:41:00 -0000      1.34
+++ agp.c       12 Nov 2012 18:20:48 -0000
@@ -60,7 +60,7 @@ int   agp_generic_free_memory(struct agp_s
 void   agp_attach(struct device *, struct device *, void *);
 int    agp_probe(struct device *, void *, void *);
 int    agpbusprint(void *, const char *);
-paddr_t        agpmmap(void *, off_t, int);
+paddr_t        agpmmap(dev_t, off_t, int);
 int    agpioctl(dev_t, u_long, caddr_t, int, struct proc *);
 int    agpopen(dev_t, int, int, struct proc *);
 int    agpclose(dev_t, int, int , struct proc *);
@@ -206,9 +206,12 @@ struct cfdriver agp_cd = {
 };
 
 paddr_t
-agpmmap(void *v, off_t off, int prot)
+agpmmap(dev_t dev, off_t off, int prot)
 {
-       struct agp_softc* sc = (struct agp_softc *)v;
+       struct agp_softc *sc = agp_find_device(AGPUNIT(dev));
+
+        if (sc == NULL || sc->sc_chipc == NULL)
+                return (-1);
 
        if (sc->sc_apaddr) {

Reply via email to