return EFI_INVALID_PARAMETER;\r
}\r
\r
+ //\r
+ // If request is not aligned, then convert request to EfiPciIoWithXXXUint8\r
+ // \r
+ if (FeaturePcdGet (PcdUnalignedPciIoEnable)) {\r
+ if ((Offset & ((1 << (Width & 0x03)) - 1)) != 0) {\r
+ Status = PciIoMemRead (This, Width, BarIndex, Offset, 1, Result);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ if ((*Result & Mask) == Value || Delay == 0) {\r
+ return EFI_SUCCESS;\r
+ }\r
+ do {\r
+ //\r
+ // Stall 10 us = 100 * 100ns\r
+ //\r
+ gBS->Stall (10);\r
+\r
+ Status = PciIoMemRead (This, Width, BarIndex, Offset, 1, Result);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ if ((*Result & Mask) == Value) {\r
+ return EFI_SUCCESS;\r
+ }\r
+ if (Delay <= 100) {\r
+ return EFI_TIMEOUT;\r
+ }\r
+ Delay -= 100;\r
+ } while (TRUE);\r
+ }\r
+ }\r
+ \r
Status = PciIoDevice->PciRootBridgeIo->PollMem (\r
PciIoDevice->PciRootBridgeIo,\r
(EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,\r
return EFI_UNSUPPORTED;\r
}\r
\r
+ //\r
+ // If request is not aligned, then convert request to EfiPciIoWithXXXUint8\r
+ // \r
+ if (FeaturePcdGet (PcdUnalignedPciIoEnable)) {\r
+ if ((Offset & ((1 << (Width & 0x03)) - 1)) != 0) {\r
+ Status = PciIoIoRead (This, Width, BarIndex, Offset, 1, Result);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ if ((*Result & Mask) == Value || Delay == 0) {\r
+ return EFI_SUCCESS;\r
+ }\r
+ do {\r
+ //\r
+ // Stall 10 us = 100 * 100ns\r
+ //\r
+ gBS->Stall (10);\r
+\r
+ Status = PciIoIoRead (This, Width, BarIndex, Offset, 1, Result);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ if ((*Result & Mask) == Value) {\r
+ return EFI_SUCCESS;\r
+ }\r
+ if (Delay <= 100) {\r
+ return EFI_TIMEOUT;\r
+ }\r
+ Delay -= 100;\r
+ } while (TRUE);\r
+ }\r
+ }\r
+ \r
Status = PciIoDevice->PciRootBridgeIo->PollIo (\r
PciIoDevice->PciRootBridgeIo,\r
(EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,\r
return EFI_UNSUPPORTED;\r
}\r
\r
+ //\r
+ // If request is not aligned, then convert request to EfiPciIoWithXXXUint8\r
+ // \r
+ if (FeaturePcdGet (PcdUnalignedPciIoEnable)) {\r
+ if ((Offset & ((1 << (Width & 0x03)) - 1)) != 0) {\r
+ Width &= (~0x03);\r
+ Count *= (UINTN)(1 << (Width & 0x03));\r
+ }\r
+ } \r
+ \r
+\r
Status = PciIoDevice->PciRootBridgeIo->Mem.Read (\r
PciIoDevice->PciRootBridgeIo,\r
(EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,\r
return EFI_UNSUPPORTED;\r
}\r
\r
+ //\r
+ // If request is not aligned, then convert request to EfiPciIoWithXXXUint8\r
+ // \r
+ if (FeaturePcdGet (PcdUnalignedPciIoEnable)) {\r
+ if ((Offset & ((1 << (Width & 0x03)) - 1)) != 0) {\r
+ Width &= (~0x03);\r
+ Count *= (UINTN)(1 << (Width & 0x03));\r
+ }\r
+ }\r
+\r
Status = PciIoDevice->PciRootBridgeIo->Mem.Write (\r
PciIoDevice->PciRootBridgeIo,\r
(EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,\r
return EFI_UNSUPPORTED;\r
}\r
\r
+ //\r
+ // If request is not aligned, then convert request to EfiPciIoWithXXXUint8\r
+ // \r
+ if (FeaturePcdGet (PcdUnalignedPciIoEnable)) {\r
+ if ((Offset & ((1 << (Width & 0x03)) - 1)) != 0) {\r
+ Width &= (~0x03);\r
+ Count *= (UINTN)(1 << (Width & 0x03));\r
+ }\r
+ } \r
+\r
Status = PciIoDevice->PciRootBridgeIo->Io.Read (\r
PciIoDevice->PciRootBridgeIo,\r
(EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,\r
return EFI_UNSUPPORTED;\r
}\r
\r
+ //\r
+ // If request is not aligned, then convert request to EfiPciIoWithXXXUint8\r
+ // \r
+ if (FeaturePcdGet (PcdUnalignedPciIoEnable)) {\r
+ if ((Offset & ((1 << (Width & 0x03)) - 1)) != 0) {\r
+ Width &= (~0x03);\r
+ Count *= (UINTN)(1 << (Width & 0x03));\r
+ }\r
+ } \r
+\r
Status = PciIoDevice->PciRootBridgeIo->Io.Write (\r
PciIoDevice->PciRootBridgeIo,\r
(EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
+ \r
+ //\r
+ // If request is not aligned, then convert request to EfiPciIoWithXXXUint8\r
+ // \r
+ if (FeaturePcdGet (PcdUnalignedPciIoEnable)) {\r
+ if ((Offset & ((1 << (Width & 0x03)) - 1)) != 0) {\r
+ Width &= (~0x03);\r
+ Count *= (UINTN)(1 << (Width & 0x03));\r
+ }\r
+ } \r
\r
Status = PciIoDevice->PciRootBridgeIo->Pci.Read (\r
PciIoDevice->PciRootBridgeIo,\r
return Status;\r
}\r
\r
+ //\r
+ // If request is not aligned, then convert request to EfiPciIoWithXXXUint8\r
+ // \r
+ if (FeaturePcdGet (PcdUnalignedPciIoEnable)) {\r
+ if ((Offset & ((1 << (Width & 0x03)) - 1)) != 0) {\r
+ Width &= (~0x03);\r
+ Count *= (UINTN)(1 << (Width & 0x03));\r
+ }\r
+ } \r
+ \r
Status = PciIoDevice->PciRootBridgeIo->Pci.Write (\r
PciIoDevice->PciRootBridgeIo,\r
(EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,\r
return EFI_UNSUPPORTED;\r
}\r
\r
+ //\r
+ // If request is not aligned, then convert request to EfiPciIoWithXXXUint8\r
+ // \r
+ if (FeaturePcdGet (PcdUnalignedPciIoEnable)) {\r
+ if ((SrcOffset & ((1 << (Width & 0x03)) - 1)) != 0 || (DestOffset & ((1 << (Width & 0x03)) - 1)) != 0) {\r
+ Width &= (~0x03);\r
+ Count *= (UINTN)(1 << (Width & 0x03));\r
+ }\r
+ } \r
+\r
Status = PciIoDevice->PciRootBridgeIo->CopyMem (\r
PciIoDevice->PciRootBridgeIo,\r
(EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,\r