public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Jiewen Yao <jiewen.yao@intel.com>
To: edk2-devel@lists.01.org
Cc: David Wei <david.wei@intel.com>
Subject: [PATCH] Vlv2TbltDevicePkg/PlatformInitPei: Support USB init
Date: Tue,  6 Sep 2016 16:32:14 +0800	[thread overview]
Message-ID: <1473150734-12192-1-git-send-email-jiewen.yao@intel.com> (raw)

In order to support recovery in PEI phase, a platform need initialize
USB controller. This logic is missing in current PchInitPeim.

We removed MultiPlatformInfoInit() because it is already done in
PlatformEarlyInitEntry().

We also initialize XhciMemBaseAddr to 0, or it is garbage value.

Cc: David Wei <david.wei@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: David Wei <david.wei@intel.com>
---
 Vlv2TbltDevicePkg/PlatformInitPei/PchInitPeim.c | 26 ++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/Vlv2TbltDevicePkg/PlatformInitPei/PchInitPeim.c b/Vlv2TbltDevicePkg/PlatformInitPei/PchInitPeim.c
index 18ecda4..286ccee 100644
--- a/Vlv2TbltDevicePkg/PlatformInitPei/PchInitPeim.c
+++ b/Vlv2TbltDevicePkg/PlatformInitPei/PchInitPeim.c
@@ -53,6 +53,11 @@ PchInitInterrupt (
   IN SYSTEM_CONFIGURATION  *SystemConfiguration
   );
 
+EFI_STATUS
+InstallPeiPchUsbPolicy (
+  IN CONST  EFI_PEI_SERVICES  **PeiServices
+  );
+
 #ifndef __GNUC__
 #pragma warning (push)
 #pragma warning (disable : 4245)
@@ -541,8 +546,18 @@ PlatformPchInit (
   IN UINT16                      PlatformType
   )
 {
+  EFI_STATUS     Status;
+  EFI_BOOT_MODE  BootMode;
+
+  Status = PeiServicesGetBootMode (&BootMode);
+  ASSERT_EFI_ERROR (Status);
+
   IchRcrbInit (PeiServices, SystemConfiguration);
 
+  if (BootMode == BOOT_IN_RECOVERY_MODE) {
+    InstallPeiPchUsbPolicy(PeiServices);
+  }
+
   //
   // PCH Policy Initialization based on Setup variable.
   //
@@ -721,7 +736,8 @@ InstallPeiPchUsbPolicy (
   EFI_PEI_PPI_DESCRIPTOR  *PeiPchUsbPolicyPpiDesc;
   PCH_USB_POLICY_PPI      *PeiPchUsbPolicyPpi;
   PCH_USB_CONFIG          *UsbConfig;
-  EFI_PLATFORM_INFO_HOB   PlatformInfo;
+
+  DEBUG ((EFI_D_INFO, "InstallPeiPchUsbPolicy...\n"));
 
   //
   // Allocate descriptor and PPI structures.  Since these are dynamically updated
@@ -745,12 +761,6 @@ InstallPeiPchUsbPolicy (
   UsbConfig->UsbPerPortCtl            = PCH_DEVICE_DISABLE;
   UsbConfig->Ehci1Usbr                = PCH_DEVICE_DISABLE;
 
-  //
-  // Initialize PlatformInfo HOB
-  //
-  ZeroMem (&PlatformInfo, sizeof(PlatformInfo));
-  MultiPlatformInfoInit(PeiServices, &PlatformInfo);
-
   UsbConfig->Usb20OverCurrentPins[0] = PchUsbOverCurrentPin0;
 
   UsbConfig->Usb20OverCurrentPins[1] = PchUsbOverCurrentPin0;
@@ -784,6 +794,8 @@ InstallPeiPchUsbPolicy (
 
   PeiPchUsbPolicyPpi->EhciMemLength   = (UINT32) 0x400 * PchEhciControllerMax;
 
+  PeiPchUsbPolicyPpi->XhciMemBaseAddr = 0;
+
   PeiPchUsbPolicyPpi->UsbConfig       = UsbConfig;
 
   PeiPchUsbPolicyPpiDesc->Flags       = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
-- 
2.7.4.windows.1



                 reply	other threads:[~2016-09-06  8:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1473150734-12192-1-git-send-email-jiewen.yao@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