| /* |
| * Samsung debugging features for Samsung's SoC's. |
| * |
| * Copyright (c) 2014-2019 Samsung Electronics Co., Ltd. |
| * http://www.samsung.com |
| * |
| * This program is free software; you can redistribute it and/or modify |
| * it under the terms of the GNU General Public License as published by |
| * the Free Software Foundation; either version 2 of the License, or |
| * (at your option) any later version. |
| */ |
| |
| #ifndef SEC_DEBUG_H |
| #define SEC_DEBUG_H |
| |
| #include <linux/sizes.h> |
| #include <linux/reboot.h> |
| #include <linux/irq.h> |
| #include <linux/sec_ext.h> |
| #include <linux/sec_debug_types.h> |
| |
| #define SEC_DEBUG_MAGIC_PA memblock_start_of_DRAM() |
| #define SEC_DEBUG_MAGIC_VA phys_to_virt(SEC_DEBUG_MAGIC_PA) |
| #define SEC_DEBUG_EXTRA_INFO_VA (SEC_DEBUG_MAGIC_VA + 0x400) |
| #define SEC_DEBUG_DUMPER_LOG_VA (SEC_DEBUG_MAGIC_VA + 0x800) |
| #define BUF_SIZE_MARGIN (SZ_1K - 0x80) |
| |
| /* |
| * SEC DEBUG |
| */ |
| #define SEC_DEBUG_MAGIC_INFORM (EXYNOS_PMU_INFORM2) |
| #define SEC_DEBUG_PANIC_INFORM (EXYNOS_PMU_INFORM3) |
| |
| #ifdef CONFIG_SEC_DEBUG |
| extern void sec_debug_clear_magic_rambase(void); |
| extern int id_get_asb_ver(void); |
| extern int id_get_product_line(void); |
| extern void sec_debug_reboot_handler(void *p); |
| extern void sec_debug_panic_handler(void *buf, bool dump); |
| extern void sec_debug_post_panic_handler(void); |
| |
| extern int sec_debug_get_debug_level(void); |
| extern int sec_debug_enter_upload(void); |
| extern void sec_debug_disable_printk_process(void); |
| extern char *verbose_reg(int cpu_type, int reg_name, unsigned long reg_val); |
| /* getlog support */ |
| extern void sec_getlog_supply_kernel(void *klog_buf); |
| extern void sec_getlog_supply_platform(unsigned char *buffer, const char *name); |
| extern void sec_gaf_supply_rqinfo(unsigned short curr_offset, unsigned short rq_offset); |
| #else |
| #define id_get_asb_ver() (-1) |
| #define id_get_product_line() (-1) |
| #define sec_debug_reboot_handler(a) do { } while (0) |
| #define sec_debug_panic_handler(a, b) do { } while (0) |
| #define sec_debug_post_panic_handler() do { } while (0) |
| |
| #define sec_debug_get_debug_level() (0) |
| #define sec_debug_disable_printk_process() do { } while (0) |
| #define sec_debug_verbose_reg(a, b, c) do { } while (0) |
| |
| #define sec_getlog_supply_kernel(a) do { } while (0) |
| #define sec_getlog_supply_platform(a, b) do { } while (0) |
| |
| #define sec_gaf_supply_rqinfo(a, b) do { } while (0) |
| #endif /* CONFIG_SEC_DEBUG */ |
| |
| enum sec_debug_reset_reason_t { |
| RR_S = 1, |
| RR_W = 2, |
| RR_D = 3, |
| RR_K = 4, |
| RR_M = 5, |
| RR_P = 6, |
| RR_R = 7, |
| RR_B = 8, |
| RR_N = 9, |
| RR_T = 10, |
| RR_C = 11, |
| }; |
| |
| extern unsigned reset_reason; |
| |
| struct sec_debug_ksyms { |
| uint32_t magic; |
| uint32_t kallsyms_all; |
| uint64_t addresses_pa; |
| uint64_t names_pa; |
| uint64_t num_syms; |
| uint64_t token_table_pa; |
| uint64_t token_index_pa; |
| uint64_t markers_pa; |
| struct ksect { |
| uint64_t sinittext; |
| uint64_t einittext; |
| uint64_t stext; |
| uint64_t etext; |
| uint64_t end; |
| } sect; |
| uint64_t relative_base; |
| uint64_t offsets_pa; |
| uint64_t kimage_voffset; |
| uint64_t reserved[4]; |
| }; |
| |
| /* sec debug next */ |
| struct basic_type_int { |
| uint64_t pa; /* physical address of the variable */ |
| uint32_t size; /* size of basic type. eg sizeof(unsigned long) goes here */ |
| uint32_t count; /* for array types */ |
| }; |
| |
| struct sec_debug_kcnst { |
| uint64_t nr_cpus; |
| struct basic_type_int per_cpu_offset; |
| |
| uint64_t phys_offset; |
| uint64_t phys_mask; |
| uint64_t page_offset; |
| uint64_t page_mask; |
| uint64_t page_shift; |
| |
| uint64_t va_bits; |
| uint64_t kimage_vaddr; |
| uint64_t kimage_voffset; |
| |
| uint64_t pa_swapper; |
| uint64_t pgdir_shift; |
| uint64_t pud_shift; |
| uint64_t pmd_shift; |
| |
| uint64_t ptrs_per_pgd; |
| uint64_t ptrs_per_pud; |
| uint64_t ptrs_per_pmd; |
| uint64_t ptrs_per_pte; |
| |
| uint64_t kconfig_base; |
| uint64_t kconfig_size; |
| |
| uint64_t pa_text; |
| uint64_t pa_start_rodata; |
| uint64_t reserved[4]; |
| }; |
| |
| struct member_type { |
| uint16_t size; |
| uint16_t offset; |
| }; |
| |
| typedef struct member_type member_type_int; |
| typedef struct member_type member_type_long; |
| typedef struct member_type member_type_longlong; |
| typedef struct member_type member_type_ptr; |
| typedef struct member_type member_type_str; |
| |
| struct struct_thread_info { |
| uint32_t struct_size; |
| member_type_long flags; |
| member_type_ptr task; |
| member_type_int cpu; |
| member_type_long rrk; |
| }; |
| |
| struct struct_task_struct { |
| uint32_t struct_size; |
| member_type_long state; |
| member_type_long exit_state; |
| member_type_ptr stack; |
| member_type_int flags; |
| member_type_int on_cpu; |
| member_type_int on_rq; |
| member_type_int cpu; |
| member_type_int pid; |
| member_type_str comm; |
| member_type_ptr tasks_next; |
| member_type_ptr thread_group_next; |
| member_type_long fp; |
| member_type_long sp; |
| member_type_long pc; |
| member_type_long sched_info__pcount; |
| member_type_longlong sched_info__run_delay; |
| member_type_longlong sched_info__last_arrival; |
| member_type_longlong sched_info__last_queued; |
| member_type_int ssdbg_wait__type; |
| member_type_ptr ssdbg_wait__data; |
| }; |
| |
| struct irq_stack_info { |
| uint64_t pcpu_stack; /* IRQ_STACK_PTR(0) */ |
| uint64_t size; /* IRQ_STACK_SIZE */ |
| uint64_t start_sp; /* IRQ_STACK_START_SP */ |
| }; |
| |
| struct sec_debug_task { |
| uint64_t stack_size; /* THREAD_SIZE */ |
| uint64_t start_sp; /* TRHEAD_START_SP */ |
| struct struct_thread_info ti; |
| struct struct_task_struct ts; |
| uint64_t init_task; |
| struct irq_stack_info irq_stack; |
| }; |
| |
| struct sec_debug_spinlock_info { |
| member_type_int owner_cpu; |
| member_type_ptr owner; |
| int debug_enabled; |
| }; |
| |
| #define SD_ESSINFO_KEY_SIZE (32) |
| #define SD_NR_ESSINFO_ITEMS (16) |
| |
| struct ess_info_offset { |
| char key[SD_ESSINFO_KEY_SIZE]; |
| unsigned long base; |
| unsigned long last; |
| unsigned int nr; |
| unsigned int size; |
| unsigned int per_core; |
| }; |
| |
| struct sec_debug_ess_info { |
| struct ess_info_offset item[SD_NR_ESSINFO_ITEMS]; |
| }; |
| |
| struct watchdogd_info { |
| struct task_struct *tsk; |
| struct thread_info *thr; |
| struct rtc_time *tm; |
| |
| unsigned long long last_ping_time; |
| int last_ping_cpu; |
| bool init_done; |
| |
| unsigned long emerg_addr; |
| }; |
| |
| struct bad_stack_info { |
| unsigned long magic; |
| unsigned long esr; |
| unsigned long far; |
| unsigned long spel0; |
| unsigned long cpu; |
| unsigned long tsk_stk; |
| unsigned long irq_stk; |
| unsigned long ovf_stk; |
| }; |
| |
| struct suspend_dev_info { |
| uint64_t suspend_func; |
| uint64_t suspend_device; |
| uint64_t shutdown_func; |
| uint64_t shutdown_device; |
| }; |
| |
| struct sec_debug_kernel_data { |
| uint64_t task_in_pm_suspend; |
| uint64_t task_in_sys_reboot; |
| uint64_t task_in_sys_shutdown; |
| uint64_t task_in_dev_shutdown; |
| uint64_t task_in_sysrq_crash; |
| uint64_t task_in_soft_lockup; |
| uint64_t cpu_in_soft_lockup; |
| uint64_t task_in_hard_lockup; |
| uint64_t cpu_in_hard_lockup; |
| uint64_t unfrozen_task; |
| uint64_t unfrozen_task_count; |
| uint64_t sync_irq_task; |
| uint64_t sync_irq_num; |
| uint64_t sync_irq_name; |
| uint64_t sync_irq_desc; |
| uint64_t sync_irq_thread; |
| uint64_t sync_irq_threads_active; |
| uint64_t dev_shutdown_start; |
| uint64_t dev_shutdown_end; |
| uint64_t dev_shutdown_duration; |
| uint64_t dev_shutdown_func; |
| uint64_t sysrq_ptr; |
| struct watchdogd_info wddinfo; |
| struct bad_stack_info bsi; |
| struct suspend_dev_info sdi; |
| }; |
| |
| enum sdn_map { |
| SDN_MAP_DUMP_SUMMARY, |
| SDN_MAP_AUTO_COMMENT, |
| SDN_MAP_EXTRA_INFO, |
| SDN_MAP_AUTO_ANALYSIS, |
| SDN_MAP_INITTASK_LOG, |
| SDN_MAP_DEBUG_PARAM, |
| SDN_MAP_FIRST_KMSG, |
| SDN_MAP_SPARED_BUFFER, |
| NR_SDN_MAP, |
| }; |
| |
| struct sec_debug_buf { |
| unsigned long base; |
| unsigned long size; |
| }; |
| |
| struct sec_debug_map { |
| struct sec_debug_buf buf[NR_SDN_MAP]; |
| }; |
| |
| #define SET_MEMBER_TYPE_INFO(PTR, TYPE, MEMBER) \ |
| { \ |
| (PTR)->size = sizeof(((TYPE *)0)->MEMBER); \ |
| (PTR)->offset = offsetof(TYPE, MEMBER); \ |
| } |
| |
| struct sec_debug_memtab { |
| uint64_t table_start_pa; |
| uint64_t table_end_pa; |
| uint64_t reserved[4]; |
| }; |
| |
| #define THREAD_START_SP (THREAD_SIZE - 16) |
| #define IRQ_STACK_START_SP THREAD_START_SP |
| |
| #define SEC_DEBUG_MAGIC0 (0x11221133) |
| #define SEC_DEBUG_MAGIC1 (0x12121313) |
| |
| enum { |
| DSS_KEVENT_TASK, |
| DSS_KEVENT_WORK, |
| DSS_KEVENT_IRQ, |
| DSS_KEVENT_FREQ, |
| DSS_KEVENT_IDLE, |
| DSS_KEVENT_THRM, |
| DSS_KEVENT_ACPM, |
| }; |
| |
| extern unsigned int get_smpl_warn_number(void); |
| extern void (*mach_restart)(enum reboot_mode mode, const char *cmd); |
| |
| extern void sec_debug_task_sched_log_short_msg(char *msg); |
| extern void sec_debug_task_sched_log(int cpu, struct task_struct *task); |
| extern void sec_debug_irq_sched_log(unsigned int irq, void *fn, int en); |
| extern void sec_debug_irq_enterexit_log(unsigned int irq, unsigned long long start_time); |
| |
| extern void sec_debug_set_kallsyms_info(struct sec_debug_ksyms *ksyms, int magic); |
| extern int sec_debug_check_sj(void); |
| |
| extern unsigned int sec_debug_get_kevent_paddr(int type); |
| |
| extern char *get_bk_item_val(const char *key); |
| extern void get_bk_item_val_as_string(const char *key, char *buf); |
| extern void sec_debug_get_kevent_info(struct ess_info_offset *p, int type); |
| extern unsigned long sec_debug_get_kevent_index_addr(int type); |
| |
| extern void sec_debug_set_task_in_pm_suspend(uint64_t task); |
| extern void sec_debug_set_task_in_sys_reboot(uint64_t task); |
| extern void sec_debug_set_task_in_sys_shutdown(uint64_t task); |
| extern void sec_debug_set_task_in_dev_shutdown(uint64_t task); |
| extern void sec_debug_set_sysrq_crash(struct task_struct *task); |
| extern void sec_debug_set_task_in_soft_lockup(uint64_t task); |
| extern void sec_debug_set_cpu_in_soft_lockup(uint64_t cpu); |
| extern void sec_debug_set_task_in_hard_lockup(uint64_t task); |
| extern void sec_debug_set_cpu_in_hard_lockup(uint64_t cpu); |
| extern void sec_debug_set_unfrozen_task(uint64_t task); |
| extern void sec_debug_set_unfrozen_task_count(uint64_t count); |
| extern void sec_debug_set_task_in_sync_irq(uint64_t task, unsigned int irq, const char *name, struct irq_desc *desc); |
| extern void sec_debug_set_device_shutdown_timeinfo(uint64_t start, uint64_t end, uint64_t duration, uint64_t func); |
| extern void sec_debug_clr_device_shutdown_timeinfo(void); |
| |
| extern struct watchdogd_info *sec_debug_get_wdd_info(void); |
| extern struct bad_stack_info *sec_debug_get_bs_info(void); |
| extern void *sec_debug_get_debug_base(int type); |
| extern unsigned long sec_debug_get_buf_base(int type); |
| extern unsigned long sec_debug_get_buf_size(int type); |
| |
| #define ENABLE_SDCARD_RAMDUMP (0x73646364) |
| #define MAGIC_SDR_FOR_MINFORM (0x3) |
| #define OFFSET_SDR_FOR_MINFORM (0x0) |
| #define MASK_SDR_FOR_MINFORM (0xF) |
| |
| extern void sec_set_reboot_magic(int magic, int offset, int mask); |
| |
| #ifdef CONFIG_SEC_DEBUG |
| extern void sec_debug_set_shutdown_device(const char *fname, const char *dname); |
| extern void sec_debug_set_suspend_device(const char *fname, const char *dname); |
| #else |
| #define sec_debug_set_shutdown_device(a, b) do { } while (0) |
| #define sec_debug_set_suspend_device(a, b) do { } while (0) |
| #endif |
| |
| #ifdef CONFIG_SEC_DEBUG_PPMPU |
| extern void print_ppmpu_protection(struct pt_regs *regs); |
| #else |
| static inline void print_ppmpu_protection(struct pt_regs *regs) {} |
| #endif |
| |
| #ifdef CONFIG_SEC_DEBUG_LAST_KMSG |
| #define SEC_LKMSG_MAGICKEY 0x0000000a6c6c7546 |
| extern void sec_debug_save_last_kmsg(unsigned char *head_ptr, |
| unsigned char *curr_ptr, size_t buf_size); |
| #else |
| #define sec_debug_save_last_kmsg(a, b, c) do { } while (0) |
| #endif |
| |
| |
| /* |
| * SEC DEBUG EXTRA INFO |
| */ |
| |
| #define V3_TEST_PHYS_ADDR (0x91700000) |
| #define OFFSET_SHARED_BUFFER (0xC00) |
| #define MAX_ITEM_KEY_LEN (16) |
| #define MAX_ITEM_VAL_LEN (1008) |
| |
| enum shared_buffer_slot { |
| SLOT_32, |
| SLOT_64, |
| SLOT_256, |
| SLOT_1024, |
| SLOT_MAIN_END = SLOT_1024, |
| NR_MAIN_SLOT = 4, |
| SLOT_BK_32 = NR_MAIN_SLOT, |
| SLOT_BK_64, |
| SLOT_BK_256, |
| SLOT_BK_1024, |
| SLOT_END = SLOT_BK_1024, |
| NR_SLOT = 8, |
| }; |
| |
| struct sec_debug_sb_index { |
| unsigned int paddr; /* physical address of slot */ |
| unsigned int size; /* size of a item */ |
| unsigned int nr; /* number of items in slot */ |
| unsigned int cnt; /* number of used items in slot */ |
| |
| /* map to indicate which items are added by bootloader */ |
| unsigned long blmark; |
| }; |
| |
| struct sec_debug_shared_buffer { |
| /* initial magic code */ |
| unsigned int magic[4]; |
| |
| /* shared buffer index */ |
| struct sec_debug_sb_index sec_debug_sbidx[NR_SLOT]; |
| }; |
| |
| #define MAX_EXTRA_INFO_HDR_LEN 6 |
| #define SEC_DEBUG_BADMODE_MAGIC 0x6261646d |
| |
| enum sec_debug_extra_fault_type { |
| UNDEF_FAULT, /* 0 */ |
| BAD_MODE_FAULT, /* 1 */ |
| WATCHDOG_FAULT, /* 2 */ |
| KERNEL_FAULT, /* 3 */ |
| MEM_ABORT_FAULT, /* 4 */ |
| SP_PC_ABORT_FAULT, /* 5 */ |
| PAGE_FAULT, /* 6 */ |
| ACCESS_USER_FAULT, /* 7 */ |
| EXE_USER_FAULT, /* 8 */ |
| ACCESS_USER_OUTSIDE_FAULT, /* 9 */ |
| BUG_FAULT, /* 10 */ |
| PANIC_FAULT, |
| FAULT_MAX, |
| }; |
| |
| #if defined(CONFIG_SAMSUNG_VST_CAL) |
| extern int volt_vst_cal_bdata; |
| #endif |
| |
| #define SEC_DEBUG_SHARED_MAGIC0 0xFFFFFFFF |
| #define SEC_DEBUG_SHARED_MAGIC1 0x95308180 |
| #define SEC_DEBUG_SHARED_MAGIC2 0x14F014F0 |
| #define SEC_DEBUG_SHARED_MAGIC3 0x00010001 |
| |
| #ifdef CONFIG_SEC_DEBUG_EXTRA_INFO |
| |
| extern void simulate_extra_info_force_error(unsigned int magic); |
| extern struct exynos_chipid_info exynos_soc_info; |
| extern unsigned int get_smpl_warn_number(void); |
| |
| extern void sec_debug_init_extra_info(struct sec_debug_shared_buffer *); |
| extern void sec_debug_finish_extra_info(void); |
| extern void sec_debug_store_extra_info_A(char *ptr); |
| extern void sec_debug_store_extra_info_B(char *ptr); |
| extern void sec_debug_store_extra_info_C(char *ptr); |
| extern void sec_debug_store_extra_info_M(char *ptr); |
| extern void sec_debug_store_extra_info_F(char *ptr); |
| extern void sec_debug_set_extra_info_fault(enum sec_debug_extra_fault_type, |
| unsigned long addr, struct pt_regs *regs); |
| extern void sec_debug_set_extra_info_bug(const char *file, unsigned int line); |
| extern void sec_debug_set_extra_info_panic(char *str); |
| extern void sec_debug_set_extra_info_backtrace(struct pt_regs *regs); |
| extern void sec_debug_set_extra_info_backtrace_cpu(struct pt_regs *regs, int cpu); |
| extern void sec_debug_set_extra_info_backtrace_task(struct task_struct *tsk); |
| extern void sec_debug_set_extra_info_evt_version(void); |
| extern void sec_debug_set_extra_info_sysmmu(char *str); |
| extern void sec_debug_set_extra_info_busmon(char *str); |
| extern void sec_debug_set_extra_info_dpm_timeout(char *devname); |
| extern void sec_debug_set_extra_info_smpl(unsigned long count); |
| extern void sec_debug_set_extra_info_esr(unsigned int esr); |
| extern void sec_debug_set_extra_info_merr(char *merr); |
| extern void sec_debug_set_extra_info_hint(u64 hint); |
| extern void sec_debug_set_extra_info_decon(unsigned int err); |
| extern void sec_debug_set_extra_info_batt(int cap, int volt, int temp, int curr); |
| extern void sec_debug_set_extra_info_ufs_error(char *str); |
| extern void sec_debug_set_extra_info_zswap(char *str); |
| extern void sec_debug_set_extra_info_mfc_error(char *str); |
| extern void sec_debug_set_extra_info_aud(char *str); |
| extern void sec_debug_set_extra_info_unfz(char *tmp); |
| extern void sec_debug_set_extra_info_epd(char *str); |
| |
| #else |
| |
| #define sec_debug_init_extra_info(a) do { } while (0) |
| #define sec_debug_finish_extra_info() do { } while (0) |
| #define sec_debug_store_extra_info_A(a) do { } while (0) |
| #define sec_debug_store_extra_info_C(a) do { } while (0) |
| #define sec_debug_store_extra_info_M(a) do { } while (0) |
| #define sec_debug_store_extra_info_F(a) do { } while (0) |
| #define sec_debug_set_extra_info_fault(a, b, c) do { } while (0) |
| #define sec_debug_set_extra_info_bug(a, b) do { } while (0) |
| #define sec_debug_set_extra_info_panic(a) do { } while (0) |
| #define sec_debug_set_extra_info_backtrace(a) do { } while (0) |
| #define sec_debug_set_extra_info_backtrace_cpu(a, b) do { } while (0) |
| #define sec_debug_set_extra_info_evt_version() do { } while (0) |
| #define sec_debug_set_extra_info_sysmmu(a) do { } while (0) |
| #define sec_debug_set_extra_info_busmon(a) do { } while (0) |
| #define sec_debug_set_extra_info_dpm_timeout(a) do { } while (0) |
| #define sec_debug_set_extra_info_smpl(a) do { } while (0) |
| #define sec_debug_set_extra_info_esr(a) do { } while (0) |
| #define sec_debug_set_extra_info_merr(a) do { } while (0) |
| #define sec_debug_set_extra_info_hint(a) do { } while (0) |
| #define sec_debug_set_extra_info_decon(a) do { } while (0) |
| #define sec_debug_set_extra_info_batt(a, b, c, d) do { } while (0) |
| #define sec_debug_set_extra_info_ufs_error(a) do { } while (0) |
| #define sec_debug_set_extra_info_zswap(a) do { } while (0) |
| #define sec_debug_set_extra_info_mfc_error(a) do { } while (0) |
| #define sec_debug_set_extra_info_aud(a) do { } while (0) |
| #define sec_debug_set_extra_info_unfz(a) do { } while (0) |
| #define sec_debug_set_extra_info_epd(a) do { } while (0) |
| |
| #endif /* CONFIG_SEC_DEBUG_EXTRA_INFO */ |
| |
| /* |
| * SEC DEBUG AUTO COMMENT |
| */ |
| |
| #define SEC_DEBUG_AUTO_COMM_BUF_SIZE 10 |
| |
| struct sec_debug_auto_comm_buf { |
| int reserved_0; |
| int reserved_1; |
| int reserved_2; |
| unsigned int offset; |
| char buf[SZ_4K]; |
| }; |
| |
| struct sec_debug_auto_comment { |
| int header_magic; |
| int fault_flag; |
| int lv5_log_cnt; |
| u64 lv5_log_order; |
| int order_map_cnt; |
| int order_map[SEC_DEBUG_AUTO_COMM_BUF_SIZE]; |
| struct sec_debug_auto_comm_buf auto_comm_buf[SEC_DEBUG_AUTO_COMM_BUF_SIZE]; |
| |
| int tail_magic; |
| }; |
| |
| #ifdef CONFIG_SEC_DEBUG_AUTO_COMMENT |
| #define AC_SIZE 0xf3c |
| #define AC_MAGIC 0xcafecafe |
| #define AC_TAIL_MAGIC 0x00c0ffee |
| #define AC_EDATA_MAGIC 0x43218765 |
| |
| enum { |
| PRIO_LV0 = 0, |
| PRIO_LV1, |
| PRIO_LV2, |
| PRIO_LV3, |
| PRIO_LV4, |
| PRIO_LV5, |
| PRIO_LV6, |
| PRIO_LV7, |
| PRIO_LV8, |
| PRIO_LV9 |
| }; |
| |
| enum sec_debug_FREQ_INFO { |
| FREQ_INFO_CLD0 = 0, |
| FREQ_INFO_CLD1, |
| FREQ_INFO_INT, |
| FREQ_INFO_MIF, |
| FREQ_INFO_MAX, |
| }; |
| |
| struct sec_debug_auto_comm_log_idx { |
| atomic_t logging_entry; |
| atomic_t logging_disable; |
| atomic_t logging_count; |
| }; |
| |
| struct auto_comment_log_map { |
| char prio_level; |
| char max_count; |
| }; |
| |
| static const struct auto_comment_log_map init_data[SEC_DEBUG_AUTO_COMM_BUF_SIZE] = { |
| {PRIO_LV0, 0}, |
| {PRIO_LV5, 8}, |
| {PRIO_LV9, 0}, |
| {PRIO_LV5, 0}, |
| {PRIO_LV5, 0}, |
| {PRIO_LV1, 7}, |
| {PRIO_LV2, 8}, |
| {PRIO_LV5, 0}, |
| {PRIO_LV5, 8}, |
| {PRIO_LV0, 0} |
| }; |
| |
| extern void sec_debug_auto_comment_log_disable(int type); |
| extern void sec_debug_auto_comment_log_once(int type); |
| extern void register_set_auto_comm_buf(void (*func)(int type, const char *buf, size_t size)); |
| extern void register_set_auto_comm_lastfreq(void (*func)(int type, |
| int old_freq, int new_freq, u64 time, int en)); |
| #endif |
| |
| #ifdef CONFIG_SEC_DEBUG |
| extern bool sec_debug_pcprwsem_enabled; |
| extern void sec_debug_pcprwsem_log_enable(bool en); |
| extern void __sec_debug_pcprwsem_log_print(const char *s, int mode, void *sem); |
| static inline void sec_debug_pcprwsem_log_print(const char *s, int mode, void *sem) |
| { |
| if (likely(!sec_debug_pcprwsem_enabled)) |
| return; |
| |
| __sec_debug_pcprwsem_log_print(s, mode, sem); |
| } |
| #else |
| #define sec_debug_pcprwsem_log_enable() do { } while (0) |
| #define sec_debug_pcprwsem_log_print(a, b, c) do { } while (0) |
| #endif |
| |
| #ifdef CONFIG_SEC_DEBUG_DTASK |
| extern void sec_debug_wtsk_print_info(struct task_struct *task, bool raw); |
| extern void sec_debug_wtsk_set_data(int type, void *data); |
| static inline void sec_debug_wtsk_clear_data(void) |
| { |
| sec_debug_wtsk_set_data(DTYPE_NONE, NULL); |
| } |
| #else |
| #define sec_debug_wtsk_print_info(a, b) do { } while (0) |
| #define sec_debug_wtsk_set_data(a, b) do { } while (0) |
| #define sec_debug_wtsk_clear_data() do { } while (0) |
| #endif |
| |
| #ifdef CONFIG_SEC_DEBUG_INIT_LOG |
| extern void register_init_log_hook_func(void (*func)(const char *buf, size_t size)); |
| #endif |
| |
| /* increase if sec_debug_next is not changed and other feature is upgraded */ |
| #define SEC_DEBUG_KERNEL_UPPER_VERSION (0x0001) |
| /* increase if sec_debug_next is changed */ |
| #define SEC_DEBUG_KERNEL_LOWER_VERSION (0x0001) |
| |
| /* SEC DEBUG NEXT DEFINITION */ |
| struct sec_debug_next { |
| unsigned int magic[2]; |
| unsigned int version[2]; |
| |
| struct sec_debug_map map; |
| struct sec_debug_memtab memtab; |
| struct sec_debug_ksyms ksyms; |
| struct sec_debug_kcnst kcnst; |
| struct sec_debug_task task; |
| struct sec_debug_ess_info ss_info; |
| struct sec_debug_spinlock_info rlock; |
| struct sec_debug_kernel_data kernd; |
| |
| struct sec_debug_auto_comment auto_comment; |
| struct sec_debug_shared_buffer extra_info; |
| }; |
| |
| /* |
| * Samsung TN Logging Options |
| */ |
| |
| #ifdef CONFIG_TOUCHSCREEN_DUMP_MODE |
| struct tsp_dump_callbacks { |
| void (*inform_dump)(void); |
| }; |
| #endif |
| |
| #ifdef CONFIG_SEC_DEBUG_LIMIT_BACKTRACE |
| #define MAX_UNWINDING_LOOP 50 /* maximum number of unwind frame */ |
| #endif |
| |
| #ifdef CONFIG_SEC_DEBUG_SYSRQ_KMSG |
| extern size_t sec_debug_get_curr_init_ptr(void); |
| extern size_t dbg_snapshot_get_curr_ptr_for_sysrq(void); |
| #endif |
| |
| /* sec_debug_memtab.c */ |
| extern void secdbg_base_set_memtab_info(struct sec_debug_memtab *ksyms); |
| |
| #ifdef CONFIG_SEC_DEBUG |
| #define SDBG_KNAME_LEN 64 |
| struct secdbg_member_type { |
| char member[SDBG_KNAME_LEN]; |
| uint16_t size; |
| uint16_t offset; |
| uint16_t unused[2]; |
| }; |
| #define SECDBG_DEFINE_MEMBER_TYPE(key, st, mem) \ |
| const struct secdbg_member_type sdbg_##key \ |
| __attribute__((__section__(".secdbg_mbtab." #key))) = { \ |
| .member = #key, \ |
| .size = FIELD_SIZEOF(struct st, mem), \ |
| .offset = offsetof(struct st, mem), \ |
| } |
| #else |
| #define SECDBG_DEFINE_MEMBER_TYPE(a, b, c) |
| #endif /* CONFIG_SEC_DEBUG */ |
| |
| #ifdef CONFIG_SEC_DEBUG_SOFTDOG |
| extern void secdbg_softdog_show_info(void); |
| #else |
| #define secdbg_softdog_show_info() do { } while (0) |
| #endif |
| |
| #endif /* SEC_DEBUG_H */ |
| |