summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Bus
diff options
context:
space:
mode:
authorPaul Chang <paulchang@ami.com>2024-10-28 15:53:25 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-11-01 01:53:53 +0000
commita9901a7748ad08664ebc323ee9c475176aca48e7 (patch)
tree7ce4226d9f20bdd01346cc29c9471a021b1d477d /MdeModulePkg/Bus
parentd13f31c3fe17eb532bf9016a2d8de3885642cba0 (diff)
downloadedk2-a9901a7748ad08664ebc323ee9c475176aca48e7.tar.gz
edk2-a9901a7748ad08664ebc323ee9c475176aca48e7.tar.bz2
edk2-a9901a7748ad08664ebc323ee9c475176aca48e7.zip
MdeModulePkg: SataControllerSupported checks DevicePath Protocol
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4858 Ph52a PCIE to SATA card inserted on Intel MTL/ARL causes system hanged. Root cause of this issue is because Ph52a's driver only uses DevicePath protocol alone and EDK2 driver only uses PciIo protocol alone. Both drivers start and try to manage SATA controller. Signed-off-by: Paul Chang <paulchang@ami.com>
Diffstat (limited to 'MdeModulePkg/Bus')
-rw-r--r--MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c32
-rw-r--r--MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.h1
-rw-r--r--MdeModulePkg/Bus/Pci/SataControllerDxe/SataControllerDxe.inf1
3 files changed, 31 insertions, 3 deletions
diff --git a/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c b/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c
index ea0116071c..e38304cffd 100644
--- a/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c
+++ b/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c
@@ -287,9 +287,35 @@ SataControllerSupported (
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
- EFI_STATUS Status;
- EFI_PCI_IO_PROTOCOL *PciIo;
- PCI_TYPE00 PciData;
+ EFI_STATUS Status;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ PCI_TYPE00 PciData;
+ EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
+
+ //
+ // Attempt to open DevicePath Protocol
+ //
+ Status = gBS->OpenProtocol (
+ Controller,
+ &gEfiDevicePathProtocolGuid,
+ (VOID *)&ParentDevicePath,
+ This->DriverBindingHandle,
+ Controller,
+ EFI_OPEN_PROTOCOL_BY_DRIVER
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ ///
+ /// Close the protocol because we don't use it here
+ ///
+ gBS->CloseProtocol (
+ Controller,
+ &gEfiDevicePathProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
//
// Attempt to open PCI I/O Protocol
diff --git a/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.h b/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.h
index 4d545fb1f9..91d10e1555 100644
--- a/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.h
+++ b/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.h
@@ -18,6 +18,7 @@
#include <Protocol/DriverBinding.h>
#include <Protocol/PciIo.h>
#include <Protocol/IdeControllerInit.h>
+#include <Protocol/DevicePath.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
diff --git a/MdeModulePkg/Bus/Pci/SataControllerDxe/SataControllerDxe.inf b/MdeModulePkg/Bus/Pci/SataControllerDxe/SataControllerDxe.inf
index 488920a68c..e446058e34 100644
--- a/MdeModulePkg/Bus/Pci/SataControllerDxe/SataControllerDxe.inf
+++ b/MdeModulePkg/Bus/Pci/SataControllerDxe/SataControllerDxe.inf
@@ -45,6 +45,7 @@
[Protocols]
gEfiPciIoProtocolGuid ## TO_START
gEfiIdeControllerInitProtocolGuid ## BY_START
+ gEfiDevicePathProtocolGuid
[UserExtensions.TianoCore."ExtraFiles"]
SataControllerDxeExtra.uni