0001
0002
0003
0004 #include <linux/fs.h>
0005 #include <linux/fcntl.h>
0006 #include <linux/memblock.h>
0007 #include <linux/mm.h>
0008
0009 #include <asm/bootinfo.h>
0010
0011 #include <loongson.h>
0012 #include <mem.h>
0013 #include <pci.h>
0014
0015
0016 u32 memsize, highmemsize;
0017
0018 void __init prom_init_memory(void)
0019 {
0020 memblock_add(0x0, (memsize << 20));
0021
0022 #ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG
0023 {
0024 int bit;
0025
0026 bit = fls(memsize + highmemsize);
0027 if (bit != ffs(memsize + highmemsize))
0028 bit += 20;
0029 else
0030 bit = bit + 20 - 1;
0031
0032
0033 LOONGSON_ADDRWIN_CPUTODDR(ADDRWIN_WIN3, 0x80000000ul,
0034 0x80000000ul, (1 << bit));
0035 mmiowb();
0036 }
0037 #endif
0038
0039 #ifdef CONFIG_64BIT
0040 if (highmemsize > 0)
0041 memblock_add(LOONGSON_HIGHMEM_START, highmemsize << 20);
0042 #endif
0043 }