coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
mtrr.h File Reference
#include <cpu/x86/msr.h>
#include <stdint.h>
Include dependency graph for mtrr.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MTRR_IORR0_BASE   0xC0010016
 
#define MTRR_IORR0_MASK   0xC0010017
 
#define MTRR_IORR1_BASE   0xC0010018
 
#define MTRR_IORR1_MASK   0xC0010019
 
#define MTRR_READ_MEM   (1 << 4)
 
#define MTRR_WRITE_MEM   (1 << 3)
 
#define SYSCFG_MSR   0xC0010010
 
#define SYSCFG_MSR_TOM2WB   (1 << 22)
 
#define SYSCFG_MSR_TOM2En   (1 << 21)
 
#define SYSCFG_MSR_MtrrVarDramEn   (1 << 20)
 
#define SYSCFG_MSR_MtrrFixDramModEn   (1 << 19)
 
#define SYSCFG_MSR_MtrrFixDramEn   (1 << 18)
 
#define SYSCFG_MSR_UcLockEn   (1 << 17)
 
#define SYSCFG_MSR_ChxToDirtyDis   (1 << 16)
 
#define SYSCFG_MSR_ClVicBlkEn   (1 << 11)
 
#define SYSCFG_MSR_SetDirtyEnO   (1 << 10)
 
#define SYSCFG_MSR_SetDirtyEnS   (1 << 9)
 
#define SYSCFG_MSR_SetDirtyEnE   (1 << 8)
 
#define SYSCFG_MSR_SysVicLimitMask   ((1 << 8) - (1 << 5))
 
#define SYSCFG_MSR_SysAckLimitMask   ((1 << 5) - (1 << 0))
 
#define IORRBase_MSR(reg)   (0xC0010016 + 2 * (reg))
 
#define IORRMask_MSR(reg)   (0xC0010016 + 2 * (reg) + 1)
 
#define TOP_MEM   0xC001001Aul
 
#define TOP_MEM2   0xC001001Dul
 
#define TOP_MEM_MASK   0x007fffff
 
#define TOP_MEM_MASK_KB   (TOP_MEM_MASK >> 10)
 

Functions

void add_uma_resource_below_tolm (struct device *nb, int idx)
 
static __always_inline msr_t rdmsr_amd (unsigned int index)
 
static __always_inline void wrmsr_amd (unsigned int index, msr_t msr)
 
static uint64_t amd_topmem (void)
 
static uint64_t amd_topmem2 (void)
 

Macro Definition Documentation

◆ IORRBase_MSR

#define IORRBase_MSR (   reg)    (0xC0010016 + 2 * (reg))

Definition at line 27 of file mtrr.h.

◆ IORRMask_MSR

#define IORRMask_MSR (   reg)    (0xC0010016 + 2 * (reg) + 1)

Definition at line 28 of file mtrr.h.

◆ MTRR_IORR0_BASE

#define MTRR_IORR0_BASE   0xC0010016

Definition at line 4 of file mtrr.h.

◆ MTRR_IORR0_MASK

#define MTRR_IORR0_MASK   0xC0010017

Definition at line 5 of file mtrr.h.

◆ MTRR_IORR1_BASE

#define MTRR_IORR1_BASE   0xC0010018

Definition at line 6 of file mtrr.h.

◆ MTRR_IORR1_MASK

#define MTRR_IORR1_MASK   0xC0010019

Definition at line 7 of file mtrr.h.

◆ MTRR_READ_MEM

#define MTRR_READ_MEM   (1 << 4)

Definition at line 9 of file mtrr.h.

◆ MTRR_WRITE_MEM

#define MTRR_WRITE_MEM   (1 << 3)

Definition at line 10 of file mtrr.h.

◆ SYSCFG_MSR

#define SYSCFG_MSR   0xC0010010

Definition at line 12 of file mtrr.h.

◆ SYSCFG_MSR_ChxToDirtyDis

#define SYSCFG_MSR_ChxToDirtyDis   (1 << 16)

Definition at line 19 of file mtrr.h.

◆ SYSCFG_MSR_ClVicBlkEn

