当PCIe设备接收到热复位后,LTSSM会进入Recovery and Hot Reset状态,然后返回值Detect状态,并重新开始链路初始化训练。其该PCIe设备的所有状态机,硬件逻辑,端口状态和配置空间中的寄存器(除了Sticky bits)都将被初始化值默认状态。
软件可以通过向桥设备的,特定端口的配置空间中的二级总线复位(Secondary Bus Reset)bit先写0再写1,来产生热复位,如下图所示: 需要注意的是,如果软件设置的是Switch的Upstream端口的二级总线复位bit,则该Switch会往其所有的Downstream端口广播热复位信号。而PCIe-to-PCI桥则会将接收到的热复位信号转换为PRST#置位,发送给PCI设备。 二级总线复位(Secondary Bus Reset)bit在配置空间的位置如下图所示:
An FLR causes a Function to lose track of any outstanding non-posted Requests. Any corresponding Completions that later arrive are referred to as being “stale”. If software issues an FLR while there are outstanding Requests, and then re-enables the Function for operation without waiting for potential stale Completions, any stale Completions that arrive afterwards may cause data corruption by being mistaken by the Function as belonging to Requests issued since the FLR. Software can avoid data corruption from stale Completions in a variety of ways. Here’s a possible algorithm:
Software that’s performing the FLR synchronizes with other software that might potentially access the Function directly, and ensures such accesses do not occur during this algorithm.
Software clears the entire Command register, disabling the Function from issuing any new Requests.
Software polls the Transactions Pending bit in the Device Status register either until it is clear or until it has been long enough that software is reasonably certain that Completions associated with any remaining outstanding Transactions will never arrive. On many platforms, the Transactions Pending bit will usually clear within a few milliseconds, so software might choose to poll during this initial period using a tight software loop. On rare cases when the Transactions Pending bit does not clear by this time, software will need to poll for a much longer platform-specific period (potentially seconds), so software might choose to conduct this polling using a timer-based interrupt polling mechanism.
Software initiates the FLR.
Software waits 100 ms.
Software reconfigures the Function and enables it for normal operation.