Hi Łukasz, Kever,

On 11/27/24 11:21 PM, Łukasz Czechowski wrote:
Hi Kever,

On 2024/11/27 03:42 Kever Yang <[email protected]> wrote:

Hi Lukasz,

      I got a new error base on patch [1], see full log here [2].

Looking at the file efi_stub.c that is used in the failing
configuration it looks to me
that some functions from debug_uart.h are used here for convenience
(i.e. printhex),
even though the DEBUG_UART is not used. This is contrary to my assumption that
DEBUG_UART_FUNCS macro should not be used if DEBUG UART is not available.
In order to apply the patch then, either the efi_stub code must be
updated to not
use debug functions or the assumption must be relaxed - I'm not yet
sure what shall be
the correct approach.


"""
diff --git a/lib/efi/efi_stub.c b/lib/efi/efi_stub.c
index 40fc29d9adf..5172cd78a7c 100644
--- a/lib/efi/efi_stub.c
+++ b/lib/efi/efi_stub.c
@@ -83,12 +83,14 @@ void puts(const char *str)
                putc(*str++);
 }

+#ifdef CONFIG_DEBUG_UART
 static void _debug_uart_putc(int ch)
 {
        putc(ch);
 }

 DEBUG_UART_FUNCS
+#endif

 void *memcpy(void *dest, const void *src, size_t size)
 {
"""

Fixes it. It builds fine with and without CONFIG_DEBUG_UART set. Not sure if it's proper but I guess that's fine?

While reading the patch again, I think we made a small oversight.

#define printhex8(value) do{}while(0);

is an issue because ch may actually have side effects.

Take for example an interrupt register where reading is acknowledging, if one does:

printhex8(readl(INT_REG))

will read the register when CONFIG_DEBUG_UART is set, but not when it's not.

I am not sure if and how we can handle that so that things are executed but only print is not called. Is this something we should care about?

Cheers,
Quentin

Reply via email to