patch-2.1.96 linux/arch/arm/mm/mm-rpc.c
Next file: linux/arch/arm/mm/proc-arm6,7.S
Previous file: linux/arch/arm/mm/mm-nexuspci.c
Back to the patch index
Back to the overall index
- Lines: 85
- Date:
Sun Apr 12 11:42:15 1998
- Orig file:
v2.1.95/linux/arch/arm/mm/mm-rpc.c
- Orig date:
Tue Jan 20 16:39:42 1998
diff -u --recursive --new-file v2.1.95/linux/arch/arm/mm/mm-rpc.c linux/arch/arm/mm/mm-rpc.c
@@ -6,7 +6,14 @@
* Copyright (C) 1998 Russell King
*/
+#include <linux/sched.h>
+#include <linux/slab.h>
+
+#include <asm/pgtable.h>
#include <asm/setup.h>
+#include <asm/io.h>
+#include <asm/proc/mm-init.h>
+#include <asm/arch/mm-init.h>
#define NR_DRAM_BANKS 4
#define NR_VRAM_BANKS 1
@@ -21,8 +28,8 @@
#define FIRST_DRAM_ADDR 0x10000000
#define PHYS_TO_BANK(x) (((x) >> BANK_SHIFT) & (NR_DRAM_BANKS - 1))
-#define BANK_TO_PHYS(x) ((FIRST_DRAM_ADDR) +
- (((x) - FIRST_DRAM_BANK) << BANK_SHIFT)
+#define BANK_TO_PHYS(x) ((FIRST_DRAM_ADDR) + \
+ (((x) - FIRST_DRAM_BANK) << BANK_SHIFT))
struct ram_bank {
unsigned int virt_addr; /* virtual address of the *end* of this bank + 1 */
@@ -75,6 +82,56 @@
rambank[bank].virt_addr = PAGE_OFFSET + bytes;
}
- drambank[4].phys_offset = 0xd6000000;
- drambank[4].virt_addr = 0xd8000000;
+ rambank[FIRST_VRAM_BANK].phys_offset = 0xd6000000;
+ rambank[FIRST_VRAM_BANK].virt_addr = 0xd8000000;
+
+ current->tss.memmap = __virt_to_phys((unsigned long)swapper_pg_dir);
+}
+
+static struct mapping {
+ unsigned long virtual;
+ unsigned long physical;
+ unsigned long length;
+} io_mapping[] = {
+ { SCREEN2_BASE, SCREEN_START, 2*1048576 }, /* VRAM */
+ { IO_BASE, IO_START, IO_SIZE } /* IO space */
+};
+
+#define SIZEOFIO (sizeof(io_mapping) / sizeof(io_mapping[0]))
+
+/* map in IO */
+unsigned long setup_io_pagetables(unsigned long start_mem)
+{
+ struct mapping *mp;
+ int i;
+
+ for (i = 0, mp = io_mapping; i < SIZEOFIO; i++, mp++) {
+ while ((mp->virtual & 1048575 || mp->physical & 1048575) && mp->length >= PAGE_SIZE) {
+ alloc_init_page(&start_mem, mp->virtual, mp->physical, DOMAIN_IO,
+ PTE_AP_WRITE);
+
+ mp->length -= PAGE_SIZE;
+ mp->virtual += PAGE_SIZE;
+ mp->physical += PAGE_SIZE;
+ }
+
+ while (mp->length >= 1048576) {
+ alloc_init_section(&start_mem, mp->virtual, mp->physical, DOMAIN_IO,
+ PMD_SECT_AP_WRITE);
+ mp->length -= 1048576;
+ mp->virtual += 1048576;
+ mp->physical += 1048576;
+ }
+
+ while (mp->length >= PAGE_SIZE) {
+ alloc_init_page(&start_mem, mp->virtual, mp->physical, DOMAIN_IO,
+ PTE_AP_WRITE);
+
+ mp->length -= PAGE_SIZE;
+ mp->virtual += PAGE_SIZE;
+ mp->physical += PAGE_SIZE;
+ }
+ }
+
+ return start_mem;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov