FreeBSD kernel kern code
subr_physmem.c File Reference
#include <sys/cdefs.h>
#include "opt_acpi.h"
#include "opt_ddb.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/physmem.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
#include <vm/vm_page.h>
#include <vm/vm_phys.h>
#include <vm/vm_dumpset.h>
#include <machine/md_var.h>
Include dependency graph for subr_physmem.c:

Go to the source code of this file.

Data Structures

struct  region
 

Macros

#define MAX_HWCNT   16
 
#define MAX_EXCNT   16
 

Functions

 __FBSDID ("$FreeBSD$")
 
static void physmem_dump_tables (int(*prfunc)(const char *,...))
 
void physmem_print_tables (void)
 
static size_t regions_to_avail (vm_paddr_t *avail, uint32_t exflags, size_t maxavail, uint64_t maxphyssz, long *pavail, long *prealmem)
 
static size_t merge_upper_regions (struct region *regions, size_t rcnt, size_t idx)
 
static size_t insert_region (struct region *regions, size_t rcnt, vm_paddr_t addr, vm_size_t size, uint32_t flags)
 
void physmem_hardware_region (uint64_t pa, uint64_t sz)
 
void physmem_exclude_region (vm_paddr_t pa, vm_size_t sz, uint32_t exflags)
 
size_t physmem_avail (vm_paddr_t *avail, size_t maxavail)
 
void physmem_init_kernel_globals (void)
 

Variables

static struct region hwregions [MAX_HWCNT]
 
static struct region exregions [MAX_EXCNT]
 
static size_t hwcnt
 
static size_t excnt
 
long realmem
 
long Maxmem
 

Macro Definition Documentation

◆ MAX_EXCNT

#define MAX_EXCNT   16

Definition at line 62 of file subr_physmem.c.

◆ MAX_HWCNT

#define MAX_HWCNT   16

Definition at line 61 of file subr_physmem.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ insert_region()

static size_t insert_region ( struct region regions,
size_t  rcnt,
vm_paddr_t  addr,
vm_size_t  size,
uint32_t  flags 
)
static

Definition at line 338 of file subr_physmem.c.

References addr, region::addr, region::flags, flags, merge_upper_regions(), and region::size.

Referenced by physmem_exclude_region(), and physmem_hardware_region().

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

◆ merge_upper_regions()

static size_t merge_upper_regions ( struct region regions,
size_t  rcnt,
size_t  idx 
)
static

Definition at line 277 of file subr_physmem.c.

References addr, region::addr, region::flags, and region::size.

Referenced by insert_region().

Here is the caller graph for this function:

◆ physmem_avail()

size_t physmem_avail ( vm_paddr_t *  avail,
size_t  maxavail 
)

Definition at line 465 of file subr_physmem.c.

References regions_to_avail().

Here is the call graph for this function:

◆ physmem_dump_tables()

static void physmem_dump_tables ( int(*)(const char *,...)  prfunc)
static

Definition at line 96 of file subr_physmem.c.

References addr, region::addr, excnt, exregions, region::flags, flags, hwcnt, hwregions, and region::size.

Referenced by physmem_print_tables().

Here is the caller graph for this function:

◆ physmem_exclude_region()

void physmem_exclude_region ( vm_paddr_t  pa,
vm_size_t  sz,
uint32_t  exflags 
)

Definition at line 446 of file subr_physmem.c.

References excnt, exregions, insert_region(), and panic().

Here is the call graph for this function:

◆ physmem_hardware_region()

void physmem_hardware_region ( uint64_t  pa,
uint64_t  sz 
)

Definition at line 394 of file subr_physmem.c.

References hwcnt, hwregions, and insert_region().

Here is the call graph for this function:

◆ physmem_init_kernel_globals()

void physmem_init_kernel_globals ( void  )

Definition at line 481 of file subr_physmem.c.

References Maxmem, panic(), realmem, and regions_to_avail().

Here is the call graph for this function:

◆ physmem_print_tables()

void physmem_print_tables ( void  )

Definition at line 136 of file subr_physmem.c.

References physmem_dump_tables(), and printf().

Here is the call graph for this function:

◆ regions_to_avail()

static size_t regions_to_avail ( vm_paddr_t *  avail,
uint32_t  exflags,
size_t  maxavail,
uint64_t  maxphyssz,
long *  pavail,
long *  prealmem 
)
static

Definition at line 155 of file subr_physmem.c.

References region::addr, excnt, exregions, region::flags, hwcnt, hwregions, panic(), region::size, and start.

Referenced by physmem_avail(), and physmem_init_kernel_globals().

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

Variable Documentation

◆ excnt

size_t excnt
static

Definition at line 81 of file subr_physmem.c.

Referenced by physmem_dump_tables(), physmem_exclude_region(), and regions_to_avail().

◆ exregions

struct region exregions[MAX_EXCNT]
static

Definition at line 78 of file subr_physmem.c.

Referenced by physmem_dump_tables(), physmem_exclude_region(), and regions_to_avail().

◆ hwcnt

size_t hwcnt
static

Definition at line 80 of file subr_physmem.c.

Referenced by physmem_dump_tables(), physmem_hardware_region(), and regions_to_avail().

◆ hwregions

struct region hwregions[MAX_HWCNT]
static

Definition at line 77 of file subr_physmem.c.

Referenced by physmem_dump_tables(), physmem_hardware_region(), and regions_to_avail().

◆ Maxmem

long Maxmem

Definition at line 88 of file subr_physmem.c.

Referenced by physmem_init_kernel_globals().

◆ realmem

long realmem

Definition at line 87 of file subr_physmem.c.

Referenced by physmem_init_kernel_globals(), sysctl_hw_realmem(), and tunable_mbinit().