diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2012-11-13 13:37:25 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2012-11-13 13:37:25 +0000 |
commit | 9911454765159d698b0fb2f47f6b6b0f8e40acf9 (patch) | |
tree | b78cd716d2224eaf548c2140d02fb3e8fb0c6ef2 /sys/dev/pci/agp.c | |
parent | 6c750a337e3a4a8bbad5120354b53f3e54e72b4f (diff) |
Correct the first argument of agpmmap() making possible to mmap the AGP
aperture.
ok kettenis@
Diffstat (limited to 'sys/dev/pci/agp.c')
-rw-r--r-- | sys/dev/pci/agp.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/dev/pci/agp.c b/sys/dev/pci/agp.c index c8719efe7f2..bd2a20f664d 100644 --- a/sys/dev/pci/agp.c +++ b/sys/dev/pci/agp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: agp.c,v 1.34 2010/12/26 15:41:00 miod Exp $ */ +/* $OpenBSD: agp.c,v 1.35 2012/11/13 13:37:24 mpi Exp $ */ /*- * Copyright (c) 2000 Doug Rabson * All rights reserved. @@ -60,7 +60,7 @@ int agp_generic_free_memory(struct agp_softc *, struct agp_memory *); 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) { |