Staging
v0.8.1
https://github.com/torvalds/linux
Raw File
Tip revision: c9e6606c7fe92b50a02ce51dda82586ebdf99b48 authored by Linus Torvalds on 02 January 2022, 22:23:25 UTC
Linux 5.16-rc8
Tip revision: c9e6606
dbg.c
// SPDX-License-Identifier: GPL-2.0
/*
 * MIPS-specific debug support for pre-boot environment
 *
 * NOTE: putc() is board specific, if your board have a 16550 compatible uart,
 * please select SYS_SUPPORTS_ZBOOT_UART16550 for your machine. othewise, you
 * need to implement your own putc().
 */
#include <linux/compiler.h>
#include <linux/types.h>

void __weak putc(char c)
{
}

void puts(const char *s)
{
	char c;
	while ((c = *s++) != '\0') {
		putc(c);
		if (c == '\n')
			putc('\r');
	}
}

void puthex(unsigned long long val)
{

	unsigned char buf[10];
	int i;
	for (i = 7; i >= 0; i--) {
		buf[i] = "0123456789ABCDEF"[val & 0x0F];
		val >>= 4;
	}
	buf[8] = '\0';
	puts(buf);
}
back to top