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_keylist.h" |
| 41 |
| 42 #define OFFSET( s, e ) (NvU32)(void *)(&(((s*)0)->e)) |
| 43 |
| 44 |
| 45 typedef struct NvRmSetKeyValuePair_in_t |
| 46 { |
| 47 NvU32 package_; |
| 48 NvU32 function_; |
| 49 NvRmDeviceHandle hRm; |
| 50 NvU32 KeyID; |
| 51 NvU32 Value; |
| 52 } NV_ALIGN(4) NvRmSetKeyValuePair_in; |
| 53 |
| 54 typedef struct NvRmSetKeyValuePair_inout_t |
| 55 { |
| 56 NvU32 dummy_; |
| 57 } NV_ALIGN(4) NvRmSetKeyValuePair_inout; |
| 58 |
| 59 typedef struct NvRmSetKeyValuePair_out_t |
| 60 { |
| 61 NvError ret_; |
| 62 } NV_ALIGN(4) NvRmSetKeyValuePair_out; |
| 63 |
| 64 typedef struct NvRmSetKeyValuePair_params_t |
| 65 { |
| 66 NvRmSetKeyValuePair_in in; |
| 67 NvRmSetKeyValuePair_inout inout; |
| 68 NvRmSetKeyValuePair_out out; |
| 69 } NvRmSetKeyValuePair_params; |
| 70 |
| 71 typedef struct NvRmGetKeyValue_in_t |
| 72 { |
| 73 NvU32 package_; |
| 74 NvU32 function_; |
| 75 NvRmDeviceHandle hRm; |
| 76 NvU32 KeyID; |
| 77 } NV_ALIGN(4) NvRmGetKeyValue_in; |
| 78 |
| 79 typedef struct NvRmGetKeyValue_inout_t |
| 80 { |
| 81 NvU32 dummy_; |
| 82 } NV_ALIGN(4) NvRmGetKeyValue_inout; |
| 83 |
| 84 typedef struct NvRmGetKeyValue_out_t |
| 85 { |
| 86 NvU32 ret_; |
| 87 } NV_ALIGN(4) NvRmGetKeyValue_out; |
| 88 |
| 89 typedef struct NvRmGetKeyValue_params_t |
| 90 { |
| 91 NvRmGetKeyValue_in in; |
| 92 NvRmGetKeyValue_inout inout; |
| 93 NvRmGetKeyValue_out out; |
| 94 } NvRmGetKeyValue_params; |
| 95 |
| 96 static NvError NvRmSetKeyValuePair_dispatch_( void *InBuffer, NvU32 InSize, void
*OutBuffer, NvU32 OutSize, NvDispatchCtx* Ctx ) |
| 97 { |
| 98 NvError err_ = NvSuccess; |
| 99 NvRmSetKeyValuePair_in *p_in; |
| 100 NvRmSetKeyValuePair_out *p_out; |
| 101 |
| 102 p_in = (NvRmSetKeyValuePair_in *)InBuffer; |
| 103 p_out = (NvRmSetKeyValuePair_out *)((NvU8 *)OutBuffer + OFFSET(NvRmSetKeyVal
uePair_params, out) - OFFSET(NvRmSetKeyValuePair_params, inout)); |
| 104 |
| 105 |
| 106 p_out->ret_ = NvRmSetKeyValuePair( p_in->hRm, p_in->KeyID, p_in->Value ); |
| 107 |
| 108 return err_; |
| 109 } |
| 110 |
| 111 static NvError NvRmGetKeyValue_dispatch_( void *InBuffer, NvU32 InSize, void *Ou
tBuffer, NvU32 OutSize, NvDispatchCtx* Ctx ) |
| 112 { |
| 113 NvError err_ = NvSuccess; |
| 114 NvRmGetKeyValue_in *p_in; |
| 115 NvRmGetKeyValue_out *p_out; |
| 116 |
| 117 p_in = (NvRmGetKeyValue_in *)InBuffer; |
| 118 p_out = (NvRmGetKeyValue_out *)((NvU8 *)OutBuffer + OFFSET(NvRmGetKeyValue_p
arams, out) - OFFSET(NvRmGetKeyValue_params, inout)); |
| 119 |
| 120 |
| 121 p_out->ret_ = NvRmGetKeyValue( p_in->hRm, p_in->KeyID ); |
| 122 |
| 123 return err_; |
| 124 } |
| 125 |
| 126 NvError nvrm_keylist_Dispatch( NvU32 function, void *InBuffer, NvU32 InSize, voi
d *OutBuffer, NvU32 OutSize, NvDispatchCtx* Ctx ); |
| 127 NvError nvrm_keylist_Dispatch( NvU32 function, void *InBuffer, NvU32 InSize, voi
d *OutBuffer, NvU32 OutSize, NvDispatchCtx* Ctx ) |
| 128 { |
| 129 NvError err_ = NvSuccess; |
| 130 |
| 131 switch( function ) { |
| 132 case 1: |
| 133 err_ = NvRmSetKeyValuePair_dispatch_( InBuffer, InSize, OutBuffer, OutSi
ze, Ctx ); |
| 134 break; |
| 135 case 0: |
| 136 err_ = NvRmGetKeyValue_dispatch_( InBuffer, InSize, OutBuffer, OutSize,
Ctx ); |
| 137 break; |
| 138 default: |
| 139 err_ = NvError_BadParameter; |
| 140 break; |
| 141 } |
| 142 |
| 143 return err_; |
| 144 } |
OLD | NEW |