diff mbox

[1/3] uefi: uefidump: Add support for HwErrRecSupport

Message ID 1378369647-6048-1-git-send-email-ivan.hu@canonical.com
State Accepted
Headers show

Commit Message

Ivan Hu Sept. 5, 2013, 8:27 a.m. UTC
HwErrRecSupport identifies the level of hardware error record persistence
support implemented by the platform.

Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
---
 src/uefi/uefidump/uefidump.c |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

Comments

Colin Ian King Sept. 5, 2013, 1:33 p.m. UTC | #1
On 05/09/13 09:27, Ivan Hu wrote:
> HwErrRecSupport identifies the level of hardware error record persistence
> support implemented by the platform.
> 
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  src/uefi/uefidump/uefidump.c |   25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c
> index dd58a3d..dc576c7 100644
> --- a/src/uefi/uefidump/uefidump.c
> +++ b/src/uefi/uefidump/uefidump.c
> @@ -656,6 +656,30 @@ static void uefidump_info_signature_support(fwts_framework *fw, fwts_uefi_var *v
>  	}
>  }
>  
> +static void uefidump_info_hwerrrec_support(fwts_framework *fw, fwts_uefi_var *var)
> +{
> +	if (var->datalen != 2) {
> +		/* Should be 2 byte, of not, dump it out as a hex dump */
> +		uefidump_var_hexdump(fw, var);
> +	} else {
> +		char *support;
> +		uint16_t *value = (uint16_t *)var->data;
> +
> +		switch (*value) {
> +		case 0:
> +			support = " (Not support for Hardware Error Record Persistence)";
> +			break;
> +		case 1:
> +			support = " (Support for Hardware Error Record Persistence)";
> +			break;
> +		default:
> +			support = " (reserved value)";
> +			break;
> +		}
> +		fwts_log_info_verbatum(fw, "  Value: 0x%4.4" PRIx16 "%s.", *value, support);
> +	}
> +}
> +
>  static uefidump_info uefidump_info_table[] = {
>  	{ "PlatformLangCodes",	uefidump_info_platform_langcodes },
>  	{ "PlatformLang",	uefidump_info_platform_lang },
> @@ -680,6 +704,7 @@ static uefidump_info uefidump_info_table[] = {
>  	{ "MemoryOverwriteRequestControl",	uefidump_info_morc },
>  	{ "AcpiGlobalVariable",	uefidump_info_acpi_global_variable },
>  	{ "SignatureSupport",	uefidump_info_signature_support },
> +	{ "HwErrRecSupport",	uefidump_info_hwerrrec_support },

Looking at the UEFI 2.4 spec, section 7.2.3.2 Hardware Error Record
Variables, the variable name is "HwErrRec" followed by a 4 digit decimal
(which funnily enough in the example in the spec shows a 4 digit
hexadecimal number).  Anyhow, I guess "HwErrRec" is sufficient.  Is
"HwErrRecSupport" different to "HwErrRec"?

>  	{ NULL, NULL }
>  };
>  
>
Colin Ian King Sept. 5, 2013, 1:36 p.m. UTC | #2
On 05/09/13 14:33, Colin Ian King wrote:
> On 05/09/13 09:27, Ivan Hu wrote:
>> HwErrRecSupport identifies the level of hardware error record persistence
>> support implemented by the platform.
>>
>> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
>> ---
>>  src/uefi/uefidump/uefidump.c |   25 +++++++++++++++++++++++++
>>  1 file changed, 25 insertions(+)
>>
>> diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c
>> index dd58a3d..dc576c7 100644
>> --- a/src/uefi/uefidump/uefidump.c
>> +++ b/src/uefi/uefidump/uefidump.c
>> @@ -656,6 +656,30 @@ static void uefidump_info_signature_support(fwts_framework *fw, fwts_uefi_var *v
>>  	}
>>  }
>>  
>> +static void uefidump_info_hwerrrec_support(fwts_framework *fw, fwts_uefi_var *var)
>> +{
>> +	if (var->datalen != 2) {
>> +		/* Should be 2 byte, of not, dump it out as a hex dump */
>> +		uefidump_var_hexdump(fw, var);
>> +	} else {
>> +		char *support;
>> +		uint16_t *value = (uint16_t *)var->data;
>> +
>> +		switch (*value) {
>> +		case 0:
>> +			support = " (Not support for Hardware Error Record Persistence)";
>> +			break;
>> +		case 1:
>> +			support = " (Support for Hardware Error Record Persistence)";
>> +			break;
>> +		default:
>> +			support = " (reserved value)";
>> +			break;
>> +		}
>> +		fwts_log_info_verbatum(fw, "  Value: 0x%4.4" PRIx16 "%s.", *value, support);
>> +	}
>> +}
>> +
>>  static uefidump_info uefidump_info_table[] = {
>>  	{ "PlatformLangCodes",	uefidump_info_platform_langcodes },
>>  	{ "PlatformLang",	uefidump_info_platform_lang },
>> @@ -680,6 +704,7 @@ static uefidump_info uefidump_info_table[] = {
>>  	{ "MemoryOverwriteRequestControl",	uefidump_info_morc },
>>  	{ "AcpiGlobalVariable",	uefidump_info_acpi_global_variable },
>>  	{ "SignatureSupport",	uefidump_info_signature_support },
>> +	{ "HwErrRecSupport",	uefidump_info_hwerrrec_support },
> 
> Looking at the UEFI 2.4 spec, section 7.2.3.2 Hardware Error Record
> Variables, the variable name is "HwErrRec" followed by a 4 digit decimal
> (which funnily enough in the example in the spec shows a 4 digit
> hexadecimal number).  Anyhow, I guess "HwErrRec" is sufficient.  Is
> "HwErrRecSupport" different to "HwErrRec"?

Ignore that comment. I found it in the spec. Yes, HwErrRecSupport is a
different.

> 
>>  	{ NULL, NULL }
>>  };
>>  
>>
>
Colin Ian King Sept. 5, 2013, 1:37 p.m. UTC | #3
On 05/09/13 09:27, Ivan Hu wrote:
> HwErrRecSupport identifies the level of hardware error record persistence
> support implemented by the platform.
> 
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  src/uefi/uefidump/uefidump.c |   25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c
> index dd58a3d..dc576c7 100644
> --- a/src/uefi/uefidump/uefidump.c
> +++ b/src/uefi/uefidump/uefidump.c
> @@ -656,6 +656,30 @@ static void uefidump_info_signature_support(fwts_framework *fw, fwts_uefi_var *v
>  	}
>  }
>  
> +static void uefidump_info_hwerrrec_support(fwts_framework *fw, fwts_uefi_var *var)
> +{
> +	if (var->datalen != 2) {
> +		/* Should be 2 byte, of not, dump it out as a hex dump */
> +		uefidump_var_hexdump(fw, var);
> +	} else {
> +		char *support;
> +		uint16_t *value = (uint16_t *)var->data;
> +
> +		switch (*value) {
> +		case 0:
> +			support = " (Not support for Hardware Error Record Persistence)";
> +			break;
> +		case 1:
> +			support = " (Support for Hardware Error Record Persistence)";
> +			break;
> +		default:
> +			support = " (reserved value)";
> +			break;
> +		}
> +		fwts_log_info_verbatum(fw, "  Value: 0x%4.4" PRIx16 "%s.", *value, support);
> +	}
> +}
> +
>  static uefidump_info uefidump_info_table[] = {
>  	{ "PlatformLangCodes",	uefidump_info_platform_langcodes },
>  	{ "PlatformLang",	uefidump_info_platform_lang },
> @@ -680,6 +704,7 @@ static uefidump_info uefidump_info_table[] = {
>  	{ "MemoryOverwriteRequestControl",	uefidump_info_morc },
>  	{ "AcpiGlobalVariable",	uefidump_info_acpi_global_variable },
>  	{ "SignatureSupport",	uefidump_info_signature_support },
> +	{ "HwErrRecSupport",	uefidump_info_hwerrrec_support },
>  	{ NULL, NULL }
>  };
>  
> 
Acked-by: Colin Ian King <colin.king@canonical.com>
Keng-Yu Lin Sept. 6, 2013, 5:53 a.m. UTC | #4
On Thu, Sep 5, 2013 at 4:27 PM, Ivan Hu <ivan.hu@canonical.com> wrote:
> HwErrRecSupport identifies the level of hardware error record persistence
> support implemented by the platform.
>
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  src/uefi/uefidump/uefidump.c |   25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
>
> diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c
> index dd58a3d..dc576c7 100644
> --- a/src/uefi/uefidump/uefidump.c
> +++ b/src/uefi/uefidump/uefidump.c
> @@ -656,6 +656,30 @@ static void uefidump_info_signature_support(fwts_framework *fw, fwts_uefi_var *v
>         }
>  }
>
> +static void uefidump_info_hwerrrec_support(fwts_framework *fw, fwts_uefi_var *var)
> +{
> +       if (var->datalen != 2) {
> +               /* Should be 2 byte, of not, dump it out as a hex dump */
> +               uefidump_var_hexdump(fw, var);
> +       } else {
> +               char *support;
> +               uint16_t *value = (uint16_t *)var->data;
> +
> +               switch (*value) {
> +               case 0:
> +                       support = " (Not support for Hardware Error Record Persistence)";
> +                       break;
> +               case 1:
> +                       support = " (Support for Hardware Error Record Persistence)";
> +                       break;
> +               default:
> +                       support = " (reserved value)";
> +                       break;
> +               }
> +               fwts_log_info_verbatum(fw, "  Value: 0x%4.4" PRIx16 "%s.", *value, support);
> +       }
> +}
> +
>  static uefidump_info uefidump_info_table[] = {
>         { "PlatformLangCodes",  uefidump_info_platform_langcodes },
>         { "PlatformLang",       uefidump_info_platform_lang },
> @@ -680,6 +704,7 @@ static uefidump_info uefidump_info_table[] = {
>         { "MemoryOverwriteRequestControl",      uefidump_info_morc },
>         { "AcpiGlobalVariable", uefidump_info_acpi_global_variable },
>         { "SignatureSupport",   uefidump_info_signature_support },
> +       { "HwErrRecSupport",    uefidump_info_hwerrrec_support },
>         { NULL, NULL }
>  };
>
> --
> 1.7.9.5
>

Acked-by: Keng-Yu Lin <kengyu@canonical.com>
diff mbox

Patch

diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c
index dd58a3d..dc576c7 100644
--- a/src/uefi/uefidump/uefidump.c
+++ b/src/uefi/uefidump/uefidump.c
@@ -656,6 +656,30 @@  static void uefidump_info_signature_support(fwts_framework *fw, fwts_uefi_var *v
 	}
 }
 
