]> git.saurik.com Git - apple/xnu.git/blob - iokit/IOKit/IODeviceMemory.h
xnu-201.42.3.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 : public IOMemoryDescriptor
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 class IODeviceMemory : public IOMemoryDescriptor
39 {
40 OSDeclareDefaultStructors(IODeviceMemory)
41
42 public:
43
44 /*! @struct InitElement
45 @field start First physical address in the range.
46 @field length Length of the range.
47 @field tag 32-bit value not interpreted by IODeviceMemory or IOMemoryDescriptor, for use by the bus family. */
48
49 struct InitElement {
50 IOPhysicalAddress start;
51 IOPhysicalLength length;
52 IOOptionBits tag;
53 };
54
55 /*! @function arrayFromList
56 @abstract Constructs an OSArray of IODeviceMemory instances, each describing one physical range, and a tag value.
57 @discussion This method creates IODeviceMemory instances for each physical range passed in a 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.
58 @param list An array of IODeviceMemory::InitElement structures.
59 @param count The number of elements in the list.
60 @result A created OSArray of IODeviceMemory objects, to be released by the caller, or zero on failure. */
61
62 static OSArray * arrayFromList(
63 InitElement list[],
64 IOItemCount count );
65
66 /*! @function withRange
67 @abstract Constructs an IODeviceMemory instance, describing one physical range.
68 @discussion This method creates IODeviceMemory instance for one physical range passed as a physical address and length. It just calls IOMemoryDescriptor::withPhysicalAddress.
69 @param address The physical address of the first byte in the memory.
70 @param withLength The length of memory.
71 @result The created IODeviceMemory on success, to be released by the caller, or zero on failure. */
72
73 static IODeviceMemory * withRange(
74 IOPhysicalAddress start,
75 IOPhysicalLength length );
76
77 /*! @function withRange
78 @abstract Constructs an IODeviceMemory instance, describing a subset of an existing IODeviceMemory range.
79 @discussion This method creates IODeviceMemory instance for a subset of an existing IODeviceMemory range, passed as a physical address offset and length. It just calls IOMemoryDescriptor::withSubRange.
80 @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.
81 @param offset A byte offset into the parent's memory.
82 @param length The length of the subrange.
83 @result The created IODeviceMemory on success, to be released by the caller, or zero on failure. */
84
85 static IODeviceMemory * withSubRange(
86 IODeviceMemory * of,
87 IOPhysicalAddress offset,
88 IOPhysicalLength length );
89 };
90
91 #endif /* ! _IOKIT_IODEVICEMEMORY_H */