accel/qaic: Add AIC200 support
[drm/drm-misc.git] / arch / mips / loongson2ef / common / mem.c
blobfceb3ee47eb0e20836f50387d61bc7d2ece1a2f8
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 */
4 #include <linux/fs.h>
5 #include <linux/fcntl.h>
6 #include <linux/memblock.h>
7 #include <linux/mm.h>
9 #include <asm/bootinfo.h>
11 #include <loongson.h>
12 #include <mem.h>
13 #include <pci.h>
16 u32 memsize, highmemsize;
18 void __init prom_init_memory(void)
20 memblock_add(0x0, (memsize << 20));
22 #ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG
24 int bit;
26 bit = fls(memsize + highmemsize);
27 if (bit != ffs(memsize + highmemsize))
28 bit += 20;
29 else
30 bit = bit + 20 - 1;
32 /* set cpu window3 to map CPU to DDR: 2G -> 2G */
33 LOONGSON_ADDRWIN_CPUTODDR(ADDRWIN_WIN3, 0x80000000ul,
34 0x80000000ul, (1 << bit));
35 mmiowb();
37 #endif /* !CONFIG_CPU_SUPPORTS_ADDRWINCFG */
39 #ifdef CONFIG_64BIT
40 if (highmemsize > 0)
41 memblock_add(LOONGSON_HIGHMEM_START, highmemsize << 20);
42 #endif /* !CONFIG_64BIT */