From d21fc3610fb2142758d4bb35bc682f005d893c35 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Thu, 1 Jun 2006 11:05:36 +0000 Subject: [PATCH] Added sample AoE test code to tree --- src/Makefile | 1 + src/tests/aoeboot.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 src/tests/aoeboot.c diff --git a/src/Makefile b/src/Makefile index 9e3e012e..989199c4 100644 --- a/src/Makefile +++ b/src/Makefile @@ -141,6 +141,7 @@ SRCDIRS += drivers/scsi SRCDIRS += drivers/ata SRCDIRS += drivers/nvs SRCDIRS += interface/pxe +SRCDIRS += tests # NON_AUTO_SRCS lists files that are excluded from the normal # automatic build system. diff --git a/src/tests/aoeboot.c b/src/tests/aoeboot.c new file mode 100644 index 00000000..91a7ff41 --- /dev/null +++ b/src/tests/aoeboot.c @@ -0,0 +1,42 @@ +#include +#include +#include +#include +#include +#include + +static struct aoe_device test_aoedev = { + .aoe = { + .major = 0, + .minor = 0, + }, +}; + +int test_aoeboot ( struct net_device *netdev ) { + struct int13_drive drive; + int rc; + + test_aoedev.aoe.netdev = netdev; + printf ( "Initialising AoE device e%d.%d\n", + test_aoedev.aoe.major, test_aoedev.aoe.minor ); + if ( ( rc = init_aoedev ( &test_aoedev ) ) != 0 ) { + printf ( "Could not reach AoE device e%d.%d\n", + test_aoedev.aoe.major, test_aoedev.aoe.minor ); + return rc; + } + + memset ( &drive, 0, sizeof ( drive ) ); + drive.blockdev = &test_aoedev.ata.blockdev; + register_int13_drive ( &drive ); + printf ( "Registered AoE device e%d.%d as BIOS drive %#02x\n", + test_aoedev.aoe.major, test_aoedev.aoe.minor, drive.drive ); + + printf ( "Booting from BIOS drive %#02x\n", drive.drive ); + rc = int13_boot ( drive.drive ); + printf ( "Boot failed\n" ); + + printf ( "Unregistering BIOS drive %#02x\n", drive.drive ); + unregister_int13_drive ( &drive ); + + return rc; +}