[edk2-devel] [Patch V2] BoardModulePkg: Early connect PCI Root Bridge in BoardBdsHookLib

Heng Luo posted 1 patch 4 years, 1 month ago
Failed in applying to current master (apply log)
Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHookLib.c | 77 ++++++++++++++++++++++++++++++++++++++---------------------------------------
1 file changed, 38 insertions(+), 39 deletions(-)
[edk2-devel] [Patch V2] BoardModulePkg: Early connect PCI Root Bridge in BoardBdsHookLib
Posted by Heng Luo 4 years, 1 month ago
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3016

Trigger PCI Bus scanning at BdsBeforeConsoleAfterTrustedConsoleCallback().
Move the call to EnumUsbKeyboard() to after PciEnumComplete.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Heng Luo <heng.luo@intel.com>
---
 Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHookLib.c | 77 ++++++++++++++++++++++++++++++++++++++---------------------------------------
 1 file changed, 38 insertions(+), 39 deletions(-)

diff --git a/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHookLib.c b/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHookLib.c
index 9d42a8c27f..d7612fb80a 100644
--- a/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHookLib.c
+++ b/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHookLib.c
@@ -1141,11 +1141,6 @@ BdsPciEnumCompleteCallback (
 
   gBootMode                  = GetBootModeHob ();
 
-  //
-  // Connect Root Bridge to make PCI BAR resource allocated and all PciIo created
-  //
-  ConnectRootBridge (FALSE);
-
   //
   // Fill ConIn/ConOut in Full Configuration boot mode
   //
@@ -1180,6 +1175,42 @@ BdsPciEnumCompleteCallback (
     }
   }
 
