cmd_hob.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * Copyright (C) 2014, Bin Meng <bmeng.cn@gmail.com>
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <common.h>
  7. #include <command.h>
  8. #include <linux/compiler.h>
  9. #include <asm/arch/fsp/fsp_support.h>
  10. DECLARE_GLOBAL_DATA_PTR;
  11. static char *hob_type[] = {
  12. "reserved",
  13. "Hand-off",
  14. "Memory Allocation",
  15. "Resource Descriptor",
  16. "GUID Extension",
  17. "Firmware Volumn",
  18. "CPU",
  19. "Memory Pool",
  20. "reserved",
  21. "Firmware Volumn 2",
  22. "Load PEIM Unused",
  23. "UEFI Capsule",
  24. };
  25. int do_hob(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  26. {
  27. union hob_pointers_t hob;
  28. u16 type;
  29. char *desc;
  30. int i = 0;
  31. hob.raw = (u8 *)gd->arch.hob_list;
  32. printf("HOB list address: 0x%08x\n\n", (unsigned int)hob.raw);
  33. printf("No. | Address | Type | Length in Bytes\n");
  34. printf("----|----------|---------------------|----------------\n");
  35. while (!END_OF_HOB(hob)) {
  36. printf("%-3d | %08x | ", i, (unsigned int)hob.raw);
  37. type = hob.hdr->type;
  38. if (type == HOB_TYPE_UNUSED)
  39. desc = "*Unused*";
  40. else if (type == HOB_TYPE_EOH)
  41. desc = "**END OF HOB**";
  42. else if (type >= 0 && type <= ARRAY_SIZE(hob_type))
  43. desc = hob_type[type];
  44. else
  45. desc = "!!!Invalid Type!!!";
  46. printf("%-19s | %-15d\n", desc, hob.hdr->len);
  47. hob.raw = GET_NEXT_HOB(hob);
  48. i++;
  49. }
  50. return 0;
  51. }
  52. /* -------------------------------------------------------------------- */
  53. U_BOOT_CMD(
  54. hob, 1, 1, do_hob,
  55. "print FSP Hand-Off Block information",
  56. ""
  57. );