LCOV - code coverage report
Current view: top level - legacy/ascend950/unified_platform/common - orion_adapter_hal.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 47.8 % 23 11
Test Date: 2026-08-17 10:19:35 Functions: 50.0 % 4 2

            Line data    Source code
       1              : /**
       2              :  * Copyright (c) 2025 Huawei Technologies Co., Ltd.
       3              :  * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
       4              :  * CANN Open Software License Agreement Version 2.0 (the "License").
       5              :  * Please refer to the License for details. You may not use this file except in compliance with the License.
       6              :  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
       7              :  * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
       8              :  * See LICENSE in the root of the software repository for the full text of the License.
       9              :  */
      10              : #include "orion_adapter_hal.h"
      11              : 
      12              : #include "dlhal_function_v2.h"
      13              : #include "ascend_hal_error.h"
      14              : #include "log.h"
      15              : 
      16              : namespace Hccl {
      17            0 : HcclResult HrtHalDrvQueryProcessHostPid(
      18              :     int pid, unsigned int* chipId, unsigned int* vfid, unsigned int* hostPid, unsigned int* cpType)
      19              : {
      20            0 :     CHK_PTR_NULL(hostPid);
      21              :     // 和底软确认,chipId、vfid、hostPid、cpType不需要校验空指针,如果传入空指针表示当前不获取该值
      22            0 :     drvError_t ret = DlHalFunctionV2::GetInstance().dlHalDrvQueryProcessHostPid(pid, chipId, vfid, hostPid, cpType);
      23            0 :     CHK_PRT_RET(
      24              :         ret != DRV_ERROR_NONE,
      25              :         HCCL_ERROR(
      26              :             "errNo[0x%016llx] HrtHalDrvQueryProcessHostPid fail,"
      27              :             "return[%d], para: pid[%d].",
      28              :             HCCL_ERROR_CODE(HCCL_E_DRV), ret, pid),
      29              :         HCCL_E_DRV);
      30            0 :     HCCL_INFO("HrtHalDrvQueryProcessHostPid pid[%d] hostPid[%u]", pid, *hostPid);
      31            0 :     return HCCL_SUCCESS;
      32              : }
      33              : 
      34            0 : HcclResult HrtHalGetDeviceInfo(uint32_t devId, int32_t moduleType, int32_t infoType, int64_t& value)
      35              : {
      36            0 :     CHK_RET(DlHalFunctionV2::GetInstance().DlHalFunctionInit());
      37            0 :     drvError_t ret = DlHalFunctionV2::GetInstance().dlHalGetDeviceInfo(devId, moduleType, infoType, &value);
      38            0 :     CHK_PRT_RET(
      39              :         ret == DRV_ERROR_NOT_SUPPORT,
      40              :         HCCL_ERROR(
      41              :             "errNo[0x%016llx] HrtHalGetDeviceInfo not support"
      42              :             "return[%d].",
      43              :             HCCL_ERROR_CODE(DRV_ERROR_NOT_SUPPORT), ret),
      44              :         HCCL_E_NOT_SUPPORT);
      45            0 :     CHK_PRT_RET(
      46              :         ret != DRV_ERROR_NONE,
      47              :         HCCL_ERROR(
      48              :             "errNo[0x%016llx] HrtHalGetDeviceInfo fail,"
      49              :             "return[%d].",
      50              :             HCCL_ERROR_CODE(HCCL_E_DRV), ret),
      51              :         HCCL_E_DRV);
      52            0 :     return HCCL_SUCCESS;
      53              : }
      54              : 
      55            3 : HcclResult HrtHalHostRegister(void* srcPtr, uint64_t size, uint32_t flag, int32_t deviceLogicId, void** dstPtr)
      56              : {
      57            3 :     CHK_PTR_NULL(srcPtr);
      58            3 :     CHK_PTR_NULL(dstPtr);
      59              : 
      60            3 :     drvError_t ret = halHostRegister(srcPtr, size, flag, deviceLogicId, dstPtr);
      61            6 :     CHK_PRT_RET(
      62              :         ret != DRV_ERROR_NONE,
      63              :         HCCL_ERROR(
      64              :             "errNo[0x%016llx] HrtHalHostRegister fail,"
      65              :             "return[%d].",
      66              :             HCCL_ERROR_CODE(HCCL_E_DRV), ret),
      67              :         HCCL_E_DRV);
      68            2 :     return HCCL_SUCCESS;
      69              : }
      70              : 
      71            6 : HcclResult HrtHalHostUnregister(void* ptr, int32_t deviceLogicId)
      72              : {
      73            6 :     CHK_PTR_NULL(ptr);
      74              : 
      75            6 :     drvError_t ret = halHostUnregister(ptr, deviceLogicId);
      76            6 :     CHK_PRT_RET(
      77              :         ret != DRV_ERROR_NONE,
      78              :         HCCL_ERROR(
      79              :             "errNo[0x%016llx] HrtHalHostUnregister fail,"
      80              :             "return[%d].",
      81              :             HCCL_ERROR_CODE(HCCL_E_DRV), ret),
      82              :         HCCL_E_DRV);
      83            6 :     return HCCL_SUCCESS;
      84              : }
      85              : } // namespace Hccl
        

Generated by: LCOV version 2.0-1