6 #include <gpxe/netdevice.h>
10 static struct aoe_device test_aoedev
= {
17 static int aoe_parse ( const char *aoename
, struct aoe_session
*aoe
) {
18 char *ptr
= ( ( char * ) aoename
);
23 aoe
->major
= strtoul ( ptr
, &ptr
, 10 );
27 aoe
->minor
= strtoul ( ptr
, &ptr
, 10 );
34 int test_aoeboot ( struct net_device
*netdev
, const char *aoename
,
35 unsigned int drivenum
) {
36 struct int13_drive drive
;
39 printf ( "Attempting to boot from AoE device %s via %s\n",
40 aoename
, netdev
->name
);
42 if ( ( rc
= aoe_parse ( aoename
, &test_aoedev
.aoe
) ) != 0 ) {
43 printf ( "Invalid AoE device name \"%s\"\n", aoename
);
47 printf ( "Initialising AoE device e%d.%d\n",
48 test_aoedev
.aoe
.major
, test_aoedev
.aoe
.minor
);
49 test_aoedev
.aoe
.netdev
= netdev
;
50 if ( ( rc
= init_aoedev ( &test_aoedev
) ) != 0 ) {
51 printf ( "Could not reach AoE device e%d.%d\n",
52 test_aoedev
.aoe
.major
, test_aoedev
.aoe
.minor
);
56 memset ( &drive
, 0, sizeof ( drive
) );
57 drive
.drive
= drivenum
;
58 drive
.blockdev
= &test_aoedev
.ata
.blockdev
;
59 register_int13_drive ( &drive
);
60 printf ( "Registered AoE device e%d.%d as BIOS drive %#02x\n",
61 test_aoedev
.aoe
.major
, test_aoedev
.aoe
.minor
, drive
.drive
);
63 printf ( "Booting from BIOS drive %#02x\n", drive
.drive
);
64 rc
= int13_boot ( drive
.drive
);
65 printf ( "Boot failed\n" );
67 printf ( "Unregistering BIOS drive %#02x\n", drive
.drive
);
68 unregister_int13_drive ( &drive
);