summaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorMichael Brown2006-06-01 13:05:36 +0200
committerMichael Brown2006-06-01 13:05:36 +0200
commitd21fc3610fb2142758d4bb35bc682f005d893c35 (patch)
tree56a5cf57b375f424411c8fb9a6d3fe37e06c37ef /src/tests
parentPut in a method to get the MAC address for the AoE target. (It's not (diff)
downloadipxe-d21fc3610fb2142758d4bb35bc682f005d893c35.tar.gz
ipxe-d21fc3610fb2142758d4bb35bc682f005d893c35.tar.xz
ipxe-d21fc3610fb2142758d4bb35bc682f005d893c35.zip
Added sample AoE test code to tree
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/aoeboot.c42
1 files changed, 42 insertions, 0 deletions
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 <stdint.h>
+#include <vsprintf.h>
+#include <console.h>
+#include <gpxe/netdevice.h>
+#include <gpxe/aoe.h>
+#include <int13.h>
+
+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;
+}