The ChorusOS Board Support Package (BSP) hot swap feature allows you to remove and replace a board from an instance of the ChorusOS operating system, without having to shut the system down. BSP hot swap starts and stops the driver corresponding to a board that is inserted or removed.
The BSP hot swap features a two-layer implementation:
A board-dependent layer, the Hot Swap Controller (HSC), that handles the ENUM# signal. The ENUM# signal notifies the system of an insertion or a removal event specified by Peripheral Component Interconnect (PCI) hot swap.
A common layer that implements the handler attached to the ENUM# signal. This is a PciSwap device driver installed between the bridge-specific PCI bus implementation and the implementation of the board-specific HSC hot swap interrupt driver.
ChorusOS BSP hot swap support defines and implements a common layer between the PCI bus device driver and the HSC device driver. The implementation of the PCI bus (bridge) is chip-specific and is not supposed to be aware of the PCI hot swap capabilities. However, the handling of the ENUM# event is board-specific, because the ENUM# signal can be routed to any interrupt source and can even be polled upon timeout. The detection of this is not parent bus-specific either, but depends on the implementation of the PCI device inserted.
BSP Hot Swap support is split into three stages:
Handling the ENUM# signal.
Accessing the Hot Swap Control/Status Register (HS_CSR)
Interconnecting with the System Management (system event propagation).
The BSP hot swap feature of the ChorusOS operating system performs the following operations upon system start-up and the insertion or removal of a board.
When started, the PciSwap
device driver looks
up the device registry for the HSC device driver specified
for its node. If found, the PciSwap
driver opens
the HSC device and installs its ENUM#
handler. Without an ENUM# handler the PCI bus node will
not support hot swap. The PCI bus driver init-method looks
up the device registry and searches for the instance of the PciSwap
driver specified for its device node. If found, the PCI bus
driver opens the connection to this instance and installs its handlers for
insertion and removal events. The PCI bus node now has hot swap capabilities.
On insertion of a board, the ENUM# signal is detected
and neutralized by the HSC device driver. This event is
passed to the PciSwap
driver, which detects the slot
into which the board is inserted. The parent PCI bus driver
is notified for each insertion. The PCI bus driver or PciSwap
(or both) invokes the PCI enumerator.
New device nodes are created or static nodes are activated. The device-specific
driver establishes the connection to the PCI bus. The PCI bus driver invokes
a lock method for each activated device node in the PciSwap
driver. The slot is declared BUSY.
The ENUM# signal is detected by the HSC device driver. This event is passed to the PciSwap
driver, which detects which slot to remove. The parent PCI bus driver is notified for each removal. The PCI
bus driver sends the device shutdown event. The PCI device
closes its connection to the PCI bus. The PCI bus driver or PciSwap
(or both) invokes
the PCI enumerator. The dynamic (enumerated) device nodes
are deleted or static nodes are deactivated. When the last connection to the PCI bus driver for the slot is closed, the PCI
bus driver invokes the method of the PciSwap
driver.
The slot is declared FREE and can be removed.
The BSP hot swap feature API is given in the table below:
Function |
Description |
---|---|
open() |
Establish a connection between PCI bus and the Hot Swap Controller device. |
lock() |
Called before device initialization, to show that the PCI slot is busy. |
unlock() |
Called after device shut down, to show that the PCI slot is free to extract. |
close() |
Close a connection between PCI bus and the Hot Swap Controller device. |