Intel P6 / AMD K7 MTRRs management IOCtl PDD, ver.0.08

Copyright (c) 1999-2002 Takayuki 'January June' Suwa / Beliefia Productions


0. Table of Contents



1. Welcome

P6K7MTRR.sys is a simple interface physical device driver (PDD) that can manage Memory Type Range Registers (MTRRs) of Intel P6* / AMD K7** series processors. Programmer can query / modify any MTRR settings via DosDevIOCtl() API, from non-Ring0 privileges.
A sample executable, VFBWC.exe, sets MTRR write-combining strategy to video frame buffer aperture. It can often improve graphic performance, especially DIVE.
Free to use, under the GNU LGPL.

* P6 includes PentiumPro, PentiumII, Celeron and PentiumIII.
** K7 includes Athlon and Duron.

1.1. Copyright and Disclaimer

  1. 'THIS SOFTWARE AND WHOLE SET OF DOCUMENTS' (CALLED 'THE PACKAGE') ARE ENTIRELY COPYRIGHTED BY TAKAYUKI 'JANUARY JUNE' SUWA / BELIEFIA PRODUCTIONS, AUTHOR / HOLDER OF THE PRODUCT.
  2. THIS PACKAGE IS DISTRIBUTED UNDER THE "GNU LESSER PUBLIC LICENSE" (LGPL). IT CLAIMS: SEE "COPYING" FOR DETAIL.
  3. THE PACKAGE IS PROVIDED 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  4. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES, WHETHER IN CONTRACT OR TORT (INCLUDED NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE PRODUCT, EVEN THOUGH SUCH HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF ANY DAMAGE.

1.2. System Requirements

This software will be functioned in environment such as:
If used for development purpose, some P6 / K7 MTRRs knowledge are of course required.

1.3. Contact Author

Email to Takayuki 'January June' Suwa:

1.4. Revision History



2. How to Use


2.1. Driver Installation

  1. Unzip archive to where you desire. (e.g. C:\P6K7MTRR)
  2. Add
    DEVICE=d:\path\P6K7MTRR.sys
    line to your CONFIG.SYS. (d and path must be replaced with actual installation drive / path)
  3. Restart your system. If installation successfully, you will see:
    P6K7MTRR.sys - Intel P6 / AMD K7 MTRRs management IOCtl PDD, ver.0.08
    Copyright (c) 1999-2002 Takayuki 'January June' Suwa
    Intel P6 MTRR feature is found. The driver has been installed.
    or
    P6K7MTRR.sys - Intel P6 / AMD K7 MTRRs management IOCtl PDD, ver.0.08
    Copyright (c) 1999-2002 Takayuki 'January June' Suwa
    AMD K7 MTRR feature is found. The driver has been installed.
    After restarting, you will found:
    Driver: P6K7MTRR.sys  -  Intel P6 / AMD K7 MTRRs management IOCtl PDD
    Vendor: Takayuki 'January June' Suwa  Version: 1.1  Date (MDY): 5/18/2002
    Flag:   STATIC     Type-Subtype: OS2 - HELPER
    in rmview /d listing when resource manager-aware environments.
  4. In order not to show any messages, add /Q switch:
    DEVICE=d:\path\P6K7MTRR.sys /Q

2.2. How to Apply Write-Combining to Video Frame Buffer Aperture

  1. Run VFBWC.exe from Presentation Manager-aware environment such as WPS OS/2 Windowed VIO. You will see such as:
    VFBWC.exe - Video Frame Buffer to Write-Combining for P6K7MTRR.sys, ver.0.08e
    Copyright 1999-2002 Takayuki 'January June' Suwa.
     
    main memory :
      81920 pages @ 0x00000000, 327680kB -> write-back, valid
    video frame buffer aperture :
      576 pages @ 0xe6000000, 2304kB -> write-combining, valid
    VGA region (32 pages @ 0x000a0000, 128kB) : as-is
     
    in order to apply this setting, rerun with -a option.
    In this example, video frame buffer aperture PhysAddr is 0xe6000000 and Pages is 576.
  2. If detection seems true, rerun VFBWC.exe with -a option.
    If seems false, add proper PhysAddr in hexadecimal and Pages in decimal such as:
    VFBWC e6000000 1024 -a
    In this example, "e6000000" is PhysAddr, and "1024" is Pages.
    You will see:
    setting has been applied.
    On Warp4.5-based multiprocessor environments, VFBWC will detect all available CPUs and apply to them automatically.
  3. To apply automatically during startup sequence, add
    RUN=d:\path\VFBWC.exe PhysAddr Pages -a
    line to your CONFIG.SYS. (d and path must be replaced with actual installation drive/path)
    Use of CALL= statement is NOT recommended, especially on Warp4.5-based multiprocessor environments (causes hang-up).
    In this case PhysAddr and Pages also must be specified, because autodetection cannot be used in pre-Presentation Manager environment.
    And, for laptop/notebook machines,
    RUN=d:\path\VFBWC.exe PhysAddr Pages -a -d
    to re-apply automatically after APM suspend resuming.
  4. Run VFBWC.exe with -?, and you will see usage summary and other options:
    usage:
      VFBWC.exe  [-options]  [{PhysAddr in hexadecimal}  {Pages in decimal}]
        PhysAddr/Pages is not specified, VFBWC will try to detect physical
        address/pages of video frame buffer aperture.
        (requires Presentation Manager activity)
    options:
      -1  rounds Pages up to 1MB granule
      -a  applies settings to MTTRs actually
      -b  rings beep when setting is applied
      -d  goes into daemon mode, waits until APM suspend resuming and re-apply
      -i  turns to invalid settings to video frame buffer aperture /
            uncacheable to VGA region
      -v  also applies write-combining to VGA region
      -?  displays this message


3. P6K7MTRR.sys Device IOCtl Reference


3.1. Constants and Structures

All constants and structures needed for development are defined in P6K7MTRR.h. See also.

3.2. Precautions and Limitations


3.3. DosDevIOCtl() Interface


3.3.1. P6K7MTRR_SETMTRR2DEFAULT (40h)

Category:
IOCTL_P6K7MTRR (c4h)
Function:
P6K7MTRR_SETMTRR2DEFAULT (40h)
Desctiption:
Set all MTRR settings to default
Parameter Packet Format:
None. This pointer should be NULL.
Data Packet Format:
None. This pointer should be NULL.
Returns:
NO_ERROR
Success.
ERROR_I24_INVALID_PARAMETER
Not supported.
Remarks:
In this function, 'default' means a set of all MTRR settings at initialization of P6K7MTRR.sys during startup sequence.

3.3.2. P6K7MTRR_SETMTRRDEFTYPE (41h)

Category:
IOCTL_P6K7MTRR (c4h)
Function:
P6K7MTRR_SETMTRRDEFTYPE (41h)
Desctiption:
Set MTRR default type
Parameter Packet Format:
None. This pointer should be NULL.
Data Packet Format:
P6K7MTRRDEFTYPEDATA. See also P6K7MTRR.h.
Returns:
NO_ERROR
Success.
ERROR_I24_INVALID_PARAMETER
Wrong default memory type is specified.
Remarks:
MTRR enabled flag cannot be 0, because of restriction of P6K7MTRR.sys.

3.3.3. P6K7MTRR_SETMTRRFIXEDRANGE (42h)

Category:
IOCTL_P6K7MTRR (c4h)
Function:
P6K7MTRR_SETMTRRFIXEDRANGE (42h)
Desctiption:
Set MTRR fixed ranges
Parameter Packet Format:
None. This pointer should be NULL.
Data Packet Format:
P6K7MTRRFIXEDRANGEDATA. See also P6K7MTRR.h.
Returns:
NO_ERROR
Success.
ERROR_I24_INVALID_PARAMETER
Wrong memory types are specified.
Remarks:
None.

3.3.4. P6K7MTRR_SETMTRRVARIABLERANGE (43h)

Category:
IOCTL_P6K7MTRR (c4h)
Function:
P6K7MTRR_SETMTRRVARIABLERANGE (43h)
Desctiption:
Set MTRR variable range
Parameter Packet Format:
P6K7MTRRVARIABLERANGEPARM. See also P6K7MTRR.h.
Data Packet Format:
P6K7MTRRVARIABLERANGEDATA. See also P6K7MTRR.h.
Returns:
NO_ERROR
Success.
ERROR_I24_INVALID_PARAMETER
Either wrong index or memory type is specified (or both).
Remarks:
None.

3.3.5. P6K7MTRR_QRYMTRRCAP (60h)

Category:
IOCTL_P6K7MTRR (c4h)
Function:
P6K7MTRR_QRYMTRRCAP (60h)
Desctiption:
Query MTRR capabilities
Parameter Packet Format:
None. This pointer should be NULL.
Data Packet Format:
P6K7MTRRCAPDATA. See also P6K7MTRR.h.
Returns:
NO_ERROR
Success.
Remarks:
None.

3.3.6. P6K7MTRR_QRYMTRRDEFTYPE (61h)

Category:
IOCTL_P6K7MTRR (c4h)
Function:
P6K7MTRR_QRYMTRRDEFTYPE (61h)
Desctiption:
Query MTRR default type
Parameter Packet Format:
None. This pointer should be NULL.
Data Packet Format:
P6K7MTRRDEFTYPEDATA. See also P6K7MTRR.h.
Returns:
NO_ERROR
Success.
Remarks:
None.

3.3.7. P6K7MTRR_QRYMTRRFIXEDRANGE (62h)

Category:
IOCTL_P6K7MTRR (c4h)
Function:
P6K7MTRR_QRYMTRRFIXEDRANGE (62h)
Desctiption:
Query MTRR fixed ranges
Parameter Packet Format:
None. This pointer should be NULL.
Data Packet Format:
P6K7MTRRFIXEDRANGEDATA. See also P6K7MTRR.h.
Returns:
NO_ERROR
Success.
Remarks:
None.

3.3.8. P6K7MTRR_QRYMTRRVARIABLERANGE (63h)

Category:
IOCTL_P6K7MTRR (c4h)
Function:
P6K7MTRR_QRYMTRRVARIABLERANGE (63h)
Desctiption:
Set MTRR variable range
Parameter Packet Format:
P6K7MTRRVARIABLERANGEPARM. See also P6K7MTRR.h.
Data Packet Format:
P6K7MTRRVARIABLERANGEDATA. See also P6K7MTRR.h.
Returns:
NO_ERROR
Success.
ERROR_I24_INVALID_PARAMETER
Wrong index is specified.
Remarks:
None.


4. Troubleshooting

  1. Q. P6K7MTRR.sys cannot be installed on my machine...
    A. CPU of your machine is not Intel P6 nor AMD K7 :)
  2. Q. VFBWC autodetection is not functioned...
    A. This feature requires PM activity. Or, PM driver of your video card is buggy :)


5. Credits

Development
Programming
Takayuki 'January June' Suwa / Beliefia Productions
Documentation
Takayuki 'January June' Suwa / Beliefia Productions
Special thanks to
Masaharu 'Densuke' Nagata
He allowed me to replicate WARP4 Developer's Toolkit UNDER LEGAL LICENSE. Thanks a lot.
SciTech Display Doctor 7 for OS/2 development team
Congratulations! :)


Copyright 1999-2002 Takayuki 'January June' Suwa / Beliefia Productions. All rights reserved.
Beliefia Productions and its logo design are trademarks of Beliefia Productions. All rights reserved.
Other copyrighted works (images, musics, programs, and so on), trademarks and servicemarks in this document are owned by their respective owners.

[This document is HTML3.2(Wilbur)-compliant.]