On Aug 1, 2012, at 4:17 AM, Miri (Miriam) Shitrit wrote:

> Hi,
>  
> I have an EFI driver for a PCI device which works fine when BAR is 32-bit 
> (below 4G), but on a setup with 64-bit BAR (above 4G BIOS option enabled) the 
> Mem.Read and MEm.Write functions of EFI_PCI_IO_PROTOCOL fail with 
> INVALID_PARAMETER error.
>  

What width did you try? Are you sure you are using the correct BarIndex?

> I tried to replace these functions with CopyMem() from/to the BAR memory 
> address + offset, the read works fine but the write fails most of the times.
>  

It sounds like the cacheability attributes for the BAR memory range are not 
correct? 

> What should be replaced to support 64-bit BAR (above 4G)?

If you are passing correct arguments to PCI IO it is likely an issue with the 
PCI Root Bridge IO protocol, and that is chipset specific code. 

> Do I need to use the Map() and Unmap() functions?
>  

No these are only for DMA. For example on X64 the DMA into memory are cache 
coherent, but on ARM the DMA by hardware is not cache coherent so extra 
operations are required for the CPU to see the data that was DMA'ed. The point 
of the PCI IO protocol is to abstract coherency requirements from the driver. 

> I will appreciate any help or link to any reference.
>  

See PciIoMemRead() in 
https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c

If the platform has setup caching incorrectly it is likely that the MTRR 
registers are not programmed correctly. 

Also sounds like you should contact the vendor of the platform you are using 
and report a bug. 

Thanks,

Andrew

> Thanks,
> Miri
>  
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. 
> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________
> edk2-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to