coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
decompressor.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <bootblock_common.h>
5 #include <delay.h>
6 #include <metadata_hash.h>
7 #include <program_loading.h>
8 #include <symbols.h>
9 #include <timestamp.h>
10 
11 extern u8 compressed_bootblock[];
12 asm (
13  ".pushsection .data.compressed_bootblock,\"a\",@progbits\n\t"
14  ".type compressed_bootblock, %object\n\t"
15  ".balign 8\n"
16  "compressed_bootblock:\n\t"
17  ".incbin \"" __BUILD_DIR__ "/cbfs/" CONFIG_CBFS_PREFIX "/bootblock.lz4\"\n\t"
18  ".size compressed_bootblock, . - compressed_bootblock\n\t"
19  ".popsection\n\t"
20 );
21 
22 struct bootblock_arg arg = {
23  .base_timestamp = 0,
24  .num_timestamps = 2,
25  .timestamps = {
26  { .entry_id = TS_ULZ4F_START },
27  { .entry_id = TS_ULZ4F_END },
28  },
29 };
30 
31 struct prog prog_bootblock = {
33  .entry = (void *)_bootblock,
34  .arg = &arg,
35 };
36 
37 __weak void decompressor_soc_init(void) { /* no-op */ }
38 
39 void main(void)
40 {
41  init_timer();
42 
43  if (CONFIG(COLLECT_TIMESTAMPS))
45 
46  if (CONFIG(CBFS_VERIFICATION))
48 
50 
51  if (CONFIG(COLLECT_TIMESTAMPS))
53 
54  size_t out_size = ulz4f(compressed_bootblock, _bootblock);
55  prog_segment_loaded((uintptr_t)_bootblock, out_size, SEG_FINAL);
56 
57  if (CONFIG(COLLECT_TIMESTAMPS))
59 
61 }
size_t ulz4f(const void *src, void *dst)
Definition: lz4_wrapper.c:167
@ CONFIG
Definition: dsi_common.h:201
void * metadata_hash_export_anchor(void)
Definition: metadata_hash.c:20
struct bootblock_arg arg
Definition: decompressor.c:22
u8 compressed_bootblock[]
void main(void)
Definition: decompressor.c:39
__weak void decompressor_soc_init(void)
Definition: decompressor.c:37
struct prog prog_bootblock
Definition: decompressor.c:31
__weak void init_timer(void)
Definition: arch_timer.c:12
@ SEG_FINAL
void prog_segment_loaded(uintptr_t start, size_t size, int flags)
Definition: prog_ops.c:6
void prog_run(struct prog *prog)
Definition: prog_ops.c:24
@ PROG_BOOTBLOCK
const struct smm_save_state_ops *legacy_ops __weak
Definition: save_state.c:8
unsigned long uintptr_t
Definition: stdint.h:21
uint8_t u8
Definition: stdint.h:45
void * metadata_hash_anchor
struct timestamp_entry timestamps[]
uint64_t base_timestamp
enum prog_type type
int64_t entry_stamp
#define timestamp_get()
Workaround for guard combination above.
Definition: timestamp.h:52
@ TS_ULZ4F_END
@ TS_ULZ4F_START