EFI_EXT_SCSI_PASS_THRU_MODE PassThruMode;\r
UINT8 MaxTarget;\r
EFI_PCI_IO_PROTOCOL *PciIo;\r
+ UINT64 OriginalPciAttributes;\r
} MPT_SCSI_DEV;\r
\r
#define MPT_SCSI_FROM_PASS_THRU(PassThruPtr) \\r
goto FreePool;\r
}\r
\r
+ Status = Dev->PciIo->Attributes (\r
+ Dev->PciIo,\r
+ EfiPciIoAttributeOperationGet,\r
+ 0,\r
+ &Dev->OriginalPciAttributes\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ goto CloseProtocol;\r
+ }\r
+\r
+ //\r
+ // Enable I/O Space & Bus-Mastering\r
+ //\r
+ Status = Dev->PciIo->Attributes (\r
+ Dev->PciIo,\r
+ EfiPciIoAttributeOperationEnable,\r
+ (EFI_PCI_IO_ATTRIBUTE_IO |\r
+ EFI_PCI_IO_ATTRIBUTE_BUS_MASTER),\r
+ NULL\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ goto CloseProtocol;\r
+ }\r
+\r
+ //\r
+ // Signal device supports 64-bit DMA addresses\r
+ //\r
+ Status = Dev->PciIo->Attributes (\r
+ Dev->PciIo,\r
+ EfiPciIoAttributeOperationEnable,\r
+ EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE,\r
+ NULL\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ //\r
+ // Warn user that device will only be using 32-bit DMA addresses.\r
+ //\r
+ // Note that this does not prevent the device/driver from working\r
+ // and therefore we only warn and continue as usual.\r
+ //\r
+ DEBUG ((\r
+ DEBUG_WARN,\r
+ "%a: failed to enable 64-bit DMA addresses\n",\r
+ __FUNCTION__\r
+ ));\r
+ }\r
+\r
//\r
// Host adapter channel, doesn't exist\r
//\r
&Dev->PassThru\r
);\r
if (EFI_ERROR (Status)) {\r
- goto CloseProtocol;\r
+ goto RestoreAttributes;\r
}\r
\r
return EFI_SUCCESS;\r
\r
+RestoreAttributes:\r
+ Dev->PciIo->Attributes (\r
+ Dev->PciIo,\r
+ EfiPciIoAttributeOperationSet,\r
+ Dev->OriginalPciAttributes,\r
+ NULL\r
+ );\r
+\r
CloseProtocol:\r
gBS->CloseProtocol (\r
ControllerHandle,\r
return Status;\r
}\r
\r
+ Dev->PciIo->Attributes (\r
+ Dev->PciIo,\r
+ EfiPciIoAttributeOperationSet,\r
+ Dev->OriginalPciAttributes,\r
+ NULL\r
+ );\r
+\r
gBS->CloseProtocol (\r
ControllerHandle,\r
&gEfiPciIoProtocolGuid,\r