Dandan:
  How about name PCD to PcdFrontPageFormSetGuid? And, if FormSetGuid or one of 
the elements of the ClassId field  in the EFI_IFR_FORM_SET op-code matches this 
PCD value, it means this formset is front page.

Thanks
Liming
From: Bi, Dandan
Sent: Monday, June 08, 2015 1:57 PM
To: 'edk2-devel@lists.sourceforge.net'; Dong, Eric; Gao, Liming
Subject: [patch] EDKII:Display engine should not depend on the framework code

Display engine base on class opcode to detect whether in
frontpage form.Now remove class/subclass and use ClassGuid to
judge whether in frontpage form

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan...@intel.com<mailto:dandan...@intel.com>>
---
.../Universal/BdsDxe/FrontPageVfr.Vfr              |  4 +---
.../CustomizedDisplayLib/CustomizedDisplayLib.inf  |  5 +++--
.../CustomizedDisplayLibInternal.c                 | 23 +++++++++++++++++++++-
MdeModulePkg/MdeModulePkg.dec                      |  4 ++++
MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c  |  1 +
.../Universal/SetupBrowserDxe/Presentation.c       | 17 ++++++++++++++++
MdeModulePkg/Universal/SetupBrowserDxe/Setup.h     |  1 +
7 files changed, 49 insertions(+), 6 deletions(-)

diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPageVfr.Vfr 
b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPageVfr.Vfr
index d5fe4f4..a2d92df 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPageVfr.Vfr
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPageVfr.Vfr
@@ -1,10 +1,10 @@
///** @file
//
 //    Browser formset.
//
-//  Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
+//  Copyright (c) 2007 - 2015, 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
//
@@ -39,12 +39,10 @@
formset
   guid     = FRONT_PAGE_FORMSET_GUID,
   title    = STRING_TOKEN(STR_FRONT_PAGE_TITLE),
   help     = STRING_TOKEN(STR_NULL_STRING),
   classguid = FRONT_PAGE_FORMSET_GUID,
-  class    = FRONT_PAGE_CLASS,
-  subclass = FRONT_PAGE_SUBCLASS,

   form formid = FRONT_PAGE_FORM_ID,
        title  = STRING_TOKEN(STR_FRONT_PAGE_TITLE);

     banner
