1// SPDX-License-Identifier: GPL-3.0-or-later
2
3#pragma once
4
5#include "mos/platform/platform_defs.h"
6
7#include <mos/mos_global.h>
8
9#ifndef MOS_PLATFORM_DEBUG_MODULES
10#define MOS_PLATFORM_DEBUG_MODULES(X)
11#endif
12
13// clang-format off
14// ! Keep this list consistent with arch/generic/Kconfig.debug
15#define MOS_GENERIC_PLATFORM_DEBUG_MODULES(X) \
16 X(limine)
17
18// ! Keep this list consistent with kernel/Kconfig.debug
19#define MOS_ALL_DEBUG_MODULES(X) \
20 MOS_PLATFORM_DEBUG_MODULES(X) \
21 MOS_GENERIC_PLATFORM_DEBUG_MODULES(X) \
22 X(cpio) \
23 X(dcache) \
24 X(dcache_ref) \
25 X(dma) \
26 X(elf) \
27 X(futex) \
28 X(io) \
29 X(ipc) \
30 X(ipi) \
31 X(naive_sched) \
32 X(panic) \
33 X(pagefault) \
34 X(pipe) \
35 X(pmm) \
36 X(pmm_buddy) \
37 X(process) \
38 X(scheduler) \
39 X(setup) \
40 X(signal) \
41 X(slab) \
42 X(spinlock) \
43 X(syscall) \
44 X(sysfs) \
45 X(thread) \
46 X(tmpfs) \
47 X(userfs) \
48 X(vfs) \
49 X(vmm)
50// clang-format on
51
52#if MOS_CONFIG(MOS_DYNAMIC_DEBUG)
53
54typedef struct _debug_info_entry
55{
56 u32 id;
57 const char *name;
58 bool enabled;
59} debug_info_entry;
60
61extern struct _mos_debug_info
62{
63#define _expand_field(name) debug_info_entry name;
64 MOS_ALL_DEBUG_MODULES(_expand_field)
65#undef _expand_field
66} mos_debug_info;
67
68#define mos_debug_enabled(name) (mos_debug_info.name.enabled)
69#define mos_debug_enabled_ptr(name) (&mos_debug_info.name.enabled)
70#else
71#define mos_debug_enabled(name) MOS_DEBUG_FEATURE(name)
72#define mos_debug_enabled_ptr(name) NULL
73#endif
74