OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2009 NVIDIA Corporation. |
| 3 * All rights reserved. |
| 4 * |
| 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: |
| 7 * |
| 8 * Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. |
| 10 * |
| 11 * Redistributions in binary form must reproduce the above copyright notice, |
| 12 * this list of conditions and the following disclaimer in the documentation |
| 13 * and/or other materials provided with the distribution. |
| 14 * |
| 15 * Neither the name of the NVIDIA Corporation nor the names of its contributors |
| 16 * may be used to endorse or promote products derived from this software |
| 17 * without specific prior written permission. |
| 18 * |
| 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| 23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 29 * POSSIBILITY OF SUCH DAMAGE. |
| 30 * |
| 31 */ |
| 32 |
| 33 #ifndef INCLUDED_nvrm_init_H |
| 34 #define INCLUDED_nvrm_init_H |
| 35 |
| 36 |
| 37 #if defined(__cplusplus) |
| 38 extern "C" |
| 39 { |
| 40 #endif |
| 41 |
| 42 |
| 43 #include "nvcommon.h" |
| 44 #include "nverror.h" |
| 45 |
| 46 /** |
| 47 * NvRmDeviceHandle is an opaque handle to an RM device. |
| 48 */ |
| 49 |
| 50 typedef struct NvRmDeviceRec *NvRmDeviceHandle; |
| 51 |
| 52 /** |
| 53 * A physical address type sized such that it matches the addressing support of |
| 54 * the hardware modules RM typically interfaces with. May be smaller than an |
| 55 * NvOsPhysAddr. |
| 56 * |
| 57 * XXX We should probably get rid of this and just use NvU32. It's rather |
| 58 * difficult to explain what exactly NvRmPhysAddr is. Also, what if some units |
| 59 * are upgraded to do 64-bit addressing and others remain 32? Would we really |
| 60 * want to increase NvRmPhysAddr to NvU64 across the board? |
| 61 * |
| 62 * Another option would be to put the following types in nvcommon.h: |
| 63 * typedef NvU32 NvPhysAddr32; |
| 64 * typedef NvU64 NvPhysAddr64; |
| 65 * Using these types would then be purely a form of documentation and nothing |
| 66 * else. |
| 67 * |
| 68 * This header file is a somewhat odd place to put this type. Putting it in |
| 69 * memmgr would be even worse, though, because then a lot of header files would |
| 70 * all suddenly need to #include nvrm_memmgr.h just to get the NvRmPhysAddr |
| 71 * type. (They already all include this header anyway.) |
| 72 */ |
| 73 |
| 74 typedef NvU32 NvRmPhysAddr; |
| 75 |
| 76 /** |
| 77 * Opens the Resource Manager for a given device. |
| 78 * |
| 79 * Can be called multiple times for a given device. Subsequent |
| 80 * calls will not necessarily return the same handle. Each call to |
| 81 * NvRmOpen() must be paired with a corresponding call to NvRmClose(). |
| 82 * |
| 83 * Assert encountered in debug mode if DeviceId value is invalid. |
| 84 * |
| 85 * This call is not intended to perform any significant hardware |
| 86 * initialization of the device; rather its primary purpose is to |
| 87 * initialize RM's internal data structures that are involved in |
| 88 * managing the device. |
| 89 * |
| 90 * @param pHandle the RM handle is stored here. |
| 91 * @param DeviceId implementation-dependent value specifying the device |
| 92 * to be opened. Currently must be set to zero. |
| 93 * |
| 94 * @retval NvSuccess Indicates that RM was successfully opened. |
| 95 * @retval NvError_InsufficientMemory Indicates that RM was unable to allocate |
| 96 * memory for its internal data structures. |
| 97 */ |
| 98 |
| 99 NvError NvRmOpen( |
| 100 NvRmDeviceHandle * pHandle, |
| 101 NvU32 DeviceId ); |
| 102 |
| 103 /** |
| 104 * Called by the platform/OS code to initialize the Rm. Usage and |
| 105 * implementation of this API is platform specific. |
| 106 * |
| 107 * This APIs should not be called by the normal clients of the Rm. |
| 108 * |
| 109 * This APIs is guaranteed to succeed on the supported platforms. |
| 110 * |
| 111 * @param pHandle the RM handle is stored here. |
| 112 */ |
| 113 |
| 114 void NvRmInit( |
| 115 NvRmDeviceHandle * pHandle ); |
| 116 |
| 117 /** |
| 118 * Temporary version of NvRmOpen lacking the DeviceId parameter |
| 119 */ |
| 120 |
| 121 NvError NvRmOpenNew( |
| 122 NvRmDeviceHandle * pHandle ); |
| 123 |
| 124 /** |
| 125 * Closes the Resource Manager for a given device. |
| 126 * |
| 127 * Each call to NvRmOpen() must be paired with a corresponding call |
| 128 * to NvRmClose(). |
| 129 * |
| 130 * @param hDevice The RM handle. If hDevice is NULL, this API has no effect. |
| 131 */ |
| 132 |
| 133 void NvRmClose( |
| 134 NvRmDeviceHandle hDevice ); |
| 135 |
| 136 /** @} */ |
| 137 |
| 138 #if defined(__cplusplus) |
| 139 } |
| 140 #endif |
| 141 |
| 142 #endif |
OLD | NEW |