summaryrefslogtreecommitdiff
path: root/core/sboot.c
blob: 1649b7ed2fc0ddb556a04d418c98b3df4a0264d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
 * Copyright (c) 2026, Apollo Telephone Laboratories.
 * Provided under the BSD-3 clause.
 */

#include <efi.h>
#include <efilib.h>
#include <sboot/sboot.h>
#include <sboot/config.h>
#include <sboot/fwi.h>

EFI_STATUS
EFIAPI
efi_main(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
{
    UINTN NrBootEntries;
    BOOT_PROTOCOL LastProtocol;

    InitializeLib(ImageHandle, SystemTable);
    NrBootEntries = NELEM(ConfigBootEntries);

    /* Ensure the list is terminated */
    LastProtocol = ConfigBootEntries[NrBootEntries - 1].Protocol;
    if (LastProtocol != PROTOCOL_END) {
        Print(L"fatal: boot entry list not terminated\n");
        Hcf();
    }

    /* Disable the watchdog timer */
    FwiSetWatchdogTimer(
        0,
        0,
        0,
        NULL
    );

    Print(
        L"SBOOT %s - %d boot entrie(s)\n",
        SBOOT_VERSION,
        NELEM(ConfigBootEntries) - 1
    );

    for (;;);
}