Remove zero address check in IoMmuMap.
The reason is that a CSM legacy driver may use legacy memory for DMA.
As such, the legacyBios need allow below 1M to the legacy device.
This patch also fixed some typo.
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
EFI_PHYSICAL_ADDRESS DmaMemoryTop;\r
BOOLEAN NeedRemap;\r
\r
EFI_PHYSICAL_ADDRESS DmaMemoryTop;\r
BOOLEAN NeedRemap;\r
\r
- DEBUG ((DEBUG_VERBOSE, "IoMmuMap: ==> 0x%08x - 0x%08x (%x)\n", HostAddress, NumberOfBytes, Operation));\r
-\r
- if (HostAddress == NULL || NumberOfBytes == NULL || DeviceAddress == NULL ||\r
+ if (NumberOfBytes == NULL || DeviceAddress == NULL ||\r
Mapping == NULL) {\r
DEBUG ((DEBUG_ERROR, "IoMmuMap: %r\n", EFI_INVALID_PARAMETER));\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
Mapping == NULL) {\r
DEBUG ((DEBUG_ERROR, "IoMmuMap: %r\n", EFI_INVALID_PARAMETER));\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
+ DEBUG ((DEBUG_VERBOSE, "IoMmuMap: ==> 0x%08x - 0x%08x (%x)\n", HostAddress, *NumberOfBytes, Operation));\r
+\r
//\r
// Make sure that Operation is valid\r
//\r
//\r
// Make sure that Operation is valid\r
//\r
if (NeedRemap) {\r
//\r
// Common Buffer operations can not be remapped. If the common buffer\r
if (NeedRemap) {\r
//\r
// Common Buffer operations can not be remapped. If the common buffer\r
- // if above 4GB, then it is not possible to generate a mapping, so return\r
+ // is above 4GB, then it is not possible to generate a mapping, so return\r
// an error.\r
//\r
DEBUG ((DEBUG_ERROR, "IoMmuMap: %r\n", EFI_UNSUPPORTED));\r
// an error.\r
//\r
DEBUG ((DEBUG_ERROR, "IoMmuMap: %r\n", EFI_UNSUPPORTED));\r
\r
SecondLevelPagingEntry = NULL;\r
\r
\r
SecondLevelPagingEntry = NULL;\r
\r
- DEBUG ((DEBUG_INFO,"SetAccessAttribute (S%04x B%02x D%02x F%02x) (0x%016lx - 0x%08x, %x)\n", Segment, SourceId.Bits.Bus, SourceId.Bits.Device, SourceId.Bits.Function, BaseAddress, (UINTN)Length, IoMmuAccess));\r
+ DEBUG ((DEBUG_VERBOSE,"SetAccessAttribute (S%04x B%02x D%02x F%02x) (0x%016lx - 0x%08x, %x)\n", Segment, SourceId.Bits.Bus, SourceId.Bits.Device, SourceId.Bits.Function, BaseAddress, (UINTN)Length, IoMmuAccess));\r
\r
VtdIndex = FindVtdIndexByPciDevice (Segment, SourceId, &ExtContextEntry, &ContextEntry);\r
if (VtdIndex == (UINTN)-1) {\r
\r
VtdIndex = FindVtdIndexByPciDevice (Segment, SourceId, &ExtContextEntry, &ContextEntry);\r
if (VtdIndex == (UINTN)-1) {\r