cmd_hob.c 1.2 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/fsp/fsp_support.h>
  10. DECLARE_GLOBAL_DATA_PTR;
  11. static char *hob_type[] = {
  12. "reserved",
  13. "Hand-off",
  14. "Mem Alloc",
  15. "Res Desc",
  16. "GUID Ext",
  17. "FV",
  18. "CPU",
  19. "Mem Pool",
  20. "reserved",
  21. "FV2",
  22. "Load PEIM",
  23. "Capsule",
  24. };
  25. int do_hob(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  26. {
  27. const struct hob_header *hdr;
  28. uint type;
  29. char *desc;
  30. int i = 0;
  31. hdr = gd->arch.hob_list;
  32. printf("HOB list address: 0x%08x\n\n", (unsigned int)hdr);
  33. printf("# | Address | Type | Len\n");
  34. printf("---|----------|-----------|-----\n");
  35. while (!end_of_hob(hdr)) {
  36. printf("%-2d | %08x | ", i, (unsigned int)hdr);
  37. type = hdr->type;
  38. if (type == HOB_TYPE_UNUSED)
  39. desc = "*Unused*";
  40. else if (type == HOB_TYPE_EOH)
  41. desc = "*EOH*";
  42. else if (type >= 0 && type <= ARRAY_SIZE(hob_type))
  43. desc = hob_type[type];
  44. else
  45. desc = "*Invalid*";
  46. printf("%-9s | %-4d\n", desc, hdr->len);
  47. hdr = get_next_hob(hdr);
  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. );