mb/google/fatcat/var/felino: Add initial memory config
[coreboot2.git] / payloads / linuxcheck / linuxcheck.c
blob35d73f1d219b7c48223c924f2646513dfba61b5d
1 /*
3 * Copyright (C) 2018 Google Inc.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 2 of the License.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
15 #include <libpayload-config.h>
16 #include <libpayload.h>
17 #include "linuxcheck.h"
19 extern struct console_output_driver *console_out;
20 extern struct sysinfo_t lib_sysinfo;
22 int main(void)
24 int ret, i;
26 buts("Greetings from linuxcheck, via hard-coded calls to serial functions.\n");
27 if (console_out == NULL)
28 buts("Bad news: console_out is NULL\n");
29 if (lib_sysinfo.serial == NULL)
30 buts("Bad news: lib_sysinfo.serial is NULL. Very little will work well.\n");
31 ret = lib_get_sysinfo();
32 if (ret) {
33 buts("lib_get_sysinfo() is non-zero");
34 hex32(ret);
35 buts("\n");
38 buts("The next line should be puts works\n");
39 puts("puts works\n");
40 buts("If you did not see puts works, then you have a console issues\n");
41 buts("The next line should be 'printf works'\n");
42 printf("printf works\n");
43 buts(" ... if you did not see printf works, then you have a printf issue\n");
44 printf("Number of memory ranges: %d\n", lib_sysinfo.n_memranges);
45 for (i = 0; i < lib_sysinfo.n_memranges; i++) {
46 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 buts("Now we will halt. Bye");
49 halt();
50 return 0;