I/O Kit Fundamentals
PDF
Introduction
What Is the I/O Kit?
Before You Begin
I/O Kit Features
Design Principles of the I/O Kit
Limitations of the I/O Kit
Language Choice
Using Namespaces in an I/O Kit Driver
Using Static Constructors in an I/O Kit Driver
The Parts of the I/O Kit
Frameworks and Libraries
Applications and Tools
Other I/O Kit Resources
Should You Program in the Kernel?
When Code Should Reside in the Kernel
Alternatives to Kernel-Resident Code
Architectural Overview
Driver Layering
Families and Drivers
Drivers and Nubs
The Anatomy of an I/O Connection
The Runtime Environment of Device Drivers
Runtime Features
Kernel Programming Constraints
The I/O Registry and the I/O Catalog
Driver Matching
The I/O Kit Class Hierarchy
The OS Classes
The General I/O Kit Classes
The I/O Kit Family Classes
Controlling Devices From Outside the Kernel
The Device-Interface Mechanism
POSIX Device Files
The I/O Registry
I/O Registry Architecture and Construction
The I/O Registry Explorer
Driver and Device Matching
Driver Personalities and Matching Languages
Driver Matching and Loading
Driver Matching
Device Probing
Driver Loading
Device Matching
The Base Classes
The libkern Base Classes
Object Creation and Disposal (OSObject)
Object Construction
Object Retention and Disposal
Runtime Type Information (OSMetaClass)
Object Construction and Dynamic Allocation
Type Casting, Object Introspection, and Class Information
Defining C++ Classes in libkern
The I/O Kit Base Classes
Dynamic Driver Registration (IORegistryEntry)
Basic Driver Behavior (IOService)
Driver Object Life Cycle
Driver Matching and Loading
Driver Status Change
Driver Shutdown
Provider Matching
Notification and Messaging
Driver Accessors
Other IOService Features
I/O Kit Families
Drivers and Families
Families As Libraries
Library Versioning
Library Loading
The Programmatic Structure of Families
Typical Classes
Naming and Coding Conventions
Creating An I/O Kit Family
Handling Events
Work Loops
Work Loop Architecture
Shared and Dedicated Work Loops
Examples of Obtaining Work Loops
Event Sources
Handling Interrupts
Interrupt Handling in the I/O Kit
Setting Up an Interrupt Handler Attached to a Work Loop
Filter Interrupt Event Sources
Using Interrupt Handlers With No Work Loops
Handling Timer Events
I/O Requests and Command Gates
Up Calls and Down Calls
Setting Up and Using Command Gates
Completion Chaining
Managing Data
Handling I/O Transfers
Memory Descriptors and Memory Cursors
Memory in an I/O Request
Issues With 64-Bit System Architectures
Address Translation on 64-Bit System Architectures
Supporting DMA on 64-Bit System Architectures
Relaying I/O Requests
More on Memory Descriptors
More on Memory Cursors
DMA and System Memory
Dealing With Hardware Constraints
IOMemoryCursor Subclasses
Managing Power
Power Events
The Power Plane: A Hierarchy of Power Dependencies
Devices and Power States
Deciding How to Implement Power Management in Your Driver
Implementing Basic Power Management
Implementing Advanced Power Management
Defining and Using Multiple Power States
Changing the Power State of a Device
Responding to a Power State–Change Request
Initiating a Power-State Change
Implementing Idleness Determination and Idle Power Saving
Receiving Notification of Power-State Changes in Other Devices
Receiving Shutdown and Restart Notifications
Keeping Power On for Future Device Attachment
Managing Device Removal
The Phases of Device Removal
Making Drivers Inactive
Clearing I/O Queues
Detaching and Releasing Objects
Base and Helper Class Hierarchy
The following chart presents the class hierarchy of all I/O Kit classes that are not members of a specific family. See the preceding appendix, “I/O Kit Family Reference” for the class hierarchy charts of most families.
Bibliography
System Internals
Websites - Online Resources
Glossary
Appendix A: I/O Kit Family Reference
ADB
ATA and ATAPI
Audio
FireWire
Graphics
A Note on NDRV Compatibility
HID
Network
PC Card
PCI and AGP
SBP-2
SCSI Parallel
SCSI Architecture Model
Serial
Storage
IOMedia Filter Schemes
Partition Schemes
IOMedia Properties
Accessing IOMedia From Applications
USB
Devices Without I/O Kit Families
Imaging Devices
Digital Video
Sequential Access Devices (Tape Drives)
Telephony Devices
Vendor-Specific Devices
Revision History
Index