#endif
 
        /* Call our payload! */
-#ifdef DEBUG_EFI
-       printf("%s:%d Jumping to 0x%lx\n", __func__, __LINE__, (long)entry);
-#endif
+       debug("%s:%d Jumping to 0x%lx\n", __func__, __LINE__, (long)entry);
 
        if (setjmp(&loaded_image_info.exit_jmp)) {
                efi_status_t status = loaded_image_info.exit_status;
 
 
 #include <linux/list.h>
 
-/* #define DEBUG_EFI */
-
-#ifdef DEBUG_EFI
 #define EFI_ENTRY(format, ...) do { \
        efi_restore_gd(); \
-       printf("EFI: Entry %s(" format ")\n", __func__, ##__VA_ARGS__); \
+       debug("EFI: Entry %s(" format ")\n", __func__, ##__VA_ARGS__); \
        } while(0)
-#else
-#define EFI_ENTRY(format, ...) do { \
-       efi_restore_gd(); \
-       } while(0)
-#endif
 
 #define EFI_EXIT(ret) efi_exit_func(ret);
 
 
  *  SPDX-License-Identifier:     GPL-2.0+
  */
 
-/* #define DEBUG_EFI */
-
 #include <common.h>
 #include <efi_loader.h>
 #include <malloc.h>
 
 static efi_status_t efi_unsupported(const char *funcname)
 {
-#ifdef DEBUG_EFI
-       printf("EFI: App called into unimplemented function %s\n", funcname);
-#endif
+       debug("EFI: App called into unimplemented function %s\n", funcname);
        return EFI_EXIT(EFI_UNSUPPORTED);
 }
 
 
        blocks = buffer_size / blksz;
        lba += diskobj->offset;
 
-#ifdef DEBUG_EFI
-       printf("EFI: %s:%d blocks=%x lba=%"PRIx64" blksz=%x dir=%d\n", __func__,
-              __LINE__, blocks, lba, blksz, direction);
-#endif
+       debug("EFI: %s:%d blocks=%x lba=%"PRIx64" blksz=%x dir=%d\n", __func__,
+             __LINE__, blocks, lba, blksz, direction);
 
        /* We only support full block access */
        if (buffer_size & (blksz - 1))
        /* We don't do interrupts, so check for timers cooperatively */
        efi_timer_check();
 
-#ifdef DEBUG_EFI
-       printf("EFI: %s:%d n=%lx blocks=%x\n", __func__, __LINE__, n, blocks);
-#endif
+       debug("EFI: %s:%d n=%lx blocks=%x\n", __func__, __LINE__, n, blocks);
+
        if (n != blocks)
                return EFI_EXIT(EFI_DEVICE_ERROR);
 
 
  *  SPDX-License-Identifier:     GPL-2.0+
  */
 
-/* #define DEBUG_EFI */
-
 #include <common.h>
 #include <efi_loader.h>
 #include <malloc.h>
 
                ulong *p = efi_runtime_detach_list[i].ptr;
                ulong newaddr = patchto ? (patchto + patchoff) : 0;
 
-#ifdef DEBUG_EFI
-               printf("%s: Setting %p to %lx\n", __func__, p, newaddr);
-#endif
+               debug("%s: Setting %p to %lx\n", __func__, p, newaddr);
                *p = newaddr;
        }
 }
        static ulong lastoff = CONFIG_SYS_TEXT_BASE;
 #endif
 
-#ifdef DEBUG_EFI
-       printf("%s: Relocating to offset=%lx\n", __func__, offset);
-#endif
-
+       debug("%s: Relocating to offset=%lx\n", __func__, offset);
        for (; (ulong)rel < (ulong)&__efi_runtime_rel_stop; rel++) {
                ulong base = CONFIG_SYS_TEXT_BASE;
                ulong *p;
                        continue;
                }
 
-#ifdef DEBUG_EFI
-               printf("%s: Setting %p to %lx\n", __func__, p, newaddr);
-#endif
-
+               debug("%s: Setting %p to %lx\n", __func__, p, newaddr);
                *p = newaddr;
                flush_dcache_range((ulong)p & ~(EFI_CACHELINE_SIZE - 1),
                        ALIGN((ulong)&p[1], EFI_CACHELINE_SIZE));