OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2010 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_xpc_H |
| 34 #define INCLUDED_nvrm_xpc_H |
| 35 |
| 36 |
| 37 #if defined(__cplusplus) |
| 38 extern "C" |
| 39 { |
| 40 #endif |
| 41 |
| 42 #include "nvrm_module.h" |
| 43 #include "nvrm_init.h" |
| 44 |
| 45 #include "nvcommon.h" |
| 46 #include "nvos.h" |
| 47 #include "nvrm_init.h" |
| 48 #include "nvrm_interrupt.h" |
| 49 |
| 50 /** |
| 51 * @brief 16 Byte allignment for the shared memory message transfer. |
| 52 */ |
| 53 |
| 54 typedef enum |
| 55 { |
| 56 XPC_MESSAGE_ALIGNMENT_SIZE = 0x10, |
| 57 Xpc_Alignment_Num, |
| 58 Xpc_Alignment_Force32 = 0x7FFFFFFF |
| 59 } Xpc_Alignment; |
| 60 |
| 61 /** |
| 62 * NvRmPrivXpcMessageHandle is an opaque handle to NvRmPrivXpcMessage. |
| 63 * |
| 64 * @ingroup nvrm_xpc |
| 65 */ |
| 66 |
| 67 typedef struct NvRmPrivXpcMessageRec *NvRmPrivXpcMessageHandle; |
| 68 |
| 69 /** |
| 70 * Create the xpc message handles for sending/receiving the message to/from |
| 71 * target processor. |
| 72 * This function allocates the memory (from multiprocessor shared memory |
| 73 * region) and os resources for the message transfer and synchrnoisation. |
| 74 * |
| 75 * @see NvRmPrivXpcSendMessage() |
| 76 * @see NvRmPrivXpcGetMessage() |
| 77 * |
| 78 * @param hDevice Handle to the Rm device which is required by Ddk to acquire |
| 79 * the resources from RM. |
| 80 * @param phXpcMessage Pointer to the handle to Xpc message where created |
| 81 * Xpc message handle is stored. |
| 82 * |
| 83 * @retval NvSuccess Indicates the message queue is successfully created. |
| 84 * @retval NvError_BadValue The parameter passed are incorrect. |
| 85 * @retval NvError_InsufficientMemory Indicates that function fails to allocate
the |
| 86 * memory for message queue. |
| 87 * @retval NvError_MemoryMapFailed Indicates that the memory mapping for xpc |
| 88 * controller register failed. |
| 89 * @retval NvError_NotSupported Indicates that the requested operation is not |
| 90 * supported for the given target processor/Instance. |
| 91 * |
| 92 */ |
| 93 |
| 94 NvError NvRmPrivXpcCreate( |
| 95 NvRmDeviceHandle hDevice, |
| 96 NvRmPrivXpcMessageHandle * phXpcMessage ); |
| 97 |
| 98 /** |
| 99 * Destroy the created Xpc message handle. This frees all the resources |
| 100 * allocated for the xpc message handle. |
| 101 * |
| 102 * @note After calling this function client will not able to send/receive any |
| 103 * message. |
| 104 * |
| 105 * @see NvRmPrivXpcMessageCreate() |
| 106 * |
| 107 * @param hXpcMessage Xpc message queue handle which need to be destroy. |
| 108 * This cas created when function NvRmPrivXpcMessageCreate() was called. |
| 109 * |
| 110 */ |
| 111 |
| 112 void NvRmPrivXpcDestroy( |
| 113 NvRmPrivXpcMessageHandle hXpcMessage ); |
| 114 |
| 115 NvError NvRmPrivXpcSendMessage( |
| 116 NvRmPrivXpcMessageHandle hXpcMessage, |
| 117 NvU32 data ); |
| 118 |
| 119 NvU32 NvRmPrivXpcGetMessage( |
| 120 NvRmPrivXpcMessageHandle hXpcMessage ); |
| 121 |
| 122 /** |
| 123 * Initializes the Arbitration semaphore system for cross processor synchronizat
ion. |
| 124 * |
| 125 * @param hDevice The RM handle. |
| 126 * |
| 127 * @retval "NvError_IrqRegistrationFailed" if interupt is already registred. |
| 128 * @retval "NvSuccess" if successfull. |
| 129 */ |
| 130 |
| 131 NvError NvRmXpcInitArbSemaSystem( |
| 132 NvRmDeviceHandle hDevice ); |
| 133 |
| 134 /** |
| 135 * Tries to obtain a hw arbitration semaphore. This API is used to |
| 136 * synchronize access to hw blocks across processors. |
| 137 * |
| 138 * @param modId The module that we need to cross-processor safe access to. |
| 139 */ |
| 140 |
| 141 void NvRmXpcModuleAcquire( |
| 142 NvRmModuleID modId ); |
| 143 |
| 144 /** |
| 145 * Releases the arbitration semaphore corresponding to the given module id. |
| 146 * |
| 147 * @param modId The module that we are releasing. |
| 148 */ |
| 149 |
| 150 void NvRmXpcModuleRelease( |
| 151 NvRmModuleID modId ); |
| 152 |
| 153 #if defined(__cplusplus) |
| 154 } |
| 155 #endif |
| 156 |
| 157 #endif |
OLD | NEW |