dbg.c 710 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * MIPS-specific debug support for pre-boot environment
  4. *
  5. * NOTE: putc() is board specific, if your board have a 16550 compatible uart,
  6. * please select SYS_SUPPORTS_ZBOOT_UART16550 for your machine. otherwise, you
  7. * need to implement your own putc().
  8. */
  9. #include <linux/compiler.h>
  10. #include <linux/types.h>
  11. #include "decompress.h"
  12. void __weak putc(char c)
  13. {
  14. }
  15. void puts(const char *s)
  16. {
  17. char c;
  18. while ((c = *s++) != '\0') {
  19. putc(c);
  20. if (c == '\n')
  21. putc('\r');
  22. }
  23. }
  24. void puthex(unsigned long long val)
  25. {
  26. unsigned char buf[10];
  27. int i;
  28. for (i = 7; i >= 0; i--) {
  29. buf[i] = "0123456789ABCDEF"[val & 0x0F];
  30. val >>= 4;
  31. }
  32. buf[8] = '\0';
  33. puts(buf);
  34. }