]> git.saurik.com Git - apple/xnu.git/blob - iokit/IOKit/IODeviceMemory.h
xnu-792.6.22.tar.gz
[apple/xnu.git] / iokit / IOKit / IODeviceMemory.h
1 /*
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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.
11 *
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
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /*
23 * Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
24 *
25 * HISTORY
26 *
27 */
28
29 #ifndef _IOKIT_IODEVICEMEMORY_H
30 #define _IOKIT_IODEVICEMEMORY_H
31
32 #include <IOKit/IOMemoryDescriptor.h>
33
34 /*! @class IODeviceMemory
35 @abstract An IOMemoryDescriptor used for device physical memory ranges.
36 @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.
37 */
38
39 class IODeviceMemory : public IOMemoryDescriptor
40 {
41 OSDeclareDefaultStructors(IODeviceMemory)
42
43 public:
44
45 /*! @struct InitElement
46 @field start First physical address in the range.
47 @field length Length of the range.
48 @field tag 32-bit value not interpreted by IODeviceMemory or IOMemoryDescriptor, for use by the bus family. */
49
50 struct InitElement {
51 IOPhysicalAddress start;
52 IOPhysicalLength length;
53 IOOptionBits tag;
54 };
55
56 /*! @function arrayFromList
57 @abstract Constructs an OSArray of IODeviceMemory instances, each describing one physical range, and a tag value.
58 @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.
59 @param list An array of IODeviceMemory::InitElement structures.
60 @param count The number of elements in the list.
61 @result Returns a created OSArray of IODeviceMemory objects, to be released by the caller, or zero on failure. */
62
63 static OSArray * arrayFromList(
64 InitElement list[],
65 IOItemCount count );
66
67 /*! @function withRange
68 @abstract Constructs an IODeviceMemory instance, describing one physical range.
69 @discussion This method creates an IODeviceMemory instance for one physical range passed as a physical address and length. It just calls IOMemoryDescriptor::withPhysicalAddress.
70 @param address The physical address of the first byte in the memory.
71 @param withLength The length of memory.
72 @result Returns the created IODeviceMemory on success, to be released by the caller, or zero on failure. */
73
74 static IODeviceMemory * withRange(
75 IOPhysicalAddress start,
76 IOPhysicalLength length );
77
78 /*! @function withSubRange
79 @abstract Constructs an IODeviceMemory instance, describing a subset of an existing IODeviceMemory range.
80 @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.
81 @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.
82 @param offset A byte offset into the parent's memory.
83 @param length The length of the subrange.
84 @result Returns the created IODeviceMemory on success, to be released by the caller, or zero on failure. */
85
86 static IODeviceMemory * withSubRange(
87 IODeviceMemory * of,
88 IOPhysicalAddress offset,
89 IOPhysicalLength length );
90 };
91
92 #endif /* ! _IOKIT_IODEVICEMEMORY_H */