2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
23 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
30 #ifndef _IOKIT_IOAGPDEVICE_H
31 #define _IOKIT_IOAGPDEVICE_H
33 #include <IOKit/IORangeAllocator.h>
34 #include <IOKit/pci/IOPCIDevice.h>
36 /* Definitions of AGP config registers */
38 kIOPCIConfigAGPStatusOffset
= 4,
39 kIOPCIConfigAGPCommandOffset
= 8
42 /* Definitions of AGP Command & Status registers */
44 kIOAGPRequestQueueMask
= 0xff000000,
45 kIOAGPSideBandAddresssing
= 0x00000200,
46 kIOAGPEnable
= 0x00000100,
47 kIOAGP4GbAddressing
= 0x00000020,
48 kIOAGP4xDataRate
= 0x00000004,
49 kIOAGP2xDataRate
= 0x00000002,
50 kIOAGP1xDataRate
= 0x00000001
54 kIOAGPGartInvalidate
= 0x00000001
57 // getAGPStatus() defines
59 kIOAGPDefaultStatus
= 0
62 kIOAGPIdle
= 0x00000001,
63 kIOAGPInvalidGARTEntry
= 0x00000002,
64 kIOAGPAccessOutOfRange
= 0x00000004
67 #define kIOAGPBusFlagsKey "IOAGPFlags"
69 kIOAGPGartIdleInvalidate
= 0x00000001
74 kIOAGPStateEnabled
= 0x00000001,
75 kIOAGPStateEnablePending
= 0x00010000
79 /*! @class IOAGPDevice : public IOPCIDevice
80 @abstract An IOService class representing an AGP master device.
81 @discussion The discovery of an AGP master device by the PCI bus family results in an instance of the IOAGPDevice being created and published. It provides services specific to AGP, in addition to the PCI services supplied by its superclass IOPCIDevice. */
83 class IOAGPDevice
: public IOPCIDevice
85 OSDeclareDefaultStructors(IOAGPDevice
)
89 /*! @struct ExpansionData
90 @discussion This structure will be used to expand the capablilties of the IOWorkLoop in the future.
92 struct ExpansionData
{ };
95 Reserved for future use. (Internal use only) */
96 ExpansionData
*reserved
;
100 UInt8 masterAGPRegisters
;
102 /*! @function createAGPSpace
103 @abstract Allocates the AGP space, and enables AGP transactions on the master and slave.
104 @discussion This method should be called by the driver for the AGP master device to set the size of the space and enable AGP transactions. It will destroy any AGP space currently allocated.
105 @param options No options are currently defined, pass zero.
106 @param address The physical range allocated for the AGP space is passed back to the caller.
107 @param length An in/out parameter - the caller sets the devices maximum AGP addressing and the actual size created is passed back.
108 @result An IOReturn code indicating success or failure. */
110 virtual IOReturn
createAGPSpace( IOOptionBits options
,
111 IOPhysicalAddress
* address
,
112 IOPhysicalLength
* length
);
114 /*! @function destroyAGPSpace
115 @abstract Destroys the AGP space, and disables AGP transactions on the master and slave.
116 @discussion This method should be called by the driver to shutdown AGP transactions and release resources. */
118 virtual IOReturn
destroyAGPSpace( void );
120 /*! @function getAGPRangeAllocator
121 @abstract Accessor to obtain the AGP range allocator.
122 @discussion To allocate ranges in AGP space, obtain a range allocator for the space with this method. It is retained while the space is created (until destroyAGPSpace is called) and should not be released by the caller.
123 @result A pointer to the range allocator for the AGP space. */
125 virtual IORangeAllocator
* getAGPRangeAllocator( void );
127 /*! @function getAGPStatus
128 @abstract Returns the current state of the AGP bus.
129 @discussion Returns state bits for the AGP bus. Only one type of status is currently defined.
130 @param which Type of status - only kIOAGPDefaultStatus is currently valid.
131 @result Mask of status bits for the AGP bus. */
133 virtual IOOptionBits
getAGPStatus( IOOptionBits which
= kIOAGPDefaultStatus
);
135 /*! @function commitAGPMemory
136 @abstract Makes memory addressable by AGP transactions.
137 @discussion Makes the memory described by the IOMemoryDescriptor object addressable by AGP by entering its pages into the GART array, given an offset into AGP space supplied by the caller (usually allocated by the AGP range allocator). It is the callers responsibility to prepare non-kernel pageable memory before calling this method, with IOMemoryDescriptor::prepare.
138 @param memory A IOMemoryDescriptor object describing the memory to add to the GART.
139 @param agpOffset An offset into AGP space that the caller has allocated - usually allocated by the AGP range allocator.
140 @param options Pass kIOAGPGartInvalidate if the AGP target should invalidate any GART TLB.
141 @result An IOReturn code indicating success or failure. */
143 virtual IOReturn
commitAGPMemory( IOMemoryDescriptor
* memory
,
144 IOByteCount agpOffset
,
145 IOOptionBits options
= 0 );
147 /*! @function releaseAGPMemory
148 @abstract Releases memory addressable by AGP transactions.
149 @discussion Makes the memory described by the IOMemoryDescriptor object unaddressable by AGP by removing its pages from the GART array, given an offset into AGP space supplied by the caller (usually allocated by the AGP range allocator). It is the callers responsibility to complete non-kernel pageable memory before calling this method, with IOMemoryDescriptor::complete.
150 @param memory A IOMemoryDescriptor object describing the memory to remove from the GART.
151 @param agpOffset An offset into AGP space that the caller has allocated - usually allocated by the AGP range allocator.
152 @param options Pass kIOAGPGartInvalidate if the AGP target should invalidate any GART TLB.
153 @result An IOReturn code indicating success or failure. */
155 virtual IOReturn
releaseAGPMemory( IOMemoryDescriptor
* memory
,
156 IOByteCount agpOffset
,
157 IOOptionBits options
= 0 );
159 virtual IOReturn
resetAGP( IOOptionBits options
= 0 );
161 /*! @function getAGPSpace
162 @abstract Returns the allocated AGP space.
163 @discussion This method can be called by the driver for the AGP master device to retrieve the physical address and size of the space created with createAGPSpace.
164 @param address The physical range allocated for the AGP space is passed back to the caller. Zero may be pased if the address is not needed by the caller.
165 @param length The size of the the AGP space created is passed back. Zero may be pased if the length is not needed by the caller.
166 @result An IOReturn code indicating success or failure. */
168 virtual IOReturn
getAGPSpace( IOPhysicalAddress
* address
,
169 IOPhysicalLength
* length
);
172 OSMetaClassDeclareReservedUnused(IOAGPDevice
, 0);
173 OSMetaClassDeclareReservedUnused(IOAGPDevice
, 1);
174 OSMetaClassDeclareReservedUnused(IOAGPDevice
, 2);
175 OSMetaClassDeclareReservedUnused(IOAGPDevice
, 3);
176 OSMetaClassDeclareReservedUnused(IOAGPDevice
, 4);
177 OSMetaClassDeclareReservedUnused(IOAGPDevice
, 5);
178 OSMetaClassDeclareReservedUnused(IOAGPDevice
, 6);
179 OSMetaClassDeclareReservedUnused(IOAGPDevice
, 7);
180 OSMetaClassDeclareReservedUnused(IOAGPDevice
, 8);
181 OSMetaClassDeclareReservedUnused(IOAGPDevice
, 9);
182 OSMetaClassDeclareReservedUnused(IOAGPDevice
, 10);
183 OSMetaClassDeclareReservedUnused(IOAGPDevice
, 11);
184 OSMetaClassDeclareReservedUnused(IOAGPDevice
, 12);
185 OSMetaClassDeclareReservedUnused(IOAGPDevice
, 13);
186 OSMetaClassDeclareReservedUnused(IOAGPDevice
, 14);
187 OSMetaClassDeclareReservedUnused(IOAGPDevice
, 15);
188 OSMetaClassDeclareReservedUnused(IOAGPDevice
, 16);
191 #endif /* ! _IOKIT_IOAGPDEVICE_H */