1/*
2 * Copyright 2017, Data61
3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO)
4 * ABN 41 687 119 230.
5 *
6 * This software may be distributed and modified according to the terms of
7 * the BSD 2-Clause license. Note that NO WARRANTY is provided.
8 * See "LICENSE_BSD2.txt" for details.
9 *
10 * @TAG(DATA61_BSD)
11 */
12
13#include <autoconf.h>
14#include <sel4debug/gen_config.h>
15
16#include <stdio.h>
17
18#include <sel4/sel4.h>
19#include <utils/util.h>
20
21void debug_print_bootinfo(seL4_BootInfo *info)
22{
23
24    printf("Node %lu of %lu\n", (long)info->nodeID, (long)info->numNodes);
25    printf("IOPT levels:     %u\n", (int)info->numIOPTLevels);
26    printf("IPC buffer:      %p\n", info->ipcBuffer);
27    printf("Empty slots:     [%lu --> %lu)\n", (long)info->empty.start, (long)info->empty.end);
28    printf("sharedFrames:    [%lu --> %lu)\n", (long)info->sharedFrames.start, (long)info->sharedFrames.end);
29    printf("userImageFrames: [%lu --> %lu)\n", (long)info->userImageFrames.start, (long)info->userImageFrames.end);
30    printf("userImagePaging: [%lu --> %lu)\n", (long)info->userImagePaging.start, (long)info->userImagePaging.end);
31    printf("untypeds:        [%lu --> %lu)\n", (long)info->untyped.start, (long)info->untyped.end);
32    printf("Initial thread domain: %u\n", (int)info->initThreadDomain);
33    printf("Initial thread cnode size: %u\n", (int)info->initThreadCNodeSizeBits);
34    printf("List of untypeds\n");
35    printf("------------------\n");
36    printf("Paddr    | Size   | Device\n");
37
38    int sizes[CONFIG_WORD_SIZE] = {0};
39    for (int i = 0; i < CONFIG_MAX_NUM_BOOTINFO_UNTYPED_CAPS && i < (info->untyped.end - info->untyped.start); i++) {
40        int index = info->untypedList[i].sizeBits;
41        assert(index < ARRAY_SIZE(sizes));
42        sizes[index]++;
43        printf("%p | %zu | %d\n", (void *)info->untypedList[i].paddr, (size_t)info->untypedList[i].sizeBits,
44               (int)info->untypedList[i].isDevice);
45    }
46
47    printf("Untyped summary\n");
48    for (int i = 0; i < ARRAY_SIZE(sizes); i++) {
49        if (sizes[i] != 0) {
50            printf("%d untypeds of size %d\n", sizes[i], i);
51        }
52    }
53}
54
55