Skip to content

Commit

Permalink
[driver] Print SAN boot configuration summary on boot splash screen
Browse files Browse the repository at this point in the history
When SAN boot fails, it is currently almost impossible to get
diagnostic information without attaching a debugger.  Fix this by
printing a few brief lines of key information on the boot splash
screen itself.

Signed-off-by: Michael Brown <mbrown@fensystems.co.uk>
  • Loading branch information
mcb30 committed Feb 26, 2011
1 parent 63bc225 commit 697f393
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 12 deletions.
7 changes: 7 additions & 0 deletions src/driver/abft.c
Expand Up @@ -21,6 +21,7 @@
#include <ntddk.h>
#include <ntstrsafe.h>
#include "sanbootconf.h"
#include "boottext.h"
#include "nic.h"
#include "abft.h"

Expand Down Expand Up @@ -53,6 +54,12 @@ VOID parse_abft ( PACPI_DESCRIPTION_HEADER acpi ) {
abft->mac[0], abft->mac[1], abft->mac[2],
abft->mac[3], abft->mac[4], abft->mac[5] );

/* Print compressed information on boot splash screen */
BootPrint ( "NIC %02x:%02x:%02x:%02x:%02x:%02x target e%d.%d\n",
abft->mac[0], abft->mac[1], abft->mac[2],
abft->mac[3], abft->mac[4], abft->mac[5],
abft->shelf, abft->slot );

