diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2014-03-14 23:42:42 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2014-03-14 23:42:42 +0000 |
commit | 6269b72af6891dcd8519ea9ca6048764d03f353e (patch) | |
tree | 277b80984face488e3a24f206f3667bbaf6ee501 /sys/dev/pci | |
parent | cbe3de21ea36ce1abe4abeea1c5a6205f0f3541e (diff) |
Remove the userland AGP interface. Now that we have KMS, it is no longer
used by any of the remaining xenocara drivers. Except perhaps for the
legacy i810 support in the xf86-video-intel driver. But i810 support has
almost certainly been broken for more than a year now, and any remaining
users are probably better off using the xf86-video-vesa driver ever since
XAA support was removed from the X server.
ok deraadt@, jsg@, mpi@
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/agp.c | 194 |
1 files changed, 1 insertions, 193 deletions
diff --git a/sys/dev/pci/agp.c b/sys/dev/pci/agp.c index 8fc3869d720..4bd3b849eed 100644 --- a/sys/dev/pci/agp.c +++ b/sys/dev/pci/agp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: agp.c,v 1.38 2013/08/06 09:45:32 jsg Exp $ */ +/* $OpenBSD: agp.c,v 1.39 2014/03/14 23:42:41 kettenis Exp $ */ /*- * Copyright (c) 2000 Doug Rabson * All rights reserved. @@ -68,14 +68,7 @@ int agpclose(dev_t, int, int , struct proc *); struct agp_memory *agp_find_memory(struct agp_softc *, int); struct agp_memory *agp_lookup_memory(struct agp_softc *, off_t); -/* userland ioctl functions */ int agpvga_match(struct pci_attach_args *); -int agp_info_user(void *, agp_info *); -int agp_setup_user(void *, agp_setup *); -int agp_allocate_user(void *, agp_allocate *); -int agp_deallocate_user(void *, int); -int agp_bind_user(void *, agp_bind *); -int agp_unbind_user(void *, agp_unbind *); int agp_acquire_helper(void *dev, enum agp_acquire_state state); int agp_release_helper(void *dev, enum agp_acquire_state state); @@ -208,101 +201,6 @@ struct cfdriver agp_cd = { NULL, "agp", DV_DULL }; -paddr_t -agpmmap(dev_t dev, off_t off, int prot) -{ - struct agp_softc *sc = agp_find_device(AGPUNIT(dev)); - - if (sc == NULL) - return (-1); - - return agp_mmap(sc, off, prot); -} -int -agpopen(dev_t dev, int oflags, int devtype, struct proc *p) -{ - struct agp_softc *sc = agp_find_device(AGPUNIT(dev)); - - if (sc == NULL || sc->sc_chipc == NULL) - return (ENXIO); - - if (!sc->sc_opened) - sc->sc_opened = 1; - else - return (EBUSY); - - return (0); -} - - -int -agpioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *pb) -{ - struct agp_softc *sc = agp_find_device(AGPUNIT(dev)); - - if (sc == NULL) - return (ENODEV); - - if (sc->sc_methods == NULL || sc->sc_chipc == NULL) - return (ENXIO); - - if (cmd != AGPIOC_INFO && !(flag & FWRITE)) - return (EPERM); - - switch(cmd) { - case AGPIOC_INFO: - return (agp_info_user(sc, (agp_info *)addr)); - - case AGPIOC_ACQUIRE: - return (agp_acquire_helper(sc, AGP_ACQUIRE_USER)); - - case AGPIOC_RELEASE: - return (agp_release_helper(sc, AGP_ACQUIRE_USER)); - - case AGPIOC_SETUP: - return (agp_setup_user(sc, (agp_setup *)addr)); - - case AGPIOC_ALLOCATE: - return (agp_allocate_user(sc, (agp_allocate *)addr)); - - case AGPIOC_DEALLOCATE: - return (agp_deallocate_user(sc, *(int *)addr)); - - case AGPIOC_BIND: - return (agp_bind_user(sc, (agp_bind *)addr)); - - case AGPIOC_UNBIND: - return (agp_unbind_user(sc, (agp_unbind *)addr)); - - default: - return (ENOTTY); - } - -} - -int -agpclose(dev_t dev, int flags, int devtype, struct proc *p) -{ - struct agp_softc *sc = agp_find_device(AGPUNIT(dev)); - struct agp_memory *mem; - - /* - * Clear the GATT and force release on last close - */ - if (sc->sc_state == AGP_ACQUIRE_USER) { - while ((mem = TAILQ_FIRST(&sc->sc_memory)) != 0) { - if (mem->am_is_bound) { - agp_unbind_memory(sc, mem); - } - agp_free_memory(sc, mem); - } - agp_release_helper(sc, AGP_ACQUIRE_USER); - } - sc->sc_opened = 0; - - return (0); -} - struct agp_memory * agp_find_memory(struct agp_softc *sc, int id) { @@ -697,96 +595,6 @@ agp_release_helper(void *dev, enum agp_acquire_state state) return (0); } -/* Implementation of the userland ioctl API */ - -int -agp_info_user(void *dev, agp_info *info) -{ - struct agp_softc *sc = (struct agp_softc *) dev; - - if (!sc->sc_chipc) - return (ENXIO); - - bzero(info, sizeof *info); - info->bridge_id = sc->sc_id; - if (sc->sc_capoff != 0) - info->agp_mode = pci_conf_read(sc->sc_pc, sc->sc_pcitag, - AGP_STATUS + sc->sc_capoff); - else - info->agp_mode = 0; /* i810 doesn't have real AGP */ - info->aper_base = sc->sc_apaddr; - info->aper_size = sc->sc_apsize >> 20; - info->pg_total = - info->pg_system = sc->sc_maxmem >> AGP_PAGE_SHIFT; - info->pg_used = sc->sc_allocated >> AGP_PAGE_SHIFT; - - return (0); -} - -int -agp_setup_user(void *dev, agp_setup *setup) -{ - struct agp_softc *sc = dev; - - return (agp_enable(sc, setup->agp_mode)); -} - -int -agp_allocate_user(void *dev, agp_allocate *alloc) -{ - struct agp_softc *sc = dev; - struct agp_memory *mem; - size_t size = alloc->pg_count << AGP_PAGE_SHIFT; - - if (sc->sc_allocated + size > sc->sc_maxmem) - return (EINVAL); - - mem = agp_alloc_memory(sc, alloc->type, size); - if (mem) { - alloc->key = mem->am_id; - alloc->physical = mem->am_physical; - return (0); - } else - return (ENOMEM); -} - -int -agp_deallocate_user(void *dev, int id) -{ - struct agp_softc *sc = dev; - struct agp_memory *mem; - - if ((mem = agp_find_memory(sc, id)) != NULL) { - agp_free_memory(sc, mem); - return (0); - } else - return (ENOENT); -} - -int -agp_bind_user(void *dev, agp_bind *bind) -{ - struct agp_softc *sc = dev; - struct agp_memory *mem; - - if ((mem = agp_find_memory(sc, bind->key)) == NULL) - return (ENOENT); - return (agp_bind_memory(sc, mem, bind->pg_start << AGP_PAGE_SHIFT)); -} - - -int -agp_unbind_user(void *dev, agp_unbind *unbind) -{ - struct agp_softc *sc = dev; - struct agp_memory *mem; - - if ((mem = agp_find_memory(sc, unbind->key)) == NULL) - return (ENOENT); - - return (agp_unbind_memory(sc, mem)); -} - /* Implementation of the kernel api */ void * |