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-18 17:47:01 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              : 
      11              : #include "orion_adapter_hal.h"
      12              : 
      13              : #include "dlhal_function_v2.h"
      14              : #include "ascend_hal_error.h"
      15              : #include "log.h"
      16              : 
      17              : namespace Hccl {
      18            0 : HcclResult HrtHalDrvQueryProcessHostPid(
      19              :     int pid, unsigned int* chipId, unsigned int* vfid, 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, chipId, vfid, hostPid, cpType);
      24            0 :     CHK_PRT_RET(
      25              :         ret != DRV_ERROR_NONE,
      26              :         HCCL_ERROR(
      27              :             "errNo[0x%016llx] HrtHalDrvQueryProcessHostPid fail,"
      28              :             "return[%d], para: pid[%d].",
      29              :             HCCL_ERROR_CODE(HCCL_E_DRV), ret, pid),
      30              :         HCCL_E_DRV);
      31            0 :     HCCL_INFO("HrtHalDrvQueryProcessHostPid pid[%d] hostPid[%u]", pid, *hostPid);
      32            0 :     return HCCL_SUCCESS;
      33              : }
      34              : 
      35            0 : HcclResult HrtHalGetDeviceInfo(uint32_t devId, int32_t moduleType, int32_t infoType, int64_t& value)
      36              : {
      37            0 :     CHK_RET(DlHalFunctionV2::GetInstance().DlHalFunctionInit());
      38            0 :     drvError_t ret = DlHalFunctionV2::GetInstance().dlHalGetDeviceInfo(devId, moduleType, infoType, &value);
      39            0 :     CHK_PRT_RET(
      40              :         ret == DRV_ERROR_NOT_SUPPORT,
      41              :         HCCL_ERROR(
      42              :             "errNo[0x%016llx] HrtHalGetDeviceInfo not support"
      43              :             "return[%d].",
      44              :             HCCL_ERROR_CODE(DRV_ERROR_NOT_SUPPORT), ret),
      45              :         HCCL_E_NOT_SUPPORT);
      46            0 :     CHK_PRT_RET(
      47              :         ret != DRV_ERROR_NONE,
      48              :         HCCL_ERROR(
      49              :             "errNo[0x%016llx] HrtHalGetDeviceInfo fail,"
      50              :             "return[%d].",
      51              :             HCCL_ERROR_CODE(HCCL_E_DRV), ret),
      52              :         HCCL_E_DRV);
      53            0 :     return HCCL_SUCCESS;
      54              : }
      55              : 
      56            3 : HcclResult HrtHalHostRegister(void* srcPtr, uint64_t size, uint32_t flag, int32_t deviceLogicId, void** dstPtr)
      57              : {
      58            3 :     CHK_PTR_NULL(srcPtr);
      59            3 :     CHK_PTR_NULL(dstPtr);
      60              : 
      61            3 :     drvError_t ret = halHostRegister(srcPtr, size, flag, deviceLogicId, dstPtr);
      62            6 :     CHK_PRT_RET(
      63              :         ret != DRV_ERROR_NONE,
      64              :         HCCL_ERROR(
      65              :             "errNo[0x%016llx] HrtHalHostRegister fail,"
      66              :             "return[%d].",
      67              :             HCCL_ERROR_CODE(HCCL_E_DRV), ret),
      68              :         HCCL_E_DRV);
      69            2 :     return HCCL_SUCCESS;
      70              : }
      71              : 
      72            6 : HcclResult HrtHalHostUnregister(void* ptr, int32_t deviceLogicId)
      73              : {
      74            6 :     CHK_PTR_NULL(ptr);
      75              : 
      76            6 :     drvError_t ret = halHostUnregister(ptr, deviceLogicId);
      77            6 :     CHK_PRT_RET(
      78              :         ret != DRV_ERROR_NONE,
      79              :         HCCL_ERROR(
      80              :             "errNo[0x%016llx] HrtHalHostUnregister fail,"
      81              :             "return[%d].",
      82              :             HCCL_ERROR_CODE(HCCL_E_DRV), ret),
      83              :         HCCL_E_DRV);
      84            6 :     return HCCL_SUCCESS;
      85              : }
      86              : } // namespace Hccl
        

Generated by: LCOV version 2.0-1