Re: [edk2] [patch] MdeModulePkg/DriverSampleDxe: Refine the sample case for UNION type

2018-03-06 Thread Gao, Liming
Reviewed-by: Liming Gao 

> -Original Message-
> From: Bi, Dandan
> Sent: Wednesday, March 7, 2018 11:06 AM
> To: edk2-devel@lists.01.org
> Cc: Dong, Eric ; Gao, Liming 
> Subject: [patch] MdeModulePkg/DriverSampleDxe: Refine the sample case for 
> UNION type
> 
> The example of UNION storage is not good, now update it.
> 
> Cc: Eric Dong 
> Cc: Liming Gao 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Dandan Bi 
> ---
>  MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h  |  6 +++---
>  MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr| 14 ++
>  MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni |  6 +-
>  3 files changed, 6 insertions(+), 20 deletions(-)
> 
> diff --git a/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h 
> b/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h
> index 6f092de..208a4c6 100644
> --- a/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h
> +++ b/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h
> @@ -1,8 +1,8 @@
>  /** @file
> 
> -Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
> +Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
>  This program and the accompanying materials
>  are licensed and made available under the terms and conditions of the BSD 
> License
>  which accompanies this distribution.  The full text of the license may be 
> found at
>  http://opensource.org/licenses/bsd-license.php
> 
> @@ -51,12 +51,12 @@ typedef struct {
>UINT8: 0;  // Special width 0 can be used to force 
> alignment at the next word boundary
>UINT8NestBitNumeric  : 4;
>  } MY_BITS_DATA;
> 
>  typedef union {
> -  UINT16   BitField : 10;
> -  UINT8ByteField;
> +  UINT8UnionNumeric;
> +  UINT8UnionNumericAlias;
>  } MY_EFI_UNION_DATA;
> 
>  typedef struct {
>UINT16  MyStringData[40];
>UINT16  SomethingHiddenForHtml;
> diff --git a/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr 
> b/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr
> index b1017d9..9d99dcf 100644
> --- a/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr
> +++ b/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr
> @@ -1,10 +1,10 @@
>  ///** @file
>  //
>  //Sample Setup formset.
>  //
> -//  Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
> +//  Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
>  //  This program and the accompanying materials
>  //  are licensed and made available under the terms and conditions of the 
> BSD License
>  //  which accompanies this distribution.  The full text of the license may 
> be found at
>  //  http://opensource.org/licenses/bsd-license.php
>  //
> @@ -913,30 +913,20 @@ formset
>  endnumeric;
> 
>  subtitle text = STRING_TOKEN(STR_SUBTITLE_TEXT2);
>  subtitle text = STRING_TOKEN(STR_UNION_EFI_VARSTORE);
> 
> -numeric varid   = MyEfiUnionVar.ByteField,
> +numeric varid   = MyEfiUnionVar.UnionNumeric,
>  prompt  = STRING_TOKEN(STR_UNION_BYTE_NUMERIC_PROMPT),
>  help= STRING_TOKEN(STR_UNION_BYTE_NUMERIC_HELP),
>  minimum = 0,
>  maximum = 20,
>  step= 0,
>  default = 7, defaultstore = MyStandardDefault,
>  default = 8, defaultstore = MyManufactureDefault,
>  endnumeric;
> 
> -numeric varid   = MyEfiUnionVar.BitField,
> -prompt  = STRING_TOKEN(STR_UNION_BIT_NUMERIC_PROMPT),
> -help= STRING_TOKEN(STR_UNION_BIT_NUMERIC_HELP),
> -minimum = 0,
> -maximum = 20,
> -step= 0,
> -default = 7, defaultstore = MyStandardDefault,
> -default = 8, defaultstore = MyManufactureDefault,
> -endnumeric;
> -
>  guidop
>guid = DRIVER_SAMPLE_FORMSET_GUID,
>datatype = MY_EFI_BITS_VARSTORE_DATA,
>  data.EfiBitNumeric  = 1,
>  data.EfiBitOneof = 1,
> diff --git a/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni 
> b/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni
> index 7cc6a19..2215c08 100644
> --- a/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni
> +++ b/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni
> @@ -1,8 +1,8 @@
>  // *++
>   //
> -// Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
> +// Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
>  // This program and the accompanying materials
>  // are licensed and made available under the terms and conditions of the BSD 
> License
>  // which accompanies this distribution.  The full text of the license may be 
> found at
>  // http://opensource.org/licenses/bsd-license.php
>  //
> @@ -330,14 +330,10 @@
> #language fr-FR "The question refer 
> to byte field in BIT structure"
>  #string STR_UNION_BYTE_NUMERIC_PROMPT  #language en-US "UNION EfiVarStore 
> byte numeric"
> #language fr-FR "UNIO

[edk2] [patch] MdeModulePkg/DriverSampleDxe: Refine the sample case for UNION type

2018-03-06 Thread Dandan Bi
The example of UNION storage is not good, now update it.

Cc: Eric Dong 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi 
---
 MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h  |  6 +++---
 MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr| 14 ++
 MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni |  6 +-
 3 files changed, 6 insertions(+), 20 deletions(-)

diff --git a/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h 
b/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h
index 6f092de..208a4c6 100644
--- a/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h
+++ b/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h
@@ -1,8 +1,8 @@
 /** @file
 
-Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
 http://opensource.org/licenses/bsd-license.php
 
@@ -51,12 +51,12 @@ typedef struct {
   UINT8: 0;  // Special width 0 can be used to force 
alignment at the next word boundary
   UINT8NestBitNumeric  : 4;
 } MY_BITS_DATA;
 
 typedef union {
-  UINT16   BitField : 10;
-  UINT8ByteField;
+  UINT8UnionNumeric;
+  UINT8UnionNumericAlias;
 } MY_EFI_UNION_DATA;
 
 typedef struct {
   UINT16  MyStringData[40];
   UINT16  SomethingHiddenForHtml;
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr 
b/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr
index b1017d9..9d99dcf 100644
--- a/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr
+++ b/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr
@@ -1,10 +1,10 @@
 ///** @file
 //
 //Sample Setup formset.
 //
-//  Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
+//  Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
 //  This program and the accompanying materials
 //  are licensed and made available under the terms and conditions of the BSD 
License
 //  which accompanies this distribution.  The full text of the license may be 
found at
 //  http://opensource.org/licenses/bsd-license.php
 //
@@ -913,30 +913,20 @@ formset
 endnumeric;
 
 subtitle text = STRING_TOKEN(STR_SUBTITLE_TEXT2);
 subtitle text = STRING_TOKEN(STR_UNION_EFI_VARSTORE);
 
-numeric varid   = MyEfiUnionVar.ByteField,
+numeric varid   = MyEfiUnionVar.UnionNumeric,
 prompt  = STRING_TOKEN(STR_UNION_BYTE_NUMERIC_PROMPT),
 help= STRING_TOKEN(STR_UNION_BYTE_NUMERIC_HELP),
 minimum = 0,
 maximum = 20,
 step= 0,
 default = 7, defaultstore = MyStandardDefault,
 default = 8, defaultstore = MyManufactureDefault,
 endnumeric;
 
-numeric varid   = MyEfiUnionVar.BitField,
-prompt  = STRING_TOKEN(STR_UNION_BIT_NUMERIC_PROMPT),
-help= STRING_TOKEN(STR_UNION_BIT_NUMERIC_HELP),
-minimum = 0,
-maximum = 20,
-step= 0,
-default = 7, defaultstore = MyStandardDefault,
-default = 8, defaultstore = MyManufactureDefault,
-endnumeric;
-
 guidop
   guid = DRIVER_SAMPLE_FORMSET_GUID,
   datatype = MY_EFI_BITS_VARSTORE_DATA,
 data.EfiBitNumeric  = 1,
 data.EfiBitOneof = 1,
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni 
b/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni
index 7cc6a19..2215c08 100644
--- a/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni
+++ b/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni
@@ -1,8 +1,8 @@
 // *++
//
-// Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
+// Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
 // This program and the accompanying materials  
 // are licensed and made available under the terms and conditions of the BSD 
License 
 // which accompanies this distribution.  The full text of the license may be 
found at
 // http://opensource.org/licenses/bsd-license.php  
  
 // 
  
@@ -330,14 +330,10 @@
#language fr-FR "The question refer to 
byte field in BIT structure"
 #string STR_UNION_BYTE_NUMERIC_PROMPT  #language en-US "UNION EfiVarStore byte 
numeric"
#language fr-FR "UNION EfiVarStore byte 
numeric"
 #string STR_UNION_BYTE_NUMERIC_HELP#language en-US "Question refer to byte 
field in UNION type efivastore, the Standard default is 7 Manufacture default 
is 8"
#language fr-FR "Question refer to byte 
field in UNION type efivastore, the Standard