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

Dandan Bi posted 1 patch 6 years, 2 months ago
Failed in applying to current master (apply log)
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(-)
[edk2] [patch] MdeModulePkg/DriverSampleDxe: Refine the sample case for UNION type
Posted by Dandan Bi 6 years, 2 months ago
The example of UNION storage is not good, now update it.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 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.<BR>
+Copyright (c) 2007 - 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
 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
   UINT8    NestBitNumeric  : 4;
 } MY_BITS_DATA;
 
 typedef union {
-  UINT16   BitField : 10;
-  UINT8    ByteField;
+  UINT8    UnionNumeric;
+  UINT8    UnionNumericAlias;
 } 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.<BR>
+//  Copyright (c) 2004 - 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
 //  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.<BR>
+// Copyright (c) 2007 - 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         
 // 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 default is 7 Manufacture default is 8"
-#string STR_UNION_BIT_NUMERIC_PROMPT   #language en-US "UNION EfiVarStore bit numeric"
-                                       #language fr-FR "UNION EfiVarStore bit numeric"
-#string STR_UNION_BIT_NUMERIC_HELP     #language en-US "Question refer to bit field in UNION type efivastore, the Standard default is 7 Manufacture default is 8"
-                                       #language fr-FR "Question refer to bit field in UNION type efivastore, the Standard default is 7 Manufacture default is 8"
 // Boot Order
 #string STR_BOOT_TITLE                 #language en-US "Boot"
 #string STR_BOOT_OPTIONS               #language en-US "Boot Order"
 #string STR_BOOT_OPTION1               #language en-US "IDE HDD"
 #string STR_BOOT_OPTION2               #language en-US "ATAPI CD"
-- 
1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [patch] MdeModulePkg/DriverSampleDxe: Refine the sample case for UNION type
Posted by Gao, Liming 6 years, 2 months ago
Reviewed-by: Liming Gao <liming.gao@intel.com>

> -----Original Message-----
> From: Bi, Dandan
> Sent: Wednesday, March 7, 2018 11:06 AM
> To: edk2-devel@lists.01.org
> Cc: Dong, Eric <eric.dong@intel.com>; Gao, Liming <liming.gao@intel.com>
> 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 <eric.dong@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> ---
>  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.<BR>
> +Copyright (c) 2007 - 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
>  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
>    UINT8    NestBitNumeric  : 4;
>  } MY_BITS_DATA;
> 
>  typedef union {
> -  UINT16   BitField : 10;
> -  UINT8    ByteField;
> +  UINT8    UnionNumeric;
> +  UINT8    UnionNumericAlias;
>  } 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.<BR>
> +//  Copyright (c) 2004 - 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
>  //  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.<BR>
> +// Copyright (c) 2007 - 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
>  // 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
> default is 7 Manufacture default is 8"
> -#string STR_UNION_BIT_NUMERIC_PROMPT   #language en-US "UNION EfiVarStore bit numeric"
> -                                       #language fr-FR "UNION EfiVarStore bit numeric"
> -#string STR_UNION_BIT_NUMERIC_HELP     #language en-US "Question refer to bit field in UNION type efivastore, the Standard
> default is 7 Manufacture default is 8"
> -                                       #language fr-FR "Question refer to bit field in UNION type efivastore, the Standard
> default is 7 Manufacture default is 8"
>  // Boot Order
>  #string STR_BOOT_TITLE                 #language en-US "Boot"
>  #string STR_BOOT_OPTIONS               #language en-US "Boot Order"
>  #string STR_BOOT_OPTION1               #language en-US "IDE HDD"
>  #string STR_BOOT_OPTION2               #language en-US "ATAPI CD"
> --
> 1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel