usb: gadget: udc: pch_udc: Fix a plethora of function documentation related issues
[linux/fpc-iii.git] / arch / mips / loongson2ef / common / mem.c
blobae21f1c62baa58fea2f2f531b08488ff6aa387bc
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 add_memory_region(0x0, (memsize << 20), BOOT_MEM_RAM);
22 add_memory_region(memsize << 20, LOONGSON_PCI_MEM_START - (memsize <<
23 20), BOOT_MEM_RESERVED);
25 #ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG
27 int bit;
29 bit = fls(memsize + highmemsize);
30 if (bit != ffs(memsize + highmemsize))
31 bit += 20;
32 else
33 bit = bit + 20 - 1;
35 /* set cpu window3 to map CPU to DDR: 2G -> 2G */
36 LOONGSON_ADDRWIN_CPUTODDR(ADDRWIN_WIN3, 0x80000000ul,
37 0x80000000ul, (1 << bit));
38 mmiowb();
40 #endif /* !CONFIG_CPU_SUPPORTS_ADDRWINCFG */
42 #ifdef CONFIG_64BIT
43 if (highmemsize > 0)
44 add_memory_region(LOONGSON_HIGHMEM_START,
45 highmemsize << 20, BOOT_MEM_RAM);
47 add_memory_region(LOONGSON_PCI_MEM_END + 1, LOONGSON_HIGHMEM_START -
48 LOONGSON_PCI_MEM_END - 1, BOOT_MEM_RESERVED);
50 #endif /* !CONFIG_64BIT */
53 /* override of arch/mips/mm/cache.c: __uncached_access */
54 int __uncached_access(struct file *file, unsigned long addr)
56 if (file->f_flags & O_DSYNC)
57 return 1;
59 return addr >= __pa(high_memory) ||
60 ((addr >= LOONGSON_MMIO_MEM_START) &&
61 (addr < LOONGSON_MMIO_MEM_END));