mirror of
https://github.com/ipxe/ipxe
synced 2025-12-23 21:41:43 +03:00
[block] Provide abstraction to allow system to be quiesced
When performing a SAN boot via INT 13, there is no way for the operating system to indicate that it has finished using the INT 13 SAN device. We therefore have no opportunity to clean up state before the loaded operating system's native drivers take over. This can cause problems when booting Windows, which tends not to be forgiving of unexpected system state. Windows will typically write a flag to the SAN device as the last action before transferring control to the native drivers. We can use this as a heuristic to bring the system to a quiescent state (without performing a full shutdown); this provides us an opportunity to temporarily clean up state that could otherwise prevent a successful Windows boot. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -41,6 +41,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
#include <ipxe/iso9660.h>
|
||||
#include <ipxe/dhcp.h>
|
||||
#include <ipxe/settings.h>
|
||||
#include <ipxe/quiesce.h>
|
||||
#include <ipxe/sanboot.h>
|
||||
|
||||
/**
|
||||
@@ -365,6 +366,9 @@ int sandev_reopen ( struct san_device *sandev ) {
|
||||
struct san_path *sanpath;
|
||||
int rc;
|
||||
|
||||
/* Unquiesce system */
|
||||
unquiesce();
|
||||
|
||||
/* Close any outstanding command and restart interfaces */
|
||||
sandev_restart ( sandev, -ECONNRESET );
|
||||
assert ( sandev->active == NULL );
|
||||
@@ -503,6 +507,9 @@ sandev_command ( struct san_device *sandev,
|
||||
/* Sanity check */
|
||||
assert ( ! timer_running ( &sandev->timer ) );
|
||||
|
||||
/* Unquiesce system */
|
||||
unquiesce();
|
||||
|
||||
/* (Re)try command */
|
||||
do {
|
||||
|
||||
@@ -654,6 +661,14 @@ int sandev_write ( struct san_device *sandev, uint64_t lba,
|
||||
if ( ( rc = sandev_rw ( sandev, lba, count, buffer, block_write ) ) != 0 )
|
||||
return rc;
|
||||
|
||||
/* Quiesce system. This is a heuristic designed to ensure
|
||||
* that the system is quiesced before Windows starts up, since
|
||||
* a Windows SAN boot will typically write a status flag to
|
||||
* the disk as its last action before transferring control to
|
||||
* the native drivers.
|
||||
*/
|
||||
quiesce();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user