UINT16 ControlBlockBaseAddr;\r
UINTN DataSize;\r
IDE_BUS_DRIVER_PRIVATE_DATA *IdeBusDriverPrivateData;\r
+ UINT64 Supports;\r
\r
//\r
// Local variables declaration for IdeControllerInit support\r
\r
Status = PciIo->Attributes (\r
PciIo,\r
- EfiPciIoAttributeOperationEnable,\r
- EFI_PCI_DEVICE_ENABLE,\r
- NULL\r
+ EfiPciIoAttributeOperationSupported,\r
+ 0,\r
+ &Supports\r
);\r
+ if (!EFI_ERROR (Status)) {\r
+ Supports &= EFI_PCI_DEVICE_ENABLE;\r
+ Status = PciIo->Attributes (\r
+ PciIo,\r
+ EfiPciIoAttributeOperationEnable,\r
+ Supports,\r
+ NULL\r
+ );\r
+ }\r
+\r
if (EFI_ERROR (Status)) {\r
goto ErrorExit;\r
}\r
BOOLEAN AllChildrenStopped;\r
UINTN Index;\r
IDE_BUS_DRIVER_PRIVATE_DATA *IdeBusDriverPrivateData;\r
+ UINT64 Supports;\r
\r
IdeBusDriverPrivateData = NULL;\r
\r
EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
);\r
if (!EFI_ERROR (Status)) {\r
- PciIo->Attributes (\r
- PciIo,\r
- EfiPciIoAttributeOperationDisable,\r
- EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO | EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO | EFI_PCI_DEVICE_ENABLE,\r
- NULL\r
- );\r
+ Status = PciIo->Attributes (\r
+ PciIo,\r
+ EfiPciIoAttributeOperationSupported,\r
+ 0,\r
+ &Supports\r
+ );\r
+ if (!EFI_ERROR (Status)) {\r
+ Supports &= EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO | EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO | EFI_PCI_DEVICE_ENABLE;\r
+ PciIo->Attributes (\r
+ PciIo,\r
+ EfiPciIoAttributeOperationDisable,\r
+ Supports,\r
+ NULL\r
+ );\r
+ }\r
}\r
\r
gBS->OpenProtocol (\r
}\r
//\r
// Just a trick for ENABLE attribute\r
+ // EFI_PCI_DEVICE_ENABLE is not defined in UEFI spec, which is the internal usage.\r
+ // So, this logic doesn't confrom to UEFI spec, which should be removed.\r
//\r
- if ((Attributes & EFI_PCI_DEVICE_ENABLE) == EFI_PCI_DEVICE_ENABLE) {\r
- Attributes &= (PciIoDevice->Supports);\r
-\r
- //\r
- // Raise the EFI_P_PC_ENABLE Status code\r
- //\r
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
- EFI_PROGRESS_CODE,\r
- EFI_IO_BUS_PCI | EFI_P_PC_ENABLE,\r
- PciIoDevice->DevicePath\r
- );\r
- }\r
+ // if ((Attributes & EFI_PCI_DEVICE_ENABLE) == EFI_PCI_DEVICE_ENABLE) {\r
+ // Attributes &= (PciIoDevice->Supports);\r
+ //\r
+ // //\r
+ // // Raise the EFI_P_PC_ENABLE Status code\r
+ // //\r
+ // REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
+ // EFI_PROGRESS_CODE,\r
+ // EFI_IO_BUS_PCI | EFI_P_PC_ENABLE,\r
+ // PciIoDevice->DevicePath\r
+ // );\r
+ // }\r
\r
//\r
// If no attributes can be supported, then return.\r
EFI_STATUS Status;\r
USB2_HC_DEV *Ehc;\r
EFI_PCI_IO_PROTOCOL *PciIo;\r
+ UINT64 Supports;\r
\r
//\r
// Open the PciIo Protocol, then enable the USB host controller\r
\r
Status = PciIo->Attributes (\r
PciIo,\r
- EfiPciIoAttributeOperationEnable,\r
- EFI_PCI_DEVICE_ENABLE,\r
- NULL\r
+ EfiPciIoAttributeOperationSupported,\r
+ 0,\r
+ &Supports\r
);\r
+ if (!EFI_ERROR (Status)) {\r
+ Supports &= EFI_PCI_DEVICE_ENABLE;\r
+ Status = PciIo->Attributes (\r
+ PciIo,\r
+ EfiPciIoAttributeOperationEnable,\r
+ Supports,\r
+ NULL\r
+ );\r
+ }\r
\r
if (EFI_ERROR (Status)) {\r
EHC_ERROR (("EhcDriverBindingStart: failed to enable controller\n"));\r
EFI_USB2_HC_PROTOCOL *Usb2Hc;\r
EFI_PCI_IO_PROTOCOL *PciIo;\r
USB2_HC_DEV *Ehc;\r
+ UINT64 Supports;\r
\r
//\r
// Test whether the Controller handler passed in is a valid\r
//\r
// Disable the USB Host Controller\r
//\r
- PciIo->Attributes (\r
- PciIo,\r
- EfiPciIoAttributeOperationDisable,\r
- EFI_PCI_DEVICE_ENABLE,\r
- NULL\r
- );\r
+ Status = PciIo->Attributes (\r
+ PciIo,\r
+ EfiPciIoAttributeOperationSupported,\r
+ 0,\r
+ &Supports\r
+ );\r
+ if (!EFI_ERROR (Status)) {\r
+ Supports &= EFI_PCI_DEVICE_ENABLE;\r
+ Status = PciIo->Attributes (\r
+ PciIo,\r
+ EfiPciIoAttributeOperationDisable,\r
+ Supports,\r
+ NULL\r
+ );\r
+ }\r
\r
gBS->CloseProtocol (\r
Controller,\r
);\r
\r
gBS->FreePool (Ehc);\r
- return Status;\r
+ return EFI_SUCCESS;\r
}\r
\r
EFI_DRIVER_BINDING_PROTOCOL\r
)\r
{\r
USB_HC_DEV *Uhc;\r
+ UINT64 Supports;\r
\r
//\r
// Uninstall the USB_HC and USB_HC2 protocol, then disable the controller\r
\r
UhciFreeAllAsyncReq (Uhc);\r
UhciDestoryFrameList (Uhc);\r
-\r
+ \r
+ Uhc->PciIo->Attributes (\r
+ Uhc->PciIo,\r
+ EfiPciIoAttributeOperationSupported,\r
+ 0,\r
+ &Supports\r
+ );\r
+ Supports &= EFI_PCI_DEVICE_ENABLE;\r
Uhc->PciIo->Attributes (\r
Uhc->PciIo,\r
EfiPciIoAttributeOperationDisable,\r
- EFI_PCI_DEVICE_ENABLE,\r
+ Supports,\r
NULL\r
);\r
\r
EFI_STATUS Status;\r
EFI_PCI_IO_PROTOCOL *PciIo;\r
USB_HC_DEV *Uhc;\r
+ UINT64 Supports;\r
\r
//\r
// Open PCIIO, then enable the EHC device and turn off emulation\r
\r
Status = PciIo->Attributes (\r
PciIo,\r
- EfiPciIoAttributeOperationEnable,\r
- EFI_PCI_DEVICE_ENABLE,\r
- NULL\r
+ EfiPciIoAttributeOperationSupported,\r
+ 0,\r
+ &Supports\r
);\r
+ if (!EFI_ERROR (Status)) {\r
+ Supports &= EFI_PCI_DEVICE_ENABLE;\r
+ Status = PciIo->Attributes (\r
+ PciIo,\r
+ EfiPciIoAttributeOperationEnable,\r
+ Supports,\r
+ NULL\r
+ );\r
+ }\r
\r
if (EFI_ERROR (Status)) {\r
goto CLOSE_PCIIO;\r
UINT8 *TmpPxePointer;\r
EFI_PCI_IO_PROTOCOL *PciIoFncs;\r
UINTN Len; \r
+ UINT64 Supports;\r
\r
Status = gBS->OpenProtocol (\r
Controller,\r
\r
Status = PciIoFncs->Attributes (\r
PciIoFncs,\r
- EfiPciIoAttributeOperationEnable,\r
- EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_MEMORY | EFI_PCI_IO_ATTRIBUTE_IO | EFI_PCI_IO_ATTRIBUTE_BUS_MASTER,\r
- NULL\r
+ EfiPciIoAttributeOperationSupported,\r
+ 0,\r
+ &Supports\r
);\r
+ if (!EFI_ERROR (Status)) {\r
+ Supports &= EFI_PCI_DEVICE_ENABLE;\r
+ Status = PciIoFncs->Attributes (\r
+ PciIoFncs,\r
+ EfiPciIoAttributeOperationEnable,\r
+ Supports,\r
+ NULL\r
+ );\r
+ }\r
//\r
// Read all the registers from device's PCI Configuration space\r
//\r
Status = gBS->HandleProtocol (\r
mBdsImageHandle,\r
&gEfiLoadedImageProtocolGuid,\r
- &LoadedImage\r
+ (VOID **) &LoadedImage\r
);\r
if (!EFI_ERROR (Status)) {\r
Status = gBS->HandleProtocol (\r