## Physical Device Driver Reference

[prev][next][parent][TOC]

### 0h - Remarks

On entry, the request block contains the following fields as inputs to the physical device driver:

Pointer_1 Points to the DevHlp entry point
Pointer_2 Points to the INIT arguments
Data_2 Drive number for the first block device unit

The arguments for installable device drivers from the DEVICE= line in the CONFIG.SYS file allow the physical device driver to use configurable parameters to initialize itself and its device.

At initialization time, the physical device driver runs as a thread under a protected-mode process at application level with I/O privilege. The device driver can issue certain OS/2 dynamic link function calls at this time. Refer to Physical Device Driver Initialization for more details. On completion of initialization, the physical device driver must set fields in the request packet as described:

    /-----------------------------------------\

    |Fields    |Output Information for INIT   |

    |          |Success                       |

    |----------+------------------------------|

    |Data_1    |Number of logical block       |

    |          |devices or units (block       |

    |          |devices only)                 |

    |----------+------------------------------|

    |Pointer_1 |WORD offset to end of code    |

    |          |segment and WORD offset to end|

    |          |of data segment               |

    |----------+------------------------------|

    |Pointer_2 |Points to the BIOS Parameter  |

    |          |Block (BPB) array for the     |

    |          |logical block devices or units|

    |          |(block devices only)          |

    |----------+------------------------------|

    |Status    |Set the status WORD in the    |

    |          |request header to 0100h.      |

    \-----------------------------------------/

A block device driver must return in Data_1 the number of logical devices or units that are available. The kernel's file system layer assigns sequential drive letters to these units. A character device driver then sets Data_1 to 0.

Both block device drivers and character device drivers must set Pointer_1 with the offsets of the code and data segments. This allows a physical device driver to release code and data needed only by the device driver's initialization routine. First, the initialization code and data must be located at the end of the appropriate segments. Then, as the final step in initialization, the physical device driver sets the offsets to the end of the code segment and the end of the data segment. This also permits a physical device driver to load with a maximum-sized data segment (64KB) and let it release the amount that it does not need.

A block device driver must return an array of BPBs for the logical units that it supports in Pointer_2. A character device driver sets Pointer_2 to 0.

The Status field in the request packet header must be set to indicate no error and done. If the physical device driver determines it cannot set up the device and wants to quit, it must return with the error bit in the request packet Status field set to 1. The physical device driver can also return the following:

    /-----------------------------------------\

    |Fields    |Output Information for INIT   |

    |          |Failure                       |

    |----------+------------------------------|

    |Data_1    |BYTE  00h                     |

    |----------+------------------------------|

    |Pointer_1 |WORD 0000h, and WORD 0000h    |

    |----------+------------------------------|

    |Status    |810Ch or 8115                 |

    \-----------------------------------------/

The Status field in the request packet header must be set to indicate the failure of the INIT request with the general failure error return code. The Status must also indicate that the request is done.

One of the above techniques must be used to return device initialization failures from the physical device driver to the system initialization process. A character device driver that contains multiple device driver headers can fail initialization on a subset of the headers in its header chain.

The system initialization process remembers the last nonzero size code and data segment offsets returned for the devices in the device driver that completed initialization. These last values are used to resize the physical device driver's code and data segments after INIT packets have been sent to the physical device driver for each device in the physical device driver header chain.

When a device in the header chain cannot be initialized, the physical device driver can set the code and data segments to 0, and set the error bit in the request packet Status field to indicate initialization failure for that device. The physical device driver will not receive any future request packets for a specific device if it returns a failure for the INIT request packet for that device.

If none of the devices in the device driver header chain passes initialization , and the device driver returns an error code other than Initialization Failed (noncritical) (15h) for at least one device in the device driver chain, a failure message appears and the physical device driver does not remain loaded.

If at least one of the devices in the device driver header chain passes initialization, a failure message does not appear and the physical device driver remains loaded.

Because the system initialization process maintains the pass/fail return status for each device header in a physical device driver header chain, the physical device driver must not manipulate the linkages of the headers.