diff options
author | Laszlo Ersek <lersek@redhat.com> | 2017-09-07 20:56:39 +0200 |
---|---|---|
committer | Laszlo Ersek <lersek@redhat.com> | 2017-09-08 20:22:32 +0200 |
commit | eed3f713052204e31f1c4703ef544897881c552e (patch) | |
tree | 485e8a583ff02eef3d26fa32d4c7c46d645132e7 | |
parent | 3281ebb4ae7de2a858c2e7ec4998b7e55be1a4dc (diff) | |
download | edk2-eed3f713052204e31f1c4703ef544897881c552e.tar.gz edk2-eed3f713052204e31f1c4703ef544897881c552e.tar.bz2 edk2-eed3f713052204e31f1c4703ef544897881c552e.zip |
MdeModulePkg/AtaAtapiPassThru: cache EnabledPciAttributes
Both AtaAtapiPassThruStart() and AtaAtapiPassThruStop() fetch the
supported attributes of the device, just so they can toggle the
IO+MMIO+BusMaster subset.
After we compute this bitmask in AtaAtapiPassThruStart(), we can cache it
for later, and save the fetch in AtaAtapiPassThruStop().
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
-rw-r--r-- | MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c | 32 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h | 1 |
2 files changed, 13 insertions, 20 deletions
diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c index 795443ef74..b7fdb8dd48 100644 --- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c +++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c @@ -94,6 +94,7 @@ ATA_ATAPI_PASS_THRU_INSTANCE gAtaAtapiPassThruInstanceTemplate = { NULL,
NULL
},
+ 0, // EnabledPciAttributes
0, // OriginalAttributes
0, // PreviousPort
0, // PreviousPortMultiplier
@@ -670,7 +671,7 @@ AtaAtapiPassThruStart ( EFI_IDE_CONTROLLER_INIT_PROTOCOL *IdeControllerInit;
ATA_ATAPI_PASS_THRU_INSTANCE *Instance;
EFI_PCI_IO_PROTOCOL *PciIo;
- UINT64 Supports;
+ UINT64 EnabledPciAttributes;
UINT64 OriginalPciAttributes;
Status = EFI_SUCCESS;
@@ -722,14 +723,14 @@ AtaAtapiPassThruStart ( PciIo,
EfiPciIoAttributeOperationSupported,
0,
- &Supports
+ &EnabledPciAttributes
);
if (!EFI_ERROR (Status)) {
- Supports &= (UINT64)EFI_PCI_DEVICE_ENABLE;
+ EnabledPciAttributes &= (UINT64)EFI_PCI_DEVICE_ENABLE;
Status = PciIo->Attributes (
PciIo,
EfiPciIoAttributeOperationEnable,
- Supports,
+ EnabledPciAttributes,
NULL
);
}
@@ -749,6 +750,7 @@ AtaAtapiPassThruStart ( Instance->ControllerHandle = Controller;
Instance->IdeControllerInit = IdeControllerInit;
Instance->PciIo = PciIo;
+ Instance->EnabledPciAttributes = EnabledPciAttributes;
Instance->OriginalPciAttributes = OriginalPciAttributes;
Instance->AtaPassThru.Mode = &Instance->AtaPassThruMode;
Instance->ExtScsiPassThru.Mode = &Instance->ExtScsiPassThruMode;
@@ -859,7 +861,6 @@ AtaAtapiPassThruStop ( EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru;
EFI_PCI_IO_PROTOCOL *PciIo;
EFI_AHCI_REGISTERS *AhciRegisters;
- UINT64 Supports;
DEBUG ((EFI_D_INFO, "==AtaAtapiPassThru Stop== Controller = %x\n", Controller));
@@ -952,21 +953,12 @@ AtaAtapiPassThruStop ( //
// Disable this ATA host controller.
//
- Status = PciIo->Attributes (
- PciIo,
- EfiPciIoAttributeOperationSupported,
- 0,
- &Supports
- );
- if (!EFI_ERROR (Status)) {
- Supports &= (UINT64)EFI_PCI_DEVICE_ENABLE;
- PciIo->Attributes (
- PciIo,
- EfiPciIoAttributeOperationDisable,
- Supports,
- NULL
- );
- }
+ PciIo->Attributes (
+ PciIo,
+ EfiPciIoAttributeOperationDisable,
+ Instance->EnabledPciAttributes,
+ NULL
+ );
//
// Restore original PCI attributes
diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h index 4f327dc30b..85e5a55539 100644 --- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h +++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h @@ -100,6 +100,7 @@ typedef struct { // The attached device list
//
LIST_ENTRY DeviceList;
+ UINT64 EnabledPciAttributes;
UINT64 OriginalPciAttributes;
//
|