iomem and ioports
prabhu
prabhum at msys-tech.com
Wed Feb 16 02:45:19 EST 2011
HI All,
I started to understand output of /proc/oiports and /proc/iomem. I
confused to relate these two's output.
Below is the kernel source for Mapping of io-port to io-mem. Could
anyone please explain below code.
/* We encode the physical PIO addresses (0-0xffff) into the
(0-
* pointer by offsetting them with a constant (0x10000) and
* assuming that all the low addresses are always PIO. That means
means
* we can do some sanity checks on the low bits, and don't
* need to just take things for granted.
*/
#define PIO_OFFSET 0x10000UL
#define PIO_MASK 0x0ffffUL
#define PIO_RESERVED 0x40000UL
void __iomem *ioport_map(unsigned long port, unsigned int nr) {
__iomem
if (port > PIO_MASK) return NULL;
return (void __iomem *) (unsigned long) (port + PIO_OFFSET);
__iomem
}
Thanks,
Prabhu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110216/27ef056e/attachment.html
More information about the Kernelnewbies
mailing list