diff mbox

[U-Boot,1/4] x86: fsp: Compact the output of hob command

Message ID 1444466879-24281-1-git-send-email-bmeng.cn@gmail.com
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Bin Meng Oct. 10, 2015, 8:47 a.m. UTC
Compact hob command output, especially by making hob type string a
little bit shorter so that we can leave room for future extension.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 arch/x86/lib/cmd_hob.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

Comments

Bin Meng Oct. 10, 2015, 11:01 a.m. UTC | #1
On Sat, Oct 10, 2015 at 4:47 PM, Bin Meng <bmeng.cn@gmail.com> wrote:
> Compact hob command output, especially by making hob type string a
> little bit shorter so that we can leave room for future extension.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
>  arch/x86/lib/cmd_hob.c | 28 ++++++++++++++--------------
>  1 file changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/arch/x86/lib/cmd_hob.c b/arch/x86/lib/cmd_hob.c
> index 915746a..6ff321a 100644
> --- a/arch/x86/lib/cmd_hob.c
> +++ b/arch/x86/lib/cmd_hob.c
> @@ -14,16 +14,16 @@ DECLARE_GLOBAL_DATA_PTR;
>  static char *hob_type[] = {
>         "reserved",
>         "Hand-off",
> -       "Memory Allocation",
> -       "Resource Descriptor",
> -       "GUID Extension",
> -       "Firmware Volume",
> +       "Mem Alloc",
> +       "Res Desc",
> +       "GUID Ext",
> +       "FV",
>         "CPU",
> -       "Memory Pool",
> +       "Mem Pool",
>         "reserved",
> -       "Firmware Volume 2",
> -       "Load PEIM Unused",
> -       "UEFI Capsule",
> +       "FV2",
> +       "Load PEIM",
> +       "Capsule",
>  };
>
>  int do_hob(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> @@ -37,20 +37,20 @@ int do_hob(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>
>         printf("HOB list address: 0x%08x\n\n", (unsigned int)hdr);
>
> -       printf("No. | Address  | Type                | Length in Bytes\n");
> -       printf("----|----------|---------------------|----------------\n");
> +       printf("#  | Address  | Type      | Len\n");
> +       printf("---|----------|-----------|-----\n");
>         while (!end_of_hob(hdr)) {
> -               printf("%-3d | %08x | ", i, (unsigned int)hdr);
> +               printf("%-2d | %08x | ", i, (unsigned int)hdr);
>                 type = hdr->type;
>                 if (type == HOB_TYPE_UNUSED)
>                         desc = "*Unused*";
>                 else if (type == HOB_TYPE_EOH)
> -                       desc = "*END OF HOB*";
> +                       desc = "*EOH*";
>                 else if (type >= 0 && type <= ARRAY_SIZE(hob_type))
>                         desc = hob_type[type];
>                 else
> -                       desc = "*Invalid Type*";
> -               printf("%-19s | %-15d\n", desc, hdr->len);
> +                       desc = "*Invalid*";
> +               printf("%-9s | %-4d\n", desc, hdr->len);

Looks like I should change %-4d to %-5d as on BayTrail some HOB length
would be quite large.

>                 hdr = get_next_hob(hdr);
>                 i++;
>         }
> --

Regards,
Bin
Simon Glass Oct. 18, 2015, 8:26 p.m. UTC | #2
On 10 October 2015 at 02:47, Bin Meng <bmeng.cn@gmail.com> wrote:
> Compact hob command output, especially by making hob type string a
> little bit shorter so that we can leave room for future extension.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
>  arch/x86/lib/cmd_hob.c | 28 ++++++++++++++--------------
>  1 file changed, 14 insertions(+), 14 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>
Simon Glass Oct. 18, 2015, 8:26 p.m. UTC | #3
Hi Bin,

On 10 October 2015 at 05:01, Bin Meng <bmeng.cn@gmail.com> wrote:
> On Sat, Oct 10, 2015 at 4:47 PM, Bin Meng <bmeng.cn@gmail.com> wrote:
>> Compact hob command output, especially by making hob type string a
>> little bit shorter so that we can leave room for future extension.
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>> ---
>>
>>  arch/x86/lib/cmd_hob.c | 28 ++++++++++++++--------------
>>  1 file changed, 14 insertions(+), 14 deletions(-)
>>
>> diff --git a/arch/x86/lib/cmd_hob.c b/arch/x86/lib/cmd_hob.c
>> index 915746a..6ff321a 100644
>> --- a/arch/x86/lib/cmd_hob.c
>> +++ b/arch/x86/lib/cmd_hob.c
>> @@ -14,16 +14,16 @@ DECLARE_GLOBAL_DATA_PTR;
>>  static char *hob_type[] = {
>>         "reserved",
>>         "Hand-off",
>> -       "Memory Allocation",
>> -       "Resource Descriptor",
>> -       "GUID Extension",
>> -       "Firmware Volume",
>> +       "Mem Alloc",
>> +       "Res Desc",
>> +       "GUID Ext",
>> +       "FV",
>>         "CPU",
>> -       "Memory Pool",
>> +       "Mem Pool",
>>         "reserved",
>> -       "Firmware Volume 2",
>> -       "Load PEIM Unused",
>> -       "UEFI Capsule",
>> +       "FV2",
>> +       "Load PEIM",
>> +       "Capsule",
>>  };
>>
>>  int do_hob(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>> @@ -37,20 +37,20 @@ int do_hob(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>>
>>         printf("HOB list address: 0x%08x\n\n", (unsigned int)hdr);
>>
>> -       printf("No. | Address  | Type                | Length in Bytes\n");
>> -       printf("----|----------|---------------------|----------------\n");
>> +       printf("#  | Address  | Type      | Len\n");
>> +       printf("---|----------|-----------|-----\n");
>>         while (!end_of_hob(hdr)) {
>> -               printf("%-3d | %08x | ", i, (unsigned int)hdr);
>> +               printf("%-2d | %08x | ", i, (unsigned int)hdr);
>>                 type = hdr->type;
>>                 if (type == HOB_TYPE_UNUSED)
>>                         desc = "*Unused*";
>>                 else if (type == HOB_TYPE_EOH)
>> -                       desc = "*END OF HOB*";
>> +                       desc = "*EOH*";
>>                 else if (type >= 0 && type <= ARRAY_SIZE(hob_type))
>>                         desc = hob_type[type];
>>                 else
>> -                       desc = "*Invalid Type*";
>> -               printf("%-19s | %-15d\n", desc, hdr->len);
>> +                       desc = "*Invalid*";
>> +               printf("%-9s | %-4d\n", desc, hdr->len);
>
> Looks like I should change %-4d to %-5d as on BayTrail some HOB length
> would be quite large.
>

I think it is better to use hex. U-Boot uses hex for most output.

Regards,
Simon
Simon Glass Oct. 18, 2015, 9:38 p.m. UTC | #4
On 18 October 2015 at 14:26, Simon Glass <sjg@chromium.org> wrote:
> On 10 October 2015 at 02:47, Bin Meng <bmeng.cn@gmail.com> wrote:
>> Compact hob command output, especially by making hob type string a
>> little bit shorter so that we can leave room for future extension.
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>> ---
>>
>>  arch/x86/lib/cmd_hob.c | 28 ++++++++++++++--------------
>>  1 file changed, 14 insertions(+), 14 deletions(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-x86, thanks!
diff mbox

Patch

diff --git a/arch/x86/lib/cmd_hob.c b/arch/x86/lib/cmd_hob.c
index 915746a..6ff321a 100644
--- a/arch/x86/lib/cmd_hob.c
+++ b/arch/x86/lib/cmd_hob.c
@@ -14,16 +14,16 @@  DECLARE_GLOBAL_DATA_PTR;
 static char *hob_type[] = {
 	"reserved",
 	"Hand-off",
-	"Memory Allocation",
-	"Resource Descriptor",
-	"GUID Extension",
-	"Firmware Volume",
+	"Mem Alloc",
+	"Res Desc",
+	"GUID Ext",
+	"FV",
 	"CPU",
-	"Memory Pool",
+	"Mem Pool",
 	"reserved",
-	"Firmware Volume 2",
-	"Load PEIM Unused",
-	"UEFI Capsule",
+	"FV2",
+	"Load PEIM",
+	"Capsule",
 };
 
 int do_hob(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
@@ -37,20 +37,20 @@  int do_hob(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 	printf("HOB list address: 0x%08x\n\n", (unsigned int)hdr);
 
-	printf("No. | Address  | Type                | Length in Bytes\n");
-	printf("----|----------|---------------------|----------------\n");
+	printf("#  | Address  | Type      | Len\n");
+	printf("---|----------|-----------|-----\n");
 	while (!end_of_hob(hdr)) {
-		printf("%-3d | %08x | ", i, (unsigned int)hdr);
+		printf("%-2d | %08x | ", i, (unsigned int)hdr);
 		type = hdr->type;
 		if (type == HOB_TYPE_UNUSED)
 			desc = "*Unused*";
 		else if (type == HOB_TYPE_EOH)
-			desc = "*END OF HOB*";
+			desc = "*EOH*";
 		else if (type >= 0 && type <= ARRAY_SIZE(hob_type))
 			desc = hob_type[type];
 		else
-			desc = "*Invalid Type*";
-		printf("%-19s | %-15d\n", desc, hdr->len);
+			desc = "*Invalid*";
+		printf("%-9s | %-4d\n", desc, hdr->len);
 		hdr = get_next_hob(hdr);
 		i++;
 	}