1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2020-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: MIT
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in
13  * all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21  * DEALINGS IN THE SOFTWARE.
22  */
23 
24 #define NVOC_KERNEL_IOCTRL_H_PRIVATE_ACCESS_ALLOWED
25 
26 #include "kernel/gpu/nvlink/kernel_nvlink.h"
27 #include "kernel/gpu/nvlink/kernel_ioctrl.h"
28 
29 /*!
30  * @brief Construct a KernelIoctrl object
31  *
32  * @param[in]  pGpu          GPU object pointer
33  * @param[in]  pKernelIoctrl KernelIoctrl object pointer
34  * @param[in]  publicId      The ID of the ioctrl to be constructed
35  *
36  * @return  NV_OK on success
37  */
38 NV_STATUS
kioctrlConstructEngine_IMPL(OBJGPU * pGpu,KernelIoctrl * pKernelIoctrl,NvU32 publicId)39 kioctrlConstructEngine_IMPL
40 (
41     OBJGPU        *pGpu,
42     KernelIoctrl  *pKernelIoctrl,
43     NvU32          publicId
44 )
45 {
46     NV_STATUS    status = NV_OK;
47     OBJENGSTATE *pEngstate;
48 
49     pKernelIoctrl->PublicId = publicId;
50 
51     // Default the IOCTRL IP version
52     pKernelIoctrl->ipVerIoctrl = NVLINK_VERSION_10;
53 
54     pEngstate = dynamicCast(pKernelIoctrl, OBJENGSTATE);
55     pEngstate->engDesc = ENG_KERNEL_IOCTRL(publicId);
56 
57     status = kioctrlMinionConstruct_HAL(pGpu, pKernelIoctrl);
58 
59     return status;
60 }
61 
62 /*!
63  * @brief Destruct a KernelIoctrl object
64  *
65  * @param[in] pKernelIoctrl  KernelIoctrl object pointer
66  */
67 void
kioctrlDestructEngine_IMPL(KernelIoctrl * pKernelIoctrl)68 kioctrlDestructEngine_IMPL
69 (
70     KernelIoctrl *pKernelIoctrl
71 )
72 {
73     return;
74 }
75