Partager via


I/O Resource Manager (Windows Embedded CE 6.0)

1/6/2010

When the system boots, the bus enumerator enumerates the registry and loads all the built-in devices based on this registry information. You can configure this registry information. The I/O Resource Manager then tracks the current state of resources available in the system and manages all further I/O resource requests and allocations by bus drivers. Consequently, all bus drivers should request I/O resources from the I/O Resource Manager when they load a client driver for installable devices or other types of devices.

The I/O Resource Manager is an intrinsic part of Device Manager. The I/O Resource Manager tracks the available system resources initialized from the registry before any devices are loaded. Tracking these resources prevents accidental collisions when two or more device drivers attempt to use the same resources.

The OAL and the registry usually pre-allocate IRQ and I/O space resources that bus drivers request. However, the I/O Resource Manager is not limited to managing I/O and IRQ spaces. The specific set of resources available can include any that you define. Bus drivers, such as the PCI bus driver, request IRQ and I/O space resources from the I/O Resource Manager as it loads device drivers for the devices it finds. The same is true for the PC Card bus driver and I/O resources required by PC Card client drivers. The PC Card bus driver releases resources as users remove PC Cards from the system.

Every hardware platform has unique IRQs and I/O space available. IRQs for built-in and fixed devices should map to interrupt identifiers (SYSINTRs) in the OAL. The IRQs for built-in and fixed devices should be excluded from the available resources. IRQs used with the PCI bus are usually shared.

IRQs and I/O space resources are predefined. The HKEY_LOCAL_MACHINE\Drivers\Resources\IRQ and HKEY_LOCAL_MACHINE\Drivers\Resources\IO registry keys provide the initial state of the I/O Resource Manager.

The following table shows the subkeys for these registry keys.

Subkey Example value Description

Identifier

DWORD:1

Resource identifier. This is a label for a set of numbers and is defined in %_WINCEROOT%\Public\Common\DDK\Inc\Resmgr.h.

Minimum

DWORD:1

Smallest numbered resource of this type.

Space

DWORD:16

Number of resources in the resource space.

Ranges

"1, 3-5, 8"

Comma-separated list of initially available resources ranges. The default is none.

Shared

"4"

Comma-separated list of initially available sharable resources. The default is none.

Note

DWORD entries are interpreted as hexadecimal constants, but the strings are parsed as lists of C-style constants.

The following registry key example shows I/O Resource Manager registry settings.

; Resources available at time of Device.exe initialization.
; Key names are descriptive; resource IDs are definitive.
; System IDs are defined in ddk\inc\resmgr.h.
; HIVE BOOT SECTION
[HKEY_LOCAL_MACHINE\Drivers\Resources\IRQ]
    "Identifier"=dword:1
    "Minimum"=dword:1
    "Space"=dword:F
    "Ranges"="1,3-7,9-0xF"
    "Shared"="1,3-7,9-0xF"

; I/O ranges are reserved for all drivers listed in this file that are not
; part of an expansion bus (PCI, PCMCIA, etc).  If your hardware platform does not
; have one of these peripherals, you might edit this list accordingly.  This
; sample configuration assumes that if you have any COM port, you also have all of
; the lower-numbered COM ports.
[HKEY_LOCAL_MACHINE\Drivers\Resources\IO]
    "Identifier"=dword:2
    "Minimum"=dword:0
    "Space"=dword:10000
IF BSP_NOSERIAL
    "Ranges"="0-0x5F,0x65-0x277,0x284-0x38F,0x392-0x3DF,0x3E2-0xFFFF"
ENDIF ; BSP_NOSERIAL
IF BSP_NOSERIAL !
    "Ranges"="0-0x5F,0x65-0x277,0x284-0x2F7,0x300-0x38F,0x392-0x3DF,0x3E2-0xFFFF"
ENDIF ; BSP_NOSERIAL !
IF BSP_SERIAL2
    "Ranges"="0-0x5F,0x65-0x277,0x284-0x2F7,0x300-0x38F,0x392-0x3DF,0x3E2-0x3E7,0x3F0-0xFFFF"
ENDIF ; BSP_SERIAL2
IF BSP_SERIAL3
    "Ranges"="0-0x5F,0x65-0x277,0x284-0x2E7,0x2F0-0x2F7,0x300-0x38F,0x392-0x3DF,0x3E2-0x3E7,0x3F0-0xFFFF"
ENDIF ; BSP_SERIAL3

If shared resources are available, you can request them at any time. They can only be set if the resource space is less than or equal to 32.

ResourceCreateList creates a new resource type, but because you can statically initialize extensions, you can easily add these extensions to the registry key. Create a new subkey and specify an identifier between 0x80000 and 0xFFFFF, which are defined as RESMGR_BASE_OEM and RESMGR_MAX_OEM, respectively. You can also find these values in %_WINCEROOT%\Public\Common\DDK\Inc\Resmgr.h.

Only privileged processes can invoke the I/O Resource Manager functions. This prevents malicious applications from confusing the system by releasing resources owned by a device driver. Because Device Manager is a privileged process, device drivers, particularly bus drivers, can call these functions without modification.

See Also

Reference

Device Manager Reference

Other Resources

Device Manager
Enhancing the Security of a Device