'PciIO->Map' is returning "EFI_OUT_OF_RESOURCES" on Intel CRB device


Laszlo Ersek
 

On 02/01/21 11:14, udai16787 via [] wrote:
Small Update:
I could fix the issue by moving the PCI->Map little early in the initialization but couldn't root cause it yet.
Could be that the portion of the address space that PciIo->Map() can
deal with gets fragmented in the part of code that you have now
eliminated, by moving the call earlier.

Laszlo


UdayS
 

Small Update:
I could fix the issue by moving the PCI->Map little early in the initialization but couldn't root cause it yet.


Laszlo Ersek
 

On 01/15/21 06:33, udai16787 via [] wrote:
Hi Laszlo,
Thanks for replying.

(1) For BusMasterRead, you should not use AllocateBuffer. AllocateBuffer
is only needed for CommonBuffer operations.
Right. I have updated it now.

(2) PciIo->Map can run out of resources dependent on the IOMMU I guess,
as one reason. It can also run out of resources if you leak mappings
somewhere.
Prior to calling to above mentioned call, I do map two 16 bytes chunks for reading and current chunk where I get error is 128bytes long.

All systems need not react to such issues the same way.
What do you recommend how do I approach to this issue.
Ask your firmware vendor, or build your stuff upon open source software
that you can analyze yourself.

Thanks
Laszlo


UdayS
 

Hi Laszlo,
Thanks for replying.

(1) For BusMasterRead, you should not use AllocateBuffer. AllocateBuffer
is only needed for CommonBuffer operations.
Right. I have updated it now.

(2) PciIo->Map can run out of resources dependent on the IOMMU I guess,
as one reason. It can also run out of resources if you leak mappings
somewhere.
Prior to calling to above mentioned call, I do map two 16 bytes chunks for reading and current chunk where I get error is 128bytes long.

All systems need not react to such issues the same way.
What do you recommend how do I approach to this issue.

-US


Laszlo Ersek
 

On 01/14/21 16:45, UdayS via groups.io wrote:
Hello Experts,
Need your help to understand why is PciIO->Map is returning "EFI_OUT_OF_RESOURCES" in my Intel CRB DQ57TM (v2.31) but same driver works in other SuperMicro system ( v2.31 and v2.4).
I understand it is specific to the IO mem allocated to the device, but I don't know how to find the memory map of the system and find the difference and the root cause of it.

Below is the code where I get error:
Status = PciIo->Map ( PciIo, // This
EfiPciIoOperationBusMasterRead, // Operation
(VOID *)RxBuffer, // HostAddress
(UINTN *)&RxSize, // NumberOfBytes
&DeviceAddress, // DeviceAddress
&RxBufferDMAMapping // Mapping
);
if (EFI_ERROR (Status)) {
AsciiPrint("\n PciIO->Map (RxBuffer[%d]): Status[%d]", RxSize, Status);
return CSIO_NOMEM;
}

And "RxBuffer", I have allocated using AllocateBuffer.
(1) For BusMasterRead, you should not use AllocateBuffer. AllocateBuffer
is only needed for CommonBuffer operations. For BusMasterRead and
BusMasterWrite, Map will handle bounce buffers internally.

(2) PciIo->Map can run out of resources dependent on the IOMMU I guess,
as one reason. It can also run out of resources if you leak mappings
somewhere. All systems need not react to such issues the same way.

Laszlo


UdayS
 

Hello Experts,
Need your help to understand why is PciIO->Map is returning "EFI_OUT_OF_RESOURCES" in my Intel CRB DQ57TM (v2.31) but same driver works in other SuperMicro system ( v2.31 and v2.4).
I understand it is specific to the IO mem allocated to the device, but I don't know how to find the memory map of the system and find the difference and the root cause of it.

Below is the code where I get error:
Status = PciIo->Map ( PciIo, // This
EfiPciIoOperationBusMasterRead, // Operation
(VOID *)RxBuffer, // HostAddress
(UINTN *)&RxSize, // NumberOfBytes
&DeviceAddress, // DeviceAddress
&RxBufferDMAMapping // Mapping
);
if (EFI_ERROR (Status)) {
AsciiPrint("\n PciIO->Map (RxBuffer[%d]): Status[%d]", RxSize, Status);
return CSIO_NOMEM;
}

And "RxBuffer", I have allocated using AllocateBuffer.

Regards,
US