Deleted Added
full compact
agpvar.h (153563) agpvar.h (173573)
1/*-
2 * Copyright (c) 2000 Doug Rabson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 2000 Doug Rabson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/dev/agp/agpvar.h 153563 2005-12-20 20:05:21Z jhb $
26 * $FreeBSD: head/sys/dev/agp/agpvar.h 173573 2007-11-12 21:51:38Z jhb $
27 */
28
29#ifndef _PCI_AGPVAR_H_
30#define _PCI_AGPVAR_H_
31
32/*
33 * The AGP chipset can be acquired by user or kernel code. If the
34 * chipset has already been acquired, it cannot be acquired by another
35 * user until the previous user has released it.
36 */
37enum agp_acquire_state {
38 AGP_ACQUIRE_FREE,
39 AGP_ACQUIRE_USER,
40 AGP_ACQUIRE_KERNEL
41};
42
43/*
44 * This structure is used to query the state of the AGP system.
45 */
46struct agp_info {
47 u_int32_t ai_mode;
48 vm_offset_t ai_aperture_base;
49 vm_size_t ai_aperture_size;
50 vm_size_t ai_memory_allowed;
51 vm_size_t ai_memory_used;
52 u_int32_t ai_devid;
53};
54
55struct agp_memory_info {
56 vm_size_t ami_size; /* size in bytes */
57 vm_offset_t ami_physical; /* bogus hack for i810 */
58 vm_offset_t ami_offset; /* page offset if bound */
59 int ami_is_bound; /* non-zero if bound */
60};
61
62/*
63 * Find the AGP device and return it.
64 */
65device_t agp_find_device(void);
66
67/*
68 * Return the current owner of the AGP chipset.
69 */
70enum agp_acquire_state agp_state(device_t dev);
71
72/*
73 * Query the state of the AGP system.
74 */
75void agp_get_info(device_t dev, struct agp_info *info);
76
77/*
78 * Acquire the AGP chipset for use by the kernel. Returns EBUSY if the
79 * AGP chipset is already acquired by another user.
80 */
81int agp_acquire(device_t dev);
82
83/*
84 * Release the AGP chipset.
85 */
86int agp_release(device_t dev);
87
88/*
89 * Enable the agp hardware with the relavent mode. The mode bits are
27 */
28
29#ifndef _PCI_AGPVAR_H_
30#define _PCI_AGPVAR_H_
31
32/*
33 * The AGP chipset can be acquired by user or kernel code. If the
34 * chipset has already been acquired, it cannot be acquired by another
35 * user until the previous user has released it.
36 */
37enum agp_acquire_state {
38 AGP_ACQUIRE_FREE,
39 AGP_ACQUIRE_USER,
40 AGP_ACQUIRE_KERNEL
41};
42
43/*
44 * This structure is used to query the state of the AGP system.
45 */
46struct agp_info {
47 u_int32_t ai_mode;
48 vm_offset_t ai_aperture_base;
49 vm_size_t ai_aperture_size;
50 vm_size_t ai_memory_allowed;
51 vm_size_t ai_memory_used;
52 u_int32_t ai_devid;
53};
54
55struct agp_memory_info {
56 vm_size_t ami_size; /* size in bytes */
57 vm_offset_t ami_physical; /* bogus hack for i810 */
58 vm_offset_t ami_offset; /* page offset if bound */
59 int ami_is_bound; /* non-zero if bound */
60};
61
62/*
63 * Find the AGP device and return it.
64 */
65device_t agp_find_device(void);
66
67/*
68 * Return the current owner of the AGP chipset.
69 */
70enum agp_acquire_state agp_state(device_t dev);
71
72/*
73 * Query the state of the AGP system.
74 */
75void agp_get_info(device_t dev, struct agp_info *info);
76
77/*
78 * Acquire the AGP chipset for use by the kernel. Returns EBUSY if the
79 * AGP chipset is already acquired by another user.
80 */
81int agp_acquire(device_t dev);
82
83/*
84 * Release the AGP chipset.
85 */
86int agp_release(device_t dev);
87
88/*
89 * Enable the agp hardware with the relavent mode. The mode bits are
90 * defined in <pci/agpreg.h>
90 * defined in <dev/agp/agpreg.h>
91 */
92int agp_enable(device_t dev, u_int32_t mode);
93
94/*
95 * Allocate physical memory suitable for mapping into the AGP
96 * aperture. The value returned is an opaque handle which can be
97 * passed to agp_bind(), agp_unbind() or agp_deallocate().
98 */
99void *agp_alloc_memory(device_t dev, int type, vm_size_t bytes);
100
101/*
102 * Free memory which was allocated with agp_allocate().
103 */
104void agp_free_memory(device_t dev, void *handle);
105
106/*
107 * Bind memory allocated with agp_allocate() at a given offset within
108 * the AGP aperture. Returns EINVAL if the memory is already bound or
109 * the offset is not at an AGP page boundary.
110 */
111int agp_bind_memory(device_t dev, void *handle, vm_offset_t offset);
112
113/*
114 * Unbind memory from the AGP aperture. Returns EINVAL if the memory
115 * is not bound.
116 */
117int agp_unbind_memory(device_t dev, void *handle);
118
119/*
120 * Retrieve information about a memory block allocated with
121 * agp_alloc_memory().
122 */
123void agp_memory_info(device_t dev, void *handle, struct agp_memory_info *mi);
124
125#endif /* !_PCI_AGPVAR_H_ */
91 */
92int agp_enable(device_t dev, u_int32_t mode);
93
94/*
95 * Allocate physical memory suitable for mapping into the AGP
96 * aperture. The value returned is an opaque handle which can be
97 * passed to agp_bind(), agp_unbind() or agp_deallocate().
98 */
99void *agp_alloc_memory(device_t dev, int type, vm_size_t bytes);
100
101/*
102 * Free memory which was allocated with agp_allocate().
103 */
104void agp_free_memory(device_t dev, void *handle);
105
106/*
107 * Bind memory allocated with agp_allocate() at a given offset within
108 * the AGP aperture. Returns EINVAL if the memory is already bound or
109 * the offset is not at an AGP page boundary.
110 */
111int agp_bind_memory(device_t dev, void *handle, vm_offset_t offset);
112
113/*
114 * Unbind memory from the AGP aperture. Returns EINVAL if the memory
115 * is not bound.
116 */
117int agp_unbind_memory(device_t dev, void *handle);
118
119/*
120 * Retrieve information about a memory block allocated with
121 * agp_alloc_memory().
122 */
123void agp_memory_info(device_t dev, void *handle, struct agp_memory_info *mi);
124
125#endif /* !_PCI_AGPVAR_H_ */