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

Commit 30cd4a4e authored by Paul Mackerras's avatar Paul Mackerras
Browse files

powerpc: Initialize btext subsystem later, after prom_init



We were initializing the btext stuff from prom_init(), thus breaking
the rule that all communication between prom_init() and the rest of
the kernel has to be via the flattened device tree.  This removes
the btext initialization calls from prom_init() and initializes it
instead after the device tree is unflattened.  It would be nice to
do it earlier, but that needs some more infrastructure to find the
properties we need in the flattened device tree.

Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 7dffb720
Loading
Loading
Loading
Loading
+0 −28
Original line number Original line Diff line number Diff line
@@ -153,9 +153,6 @@ __after_mmu_off:
	bl	flush_tlbs
	bl	flush_tlbs


	bl	initial_bats
	bl	initial_bats
#if !defined(CONFIG_APUS) && defined(CONFIG_BOOTX_TEXT)
	bl	setup_disp_bat
#endif


/*
/*
 * Call setup_cpu for CPU 0 and initialize 6xx Idle
 * Call setup_cpu for CPU 0 and initialize 6xx Idle
@@ -1297,31 +1294,6 @@ initial_bats:
	isync
	isync
	blr
	blr


#if !defined(CONFIG_APUS) && defined(CONFIG_BOOTX_TEXT)
setup_disp_bat:
	/*
	 * setup the display bat prepared for us in prom.c
	 */
	mflr	r8
	bl	reloc_offset
	mtlr	r8
	addis	r8,r3,disp_BAT@ha
	addi	r8,r8,disp_BAT@l
	lwz	r11,0(r8)
	lwz	r8,4(r8)
	mfspr	r9,SPRN_PVR
	rlwinm	r9,r9,16,16,31		/* r9 = 1 for 601, 4 for 604 */
	cmpwi	0,r9,1
	beq	1f
	mtspr	SPRN_DBAT3L,r8
	mtspr	SPRN_DBAT3U,r11
	blr
1:	mtspr	SPRN_IBAT3L,r8
	mtspr	SPRN_IBAT3U,r11
	blr

#endif /* !defined(CONFIG_APUS) && defined(CONFIG_BOOTX_TEXT) */



#ifdef CONFIG_8260
#ifdef CONFIG_8260
/* Jump into the system reset for the rom.
/* Jump into the system reset for the rom.
+0 −59
Original line number Original line Diff line number Diff line
@@ -1404,62 +1404,6 @@ static int __init prom_find_machine_type(void)
#endif
#endif
}
}


static int __init setup_disp(phandle dp)
{
#if defined(CONFIG_BOOTX_TEXT) && defined(CONFIG_PPC32)
	int width = 640, height = 480, depth = 8, pitch;
	unsigned address;
	u32 addrs[8][5];
	int i, naddrs;
	char name[32];
	char *getprop = "getprop";

	prom_printf("Initializing screen: ");

	memset(name, 0, sizeof(name));
	call_prom(getprop, 4, 1, dp, "name", name, sizeof(name));
	name[sizeof(name)-1] = 0;
	prom_print(name);
	prom_print("\n");
	call_prom(getprop, 4, 1, dp, "width", &width, sizeof(width));
	call_prom(getprop, 4, 1, dp, "height", &height, sizeof(height));
	call_prom(getprop, 4, 1, dp, "depth", &depth, sizeof(depth));
	pitch = width * ((depth + 7) / 8);
	call_prom(getprop, 4, 1, dp, "linebytes",
		  &pitch, sizeof(pitch));
	if (pitch == 1)
		pitch = 0x1000;		/* for strange IBM display */
	address = 0;
	call_prom(getprop, 4, 1, dp, "address", &address, sizeof(address));
	if (address == 0) {
		/* look for an assigned address with a size of >= 1MB */
		naddrs = call_prom(getprop, 4, 1, dp, "assigned-addresses",
				   addrs, sizeof(addrs));
		naddrs /= 20;
		for (i = 0; i < naddrs; ++i) {
			if (addrs[i][4] >= (1 << 20)) {
				address = addrs[i][2];
				/* use the BE aperture if possible */
				if (addrs[i][4] >= (16 << 20))
					address += (8 << 20);
				break;
			}
		}
		if (address == 0) {
			prom_print("Failed to get address\n");
			return 0;
		}
	}
	/* kludge for valkyrie */
	if (strcmp(name, "valkyrie") == 0)
		address += 0x1000;

	prom_printf("\n\n\n\naddress = %x\n", address);
	btext_setup_display(width, height, depth, pitch, address);
