From: "Jin, Eric" <eric.jin@intel.com>
To: Supreeth Venkatesh <supreeth.venkatesh@arm.com>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [edk2-test][Patch v2] uefi-sct/SctPkg:Assign 0 to the tail of HwErrRecVariableName.
Date: Fri, 2 Nov 2018 01:39:22 +0000 [thread overview]
Message-ID: <DA72DC7456565B47808A57108259571F63705EF4@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <aed1f61db929c3eb25a62d4a3f03a390eedf772f.camel@arm.com>
Supreeth,
Thank you for the reminder. I correct them in the commit. Thanks.
Best Regards
Eric
-----Original Message-----
From: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Sent: Friday, November 2, 2018 4:23 AM
To: Jin, Eric <eric.jin@intel.com>; edk2-devel@lists.01.org
Subject: Re: [edk2-test][Patch v2] uefi-sct/SctPkg:Assign 0 to the tail of HwErrRecVariableName.
Reviewed-by: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
There are some unintentional indentation changes in "switch" statement.
Please take care of that before (if intentional, ok as well) commit.
On Thu, 2018-11-01 at 10:52 +0800, Eric Jin wrote:
> Add definition of HwErrRecVariableNamePrefixLength,
> HwErrRecVariableNameIndexLength and HwErrRecVariableNameLength Make
> the HwErrRecVariableName as the valid string.
> Ensure the HwErrRecVariable could be deleted before the test exit.
>
> Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Eric Jin <eric.jin@intel.com>
> ---
> .../BlackBoxTest/VariableServicesBBTestFunction.c | 38
> +++++++++++++---------
> .../BlackBoxTest/VariableServicesBBTestMain.h | 13 +++++++-
> 2 files changed, 35 insertions(+), 16 deletions(-)
>
> diff --git a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBo
> xTest/VariableServicesBBTestFunction.c b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBo
> xTest/VariableServicesBBTestFunction.c
> index d1064ce..defe71a 100644
> --- a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBo
> xTest/VariableServicesBBTestFunction.c
> +++ b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBo
> xTest/VariableServicesBBTestFunction.c
> @@ -1,7 +1,7 @@
> /** @file
>
> Copyright 2006 - 2012 Unified EFI, Inc.<BR>
> - Copyright (c) 2010 - 2012, Intel Corporation. All rights
> reserved.<BR>
> + Copyright (c) 2010 - 2018, Intel Corporation. All rights
> reserved.<BR>
>
> This program and the accompanying materials
> are licensed and made available under the terms and conditions of
> the BSD License @@ -2855,7 +2855,7 @@ HardwareErrorRecordFuncTest (
> UINT64 RemainingVariableStorageSize;
> UINT64 MaximumVariableSize;
>
> - CHAR16 HwErrRecVariableName[13];
> + CHAR16 HwErrRecVariableName[HwErrRecVariableNameLen
> gth];
> CHAR16 HwErrRecVariable[] = L"This is a HwErrRec
> variable!";
>
> CHAR16 GetVariableName[MAX_BUFFER_SIZE];
> @@ -2864,7 +2864,7 @@ HardwareErrorRecordFuncTest (
>
> UINTN Num;
> UINTN MaxNum = 0;
> - CHAR16 ErrorNum[5];
> + CHAR16 ErrorNum[HwErrRecVariableNameIndexLength+1];
>
> CHAR16 HwErrRecGetVariable[255];
>
> @@ -2908,7 +2908,11 @@ HardwareErrorRecordFuncTest (
> }
>
> //
> - // Read reset record
> + // Try to read reset record from the RecoveryData, // and the
> + magic num is saved in the RecoveryData[0].
> + // When the status is EFI_SUCCESS and magic num is 2, // it means
> + useful data has been saved before the reset // and the date should
> + be retrived goto particular process
> //
> Status = RecoveryLib->ReadResetRecord (
> RecoveryLib, @@ -2916,12 +2920,12 @@
> HardwareErrorRecordFuncTest (
> RecoveryData
> );
> if ( !EFI_ERROR(Status) && (RecoveryDataSize > 0) ) {
> - switch (RecoveryData[0]) {
> + switch (RecoveryData[0]) {
Is the indentation change intentional? It looked good to me earlier and is ok with edk2 C coding standards as well.
> case 2:
> goto step2;
> default:
> goto step3;
> - }
> + }
Is the indentation change intentional? It looked good to me earlier and is ok with edk2 C coding standards as well.
> }
>
> //
> @@ -2978,7 +2982,7 @@ HardwareErrorRecordFuncTest (
> // Get a useable variable name
> //
> GetVariableName[0] = L'\0';
> - ErrorNum[4] = L'\0';
> + ErrorNum[HwErrRecVariableNameIndexLength] = L'\0';
>
>
> while (TRUE) {
> @@ -3001,9 +3005,9 @@ HardwareErrorRecordFuncTest (
> break;
> }
>
> - if ( (SctStrnCmp (GetVariableName, L"HwErrRec", 8) == 0) &&
> + if ( (SctStrnCmp (GetVariableName, L"HwErrRec",
> HwErrRecVariableNamePrefixLength) == 0) &&
> (SctCompareGuid (&VendorGuid, &gHwErrRecGuid) == 0) ) {
> - SctStrnCpy (ErrorNum, &GetVariableName[8], 4);
> + SctStrnCpy (ErrorNum,
> &GetVariableName[HwErrRecVariableNamePrefixLength],
> HwErrRecVariableNameIndexLength);
> Num = SctXtoi (ErrorNum);
> if (MaxNum < Num)
> MaxNum = Num;
> @@ -3014,7 +3018,8 @@ HardwareErrorRecordFuncTest (
>
> HwErrRecVariableName[0] = L'\0';
> SctStrCat ( HwErrRecVariableName, L"HwErrRec" );
> - Myitox( MaxNum, HwErrRecVariableName+8 );
> + Myitox( MaxNum,
> HwErrRecVariableName+HwErrRecVariableNamePrefixLength );
> + HwErrRecVariableName[HwErrRecVariableNameLength-1] = L'\0';
>
> //
> // Set the new HwErrRec variable to the global variable @@ -3033,11
> +3038,12 @@ HardwareErrorRecordFuncTest (
> }
>
> //
> - // Write reset record
> + // Before the reset, test writes magic num 2 in RecoveryData[0] //
> + and writes the useful data - HwErrRecVariableName - to
> RecoveryData[2]
> //
> RecoveryData[0] = 2;
> - SctStrnCpy ( (CHAR16*)(&RecoveryData[2]), HwErrRecVariableName, 12
> );
> - RecoveryLib->WriteResetRecord( RecoveryLib, 13*sizeof(CHAR16)+2,
> RecoveryData );
> + SctStrnCpy ( (CHAR16*)(&RecoveryData[2]), HwErrRecVariableName,
> HwErrRecVariableNameLength-1 );
> + RecoveryLib->WriteResetRecord( RecoveryLib,
> HwErrRecVariableNameLength*sizeof(CHAR16)+2, RecoveryData );
>
> //
> // Prompt the user about the cold reset and reset the system @@
> -3048,11 +3054,13 @@ HardwareErrorRecordFuncTest (
> gtRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
>
> //
> - // After the cold reset
> + // The particular process after the reset // retrive the useful
> + data - HwErrRecVariableName - from
> RecoveryData[2]
> //
> step2:
> DataSize = 255;
> - SctStrnCpy ( HwErrRecVariableName, (CHAR16*)(RecoveryData+2), 12 );
> + HwErrRecVariableName[HwErrRecVariableNameLength-1] = L'\0';
> + SctStrnCpy ( HwErrRecVariableName, (CHAR16*)(RecoveryData+2),
> HwErrRecVariableNameLength-1 );
> Status = RT->GetVariable (
> HwErrRecVariableName,
> &gHwErrRecGuid, diff --git a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBo
> xTest/VariableServicesBBTestMain.h b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBo
> xTest/VariableServicesBBTestMain.h
> index 051ae6f..426b762 100644
> --- a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBo
> xTest/VariableServicesBBTestMain.h
> +++ b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBo
> xTest/VariableServicesBBTestMain.h
> @@ -1,7 +1,7 @@
> /** @file
>
> Copyright 2006 - 2016 Unified EFI, Inc.<BR>
> - Copyright (c) 2010 - 2016, Intel Corporation. All rights
> reserved.<BR>
> + Copyright (c) 2010 - 2018, Intel Corporation. All rights
> reserved.<BR>
>
> This program and the accompanying materials
> are licensed and made available under the terms and conditions of
> the BSD License @@ -125,6 +125,17 @@ Abstract:
> #endif
>
> //
> +// The Variable Name of Hardware Error Record Variables // defined in
> +the UEFI Spec is HwErrRec####. For example, // HwErrRec0001,
> +HwErrRec0002, HwErrRecF31A, etc.
> +// The prefix length is 8, index length is 4.
> +// Consider the tail of string, the name length is 13.
> +//
> +#define HwErrRecVariableNameLength 13
> +#define HwErrRecVariableNamePrefixLength 8 #define
> +HwErrRecVariableNameIndexLength 4
> +
> +//
> // Global Variables
> //
>
prev parent reply other threads:[~2018-11-02 1:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-01 2:52 [edk2-test][Patch v2] uefi-sct/SctPkg:Assign 0 to the tail of HwErrRecVariableName Eric Jin
2018-11-01 20:23 ` Supreeth Venkatesh
2018-11-02 1:39 ` Jin, Eric [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DA72DC7456565B47808A57108259571F63705EF4@SHSMSX103.ccr.corp.intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox