public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Daniil Egranov <daniil.egranov@arm.com>
To: edk2-devel@lists.01.org
Cc: leif.lindholm@linaro.org, ard.biesheuvel@linaro.org,
	Daniil Egranov <daniil.egranov@arm.com>
Subject: [PATCH 3/4] Drivers/SataSiI3132Dxe: Enable multi-controller support
Date: Fri, 27 Oct 2017 00:33:25 -0500	[thread overview]
Message-ID: <20171027053326.48815-4-daniil.egranov@arm.com> (raw)
In-Reply-To: <20171027053326.48815-1-daniil.egranov@arm.com>

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



  parent reply	other threads:[~2017-10-27  5:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-27  5:33 [PATCH 0/4] SataSiI3132Dxe fixes Daniil Egranov
2017-10-27  5:33 ` [PATCH 1/4] Drivers/SataSiI3132Dxe: Fixed PCI IO read and write operations Daniil Egranov
2017-10-27  9:22   ` Ard Biesheuvel
2017-10-27  5:33 ` [PATCH 2/4] Drivers/SataSiI3132Dxe: Allow 64-bit DMA transfer Daniil Egranov
2017-10-27  9:23   ` Ard Biesheuvel
2017-10-27  5:33 ` Daniil Egranov [this message]
2017-10-27 12:42   ` [PATCH 3/4] Drivers/SataSiI3132Dxe: Enable multi-controller support Ard Biesheuvel
2017-10-27  5:33 ` [PATCH 4/4] Drivers/SataSiI3132Dxe: Fixed startup and shutdown procedures Daniil Egranov
2017-10-27 12:47   ` Ard Biesheuvel
2017-10-27 12:48 ` [PATCH 0/4] SataSiI3132Dxe fixes Ard Biesheuvel
2017-10-27 16:57 ` Jeremy Linton
2017-10-27 17:00   ` Ard Biesheuvel

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=20171027053326.48815-4-daniil.egranov@arm.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