]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
ff6e181a A |
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. Please obtain a copy of the License at | |
10 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
11 | * file. | |
1c79356b | 12 | * |
ff6e181a A |
13 | * The Original Code and all software distributed under the License are |
14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
1c79356b A |
15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
ff6e181a A |
17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
18 | * Please see the License for the specific language governing rights and | |
19 | * limitations under the License. | |
1c79356b A |
20 | * |
21 | * @APPLE_LICENSE_HEADER_END@ | |
22 | */ | |
23 | /* | |
24 | * Copyright (c) 1998 Apple Computer, Inc. All rights reserved. | |
25 | * | |
26 | * HISTORY | |
27 | * | |
28 | */ | |
29 | ||
30 | #ifndef _IOKIT_IODEVICEMEMORY_H | |
31 | #define _IOKIT_IODEVICEMEMORY_H | |
32 | ||
33 | #include <IOKit/IOMemoryDescriptor.h> | |
34 | ||
91447636 | 35 | /*! @class IODeviceMemory |
1c79356b | 36 | @abstract An IOMemoryDescriptor used for device physical memory ranges. |
91447636 A |
37 | @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. |
38 | */ | |
1c79356b A |
39 | |
40 | class IODeviceMemory : public IOMemoryDescriptor | |
41 | { | |
42 | OSDeclareDefaultStructors(IODeviceMemory) | |
43 | ||
44 | public: | |
45 | ||
46 | /*! @struct InitElement | |
47 | @field start First physical address in the range. | |
48 | @field length Length of the range. | |
49 | @field tag 32-bit value not interpreted by IODeviceMemory or IOMemoryDescriptor, for use by the bus family. */ | |
50 | ||
51 | struct InitElement { | |
52 | IOPhysicalAddress start; | |
53 | IOPhysicalLength length; | |
54 | IOOptionBits tag; | |
55 | }; | |
56 | ||
57 | /*! @function arrayFromList | |
58 | @abstract Constructs an OSArray of IODeviceMemory instances, each describing one physical range, and a tag value. | |
91447636 | 59 | @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. |
1c79356b A |
60 | @param list An array of IODeviceMemory::InitElement structures. |
61 | @param count The number of elements in the list. | |
91447636 | 62 | @result Returns a created OSArray of IODeviceMemory objects, to be released by the caller, or zero on failure. */ |
1c79356b A |
63 | |
64 | static OSArray * arrayFromList( | |
65 | InitElement list[], | |
66 | IOItemCount count ); | |
67 | ||
68 | /*! @function withRange | |
69 | @abstract Constructs an IODeviceMemory instance, describing one physical range. | |
91447636 | 70 | @discussion This method creates an IODeviceMemory instance for one physical range passed as a physical address and length. It just calls IOMemoryDescriptor::withPhysicalAddress. |
1c79356b A |
71 | @param address The physical address of the first byte in the memory. |
72 | @param withLength The length of memory. | |
91447636 | 73 | @result Returns the created IODeviceMemory on success, to be released by the caller, or zero on failure. */ |
1c79356b A |
74 | |
75 | static IODeviceMemory * withRange( | |
76 | IOPhysicalAddress start, | |
77 | IOPhysicalLength length ); | |
78 | ||
91447636 | 79 | /*! @function withSubRange |
1c79356b | 80 | @abstract Constructs an IODeviceMemory instance, describing a subset of an existing IODeviceMemory range. |
91447636 | 81 | @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. |
1c79356b A |
82 | @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. |
83 | @param offset A byte offset into the parent's memory. | |
84 | @param length The length of the subrange. | |
91447636 | 85 | @result Returns the created IODeviceMemory on success, to be released by the caller, or zero on failure. */ |
1c79356b A |
86 | |
87 | static IODeviceMemory * withSubRange( | |
88 | IODeviceMemory * of, | |
89 | IOPhysicalAddress offset, | |
90 | IOPhysicalLength length ); | |
91 | }; | |
92 | ||
93 | #endif /* ! _IOKIT_IODEVICEMEMORY_H */ |