Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e817513b authored by Dave Kleikamp's avatar Dave Kleikamp Committed by Josh Boyer
Browse files

powerpc/44x: boot wrapper: allow kernel to load into non-zero address



For AMP, different kernel instances load into separate memory regions.
Read the start of memory from the device tree and limit the memory to what's
specified in the device tree.

Signed-off-by: default avatarDave Kleikamp <shaggy@linux.vnet.ibm.com>
Signed-off-by: default avatarTony Breeds <tony@bakeyournoodle.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: default avatarJosh Boyer <jwboyer@linux.vnet.ibm.com>
parent 91b191c7
Loading
Loading
Loading
Loading
+22 −1
Original line number Diff line number Diff line
@@ -34,11 +34,31 @@

BSS_STACK(4096);

static u32 ibm4xx_memstart;

static void iss_4xx_fixups(void)
{
	void *memory;
	u32 reg[3];

	memory = finddevice("/memory");
	if (!memory)
		fatal("Can't find memory node\n");
	/* This assumes #address-cells = 2, #size-cells =1 and that */
	getprop(memory, "reg", reg, sizeof(reg));
	if (reg[2])
		/* If the device tree specifies the memory range, use it */
		ibm4xx_memstart = reg[1];
	else
		/* othersize, read it from the SDRAM controller */
		ibm4xx_sdram_fixup_memsize();
}

static void *iss_4xx_vmlinux_alloc(unsigned long size)
{
	return (void *)ibm4xx_memstart;
}

#define SPRN_PIR	0x11E	/* Processor Indentification Register */
void platform_init(void)
{
@@ -48,6 +68,7 @@ void platform_init(void)

	simple_alloc_init(_end, avail_ram, 128, 64);
	platform_ops.fixups = iss_4xx_fixups;
	platform_ops.vmlinux_alloc = iss_4xx_vmlinux_alloc;
	platform_ops.exit = ibm44x_dbcr_reset;
	pir_reg = mfspr(SPRN_PIR);
	fdt_set_boot_cpuid_phys(_dtb_start, pir_reg);