coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
pmp.c File Reference
#include <arch/encoding.h>
#include <stdint.h>
#include <arch/pmp.h>
#include <console/console.h>
#include <commonlib/helpers.h>
Include dependency graph for pmp.c:

Go to the source code of this file.

Data Structures

struct  pmpcfg_t
 

Macros

#define GRANULE   (1 << PMP_SHIFT)
 

Functions

static uintptr_t read_pmpcfg (int idx)
 
static void write_pmpcfg (int idx, uintptr_t cfg)
 
static uintptr_t read_pmpaddr (int idx)
 
static void write_pmpaddr (int idx, uintptr_t val)
 
static pmpcfg_t generate_pmp_napot (uintptr_t base, uintptr_t size, uintptr_t flags)
 
static pmpcfg_t generate_pmp_range (uintptr_t base, uintptr_t size, uintptr_t flags)
 
static pmpcfg_t generate_pmp (uintptr_t base, uintptr_t size, uintptr_t flags)
 
static int find_empty_pmp_entry (int is_range)
 
static void mask_pmp_entry_used (int idx)
 
void reset_pmp (void)
 
void setup_pmp (uintptr_t base, uintptr_t size, uintptr_t flags)
 

Variables

static uintptr_t pmp_entry_used_mask
 

Macro Definition Documentation

◆ GRANULE

#define GRANULE   (1 << PMP_SHIFT)

Definition at line 9 of file pmp.c.

Function Documentation

◆ find_empty_pmp_entry()

static int find_empty_pmp_entry ( int  is_range)
static

Definition at line 247 of file pmp.c.

References die(), pmp_entries_num(), and pmp_entry_used_mask.

Referenced by setup_pmp().

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

◆ generate_pmp()

static pmpcfg_t generate_pmp ( uintptr_t  base,
uintptr_t  size,
uintptr_t  flags 
)
static

Definition at line 234 of file pmp.c.

References base, generate_pmp_napot(), generate_pmp_range(), and IS_POWER_OF_2.

Referenced by setup_pmp().

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

◆ generate_pmp_napot()

static pmpcfg_t generate_pmp_napot ( uintptr_t  base,
uintptr_t  size,
uintptr_t  flags 
)
static

Definition at line 210 of file pmp.c.

References pmpcfg_t::address, base, pmpcfg_t::cfg, GRANULE, PMP_L, PMP_NA4, PMP_NAPOT, PMP_R, PMP_SHIFT, PMP_W, PMP_X, and pmpcfg_t::previous_address.

Referenced by generate_pmp().

Here is the caller graph for this function:

◆ generate_pmp_range()

static pmpcfg_t generate_pmp_range ( uintptr_t  base,
uintptr_t  size,
uintptr_t  flags 
)
static

Definition at line 222 of file pmp.c.

References pmpcfg_t::address, base, pmpcfg_t::cfg, PMP_L, PMP_R, PMP_SHIFT, PMP_TOR, PMP_W, PMP_X, and pmpcfg_t::previous_address.

Referenced by generate_pmp().

Here is the caller graph for this function:

◆ mask_pmp_entry_used()

static void mask_pmp_entry_used ( int  idx)
static

Definition at line 272 of file pmp.c.

References pmp_entry_used_mask.

Referenced by setup_pmp().

Here is the caller graph for this function:

◆ read_pmpaddr()

static uintptr_t read_pmpaddr ( int  idx)
static

Definition at line 113 of file pmp.c.

Referenced by write_pmpaddr().

Here is the caller graph for this function:

◆ read_pmpcfg()

static uintptr_t read_pmpcfg ( int  idx)
static

Definition at line 32 of file pmp.c.

Referenced by reset_pmp(), and write_pmpcfg().

Here is the caller graph for this function:

◆ reset_pmp()

void reset_pmp ( void  )

Definition at line 278 of file pmp.c.

References die(), pmp_entries_num(), PMP_L, read_pmpcfg(), write_pmpaddr(), and write_pmpcfg().

Here is the call graph for this function:

◆ setup_pmp()

void setup_pmp ( uintptr_t  base,
uintptr_t  size,
uintptr_t  flags 
)

◆ write_pmpaddr()

static void write_pmpaddr ( int  idx,
uintptr_t  val 
)
static

Definition at line 153 of file pmp.c.

References die(), read_pmpaddr(), and val.

Referenced by reset_pmp(), and setup_pmp().

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

◆ write_pmpcfg()

static void write_pmpcfg ( int  idx,
uintptr_t  cfg 
)
static

Definition at line 59 of file pmp.c.

References die(), and read_pmpcfg().

Referenced by reset_pmp(), and setup_pmp().

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

Variable Documentation

◆ pmp_entry_used_mask

uintptr_t pmp_entry_used_mask
static

Definition at line 29 of file pmp.c.

Referenced by find_empty_pmp_entry(), and mask_pmp_entry_used().