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,
|
||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
|
0, // EnabledPciAttributes
|
||||||
0, // OriginalAttributes
|
0, // OriginalAttributes
|
||||||
0, // PreviousPort
|
0, // PreviousPort
|
||||||
0, // PreviousPortMultiplier
|
0, // PreviousPortMultiplier
|
||||||
@ -670,7 +671,7 @@ AtaAtapiPassThruStart (
|
|||||||
EFI_IDE_CONTROLLER_INIT_PROTOCOL *IdeControllerInit;
|
EFI_IDE_CONTROLLER_INIT_PROTOCOL *IdeControllerInit;
|
||||||
ATA_ATAPI_PASS_THRU_INSTANCE *Instance;
|
ATA_ATAPI_PASS_THRU_INSTANCE *Instance;
|
||||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||||
UINT64 Supports;
|
UINT64 EnabledPciAttributes;
|
||||||
UINT64 OriginalPciAttributes;
|
UINT64 OriginalPciAttributes;
|
||||||
|
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
@ -722,14 +723,14 @@ AtaAtapiPassThruStart (
|
|||||||
PciIo,
|
PciIo,
|
||||||
EfiPciIoAttributeOperationSupported,
|
EfiPciIoAttributeOperationSupported,
|
||||||
0,
|
0,
|
||||||
&Supports
|
&EnabledPciAttributes
|
||||||
);
|
);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Supports &= (UINT64)EFI_PCI_DEVICE_ENABLE;
|
EnabledPciAttributes &= (UINT64)EFI_PCI_DEVICE_ENABLE;
|
||||||
Status = PciIo->Attributes (
|
Status = PciIo->Attributes (
|
||||||
PciIo,
|
PciIo,
|
||||||
EfiPciIoAttributeOperationEnable,
|
EfiPciIoAttributeOperationEnable,
|
||||||
Supports,
|
EnabledPciAttributes,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -749,6 +750,7 @@ AtaAtapiPassThruStart (
|
|||||||
Instance->ControllerHandle = Controller;
|
Instance->ControllerHandle = Controller;
|
||||||
Instance->IdeControllerInit = IdeControllerInit;
|
Instance->IdeControllerInit = IdeControllerInit;
|
||||||
Instance->PciIo = PciIo;
|
Instance->PciIo = PciIo;
|
||||||
|
Instance->EnabledPciAttributes = EnabledPciAttributes;
|
||||||
Instance->OriginalPciAttributes = OriginalPciAttributes;
|
Instance->OriginalPciAttributes = OriginalPciAttributes;
|
||||||
Instance->AtaPassThru.Mode = &Instance->AtaPassThruMode;
|
Instance->AtaPassThru.Mode = &Instance->AtaPassThruMode;
|
||||||
Instance->ExtScsiPassThru.Mode = &Instance->ExtScsiPassThruMode;
|
Instance->ExtScsiPassThru.Mode = &Instance->ExtScsiPassThruMode;
|
||||||
@ -859,7 +861,6 @@ AtaAtapiPassThruStop (
|
|||||||
EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru;
|
EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru;
|
||||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||||
EFI_AHCI_REGISTERS *AhciRegisters;
|
EFI_AHCI_REGISTERS *AhciRegisters;
|
||||||
UINT64 Supports;
|
|
||||||
|
|
||||||
DEBUG ((EFI_D_INFO, "==AtaAtapiPassThru Stop== Controller = %x\n", Controller));
|
DEBUG ((EFI_D_INFO, "==AtaAtapiPassThru Stop== Controller = %x\n", Controller));
|
||||||
|
|
||||||
@ -952,21 +953,12 @@ AtaAtapiPassThruStop (
|
|||||||
//
|
//
|
||||||
// Disable this ATA host controller.
|
// Disable this ATA host controller.
|
||||||
//
|
//
|
||||||
Status = PciIo->Attributes (
|
PciIo->Attributes (
|
||||||
PciIo,
|
PciIo,
|
||||||
EfiPciIoAttributeOperationSupported,
|
EfiPciIoAttributeOperationDisable,
|
||||||
0,
|
Instance->EnabledPciAttributes,
|
||||||
&Supports
|
NULL
|
||||||
);
|
);
|
||||||
if (!EFI_ERROR (Status)) {
|
|
||||||
Supports &= (UINT64)EFI_PCI_DEVICE_ENABLE;
|
|
||||||
PciIo->Attributes (
|
|
||||||
PciIo,
|
|
||||||
EfiPciIoAttributeOperationDisable,
|
|
||||||
Supports,
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Restore original PCI attributes
|
// Restore original PCI attributes
|
||||||
|
@ -100,6 +100,7 @@ typedef struct {
|
|||||||
// The attached device list
|
// The attached device list
|
||||||
//
|
//
|
||||||
LIST_ENTRY DeviceList;
|
LIST_ENTRY DeviceList;
|
||||||
|
UINT64 EnabledPciAttributes;
|
||||||
UINT64 OriginalPciAttributes;
|
UINT64 OriginalPciAttributes;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
Loading…
x
Reference in New Issue
Block a user