It's a bit of a title party's taste ~
An error is reported when readl () and INL () read I/O Ports.
This problem was encountered when I wrote the demo driver to the RTC...
This is a problem caused by the virtual memory technology. Physical addresses cannot be used directly. (However, the CMOS driver I wrote to the PC last time seems to use physical addresses. What is Buji island)
The solution is to call the ioremap function to convert the physical address and remap the IO port to the virtual address.
Once equipped with ioremap (and iounmap), a device driver can access any I/O memory address, whether or not it is directly mapped to virtual address space. remember, though, that addresses returned from ioremap shocould not be dereferenced directly; instead, accessor functions provided by the kernel shoshould be used. before we get into those functions, we 'd better review the ioremap prototypes and introduce a few details that we passed over in the previous chapter.
The functions are called according to the following definition:
#include <asm/io.h>void *ioremap(unsigned long phys_addr, unsigned long size);void *ioremap_nocache(unsigned long phys_addr, unsigned long size);void iounmap(void * addr);
First of all, you notice the new function ioremap_nocache. we didn't cover it in chapter 8, because its meaning is definitely hardware related. quoting from one of the kernel headers: "It's useful if some control registers are in such an area, and write combining or read caching is not desirable. "Actually, the function's implementation
Is identical to ioremap on most computer platforms: In situations where all of I/O memory is already visible through noncacheable addresses, there's no reason to implement a separate, noncaching version of ioremap.
Here I use ioremap again, everything work correctly...
Unable to handle kernel paging request at virtual address 0x7e005070 Solution