#-1# Copyright (c) 2000 Doug Rabson2# All rights reserved.3#4# Redistribution and use in source and binary forms, with or without5# modification, are permitted provided that the following conditions6# are met:7# 1. Redistributions of source code must retain the above copyright8# notice, this list of conditions and the following disclaimer.9# 2. Redistributions in binary form must reproduce the above copyright10# notice, this list of conditions and the following disclaimer in the11# documentation and/or other materials provided with the distribution.12#13# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND14# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE15# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE16# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE17# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL18# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS19# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)20# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT21# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY22# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF23# SUCH DAMAGE.24#25#2627#include <sys/bus.h>2829#30# The AGP interface is used internally to the agp driver to isolate the31# differences between various AGP chipsets into chipset mini drivers. It32# should not be used outside the AGP driver. The kernel api for accessing33# AGP functionality is described in <dev/agp/agpvar.h>34#35INTERFACE agp;3637CODE {38static int39null_agp_chipset_flush(device_t dev)40{41return (ENXIO);42}43};4445#46# Return the current aperture size.47#48METHOD u_int32_t get_aperture {49device_t dev;50};5152#53# Set the size of the aperture. Return EINVAL on error or 0 on success.54#55METHOD int set_aperture {56device_t dev;57u_int32_t aperture;58};5960#61# Bind a single page in the AGP aperture to a given physical address.62# The offset is a byte offset within the aperture which must be63# aligned to an AGP page boundary.64#65METHOD int bind_page {66device_t dev;67vm_offset_t offset;68vm_offset_t physical;69};7071#72# Unbind a single page in the AGP aperture.73#74METHOD int unbind_page {75device_t dev;76vm_offset_t offset;77};7879#80# Flush the GATT TLB. This is used after a call to bind_page to81# ensure that any mappings cached in the chipset are discarded.82#83METHOD void flush_tlb {84device_t dev;85};8687#88# Enable the agp hardware with the relavent mode. The mode bits are89# defined in <dev/agp/agpreg.h>90#91METHOD int enable {92device_t dev;93u_int32_t mode;94};9596#97# Allocate memory of a given type. The type is a chipset-specific98# code which is used by certain integrated agp graphics chips99# (basically just the i810 for now) to access special features of100# the chipset. An opaque handle representing the memory region is101# returned and can be used as an argument to free_memory, bind_memory102# and unbind_memory.103#104# The size is specified in bytes but must be a multiple of the AGP105# page size.106#107METHOD struct agp_memory * alloc_memory {108device_t dev;109int type;110vm_size_t size;111};112113#114# Free a memory region previously allocated with alloc_memory. Return115# EBUSY if the memory is bound.116#117METHOD int free_memory {118device_t dev;119struct agp_memory *mem;120};121122#123# Bind a memory region to a specific byte offset within the chipset's124# AGP aperture. This effectively defines a range of contiguous125# physical address which alias the (possibly uncontiguous) pages in126# the memory region.127#128METHOD int bind_memory {129device_t dev;130struct agp_memory *mem;131vm_offset_t offset;132};133134#135# Unbind a memory region bound with bind_memory.136#137METHOD int unbind_memory {138device_t dev;139struct agp_memory *handle;140};141142METHOD int chipset_flush {143device_t dev;144} DEFAULT null_agp_chipset_flush;145146147