Saved controller specific data into the driver's information structure.
Removed global variable indicating the driver's status and added
check for the driver's status based on the available protocol.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Daniil Egranov <daniil.egranov@arm.com>
---
EmbeddedPkg/Drivers/SataSiI3132Dxe/SataSiI3132.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/EmbeddedPkg/Drivers/SataSiI3132Dxe/SataSiI3132.c b/EmbeddedPkg/Drivers/SataSiI3132Dxe/SataSiI3132.c
index c1760fdc1b..50253b9160 100644
--- a/EmbeddedPkg/Drivers/SataSiI3132Dxe/SataSiI3132.c
+++ b/EmbeddedPkg/Drivers/SataSiI3132Dxe/SataSiI3132.c
@@ -309,8 +309,6 @@ ON_EXIT:
return Status;
}
-BOOLEAN mbStarted = FALSE;
-
/**
Starting the Pci SATA Driver.
@@ -342,9 +340,18 @@ SataSiI3132DriverBindingStart (
SATA_TRACE ("SataSiI3132DriverBindingStart()");
- //TODO: Find a nicer way to do it !
- if (mbStarted) {
- return EFI_SUCCESS; // Don't restart me !
+ Status = gBS->OpenProtocol (
+ Controller,
+ &gEfiAtaPassThruProtocolGuid,
+ NULL,
+ This->DriverBindingHandle,
+ Controller,
+ EFI_OPEN_PROTOCOL_TEST_PROTOCOL
+ );
+
+ if (!EFI_ERROR (Status)) {
+ SATA_TRACE ("SataSiI3132DriverBindingStart: driver already started");
+ return Status;
}
//
@@ -426,6 +433,8 @@ SataSiI3132DriverBindingStart (
return Status;
}
+ SataSiI3132Instance->OriginalPciAttributes = OriginalPciAttributes;
+
// Initialize SiI3132 Sata Controller
Status = SataSiI3132Initialization (SataSiI3132Instance);
if (EFI_ERROR (Status)) {
@@ -458,8 +467,6 @@ SataSiI3132DriverBindingStart (
goto UNINSTALL_USBHC;
}*/
- mbStarted = TRUE;
-
SATA_TRACE ("SataSiI3132DriverBindingStart() Success!");
return EFI_SUCCESS;
--
2.11.0
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
On 27 October 2017 at 06:33, Daniil Egranov <daniil.egranov@arm.com> wrote:
> Saved controller specific data into the driver's information structure.
> Removed global variable indicating the driver's status and added
> check for the driver's status based on the available protocol.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Daniil Egranov <daniil.egranov@arm.com>
> ---
> EmbeddedPkg/Drivers/SataSiI3132Dxe/SataSiI3132.c | 21 ++++++++++++++-------
> 1 file changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/EmbeddedPkg/Drivers/SataSiI3132Dxe/SataSiI3132.c b/EmbeddedPkg/Drivers/SataSiI3132Dxe/SataSiI3132.c
> index c1760fdc1b..50253b9160 100644
> --- a/EmbeddedPkg/Drivers/SataSiI3132Dxe/SataSiI3132.c
> +++ b/EmbeddedPkg/Drivers/SataSiI3132Dxe/SataSiI3132.c
> @@ -309,8 +309,6 @@ ON_EXIT:
> return Status;
> }
>
> -BOOLEAN mbStarted = FALSE;
> -
> /**
> Starting the Pci SATA Driver.
>
> @@ -342,9 +340,18 @@ SataSiI3132DriverBindingStart (
>
> SATA_TRACE ("SataSiI3132DriverBindingStart()");
>
> - //TODO: Find a nicer way to do it !
> - if (mbStarted) {
> - return EFI_SUCCESS; // Don't restart me !
> + Status = gBS->OpenProtocol (
> + Controller,
> + &gEfiAtaPassThruProtocolGuid,
> + NULL,
> + This->DriverBindingHandle,
> + Controller,
> + EFI_OPEN_PROTOCOL_TEST_PROTOCOL
> + );
> +
> + if (!EFI_ERROR (Status)) {
> + SATA_TRACE ("SataSiI3132DriverBindingStart: driver already started");
> + return Status;
Can you explain what this does? Does it check whether the protocol we
will install is already installed? Is this how other PCI drivers deal
with this?
> }
>
> //
> @@ -426,6 +433,8 @@ SataSiI3132DriverBindingStart (
> return Status;
> }
>
> + SataSiI3132Instance->OriginalPciAttributes = OriginalPciAttributes;
> +
Does this belong in the same patch?
> // Initialize SiI3132 Sata Controller
> Status = SataSiI3132Initialization (SataSiI3132Instance);
> if (EFI_ERROR (Status)) {
> @@ -458,8 +467,6 @@ SataSiI3132DriverBindingStart (
> goto UNINSTALL_USBHC;
> }*/
>
> - mbStarted = TRUE;
> -
> SATA_TRACE ("SataSiI3132DriverBindingStart() Success!");
> return EFI_SUCCESS;
>
> --
> 2.11.0
>
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
© 2016 - 2025 Red Hat, Inc.