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