Table of contents
GDI
TOC
Collapse the table of content
Expand the table of content

Claiming Legacy Resources

Last Updated: 2/14/2017

A video miniport driver must claim and report all legacy resources in its VIDEO_HW_INITIALIZATION_DATA structure during driver initialization. Legacy resources are those resources not listed in the device's PCI configuration space but that are decoded by the device. NT-based operating systems will disable power management and docking when they encounter legacy resources that are not reported in the manner outlined in this section.

Miniport drivers must do the following to report such legacy resources:

  • If the legacy resource list for the device is known at compile time, fill in the following two fields of the VIDEO_HW_INITIALIZATION_DATA structure that is created and initialized in the DriverEntry routine:

    Structure MemberDefinition

    HwLegacyResourceList

    Points to an array of VIDEO_ACCESS_RANGE structures. Each structure describes a device I/O port or memory range for the video adapter that is not listed in PCI configuration space.

    HwLegacyResourceCount

    Is the number of elements in the array to which HwLegacyResourceList points.

  • If the legacy resource list for the device is not known at compile time, implement a HwVidLegacyResources function and initialize the HwGetLegacyResources member of VIDEO_HW_INITIALIZATION_DATA to point to this function. For example, a miniport driver that supports two devices with different sets of legacy resources would implement HwVidLegacyResources to report the legacy resources at run time. The video port driver will ignore the HwLegacyResourceList and HwLegacyResourceCount members of VIDEO_HW_INITIALIZATION_DATA when a miniport driver implements HwVidLegacyResources.

  • Fill in the RangePassive field for each VIDEO_ACCESS_RANGE structure defined in the miniport driver accordingly. Setting RangePassive to VIDEO_RANGE_PASSIVE_DECODE indicates that the region is decoded by the hardware but that the display and video miniport drivers will never touch it. Setting RangePassive to VIDEO_RANGE_10_BIT_DECODE indicates that the device decodes ten bits of the port address for the region.

Again, a driver should only include resources that the hardware decodes but that are not claimed by PCI. Code in a driver that needs to claim minimal legacy resources might look something like the following:

//              RangeStart        RangeLength
//              |                 |      RangeInIoSpace
//              |                 |      |  RangeVisible
//        +-----+-----+           |      |  |  RangeShareable
//       low         high         |      |  |  |  RangePassive
//        v           v           v      v  v  v  v
VIDEO_ACCESS_RANGE AccessRanges[] = {
    // [0] (0x3b0-0x3bb)
    {0x000003b0, 0x00000000, 0x0000000c, 1, 1, 1, 0},
    // [1] (0x3c0-0x3df)
    {0x000003C0, 0x00000000, 0x00000010, 1, 1, 1, 0},
    // [2] (0xa0000-0xaffff)
    {0x000A0000, 0x00000000, 0x00010000, 1, 0, 0, 0},
};

// Within the DriverEntry routine:
VIDEO_HW_INITIALIZATION_DATA hwInitData;
hwInitData.HwLegacyResourceList = AccessRanges;
hwInitData.HwLegacyResourceCount = 3;

The miniport driver can "reclaim" legacy resources again in subsequent call(s) to VideoPortVerifyAccessRanges; however, the video port driver will just ignore requests for any such previously claimed resources. Power management and docking will be disabled in the system if the miniport driver attempts to claim a legacy access range in VideoPortVerifyAccessRanges that was not previously claimed in the HwLegacyResourceList during DriverEntry or returned in the LegacyResourceList parameter of HwVidLegacyResources.

Send comments about this topic to Microsoft

© 2017 Microsoft