cmd_hob.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 Volume",
  18. "CPU",
  19. "Memory Pool",
  20. "reserved",
  21. "Firmware Volume 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 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 = get_hob_type(hob);
  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, get_hob_length(hob));
  47. hob.raw = get_next_hob(hob);
  48. i++;
  49. }
  50. return 0;
  51. }
  52. U_BOOT_CMD(
  53. hob, 1, 1, do_hob,
  54. "print Firmware Support Package (FSP) Hand-Off Block information",
  55. ""
  56. );