coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
memmap.c
Go to the documentation of this file.
1
/* SPDX-License-Identifier: GPL-2.0-only */
2
3
// Use simple device model for this file even in ramstage
4
#define __SIMPLE_DEVICE__
5
6
#include <
device/pci_ops.h
>
7
#include <
arch/romstage.h
>
8
#include <
cbmem.h
>
9
#include <
cpu/x86/mtrr.h
>
10
#include <
program_loading.h
>
11
#include "
e7505.h
"
12
13
void
*
cbmem_top_chipset
(
void
)
14
{
15
const
pci_devfn_t
mch =
PCI_DEV
(0, 0, 0);
16
uintptr_t
tolm;
17
18
/* This is at 128 MiB boundary. */
19
tolm =
pci_read_config16
(mch,
TOLM
) >> 11;
20
tolm <<= 27;
21
22
return
(
void
*)tolm;
23
}
24
25
void
northbridge_write_smram
(
u8
smram);
26
27
void
northbridge_write_smram
(
u8
smram)
28
{
29
const
pci_devfn_t
mch =
PCI_DEV
(0, 0, 0);
30
pci_write_config8
(mch,
SMRAMC
, smram);
31
}
32
33
void
fill_postcar_frame
(
struct
postcar_frame
*pcf)
34
{
35
uintptr_t
top_of_ram;
36
37
/*
38
* Choose to NOT set ROM as WP cacheable here.
39
* Timestamps indicate the CPU this northbridge code is
40
* connected to, performs better for memcpy() and un-lzma
41
* operations when source is left as UC.
42
*/
43
44
pcf->
skip_common_mtrr
= 1;
45
46
/* Cache RAM as WB from 0 -> CACHE_TMP_RAMTOP. */
47
postcar_frame_add_mtrr
(pcf, 0,
CACHE_TMP_RAMTOP
,
MTRR_TYPE_WRBACK
);
48
49
/* Cache CBMEM region as WB. */
50
top_of_ram = (
uintptr_t
)
cbmem_top
();
51
postcar_frame_add_mtrr
(pcf, top_of_ram - 8*
MiB
, 8*
MiB
,
52
MTRR_TYPE_WRBACK
);
53
}
romstage.h
postcar_frame_add_mtrr
void postcar_frame_add_mtrr(struct postcar_frame *pcf, uintptr_t addr, size_t size, int type)
Definition:
postcar_loader.c:71
MiB
#define MiB
Definition:
helpers.h:76
cbmem.h
cbmem_top
void * cbmem_top(void)
Definition:
imd_cbmem.c:18
e7505.h
TOLM
#define TOLM
Definition:
e7505.h:34
pci_ops.h
pci_read_config16
static __always_inline u16 pci_read_config16(const struct device *dev, u16 reg)
Definition:
pci_ops.h:52
pci_write_config8
static __always_inline void pci_write_config8(const struct device *dev, u16 reg, u8 val)
Definition:
pci_ops.h:64
cbmem_top_chipset
void * cbmem_top_chipset(void)
Definition:
memmap.c:44
fill_postcar_frame
void fill_postcar_frame(struct postcar_frame *pcf)
Definition:
memmap.c:63
SMRAMC
#define SMRAMC
Definition:
memmap.c:39
northbridge_write_smram
void northbridge_write_smram(u8 smram)
Definition:
memmap.c:27
PCI_DEV
#define PCI_DEV(SEGBUS, DEV, FN)
Definition:
pci_type.h:14
pci_devfn_t
u32 pci_devfn_t
Definition:
pci_type.h:8
program_loading.h
uintptr_t
unsigned long uintptr_t
Definition:
stdint.h:21
u8
uint8_t u8
Definition:
stdint.h:45
postcar_frame
Definition:
romstage.h:18
postcar_frame::skip_common_mtrr
int skip_common_mtrr
Definition:
romstage.h:20
mtrr.h
CACHE_TMP_RAMTOP
#define CACHE_TMP_RAMTOP
Definition:
mtrr.h:194
MTRR_TYPE_WRBACK
#define MTRR_TYPE_WRBACK
Definition:
mtrr.h:14
src
northbridge
intel
e7505
memmap.c
Generated by
1.9.1