blob: 5e0fdba70380eabca533be7b52008a41bc74c84d [file] [log] [blame]
Ronald G. Minnich95c331b2018-09-14 01:21:05 -07001/*
2 * This file is part of the coreinfo project.
3 *
4 * Copyright (C) 2018 Google Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#include <libpayload-config.h>
17#include <libpayload.h>
18#include "linuxcheck.h"
19
20extern struct console_output_driver *console_out;
21extern struct sysinfo_t lib_sysinfo;
22
23int main(void)
24{
25 int ret, i;
26
27 buts("Greetings from linuxcheck, via hard-coded calls to serial functions.\n");
28 if (console_out == NULL)
29 buts("Bad news: console_out is NULL\n");
30 if (lib_sysinfo.serial == NULL)
31 buts("Bad news: lib_sysinfo.serial is NULL. Very little will work well.\n");
32 ret = lib_get_sysinfo();
33 if (ret) {
34 buts("lib_get_sysinfo() is non-zero");
35 hex32(ret);
36 buts("\n");
37 }
38
39 buts("The next line should be puts works\n");
40 puts("puts works\n");
41 buts("If you did not see puts works, then you have a console issues\n");
42 buts("The next line should be 'printf works'\n");
43 printf("printf works\n");
44 buts(" ... if you did not see printf works, then you have a printf issue\n");
45 printf("Number of memory ranges: %d\n", lib_sysinfo.n_memranges);
46 for (i = 0; i < lib_sysinfo.n_memranges; i++) {
47 printf("%d: base 0x%08llx size 0x%08llx type 0x%x\n", i, lib_sysinfo.memrange[i].base, lib_sysinfo.memrange[i].size, lib_sysinfo.memrange[i].type);
48 }
49 buts("Now we will halt. Bye");
50 halt();
51 return 0;
52}