* Copyright (c) 2025 Huawei Technologies Co., Ltd.
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
* CANN Open Software License Agreement Version 2.0 (the "License").
* Please refer to the License for details. You may not use this file except in compliance with the License.
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
* See LICENSE in the root of the software repository for the full text of the License.
*/
#ifndef BBOX_EXCEPTION_H
#define BBOX_EXCEPTION_H
#include "bbox_int.h"
#include "bbox_product.h"
#define MODULE_MAGIC 0xbaba0514U
#define RDR_EXCEPTIONDESC_MAXLEN 48
#define RDR_MODULE_NAME_LEN 16
#define THREAD_SIZE 0x2000
struct exc_description_s {
u32 e_excep_id;
u8 e_process_level;
u8 e_reboot_priority;
u8 e_excep_type;
u8 e_reentrant;
u64 e_notify_core_mask;
u8 e_desc[RDR_EXCEPTIONDESC_MAXLEN];
};
struct exc_info_s {
bbox_time_t e_clock;
u32 e_excep_id;
u16 e_dump_status;
u16 e_save_status;
};
struct exc_module_info_s {
u32 magic;
u16 e_excep_valid;
u16 e_excep_num;
u8 e_from_module[RDR_MODULE_NAME_LEN];
struct exc_info_s cur_info;
u32 e_mini_offset;
u32 e_mini_len;
u32 e_info_offset;
u32 e_info_len;
struct exc_description_s e_description[1];
};
struct rdr_ddr_module_infos {
u32 magic;
u32 e_mini_offset;
u32 e_mini_len;
u32 e_info_offset;
u32 e_info_len;
};
enum BBOX_PROXY_BLOCK_TYPE {
BLOCK_TYPE_NORMAL = 1 << 0,
BLOCK_TYPE_STARTUP = 1 << 1
};
#define BBOX_PROXY_MAGIC 0x56312e31
#define BBOX_PROXY_CTRL_PAD 3
static inline u32 bbox_get_magic(const buff *buffer)
{
return (*(const u32 *)buffer);
}
struct bbox_proxy_exception_ctrl {
bbox_time_t e_clock;
u32 e_main_excepid;
u32 e_sub_excepid;
u32 e_info_offset;
u32 e_info_len;
u16 e_dump_status;
u16 e_save_status;
u32 e_reserved;
};
struct bbox_proxy_block_info {
u32 ctrl_type : 16;
u32 ctrl_flag : 16;
u32 info_offset;
u32 info_block_len;
};
struct bbox_proxy_ctrl_info {
u8 e_block_num;
u8 padding[BBOX_PROXY_CTRL_PAD];
struct bbox_proxy_block_info block_info[BBOX_PROXY_CTRL_NUM];
};
struct bbox_proxy_module_ctrl {
u32 magic;
struct bbox_proxy_ctrl_info config;
struct bbox_proxy_exception_ctrl block[BBOX_PROXY_CTRL_NUM];
u8 reserved[BBOX_PROXY_CTRL_RESERV];
};
struct bbox_module_exception_ctrl {
bbox_time_t e_clock;
u32 e_excep_id;
u32 e_block_offset;
u32 e_block_len;
u32 e_info_len;
};
#define BBOX_MODULE_MAGIC 0x56312e32
#define BBOX_MODULE_CTRL_PAD 3
#define BBOX_MODULE_CTRL_NUM 6
#define BBOX_MODULE_CTRL_RESERV 312
struct bbox_module_ctrl {
u32 magic;
u8 e_block_num;
u8 padding[BBOX_MODULE_CTRL_PAD];
struct bbox_module_exception_ctrl block[BBOX_MODULE_CTRL_NUM];
u8 reserved[BBOX_MODULE_CTRL_RESERV];
};
#define BBOX_MODULE_CTRL_BLOCK_SIZE sizeof(struct bbox_module_ctrl)
#endif