]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_OSREFERENCE_HEADER_START@ | |
5 | * | |
6 | * This file contains Original Code and/or Modifications of Original Code | |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. The rights granted to you under the | |
10 | * License may not be used to create, or enable the creation or | |
11 | * redistribution of, unlawful or unlicensed copies of an Apple operating | |
12 | * system, or to circumvent, violate, or enable the circumvention or | |
13 | * violation of, any terms of an Apple operating system software license | |
14 | * agreement. | |
15 | * | |
16 | * Please obtain a copy of the License at | |
17 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
18 | * file. | |
19 | * | |
20 | * The Original Code and all software distributed under the License are | |
21 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
22 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
23 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
24 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
25 | * Please see the License for the specific language governing rights and | |
26 | * limitations under the License. | |
27 | * | |
28 | * @APPLE_LICENSE_OSREFERENCE_HEADER_END@ | |
29 | */ | |
30 | /* | |
31 | * Copyright (c) 1998 Apple Computer, Inc. All rights reserved. | |
32 | * | |
33 | * HISTORY | |
34 | * | |
35 | */ | |
36 | ||
37 | #ifndef _IOKIT_IODEVICEMEMORY_H | |
38 | #define _IOKIT_IODEVICEMEMORY_H | |
39 | ||
40 | #include <IOKit/IOMemoryDescriptor.h> | |
41 | ||
42 | /*! @class IODeviceMemory | |
43 | @abstract An IOMemoryDescriptor used for device physical memory ranges. | |
44 | @discussion The IODeviceMemory class is a simple subclass of IOMemoryDescriptor that uses its methods to describe a single range of physical memory on a device. IODeviceMemory objects are usually looked up with IOService or IOPCIDevice accessors, and are created by memory-mapped bus families. IODeviceMemory implements only some factory methods in addition to the methods of IOMemoryDescriptor. | |
45 | */ | |
46 | ||
47 | class IODeviceMemory : public IOMemoryDescriptor | |
48 | { | |
49 | OSDeclareDefaultStructors(IODeviceMemory) | |
50 | ||
51 | public: | |
52 | ||
53 | /*! @struct InitElement | |
54 | @field start First physical address in the range. | |
55 | @field length Length of the range. | |
56 | @field tag 32-bit value not interpreted by IODeviceMemory or IOMemoryDescriptor, for use by the bus family. */ | |
57 | ||
58 | struct InitElement { | |
59 | IOPhysicalAddress start; | |
60 | IOPhysicalLength length; | |
61 | IOOptionBits tag; | |
62 | }; | |
63 | ||
64 | /*! @function arrayFromList | |
65 | @abstract Constructs an OSArray of IODeviceMemory instances, each describing one physical range, and a tag value. | |
66 | @discussion This method creates IODeviceMemory instances for each physical range passed in an IODeviceMemory::InitElement array. Each element consists of a physical address, length and tag value for the IODeviceMemory. The instances are returned as a created OSArray. | |
67 | @param list An array of IODeviceMemory::InitElement structures. | |
68 | @param count The number of elements in the list. | |
69 | @result Returns a created OSArray of IODeviceMemory objects, to be released by the caller, or zero on failure. */ | |
70 | ||
71 | static OSArray * arrayFromList( | |
72 | InitElement list[], | |
73 | IOItemCount count ); | |
74 | ||
75 | /*! @function withRange | |
76 | @abstract Constructs an IODeviceMemory instance, describing one physical range. | |
77 | @discussion This method creates an IODeviceMemory instance for one physical range passed as a physical address and length. It just calls IOMemoryDescriptor::withPhysicalAddress. | |
78 | @param address The physical address of the first byte in the memory. | |
79 | @param withLength The length of memory. | |
80 | @result Returns the created IODeviceMemory on success, to be released by the caller, or zero on failure. */ | |
81 | ||
82 | static IODeviceMemory * withRange( | |
83 | IOPhysicalAddress start, | |
84 | IOPhysicalLength length ); | |
85 | ||
86 | /*! @function withSubRange | |
87 | @abstract Constructs an IODeviceMemory instance, describing a subset of an existing IODeviceMemory range. | |
88 | @discussion This method creates an IODeviceMemory instance for a subset of an existing IODeviceMemory range, passed as a physical address offset and length. It just calls IOMemoryDescriptor::withSubRange. | |
89 | @param of The parent IODeviceMemory of which a subrange is to be used for the new descriptor, which will be retained by the subrange IODeviceMemory. | |
90 | @param offset A byte offset into the parent's memory. | |
91 | @param length The length of the subrange. | |
92 | @result Returns the created IODeviceMemory on success, to be released by the caller, or zero on failure. */ | |
93 | ||
94 | static IODeviceMemory * withSubRange( | |
95 | IODeviceMemory * of, | |
96 | IOPhysicalAddress offset, | |
97 | IOPhysicalLength length ); | |
98 | }; | |
99 | ||
100 | #endif /* ! _IOKIT_IODEVICEMEMORY_H */ |