FreeBSD kernel AGP device code
|
#include <sys/cdefs.h>
#include "opt_agp.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/bus.h>
#include <sys/conf.h>
#include <sys/ioccom.h>
#include <sys/agpio.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/rwlock.h>
#include <dev/agp/agppriv.h>
#include <dev/agp/agpvar.h>
#include <dev/agp/agpreg.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcireg.h>
#include <vm/vm.h>
#include <vm/vm_extern.h>
#include <vm/vm_kern.h>
#include <vm/vm_param.h>
#include <vm/vm_object.h>
#include <vm/vm_page.h>
#include <vm/vm_pageout.h>
#include <vm/pmap.h>
#include <machine/bus.h>
#include <machine/resource.h>
#include <sys/rman.h>
Go to the source code of this file.
Macros | |
#define | AGP_MAX_SIZE nitems(agp_max) |
Functions | |
__FBSDID ("$FreeBSD$") | |
MODULE_VERSION (agp, 1) | |
MALLOC_DEFINE (M_AGP, "agp", "AGP data structures") | |
u_int8_t | agp_find_caps (device_t dev) |
static device_t | agp_find_display (void) |
struct agp_gatt * | agp_alloc_gatt (device_t dev) |
void | agp_free_gatt (struct agp_gatt *gatt) |
void | agp_set_aperture_resource (device_t dev, int rid) |
int | agp_generic_attach (device_t dev) |
void | agp_free_cdev (device_t dev) |
void | agp_free_res (device_t dev) |
int | agp_generic_detach (device_t dev) |
u_int32_t | agp_generic_get_aperture (device_t dev) |
int | agp_generic_set_aperture (device_t dev, u_int32_t aperture) |
static int | agp_v3_enable (device_t dev, device_t mdev, u_int32_t mode) |
static int | agp_v2_enable (device_t dev, device_t mdev, u_int32_t mode) |
int | agp_generic_enable (device_t dev, u_int32_t mode) |
struct agp_memory * | agp_generic_alloc_memory (device_t dev, int type, vm_size_t size) |
int | agp_generic_free_memory (device_t dev, struct agp_memory *mem) |
int | agp_generic_bind_memory (device_t dev, struct agp_memory *mem, vm_offset_t offset) |
int | agp_generic_unbind_memory (device_t dev, struct agp_memory *mem) |
static int | agp_acquire_helper (device_t dev, enum agp_acquire_state state) |
static int | agp_release_helper (device_t dev, enum agp_acquire_state state) |
static struct agp_memory * | agp_find_memory (device_t dev, int id) |
static int | agp_info_user (device_t dev, agp_info *info) |
static int | agp_setup_user (device_t dev, agp_setup *setup) |
static int | agp_allocate_user (device_t dev, agp_allocate *alloc) |
static int | agp_deallocate_user (device_t dev, int id) |
static int | agp_bind_user (device_t dev, agp_bind *bind) |
static int | agp_unbind_user (device_t dev, agp_unbind *unbind) |
static int | agp_chipset_flush (device_t dev) |
static int | agp_open (struct cdev *kdev, int oflags, int devtype, struct thread *td) |
static int | agp_close (struct cdev *kdev, int fflag, int devtype, struct thread *td) |
static int | agp_ioctl (struct cdev *kdev, u_long cmd, caddr_t data, int fflag, struct thread *td) |
static int | agp_mmap (struct cdev *kdev, vm_ooffset_t offset, vm_paddr_t *paddr, int prot, vm_memattr_t *memattr) |
device_t | agp_find_device () |
enum agp_acquire_state | agp_state (device_t dev) |
void | agp_get_info (device_t dev, struct agp_info *info) |
int | agp_acquire (device_t dev) |
int | agp_release (device_t dev) |
int | agp_enable (device_t dev, u_int32_t mode) |
void * | agp_alloc_memory (device_t dev, int type, vm_size_t bytes) |
void | agp_free_memory (device_t dev, void *handle) |
int | agp_bind_memory (device_t dev, void *handle, vm_offset_t offset) |
int | agp_unbind_memory (device_t dev, void *handle) |
void | agp_memory_info (device_t dev, void *handle, struct agp_memory_info *mi) |
int | agp_bind_pages (device_t dev, vm_page_t *pages, vm_size_t size, vm_offset_t offset) |
int | agp_unbind_pages (device_t dev, vm_size_t size, vm_offset_t offset) |
Variables | |
static d_open_t | agp_open |
static d_close_t | agp_close |
static d_ioctl_t | agp_ioctl |
static d_mmap_t | agp_mmap |
static struct cdevsw | agp_cdevsw |
static devclass_t | agp_devclass |
static u_int | agp_max [][2] |
__FBSDID | ( | "$FreeBSD$" | ) |
int agp_acquire | ( | device_t | dev | ) |
Definition at line 954 of file agp.c.
References agp_acquire_helper(), and AGP_ACQUIRE_KERNEL.
|
static |
Definition at line 690 of file agp.c.
References AGP_ACQUIRE_FREE, and agp_softc::as_state.
Referenced by agp_acquire(), and agp_ioctl().
struct agp_gatt * agp_alloc_gatt | ( | device_t | dev | ) |
Definition at line 135 of file agp.c.
References agp_gatt::ag_entries, agp_gatt::ag_physical, and agp_gatt::ag_virtual.
Referenced by agp_ali_attach(), agp_amd64_attach(), agp_apple_attach(), agp_intel_attach(), agp_nvidia_attach(), agp_sis_attach(), and agp_via_attach().
void * agp_alloc_memory | ( | device_t | dev, |
int | type, | ||
vm_size_t | bytes | ||
) |
|
static |
Definition at line 760 of file agp.c.
References agp_memory::am_id, agp_memory::am_physical, and mem.
Referenced by agp_ioctl().
int agp_bind_memory | ( | device_t | dev, |
void * | handle, | ||
vm_offset_t | offset | ||
) |
int agp_bind_pages | ( | device_t | dev, |
vm_page_t * | pages, | ||
vm_size_t | size, | ||
vm_offset_t | offset | ||
) |
|
static |
Definition at line 790 of file agp.c.
References agp_find_memory(), and mem.
Referenced by agp_ioctl().
|
static |
Definition at line 812 of file agp.c.
Referenced by agp_ioctl().
|
static |
Definition at line 833 of file agp.c.
References AGP_ACQUIRE_USER, agp_release_helper(), agp_memory::am_is_bound, agp_softc::as_isopen, agp_softc::as_memory, agp_softc::as_state, and mem.
|
static |
Definition at line 777 of file agp.c.
References agp_find_memory(), and mem.
Referenced by agp_ioctl().
int agp_enable | ( | device_t | dev, |
u_int32_t | mode | ||
) |
u_int8_t agp_find_caps | ( | device_t | dev | ) |
Definition at line 92 of file agp.c.
Referenced by agp_ali_match(), agp_amd64_match(), agp_amd_match(), agp_apple_probe(), agp_ati_match(), agp_find_display(), agp_generic_enable(), agp_get_info(), agp_info_user(), agp_intel_match(), agp_sis_match(), agp_v2_enable(), agp_v3_enable(), agp_via_attach(), and agp_via_match().
device_t agp_find_device | ( | void | ) |
Definition at line 910 of file agp.c.
References agp_devclass.
|
static |
Definition at line 105 of file agp.c.
References agp_find_caps().
Referenced by agp_generic_enable().
|
static |
Definition at line 717 of file agp.c.
References AGP_DPF, agp_memory::am_id, agp_softc::as_memory, and mem.
Referenced by agp_bind_user(), agp_deallocate_user(), and agp_unbind_user().
void agp_free_cdev | ( | device_t | dev | ) |
Definition at line 282 of file agp.c.
References agp_softc::as_devalias, and agp_softc::as_devnode.
Referenced by agp_ali_detach(), agp_amd64_detach(), agp_amd_detach(), agp_apple_detach(), agp_ati_detach(), agp_generic_detach(), agp_i810_detach(), agp_intel_detach(), agp_nvidia_detach(), agp_sis_detach(), and agp_via_detach().
void agp_free_gatt | ( | struct agp_gatt * | gatt | ) |
Definition at line 171 of file agp.c.
References agp_gatt::ag_entries, and agp_gatt::ag_virtual.
Referenced by agp_ali_detach(), agp_amd64_detach(), agp_apple_detach(), agp_intel_detach(), agp_nvidia_detach(), agp_sis_detach(), and agp_via_detach().
void agp_free_memory | ( | device_t | dev, |
void * | handle | ||
) |
void agp_free_res | ( | device_t | dev | ) |
Definition at line 292 of file agp.c.
References agp_softc::as_aperture, agp_softc::as_aperture_rid, and agp_softc::as_lock.
Referenced by agp_ali_detach(), agp_amd64_detach(), agp_amd_detach(), agp_apple_detach(), agp_ati_detach(), agp_generic_attach(), agp_generic_detach(), agp_i810_detach(), agp_intel_detach(), agp_nvidia_detach(), agp_sis_detach(), and agp_via_detach().
struct agp_memory * agp_generic_alloc_memory | ( | device_t | dev, |
int | type, | ||
vm_size_t | size | ||
) |
Definition at line 496 of file agp.c.
References agp_memory::am_id, agp_memory::am_is_bound, agp_memory::am_obj, agp_memory::am_offset, agp_memory::am_physical, agp_memory::am_size, agp_memory::am_type, agp_softc::as_allocated, agp_softc::as_maxmem, agp_softc::as_memory, agp_softc::as_nextid, mem, size, and type.
int agp_generic_attach | ( | device_t | dev | ) |
Definition at line 206 of file agp.c.
References AGP_APBASE, agp_cdevsw, agp_devclass, agp_free_res(), agp_max, AGP_MAX_SIZE, agp_softc::as_aperture, agp_softc::as_aperture_rid, agp_softc::as_devalias, agp_softc::as_devnode, agp_softc::as_lock, agp_softc::as_maxmem, agp_softc::as_memory, and agp_softc::as_nextid.
Referenced by agp_ali_attach(), agp_amd64_attach(), agp_amd_attach(), agp_apple_attach(), agp_ati_attach(), agp_i810_attach(), agp_intel_attach(), agp_nvidia_attach(), agp_sis_attach(), and agp_via_attach().
int agp_generic_bind_memory | ( | device_t | dev, |
struct agp_memory * | mem, | ||
vm_offset_t | offset | ||
) |
Definition at line 543 of file agp.c.
References AGP_DPF, agp_memory::am_is_bound, agp_memory::am_obj, agp_memory::am_offset, agp_memory::am_size, agp_softc::as_lock, mem, and offset.
Referenced by agp_i810_bind_memory().
int agp_generic_detach | ( | device_t | dev | ) |
Definition at line 303 of file agp.c.
References agp_free_cdev(), and agp_free_res().
Referenced by agp_ali_attach(), agp_amd64_attach(), agp_amd_attach(), agp_apple_attach(), agp_ati_attach(), agp_i810_attach(), agp_intel_attach(), agp_nvidia_attach(), agp_sis_attach(), and agp_via_attach().
int agp_generic_enable | ( | device_t | dev, |
u_int32_t | mode | ||
) |
Definition at line 466 of file agp.c.
References AGP_DPF, agp_find_caps(), agp_find_display(), AGP_STATUS, agp_v2_enable(), agp_v3_enable(), and mode.
int agp_generic_free_memory | ( | device_t | dev, |
struct agp_memory * | mem | ||
) |
Definition at line 528 of file agp.c.
References agp_memory::am_is_bound, agp_memory::am_obj, agp_memory::am_size, agp_softc::as_allocated, agp_softc::as_memory, and mem.
u_int32_t agp_generic_get_aperture | ( | device_t | dev | ) |
Default AGP aperture size detection which simply returns the size of the aperture's PCI resource.
Definition at line 316 of file agp.c.
References agp_softc::as_aperture.
int agp_generic_set_aperture | ( | device_t | dev, |
u_int32_t | aperture | ||
) |
Default AGP aperture size setting function, which simply doesn't allow changes to resource size.
Definition at line 328 of file agp.c.
References aperture.
Referenced by agp_i915_set_aperture().
int agp_generic_unbind_memory | ( | device_t | dev, |
struct agp_memory * | mem | ||
) |
Definition at line 649 of file agp.c.
References agp_memory::am_is_bound, agp_memory::am_obj, agp_memory::am_offset, agp_memory::am_size, agp_softc::as_lock, and mem.
Referenced by agp_i810_unbind_memory().
void agp_get_info | ( | device_t | dev, |
struct agp_info * | info | ||
) |
Definition at line 938 of file agp.c.
References agp_find_caps(), AGP_STATUS, agp_info::ai_aperture_base, agp_info::ai_aperture_size, agp_info::ai_memory_allowed, agp_info::ai_memory_used, agp_info::ai_mode, agp_softc::as_allocated, agp_softc::as_aperture, and agp_softc::as_maxmem.
|
static |
Definition at line 734 of file agp.c.
References agp_find_caps(), AGP_STATUS, agp_softc::as_allocated, agp_softc::as_aperture, and agp_softc::as_maxmem.
Referenced by agp_ioctl().
|
static |
Definition at line 856 of file agp.c.
References agp_acquire_helper(), AGP_ACQUIRE_USER, agp_allocate_user(), agp_bind_user(), agp_chipset_flush(), agp_deallocate_user(), agp_info_user(), agp_release_helper(), agp_setup_user(), and agp_unbind_user().
void agp_memory_info | ( | device_t | dev, |
void * | handle, | ||
struct agp_memory_info * | mi | ||
) |
Definition at line 994 of file agp.c.
References agp_memory::am_is_bound, agp_memory::am_offset, agp_memory::am_physical, agp_memory::am_size, agp_memory_info::ami_is_bound, agp_memory_info::ami_offset, agp_memory_info::ami_physical, agp_memory_info::ami_size, handle, and mem.
|
static |
Definition at line 893 of file agp.c.
References agp_softc::as_aperture, and offset.
|
static |
Definition at line 819 of file agp.c.
References agp_softc::as_isopen.
int agp_release | ( | device_t | dev | ) |
Definition at line 960 of file agp.c.
References AGP_ACQUIRE_KERNEL, and agp_release_helper().
|
static |
Definition at line 702 of file agp.c.
References AGP_ACQUIRE_FREE, and agp_softc::as_state.
Referenced by agp_close(), agp_ioctl(), and agp_release().
void agp_set_aperture_resource | ( | device_t | dev, |
int | rid | ||
) |
Sets the PCI resource which represents the AGP aperture.
If not called, the default AGP aperture resource of AGP_APBASE will be used. Must be called before agp_generic_attach().
Definition at line 198 of file agp.c.
References agp_softc::as_aperture_rid.
Referenced by agp_apple_attach(), and agp_i810_attach().
|
static |
Definition at line 754 of file agp.c.
Referenced by agp_ioctl().
enum agp_acquire_state agp_state | ( | device_t | dev | ) |
Definition at line 931 of file agp.c.
References agp_softc::as_state.
int agp_unbind_memory | ( | device_t | dev, |
void * | handle | ||
) |
int agp_unbind_pages | ( | device_t | dev, |
vm_size_t | size, | ||
vm_offset_t | offset | ||
) |
Definition at line 1057 of file agp.c.
References agp_softc::as_lock, offset, and size.
|
static |
Definition at line 801 of file agp.c.
References agp_find_memory(), and mem.
Referenced by agp_ioctl().
|
static |
Definition at line 413 of file agp.c.
References AGP_COMMAND, agp_find_caps(), AGP_STATUS, and mode.
Referenced by agp_generic_enable().
|
static |
Definition at line 344 of file agp.c.
References AGP_COMMAND, agp_find_caps(), AGP_STATUS, and mode.
Referenced by agp_generic_enable().
MALLOC_DEFINE | ( | M_AGP | , |
"agp" | , | ||
"AGP data structures" | |||
) |
MODULE_VERSION | ( | agp | , |
1 | |||
) |
|
static |
|
static |
Definition at line 87 of file agp.c.
Referenced by agp_find_device(), and agp_generic_attach().
|
static |
Definition at line 178 of file agp.c.
Referenced by agp_generic_attach().