soc/intel/alderlake: Add ADL-P 4+4 with 28W TDP
[coreboot.git] / src / device / oprom / yabel / debug.h
blobd93fc6e4c10422cf4bf1a67ecf03a0c7a7596715
1 /******************************************************************************
2 * Copyright (c) 2004, 2008 IBM Corporation
3 * Copyright (c) 2009 Pattrick Hueper <phueper@hueper.net>
5 * All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are
9 * met:
11 * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
14 * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer
16 * in the documentation and/or other materials provided with the
17 * distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 * Contributors:
32 * IBM Corporation - initial implementation
33 *****************************************************************************/
34 #ifndef _BIOSEMU_DEBUG_H_
35 #define _BIOSEMU_DEBUG_H_
37 #include <timer.h>
38 #include <types.h>
40 #if CONFIG(X86EMU_DEBUG_TIMINGS)
41 extern struct mono_time zero;
42 #endif
43 extern u32 debug_flags;
44 // from x86emu...needed for debugging
45 extern void x86emu_dump_xregs(void);
47 /* printf is not available in coreboot... use printk */
48 #include <console/console.h>
49 #include "x86emu/x86emu.h"
50 #define printf(x...) printk(BIOS_DEBUG, x)
52 /* PH: empty versions of set/clr_ci
53 * TODO: remove! */
54 static inline void clr_ci(void) {};
55 static inline void set_ci(void) {};
57 /* debug_flags is a binary switch that allows you to select the following items
58 * to debug. 1=on 0=off. After you decide what you want to debug create the
59 * binary value, convert to hex and set the option. These options can be
60 * selected in Kconfig.
62 * |-DEBUG_JMP - print info about JMP and RETF opcodes from x86emu
63 * ||-DEBUG_TRACE_X86EMU - print _all_ opcodes that are executed by x86emu (WARNING: this will produce a LOT of output)
64 * |||-Currently unused
65 * ||||-Currently unused
66 * |||||-Currently unused
67 * ||||||-DEBUG_PNP - Print Plug And Play access made by option rom
68 * |||||||-DEBUG_DISK - Print Disk I/O related messages, currently unused
69 * ||||||||-DEBUG_PMM - Print messages related to POST Memory Manager (PMM)
70 * |||||||||-DEBUG_VBE - Print messages related to VESA BIOS Extension (VBE) functions
71 * ||||||||||-DEBUG_PRINT_INT10 - let INT10 (i.e. character output) calls print messages to Debug output
72 * |||||||||||-DEBUG_INTR - Print messages related to interrupt handling
73 * ||||||||||||-DEBUG_CHECK_VMEM_ACCESS - Print messages related to accesse to certain areas of the virtual Memory (e.g. BDA (BIOS Data Area) or Interrupt Vectors)
74 * |||||||||||||-DEBUG_MEM - Print memory access made by option ROM (NOTE: this also includes accesses to fetch instructions)
75 * ||||||||||||||-DEBUG_IO - Print I/O access made by option rom
76 * 11000111111111 - Max Binary Value, Debug All (WARNING: - This could run for hours)
79 #define DEBUG_IO 0x1
80 #define DEBUG_MEM 0x2
81 // set this to print messages for certain virtual memory accesses (Interrupt Vectors, ...)
82 #define DEBUG_CHECK_VMEM_ACCESS 0x4
83 #define DEBUG_INTR 0x8
84 #define DEBUG_PRINT_INT10 0x10 // set to have the INT10 routine print characters
85 #define DEBUG_VBE 0x20
86 #define DEBUG_PMM 0x40
87 #define DEBUG_DISK 0x80
88 #define DEBUG_PNP 0x100
90 #define DEBUG_TRACE_X86EMU 0x1000
91 // set to enable tracing of JMPs in x86emu
92 #define DEBUG_JMP 0x2000
94 #if CONFIG(X86EMU_DEBUG)
96 #define CHECK_DBG(_flag) if (debug_flags & _flag)
98 #define DEBUG_PRINTF(_x...) printf(_x);
99 // prints the CS:IP before the printout, NOTE: actually its CS:IP of the _next_ instruction
100 // to be executed, since the x86emu advances CS:IP _before_ actually executing an instruction
102 #if CONFIG(X86EMU_DEBUG_TIMINGS)
103 #define DEBUG_PRINTF_CS_IP(_x...) DEBUG_PRINTF("[%08lx]%x:%x ", (current_time_from(&zero)).microseconds, M.x86.R_CS, M.x86.R_IP); DEBUG_PRINTF(_x);
104 #else
105 #define DEBUG_PRINTF_CS_IP(_x...) DEBUG_PRINTF("%x:%x ", M.x86.R_CS, M.x86.R_IP); DEBUG_PRINTF(_x);
106 #endif
108 #define DEBUG_PRINTF_IO(_x...) CHECK_DBG(DEBUG_IO) { DEBUG_PRINTF_CS_IP(_x) }
109 #define DEBUG_PRINTF_MEM(_x...) CHECK_DBG(DEBUG_MEM) { DEBUG_PRINTF_CS_IP(_x) }
110 #define DEBUG_PRINTF_INTR(_x...) CHECK_DBG(DEBUG_INTR) { DEBUG_PRINTF_CS_IP(_x) }
111 #define DEBUG_PRINTF_VBE(_x...) CHECK_DBG(DEBUG_VBE) { DEBUG_PRINTF_CS_IP(_x) }
112 #define DEBUG_PRINTF_PMM(_x...) CHECK_DBG(DEBUG_PMM) { DEBUG_PRINTF_CS_IP(_x) }
113 #define DEBUG_PRINTF_DISK(_x...) CHECK_DBG(DEBUG_DISK) { DEBUG_PRINTF_CS_IP(_x) }
114 #define DEBUG_PRINTF_PNP(_x...) CHECK_DBG(DEBUG_PNP) { DEBUG_PRINTF_CS_IP(_x) }
116 #else
118 #define CHECK_DBG(_flag) if (0)
120 #define DEBUG_PRINTF(_x...)
121 #define DEBUG_PRINTF_CS_IP(_x...)
123 #define DEBUG_PRINTF_IO(_x...)
124 #define DEBUG_PRINTF_MEM(_x...)
125 #define DEBUG_PRINTF_INTR(_x...)
126 #define DEBUG_PRINTF_VBE(_x...)
127 #define DEBUG_PRINTF_PMM(_x...)
128 #define DEBUG_PRINTF_DISK(_x...)
129 #define DEBUG_PRINTF_PNP(_x...)
131 #endif //DEBUG
133 void dump(u8 *addr, u32 len);
135 #endif