#define SYSCFG_MSR_ClVicBlkEn   (1 << 11)

Definition at line 20 of file mtrr.h.

◆ SYSCFG_MSR_MtrrFixDramEn

#define SYSCFG_MSR_MtrrFixDramEn   (1 << 18)

Definition at line 17 of file mtrr.h.

◆ SYSCFG_MSR_MtrrFixDramModEn

#define SYSCFG_MSR_MtrrFixDramModEn   (1 << 19)

Definition at line 16 of file mtrr.h.

◆ SYSCFG_MSR_MtrrVarDramEn

#define SYSCFG_MSR_MtrrVarDramEn   (1 << 20)

Definition at line 15 of file mtrr.h.

◆ SYSCFG_MSR_SetDirtyEnE

#define SYSCFG_MSR_SetDirtyEnE   (1 << 8)

Definition at line 23 of file mtrr.h.

◆ SYSCFG_MSR_SetDirtyEnO

#define SYSCFG_MSR_SetDirtyEnO   (1 << 10)

Definition at line 21 of file mtrr.h.

◆ SYSCFG_MSR_SetDirtyEnS

#define SYSCFG_MSR_SetDirtyEnS   (1 << 9)

Definition at line 22 of file mtrr.h.

◆ SYSCFG_MSR_SysAckLimitMask

#define SYSCFG_MSR_SysAckLimitMask   ((1 << 5) - (1 << 0))

Definition at line 25 of file mtrr.h.

◆ SYSCFG_MSR_SysVicLimitMask

#define SYSCFG_MSR_SysVicLimitMask   ((1 << 8) - (1 << 5))

Definition at line 24 of file mtrr.h.

◆ SYSCFG_MSR_TOM2En

#define SYSCFG_MSR_TOM2En   (1 << 21)

Definition at line 14 of file mtrr.h.

◆ SYSCFG_MSR_TOM2WB

#define SYSCFG_MSR_TOM2WB   (1 << 22)

Definition at line 13 of file mtrr.h.

◆ SYSCFG_MSR_UcLockEn

#define SYSCFG_MSR_UcLockEn   (1 << 17)

Definition at line 18 of file mtrr.h.

◆ TOP_MEM

#define TOP_MEM   0xC001001Aul

Definition at line 34 of file mtrr.h.

◆ TOP_MEM2

#define TOP_MEM2   0xC001001Dul

Definition at line 35 of file mtrr.h.

◆ TOP_MEM_MASK

#define TOP_MEM_MASK   0x007fffff

Definition at line 38 of file mtrr.h.

◆ TOP_MEM_MASK_KB

#define TOP_MEM_MASK_KB   (TOP_MEM_MASK >> 10)

Definition at line 39 of file mtrr.h.

Function Documentation

◆ add_uma_resource_below_tolm()

void add_uma_resource_below_tolm ( struct device nb,
int  idx 
)

Definition at line 8 of file amd_mtrr.c.

References amd_topmem(), BIOS_INFO, KiB, printk, restore_top_of_low_cacheable(), and uma_resource.

Referenced by domain_read_resources(), and domain_set_resources().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ amd_topmem()

static uint64_t amd_topmem ( void  )
inlinestatic

Definition at line 69 of file mtrr.h.

References msr_struct::lo, rdmsr(), and TOP_MEM.

Referenced by add_uma_resource_below_tolm(), amd_initcpuio(), and domain_read_resources().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ amd_topmem2()

static uint64_t amd_topmem2 ( void  )
inlinestatic

Definition at line 74 of file mtrr.h.

References msr_struct::hi, msr_struct::lo, rdmsr(), and TOP_MEM2.

Referenced by domain_read_resources(), and domain_set_resources().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdmsr_amd()

static __always_inline msr_t rdmsr_amd ( unsigned int  index)
static

Definition at line 49 of file mtrr.h.

◆ wrmsr_amd()

static __always_inline void wrmsr_amd ( unsigned int  index,
msr_t  msr 
)
static

Definition at line 60 of file mtrr.h.

References msr_struct::hi, and msr_struct::lo.