agp_if.m revision 173573
1139825Simp#- 261452Sdfr# Copyright (c) 2000 Doug Rabson 361452Sdfr# All rights reserved. 461452Sdfr# 561452Sdfr# Redistribution and use in source and binary forms, with or without 661452Sdfr# modification, are permitted provided that the following conditions 761452Sdfr# are met: 861452Sdfr# 1. Redistributions of source code must retain the above copyright 961452Sdfr# notice, this list of conditions and the following disclaimer. 1061452Sdfr# 2. Redistributions in binary form must reproduce the above copyright 1161452Sdfr# notice, this list of conditions and the following disclaimer in the 1261452Sdfr# documentation and/or other materials provided with the distribution. 1361452Sdfr# 1461452Sdfr# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1561452Sdfr# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1661452Sdfr# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1761452Sdfr# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1861452Sdfr# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1961452Sdfr# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2061452Sdfr# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2161452Sdfr# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2261452Sdfr# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2361452Sdfr# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2461452Sdfr# SUCH DAMAGE. 2561452Sdfr# 2661452Sdfr# $FreeBSD: head/sys/dev/agp/agp_if.m 173573 2007-11-12 21:51:38Z jhb $ 2761452Sdfr# 2861452Sdfr 2961452Sdfr#include <sys/bus.h> 3061452Sdfr 3161452Sdfr# 3261452Sdfr# The AGP interface is used internally to the agp driver to isolate the 3361452Sdfr# differences between various AGP chipsets into chipset mini drivers. It 3461452Sdfr# should not be used outside the AGP driver. The kernel api for accessing 35173573Sjhb# AGP functionality is described in <dev/agp/agpvar.h> 3661452Sdfr# 3761452SdfrINTERFACE agp; 3861452Sdfr 3961452Sdfr# 4061452Sdfr# Return the current aperture size. 4161452Sdfr# 4261452SdfrMETHOD u_int32_t get_aperture { 4361452Sdfr device_t dev; 4461452Sdfr}; 4561452Sdfr 4661452Sdfr# 4761452Sdfr# Set the size of the aperture. Return EINVAL on error or 0 on success. 4861452Sdfr# 4961452SdfrMETHOD int set_aperture { 5061452Sdfr device_t dev; 5161452Sdfr u_int32_t aperture; 5261452Sdfr}; 5361452Sdfr 5461452Sdfr# 5561452Sdfr# Bind a single page in the AGP aperture to a given physical address. 5661452Sdfr# The offset is a byte offset within the aperture which must be 5761452Sdfr# aligned to an AGP page boundary. 5861452Sdfr# 5961452SdfrMETHOD int bind_page { 6061452Sdfr device_t dev; 6161452Sdfr vm_offset_t offset; 6261452Sdfr vm_offset_t physical; 6361452Sdfr}; 6461452Sdfr 6561452Sdfr# 6661452Sdfr# Unbind a single page in the AGP aperture. 6761452Sdfr# 6861452SdfrMETHOD int unbind_page { 6961452Sdfr device_t dev; 7061452Sdfr vm_offset_t offset; 7161452Sdfr}; 7261452Sdfr 7361452Sdfr# 7461452Sdfr# Flush the GATT TLB. This is used after a call to bind_page to 7561452Sdfr# ensure that any mappings cached in the chipset are discarded. 7661452Sdfr# 7761452SdfrMETHOD void flush_tlb { 7861452Sdfr device_t dev; 7961452Sdfr}; 8061452Sdfr 8161452Sdfr# 8261452Sdfr# Enable the agp hardware with the relavent mode. The mode bits are 83173573Sjhb# defined in <dev/agp/agpreg.h> 8461452Sdfr# 8561452SdfrMETHOD int enable { 8661452Sdfr device_t dev; 8761452Sdfr u_int32_t mode; 8861452Sdfr}; 8961452Sdfr 9061452Sdfr# 9161452Sdfr# Allocate memory of a given type. The type is a chipset-specific 9261452Sdfr# code which is used by certain integrated agp graphics chips 9361452Sdfr# (basically just the i810 for now) to access special features of 9461452Sdfr# the chipset. An opaque handle representing the memory region is 9561452Sdfr# returned and can be used as an argument to free_memory, bind_memory 9661452Sdfr# and unbind_memory. 9761452Sdfr# 9861452Sdfr# The size is specified in bytes but must be a multiple of the AGP 9961452Sdfr# page size. 10061452Sdfr# 10161452SdfrMETHOD struct agp_memory * alloc_memory { 10261452Sdfr device_t dev; 10361452Sdfr int type; 10461452Sdfr vm_size_t size; 10561452Sdfr}; 10661452Sdfr 10761452Sdfr# 10861452Sdfr# Free a memory region previously allocated with alloc_memory. Return 10961452Sdfr# EBUSY if the memory is bound. 11061452Sdfr# 11161452SdfrMETHOD int free_memory { 11261452Sdfr device_t dev; 11361452Sdfr struct agp_memory *mem; 11461452Sdfr}; 11561452Sdfr 11661452Sdfr# 11761452Sdfr# Bind a memory region to a specific byte offset within the chipset's 11861452Sdfr# AGP aperture. This effectively defines a range of contiguous 11961452Sdfr# physical address which alias the (possibly uncontiguous) pages in 12061452Sdfr# the memory region. 12161452Sdfr# 12261452SdfrMETHOD int bind_memory { 12361452Sdfr device_t dev; 12461452Sdfr struct agp_memory *mem; 12561452Sdfr vm_offset_t offset; 12661452Sdfr}; 12761452Sdfr 12861452Sdfr# 12961452Sdfr# Unbind a memory region bound with bind_memory. 13061452Sdfr# 13161452SdfrMETHOD int unbind_memory { 13261452Sdfr device_t dev; 13361452Sdfr struct agp_memory *handle; 13461452Sdfr}; 135