Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
main.c File Reference
#include <linux/types.h>
#include <linux/stop_machine.h>
#include <linux/kvm_para.h>
#include <linux/uaccess.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/init.h>
#include <linux/sort.h>
#include <linux/cpu.h>
#include <linux/pci.h>
#include <linux/smp.h>
#include <linux/syscore_ops.h>
#include <asm/processor.h>
#include <asm/e820.h>
#include <asm/mtrr.h>
#include <asm/msr.h>
#include "mtrr.h"

Go to the source code of this file.

Data Structures

struct  set_mtrr_data
 
struct  mtrr_value
 

Macros

#define DEBUG
 

Functions

void set_mtrr_ops (const struct mtrr_ops *ops)
 
int mtrr_add_page (unsigned long base, unsigned long size, unsigned int type, bool increment)
 
int mtrr_add (unsigned long base, unsigned long size, unsigned int type, bool increment)
 
 EXPORT_SYMBOL (mtrr_add)
 
int mtrr_del_page (int reg, unsigned long base, unsigned long size)
 
int mtrr_del (int reg, unsigned long base, unsigned long size)
 
 EXPORT_SYMBOL (mtrr_del)
 
void __init mtrr_bp_init (void)
 
void mtrr_ap_init (void)
 
void mtrr_save_state (void)
 
void set_mtrr_aps_delayed_init (void)
 
void mtrr_aps_init (void)
 
void mtrr_bp_restore (void)
 
 subsys_initcall (mtrr_init_finialize)
 

Variables

u32 num_var_ranges
 
unsigned int mtrr_usage_table [MTRR_MAX_VAR_RANGES]
 
u64 size_or_mask
 
u64 size_and_mask
 
struct mtrr_opsmtrr_if
 
int __initdata changed_by_mtrr_cleanup
 

Macro Definition Documentation

#define DEBUG

Definition at line 34 of file main.c.

Function Documentation

EXPORT_SYMBOL ( mtrr_add  )
EXPORT_SYMBOL ( mtrr_del  )
int mtrr_add ( unsigned long  base,
unsigned long  size,
unsigned int  type,
bool  increment 
)

mtrr_add - Add a memory type region : Physical base address of region : Physical size of region : Type of MTRR desired : If this is true do usage counting on the region

Memory type region registers control the caching on newer Intel and non Intel processors. This function allows drivers to request an MTRR is added. The details and hardware specifics of each processor's implementation are hidden from the caller, but nevertheless the caller should expect to need to provide a power of two size on an equivalent power of two boundary.

If the region cannot be added either because all regions are in use or the CPU cannot support it a negative value is returned. On success the register number for this entry is returned, but should be treated as a cookie only.

On a multiprocessor machine the changes are made to all processors. This is required on x86 by the Intel processors.

The available types are

MTRR_TYPE_UNCACHABLE - No caching

MTRR_TYPE_WRBACK - Write data back in bursts whenever

MTRR_TYPE_WRCOMB - Write data back soon but allow bursts

MTRR_TYPE_WRTHROUGH - Cache reads but not writes

BUGS: Needs a quiet flag for the cases where drivers do not mind failures and do not wish system log messages to be sent.

Definition at line 430 of file main.c.

int mtrr_add_page ( unsigned long  base,
unsigned long  size,
unsigned int  type,
bool  increment 
)

mtrr_add_page - Add a memory type region : Physical base address of region in pages (in units of 4 kB!) : Physical size of region in pages (4 kB) : Type of MTRR desired : If this is true do usage counting on the region

Memory type region registers control the caching on newer Intel and non Intel processors. This function allows drivers to request an MTRR is added. The details and hardware specifics of each processor's implementation are hidden from the caller, but nevertheless the caller should expect to need to provide a power of two size on an equivalent power of two boundary.

If the region cannot be added either because all regions are in use or the CPU cannot support it a negative value is returned. On success the register number for this entry is returned, but should be treated as a cookie only.

On a multiprocessor machine the changes are made to all processors. This is required on x86 by the Intel processors.

The available types are

MTRR_TYPE_UNCACHABLE - No caching

MTRR_TYPE_WRBACK - Write data back in bursts whenever

MTRR_TYPE_WRCOMB - Write data back soon but allow bursts

MTRR_TYPE_WRTHROUGH - Cache reads but not writes

BUGS: Needs a quiet flag for the cases where drivers do not mind failures and do not wish system log messages to be sent.

Definition at line 278 of file main.c.

void mtrr_ap_init ( void  )

Definition at line 677 of file main.c.

void mtrr_aps_init ( void  )

Definition at line 716 of file main.c.

void __init mtrr_bp_init ( void  )

mtrr_bp_init - initialize mtrrs on the boot CPU

This needs to be called early; before any of the other CPUs are initialized (i.e. before smp_init()).

Definition at line 593 of file main.c.

void mtrr_bp_restore ( void  )

Definition at line 733 of file main.c.

int mtrr_del ( int  reg,
unsigned long  base,
unsigned long  size 
)

mtrr_del - delete a memory type region : Register returned by mtrr_add : Physical base address : Size of region

If register is supplied then base and size are ignored. This is how drivers should call it.

Releases an MTRR region. If the usage count drops to zero the register is freed and the region returns to default state. On success the register is returned, on failure a negative error code.

Definition at line 519 of file main.c.

int mtrr_del_page ( int  reg,
unsigned long  base,
unsigned long  size 
)

mtrr_del_page - delete a memory type region : Register returned by mtrr_add : Physical base address : Size of region

If register is supplied then base and size are ignored. This is how drivers should call it.

Releases an MTRR region. If the usage count drops to zero the register is freed and the region returns to default state. On success the register is returned, on failure a negative error code.

Definition at line 454 of file main.c.

void mtrr_save_state ( void  )

Save current fixed-range MTRR state of the BSP

Definition at line 700 of file main.c.

void set_mtrr_aps_delayed_init ( void  )

Definition at line 705 of file main.c.

void set_mtrr_ops ( const struct mtrr_ops ops)

Definition at line 72 of file main.c.

subsys_initcall ( mtrr_init_finialize  )

Variable Documentation

int __initdata changed_by_mtrr_cleanup

Definition at line 584 of file main.c.

struct mtrr_ops* mtrr_if

Definition at line 67 of file main.c.

unsigned int mtrr_usage_table[MTRR_MAX_VAR_RANGES]

Definition at line 59 of file main.c.

u32 num_var_ranges

Definition at line 57 of file main.c.

u64 size_and_mask

Definition at line 62 of file main.c.

u64 size_or_mask

Definition at line 62 of file main.c.