+static void uefidump_info_hwerrrec_support(fwts_framework *fw, fwts_uefi_var *var)
+{
+	if (var->datalen != 2) {
+		/* Should be 2 byte, of not, dump it out as a hex dump */
+		uefidump_var_hexdump(fw, var);
+	} else {
+		char *support;
+		uint16_t *value = (uint16_t *)var->data;
+
+		switch (*value) {
+		case 0:
+			support = " (Not support for Hardware Error Record Persistence)";
+			break;
+		case 1:
+			support = " (Support for Hardware Error Record Persistence)";
+			break;
+		default:
+			support = " (reserved value)";
+			break;
+		}
+		fwts_log_info_verbatum(fw, "  Value: 0x%4.4" PRIx16 "%s.", *value, support);
+	}
+}
+
 static uefidump_info uefidump_info_table[] = {
 	{ "PlatformLangCodes",	uefidump_info_platform_langcodes },
 	{ "PlatformLang",	uefidump_info_platform_lang },
@@ -680,6 +704,7 @@  static uefidump_info uefidump_info_table[] = {
 	{ "MemoryOverwriteRequestControl",	uefidump_info_morc },
 	{ "AcpiGlobalVariable",	uefidump_info_acpi_global_variable },
 	{ "SignatureSupport",	uefidump_info_signature_support },
+	{ "HwErrRecSupport",	uefidump_info_hwerrrec_support },
 	{ NULL, NULL }
 };