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_NVIDLCMD_H |
| 34 #define INCLUDED_NVIDLCMD_H |
| 35 |
| 36 #include "nvos.h" |
| 37 #include "nvreftrack.h" |
| 38 |
| 39 // name of the master FIFO socket on systems which use the master FIFO |
| 40 #define NVRM_DAEMON_SOCKNAME "/dev/nvrm_daemon" |
| 41 |
| 42 #define NV_DAEMON_MODULES(F) \ |
| 43 F(NvRmGraphics) \ |
| 44 F(NvMM) \ |
| 45 F(NvDDKAudio) \ |
| 46 F(NvDispMgr) |
| 47 |
| 48 #define NV_KERNEL_MODULES(F) \ |
| 49 F(NvRm) \ |
| 50 F(NvECPackage) \ |
| 51 F(NvStorManager) \ |
| 52 F(NvVib) |
| 53 |
| 54 // These codes are sent to the daemon to initiate commands from each module. |
| 55 typedef enum NvRmDaemonCodeEnum |
| 56 { |
| 57 NvRmDaemonCode_FifoCreate = 0x281e0001, |
| 58 NvRmDaemonCode_FifoDelete, |
| 59 |
| 60 #define F(X) NvRmDaemonCode_##X, |
| 61 NV_DAEMON_MODULES(F) |
| 62 #undef F |
| 63 NvRmDaemonCode_Garbage = 0xdeadbeef, |
| 64 |
| 65 NvRmDaemonCode_Force32 = 0x7FFFFFFF |
| 66 } NvRmDaemonCode; |
| 67 |
| 68 /* Defines a pair of objects for transferring data to and from the daemon. |
| 69 * FifoIn is used to read data from the daemon; FifoOut is used to write data |
| 70 * to the daemon |
| 71 */ |
| 72 typedef struct NvIdlFifoPairRec |
| 73 { |
| 74 void *FifoIn; |
| 75 void *FifoOut; |
| 76 } NvIdlFifoPair; |
| 77 |
| 78 |
| 79 /* These functions are called by the IDL-generated code: |
| 80 * |
| 81 * *_NvIdlGetIoctlCode() - get code to use to identify module |
| 82 * *_NvIdlGetFifos() - get a fifo pair for communication |
| 83 * *_NvIdlReleaseFifos() - get a fifo pair for communication |
| 84 * *_NvIdlGetIoctlFile() - get the file to use for ioctl |
| 85 */ |
| 86 |
| 87 #define NV_IDL_DECLS_STUB(pfx) \ |
| 88 NvU32 pfx##_NvIdlGetIoctlCode(void); \ |
| 89 NvOsFileHandle pfx##_NvIdlGetIoctlFile(void); |
| 90 |
| 91 #define NV_IDL_DECLS_DISPATCH_KERNEL(pfx) \ |
| 92 NvError pfx##_Dispatch( \ |
| 93 void *InBuffer, \ |
| 94 NvU32 InSize, \ |
| 95 void *OutBuffer, \ |
| 96 NvU32 OutSize, \ |
| 97 NvDispatchCtx* Ctx); |
| 98 |
| 99 #if NVOS_IS_LINUX |
| 100 #define NV_IDL_DECLS_DISPATCH_DAEMON(pfx) \ |
| 101 NvError pfx##_Dispatch( \ |
| 102 void* hFifoIn, \ |
| 103 void* hFifoOut, \ |
| 104 NvDispatchCtx* Ctx); |
| 105 #else |
| 106 #define NV_IDL_DECLS_DISPATCH_DAEMON(p) \ |
| 107 NV_IDL_DECLS_DISPATCH_KERNEL(p) |
| 108 #endif |
| 109 |
| 110 #define F(X) NV_IDL_DECLS_STUB(X) |
| 111 NV_DAEMON_MODULES(F) |
| 112 NV_KERNEL_MODULES(F) |
| 113 #undef F |
| 114 |
| 115 #define F(X) NV_IDL_DECLS_DISPATCH_DAEMON(X) |
| 116 NV_DAEMON_MODULES(F) |
| 117 #undef F |
| 118 |
| 119 #define F(X) NV_IDL_DECLS_DISPATCH_KERNEL(X) |
| 120 NV_KERNEL_MODULES(F) |
| 121 #undef F |
| 122 |
| 123 /* utility functions called by stubs & dispatchers for transferring data |
| 124 * over FIFO objects. semantics are identical to NvOsFread / NvOsFwrite */ |
| 125 NvError NvIdlHelperFifoRead(void *fifo, void *ptr, size_t len, size_t *read); |
| 126 NvError NvIdlHelperFifoWrite(void *fifo, const void *ptr, size_t len); |
| 127 |
| 128 /* utility functions called by stub helpers to allocate and free FIFOs */ |
| 129 NvError NvIdlHelperGetFifoPair(NvIdlFifoPair **pFifo); |
| 130 void NvIdlHelperReleaseFifoPair(NvIdlFifoPair *pFifo); |
| 131 |
| 132 #endif |
OLD | NEW |