## Physical Device Driver Reference

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

### 14h - Remarks

When a physical device driver is loaded, the attribute field and name in its header are used to determine if the new device driver is attempting to replace a driver already installed. If so, the previously installed device driver is requested by the operating system to DEINSTALL the indicated device. If the installed device driver refuses the DEINSTALL command, the new device driver is not allowed to initialize. If the installed device driver performs the DEINSTALL, the new device driver is initialized.

If the character device driver honors the DEINSTALL request, it must perform the following actions:

Release any allocated physical memory (FreePhys, VMFree)
Unset any hardware vectors that it had claimed (such as UnSetIRQ)
Perform any other cleanup (such as FreeCtxHook, FreeGDTSelector, FreeReqPacket, ResetTimer)
Clear the error bit in the Status field to indicate a successful DEINSTALL

If the character device driver determines that it cannot terminate, it should set the error bit in the Status field and set the error code to 03h, UNKNOWN COMMAND.

Hardware Interrupt Considerations: In honoring a DEINSTALL command, a device driver must remove its claim on the interrupt level. The DevHlp_ UnSetIRQ provides this service.

If the physical device driver's device is ill-behaved (that is, it cannot be told to stop generating interrupts or be quiesced), the physical device driver must not remove its interrupt handler. In this case, the physical device driver must refuse the DEINSTALL request.

Note: Because of the general interrupt sharing capabilities in a level- sensitive interrupt environment, device drivers should not assume that the DevHlp_IRQ service can be used to determine whether a given device is being used by another device driver. Instead, the DEINSTALL convention should be used on the logical device name that another driver might be using to access the same device.