VxWorks Reference Manual : Libraries

pentiumLib

NAME

pentiumLib - Pentium and PentiumPro library

ROUTINES

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.

DESCRIPTION

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( ).

SEE ALSO

pentiumLib, Pentium, PentiumPro Family Developer's Manual


Libraries : Routines

pentiumMtrrEnable( )

NAME

pentiumMtrrEnable( ) - enable MTRR (Memory Type Range Register)

SYNOPSIS


void pentiumMtrrEnable (void)

DESCRIPTION

This routine enables the MTRR that provide a mechanism for associating the memory types with physical address ranges in system memory.

RETURNS

N/A

SEE ALSO

pentiumLib


Libraries : Routines

pentiumMtrrDisable( )

NAME

pentiumMtrrDisable( ) - disable MTRR (Memory Type Range Register)

SYNOPSIS


void pentiumMtrrDisable (void)

DESCRIPTION

This routine disables the MTRR that provide a mechanism for associating the memory types with physical address ranges in system memory.

RETURNS

N/A

SEE ALSO

pentiumLib


Libraries : Routines

pentiumMtrrGet( )

NAME

pentiumMtrrGet( ) - get MTRRs to a specified MTRR table

SYNOPSIS

STATUS pentiumMtrrGet
    (
    MTRR * pMtrr /* MTRR table */
    )

DESCRIPTION

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.

RETURNS

OK, or ERROR if MTRR is being accessed.

SEE ALSO

pentiumLib


Libraries : Routines

pentiumMtrrSet( )

NAME

pentiumMtrrSet( ) - set MTRRs from specified MTRR table with WRMSR instruction.

SYNOPSIS

STATUS pentiumMtrrSet
    (
    MTRR * pMtrr /* MTRR table */
    )

DESCRIPTION

This routine sets MTRRs from specified MTRR table with WRMSR instruction. The written MTRRs are DEFTYPE register, fixed range MTRRs, and variable range MTRRs.

RETURNS

OK, or ERROR if MTRR is enabled or being accessed.

SEE ALSO

pentiumLib