8 #include <gpxe/netdevice.h>
9 #include <gpxe/sanboot.h>
10 #include <gpxe/abft.h>
13 FILE_LICENCE ( GPL2_OR_LATER
);
15 static int aoeboot ( const char *root_path
) {
16 struct ata_device
*ata
;
17 struct int13_drive
*drive
;
20 ata
= zalloc ( sizeof ( *ata
) );
25 drive
= zalloc ( sizeof ( *drive
) );
31 /* FIXME: ugly, ugly hack */
32 struct net_device
*netdev
= last_opened_netdev();
34 if ( ( rc
= aoe_attach ( ata
, netdev
, root_path
) ) != 0 ) {
35 printf ( "Could not attach AoE device: %s\n",
39 if ( ( rc
= init_atadev ( ata
) ) != 0 ) {
40 printf ( "Could not initialise AoE device: %s\n",
45 /* FIXME: ugly, ugly hack */
46 struct aoe_session
*aoe
=
47 container_of ( ata
->backend
, struct aoe_session
, refcnt
);
48 abft_fill_data ( aoe
);
50 drive
->blockdev
= &ata
->blockdev
;
52 register_int13_drive ( drive
);
53 printf ( "Registered as BIOS drive %#02x\n", drive
->drive
);
54 printf ( "Booting from BIOS drive %#02x\n", drive
->drive
);
55 rc
= int13_boot ( drive
->drive
);
56 printf ( "Boot failed\n" );
58 /* Leave drive registered, if instructed to do so */
62 printf ( "Unregistering BIOS drive %#02x\n", drive
->drive
);
63 unregister_int13_drive ( drive
);
75 struct sanboot_protocol aoe_sanboot_protocol __sanboot_protocol
= {