From 95c331b94b1d04ea34b480c83613c2141a02697e Mon Sep 17 00:00:00 2001 From: "Ronald G. Minnich" Date: Fri, 14 Sep 2018 01:21:05 -0700 Subject: rampayload: Add the linuxcheck payload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The i386.c file uses standard 3f8 UART for some simple diagnostic prints, and the libpayload console otherwise. This payload was used to debug Linux as a rampayload and was very helpful for that work. Change-Id: I1cce5528780cd825fd91a88137fa70abd9f218e7 Signed-off-by: Ronald G. Minnich Reviewed-on: https://review.coreboot.org/28600 Reviewed-by: Jonathan Neuschäfer Tested-by: build bot (Jenkins) --- payloads/linuxcheck/i386.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 payloads/linuxcheck/i386.c (limited to 'payloads/linuxcheck/i386.c') diff --git a/payloads/linuxcheck/i386.c b/payloads/linuxcheck/i386.c new file mode 100644 index 0000000000..2b4b541f1e --- /dev/null +++ b/payloads/linuxcheck/i386.c @@ -0,0 +1,48 @@ +/* + * This file is part of the coreinfo project. + * + * Copyright (C) 2018 Google Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include "linuxcheck.h" + +void buts(char *s) +{ + int i; + for (i = 0; i < strlen(s); i++) + outb(s[i], 0x3f8); +} + +void hex4(u8 c) +{ + static char *hex = "0123456789abcdef"; + outb(hex[c & 0xf], 0x3f8); +} + +void hex8(u8 c) +{ + hex4(c >> 4); + hex4(c); +} + +void hex16(u16 c) +{ + hex8((u8)(c >> 8)); + hex8((u8)c); +} +void hex32(u32 c) +{ + hex16((u16)(c >> 16)); + hex16((u16)c); +} -- cgit v1.2.3