/* Check for existence of NIC */
status = find_nic ( abft->mac, abft_dummy, NULL );
if ( NT_SUCCESS ( status ) ) {
Expand Down
6 changes: 0 additions & 6 deletions src/driver/acpi.c
Expand Up @@ -86,12 +86,6 @@ NTSTATUS find_acpi_table ( PCHAR signature,
"\"%.6s\" OEM table ID \"%.8s\"\n", signature,
( BASEMEM_START + offset ), table->oem_id,
table->oem_table_id );
/* Warn about use of unsupported software */
if ( strcmp ( table->oem_table_id, "gPXE" ) == 0 ) {
DbgPrint ( "*** WARNING: gPXE is no longer supported; "
"please upgrade to iPXE (http://ipxe.org) "
"***\n" );
}
/* Create copy of table */
*table_copy = ExAllocatePoolWithTag ( NonPagedPool,
table->length,
Expand Down
17 changes: 17 additions & 0 deletions src/driver/ibft.c
Expand Up @@ -22,6 +22,7 @@
#include <ntddk.h>
#include <ntstrsafe.h>
#include "sanbootconf.h"
#include "boottext.h"
#include "registry.h"
#include "nic.h"
#include "ibft.h"
Expand Down Expand Up @@ -141,6 +142,9 @@ static VOID parse_ibft_initiator ( PIBFT_TABLE ibft,
DbgPrint ( ", %s\n", ibft_ipaddr ( &initiator->radius[1] ) );
DbgPrint ( " Name = %s\n",
ibft_string ( ibft, &initiator->initiator_name ) );

/* Print compressed information on boot splash screen */
BootPrint ( "%s\n", ibft_string ( ibft, &initiator->initiator_name ) );
}

/**
Expand Down Expand Up @@ -313,6 +317,15 @@ static VOID parse_ibft_nic ( PIBFT_TABLE ibft, PIBFT_NIC nic ) {
( ( nic->pci_bus_dev_func >> 0 ) & 0x07 ) );
DbgPrint ( " Hostname = %s\n", ibft_string ( ibft, &nic->hostname ) );

/* Print compressed information on boot splash screen */
BootPrint ( "%02x:%02x:%02x:%02x:%02x:%02x %s/",
nic->mac_address[0], nic->mac_address[1],
nic->mac_address[2], nic->mac_address[3],
nic->mac_address[4], nic->mac_address[5],
ibft_ipaddr ( &nic->ip_address ) );
BootPrint ( "%s", inet_ntoa ( subnet_mask ) );
BootPrint ( " gw %s\n", ibft_ipaddr ( &nic->gateway ) );

/* Try to configure NIC */
status = find_nic ( nic->mac_address, store_tcpip_parameters, nic );
if ( NT_SUCCESS ( status ) ) {
Expand Down Expand Up @@ -372,6 +385,10 @@ static VOID parse_ibft_target ( PIBFT_TABLE ibft, PIBFT_TARGET target ) {
DbgPrint ( " Reverse CHAP secret = %s\n",
( ibft_string_exists ( &target->reverse_chap_secret ) ?
"<omitted>" : "" ) );

/* Print compressed information on boot splash screen */
BootPrint ( "%s %s\n", ibft_ipaddr ( &target->ip_address ),
ibft_string ( ibft, &target->target_name ) );
}

/**
Expand Down
5 changes: 4 additions & 1 deletion src/driver/nic.c
Expand Up @@ -26,6 +26,7 @@
#include <ndisguid.h>
#include <ntddndis.h>
#include "sanbootconf.h"
#include "boottext.h"
#include "registry.h"
#include "nic.h"

Expand Down Expand Up @@ -288,7 +289,7 @@ NTSTATUS find_nic ( PUCHAR mac,
DEVICE_INTERFACE_INCLUDE_NONACTIVE,
&symlinks );
if ( ! NT_SUCCESS ( status ) ) {
DbgPrint ( "Could not fetch NIC list: %x\n", status );
BootPrint ( "Could not fetch NIC list: %x\n", status );
return status;
}

Expand All @@ -301,6 +302,8 @@ NTSTATUS find_nic ( PUCHAR mac,
goto done;
}
status = STATUS_NO_SUCH_FILE;
BootPrint ( "ERROR: %02x:%02x:%02x:%02x:%02x:%02x not found\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5] );

done:
/* Free object list */
Expand Down
28 changes: 23 additions & 5 deletions src/driver/sanbootconf.c
Expand Up @@ -25,6 +25,7 @@
#include "ibft.h"
#include "sbft.h"
#include "abft.h"
#include "boottext.h"

/** Maximum time to wait for system disk, in seconds */
#define SANBOOTCONF_MAX_WAIT 120
Expand Down Expand Up @@ -442,23 +443,37 @@ static VOID sanbootconf_wait ( PDRIVER_OBJECT driver, PVOID context,
* Try to find ACPI table
*
* @v signature Table signature
* @v label Label for boot message
* @v parse Table parser
* @ret table_copy Copy of table, or NULL
* @ret found Table was found
*/
static BOOLEAN try_find_acpi_table ( PCHAR signature,
static BOOLEAN try_find_acpi_table ( PCHAR signature, PCHAR label,
VOID ( *parse )
( PACPI_DESCRIPTION_HEADER acpi ),
PACPI_DESCRIPTION_HEADER *table_copy ) {
PACPI_DESCRIPTION_HEADER table;
NTSTATUS status;

/* Try to find table */
status = find_acpi_table ( signature, table_copy );
if ( ! NT_SUCCESS ( status ) ) {
DbgPrint ( "No %s found\n", signature );
return FALSE;
}
table = *table_copy;

/* Inform user that we are attempting a SAN boot */
BootPrint ( "%s boot via %.8s\n", label, table->oem_table_id );
/* Warn about use of unsupported software */
if ( strcmp ( table->oem_table_id, "gPXE" ) == 0 ) {
BootPrint ( "WARNING: gPXE is no longer supported; "
"please upgrade to iPXE (http://ipxe.org)\n" );
}

/* Parse table */
parse ( table );

parse ( *table_copy );
return TRUE;
}

Expand Down Expand Up @@ -493,9 +508,12 @@ NTSTATUS DriverEntry ( IN PDRIVER_OBJECT DriverObject,

/* Look for boot firmware tables*/
found_san =
( try_find_acpi_table ( IBFT_SIG, parse_ibft, &priv->ibft ) |
try_find_acpi_table ( ABFT_SIG, parse_abft, &priv->abft ) |
try_find_acpi_table ( SBFT_SIG, parse_sbft, &priv->sbft ) );
( try_find_acpi_table ( IBFT_SIG, "iSCSI",
parse_ibft, &priv->ibft ) |
try_find_acpi_table ( ABFT_SIG, "AoE",
parse_abft, &priv->abft ) |
try_find_acpi_table ( SBFT_SIG, "SRP",
parse_sbft, &priv->sbft ) );

/* Wait for system disk, if booting from SAN */
if ( found_san ) {
Expand Down

0 comments on commit 697f393

Please sign in to comment.