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-07-28 12:11:00 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              : {
      18            0 : HcclResult HrtHalDrvQueryProcessHostPid(int pid, unsigned int *chipId, unsigned int *vfid,
      19              :     unsigned int *hostPid, unsigned int *cpType)
      20              : {
      21            0 :     CHK_PTR_NULL(hostPid);
      22              :     // 和底软确认,chipId、vfid、hostPid、cpType不需要校验空指针,如果传入空指针表示当前不获取该值
      23            0 :     drvError_t ret = DlHalFunctionV2::GetInstance().dlHalDrvQueryProcessHostPid(pid,
      24              :         chipId, vfid, hostPid, cpType);
      25            0 :     CHK_PRT_RET(ret != DRV_ERROR_NONE, HCCL_ERROR("errNo[0x%016llx] HrtHalDrvQueryProcessHostPid fail,"
      26              :         "return[%d], para: pid[%d].", HCCL_ERROR_CODE(HCCL_E_DRV), ret, pid), HCCL_E_DRV);
      27            0 :     HCCL_INFO("HrtHalDrvQueryProcessHostPid pid[%d] hostPid[%u]", pid, *hostPid);
      28            0 :     return HCCL_SUCCESS;
      29              : }
      30              : 
      31            0 : HcclResult HrtHalGetDeviceInfo(uint32_t devId, int32_t moduleType, int32_t infoType, int64_t &value)
      32              : {
      33            0 :     CHK_RET(DlHalFunctionV2::GetInstance().DlHalFunctionInit());
      34            0 :     drvError_t ret = DlHalFunctionV2::GetInstance().dlHalGetDeviceInfo(devId, moduleType, infoType, &value);
      35            0 :     CHK_PRT_RET(ret == DRV_ERROR_NOT_SUPPORT, HCCL_ERROR("errNo[0x%016llx] HrtHalGetDeviceInfo not support"
      36              :         "return[%d].", HCCL_ERROR_CODE(DRV_ERROR_NOT_SUPPORT), ret), HCCL_E_NOT_SUPPORT);
      37            0 :     CHK_PRT_RET(ret != DRV_ERROR_NONE, HCCL_ERROR("errNo[0x%016llx] HrtHalGetDeviceInfo fail,"
      38              :         "return[%d].", HCCL_ERROR_CODE(HCCL_E_DRV), ret), HCCL_E_DRV);
      39            0 :     return HCCL_SUCCESS;
      40              : }
      41              : 
      42            3 : HcclResult HrtHalHostRegister(void *srcPtr, uint64_t size, uint32_t flag, int32_t deviceLogicId, void **dstPtr)
      43              : {
      44            3 :     CHK_PTR_NULL(srcPtr);
      45            3 :     CHK_PTR_NULL(dstPtr);
      46              : 
      47            3 :     drvError_t ret = halHostRegister(srcPtr, size, flag, deviceLogicId, dstPtr);
      48            6 :     CHK_PRT_RET(ret != DRV_ERROR_NONE, HCCL_ERROR("errNo[0x%016llx] HrtHalHostRegister fail,"
      49              :         "return[%d].", HCCL_ERROR_CODE(HCCL_E_DRV), ret), HCCL_E_DRV);
      50            2 :     return HCCL_SUCCESS;
      51              : }
      52              : 
      53            6 : HcclResult HrtHalHostUnregister(void *ptr, int32_t deviceLogicId)
      54              : {
      55            6 :     CHK_PTR_NULL(ptr);
      56              : 
      57            6 :     drvError_t ret = halHostUnregister(ptr, deviceLogicId);
      58            6 :     CHK_PRT_RET(ret != DRV_ERROR_NONE, HCCL_ERROR("errNo[0x%016llx] HrtHalHostUnregister fail,"
      59              :         "return[%d].", HCCL_ERROR_CODE(HCCL_E_DRV), ret), HCCL_E_DRV);
      60            6 :     return HCCL_SUCCESS;
      61              : }
      62              : }
        

Generated by: LCOV version 2.0-1