Bin Meng | ba7b38a | 2014-12-12 21:05:32 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014, Bin Meng <bmeng.cn@gmail.com> |
| 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0+ |
| 5 | */ |
| 6 | |
| 7 | #include <common.h> |
| 8 | #include <command.h> |
| 9 | #include <linux/compiler.h> |
Simon Glass | 1021af4 | 2015-01-27 22:13:36 -0700 | [diff] [blame] | 10 | #include <asm/fsp/fsp_support.h> |
Bin Meng | ba7b38a | 2014-12-12 21:05:32 +0800 | [diff] [blame] | 11 | |
| 12 | DECLARE_GLOBAL_DATA_PTR; |
| 13 | |
| 14 | static char *hob_type[] = { |
| 15 | "reserved", |
| 16 | "Hand-off", |
| 17 | "Memory Allocation", |
| 18 | "Resource Descriptor", |
| 19 | "GUID Extension", |
Bin Meng | 255fd5c | 2014-12-17 15:50:49 +0800 | [diff] [blame] | 20 | "Firmware Volume", |
Bin Meng | ba7b38a | 2014-12-12 21:05:32 +0800 | [diff] [blame] | 21 | "CPU", |
| 22 | "Memory Pool", |
| 23 | "reserved", |
Bin Meng | 255fd5c | 2014-12-17 15:50:49 +0800 | [diff] [blame] | 24 | "Firmware Volume 2", |
Bin Meng | ba7b38a | 2014-12-12 21:05:32 +0800 | [diff] [blame] | 25 | "Load PEIM Unused", |
| 26 | "UEFI Capsule", |
| 27 | }; |
| 28 | |
| 29 | int do_hob(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
| 30 | { |
Bin Meng | 949dbc1 | 2014-12-30 16:02:05 +0800 | [diff] [blame] | 31 | const struct hob_header *hdr; |
Bin Meng | b2439ae | 2015-01-06 14:04:36 +0800 | [diff] [blame] | 32 | uint type; |
Bin Meng | ba7b38a | 2014-12-12 21:05:32 +0800 | [diff] [blame] | 33 | char *desc; |
| 34 | int i = 0; |
| 35 | |
Bin Meng | 949dbc1 | 2014-12-30 16:02:05 +0800 | [diff] [blame] | 36 | hdr = gd->arch.hob_list; |
Bin Meng | ba7b38a | 2014-12-12 21:05:32 +0800 | [diff] [blame] | 37 | |
Bin Meng | 949dbc1 | 2014-12-30 16:02:05 +0800 | [diff] [blame] | 38 | printf("HOB list address: 0x%08x\n\n", (unsigned int)hdr); |
Bin Meng | ba7b38a | 2014-12-12 21:05:32 +0800 | [diff] [blame] | 39 | |
| 40 | printf("No. | Address | Type | Length in Bytes\n"); |
| 41 | printf("----|----------|---------------------|----------------\n"); |
Bin Meng | 949dbc1 | 2014-12-30 16:02:05 +0800 | [diff] [blame] | 42 | while (!end_of_hob(hdr)) { |
| 43 | printf("%-3d | %08x | ", i, (unsigned int)hdr); |
Bin Meng | b2439ae | 2015-01-06 14:04:36 +0800 | [diff] [blame] | 44 | type = hdr->type; |
Bin Meng | ba7b38a | 2014-12-12 21:05:32 +0800 | [diff] [blame] | 45 | if (type == HOB_TYPE_UNUSED) |
| 46 | desc = "*Unused*"; |
| 47 | else if (type == HOB_TYPE_EOH) |
Bin Meng | 255fd5c | 2014-12-17 15:50:49 +0800 | [diff] [blame] | 48 | desc = "*END OF HOB*"; |
Bin Meng | ba7b38a | 2014-12-12 21:05:32 +0800 | [diff] [blame] | 49 | else if (type >= 0 && type <= ARRAY_SIZE(hob_type)) |
| 50 | desc = hob_type[type]; |
| 51 | else |
Bin Meng | 255fd5c | 2014-12-17 15:50:49 +0800 | [diff] [blame] | 52 | desc = "*Invalid Type*"; |
Bin Meng | b2439ae | 2015-01-06 14:04:36 +0800 | [diff] [blame] | 53 | printf("%-19s | %-15d\n", desc, hdr->len); |
Bin Meng | 949dbc1 | 2014-12-30 16:02:05 +0800 | [diff] [blame] | 54 | hdr = get_next_hob(hdr); |
Bin Meng | ba7b38a | 2014-12-12 21:05:32 +0800 | [diff] [blame] | 55 | i++; |
| 56 | } |
| 57 | |
| 58 | return 0; |
| 59 | } |
| 60 | |
Bin Meng | ba7b38a | 2014-12-12 21:05:32 +0800 | [diff] [blame] | 61 | U_BOOT_CMD( |
| 62 | hob, 1, 1, do_hob, |
Bin Meng | 255fd5c | 2014-12-17 15:50:49 +0800 | [diff] [blame] | 63 | "print Firmware Support Package (FSP) Hand-Off Block information", |
Bin Meng | ba7b38a | 2014-12-12 21:05:32 +0800 | [diff] [blame] | 64 | "" |
| 65 | ); |