1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2022 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 /********************* Chip Specific HAL TMR Routines **********************\
24 *                                                                           *
25 *   The GA100 specific HAL TMR routines reside in this file.                *
26 *                                                                           *
27 \***************************************************************************/
28 /* ------------------------- Includes --------------------------------------- */
29 #include "gpu/gpu.h"
30 #include "objtmr.h"
31 #include "published/ampere/ga100/dev_vm.h"
32 /* ------------------------- Datatypes -------------------------------------- */
33 /* ------------------------- Macros ----------------------------------------- */
34 /* ------------------------- Static Function Prototypes --------------------- */
35 /* ------------------------- Public Functions  ------------------------------ */
36 
37 /*!
38  * @brief Gets GPU PTIMER offsets
39  *
40  */
41 NV_STATUS
42 tmrGetGpuPtimerOffset_GA100
43 (
44     OBJGPU  *pGpu,
45     OBJTMR  *pTmr,
46     NvU32   *pGpuTimestampOffsetLo,
47     NvU32   *pGpuTimestampOffsetHi
48 )
49 {
50     {
51         *pGpuTimestampOffsetLo = GPU_GET_VREG_OFFSET(pGpu, NV_VIRTUAL_FUNCTION_TIME_0);
52         *pGpuTimestampOffsetHi = GPU_GET_VREG_OFFSET(pGpu, NV_VIRTUAL_FUNCTION_TIME_1);
53     }
54 
55     return NV_OK;
56 }
57