LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (http://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   BIOS vs. uEFI? (http://www.linuxquestions.org/questions/linux-kernel-70/bios-vs-uefi-906278/)

confuey 10-03-2011 08:11 PM

BIOS vs. uEFI?
 
We have two systems here, both running RHEL 6.0. They are identical except that one of them is using uEFI and the other is using BIOS.

A device driver we have written for a PCIe peripheral works fine on the BIOS system, but not the uEFI system. The driver is loaded after the OS has started up. Here is a small excerpt of where I think things are possibly going wrong.

bus_pci_mem_base_addr = pci_resource_start(pdev, 0);
pci_mem_size = pci_resource_len(pdev, 0);
k_addr = ioremap(bus_pci_mem_base_addr, pci_mem_size);
test_value = ioread32(k_addr);

The value of test_value is correct when looking at the BIOS system, but is incorrect on the uEFI system.

Any ideas on why this is happening? I am new to Linux and writing device drivers, so any info would be appreciated. Thanks!

smallpond 10-04-2011 10:36 AM

Why aren't you checking the return values for errors?
ioremap returns NULL when it fails.

confuey 10-04-2011 11:10 AM

@smallpond
We are checking return values for errors and they are not returning NULL. Those statements were omitted from my original post to reduce clutter.

smallpond 10-04-2011 02:36 PM

It looks like all of those functions are completely different on EFI and non-EFI systems. I'm looking at the kern_mem_attribute call and it has stuff like this:
Code:

841        /*
842          * This is a hack for ioremap calls before we set up kern_memmap.
843          * Maybe we should do efi_memmap_init() earlier instead.
844          */

so not sure what to make of that.

You are reading the first 32-bit word of PCI memory space and getting different results. What does lspci -v show on each system? Has PCI config happened correctly? Is there only one memory space? What architecture are you on? 32 or 64-bit?

confuey 10-04-2011 03:45 PM

Both systems are x86, 64-bit. The PCI device uses only a single memory region. As far as I can tell from lspci, the uEFI system sees the PCI device and its memory just fine. The behavior between the two systems seem identical up until the ioremap function call.

Looks like I will need to poke around a little more to see if I can find out more about EFI vs. non-EFI specific functions in the kernel. I am still not terribly familiar with Linux in general, so any additional info or insight on this matter would be appreciated.

Thanks!

nini09 05-22-2012 02:40 PM

You can try efi_ioremap function. EFI memory range is different from BIOS memory range.


All times are GMT -5. The time now is 12:29 PM.