ch. 9 i/o system 발표자 : 서우석 발표일 : 2006 년 11 월 6 일
TRANSCRIPT
![Page 1: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/1.jpg)
Ch. 9 I/O SystemCh. 9 I/O System
발표자 : 서우석발표일 : 2006 년 11 월 6 일
![Page 2: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/2.jpg)
목차목차
I/O System ComponentsDevice DriversI/O ProcessingThe Plug and Play (PnP) ManagerThe Power ManagerConclusion
![Page 3: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/3.jpg)
목차목차
I/O System ComponentsDevice DriversI/O ProcessingThe Plug and Play (PnP) ManagerThe Power ManagerConclusion
![Page 4: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/4.jpg)
Design GoalDesign Goal
Provide an abstraction of devices to apps.Features
High performance asynchronous packet-based I/O Services support High-Level language and different machine architectureLayering and extensibility Dynamic loading and unloading of device drivers Support for Plug and Play Support for power management Support for multiple installable file systems Windows Management Instrumentation
![Page 5: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/5.jpg)
I/O System ComponentsI/O System Components
![Page 6: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/6.jpg)
I/O ManagerI/O Manager
The Core of the I/O SystemI/O System is packet driven
Presented by an I/O Request Packet (IRP)Create Passing (Forwarding ) Disposing
Supply common codeIndividual drivers become simpler and more compact.
Other featuresManages buffers for I/O requestsProvides timeout supportRecords installable file systemsCommon routinesAsynchronous I/O
![Page 7: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/7.jpg)
Typical I/O ProcessingTypical I/O Processing
Abstracts all I/O requests as operations on a virtual file, even if it is not a file.
virtual files refers to any source or destination for I/Oopen, close, read, write functions
![Page 8: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/8.jpg)
The flow of a typical I/O requestThe flow of a typical I/O request
![Page 9: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/9.jpg)
목차목차
I/O System ComponentsDevice DriversI/O ProcessingThe Plug and Play (PnP) ManagerThe Power ManagerConclusion
![Page 10: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/10.jpg)
Types of Device DriversTypes of Device Drivers
user-mode driversVirtual device drivers to emulate 16-bit MS-DOS appPrinter drivers
kernel-mode driversFile system drivers Plug and Play drivers Non–Plug and Play drivers
ex) network API and protocol drivers
![Page 11: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/11.jpg)
WDM Drivers WDM Drivers
support for Windows power management, Plug and Play, and WMI Types of WDM drivers
Bus drivers manage a logical or physical busex) PCMCIA, PCI, USB, IEEE 1394, and ISAdetecting and informing the PnP manager of devices attached to the bus
Function drivers with the most knowledge about the operation of the device Filter drivers logically layer above or below function drivers, augmenting or changing the behavior of a device or another driver
ex) keyboard capture driver
![Page 12: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/12.jpg)
Layered Drivers Layered Drivers
Class driversimplement the I/O processing for a particular class of devices, such as disk, tape, or CD-ROMwhere the hardware interfaces have been standardized and so one driver can serve devices from a wide variety of manufacturers
Port driversimplement the processing of an I/O request specific to a type of I/O port, such as SCSIimplemented as kernel-mode libraries of functions
Miniport driversmap a generic I/O request to a type of port into an adapter type, such as a specific SCSI adapter
![Page 13: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/13.jpg)
Example: How device drivers workExample: How device drivers work
![Page 14: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/14.jpg)
Example: Adding a layered driver Example: Adding a layered driver
![Page 15: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/15.jpg)
EXPERIMENT: Viewing the Loaded Driver ListEXPERIMENT: Viewing the Loaded Driver List
![Page 16: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/16.jpg)
Key driver-function routinesKey driver-function routines
fills in system data structures to register the rest of the driver's routines with the I/O manager and performs any global driver initialization that's necessary
The PnP manager sends a driver notification via this routine. driver typically allocates a device object
the main functions that a device driver provides
initiate a data transfer to or from a device. This routine is defined only in drivers that rely on the I/O manager to queue its incoming I/O requests
When a device interrupts, the kernel's interrupt dispatcher transfers control to this routine. Only drivers for interrupt- driven devices have ISRs; a file system driver, for example, doesn't have one.
DPC routine executes at a lower IRQL (DPC/dispatch level) than that of the ISR
![Page 17: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/17.jpg)
Other routinesOther routines
One or more I/O completion routinesnotify it when a lower-level driver finishes processing an IRP
A cancel I/O routine I/O operation can be canceled
An unload routine I/O manager can remove drivers from memory
A system shutdown notification routine allows driver cleanup on system shutdown
Error-logging routines When unexpected errors occur (for example, when a disk block goes bad), a driver's error-logging routines note the occurrence and notify the I/O manager
![Page 18: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/18.jpg)
Driver Objects and Device Objects Driver Objects and Device Objects
driver objectrepresents an individual driver in the system The I/O manager obtains the address of each of the driver's dispatch routines (entry points) from the driver object
device object represents a physical or logical device on the system and describes its characteristics
Create driver object calls the driver's initialization routine create device objects to represent devices (Most PnP drivers create devices with add-device routines, optionally assign the device a name (\Device)) unload
![Page 19: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/19.jpg)
Location of Device objectLocation of Device object
Symbolic link make it possible for applications to open the device object in the \Global?? directory Non–Plug and Play and file system drivers typically create a symbolic link with a well-known name
ex) \Device\Hardware2 IoRegisterDeviceInterface
determines the symbolic link that is associated with a device instance
SetupDiEnumDeviceInterfaces enumerate the interfaces present for a particular GUID and to obtain the names of the symbolic links
SetupDiGetDeviceInterfaceDetail obtain additional information about the device
![Page 20: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/20.jpg)
EXPERIMENT: Looking at the \Device Directory EXPERIMENT: Looking at the \Device Directory
![Page 21: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/21.jpg)
The driver object The driver object
![Page 22: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/22.jpg)
EXPERIMENT: Displaying Driver and Device Objects EXPERIMENT: Displaying Driver and Device Objects
![Page 23: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/23.jpg)
Opening Devices Opening Devices
File objects the kernel-mode constructs for handles to files or devicessystem resources that two or more user-mode processes can share have names protected by object-based security support synchronization
![Page 24: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/24.jpg)
File Object Attributes File Object Attributes
FILE_OBJECT in Ntddk.h
Attribute Purpose
Filename Identifies the physical file that the file object refers to
Current byte offset Identifies the current location in the file (valid only for synchronous I/O)
Share modes Indicate whether other callers can open the file for read, write, or delete operations while the current caller is using it
Open mode flags Indicate whether I/O will be synchronous or asynchronous, cached or noncached, sequential or random, and so on
Pointer to device object Indicates the type of device the file resides on
Pointer to the volume parameter block (VPB)
Indicates the volume, or partition, that the file resides on
Pointer to section object pointers Indicates a root structure that describes a mapped file
Pointer to private cache map Identifies which parts of the file are cached by the cache manager and where they reside in the cache
![Page 25: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/25.jpg)
EXPERIMENT: Viewing the File Object Data Structure EXPERIMENT: Viewing the File Object Data Structure
![Page 26: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/26.jpg)
Opening a file object Opening a file object
![Page 27: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/27.jpg)
EXPERIMENT: Viewing Device Handles EXPERIMENT: Viewing Device Handles
![Page 28: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/28.jpg)
EXPERIMENT: Viewing Windows Device Name to Windows Device Name Mappings
EXPERIMENT: Viewing Windows Device Name to Windows Device Name Mappings
![Page 29: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/29.jpg)
목차목차
I/O System ComponentsDevice DriversI/O ProcessingThe Plug and Play (PnP) ManagerThe Power ManagerConclusion
![Page 30: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/30.jpg)
Synchronous I/O and Asynchronous I/OSynchronous I/O and Asynchronous I/O
![Page 31: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/31.jpg)
Fast I/O Fast I/O
bypass generating an IRP and instead go directly to the file system driver or cache manager to complete an I/O request.A driver registers its fast I/O entry points by entering them in a structure pointed to by the PFAST_IO_DISPATCH pointer in its driver object
![Page 32: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/32.jpg)
EXPERIMENT: Looking at a Driver's Registered Fast I/O Routines EXPERIMENT: Looking at a Driver's Registered Fast I/O Routines
![Page 33: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/33.jpg)
Mapped File I/O and File Caching Mapped File I/O and File Caching
the ability to view a file residing on disk as part of a process's virtual memory CreateFileMapping and Map- ViewOfFile functions File systems use the cache manager to map file data in virtual memory to provide better response time for I/O- bound programs
![Page 34: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/34.jpg)
Data structures involved in a single-layered driver I/O request Data structures involved in a single-layered driver I/O request
![Page 35: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/35.jpg)
EXPERIMENT: Looking at Driver Dispatch Routines EXPERIMENT: Looking at Driver Dispatch Routines
![Page 36: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/36.jpg)
EXPERIMENT: Looking at a Thread's Outstanding IRPs EXPERIMENT: Looking at a Thread's Outstanding IRPs
![Page 37: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/37.jpg)
Queuing and completing a synchronous request Queuing and completing a synchronous request
![Page 38: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/38.jpg)
Servicing a device interrupt (phase 1) Servicing a device interrupt (phase 1)
![Page 39: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/39.jpg)
Servicing a device interrupt (phase 2) Servicing a device interrupt (phase 2)
![Page 40: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/40.jpg)
Completing an I/O request (phase 1) Completing an I/O request (phase 1)
![Page 41: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/41.jpg)
Completing an I/O request (phase 2) Completing an I/O request (phase 2)
![Page 42: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/42.jpg)
Synchronization Synchronization
The execution of a driver can be preempted by higher-priority threads and time-slice (or quantum) expiration or can be interrupted by interrupts On multiprocessor systems, Windows can run driver code simultaneously on more than one processorKeAcquireInterruptSpinLock
![Page 43: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/43.jpg)
Queuing an asynchronous request to layered drivers Queuing an asynchronous request to layered drivers
![Page 44: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/44.jpg)
EXPERIMENT: Viewing a Device Stack EXPERIMENT: Viewing a Device Stack
![Page 45: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/45.jpg)
EXPERIMENT: Examining IRPs EXPERIMENT: Examining IRPs
![Page 46: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/46.jpg)
Completing a layered I/O request Completing a layered I/O request
![Page 47: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/47.jpg)
Queuing associated IRPs Queuing associated IRPs
![Page 48: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/48.jpg)
Completing associated IRPs Completing associated IRPs
![Page 49: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/49.jpg)
I/O Completion Ports I/O Completion Ports
![Page 50: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/50.jpg)
Driver Verifier Driver Verifier
looking for a number of illegal operations—including calling kernel-memory pool functions at invalid IRQL, double-freeing memory, and requesting a zero-sized memory allocation
![Page 51: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/51.jpg)
목차목차
I/O System ComponentsDevice DriversI/O ProcessingThe Plug and Play (PnP) ManagerThe Power ManagerConclusion
![Page 52: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/52.jpg)
FeaturesFeatures
automatically recognizes installed devices enumerating devices attached to the system during a boot and detecting the addition and removal of devices as the system executes Hardware resource allocation Loading appropriate drivers
If a suitable driver isn't installed, the kernel-mode PnP manager communicates with the user-mode PnP manager to install the device, possibly requesting the user's assistance in locating a suitable set of drivers
application and driver mechanisms for the detection of hardware configuration changes
![Page 53: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/53.jpg)
Driver Support for Plug and Play Driver Support for Plug and Play
must implement Plug and Play dispatch routinea power management dispatch routine an add-device routine.
start-device command configure its device to use the specified resources
query- remove notification Applications typically register for notification on their handles, which they close during a query-remove notification the driver has a chance to deny the removal or to ensure that any pending I/O operations involving the device have completed and to begin rejecting further I/O requests aimed at the device
remove command
![Page 54: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/54.jpg)
PC card remove/eject utility PC card remove/eject utility
![Page 55: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/55.jpg)
PnP CommandsPnP Commands
query-stop command To reassign a device's resources, temporarily suspend further activity on the device
query-remove command completes pending I/O operations and won't initiate further I/O requests for the device that can't be aborted and subsequently restarted
stop command direct the driver to assign different resources to the device and once again send the driver a start-device command for the device
![Page 56: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/56.jpg)
Device Plug and Play state transitions Device Plug and Play state transitions
![Page 57: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/57.jpg)
The Start Value The Start Value
two main differences between explicit device driver loading and Windows service loading
Only device drivers can specify Start values of boot-start (0) or system-start (1) Device drivers can use the Group and Tag values to control the order of loading within a phase of the boot
Start value of 0 means that the operating system loader loads the driver Start value of 1 means that the I/O manager loads the driver after the executive subsystems have finished initializing
![Page 58: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/58.jpg)
Guideline of Start ValueGuideline of Start Value
Non–Plug and Play drivers set their Start value to reflect the boot phase they want to load in Value 0:
Drivers, including both Plug and Play and non–Plug and Play drivers, that must be loaded by the boot loader during the system bootEx) system bus drivers and the boot file system driver
Value 1: A driver that isn't required for booting the system and that detects a device that a system bus driver can't enumerate Ex) serial port driver
Value 2:A non–Plug and Play driver or file system driver that doesn't have to be present
Value 3:Plug and Play drivers that aren't required to boot the systemEx) Network Adapter
![Page 59: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/59.jpg)
Device Enumeration Device Enumeration
begins device enumeration with a virtual bus driver called Root HAL acts as a bus driver that enumerates devices directly attached to the motherboard HAL relies on the hardware description the Setup process recorded in the registry
![Page 60: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/60.jpg)
Example device tree Example device tree
![Page 61: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/61.jpg)
Device Manager showing the device tree Device Manager showing the device tree
![Page 62: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/62.jpg)
the load and initialization order of drivers the load and initialization order of drivers 1. The I/O manager invokes the driver entry
routine of each boot-start driver. If a boot driver has child devices, the I/O manager enumerates those devices, reporting their presence to the PnP manager
2. After the boot-start drivers are initialized, the PnP manager walks the device tree, loading the drivers for devnodes that weren't loaded in step 1 and starting their devices
3. The PnP manager loads any drivers with a Start value of system-start that aren't yet loaded
4. The Service Control Manager loads drivers marked as auto-start
![Page 63: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/63.jpg)
EXPERIMENT: Dumping the Device Tree EXPERIMENT: Dumping the Device Tree
![Page 64: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/64.jpg)
Devnode Driver Loading Devnode Driver Loading
When a bus driver performs device enumeration, it reports device identifiers for the devices it detects back to the PnP manager device instance ID (DIID)
device IDvendor ID (VID) product ID (PID)
instance ID distinguish different instances of the same hardware
HKLM\SYSTEM\CurrentControlSet\Enum
ClassGUIDHKLM\ SYSTEM\CurrentControlSet\Control\Class Device’s devnode
![Page 65: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/65.jpg)
Keyboard enumeration key Keyboard enumeration key
![Page 66: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/66.jpg)
EXPERIMENT: Viewing Detailed Devnode Information in Device Manager
EXPERIMENT: Viewing Detailed Devnode Information in Device Manager
![Page 67: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/67.jpg)
Keyboard class key Keyboard class key
![Page 68: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/68.jpg)
Driver InstallationDriver Installation
![Page 69: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/69.jpg)
Driver Installation Driver Installation
1. checks the registry for the presence of a corresponding function driver
2. The user-mode PnP manager first tries to perform an automatic install. require user interaction and the currently logged-on user has administrator privileges
3. execute the Hardware Installation Wizard (\Windows\System32\Newdev.dll). the user-mode PnP manager defers the installation until a privileged user logs on
4. Hardware Installation Wizard uses Setup and CfgMgr (Configuration Manager) API functions to locate INF files that correspond to drivers 1. require INF file (User select or \Windows\Driver Cache\i386\
Driver.cab )2. launch class or device co-installer DLLs that perform class or
device-specific installation steps 3. Check Driver-signing policy options
5. kernel-mode PnP manager starts the driver
![Page 70: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/70.jpg)
EXPERIMENT: Looking at a Driver's INF File EXPERIMENT: Looking at a Driver's INF File
![Page 71: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/71.jpg)
EXPERIMENT: Viewing Catalog Files EXPERIMENT: Viewing Catalog Files
![Page 72: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/72.jpg)
목차목차
I/O System ComponentsDevice DriversI/O ProcessingThe Plug and Play (PnP) ManagerThe Power ManagerConclusion
![Page 73: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/73.jpg)
System Power-State Definitions System Power-State Definitions
Advanced Configuration and Power Interface (ACPI) specification
http://www.teleport.com/~acpi/spec.htm
State Power Consumption Software Resumption Hardware Latency
S0 (fully on) Maximum Not applicable None
S1 (sleeping) Less than S0, more than S2
System resumes where it left off (returns to S0) Less than 2 seconds
S2 (sleeping) Less than S1, more than S3
System resumes where it left off (returns to S0) 2 or more seconds
S3 (sleeping) Less than S2; processor is off
System resumes where it left off (returns to S0) Same as S2
S4 (hibernating) Trickle current to power button and wake circuitry
System restarts from saved hibernate file and resumes where it left off prior to hibernation (returns to S0)
Long and undefined
S5 (fully off) Trickle current to power button
System boot Long and undefined
![Page 74: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/74.jpg)
System power-state transitions System power-state transitions
![Page 75: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/75.jpg)
Example System-to-Device Power Mappings Example System-to-Device Power Mappings
System Power State Device Power State
S0 (fully on) D0 (fully on)
S1 (sleeping) D2
S2 (sleeping) D2
S3 (sleeping) D2
S4 (hibernating) D3 (fully off)
S5 (fully off) D3 (fully off)
![Page 76: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/76.jpg)
EXPERIMENT: Viewing a Driver's Power Mappings EXPERIMENT: Viewing a Driver's Power Mappings
![Page 77: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/77.jpg)
EXPERIMENT: Viewing the System Power Capabilities and Policy EXPERIMENT: Viewing the System Power Capabilities and Policy
![Page 78: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/78.jpg)
Driver Control of Device Power Driver Control of Device Power
control the device power state of its devices PoRegisterDeviceForIdleDetection
registers the device with the power manage informs the power manager of the timeout values to use to detect a device as idle and of the device power state that the power manager should apply when it detects the device as being idle
PoSetDeviceBusy driver must inform the power manager, by calling the PoSetDeviceBusy function, whenever the device is active.
![Page 79: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/79.jpg)
목차목차
I/O System ComponentsDevice DriversI/O ProcessingThe Plug and Play (PnP) ManagerThe Power ManagerConclusion
![Page 80: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/80.jpg)
ConclusionConclusion
![Page 81: Ch. 9 I/O System 발표자 : 서우석 발표일 : 2006 년 11 월 6 일](https://reader035.vdocuments.site/reader035/viewer/2022062221/56649e745503460f94b744da/html5/thumbnails/81.jpg)
Q&AQ&A