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 "cloud_v5_platform.h"
11 :
12 : #include "adump_platform_registry.h"
13 : #include "dump_common.h"
14 : #include "kernel_pc_fixer.h"
15 : #include "register_config.h"
16 :
17 : namespace Adx {
18 :
19 : ADUMP_PLATFORM_REGISTER(FeaturesSupportInterface, PlatformType::CHIP_CLOUD_V5, CloudV5Features);
20 : ADUMP_PLATFORM_REGISTER(CoredumpInterface, PlatformType::CHIP_CLOUD_V5, CloudV5Coredump);
21 : ADUMP_PLATFORM_REGISTER(ExceptionDumpInterface, PlatformType::CHIP_CLOUD_V5, CloudV5Exception);
22 : ADUMP_PLATFORM_REGISTER(DataDumpInterface, PlatformType::CHIP_CLOUD_V5, CloudV5DataDump);
23 :
24 : namespace {
25 : constexpr uint32_t MAX_AIC_CORE_COUNT = 70U;
26 : constexpr uint32_t MAX_AIV_CORE_COUNT = 70U;
27 : constexpr uint32_t MAX_ALL_CORE_COUNT = MAX_AIC_CORE_COUNT + MAX_AIV_CORE_COUNT;
28 : } // namespace
29 :
30 3 : CloudV5Features::CloudV5Features()
31 : {
32 : supported_ = {
33 : AdumpPlatformFeature::FEATURE_DATA_DUMP, AdumpPlatformFeature::FEATURE_OVERFLOW_DUMP,
34 : AdumpPlatformFeature::FEATURE_EXCEPTION_DUMP_L0, AdumpPlatformFeature::FEATURE_EXCEPTION_DUMP_L1,
35 : AdumpPlatformFeature::FEATURE_CORE_DUMP,
36 3 : };
37 3 : }
38 :
39 6 : std::unique_ptr<PcFixerInterface> CloudV5Coredump::CreatePcFixer() const
40 : {
41 12 : return std::unique_ptr<PcFixerInterface>(new (std::nothrow) CloudV5PcFixer());
42 : }
43 :
44 2 : std::shared_ptr<RegisterInterface> CloudV5Coredump::CreateRegister() const
45 : {
46 2 : return std::make_shared<CloudV5Register>();
47 : }
48 :
49 15 : uint16_t CloudV5Coredump::ConvertCoreId(uint8_t coreType, uint16_t coreId) const
50 : {
51 15 : return (coreType == CORE_TYPE_AIC) ? coreId : static_cast<uint16_t>(MAX_AIC_CORE_COUNT + coreId);
52 : }
53 :
54 3 : uint64_t CloudV5DataDump::GetKfcStackSize() const
55 : {
56 3 : constexpr uint32_t op_stack_count = MAX_ALL_CORE_COUNT;
57 3 : return CalcKfcStackSize(op_stack_count);
58 : }
59 :
60 3 : std::vector<std::string> CloudV5DataDump::GetKfcBinNames() const
61 : {
62 9 : return {"dump_stat_op_ascend960.o", "kfc_dump_stat_ascend960.o"};
63 : }
64 :
65 3 : size_t CloudV5DataDump::GetCoreTypeIDOffset() const { return MAX_AIV_CORE_COUNT; }
66 :
67 12 : size_t CloudV5DataDump::GetBlockNum() const { return MAX_ALL_CORE_COUNT; }
68 :
69 : } // namespace Adx
|