This patch creates a new commonlib/bsd subdirectory with a similar purpose to the existing commonlib, with the difference that all files under this subdirectory shall be licensed under the BSD-3-Clause license (or compatible permissive license). The goal is to allow more code to be shared with libpayload in the future. Initially, I'm going to move a few files there that have already been BSD-licensed in the existing commonlib. I am also exracting most contents of the often-needed <commonlib/helpers.h> as long as they have either been written by me (and are hereby relicensed) or have an existing equivalent in BSD-licensed libpayload code. I am also relicensing <commonlib/compression.h> (written by me) and <commonlib/compiler.h> (same stuff exists in libpayload). Finally, I am extracting the cb_err error code definitions from <types.h> into a new BSD-licensed header so that future commonlib/bsd code can build upon a common set of error values. I am making the assumption here that the enum constants and the half-sentence fragments of documentation next to them by themselves do not meet the threshold of copyrightability. Change-Id: I316cea70930f131e8e93d4218542ddb5ae4b63a2 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/38420 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Rudolph <siro@das-labor.org>
71 lines
1.8 KiB
C
71 lines
1.8 KiB
C
/*
|
|
* This file is part of the coreboot project.
|
|
*
|
|
* Copyright 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 <bootblock_common.h>
|
|
#include <commonlib/bsd/compression.h>
|
|
#include <delay.h>
|
|
#include <program_loading.h>
|
|
#include <symbols.h>
|
|
#include <timestamp.h>
|
|
|
|
extern u8 compressed_bootblock[];
|
|
asm (
|
|
".pushsection .data.compressed_bootblock,\"a\",@progbits\n\t"
|
|
".type compressed_bootblock, %object\n\t"
|
|
".balign 8\n"
|
|
"compressed_bootblock:\n\t"
|
|
".incbin \"" __BUILD_DIR__ "/cbfs/" CONFIG_CBFS_PREFIX "/bootblock.lz4\"\n\t"
|
|
".size compressed_bootblock, . - compressed_bootblock\n\t"
|
|
".popsection\n\t"
|
|
);
|
|
|
|
struct bootblock_arg arg = {
|
|
.base_timestamp = 0,
|
|
.num_timestamps = 2,
|
|
.timestamps = {
|
|
{ .entry_id = TS_START_ULZ4F },
|
|
{ .entry_id = TS_END_ULZ4F },
|
|
},
|
|
};
|
|
|
|
struct prog prog_bootblock = {
|
|
.type = PROG_BOOTBLOCK,
|
|
.entry = (void *)_bootblock,
|
|
.arg = &arg,
|
|
};
|
|
|
|
__weak void decompressor_soc_init(void) { /* no-op */ }
|
|
|
|
void main(void)
|
|
{
|
|
init_timer();
|
|
|
|
if (CONFIG(COLLECT_TIMESTAMPS))
|
|
arg.base_timestamp = timestamp_get();
|
|
|
|
decompressor_soc_init();
|
|
|
|
if (CONFIG(COLLECT_TIMESTAMPS))
|
|
arg.timestamps[0].entry_stamp = timestamp_get();
|
|
|
|
size_t out_size = ulz4f(compressed_bootblock, _bootblock);
|
|
prog_segment_loaded((uintptr_t)_bootblock, out_size, SEG_FINAL);
|
|
|
|
if (CONFIG(COLLECT_TIMESTAMPS))
|
|
arg.timestamps[1].entry_stamp = timestamp_get();
|
|
|
|
prog_run(&prog_bootblock);
|
|
}
|