diff --git a/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf 
b/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
index cdcc256..477a8fd 100644
--- a/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
+++ b/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
@@ -1,9 +1,9 @@
## @file
# Customize display library used by display engine.
#
-#  Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2013 - 2015, 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
@@ -59,6 +59,7 @@

 [Pcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserSubtitleTextColor               ## 
CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserFieldTextColor                  ## 
CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserFieldTextHighlightColor         ## 
CONSUMES
-  gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserFieldBackgroundHighlightColor   ## 
CONSUMES
\ No newline at end of file
+  gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserFieldBackgroundHighlightColor   ## 
CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFrontPageFormSet                       ## 
CONSUMES
\ No newline at end of file
diff --git 
a/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLibInternal.c 
b/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLibInternal.c
index ad4bc9a..e2bef2b 100644
--- a/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLibInternal.c
+++ b/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLibInternal.c
@@ -1,10 +1,10 @@
/** @file

   This library class defines a set of interfaces to customize Display module

-Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2013-2015, 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 that accompanies this distribution.
 The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.

@@ -254,11 +254,32 @@ PrintFramework (
VOID
ProcessUserOpcode(
   IN  EFI_IFR_OP_HEADER         *OpCodeData
   )
{
+  EFI_GUID *   ClassGuid;
+  UINT8        ClassGuidNum;
+
+  ClassGuid    = NULL;
+  ClassGuidNum = 0;
+
   switch (OpCodeData->OpCode) {
+    case EFI_IFR_FORM_SET_OP:
+      //
+      // process the statement outside of form,if it is formset op, get its 
classguid and compared with gFrontPageFormSetGuid
+      //
+      ClassGuidNum = (UINT8)(((EFI_IFR_FORM_SET *)OpCodeData)->Flags & 0x3);
+      ClassGuid    = (EFI_GUID *)(VOID *)((UINT8 *)OpCodeData + sizeof 
(EFI_IFR_FORM_SET));
+      while (ClassGuidNum-- > 0){
+        if (CompareGuid((EFI_GUID*)PcdGetPtr (PcdFrontPageFormSet),ClassGuid)){
+          gClassOfVfr = FORMSET_CLASS_FRONT_PAGE;
+          break;
+        }
+        ClassGuid ++;
+      }
+      break;
+
     case EFI_IFR_GUID_OP:
       if (CompareGuid (&gEfiIfrTianoGuid, (EFI_GUID *)((CHAR8*) OpCodeData + 
sizeof (EFI_IFR_OP_HEADER)))) {
         //
         // Tiano specific GUIDed opcodes
         //
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 4d89a57..5ba2464 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -966,10 +966,14 @@
   ## Specify the console output row of text setup.
   # @Prompt Console Output Row of Text Setup
   gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutRow|25|UINT32|0x4000000e

 [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
+  ## This PCD points to the formset Class GUID
+  #  Platform can customize the PCD to point to different formset
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFrontPageFormSet|{ 0xbc, 0x30, 0x0c, 
0x9e,0x06, 0x3f, 0xa6, 0x4b, 0x82, 0x88, 0x9, 0x17, 0x9b, 0x85, 0x5d, 0xbe 
}|VOID*|0x0001006e
+
   ## Base address of the NV variable range in flash device.
   # @Prompt Base address of flash NV variable range.
   
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x0|UINT32|0x30000001

   ## Size of the NV variable range. Note that this value should less than or 
equal to PcdFlashNvStorageFtwSpareSize.
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c 
b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
index 3785c32..4540560 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
@@ -1707,10 +1707,11 @@ ParseOpCodes (
         return EFI_INVALID_PARAMETER;
       }

       CopyMem (&FormSet->FormSetTitle, &((EFI_IFR_FORM_SET *) 
OpCodeData)->FormSetTitle, sizeof (EFI_STRING_ID));
       CopyMem (&FormSet->Help,         &((EFI_IFR_FORM_SET *) 
OpCodeData)->Help,         sizeof (EFI_STRING_ID));
+      FormSet->OpCode = (EFI_IFR_OP_HEADER *) OpCodeData;//save the opcode 
address of formset

       if (OpCodeLength > OFFSET_OF (EFI_IFR_FORM_SET, Flags)) {
         //
         // The formset OpCode contains ClassGuid
         //
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c 
b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
index 002a86a..bdf2f8a 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
@@ -544,10 +544,27 @@ AddStatementToDisplayForm (

     InsertTailList(&gDisplayFormData.StatementListOSF, 
&DisplayStatement->DisplayLink);
   }

   //
+  // Process the formset which has ClassGuid and treat this formset as 
statement outside the form.
+  //
+  if (&gCurrentSelection->FormSet->ClassGuid != NULL) {
+    DisplayStatement = AllocateZeroPool (sizeof 
(FORM_DISPLAY_ENGINE_STATEMENT));
+    ASSERT (DisplayStatement != NULL);
+
+    DisplayStatement->Signature = FORM_DISPLAY_ENGINE_STATEMENT_SIGNATURE;
+    DisplayStatement->Version   = FORM_DISPLAY_ENGINE_STATEMENT_VERSION_1;
+    DisplayStatement->OpCode = gCurrentSelection->FormSet->OpCode;
+
+    InitializeListHead (&DisplayStatement->NestStatementList);
+    InitializeListHead (&DisplayStatement->OptionListHead);
+
+    InsertTailList(&gDisplayFormData.StatementListOSF, 
&DisplayStatement->DisplayLink);
+  }
+
+  //
   // Process the statement in this form.
   //
   Link = GetFirstNode (&gCurrentSelection->Form->StatementListHead);
   while (!IsNull (&gCurrentSelection->Form->StatementListHead, Link)) {
     Statement = FORM_BROWSER_STATEMENT_FROM_LINK (Link);
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h 
b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
index c8aa9dd..82bc23b 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
@@ -452,10 +452,11 @@ typedef struct {
   UINT8                           NumberOfClassGuid;
   EFI_GUID                        ClassGuid[3];         // Up to three 
ClassGuid
   UINT16                          Class;                // Tiano extended 
Class code
   UINT16                          SubClass;             // Tiano extended 
Subclass code
   EFI_IMAGE_ID                    ImageId;
+  EFI_IFR_OP_HEADER               *OpCode;              //mainly for formset 
op to get ClassGuid

   FORM_BROWSER_STATEMENT          *StatementBuffer;     // Buffer for all 
Statements and Questions
   EXPRESSION_OPCODE               *ExpressionBuffer;    // Buffer for all 
Expression OpCode
   FORM_BROWSER_FORM               *SaveFailForm;        // The form which 
failed to save.
   FORM_BROWSER_STATEMENT          *SaveFailStatement;   // The Statement which 
failed to save.
--
1.9.5.msysgit.1
------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to