#endif /* CONFIG_BOOTX_TEXT && CONFIG_PPC32 */
	return 1;
}

static int __init prom_set_color(ihandle ih, int i, int r, int g, int b)
static int __init prom_set_color(ihandle ih, int i, int r, int g, int b)
{
{
	return call_prom("call-method", 6, 1, ADDR("color!"), ih, i, b, g, r);
	return call_prom("call-method", 6, 1, ADDR("color!"), ih, i, b, g, r);
@@ -1479,7 +1423,6 @@ static void __init prom_check_displays(void)
	phandle node;
	phandle node;
	ihandle ih;
	ihandle ih;
	int i;
	int i;
	int got_display = 0;


	static unsigned char default_colors[] = {
	static unsigned char default_colors[] = {
		0x00, 0x00, 0x00,
		0x00, 0x00, 0x00,
@@ -1546,8 +1489,6 @@ static void __init prom_check_displays(void)
					   clut[2]) != 0)
					   clut[2]) != 0)
				break;
				break;
#endif /* CONFIG_LOGO_LINUX_CLUT224 */
#endif /* CONFIG_LOGO_LINUX_CLUT224 */
		if (!got_display)
			got_display = setup_disp(node);
	}
	}
}
}


+4 −12
Original line number Original line Diff line number Diff line
@@ -294,8 +294,6 @@ unsigned long __init early_init(unsigned long dt_ptr)
{
{
	unsigned long offset = reloc_offset();
	unsigned long offset = reloc_offset();


	reloc_got2(offset);

	/*
	/*
	 * Identify the CPU type and fix up code sections
	 * Identify the CPU type and fix up code sections
	 * that depend on which cpu we have.
	 * that depend on which cpu we have.
@@ -303,12 +301,6 @@ unsigned long __init early_init(unsigned long dt_ptr)
	identify_cpu(offset, 0);
	identify_cpu(offset, 0);
	do_cpu_ftr_fixups(offset);
	do_cpu_ftr_fixups(offset);


#ifdef CONFIG_BOOTX_TEXT
	btext_prepare_BAT();
#endif

	reloc_got2(-offset);

	return KERNELBASE + offset;
	return KERNELBASE + offset;
}
}


@@ -578,13 +570,13 @@ void __init setup_arch(char **cmdline_p)
	/* so udelay does something sensible, assume <= 1000 bogomips */
	/* so udelay does something sensible, assume <= 1000 bogomips */
	loops_per_jiffy = 500000000 / HZ;
	loops_per_jiffy = 500000000 / HZ;


#ifdef CONFIG_BOOTX_TEXT
	map_boot_text();
#endif

	unflatten_device_tree();
	unflatten_device_tree();
	finish_device_tree();
	finish_device_tree();


#ifdef CONFIG_BOOTX_TEXT
	init_boot_display();
#endif

#ifdef CONFIG_PPC_MULTIPLATFORM
#ifdef CONFIG_PPC_MULTIPLATFORM
	/* This could be called "early setup arch", it must be done
	/* This could be called "early setup arch", it must be done
	 * now because xmon need it
	 * now because xmon need it
+0 −7
Original line number Original line Diff line number Diff line
@@ -188,13 +188,6 @@ void __init MMU_init(void)


	if (ppc_md.progress)
	if (ppc_md.progress)
		ppc_md.progress("MMU:exit", 0x211);
		ppc_md.progress("MMU:exit", 0x211);

#ifdef CONFIG_BOOTX_TEXT
	/* By default, we are no longer mapped */
       	boot_text_mapped = 0;
	/* Must be done last, or ppc_md.progress will die. */
	map_boot_text();
#endif
}
}


/* This is only called until mem_init is done. */
/* This is only called until mem_init is done. */