#include <xen/stdarg.h>
#include <xen/string.h>
#include <xen/early_printk.h>
-#include <asm/early_printk.h>
void early_putch(char c);
void early_flush(void);
-/* Early printk buffer */
-static char __initdata buf[512];
-
void early_puts(const char *s)
{
while (*s != '\0') {
*/
early_flush();
}
-
-static void __init early_vprintk(const char *fmt, va_list args)
-{
- vsnprintf(buf, sizeof(buf), fmt, args);
- early_puts(buf);
-}
-
-void __init early_printk(const char *fmt, ...)
-{
- va_list args;
-
- va_start(args, fmt);
- early_vprintk(fmt, args);
- va_end(args);
-}
-
-void __init
-early_panic(const char *fmt, ...)
-{
- va_list args;
-
- va_start(args, fmt);
- early_vprintk(fmt, args);
- va_end(args);
-
- early_printk("\n\nEarly Panic: Stopping\n");
-
- while(1);
-}
#include <public/memory.h>
#include <xen/sched.h>
#include <xen/vmap.h>
-#include <asm/early_printk.h>
#include <xsm/xsm.h>
#include <xen/pfn.h>
xenheap_mfn_start = base_mfn;
if ( base_mfn < xenheap_mfn_start )
- early_panic("cannot add xenheap mapping at %lx below heap start %lx",
- base_mfn, xenheap_mfn_start);
+ panic("cannot add xenheap mapping at %lx below heap start %lx",
+ base_mfn, xenheap_mfn_start);
end_mfn = base_mfn + nr_mfns;
#include <asm/page.h>
#include <asm/current.h>
#include <asm/setup.h>
-#include <asm/early_printk.h>
#include <asm/gic.h>
#include <asm/cpufeature.h>
#include <asm/platform.h>
}
if ( !paddr )
- early_panic("Not enough memory to relocate Xen");
+ panic("Not enough memory to relocate Xen");
- early_printk("Placing Xen at 0x%"PRIpaddr"-0x%"PRIpaddr"\n",
- paddr, paddr + min_size);
+ printk("Placing Xen at 0x%"PRIpaddr"-0x%"PRIpaddr"\n",
+ paddr, paddr + min_size);
early_info.modules.module[MOD_XEN].start = paddr;
early_info.modules.module[MOD_XEN].size = min_size;
void *fdt;
if ( !early_info.mem.nr_banks )
- early_panic("No memory bank");
+ panic("No memory bank");
/*
* We are going to accumulate two regions here.
if ( i != early_info.mem.nr_banks )
{
- early_printk("WARNING: only using %d out of %d memory banks\n",
- i, early_info.mem.nr_banks);
+ printk("WARNING: only using %d out of %d memory banks\n",
+ i, early_info.mem.nr_banks);
early_info.mem.nr_banks = i;
}
} while ( xenheap_pages > 128<<(20-PAGE_SHIFT) );
if ( ! e )
- early_panic("Not not enough space for xenheap");
+ panic("Not not enough space for xenheap");
domheap_pages = heap_pages - xenheap_pages;
- early_printk("Xen heap: %"PRIpaddr"-%"PRIpaddr" (%lu pages)\n",
- e - (pfn_to_paddr(xenheap_pages)), e,
- xenheap_pages);
- early_printk("Dom heap: %lu pages\n", domheap_pages);
+ printk("Xen heap: %"PRIpaddr"-%"PRIpaddr" (%lu pages)\n",
+ e - (pfn_to_paddr(xenheap_pages)), e, xenheap_pages);
+ printk("Dom heap: %lu pages\n", domheap_pages);
setup_xenheap_mappings((e >> PAGE_SHIFT) - xenheap_pages, xenheap_pages);
if ( bank != early_info.mem.nr_banks )
{
- early_printk("WARNING: only using %d out of %d memory banks\n",
- bank, early_info.mem.nr_banks);
+ printk("WARNING: only using %d out of %d memory banks\n",
+ bank, early_info.mem.nr_banks);
early_info.mem.nr_banks = bank;
}
fdt_size = device_tree_early_init(device_tree_flattened, fdt_paddr);
cmdline = device_tree_bootargs(device_tree_flattened);
- early_printk("Command line: %s\n", cmdline);
+ printk("Command line: %s\n", cmdline);
cmdline_parse(cmdline);
setup_pagetables(boot_phys_offset, get_xen_paddr());
#include <xen/cpumask.h>
#include <xen/ctype.h>
#include <xen/lib.h>
-#include <asm/early_printk.h>
struct dt_early_info __initdata early_info;
const void *device_tree_flattened;
static LIST_HEAD(aliases_lookup);
-/* Some device tree functions may be called both before and after the
- console is initialized. */
-#define dt_printk(fmt, ...) \
- do \
- { \
- if ( system_state == SYS_STATE_early_boot ) \
- early_printk(fmt, ## __VA_ARGS__); \
- else \
- printk(fmt, ## __VA_ARGS__); \
- } while (0)
-
// #define DEBUG_DT
#ifdef DEBUG_DT
-# define dt_dprintk(fmt, args...) dt_printk(XENLOG_DEBUG fmt, ##args)
+# define dt_dprintk(fmt, args...) printk(XENLOG_DEBUG fmt, ##args)
static void dt_dump_addr(const char *s, const __be32 *addr, int na)
{
dt_dprintk("%s", s);
if ( depth >= DEVICE_TREE_MAX_DEPTH )
{
- dt_printk("Warning: device tree node `%s' is nested too deep\n",
- name);
+ printk("Warning: device tree node `%s' is nested too deep\n",
+ name);
continue;
}
if ( name[0] == '\0' )
name = "/";
- dt_printk("%s%s:\n", prefix, name);
+ printk("%s%s:\n", prefix, name);
for ( prop = fdt_first_property_offset(fdt, node);
prop >= 0;
p = fdt_get_property_by_offset(fdt, prop, NULL);
- dt_printk("%s %s\n", prefix, fdt_string(fdt, fdt32_to_cpu(p->nameoff)));
+ printk("%s %s\n", prefix, fdt_string(fdt, fdt32_to_cpu(p->nameoff)));
}
return 0;
if ( address_cells < 1 || size_cells < 1 )
{
- early_printk("fdt: node `%s': invalid #address-cells or #size-cells",
- name);
+ printk("fdt: node `%s': invalid #address-cells or #size-cells",
+ name);
return;
}
prop = fdt_get_property(fdt, node, "reg", NULL);
if ( !prop )
{
- early_printk("fdt: node `%s': missing `reg' property\n", name);
+ printk("fdt: node `%s': missing `reg' property\n", name);
return;
}
else if ( fdt_node_check_compatible(fdt, node, "xen,xsm-policy") == 0 )
nr = MOD_XSM;
else
- early_panic("%s not a known xen multiboot type\n", name);
+ panic("%s not a known xen multiboot type\n", name);
mod = &early_info.modules.module[nr];
prop = fdt_get_property(fdt, node, "reg", &len);
if ( !prop )
- early_panic("node %s missing `reg' property\n", name);
+ panic("node %s missing `reg' property\n", name);
if ( len < dt_cells_to_size(address_cells + size_cells) )
- early_panic("fdt: node `%s': `reg` property length is too short\n",
+ panic("fdt: node `%s': `reg` property length is too short\n",
name);
cell = (const __be32 *)prop->data;
if ( prop )
{
if ( len > sizeof(mod->cmdline) )
- early_panic("module %d command line too long\n", nr);
+ panic("module %d command line too long\n", nr);
safe_strcpy(mod->cmdline, prop->data);
}
paddr_t start, end;
int len;
- dt_printk("Checking for initrd in /chosen\n");
+ printk("Checking for initrd in /chosen\n");
prop = fdt_get_property(fdt, node, "linux,initrd-start", &len);
if ( !prop )
return;
if ( len != sizeof(u32) && len != sizeof(u64) )
{
- dt_printk("linux,initrd-start property has invalid length %d\n", len);
+ printk("linux,initrd-start property has invalid length %d\n", len);
return;
}
start = dt_read_number((void *)&prop->data, dt_size_to_cells(len));
prop = fdt_get_property(fdt, node, "linux,initrd-end", &len);
if ( !prop )
{
- dt_printk("linux,initrd-end not present but -start was\n");
+ printk("linux,initrd-end not present but -start was\n");
return;
}
if ( len != sizeof(u32) && len != sizeof(u64) )
{
- dt_printk("linux,initrd-end property has invalid length %d\n", len);
+ printk("linux,initrd-end property has invalid length %d\n", len);
return;
}
end = dt_read_number((void *)&prop->data, dt_size_to_cells(len));
if ( start >= end )
{
- dt_printk("linux,initrd limits invalid: %"PRIpaddr" >= %"PRIpaddr"\n",
+ printk("linux,initrd limits invalid: %"PRIpaddr" >= %"PRIpaddr"\n",
start, end);
return;
}
- dt_printk("Initrd %"PRIpaddr"-%"PRIpaddr"\n", start, end);
+ printk("Initrd %"PRIpaddr"-%"PRIpaddr"\n", start, end);
mod->start = start;
mod->size = end - start;
int i, nr_rsvd;
for ( i = 0; i < mi->nr_banks; i++ )
- early_printk("RAM: %"PRIpaddr" - %"PRIpaddr"\n",
+ printk("RAM: %"PRIpaddr" - %"PRIpaddr"\n",
mi->bank[i].start,
mi->bank[i].start + mi->bank[i].size - 1);
- early_printk("\n");
+ printk("\n");
for ( i = 1 ; i < mods->nr_mods + 1; i++ )
- early_printk("MODULE[%d]: %"PRIpaddr" - %"PRIpaddr" %s\n",
+ printk("MODULE[%d]: %"PRIpaddr" - %"PRIpaddr" %s\n",
i,
mods->module[i].start,
mods->module[i].start + mods->module[i].size,
continue;
/* fdt_get_mem_rsv returns length */
e += s;
- early_printk(" RESVD[%d]: %"PRIpaddr" - %"PRIpaddr"\n",
+ printk(" RESVD[%d]: %"PRIpaddr" - %"PRIpaddr"\n",
i, s, e);
}
- early_printk("\n");
+ printk("\n");
}
/**
ret = fdt_check_header(fdt);
if ( ret < 0 )
- early_panic("No valid device tree\n");
+ panic("No valid device tree\n");
mod = &early_info.modules.module[MOD_FDT];
mod->start = paddr;
ranges = dt_get_property(parent, rprop, &rlen);
if ( ranges == NULL )
{
- dt_printk(XENLOG_ERR "DT: no ranges; cannot translate\n");
+ printk(XENLOG_ERR "DT: no ranges; cannot translate\n");
return 1;
}
if ( rlen == 0 )
bus->count_cells(dev, &na, &ns);
if ( !DT_CHECK_COUNTS(na, ns) )
{
- dt_printk(XENLOG_ERR "dt_parse: Bad cell count for device %s\n",
+ printk(XENLOG_ERR "dt_parse: Bad cell count for device %s\n",
dev->full_name);
goto bail;
}
pbus = dt_match_bus(parent);
if ( pbus == NULL )
{
- dt_printk("DT: %s is not a valid bus\n", parent->full_name);
+ printk("DT: %s is not a valid bus\n", parent->full_name);
break;
}
pbus->count_cells(dev, &pna, &pns);
tag = be32_to_cpup((__be32 *)(*p));
if ( tag != FDT_BEGIN_NODE )
{
- dt_printk(XENLOG_WARNING "Weird tag at start of node: %x\n", tag);
+ printk(XENLOG_WARNING "Weird tag at start of node: %x\n", tag);
return mem;
}
*p += 4;
}
if ( tag != FDT_END_NODE )
{
- dt_printk(XENLOG_WARNING "Weird tag at end of node: %x\n", tag);
+ printk(XENLOG_WARNING "Weird tag at end of node: %x\n", tag);
return mem;
}
start = ((unsigned long)fdt) + fdt_off_dt_struct(fdt);
unflatten_dt_node(fdt, mem, &start, NULL, &allnextp, 0);
if ( be32_to_cpup((__be32 *)start) != FDT_END )
- dt_printk(XENLOG_WARNING "Weird tag at end of tree: %08x\n",
+ printk(XENLOG_WARNING "Weird tag at end of tree: %08x\n",
*((u32 *)start));
if ( be32_to_cpu(((__be32 *)mem)[size / 4]) != 0xdeadbeef )
- dt_printk(XENLOG_WARNING "End of tree marker overwritten: %08x\n",
+ printk(XENLOG_WARNING "End of tree marker overwritten: %08x\n",
be32_to_cpu(((__be32 *)mem)[size / 4]));
*allnextp = NULL;
*/
#include <asm/device.h>
-#include <asm/early_printk.h>
#include <asm/types.h>
#include <xen/console.h>
#include <xen/device_tree.h>
if ( !console_has("dtuart") || !strcmp(opt_dtuart, "") )
{
- early_printk("No console\n");
+ printk("No console\n");
return;
}
else
options = "";
- early_printk("Looking for UART console %s\n", devpath);
+ printk("Looking for UART console %s\n", devpath);
if ( *devpath == '/' )
dev = dt_find_node_by_path(devpath);
else
if ( !dev )
{
- early_printk("Unable to find device \"%s\"\n", devpath);
+ printk("Unable to find device \"%s\"\n", devpath);
return;
}
ret = device_init(dev, DEVICE_SERIAL, options);
if ( ret )
- early_printk("Unable to initialize serial: %d\n", ret);
+ printk("Unable to initialize serial: %d\n", ret);
}
#include <xen/init.h>
#include <xen/irq.h>
#include <xen/mm.h>
-#include <asm/early_printk.h>
#include <asm/device.h>
#include <asm/exynos4210-uart.h>
#include <asm/io.h>
u64 addr, size;
if ( strcmp(config, "") )
- {
- early_printk("WARNING: UART configuration is not supported\n");
- }
+ printk("WARNING: UART configuration is not supported\n");
uart = &exynos4210_com;
res = dt_device_get_address(dev, 0, &addr, &size);
if ( res )
{
- early_printk("exynos4210: Unable to retrieve the base"
- " address of the UART\n");
+ printk("exynos4210: Unable to retrieve the base"
+ " address of the UART\n");
return res;
}
res = dt_device_get_irq(dev, 0, &uart->irq);
if ( res )
{
- early_printk("exynos4210: Unable to retrieve the IRQ\n");
+ printk("exynos4210: Unable to retrieve the IRQ\n");
return res;
}
uart->regs = ioremap_nocache(addr, size);
if ( !uart->regs )
{
- early_printk("exynos4210: Unable to map the UART memory\n");
+ printk("exynos4210: Unable to map the UART memory\n");
return -ENOMEM;
}
#include <xen/serial.h>
#include <xen/init.h>
#include <xen/irq.h>
-#include <asm/early_printk.h>
#include <xen/device_tree.h>
#include <asm/device.h>
#include <xen/errno.h>
u64 addr, size;
if ( strcmp(config, "") )
- early_printk("WARNING: UART configuration is not supported\n");
+ printk("WARNING: UART configuration is not supported\n");
uart = &omap_com;
res = dt_property_read_u32(dev, "clock-frequency", &clkspec);
if ( !res )
{
- early_printk("omap-uart: Unable to retrieve the clock frequency\n");
+ printk("omap-uart: Unable to retrieve the clock frequency\n");
return -EINVAL;
}
res = dt_device_get_address(dev, 0, &addr, &size);
if ( res )
{
- early_printk("omap-uart: Unable to retrieve the base"
- " address of the UART\n");
+ printk("omap-uart: Unable to retrieve the base"
+ " address of the UART\n");
return res;
}
res = dt_device_get_irq(dev, 0, &uart->irq);
if ( res )
{
- early_printk("omap-uart: Unable to retrieve the IRQ\n");
+ printk("omap-uart: Unable to retrieve the IRQ\n");
return res;
}
uart->regs = ioremap_nocache(addr, size);
if ( !uart->regs )
{
- early_printk("omap-uart: Unable to map the UART memory\n");
+ printk("omap-uart: Unable to map the UART memory\n");
return -ENOMEM;
}
#include <xen/serial.h>
#include <xen/init.h>
#include <xen/irq.h>
-#include <asm/early_printk.h>
#include <xen/device_tree.h>
#include <xen/errno.h>
#include <asm/device.h>
/* Baud rate already set: read it out from the divisor latch. */
divisor = (pl011_read(uart, IBRD) << 6) | (pl011_read(uart, FBRD));
if (!divisor)
- early_panic("pl011: No Baud rate configured\n");
+ panic("pl011: No Baud rate configured\n");
uart->baud = (uart->clock_hz << 2) / divisor;
}
/* This write must follow FBRD and IBRD writes. */
if ( strcmp(config, "") )
{
- early_printk("WARNING: UART configuration is not supported\n");
+ printk("WARNING: UART configuration is not supported\n");
}
uart = &pl011_com;
res = dt_device_get_address(dev, 0, &addr, &size);
if ( res )
{
- early_printk("pl011: Unable to retrieve the base"
- " address of the UART\n");
+ printk("pl011: Unable to retrieve the base"
+ " address of the UART\n");
return res;
}
res = dt_device_get_irq(dev, 0, &uart->irq);
if ( res )
{
- early_printk("pl011: Unable to retrieve the IRQ\n");
+ printk("pl011: Unable to retrieve the IRQ\n");
return res;
}
uart->regs = ioremap_nocache(addr, size);
if ( !uart->regs )
{
- early_printk("pl011: Unable to map the UART memory\n");
+ printk("pl011: Unable to map the UART memory\n");
return -ENOMEM;
}
#include <xen/libfdt/libfdt.h>
#include <xen/init.h>
#include <xen/mm.h>
-#include <asm/early_printk.h>
#include "font.h"
#include "lfb.h"
#include "modelines.h"
if ( !dev )
{
- early_printk("HDLCD: Cannot find node compatible with \"arm,hdcld\"\n");
+ printk("HDLCD: Cannot find node compatible with \"arm,hdcld\"\n");
return;
}
res = dt_device_get_address(dev, 0, &hdlcd_start, &hdlcd_size);
if ( !res )
{
- early_printk("HDLCD: Unable to retrieve MMIO base address\n");
+ printk("HDLCD: Unable to retrieve MMIO base address\n");
return;
}
cells = dt_get_property(dev, "framebuffer", &lenp);
if ( !cells )
{
- early_printk("HDLCD: Unable to retrieve framebuffer property\n");
+ printk("HDLCD: Unable to retrieve framebuffer property\n");
return;
}
if ( !hdlcd_start )
{
- early_printk(KERN_ERR "HDLCD: address missing from device tree, disabling driver\n");
+ printk(KERN_ERR "HDLCD: address missing from device tree, disabling driver\n");
return;
}
if ( !framebuffer_start )
{
- early_printk(KERN_ERR "HDLCD: framebuffer address missing from device tree, disabling driver\n");
+ printk(KERN_ERR "HDLCD: framebuffer address missing from device tree, disabling driver\n");
return;
}
else if ( strlen(mode_string) < strlen("800x600@60") ||
strlen(mode_string) > sizeof(_mode_string) - 1 )
{
- early_printk(KERN_ERR "HDLCD: invalid modeline=%s\n", mode_string);
+ printk(KERN_ERR "HDLCD: invalid modeline=%s\n", mode_string);
return;
} else {
char *s = strchr(mode_string, '-');
if ( !s )
{
- early_printk(KERN_INFO "HDLCD: bpp not found in modeline %s, assume 32 bpp\n",
+ printk(KERN_INFO "HDLCD: bpp not found in modeline %s, assume 32 bpp\n",
mode_string);
get_color_masks("32", &c);
memcpy(_mode_string, mode_string, strlen(mode_string) + 1);
} else {
if ( strlen(s) < 6 )
{
- early_printk(KERN_ERR "HDLCD: invalid mode %s\n", mode_string);
+ printk(KERN_ERR "HDLCD: invalid mode %s\n", mode_string);
return;
}
s++;
if ( get_color_masks(s, &c) < 0 )
{
- early_printk(KERN_WARNING "HDLCD: unsupported bpp %s\n", s);
+ printk(KERN_WARNING "HDLCD: unsupported bpp %s\n", s);
return;
}
bytes_per_pixel = simple_strtoll(s, NULL, 10) / 8;
}
if ( !videomode )
{
- early_printk(KERN_WARNING "HDLCD: unsupported videomode %s\n",
- _mode_string);
+ printk(KERN_WARNING "HDLCD: unsupported videomode %s\n",
+ _mode_string);
return;
}
if ( framebuffer_size < bytes_per_pixel * videomode->xres * videomode->yres )
{
- early_printk(KERN_ERR "HDLCD: the framebuffer is too small, disabling the HDLCD driver\n");
+ printk(KERN_ERR "HDLCD: the framebuffer is too small, disabling the HDLCD driver\n");
return;
}
- early_printk(KERN_INFO "Initializing HDLCD driver\n");
+ printk(KERN_INFO "Initializing HDLCD driver\n");
lfb = ioremap_wc(framebuffer_start, framebuffer_size);
if ( !lfb )
{
- early_printk(KERN_ERR "Couldn't map the framebuffer\n");
+ printk(KERN_ERR "Couldn't map the framebuffer\n");
return;
}
memset(lfb, 0x00, bytes_per_pixel * videomode->xres * videomode->yres);
#define EARLY_UART_VIRTUAL_ADDRESS \
(FIXMAP_ADDR(FIXMAP_CONSOLE) +(EARLY_UART_BASE_ADDRESS & ~PAGE_MASK))
-#endif
-
-#ifndef __ASSEMBLY__
-
-#ifdef CONFIG_EARLY_PRINTK
-
-void early_printk(const char *fmt, ...)
- __attribute__((format (printf, 1, 2)));
-void noreturn early_panic(const char *fmt, ...)
- __attribute__((format (printf, 1, 2)));
-
-#else
-
-static inline __attribute__((format (printf, 1, 2))) void
-early_printk(const char *fmt, ...)
-{}
-
-static inline void noreturn
-__attribute__((format (printf, 1, 2))) early_panic(const char *fmt, ...)
-{while(1);}
-
#endif /* !CONFIG_EARLY_PRINTK */
-#endif /* __ASSEMBLY__ */
-
#endif