+  //
+  // Enumerate USB keyboard
+  //
+  EnumUsbKeyboard ();
+
+  //
+  // For trusted console it must be handled here.
+  //
+  UpdateGraphicConOut (TRUE);
+
+  //
+  // Register Boot Options
+  //
+  RegisterDefaultBootOption ();
+
+  //
+  // Register Static Hot keys
+  //
+  RegisterStaticHotkey ();
+
+  //
+  // Process Physical Preo
+  //
+  PERF_START_EX(NULL,"EventRec", NULL, AsmReadTsc(), 0x7010);
+  if (PcdGetBool (PcdTpm2Enable)) {
+    ProcessTcgPp ();
+    ProcessTcgMor ();
+  }
+  PERF_END_EX(NULL,"EventRec", NULL, AsmReadTsc(), 0x7011);
+
+  //
+  // Perform memory test
+  // We should make all UEFI memory and GCD information populated before ExitPmAuth.
+  // SMM may consume these information.
+  //
+  MemoryTest((EXTENDMEM_COVERAGE_LEVEL) PcdGet32 (PcdPlatformMemoryCheckLevel));
 }
 
 /**
@@ -1265,41 +1296,9 @@ BdsBeforeConsoleAfterTrustedConsoleCallback (
   DEBUG ((DEBUG_INFO, "Event gBdsEventBeforeConsoleBeforeEndOfDxeGuid callback starts\n"));
 
   //
-  // Enumerate USB keyboard
-  //
-  EnumUsbKeyboard ();
-
-  //
-  // For trusted console it must be handled here.
-  //
-  UpdateGraphicConOut (TRUE);
-
-  //
-  // Register Boot Options
-  //
-  RegisterDefaultBootOption ();
-
-  //
-  // Register Static Hot keys
-  //
-  RegisterStaticHotkey ();
-
-  //
-  // Process Physical Preo
-  //
-  PERF_START_EX(NULL,"EventRec", NULL, AsmReadTsc(), 0x7010);
-  if (PcdGetBool (PcdTpm2Enable)) {
-    ProcessTcgPp ();
-    ProcessTcgMor ();
-  }
-  PERF_END_EX(NULL,"EventRec", NULL, AsmReadTsc(), 0x7011);
-
-  //
-  // Perform memory test
-  // We should make all UEFI memory and GCD information populated before ExitPmAuth.
-  // SMM may consume these information.
+  // Connect Root Bridge to make PCI BAR resource allocated and all PciIo created
   //
-  MemoryTest((EXTENDMEM_COVERAGE_LEVEL) PcdGet32 (PcdPlatformMemoryCheckLevel));
+  ConnectRootBridge (FALSE);
 }
 
 
-- 
2.24.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#66577): https://edk2.groups.io/g/devel/message/66577
Mute This Topic: https://groups.io/mt/77805401/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [Patch V2] BoardModulePkg: Early connect PCI Root Bridge in BoardBdsHookLib
Posted by Nate DeSimone 4 years, 1 month ago
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>

> -----Original Message-----
> From: Luo, Heng <heng.luo@intel.com>
> Sent: Sunday, October 25, 2020 6:07 PM
> To: devel@edk2.groups.io
> Cc: Dong, Eric <eric.dong@intel.com>; Chiu, Chasel <chasel.chiu@intel.com>;
> Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>
> Subject: [Patch V2] BoardModulePkg: Early connect PCI Root Bridge in
> BoardBdsHookLib
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3016
> 
> Trigger PCI Bus scanning at BdsBeforeConsoleAfterTrustedConsoleCallback().
> Move the call to EnumUsbKeyboard() to after PciEnumComplete.
> 
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Chasel Chiu <chasel.chiu@intel.com>
> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> Signed-off-by: Heng Luo <heng.luo@intel.com>
> ---
> 
> Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHookLi
> b.c | 77 ++++++++++++++++++++++++++++++++++++++-----------------------
> ----------------
>  1 file changed, 38 insertions(+), 39 deletions(-)
> 
> diff --git
> a/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook
> Lib.c
> b/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook
> Lib.c
> index 9d42a8c27f..d7612fb80a 100644
> ---
> a/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook
> Lib.c
> +++
> b/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook
> Lib.c
> @@ -1141,11 +1141,6 @@ BdsPciEnumCompleteCallback (
> 
> 
>    gBootMode                  = GetBootModeHob ();
> 
> 
> 
> -  //
> 
> -  // Connect Root Bridge to make PCI BAR resource allocated and all PciIo
> created
> 
> -  //
> 
> -  ConnectRootBridge (FALSE);
> 
> -
> 
>    //
> 
>    // Fill ConIn/ConOut in Full Configuration boot mode
> 
>    //
> 
> @@ -1180,6 +1175,42 @@ BdsPciEnumCompleteCallback (
>      }
> 
>    }
> 
> 
> 
> +  //
> 
> +  // Enumerate USB keyboard
> 
> +  //
> 
> +  EnumUsbKeyboard ();
> 
> +
> 
> +  //
> 
> +  // For trusted console it must be handled here.
> 
> +  //
> 
> +  UpdateGraphicConOut (TRUE);
> 
> +
> 
> +  //
> 
> +  // Register Boot Options
> 
> +  //
> 
> +  RegisterDefaultBootOption ();
> 
> +
> 
> +  //
> 
> +  // Register Static Hot keys
> 
> +  //
> 
> +  RegisterStaticHotkey ();
> 
> +
> 
> +  //
> 
> +  // Process Physical Preo
> 
> +  //
> 
> +  PERF_START_EX(NULL,"EventRec", NULL, AsmReadTsc(), 0x7010);
> 
> +  if (PcdGetBool (PcdTpm2Enable)) {
> 
> +    ProcessTcgPp ();
> 
> +    ProcessTcgMor ();
> 
> +  }
> 
> +  PERF_END_EX(NULL,"EventRec", NULL, AsmReadTsc(), 0x7011);
> 
> +
> 
> +  //
> 
> +  // Perform memory test
> 
> +  // We should make all UEFI memory and GCD information populated
> before ExitPmAuth.
> 
> +  // SMM may consume these information.
> 
> +  //
> 
> +  MemoryTest((EXTENDMEM_COVERAGE_LEVEL) PcdGet32
> (PcdPlatformMemoryCheckLevel));
> 
>  }
> 
> 
> 
>  /**
> 
> @@ -1265,41 +1296,9 @@ BdsBeforeConsoleAfterTrustedConsoleCallback (
>    DEBUG ((DEBUG_INFO, "Event
> gBdsEventBeforeConsoleBeforeEndOfDxeGuid callback starts\n"));
> 
> 
> 
>    //
> 
> -  // Enumerate USB keyboard
> 
> -  //
> 
> -  EnumUsbKeyboard ();
> 
> -
> 
> -  //
> 
> -  // For trusted console it must be handled here.
> 
> -  //
> 
> -  UpdateGraphicConOut (TRUE);
> 
> -
> 
> -  //
> 
> -  // Register Boot Options
> 
> -  //
> 
> -  RegisterDefaultBootOption ();
> 
> -
> 
> -  //
> 
> -  // Register Static Hot keys
> 
> -  //
> 
> -  RegisterStaticHotkey ();
> 
> -
> 
> -  //
> 
> -  // Process Physical Preo
> 
> -  //
> 
> -  PERF_START_EX(NULL,"EventRec", NULL, AsmReadTsc(), 0x7010);
> 
> -  if (PcdGetBool (PcdTpm2Enable)) {
> 
> -    ProcessTcgPp ();
> 
> -    ProcessTcgMor ();
> 
> -  }
> 
> -  PERF_END_EX(NULL,"EventRec", NULL, AsmReadTsc(), 0x7011);
> 
> -
> 
> -  //
> 
> -  // Perform memory test
> 
> -  // We should make all UEFI memory and GCD information populated
> before ExitPmAuth.
> 
> -  // SMM may consume these information.
> 
> +  // Connect Root Bridge to make PCI BAR resource allocated and all PciIo
> created
> 
>    //
> 
> -  MemoryTest((EXTENDMEM_COVERAGE_LEVEL) PcdGet32
> (PcdPlatformMemoryCheckLevel));
> 
> +  ConnectRootBridge (FALSE);
> 
>  }
> 
> 
> 
> 
> 
> --
> 2.24.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#66612): https://edk2.groups.io/g/devel/message/66612
Mute This Topic: https://groups.io/mt/77805401/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [Patch V2] BoardModulePkg: Early connect PCI Root Bridge in BoardBdsHookLib
Posted by Chiu, Chasel 4 years, 1 month ago
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>

> -----Original Message-----
> From: Luo, Heng <heng.luo@intel.com>
> Sent: Monday, October 26, 2020 9:07 AM
> To: devel@edk2.groups.io
> Cc: Dong, Eric <eric.dong@intel.com>; Chiu, Chasel <chasel.chiu@intel.com>;
> Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>
> Subject: [Patch V2] BoardModulePkg: Early connect PCI Root Bridge in
> BoardBdsHookLib
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3016
> 
> Trigger PCI Bus scanning at BdsBeforeConsoleAfterTrustedConsoleCallback().
> Move the call to EnumUsbKeyboard() to after PciEnumComplete.
> 
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Chasel Chiu <chasel.chiu@intel.com>
> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> Signed-off-by: Heng Luo <heng.luo@intel.com>
> ---
>  Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHookLib.c
> | 77 ++++++++++++++++++++++++++++++++++++++-----------------------------------
> ----
>  1 file changed, 38 insertions(+), 39 deletions(-)
> 
> diff --git
> a/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHookLib
> .c
> b/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHookLib
> .c
> index 9d42a8c27f..d7612fb80a 100644
> ---
> a/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHookLib
> .c
> +++
> b/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHookLib
> .c
> @@ -1141,11 +1141,6 @@ BdsPciEnumCompleteCallback (
> 
> 
>    gBootMode                  = GetBootModeHob ();
> 
> 
> 
> -  //
> 
> -  // Connect Root Bridge to make PCI BAR resource allocated and all PciIo
> created
> 
> -  //
> 
> -  ConnectRootBridge (FALSE);
> 
> -
> 
>    //
> 
>    // Fill ConIn/ConOut in Full Configuration boot mode
> 
>    //
> 
> @@ -1180,6 +1175,42 @@ BdsPciEnumCompleteCallback (
>      }
> 
>    }
> 
> 
> 
> +  //
> 
> +  // Enumerate USB keyboard
> 
> +  //
> 
> +  EnumUsbKeyboard ();
> 
> +
> 
> +  //
> 
> +  // For trusted console it must be handled here.
> 
> +  //
> 
> +  UpdateGraphicConOut (TRUE);
> 
> +
> 
> +  //
> 
> +  // Register Boot Options
> 
> +  //
> 
> +  RegisterDefaultBootOption ();
> 
> +
> 
> +  //
> 
> +  // Register Static Hot keys
> 
> +  //
> 
> +  RegisterStaticHotkey ();
> 
> +
> 
> +  //
> 
> +  // Process Physical Preo
> 
> +  //
> 
> +  PERF_START_EX(NULL,"EventRec", NULL, AsmReadTsc(), 0x7010);
> 
> +  if (PcdGetBool (PcdTpm2Enable)) {
> 
> +    ProcessTcgPp ();
> 
> +    ProcessTcgMor ();
> 
> +  }
> 
> +  PERF_END_EX(NULL,"EventRec", NULL, AsmReadTsc(), 0x7011);
> 
> +
> 
> +  //
> 
> +  // Perform memory test
> 
> +  // We should make all UEFI memory and GCD information populated before
> ExitPmAuth.
> 
> +  // SMM may consume these information.
> 
> +  //
> 
> +  MemoryTest((EXTENDMEM_COVERAGE_LEVEL) PcdGet32
> (PcdPlatformMemoryCheckLevel));
> 
>  }
> 
> 
> 
>  /**
> 
> @@ -1265,41 +1296,9 @@ BdsBeforeConsoleAfterTrustedConsoleCallback (
>    DEBUG ((DEBUG_INFO, "Event gBdsEventBeforeConsoleBeforeEndOfDxeGuid
> callback starts\n"));
> 
> 
> 
>    //
> 
> -  // Enumerate USB keyboard
> 
> -  //
> 
> -  EnumUsbKeyboard ();
> 
> -
> 
> -  //
> 
> -  // For trusted console it must be handled here.
> 
> -  //
> 
> -  UpdateGraphicConOut (TRUE);
> 
> -
> 
> -  //
> 
> -  // Register Boot Options
> 
> -  //
> 
> -  RegisterDefaultBootOption ();
> 
> -
> 
> -  //
> 
> -  // Register Static Hot keys
> 
> -  //
> 
> -  RegisterStaticHotkey ();
> 
> -
> 
> -  //
> 
> -  // Process Physical Preo
> 
> -  //
> 
> -  PERF_START_EX(NULL,"EventRec", NULL, AsmReadTsc(), 0x7010);
> 
> -  if (PcdGetBool (PcdTpm2Enable)) {
> 
> -    ProcessTcgPp ();
> 
> -    ProcessTcgMor ();
> 
> -  }
> 
> -  PERF_END_EX(NULL,"EventRec", NULL, AsmReadTsc(), 0x7011);
> 
> -
> 
> -  //
> 
> -  // Perform memory test
> 
> -  // We should make all UEFI memory and GCD information populated before
> ExitPmAuth.
> 
> -  // SMM may consume these information.
> 
> +  // Connect Root Bridge to make PCI BAR resource allocated and all PciIo
> created
> 
>    //
> 
> -  MemoryTest((EXTENDMEM_COVERAGE_LEVEL) PcdGet32
> (PcdPlatformMemoryCheckLevel));
> 
> +  ConnectRootBridge (FALSE);
> 
>  }
> 
> 
> 
> 
> 
> --
> 2.24.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#66580): https://edk2.groups.io/g/devel/message/66580
Mute This Topic: https://groups.io/mt/77805401/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-