LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 10-03-2011, 08:11 PM   #1
confuey
LQ Newbie
 
Registered: Oct 2011
Posts: 3

Rep: Reputation: Disabled
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!
 
Old 10-04-2011, 10:36 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,153

Rep: Reputation: 1265Reputation: 1265Reputation: 1265Reputation: 1265Reputation: 1265Reputation: 1265Reputation: 1265Reputation: 1265Reputation: 1265
Why aren't you checking the return values for errors?
ioremap returns NULL when it fails.
 
Old 10-04-2011, 11:10 AM   #3
confuey
LQ Newbie
 
Registered: Oct 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
@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.
 
Old 10-04-2011, 02:36 PM   #4
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,153

Rep: Reputation: 1265Reputation: 1265Reputation: 1265Reputation: 1265Reputation: 1265Reputation: 1265Reputation: 1265Reputation: 1265Reputation: 1265
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?
 
Old 10-04-2011, 03:45 PM   #5
confuey
LQ Newbie
 
Registered: Oct 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
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!
 
Old 05-22-2012, 02:40 PM   #6
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,856

Rep: Reputation: 161Reputation: 161
You can try efi_ioremap function. EFI memory range is different from BIOS memory range.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
UEFI and BIOS: What is it really? cruiser General 10 09-27-2011 11:18 AM
Questions of UEFI cruiser Linux - Software 0 09-08-2011 06:52 AM
Has anyone got UEFI working? BeaverusIV Arch 2 07-31-2011 06:47 AM
UEFI implementation? Bobzilla2639716495 Programming 2 04-02-2008 10:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 11:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration