mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-26 22:24:09 +08:00
bff06d5522
Instead of all of this cpu-specific code to remap the kernel to the correct location, use portable firmware calls to do this instead. What we do now is the following in position independant assembler: chosen_node = prom_finddevice("/chosen"); prom_mmu_ihandle_cache = prom_getint(chosen_node, "mmu"); vaddr = 4MB_ALIGN(current_text_addr()); prom_translate(vaddr, &paddr_high, &paddr_low, &mode); prom_boot_mapping_mode = mode; prom_boot_mapping_phys_high = paddr_high; prom_boot_mapping_phys_low = paddr_low; prom_map(-1, 8 * 1024 * 1024, KERNBASE, paddr_low); and that replaces the massive amount of by-hand TLB probing and programming we used to do here. The new code should also handle properly the case where the kernel is mapped at the correct address already (think: future kexec support). Consequently, the bulk of remap_kernel() dies as does the entirety of arch/sparc64/prom/map.S We try to share some strings in the PROM library with the ones used at bootup, and while we're here mark input strings to oplib.h routines with "const" when appropriate. There are many more simplifications now possible. For one thing, we can consolidate the two copies we now have of a lot of cpu setup code sitting in head.S and trampoline.S. This is a significant step towards CONFIG_DEBUG_PAGEALLOC support. Signed-off-by: David S. Miller <davem@davemloft.net>
48 lines
1.0 KiB
C
48 lines
1.0 KiB
C
/*
|
|
* printf.c: Internal prom library printf facility.
|
|
*
|
|
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
|
|
* Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
|
|
* Copyright (c) 2002 Pete Zaitcev (zaitcev@yahoo.com)
|
|
*
|
|
* We used to warn all over the code: DO NOT USE prom_printf(),
|
|
* and yet people do. Anton's banking code was outputting banks
|
|
* with prom_printf for most of the 2.4 lifetime. Since an effective
|
|
* stick is not available, we deployed a carrot: an early printk
|
|
* through PROM by means of -p boot option. This ought to fix it.
|
|
* USE printk; if you need, deploy -p.
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <asm/openprom.h>
|
|
#include <asm/oplib.h>
|
|
|
|
static char ppbuf[1024];
|
|
|
|
void
|
|
prom_write(const char *buf, unsigned int n)
|
|
{
|
|
char ch;
|
|
|
|
while (n != 0) {
|
|
--n;
|
|
if ((ch = *buf++) == '\n')
|
|
prom_putchar('\r');
|
|
prom_putchar(ch);
|
|
}
|
|
}
|
|
|
|
void
|
|
prom_printf(const char *fmt, ...)
|
|
{
|
|
va_list args;
|
|
int i;
|
|
|
|
va_start(args, fmt);
|
|
i = vscnprintf(ppbuf, sizeof(ppbuf), fmt, args);
|
|
va_end(args);
|
|
|
|
prom_write(ppbuf, i);
|
|
}
|