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 #define NV_IDL_IS_DISPATCH |
| 34 |
| 35 #include "nvcommon.h" |
| 36 #include "nvos.h" |
| 37 #include "nvassert.h" |
| 38 #include "nvreftrack.h" |
| 39 #include "nvidlcmd.h" |
| 40 #include "nvrm_interrupt.h" |
| 41 |
| 42 #define OFFSET( s, e ) (NvU32)(void *)(&(((s*)0)->e)) |
| 43 |
| 44 |
| 45 typedef struct NvRmGetIrqCountForLogicalInterrupt_in_t |
| 46 { |
| 47 NvU32 package_; |
| 48 NvU32 function_; |
| 49 NvRmDeviceHandle hRmDevice; |
| 50 NvRmModuleID ModuleID; |
| 51 } NV_ALIGN(4) NvRmGetIrqCountForLogicalInterrupt_in; |
| 52 |
| 53 typedef struct NvRmGetIrqCountForLogicalInterrupt_inout_t |
| 54 { |
| 55 NvU32 dummy_; |
| 56 } NV_ALIGN(4) NvRmGetIrqCountForLogicalInterrupt_inout; |
| 57 |
| 58 typedef struct NvRmGetIrqCountForLogicalInterrupt_out_t |
| 59 { |
| 60 NvU32 ret_; |
| 61 } NV_ALIGN(4) NvRmGetIrqCountForLogicalInterrupt_out; |
| 62 |
| 63 typedef struct NvRmGetIrqCountForLogicalInterrupt_params_t |
| 64 { |
| 65 NvRmGetIrqCountForLogicalInterrupt_in in; |
| 66 NvRmGetIrqCountForLogicalInterrupt_inout inout; |
| 67 NvRmGetIrqCountForLogicalInterrupt_out out; |
| 68 } NvRmGetIrqCountForLogicalInterrupt_params; |
| 69 |
| 70 typedef struct NvRmGetIrqForLogicalInterrupt_in_t |
| 71 { |
| 72 NvU32 package_; |
| 73 NvU32 function_; |
| 74 NvRmDeviceHandle hRmDevice; |
| 75 NvRmModuleID ModuleID; |
| 76 NvU32 Index; |
| 77 } NV_ALIGN(4) NvRmGetIrqForLogicalInterrupt_in; |
| 78 |
| 79 typedef struct NvRmGetIrqForLogicalInterrupt_inout_t |
| 80 { |
| 81 NvU32 dummy_; |
| 82 } NV_ALIGN(4) NvRmGetIrqForLogicalInterrupt_inout; |
| 83 |
| 84 typedef struct NvRmGetIrqForLogicalInterrupt_out_t |
| 85 { |
| 86 NvU32 ret_; |
| 87 } NV_ALIGN(4) NvRmGetIrqForLogicalInterrupt_out; |
| 88 |
| 89 typedef struct NvRmGetIrqForLogicalInterrupt_params_t |
| 90 { |
| 91 NvRmGetIrqForLogicalInterrupt_in in; |
| 92 NvRmGetIrqForLogicalInterrupt_inout inout; |
| 93 NvRmGetIrqForLogicalInterrupt_out out; |
| 94 } NvRmGetIrqForLogicalInterrupt_params; |
| 95 |
| 96 static NvError NvRmGetIrqCountForLogicalInterrupt_dispatch_( void *InBuffer, NvU
32 InSize, void *OutBuffer, NvU32 OutSize, NvDispatchCtx* Ctx ) |
| 97 { |
| 98 NvError err_ = NvSuccess; |
| 99 NvRmGetIrqCountForLogicalInterrupt_in *p_in; |
| 100 NvRmGetIrqCountForLogicalInterrupt_out *p_out; |
| 101 |
| 102 p_in = (NvRmGetIrqCountForLogicalInterrupt_in *)InBuffer; |
| 103 p_out = (NvRmGetIrqCountForLogicalInterrupt_out *)((NvU8 *)OutBuffer + OFFSE
T(NvRmGetIrqCountForLogicalInterrupt_params, out) - OFFSET(NvRmGetIrqCountForLog
icalInterrupt_params, inout)); |
| 104 |
| 105 |
| 106 p_out->ret_ = NvRmGetIrqCountForLogicalInterrupt( p_in->hRmDevice, p_in->Mod
uleID ); |
| 107 |
| 108 return err_; |
| 109 } |
| 110 |
| 111 static NvError NvRmGetIrqForLogicalInterrupt_dispatch_( void *InBuffer, NvU32 In
Size, void *OutBuffer, NvU32 OutSize, NvDispatchCtx* Ctx ) |
| 112 { |
| 113 NvError err_ = NvSuccess; |
| 114 NvRmGetIrqForLogicalInterrupt_in *p_in; |
| 115 NvRmGetIrqForLogicalInterrupt_out *p_out; |
| 116 |
| 117 p_in = (NvRmGetIrqForLogicalInterrupt_in *)InBuffer; |
| 118 p_out = (NvRmGetIrqForLogicalInterrupt_out *)((NvU8 *)OutBuffer + OFFSET(NvR
mGetIrqForLogicalInterrupt_params, out) - OFFSET(NvRmGetIrqForLogicalInterrupt_p
arams, inout)); |
| 119 |
| 120 |
| 121 p_out->ret_ = NvRmGetIrqForLogicalInterrupt( p_in->hRmDevice, p_in->ModuleID
, p_in->Index ); |
| 122 |
| 123 return err_; |
| 124 } |
| 125 |
| 126 NvError nvrm_interrupt_Dispatch( NvU32 function, void *InBuffer, NvU32 InSize, v
oid *OutBuffer, NvU32 OutSize, NvDispatchCtx* Ctx ); |
| 127 NvError nvrm_interrupt_Dispatch( NvU32 function, void *InBuffer, NvU32 InSize, v
oid *OutBuffer, NvU32 OutSize, NvDispatchCtx* Ctx ) |
| 128 { |
| 129 NvError err_ = NvSuccess; |
| 130 |
| 131 switch( function ) { |
| 132 case 1: |
| 133 err_ = NvRmGetIrqCountForLogicalInterrupt_dispatch_( InBuffer, InSize, O
utBuffer, OutSize, Ctx ); |
| 134 break; |
| 135 case 0: |
| 136 err_ = NvRmGetIrqForLogicalInterrupt_dispatch_( InBuffer, InSize, OutBuf
fer, OutSize, Ctx ); |
| 137 break; |
| 138 default: |
| 139 err_ = NvError_BadParameter; |
| 140 break; |
| 141 } |
| 142 |
| 143 return err_; |
| 144 } |
OLD | NEW |