coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
mmap_boot.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <boot_device.h>
4 #include <endian.h>
5 #include <spi_flash.h>
6 
7 /* The ROM is memory mapped just below 4GiB. Form a pointer for the base. */
8 #define rom_base ((void *)(uintptr_t)(0x100000000ULL-CONFIG_ROM_SIZE))
9 
10 static const struct mem_region_device boot_dev =
11  MEM_REGION_DEV_RO_INIT(rom_base, CONFIG_ROM_SIZE);
12 
13 const struct region_device *boot_device_ro(void)
14 {
15  return &boot_dev.rdev;
16 }
17 
19 {
20  table->flash_base = 0;
22  table->size = CONFIG_ROM_SIZE;
23 
24  return 1;
25 }
uint32_t spi_flash_get_mmap_windows(struct flash_mmap_window *table)
Definition: mmap_boot.c:18
#define rom_base
Definition: mmap_boot.c:8
const struct region_device * boot_device_ro(void)
Definition: mmap_boot.c:13
static const struct mem_region_device boot_dev
Definition: mmap_boot.c:10
#define MEM_REGION_DEV_RO_INIT(base_, size_)
Definition: region.h:208
unsigned int uint32_t
Definition: stdint.h:14
unsigned long uintptr_t
Definition: stdint.h:21
struct region_device rdev
Definition: region.h:184