summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Burton <paul.burton@imgtec.com>2015-09-22 20:56:37 +0200
committerRalf Baechle <ralf@linux-mips.org>2015-11-11 08:35:45 +0100
commitea050714bc3656a25b4b5fc73f3682532c7180eb (patch)
treeafe5ae19d9bc769fb2b8a3bc5a375a1e001170e8
parentMIPS: Malta: Split obj-y entries across lines (diff)
downloadlinux-ea050714bc3656a25b4b5fc73f3682532c7180eb.tar.xz
linux-ea050714bc3656a25b4b5fc73f3682532c7180eb.zip
MIPS: Malta: Remove fw_memblock_t abstraction
The fw_getmdesc function & fw_memblock_t abstraction is only used by Malta, and so far as I can tell serves no purpose beyond making the code less clear than it could be. Remove the useless level of abstraction. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Cc: James Hogan <james.hogan@imgtec.com> Cc: Markos Chandras <markos.chandras@imgtec.com> Patchwork: https://patchwork.linux-mips.org/patch/11221/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--arch/mips/include/asm/fw/fw.h16
-rw-r--r--arch/mips/mti-malta/malta-memory.c93
2 files changed, 29 insertions, 80 deletions
diff --git a/arch/mips/include/asm/fw/fw.h b/arch/mips/include/asm/fw/fw.h
index f3e6978aad70..d0ef8b4892bb 100644
--- a/arch/mips/include/asm/fw/fw.h
+++ b/arch/mips/include/asm/fw/fw.h
@@ -10,21 +10,6 @@
#include <asm/bootinfo.h> /* For cleaner code... */
-enum fw_memtypes {
- fw_dontuse,
- fw_code,
- fw_free,
-};
-
-typedef struct {
- unsigned long base; /* Within KSEG0 */
- unsigned int size; /* bytes */
- enum fw_memtypes type; /* fw_memtypes */
-} fw_memblock_t;
-
-/* Maximum number of memory block descriptors. */
-#define FW_MAX_MEMBLOCKS 32
-
extern int fw_argc;
extern int *_fw_argv;
extern int *_fw_envp;
@@ -38,7 +23,6 @@ extern int *_fw_envp;
extern void fw_init_cmdline(void);
extern char *fw_getcmdline(void);
-extern fw_memblock_t *fw_getmdesc(int);
extern void fw_meminit(void);
extern char *fw_getenv(char *name);
extern unsigned long fw_getenvl(char *name);
diff --git a/arch/mips/mti-malta/malta-memory.c b/arch/mips/mti-malta/malta-memory.c
index dadeb8379182..93ace96a1aa8 100644
--- a/arch/mips/mti-malta/malta-memory.c
+++ b/arch/mips/mti-malta/malta-memory.c
@@ -21,19 +21,25 @@
#include <asm/sections.h>
#include <asm/fw/fw.h>
-static fw_memblock_t mdesc[FW_MAX_MEMBLOCKS];
-
/* determined physical memory size, not overridden by command line args */
unsigned long physical_memsize = 0L;
-fw_memblock_t * __init fw_getmdesc(int eva)
+static void free_init_pages_eva_malta(void *begin, void *end)
+{
+ free_init_pages("unused kernel", __pa_symbol((unsigned long *)begin),
+ __pa_symbol((unsigned long *)end));
+}
+
+void __init fw_meminit(void)
{
char *memsize_str, *ememsize_str = NULL, *ptr;
unsigned long memsize = 0, ememsize = 0;
+ unsigned long kernel_start_phys, kernel_end_phys;
static char cmdline[COMMAND_LINE_SIZE] __initdata;
+ bool eva = config_enabled(CONFIG_EVA);
int tmp;
- /* otherwise look in the environment */
+ free_init_pages_eva = eva ? free_init_pages_eva_malta : NULL;
memsize_str = fw_getenv("memsize");
if (memsize_str) {
@@ -92,15 +98,14 @@ fw_memblock_t * __init fw_getmdesc(int eva)
if (memsize > 0x7fff0000)
memsize = 0x7fff0000;
- memset(mdesc, 0, sizeof(mdesc));
-
- mdesc[0].type = fw_dontuse;
- mdesc[0].base = PHYS_OFFSET;
- mdesc[0].size = 0x00001000;
+ add_memory_region(PHYS_OFFSET, 0x00001000, BOOT_MEM_RESERVED);
- mdesc[1].type = fw_code;
- mdesc[1].base = mdesc[0].base + 0x00001000UL;
- mdesc[1].size = 0x000ef000;
+ /*
+ * YAMON may still be using the region of memory from 0x1000 to 0xfffff
+ * if it has started secondary CPUs.
+ */
+ add_memory_region(PHYS_OFFSET + 0x00001000, 0x000ef000,
+ BOOT_MEM_ROM_DATA);
/*
* The area 0x000f0000-0x000fffff is allocated for BIOS memory by the
@@ -109,59 +114,19 @@ fw_memblock_t * __init fw_getmdesc(int eva)
* This mean that this area can't be used as DMA memory for PCI
* devices.
*/
- mdesc[2].type = fw_dontuse;
- mdesc[2].base = mdesc[0].base + 0x000f0000UL;
- mdesc[2].size = 0x00010000;
-
- mdesc[3].type = fw_dontuse;
- mdesc[3].base = mdesc[0].base + 0x00100000UL;
- mdesc[3].size = CPHYSADDR(PFN_ALIGN((unsigned long)&_end)) -
- 0x00100000UL;
-
- mdesc[4].type = fw_free;
- mdesc[4].base = mdesc[0].base + CPHYSADDR(PFN_ALIGN(&_end));
- mdesc[4].size = memsize - CPHYSADDR(mdesc[4].base);
-
- return &mdesc[0];
-}
-
-static void free_init_pages_eva_malta(void *begin, void *end)
-{
- free_init_pages("unused kernel", __pa_symbol((unsigned long *)begin),
- __pa_symbol((unsigned long *)end));
-}
+ add_memory_region(PHYS_OFFSET + 0x000f0000, 0x00010000,
+ BOOT_MEM_RESERVED);
-static int __init fw_memtype_classify(unsigned int type)
-{
- switch (type) {
- case fw_free:
- return BOOT_MEM_RAM;
- case fw_code:
- return BOOT_MEM_ROM_DATA;
- default:
- return BOOT_MEM_RESERVED;
- }
-}
-
-void __init fw_meminit(void)
-{
- fw_memblock_t *p;
-
- p = fw_getmdesc(config_enabled(CONFIG_EVA));
- free_init_pages_eva = (config_enabled(CONFIG_EVA) ?
- free_init_pages_eva_malta : NULL);
-
- while (p->size) {
- long type;
- unsigned long base, size;
-
- type = fw_memtype_classify(p->type);
- base = p->base;
- size = p->size;
-
- add_memory_region(base, size, type);
- p++;
- }
+ /*
+ * Reserve the memory used by kernel code, and allow the rest of RAM to
+ * be used.
+ */
+ kernel_start_phys = PHYS_OFFSET + 0x00100000;
+ kernel_end_phys = PHYS_OFFSET + CPHYSADDR(PFN_ALIGN(&_end));
+ add_memory_region(kernel_start_phys, kernel_end_phys,
+ BOOT_MEM_RESERVED);
+ add_memory_region(kernel_end_phys, memsize - kernel_end_phys,
+ BOOT_MEM_RAM);
}
void __init prom_free_prom_memory(void)