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>
This commit is contained in:
committed by
Ralf Baechle
parent
e1137e1d59
commit
ea050714bc
@@ -10,21 +10,6 @@
|
|||||||
|
|
||||||
#include <asm/bootinfo.h> /* For cleaner code... */
|
#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_argc;
|
||||||
extern int *_fw_argv;
|
extern int *_fw_argv;
|
||||||
extern int *_fw_envp;
|
extern int *_fw_envp;
|
||||||
@@ -38,7 +23,6 @@ extern int *_fw_envp;
|
|||||||
|
|
||||||
extern void fw_init_cmdline(void);
|
extern void fw_init_cmdline(void);
|
||||||
extern char *fw_getcmdline(void);
|
extern char *fw_getcmdline(void);
|
||||||
extern fw_memblock_t *fw_getmdesc(int);
|
|
||||||
extern void fw_meminit(void);
|
extern void fw_meminit(void);
|
||||||
extern char *fw_getenv(char *name);
|
extern char *fw_getenv(char *name);
|
||||||
extern unsigned long fw_getenvl(char *name);
|
extern unsigned long fw_getenvl(char *name);
|
||||||
|
@@ -21,19 +21,25 @@
|
|||||||
#include <asm/sections.h>
|
#include <asm/sections.h>
|
||||||
#include <asm/fw/fw.h>
|
#include <asm/fw/fw.h>
|
||||||
|
|
||||||
static fw_memblock_t mdesc[FW_MAX_MEMBLOCKS];
|
|
||||||
|
|
||||||
/* determined physical memory size, not overridden by command line args */
|
/* determined physical memory size, not overridden by command line args */
|
||||||
unsigned long physical_memsize = 0L;
|
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;
|
char *memsize_str, *ememsize_str = NULL, *ptr;
|
||||||
unsigned long memsize = 0, ememsize = 0;
|
unsigned long memsize = 0, ememsize = 0;
|
||||||
|
unsigned long kernel_start_phys, kernel_end_phys;
|
||||||
static char cmdline[COMMAND_LINE_SIZE] __initdata;
|
static char cmdline[COMMAND_LINE_SIZE] __initdata;
|
||||||
|
bool eva = config_enabled(CONFIG_EVA);
|
||||||
int tmp;
|
int tmp;
|
||||||
|
|
||||||
/* otherwise look in the environment */
|
free_init_pages_eva = eva ? free_init_pages_eva_malta : NULL;
|
||||||
|
|
||||||
memsize_str = fw_getenv("memsize");
|
memsize_str = fw_getenv("memsize");
|
||||||
if (memsize_str) {
|
if (memsize_str) {
|
||||||
@@ -92,15 +98,14 @@ fw_memblock_t * __init fw_getmdesc(int eva)
|
|||||||
if (memsize > 0x7fff0000)
|
if (memsize > 0x7fff0000)
|
||||||
memsize = 0x7fff0000;
|
memsize = 0x7fff0000;
|
||||||
|
|
||||||
memset(mdesc, 0, sizeof(mdesc));
|
add_memory_region(PHYS_OFFSET, 0x00001000, BOOT_MEM_RESERVED);
|
||||||
|
|
||||||
mdesc[0].type = fw_dontuse;
|
/*
|
||||||
mdesc[0].base = PHYS_OFFSET;
|
* YAMON may still be using the region of memory from 0x1000 to 0xfffff
|
||||||
mdesc[0].size = 0x00001000;
|
* if it has started secondary CPUs.
|
||||||
|
*/
|
||||||
mdesc[1].type = fw_code;
|
add_memory_region(PHYS_OFFSET + 0x00001000, 0x000ef000,
|
||||||
mdesc[1].base = mdesc[0].base + 0x00001000UL;
|
BOOT_MEM_ROM_DATA);
|
||||||
mdesc[1].size = 0x000ef000;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The area 0x000f0000-0x000fffff is allocated for BIOS memory by the
|
* 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
|
* This mean that this area can't be used as DMA memory for PCI
|
||||||
* devices.
|
* devices.
|
||||||
*/
|
*/
|
||||||
mdesc[2].type = fw_dontuse;
|
add_memory_region(PHYS_OFFSET + 0x000f0000, 0x00010000,
|
||||||
mdesc[2].base = mdesc[0].base + 0x000f0000UL;
|
BOOT_MEM_RESERVED);
|
||||||
mdesc[2].size = 0x00010000;
|
|
||||||
|
|
||||||
mdesc[3].type = fw_dontuse;
|
/*
|
||||||
mdesc[3].base = mdesc[0].base + 0x00100000UL;
|
* Reserve the memory used by kernel code, and allow the rest of RAM to
|
||||||
mdesc[3].size = CPHYSADDR(PFN_ALIGN((unsigned long)&_end)) -
|
* be used.
|
||||||
0x00100000UL;
|
*/
|
||||||
|
kernel_start_phys = PHYS_OFFSET + 0x00100000;
|
||||||
mdesc[4].type = fw_free;
|
kernel_end_phys = PHYS_OFFSET + CPHYSADDR(PFN_ALIGN(&_end));
|
||||||
mdesc[4].base = mdesc[0].base + CPHYSADDR(PFN_ALIGN(&_end));
|
add_memory_region(kernel_start_phys, kernel_end_phys,
|
||||||
mdesc[4].size = memsize - CPHYSADDR(mdesc[4].base);
|
BOOT_MEM_RESERVED);
|
||||||
|
add_memory_region(kernel_end_phys, memsize - kernel_end_phys,
|
||||||
return &mdesc[0];
|
BOOT_MEM_RAM);
|
||||||
}
|
|
||||||
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
|
|
||||||
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++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void __init prom_free_prom_memory(void)
|
void __init prom_free_prom_memory(void)
|
||||||
|
Reference in New Issue
Block a user