VxWorks Reference Manual : Libraries
pentiumLib - Pentium and PentiumPro library
pentiumMtrrEnable( ) - enable MTRR (Memory Type Range Register)
pentiumMtrrDisable( ) - disable MTRR (Memory Type Range Register)
pentiumMtrrGet( ) - get MTRRs to a specified MTRR table
pentiumMtrrSet( ) - set MTRRs from specified MTRR table with WRMSR instruction.
This library provides Pentium and PentiumPro specific routines.
MTRR (Memory Type Range Register) are a new feature introduced in the PentiumPro processor that allow the processor to optimize memory operations for different types of memory, such as RAM, ROM, frame buffer memory, and memory-mapped IO. MTRRs configure an internal map of how physical address ranges are mapped to various types of memory. The processor uses this internal map to determine the cacheability of various physical memory locations and the optimal method of accessing memory locations. For example, if a memory location is specified in an MTRR as write-through memory, the processor handles accesses to this location as follows. It reads data from that location in lines and caches the read data or maps all writes to that location to the bus and updates the cache to maintain cache coherency. In mapping the physical address space with MTRRs, the processor recognizes five types of memory: uncacheable (UC), write-combining (WC), write-through (WT), write-protected (WP), and write-back (WB).
There is one table - sysMtrr[] in sysLib.c - and four routines to interface the MTRR. These four routines are:
void pentiumMtrrEnable (void) void pentiumMtrrDisable (void) void pentiumMtrrGet ( MTRR * pMtrr /* MTRR table */ ) void pentiumMtrrSet (void) ( MTRR * pMtrr /* MTRR table */ )pentiumMtrrEnable( ) enables MTRR, pentiumMtrrDisable( ) disables MTRR. pentiumMtrrGet( ) gets MTRRs to the specified MTRR table. pentiumMtrrGet( ) sets MTRRs from the specified MTRR table. The MTRR table is defined as follows:typedef struct mtrr_fix /* MTRR - fixed range register */ { char type[8]; /* address range: [0]=0-7 ... [7]=56-63 */ } MTRR_FIX; typedef struct mtrr_var /* MTRR - variable range register */ { long long int base; /* base register */ long long int mask; /* mask register */ } MTRR_VAR; typedef struct mtrr /* MTRR */ { int cap[2]; /* MTRR cap register */ int deftype[2]; /* MTRR defType register */ MTRR_FIX fix[11]; /* MTRR fixed range registers */ MTRR_VAR var[8]; /* MTRR variable range registers */ } MTRR;Fixed Range Register's type array can be one of following memory types. MTRR_UC (uncacheable), MTRR_WC (write-combining), MTRR_WT (write-through), MTRR_WP (write-protected), and MTRR_WB (write-back). MTRR is enabled in sysHwInit( ).
pentiumLib, Pentium, PentiumPro Family Developer's Manual
pentiumMtrrEnable( ) - enable MTRR (Memory Type Range Register)
void pentiumMtrrEnable (void)
This routine enables the MTRR that provide a mechanism for associating the memory types with physical address ranges in system memory.
N/A
pentiumMtrrDisable( ) - disable MTRR (Memory Type Range Register)
void pentiumMtrrDisable (void)
This routine disables the MTRR that provide a mechanism for associating the memory types with physical address ranges in system memory.
N/A
pentiumMtrrGet( ) - get MTRRs to a specified MTRR table
STATUS pentiumMtrrGet ( MTRR * pMtrr /* MTRR table */ )
This routine gets MTRRs to a specified MTRR table with RDMSR instruction. The read MTRRs are CAP register, DEFTYPE register, fixed range MTRRs, and variable range MTRRs.
OK, or ERROR if MTRR is being accessed.
pentiumMtrrSet( ) - set MTRRs from specified MTRR table with WRMSR instruction.
STATUS pentiumMtrrSet ( MTRR * pMtrr /* MTRR table */ )
This routine sets MTRRs from specified MTRR table with WRMSR instruction. The written MTRRs are DEFTYPE register, fixed range MTRRs, and variable range MTRRs.
OK, or ERROR if MTRR is enabled or being accessed.