kernel plug and play in windows vista allen marshall lead program manager windows core platform...
TRANSCRIPT
Kernel Plug And Play In Kernel Plug And Play In Windows VistaWindows Vista
Allen MarshallAllen MarshallLead Program ManagerLead Program ManagerWindows Core Platform ArchitectureWindows Core Platform ArchitectureMicrosoft CorporationMicrosoft Corporation
AgendaAgenda
Enhanced scenario supportEnhanced scenario supportDevice custom propertiesDevice custom properties
Device ejection supportDevice ejection support
Asynchronous PnP operationsAsynchronous PnP operations
Kernel PnP diagnostic tracingKernel PnP diagnostic tracing
Supporting hardware evolutionSupporting hardware evolutionLegacy reductionLegacy reduction
Interrupt enhancementsInterrupt enhancements
Large system supportLarge system support
Multilevel rebalanceMultilevel rebalance
Machine.inf logisticsMachine.inf logistics
Common BIOS errata that impact PnPCommon BIOS errata that impact PnP
BackgroundBackground
Windows Vista features continued Windows Vista features continued advancement of Windows kernel PnP advancement of Windows kernel PnP support, driven bysupport, driven by
Evolving hardware technologiesEvolving hardware technologiesPCI ExpressPCI ExpressNUMA relations in many systemsNUMA relations in many systemsMainstream adoption of advanced server Mainstream adoption of advanced server configurationsconfigurations
Hot add memoryHot add memory
Continued development to enhance existing Continued development to enhance existing and enable new scenariosand enable new scenarios
Enabling faster system startupEnabling faster system startupImproved diagnostics, manageabilityImproved diagnostics, manageability
Enhanced Scenario SupportEnhanced Scenario SupportDevice properties in WindowsDevice properties in Windows
Today, Windows provides the kernel DDI Today, Windows provides the kernel DDI IoOpenDeviceRegistryKey()IoOpenDeviceRegistryKey()
Returns a device or driver registry keyReturns a device or driver registry key
Drivers can access registry data using standard registry DDIsDrivers can access registry data using standard registry DDIsSetup information Setup information
Name of the device’s PDOName of the device’s PDO
Use of a DDI is preferred to accessing the registry directlyUse of a DDI is preferred to accessing the registry directlyAllows better abstraction in the operating systemAllows better abstraction in the operating system
Backing store location may change in the futureBacking store location may change in the future
Windows Vista will extend this to allow custom device Windows Vista will extend this to allow custom device properties to be both set and retrieved for a device nodeproperties to be both set and retrieved for a device node
Enhanced Scenario SupportEnhanced Scenario SupportCustom property DDIs in Windows VistaCustom property DDIs in Windows Vista
This offers several practical applicationsThis offers several practical applicationsThe device’s bus driver can set these custom device The device’s bus driver can set these custom device properties on the device’s devnodeproperties on the device’s devnode
The device may store useful information in its firmware, The device may store useful information in its firmware, and make this available to the OSand make this available to the OS
Icon imageIcon image
Device description stringDevice description string
Manufacturer’s web site URLManufacturer’s web site URL
Device driverDevice driver
Kernel-modeKernel-modeIoSetDevicePropertyData()IoSetDevicePropertyData()
IoGetDevicePropertyData()IoGetDevicePropertyData()
User-modeUser-modeSetupDi…()SetupDi…()
Enhanced Scenario SupportEnhanced Scenario SupportDevice custom property DDIsDevice custom property DDIs
Function prototypes are declared in wdm.hFunction prototypes are declared in wdm.h
Bus drivers should not call these Bus drivers should not call these DDIs until they have received a DDIs until they have received a IRP_MN_QUERY_RESOURCE_REQUIREMENTSIRP_MN_QUERY_RESOURCE_REQUIREMENTS IRP IRP
This will ensure that PnP has created and initialized This will ensure that PnP has created and initialized the device node associated with the PDOthe device node associated with the PDO
Calling too early results in bug check 0xCA Calling too early results in bug check 0xCA PNP_DETECTED_FATAL_ERRORPNP_DETECTED_FATAL_ERROR
Callers must be running at IRQL == PASSIVE_LEVELCallers must be running at IRQL == PASSIVE_LEVEL
Locale-neutral property replace any existing Locale-neutral property replace any existing locale-specific propertieslocale-specific properties
If you have a locale specific property, be sure If you have a locale specific property, be sure to set this property for all relevant localesto set this property for all relevant locales
NTSTATUSIoSetDevicePropertyData ( __in PDEVICE_OBJECT Pdo, __in CONST DEVPROPKEY *PropertyKey, __in_LCID Lcid, __in ULONG Flags, __in DEVPROPTYPE Type, __in ULONG Size, __in_opt PVOID Data )
Enhanced Scenario SupportEnhanced Scenario SupportDevice custom property DDIsDevice custom property DDIs
Pdo – pointer to the physical device objectPdo – pointer to the physical device objectPropertyKey – pointer to the property key identifying the propertyPropertyKey – pointer to the property key identifying the propertyLcid – language identifierLcid – language identifierFlagsFlags
PLUGPLAY_PROPERTY_PERSISTENT – Property should PLUGPLAY_PROPERTY_PERSISTENT – Property should be persisted across bootsbe persisted across boots
Type – custom property typeType – custom property typeSize – custom property data sizeSize – custom property data sizeData – pointer to the custom property dataData – pointer to the custom property data
Enhanced Scenario SupportEnhanced Scenario SupportDevice custom property DDIsDevice custom property DDIs
Deleting custom device dataDeleting custom device dataIf Data is NULL, the specified property If Data is NULL, the specified property will be deletedwill be deleted
If Data is NULL and LCID is specified, If Data is NULL and LCID is specified, then the property data for the specified then the property data for the specified LCID will be deletedLCID will be deleted
If Data is NULL and LCID is If Data is NULL and LCID is LOCALE_NEUTRAL, then property data LOCALE_NEUTRAL, then property data for all languages will be deletedfor all languages will be deleted
IoGetDevicePropertyData ( __in PDEVICE_OBJECT Pdo, __in CONST DEVPROPKEY *PropertyKey, __in LCID Lcid, __reserved ULONG Flags, __in ULONG Size, __out PVOID Data, __out PULONG RequiredSize, __out PDEVPROPTYPE Type )
Enhanced Scenario SupportEnhanced Scenario SupportDevice custom property DDIsDevice custom property DDIs
Pdo – pointer to the physical device objectPdo – pointer to the physical device objectPropertyKey – pointer to the property key identifying the propertyPropertyKey – pointer to the property key identifying the propertyLcid – language identifierLcid – language identifierFlags – reservedFlags – reservedSize – custom property data sizeSize – custom property data sizeData – pointer to the custom property dataData – pointer to the custom property dataRequiredSize – pointer that receives the required size RequiredSize – pointer that receives the required size for getting the datafor getting the dataType – pointer that receives the custom property data typeType – pointer that receives the custom property data type
Enhanced Scenario SupportEnhanced Scenario SupportDevice custom property DDIsDevice custom property DDIs
The PCI driver in Windows Vista will expose certain The PCI driver in Windows Vista will expose certain properties for a PCI root bus and PCI bridges and properties for a PCI root bus and PCI bridges and devices using these DDIs devices using these DDIs
These properties are available to other kernel mode and user These properties are available to other kernel mode and user mode components once the root bus or a PCI device is startedmode components once the root bus or a PCI device is started
Not shown in Windows Vista UINot shown in Windows Vista UI
Function drivers can retrieve custom properties for PCI devices Function drivers can retrieve custom properties for PCI devices once the PDO completes the Start IRPonce the PDO completes the Start IRPIf a property is not applicable to a PCI device, then it will not be If a property is not applicable to a PCI device, then it will not be set and cannot be retrievedset and cannot be retrievedThese properties are volatile and are automatically refreshed These properties are volatile and are automatically refreshed across reboots or change of device location across reboots or change of device location These are read-only properties, and may not be modifiedThese are read-only properties, and may not be modified
Any modification to these properties from user or kernel mode will not Any modification to these properties from user or kernel mode will not change the operational behavior of a root bus or a device change the operational behavior of a root bus or a device
Enhanced Scenario SupportEnhanced Scenario SupportDevice custom property DDIsDevice custom property DDIs
ExamplesExamplesPCI root busPCI root bus
Secondary side characteristicsSecondary side characteristics
Secondary side speed and modeSecondary side speed and modeAvailable when the platform defines _DSM method Available when the platform defines _DSM method function 4 for the PCI host bridgefunction 4 for the PCI host bridge
PCI devicePCI deviceDevice current speed and modeDevice current speed and mode
Applicable for PCI Conventional and PCI-X devicesApplicable for PCI Conventional and PCI-X devices
Device BaseClass, SubClassDevice BaseClass, SubClass
Enhanced Scenario SupportEnhanced Scenario SupportDevice ejection DDIsDevice ejection DDIs
Windows today provides the Windows today provides the IoDeviceEjectRequest() DDIIoDeviceEjectRequest() DDI
Typically called by a bus driver to notify the PnP Typically called by a bus driver to notify the PnP manager that a hardware device eject button for one manager that a hardware device eject button for one of the bus driver’s child devices has been pressedof the bus driver’s child devices has been pressed
Callers of this API have no elegant way to know if the Callers of this API have no elegant way to know if the device eject has succeededdevice eject has succeeded
This can lead to unnecessary complication in driver code, This can lead to unnecessary complication in driver code, such as polling or other undesirable workaroundssuch as polling or other undesirable workarounds
Asynchronous behaviorAsynchronous behavior
Returns no Returns no NTSTATUSNTSTATUS code (returns code (returns VOIDVOID))
Enhanced Scenario SupportEnhanced Scenario SupportDevice ejection DDIsDevice ejection DDIs
In order to better enable hardware evolution and enhance In order to better enable hardware evolution and enhance diagnostics, Windows Vista introduces an improved diagnostics, Windows Vista introduces an improved device eject DDIdevice eject DDI
IoDeviceEjectRequestEx()IoDeviceEjectRequestEx()
Supersedes IoDeviceEjectRequest()Supersedes IoDeviceEjectRequest()
Provides an asynchronous callback mechanism Provides an asynchronous callback mechanism Allows the caller to determine if and when the actual device Allows the caller to determine if and when the actual device ejection has completed successfullyejection has completed successfully
Other software actions may be taken, e.g.Other software actions may be taken, e.g.Update a management console; illuminate eject complete indicatorUpdate a management console; illuminate eject complete indicator
Allows callers to pass in a callback and context to be invoked Allows callers to pass in a callback and context to be invoked upon successful completion of the hardware eject operationupon successful completion of the hardware eject operation
Enables synchronous ejection behaviorEnables synchronous ejection behavior
Providing an asynchronous callback leads Providing an asynchronous callback leads to less complexity in 3rd party driver codeto less complexity in 3rd party driver code
Allows platform firmware a deterministic Allows platform firmware a deterministic means to know ejection completion means to know ejection completion status via _OSTstatus via _OST
Improves stability, reliabilityImproves stability, reliability
Fosters easier development Fosters easier development and debugging, etc.and debugging, etc.
Enhanced Scenario SupportEnhanced Scenario SupportDevice ejection DDIsDevice ejection DDIs
NTSTATUSIoRequestDeviceEjectEx( __in PDEVICE_OBJECT PhysicalDeviceObject, __in_opt PIO_DEVICE_EJECT_CALLBACK Callback, __in_opt PVOID Context );
Enhanced Scenario SupportEnhanced Scenario SupportDevice ejection DDIsDevice ejection DDIs
PhysicalDeviceObject – pointer to the PDO of the device to ejectPhysicalDeviceObject – pointer to the PDO of the device to eject
Callback – pointer to the caller's callback if they want to find Callback – pointer to the caller's callback if they want to find out the ultimate status of the eject operationout the ultimate status of the eject operation
Context – context value passed to the callbackContext – context value passed to the callback
Return Value – standard NTSTATUS codesReturn Value – standard NTSTATUS codesIf this function succeeds, it does *not* mean that the eject has succeeded If this function succeeds, it does *not* mean that the eject has succeeded rather, it means that the eject was successfully queued up and that the rather, it means that the eject was successfully queued up and that the caller's callback will be called with the final statuscaller's callback will be called with the final status
If this function fails, the caller's callback is not called If this function fails, the caller's callback is not called
Enhanced Scenario SupportEnhanced Scenario SupportInterrupt DDIsInterrupt DDIs
With the advent of PCI Express MSI/MSI-X, With the advent of PCI Express MSI/MSI-X, Windows Vista includes several interrupt Windows Vista includes several interrupt architecture enhancementsarchitecture enhancements
Kernel PnP exports a new DDI for connecting to Kernel PnP exports a new DDI for connecting to interrupts: interrupts: IoConnectInterruptEx()IoConnectInterruptEx()
Required for devices that support Required for devices that support Message-signaled interruptsMessage-signaled interrupts
For details, refer to the white paper For details, refer to the white paper “Interrupt Architecture Enhancements in Windows”“Interrupt Architecture Enhancements in Windows”
Enhanced Scenario SupportEnhanced Scenario SupportAsynchronous PnP operationsAsynchronous PnP operations
Two of the slowest PnP operations areTwo of the slowest PnP operations areStarting a device Starting a device
IRP_MN_START_DEVICEIRP_MN_START_DEVICE
Enumerating a bus Enumerating a bus IRP_MN_QUERY_RELATIONS – BusRelationsIRP_MN_QUERY_RELATIONS – BusRelations
Historically, PnP serialized these operationsHistorically, PnP serialized these operations
In Windows Vista, these operations are overlappedIn Windows Vista, these operations are overlappedOffers substantive savings on consumer desktopsOffers substantive savings on consumer desktops
≈ ≈ 1 to 3 seconds by overlapping PATA/SATA enumeration1 to 3 seconds by overlapping PATA/SATA enumeration
Huge gains possible on systems with large Huge gains possible on systems with large number of slow devicesnumber of slow devices
Enhanced Scenario SupportEnhanced Scenario SupportAsynchronous PnP operationsAsynchronous PnP operations
Driver participation is required to enable parallelismDriver participation is required to enable parallelismDrivers should pend these IRPsDrivers should pend these IRPs
IRP_MN_QUERY_RELATIONS (BusRelations)IRP_MN_QUERY_RELATIONS (BusRelations)IRP_MN_START_DEVICEIRP_MN_START_DEVICE
PnP manager will dispatch other operations PnP manager will dispatch other operations while the IRP is in a pended statewhile the IRP is in a pended state
This only works if drivers participateThis only works if drivers participate
On older versions of Windows, pending On older versions of Windows, pending an IRP has no net effectan IRP has no net effect
PnP manager will wait for the pended IRP to completePnP manager will wait for the pended IRP to complete
PnP will provide tracing data PnP will provide tracing data Allows driver writers to determine how long Allows driver writers to determine how long it takes to complete these IRPsit takes to complete these IRPsIndicates if the IRP was pendedIndicates if the IRP was pended
Enhanced Scenario SupportEnhanced Scenario SupportAsynchronous PnP operationsAsynchronous PnP operations
Drivers having start order dependencies Drivers having start order dependencies will not workwill not work
E.g., PS/2 mouse and keyboardE.g., PS/2 mouse and keyboard
Avoid these types of dependencies in your designs Avoid these types of dependencies in your designs
Plug and play will serialize operations around Plug and play will serialize operations around drivers known to have such dependenciesdrivers known to have such dependencies
Avoid exposing any start Avoid exposing any start order-dependent informationorder-dependent information
Network connection numbersNetwork connection numbers
Disk numbers Disk numbers
COM port numbersCOM port numbers
Enhanced Scenario SupportEnhanced Scenario SupportKernel PnP diagnostic tracingKernel PnP diagnostic tracing
Windows Vista contains diagnostic tracing Windows Vista contains diagnostic tracing hooks around plug and play operationshooks around plug and play operations
Allows tracing failed PnP operations Allows tracing failed PnP operations such assuch as
Ejection failuresEjection failures
Code 10 failures (device failed to start)Code 10 failures (device failed to start)
Data may be utilized forData may be utilized forIdentifying problematic systems or devicesIdentifying problematic systems or devices
Discovering failure trendsDiscovering failure trends
Enhanced Scenario SupportEnhanced Scenario SupportKernel PnP diagnostic tracingKernel PnP diagnostic tracing
Tracing is visible in Event ViewerTracing is visible in Event ViewerEjection failures will appear in the Ejection failures will appear in the System channel by defaultSystem channel by default
More detailed tracing can be enabled More detailed tracing can be enabled for the Kernel-PnP Diagnostic providerfor the Kernel-PnP Diagnostic provider
Refer to Refer to WHDCWHDC for additional details for additional details
Enhanced Scenario SupportEnhanced Scenario SupportKernel PnP diagnostic tracingKernel PnP diagnostic tracing
Hardware Evolution SupportHardware Evolution SupportLegacy reductionLegacy reduction
Microsoft is continuing to eliminate legacy Microsoft is continuing to eliminate legacy platform support as new technologies matureplatform support as new technologies mature
Reduces platform complexity Reduces platform complexity while increasing flexibilitywhile increasing flexibility
Improves system reliabilityImproves system reliability
Reduces firmware code sizeReduces firmware code size
Future legacy reduction efforts Future legacy reduction efforts will be communicated in the will be communicated in the Windows Hardware NewsletterWindows Hardware Newsletter
Hardware Evolution SupportHardware Evolution SupportLegacy reductionLegacy reduction
ACPI support is required in Windows VistaACPI support is required in Windows VistaOnly the ACPI HAL and multiprocessor Only the ACPI HAL and multiprocessor kernel are providedkernel are provided
APM, MPS, PNPBIOS support has been removedAPM, MPS, PNPBIOS support has been removed
No ISAPnP enumeration supportNo ISAPnP enumeration supportisapnp.sysisapnp.sys is not installed by default is not installed by default
Requires reference in your device’s .infRequires reference in your device’s .inf
Minimal functionality preserved in Minimal functionality preserved in msisadrv.sysmsisadrv.sysContains routines to manage an ISA bridgeContains routines to manage an ISA bridge
Allows exporting an interrupt translator Allows exporting an interrupt translator interface from the HALinterface from the HAL
Required to support PS/2 keyboards and miceRequired to support PS/2 keyboards and mice
Hardware Evolution SupportHardware Evolution SupportLarge resource descriptorsLarge resource descriptors
Previous versions of Windows operating systems Previous versions of Windows operating systems limited the length of a single address range limited the length of a single address range descriptor to 4 GBdescriptor to 4 GB
Ranges > 4 GB had to be broken up into Ranges > 4 GB had to be broken up into nn contiguous contiguous 4 GB ranges4 GB ranges
Windows XP and Windows Server 2003 will bug Windows XP and Windows Server 2003 will bug check if they encounter resource descriptors > 4 GBcheck if they encounter resource descriptors > 4 GB
Windows Vista introduces support Windows Vista introduces support for large memory descriptorsfor large memory descriptors
BIOS ASL can use QWORD resource BIOS ASL can use QWORD resource descriptors to describe ranges > 4 GBdescriptors to describe ranges > 4 GB
Hardware Evolution SupportHardware Evolution SupportLarge resource descriptorsLarge resource descriptors
Windows Vista defines new large memory Windows Vista defines new large memory resource typesresource types
Defined in wdm.hDefined in wdm.h
Used internally in Windows Vista to support Used internally in Windows Vista to support Hot Add memory, large PCI Express BARsHot Add memory, large PCI Express BARs
Used by: acpi.sys, pci.sysUsed by: acpi.sys, pci.sys
These memory types should only be These memory types should only be accessed using the DDIs providedaccessed using the DDIs provided
Details will be published in the WDKDetails will be published in the WDK
Structure Maximum Length (approx) Granularity
Memory40Memory40 1 TB1 TB 256 B256 B
Memory48Memory48 256 TB256 TB 64 KB64 KB
Memory64Memory64 16777215 TB16777215 TB 4 GB4 GB
Hardware Evolution SupportHardware Evolution SupportLarge resource descriptorsLarge resource descriptors
NTSTATUSRtlIoEncodeMemIoResource ( __in PIO_RESOURCE_DESCRIPTOR Descriptor, __in UCHAR Type, __in ULONGLONG Length, __in ULONGLONG Alignment, __in ULONGLONG MinimumAddress, __in ULONGLONG MaximumAddress );
NTSTATUSRtlCmEncodeMemIoResource ( __in PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor, __in UCHAR Type, __in ULONGLONG Length, __in ULONGLONG Start );
ULONGLONGRtlIoDecodeMemIoResource ( __in PIO_RESOURCE_DESCRIPTOR Descriptor, __out_opt PULONGLONG Alignment, __out_opt PULONGLONG MinimumAddress, __out_opt PULONGLONG MaximumAddress );
ULONGLONGRtlCmDecodeMemIoResource ( __in PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor, __out_opt PULONGLONG Start );
Hardware Evolution SupportHardware Evolution SupportLarge resource descriptorsLarge resource descriptors
Hardware Evolution SupportHardware Evolution SupportDescribing resource domainsDescribing resource domains
A resource domain starts with eitherA resource domain starts with eitherAn ACPI module deviceAn ACPI module device
A PCI root bridge (PCI Express root port)A PCI root bridge (PCI Express root port)
All child resources within a resource All child resources within a resource domain must be claimed by the rootdomain must be claimed by the root
For a subtractive PCI bridge, subtractive For a subtractive PCI bridge, subtractive resources must be reportedresources must be reported
Positive decode resources must Positive decode resources must be correctly reported by the PCI bridgebe correctly reported by the PCI bridge
All PCI bus numbers must All PCI bus numbers must be accurately reportedbe accurately reported
Hardware Evolution SupportHardware Evolution SupportNUMA supportNUMA support
Windows Server Longhorn will make use Windows Server Longhorn will make use of platform-reported proximity relationshipsof platform-reported proximity relationships
Correlates devices with temporal memory Correlates devices with temporal memory and processor resourcesand processor resources
Key driver routines are invoked on the closest processor, Key driver routines are invoked on the closest processor, so memory will be allocated from NUMA local memoryso memory will be allocated from NUMA local memory
Requires no driver changesRequires no driver changes
AddDevice, IRP_MN_QUERY_DEVICE_RELATIONS-BusRelationsAddDevice, IRP_MN_QUERY_DEVICE_RELATIONS-BusRelations
The platform should include _PXM in the The platform should include _PXM in the appropriate scope in the system hierarchyappropriate scope in the system hierarchy
_PXM must correlate to either SRAT or ACPI _PXM must correlate to either SRAT or ACPI namespace information for memory and processornamespace information for memory and processor
Hardware Evolution SupportHardware Evolution SupportResource allocationResource allocation
Windows Vista introduces several changes to resource Windows Vista introduces several changes to resource allocation to better support PCI bridgesallocation to better support PCI bridges
Partial arbitrationPartial arbitration
Support for both pure and partially subtractive PCI bridgesSupport for both pure and partially subtractive PCI bridges
Windows Vista has reduced the default sizes Windows Vista has reduced the default sizes for PCI bridge windowsfor PCI bridge windows
On a large server system, previous default bridge window On a large server system, previous default bridge window sizes could lead to resources being over-committedsizes could lead to resources being over-committed
I/O windows are limited to 4 KI/O windows are limited to 4 KPCI Express endpoints may not use I/OPCI Express endpoints may not use I/O
Memory windows are limited to 1 MBMemory windows are limited to 1 MB
Hardware Evolution SupportHardware Evolution SupportResource allocationResource allocation
If a critical device is a peer of a non-boot configured If a critical device is a peer of a non-boot configured device, the parent PCI bridge won’t get rebalanced device, the parent PCI bridge won’t get rebalanced
Example devices that will limit rebalanceExample devices that will limit rebalanceDebugger devices (USB or 1394) Debugger devices (USB or 1394)
VGAVGA
Mass storage deviceMass storage device
Partially boot configured bridges will not be rebalancedPartially boot configured bridges will not be rebalancedBridge windows can’t be expandedBridge windows can’t be expanded
Devices behind the bridge may not be functional Devices behind the bridge may not be functional due to resource conflicts or failuresdue to resource conflicts or failures
Platform must boot configure required boot devicesPlatform must boot configure required boot devicesIf devices requiring boot configuration are behind If devices requiring boot configuration are behind a bridge, boot configure a bridge, boot configure allall devices behind the bridge devices behind the bridge
Hardware Evolution SupportHardware Evolution SupportMultilevel resource rebalanceMultilevel resource rebalance
Multilevel resource rebalance is a mechanism used Multilevel resource rebalance is a mechanism used by PnP to dynamically reconfigure a device hierarchy by PnP to dynamically reconfigure a device hierarchy that has already been assigned resourcesthat has already been assigned resources
Allows for optimal resource assignment for a newly added deviceAllows for optimal resource assignment for a newly added device
BIOS solution may over-commit resourcesBIOS solution may over-commit resources
Allows Windows Vista to dynamically respond Allows Windows Vista to dynamically respond to events like docking or hot add of devicesto events like docking or hot add of devices
Multilevel rebalance has implications for devices Multilevel rebalance has implications for devices behind PCI bridges and BIOS configuration behind PCI bridges and BIOS configuration of bridges and devicesof bridges and devices
This will allow dynamic adjustment of PCI bridge resourcesThis will allow dynamic adjustment of PCI bridge resources
Resource rebalance is transparent Resource rebalance is transparent to applicationsto applications
Hardware Evolution SupportHardware Evolution SupportMultilevel resource rebalanceMultilevel resource rebalance
Rebalance event flowRebalance event flowResource rebalance is triggered Resource rebalance is triggered by a hardware eventby a hardware event
Plug and play attempts to stop devicesPlug and play attempts to stop devices
New resource assignments are computed New resource assignments are computed using devices that can be stoppedusing devices that can be stopped
Plug and play stops devices that Plug and play stops devices that can be stoppedcan be stopped
Plug and play restarts stopped devices Plug and play restarts stopped devices with new resource assignmentswith new resource assignments
Hardware Evolution SupportHardware Evolution SupportMultilevel resource rebalanceMultilevel resource rebalance
Example driver events that will trigger resource rebalanceExample driver events that will trigger resource rebalancePlug and play cannot assign resources to a newly added devicePlug and play cannot assign resources to a newly added device
For instance, a PCI ExpressCard device is inserted and the memory For instance, a PCI ExpressCard device is inserted and the memory range for the parent PCI bridge cannot accommodate the device’s range for the parent PCI bridge cannot accommodate the device’s memory requirementsmemory requirements
Driver reports that its resource requirements have changedDriver reports that its resource requirements have changedDevice driver calls Device driver calls IoInvalidateDeviceState()IoInvalidateDeviceState() and reports and reports PNP_DEVICE_RESOURCE_REQUIREMENTS_CHANGEDPNP_DEVICE_RESOURCE_REQUIREMENTS_CHANGED in the in the subsequent subsequent IRP_MN_QUERY_PNP_DEVICE_STATEIRP_MN_QUERY_PNP_DEVICE_STATE
Allows a driver to relinquish unused resources back to the systemAllows a driver to relinquish unused resources back to the system
Started State
Stopped State
Stop-Pending State
IRP_MN_QUERY_STOP_DEVICE (1)IRP_MN_QUERY_STOP_DEVICE (1) IRP_MN_CANCEL_STOP_DEVICE (4)IRP_MN_CANCEL_STOP_DEVICE (4)
IRP_MN_START_DEVICE (3)IRP_MN_START_DEVICE (3)
IRP_MN_STOP_DEVICE (2)IRP_MN_STOP_DEVICE (2)
Failed Restart (5)Failed Restart (5)
Hardware Evolution SupportHardware Evolution SupportMultilevel resource rebalanceMultilevel resource rebalance
Hardware Evolution SupportHardware Evolution SupportMultilevel Resource RebalanceMultilevel Resource Rebalance
Handling Resource Rebalance Requests Handling Resource Rebalance Requests Plug and play will send Plug and play will send IRP_MN_QUERY_STOP_DEVICEIRP_MN_QUERY_STOP_DEVICE to to driversdriversDevices that succeed this IRP will participateDevices that succeed this IRP will participate
Succeed this IRP as much as possibleSucceed this IRP as much as possible
If succeeded, plug and play will sendIf succeeded, plug and play will sendIRP_MN_STOP_DEVICE IRP_MN_STOP_DEVICE IRP_MN_START_DEVICEIRP_MN_START_DEVICE
With new set of resourcesWith new set of resources
If a child device fails this IRP, its parent cannot be stoppedIf a child device fails this IRP, its parent cannot be stoppedFailing this IRP can cause resource rebalance to failFailing this IRP can cause resource rebalance to failSome device will not work in the systemSome device will not work in the system
Code 12 – CM_PROB_NORMAL_CONFLICTCode 12 – CM_PROB_NORMAL_CONFLICT
If you fail If you fail IRP_MN_QUERY_STOP_DEVICEIRP_MN_QUERY_STOP_DEVICE, you will receive , you will receive IRP_MN_CANCEL_STOP_DEVICEIRP_MN_CANCEL_STOP_DEVICE
Hardware Evolution SupportHardware Evolution SupportMultilevel resource rebalanceMultilevel resource rebalance
When you receive When you receive IRP_MN_STOP_DEVICEIRP_MN_STOP_DEVICE, drivers must, drivers mustQueue all I/O requests (do not fail I/O)Queue all I/O requests (do not fail I/O)Release all hardware resourcesRelease all hardware resourcesDisconnect interruptsDisconnect interruptsUnmap I/O, memory and disable hardware decodesUnmap I/O, memory and disable hardware decodesDo not put the device into D3Do not put the device into D3Do not reset I/O queuesDo not reset I/O queues
When you receive a When you receive a IRP_MN_START_DEVICEIRP_MN_START_DEVICE after after a a IRP_MN_STOP_DEVICEIRP_MN_STOP_DEVICE, drivers must, drivers must
Treat the resources as new resourcesTreat the resources as new resourcesReconnect new interruptsReconnect new interruptsMap new I/O, memory and enable hardware decodesMap new I/O, memory and enable hardware decodesDo not re-initialize IO queuesDo not re-initialize IO queuesResume handling I/OResume handling I/O
Be prepared to handle resource rebalance Be prepared to handle resource rebalance in your device driversin your device drivers
You may see You may see IRP_MN_SURPRISE_REMOVALIRP_MN_SURPRISE_REMOVAL immediately immediately after after IRP_MN_STOP_DEVICEIRP_MN_STOP_DEVICE
If a parent device failed its If a parent device failed its IRP_MN_START_DEVICE IRP_MN_START_DEVICE during rebalanceduring rebalance
You may see a You may see a IRP_MN_CANCEL_STOP_DEVICEIRP_MN_CANCEL_STOP_DEVICE without seeing a without seeing a IRP_MN_QUERY_STOP_DEVICEIRP_MN_QUERY_STOP_DEVICE
This can happen if someone above you in the stack fails This can happen if someone above you in the stack fails IRP_MN_QUERY_STOP_DEVICEIRP_MN_QUERY_STOP_DEVICE and completes the IRP and completes the IRP
Hardware Evolution SupportHardware Evolution SupportMultilevel resource rebalanceMultilevel resource rebalance
Hardware Evolution SupportHardware Evolution SupportMultilevel resource rebalanceMultilevel resource rebalance
Test your driver for resource Test your driver for resource rebalance requests rebalance requests
Enable driver verifierEnable driver verifier
Run pnpdtest.exe to attempt resource Run pnpdtest.exe to attempt resource rebalance on your devicerebalance on your device
Pnpdtest.exe is available in the WDKPnpdtest.exe is available in the WDK
Avoiding PnP ProblemsAvoiding PnP Problems
MCFG resource conflictsMCFG resource conflictsClaim MCFG resources as a motherboard resource devnodeClaim MCFG resources as a motherboard resource devnode
As a peer of your root PCI busAs a peer of your root PCI bus
Correctly report subtractive decode resourcesCorrectly report subtractive decode resourcesProperly report resources for subtractive bridgesProperly report resources for subtractive bridges
All subtractive devices must be accounted for at the hierarchy rootAll subtractive devices must be accounted for at the hierarchy root
Correct use of motherboard resource devnodesCorrect use of motherboard resource devnodesClaim resources at the proper level in the device hierarchyClaim resources at the proper level in the device hierarchy
E.g., ISA resources should be under the PCI-ISA bridgeE.g., ISA resources should be under the PCI-ISA bridge
Should represent real addresses not discoverable by the OSShould represent real addresses not discoverable by the OSProvide an _DIS method for devices claiming resources not decoded Provide an _DIS method for devices claiming resources not decoded by actual hardwareby actual hardware
Machine.inf LogisticsMachine.inf Logistics
Machine.inf is the INF file used by the Machine.inf is the INF file used by the Windows operating system Windows operating system
To map core chipset hardware and BIOS-To map core chipset hardware and BIOS-enumerated device identifiers (IDs) during enumerated device identifiers (IDs) during the Windows startup processthe Windows startup process
Machine.inf requires updatesMachine.inf requires updatesWhen new chipsets evolve When new chipsets evolve
When system manufacturers change device When system manufacturers change device description strings for their current chipsetsdescription strings for their current chipsets
Updates are incorporated into the latest Updates are incorporated into the latest Windows build on a quarterly basisWindows build on a quarterly basis
Machine.inf LogisticsMachine.inf Logistics
Submissions for Windows Vista will be accepted Submissions for Windows Vista will be accepted up until the Release Candidate 1 (RC1) up until the Release Candidate 1 (RC1) milestonemilestone
You are required to provide two test hardware You are required to provide two test hardware systems to Microsoftsystems to Microsoft
Use care with NO_DRV versus Use care with NO_DRV versus PCI_DRV .inf directivesPCI_DRV .inf directives
System can become inoperative if NO_DRV is System can become inoperative if NO_DRV is specified on PCI bridges with child devicesspecified on PCI bridges with child devices
For details, refer to the white paperFor details, refer to the white paperMachine.inf Update Submission ProcedureMachine.inf Update Submission Procedure
Call To ActionCall To Action
Continue driving deprecation of unnecessary legacy BIOS Continue driving deprecation of unnecessary legacy BIOS featuresfeaturesFirmware developers should start using large resource Firmware developers should start using large resource descriptors for systems running Windows Vistadescriptors for systems running Windows VistaTake advantage of the enhanced ejection infrastructure in Take advantage of the enhanced ejection infrastructure in Windows VistaWindows Vista
Test and report issues to MicrosoftTest and report issues to Microsoft
Driver developers should begin using Driver developers should begin using IoConnectInterruptEx()IoConnectInterruptEx()Driver developers must properly design and test for to Driver developers must properly design and test for to support changes in PnPsupport changes in PnP
Asynchronous operations – measure start performance Asynchronous operations – measure start performance improvementsimprovementsMultilevel resource rebalanceMultilevel resource rebalanceNew PnP DDIsNew PnP DDIs
Additional ResourcesAdditional Resources
Web ResourcesWeb ResourcesPlug and Play – Architecture and Driver Support Plug and Play – Architecture and Driver Support http://www.microsoft.com/whdc/system/pnppwr/pnp/default.mspxhttp://www.microsoft.com/whdc/system/pnppwr/pnp/default.mspx
White PapersWhite PapersFirmware Allocation of PCI Device Resources in WindowsFirmware Allocation of PCI Device Resources in Windowshttp://www.microsoft.com/whdc/system/bus/pci/PCI-rsc.mspxhttp://www.microsoft.com/whdc/system/bus/pci/PCI-rsc.mspxInterrupt Architecture Enhancements in WindowsInterrupt Architecture Enhancements in Windowshttp://www.microsoft.com/whdc/system/bus/PCI/MSI.mspxhttp://www.microsoft.com/whdc/system/bus/PCI/MSI.mspxPCI Multi-level Rebalance in Windows LonghornPCI Multi-level Rebalance in Windows Longhornhttp://www.microsoft.com/whdc/system/bus/PCI/multilevel-rebal.mspxhttp://www.microsoft.com/whdc/system/bus/PCI/multilevel-rebal.mspxSupporting Subtractive PCI-to-PCI Bridges in WindowsSupporting Subtractive PCI-to-PCI Bridges in Windowshttp://www.microsoft.com/whdc/system/bus/pci/PCIbridge-subtr.mspxhttp://www.microsoft.com/whdc/system/bus/pci/PCIbridge-subtr.mspxMachine.inf Update Submission ProcedureMachine.inf Update Submission Procedurehttp://www.microsoft.com/whdc/system/CEC/machine_inf.mspxhttp://www.microsoft.com/whdc/system/CEC/machine_inf.mspx
Related SessionsRelated SessionsCPA0070 PCI Express In-Depth for Windows VistaCPA0070 PCI Express In-Depth for Windows VistaCPA002 ACPI in Windows VistaCPA002 ACPI in Windows Vista
Kernel PnP support questionsKernel PnP support questions Ntpnp @ microsoft.comNtpnp @ microsoft.com
© 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions,
it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.