Debian Codegraph @

src/northbridge/intel/ironlake/memmap.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #define __SIMPLE_DEVICE__
4
5 #include <arch/romstage.h>
6 #include <device/pci_ops.h>
7 #include <cbmem.h>
8 #include <cpu/x86/mtrr.h>
9 #include <cpu/x86/smm.h>
10 #include <types.h>
11
12 #include "ironlake.h"
13
14 static uintptr_t northbridge_get_tseg_base(void)
15 {
16 /* Base of TSEG is top of usable DRAM */
17 return pci_read_config32(PCI_DEV(0, 0, 0), TSEG);
18 }
19
20 static size_t northbridge_get_tseg_size(void)
21 {
22 return CONFIG_SMM_TSEG_SIZE;
23 }
24
25 uintptr_t cbmem_top_chipset(void)
26 {
27 return northbridge_get_tseg_base();
28 }
29
30 void smm_region(uintptr_t *start, size_t *size)
31 {
32 *start = northbridge_get_tseg_base();
33 *size = northbridge_get_tseg_size();
34 }
35
36 void fill_postcar_frame(struct postcar_frame *pcf)
37 {
38 /* Cache at least 8 MiB below the top of ram, and at most 8 MiB
39 * above top of the ram. This satisfies MTRR alignment requirement
40 * with different TSEG size configurations.
41 */
42 const uintptr_t top_of_ram = ALIGN_DOWN(cbmem_top(), 8 * MiB);
43 postcar_frame_add_mtrr(pcf, top_of_ram - 8*MiB, 8*MiB, MTRR_TYPE_WRBACK);
44 postcar_frame_add_mtrr(pcf, top_of_ram, 8*MiB, MTRR_TYPE_WRBACK);
45 }