coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
cbmem.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <cbmem.h>
4 #include <soc/addressmap.h>
5 
6 void *cbmem_top_chipset(void)
7 {
8  static uintptr_t addr;
9 
10  if (addr == 0) {
11  uintptr_t begin_mib;
12  uintptr_t end_mib;
13 
14  memory_in_range_below_4gb(&begin_mib, &end_mib);
15  /* Make sure we consume everything up to 4GIB. */
16  if (end_mib == 4096)
17  addr = ~(uint32_t)0;
18  else
19  addr = end_mib << 20;
20  }
21 
22  return (void *)addr;
23 }
void memory_in_range_below_4gb(uintptr_t *base_mib, uintptr_t *end_mib)
Definition: addressmap.c:219
static u32 addr
Definition: cirrus.c:14
void * cbmem_top_chipset(void)
Definition: cbmem.c:6
unsigned int uint32_t
Definition: stdint.h:14
unsigned long uintptr_t
Definition: stdint.h:21