Re: IOREMAP

From: Richard B. Johnson (root@chaos.analogic.com)
Date: Fri Sep 22 2000 - 11:48:06 EST


On Fri, 22 Sep 2000, Timur Tabi wrote:

> ** Reply to message from MOHAMMED AZAD <mohammedazad@nestec.net> on Fri, 22 Sep
> 2000 21:26:56 +0530
>
>
> > How does ioremap work???... does it allocate memory after a remap
> > operation.. can someone throw some light on this... any help appreciated...
>
> Well, as they say around here ... "the source code is the documentation".
>
> Basically, ioremap allocates some virtual memory, and then maps that memory to
> the physical address you request. It's intended for PCI memory, but you can
> use it on normal memory is mark the pages reserved in the mem_map_t structures.
>

Well no. It specifically disallows using space already used by RAM.

/*
 * arch/i386/mm/ioremap.c
 *
 * Re-map IO memory to kernel address space so that we can access it.
 * This is needed for high PCI addresses that aren't mapped in the
 * 640k-1MB IO memory area on PC's
 *
 * (C) Copyright 1995 1996 Linus Torvalds
 */

        /*
         * Don't remap the low PCI/ISA area, it's always mapped..
         */
        if (phys_addr >= 0xA0000 && last_addr < 0x100000)
                return phys_to_virt(phys_addr);

        /*
         * Don't allow anybody to remap normal RAM that we're using..
         */
        if (phys_addr < virt_to_phys(high_memory))
                return NULL;

        /*
         * Mappings have to be page-aligned
         */

Cheers,
Dick Johnson

Penguin : Linux version 2.2.15 on an i686 machine (797.90 BogoMips).

"Memory is like gasoline. You use it up when you are running. Of
course you get it all back when you reboot..."; Actual explanation
obtained from the Micro$oft help desk.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 21:00:27 EST