coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
|
#include <cbfs.h>
#include <commonlib/helpers.h>
#include <console/console.h>
#include <arch/cpu.h>
#include <cpu/x86/cr.h>
#include <cpu/x86/msr.h>
#include <cpu/x86/pae.h>
#include <string.h>
#include <symbols.h>
#include <assert.h>
Go to the source code of this file.
Data Structures | |
struct | pde |
struct | pg_table |
Macros | |
#define | PDPTE_PRES (1ULL << 0) |
#define | PDPTE_ADDR_MASK (~((1ULL << 12) - 1)) |
#define | PDE_PRES (1ULL << 0) |
#define | PDE_RW (1ULL << 1) |
#define | PDE_US (1ULL << 2) |
#define | PDE_PWT (1ULL << 3) |
#define | PDE_PCD (1ULL << 4) |
#define | PDE_A (1ULL << 5) |
#define | PDE_D (1ULL << 6) |
#define | PDE_PS (1ULL << 7) |
#define | PDE_G (1ULL << 8) |
#define | PDE_PAT (1ULL << 12) |
#define | PDE_XD (1ULL << 63) |
#define | PDE_ADDR_MASK (~((1ULL << 12) - 1)) |
#define | PTE_PRES (1ULL << 0) |
#define | PTE_RW (1ULL << 1) |
#define | PTE_US (1ULL << 2) |
#define | PTE_PWT (1ULL << 3) |
#define | PTE_PCD (1ULL << 4) |
#define | PTE_A (1ULL << 5) |
#define | PTE_D (1ULL << 6) |
#define | PTE_PAT (1ULL << 7) |
#define | PTE_G (1ULL << 8) |
#define | PTE_XD (1ULL << 63) |
#define | PDPTE_IDX_SHIFT 30 |
#define | PDPTE_IDX_MASK 0x3 |
#define | PDE_IDX_SHIFT 21 |
#define | PDE_IDX_MASK 0x1ff |
#define | PTE_IDX_SHIFT 12 |
#define | PTE_IDX_MASK 0x1ff |
#define | OVERLAP(a, b, s, e) ((b) > (s) && (a) < (e)) |
Functions | |
void | paging_enable_pae_cr3 (uintptr_t cr3) |
void | paging_enable_pae (void) |
void | paging_disable_pae (void) |
int | memset_pae (uint64_t dest, unsigned char pat, uint64_t length, void *pgtbl, void *vmem_addr) |
void | paging_set_nxe (int enable) |
void | paging_set_pat (uint64_t pat) |
void | paging_set_default_pat (void) |
int | paging_enable_for_car (const char *pdpt_name, const char *pt_name) |
static void * | get_pdpt_addr (void) |
static uint64_t | pde_pat_flags (int pat) |
static uint64_t | pde_page_flags (int pat) |
static uint64_t | pte_pat_flags (int pat) |
static uint64_t | pte_page_flags (int pat) |
static int | identity_map_one_page (uintptr_t base, size_t size, int pat, int commit) |
static int | _paging_identity_map_addr (uintptr_t base, size_t size, int pat, int commit) |
static int | paging_is_enabled (void) |
int | paging_identity_map_addr (uintptr_t base, size_t size, int pat) |
Variables | |
static const size_t | s2MiB = 2 * MiB |
static const size_t | s4KiB = 4 * KiB |
struct pde | __packed |
Definition at line 470 of file pgtbl.c.
References base, identity_map_one_page(), IS_ALIGNED, MIN, s2MiB, and s4KiB.
Referenced by paging_identity_map_addr().
Definition at line 344 of file pgtbl.c.
References preram_symbols_available(), and read_cr3().
Referenced by identity_map_one_page().
Definition at line 409 of file pgtbl.c.
References base, BIOS_ERR, get_pdpt_addr(), PDE_ADDR_MASK, PDE_IDX_MASK, PDE_IDX_SHIFT, pde_page_flags(), PDE_PRES, PDE_PS, PDPTE_ADDR_MASK, PDPTE_IDX_MASK, PDPTE_IDX_SHIFT, PDPTE_PRES, printk, PTE_IDX_MASK, PTE_IDX_SHIFT, pte_page_flags(), s2MiB, and s4KiB.
Referenced by _paging_identity_map_addr().
int memset_pae | ( | uint64_t | dest, |
unsigned char | pat, | ||
uint64_t | length, | ||
void * | pgtbl, | ||
void * | vmem_addr | ||
) |
Definition at line 130 of file pgtbl.c.
References pde::addr_hi, pde::addr_lo, ALIGN_DOWN, BIOS_DEBUG, BIOS_ERR, BIOS_SPEW, IS_ALIGNED, length, memset(), MIN, offset, OVERLAP, paging_disable_pae(), paging_enable_pae_cr3(), pg_table::pd, PDE_IDX_SHIFT, PDE_PRES, PDE_PS, PDE_RW, pg_table::pdp, PDPTE_PRES, printk, s2MiB, and s4KiB.
Definition at line 87 of file pgtbl.c.
References CR0_PG, CR4_PAE, CRx_TYPE, read_cr0(), read_cr4(), write_cr0(), and write_cr4().
Referenced by memset_pae().
int paging_enable_for_car | ( | const char * | pdpt_name, |
const char * | pt_name | ||
) |
Definition at line 324 of file pgtbl.c.
References BIOS_ERR, cbfs_load(), paging_enable_pae_cr3(), preram_symbols_available(), printk, and REGION_SIZE.
Referenced by bootblock_soc_early_init().
Definition at line 71 of file pgtbl.c.
References CR0_PG, CR4_PAE, CRx_TYPE, read_cr0(), read_cr4(), write_cr0(), and write_cr4().
Referenced by paging_enable_pae_cr3().
Definition at line 64 of file pgtbl.c.
References paging_enable_pae(), and write_cr3().
Referenced by memset_pae(), and paging_enable_for_car().
Definition at line 494 of file pgtbl.c.
References _paging_identity_map_addr(), base, BIOS_ERR, IS_ALIGNED, paging_is_enabled(), printk, s2MiB, and s4KiB.
|
static |
Definition at line 489 of file pgtbl.c.
References CR0_PG, and read_cr0().
Referenced by paging_identity_map_addr().
Definition at line 315 of file pgtbl.c.
References paging_set_pat(), PAT_ENCODE, UC, WB, WC, WP, and WT.
Referenced by bootblock_soc_early_init().
void paging_set_nxe | ( | int | enable | ) |
Definition at line 279 of file pgtbl.c.
References EFER_NXE, IA32_EFER, msr_struct::lo, rdmsr(), and wrmsr().
Referenced by bootblock_soc_early_init().
Definition at line 291 of file pgtbl.c.
References msr_struct::hi, IA32_PAT, msr_struct::lo, and wrmsr().
Referenced by paging_set_default_pat().
|
static |
Definition at line 372 of file pgtbl.c.
References PDE_A, PDE_D, pde_pat_flags(), PDE_PRES, PDE_PS, and PDE_RW.
Referenced by identity_map_one_page().
|
static |
|
static |
Definition at line 400 of file pgtbl.c.
References PTE_A, PTE_D, pte_pat_flags(), PTE_PRES, and PTE_RW.
Referenced by identity_map_one_page().
|
static |
Definition at line 52 of file pgtbl.c.
Referenced by _paging_identity_map_addr(), identity_map_one_page(), memset_pae(), and paging_identity_map_addr().
Definition at line 53 of file pgtbl.c.
Referenced by _paging_identity_map_addr(), identity_map_one_page(), memset_pae(), and paging_identity_map_addr().