mirror of https://github.com/acidanthera/audk.git
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>
This commit is contained in:
parent
3281ebb4ae
commit
eed3f71305
|
@ -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
|
||||
|
|
|
@ -100,6 +100,7 @@ typedef struct {
|
|||
// The attached device list
|
||||
//
|
||||
LIST_ENTRY DeviceList;
|
||||
UINT64 EnabledPciAttributes;
|
||||
UINT64 OriginalPciAttributes;
|
||||
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue