summaryrefslogtreecommitdiffstats
path: root/sys/dev/agp/agp_if.m
blob: faf7b1ab8fdfbaf5cbbefdaddb37925750f164c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#-
# Copyright (c) 2000 Doug Rabson
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD$
#

#include <sys/bus.h>

#
# The AGP interface is used internally to the agp driver to isolate the
# differences between various AGP chipsets into chipset mini drivers. It
# should not be used outside the AGP driver. The kernel api for accessing
# AGP functionality is described in <pci/agpvar.h>
#
INTERFACE agp;

#
# Return the current aperture size.
#
METHOD u_int32_t get_aperture {
	device_t	dev;
};

#
# Set the size of the aperture. Return EINVAL on error or 0 on success.
#
METHOD int set_aperture {
	device_t	dev;
	u_int32_t	aperture;
};

#
# Bind a single page in the AGP aperture to a given physical address.
# The offset is a byte offset within the aperture which must be
# aligned to an AGP page boundary.
#
METHOD int bind_page {
	device_t	dev;
	vm_offset_t	offset;
	vm_offset_t	physical;
};

#
# Unbind a single page in the AGP aperture.
#
METHOD int unbind_page {
	device_t	dev;
	vm_offset_t	offset;
};

#
# Flush the GATT TLB. This is used after a call to bind_page to
# ensure that any mappings cached in the chipset are discarded.
#
METHOD void flush_tlb {
	device_t	dev;
};

#
# Enable the agp hardware with the relavent mode. The mode bits are
# defined in <pci/agpreg.h>
#
METHOD int enable {
	device_t	dev;
	u_int32_t	mode;
};

#
# Allocate memory of a given type. The type is a chipset-specific
# code which is used by certain integrated agp graphics chips
# (basically just the i810 for now) to access special features of
# the chipset. An opaque handle representing the memory region is
# returned and can be used as an argument to free_memory, bind_memory 
# and unbind_memory.
#
# The size is specified in bytes but must be a multiple of the AGP
# page size.
#
METHOD struct agp_memory * alloc_memory {
	device_t	dev;
	int		type;
	vm_size_t	size;
};

#
# Free a memory region previously allocated with alloc_memory. Return
# EBUSY if the memory is bound.
#
METHOD int free_memory {
	device_t	dev;
	struct agp_memory *mem;
};

#
# Bind a memory region to a specific byte offset within the chipset's
# AGP aperture. This effectively defines a range of contiguous
# physical address which alias the (possibly uncontiguous) pages in
# the memory region.
#
METHOD int bind_memory {
	device_t	dev;
	struct agp_memory *mem;
	vm_offset_t	offset;
};

#
# Unbind a memory region bound with bind_memory.
#
METHOD int unbind_memory {
	device_t	dev;
	struct agp_memory *handle;
};
OpenPOWER on IntegriCloud