OUT UINT64 *Result\r
)\r
{\r
+ NON_DISCOVERABLE_PCI_DEVICE *Dev;\r
+ EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Desc;\r
+ UINTN Count;\r
+ EFI_STATUS Status;\r
+\r
+ if ((UINT32)Width > EfiPciIoWidthUint64) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ if (Result == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ Dev = NON_DISCOVERABLE_PCI_DEVICE_FROM_PCI_IO(This);\r
+ Count = 1;\r
+\r
+ Status = GetBarResource (Dev, BarIndex, &Desc);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ if (Offset + (Count << (Width & 0x3)) > Desc->AddrLen) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+\r
ASSERT (FALSE);\r
return EFI_UNSUPPORTED;\r
}\r
OUT UINT64 *Result\r
)\r
{\r
+ NON_DISCOVERABLE_PCI_DEVICE *Dev;\r
+ EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Desc;\r
+ UINTN Count;\r
+ EFI_STATUS Status;\r
+\r
+ if ((UINT32)Width > EfiPciIoWidthUint64) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ if (Result == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ Dev = NON_DISCOVERABLE_PCI_DEVICE_FROM_PCI_IO(This);\r
+ Count = 1;\r
+\r
+ Status = GetBarResource (Dev, BarIndex, &Desc);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ if (Offset + (Count << (Width & 0x3)) > Desc->AddrLen) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+\r
ASSERT (FALSE);\r
return EFI_UNSUPPORTED;\r
}\r
IN OUT VOID *Buffer\r
)\r
{\r
+ NON_DISCOVERABLE_PCI_DEVICE *Dev;\r
+ EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Desc;\r
+ EFI_STATUS Status;\r
+\r
+ if ((UINT32)Width >= EfiPciIoWidthMaximum) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ if (Buffer == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ Dev = NON_DISCOVERABLE_PCI_DEVICE_FROM_PCI_IO(This);\r
+\r
+ Status = GetBarResource (Dev, BarIndex, &Desc);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ if (Offset + (Count << (Width & 0x3)) > Desc->AddrLen) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+\r
ASSERT (FALSE);\r
return EFI_UNSUPPORTED;\r
}\r
IN OUT VOID *Buffer\r
)\r
{\r
+ NON_DISCOVERABLE_PCI_DEVICE *Dev;\r
+ EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Desc;\r
+ EFI_STATUS Status;\r
+\r
+ if ((UINT32)Width >= EfiPciIoWidthMaximum) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ if (Buffer == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ Dev = NON_DISCOVERABLE_PCI_DEVICE_FROM_PCI_IO(This);\r
+\r
+ Status = GetBarResource (Dev, BarIndex, &Desc);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ if (Offset + (Count << (Width & 0x3)) > Desc->AddrLen) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+\r
ASSERT (FALSE);\r
return EFI_UNSUPPORTED;\r
}\r
IN UINTN Count\r
)\r
{\r
+ NON_DISCOVERABLE_PCI_DEVICE *Dev;\r
+ EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *DestDesc;\r
+ EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *SrcDesc;\r
+ EFI_STATUS Status;\r
+\r
+ if ((UINT32)Width > EfiPciIoWidthUint64) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ Dev = NON_DISCOVERABLE_PCI_DEVICE_FROM_PCI_IO(This);\r
+\r
+ Status = GetBarResource (Dev, DestBarIndex, &DestDesc);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ if (DestOffset + (Count << (Width & 0x3)) > DestDesc->AddrLen) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+\r
+ Status = GetBarResource (Dev, SrcBarIndex, &SrcDesc);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ if (SrcOffset + (Count << (Width & 0x3)) > SrcDesc->AddrLen) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+\r
ASSERT (FALSE);\r
return EFI_UNSUPPORTED;\r
}\r
NON_DISCOVERABLE_PCI_DEVICE *Dev;\r
BOOLEAN Enable;\r
\r
- #define DEV_SUPPORTED_ATTRIBUTES \\r
- (EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE)\r
-\r
Dev = NON_DISCOVERABLE_PCI_DEVICE_FROM_PCI_IO(This);\r
\r
if ((Attributes & (~(DEV_SUPPORTED_ATTRIBUTES))) != 0) {\r
IN OUT UINT64 *Length\r
)\r
{\r
+ NON_DISCOVERABLE_PCI_DEVICE *Dev;\r
+ EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Desc;\r
+ EFI_PCI_IO_PROTOCOL_WIDTH Width;\r
+ UINTN Count;\r
+ EFI_STATUS Status;\r
+\r
+ if ((Attributes & (~DEV_SUPPORTED_ATTRIBUTES)) != 0) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+\r
+ if (Offset == NULL || Length == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ Dev = NON_DISCOVERABLE_PCI_DEVICE_FROM_PCI_IO(This);\r
+ Width = EfiPciIoWidthUint8;\r
+ Count = (UINT32) *Length;\r
+\r
+ Status = GetBarResource(Dev, BarIndex, &Desc);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ if (*Offset + (Count << (Width & 0x3)) > Desc->AddrLen) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+\r
ASSERT (FALSE);\r
return EFI_UNSUPPORTED;\r
}\r