#include <stdint.h>#include <string.h>#include <stdlib.h>#include <stdio.h>#include <errno.h>#include <gpxe/aoe.h>#include <gpxe/ata.h>#include <gpxe/netdevice.h>#include <gpxe/sanboot.h>#include <gpxe/abft.h>#include <int13.h>Go to the source code of this file.
Functions | |
| FILE_LICENCE (GPL2_OR_LATER) | |
| static int | aoeboot (const char *root_path) |
Variables | |
| struct sanboot_protocol aoe_sanboot_protocol | __sanboot_protocol |
| FILE_LICENCE | ( | GPL2_OR_LATER | ) |
| static int aoeboot | ( | const char * | root_path | ) | [static] |
Definition at line 15 of file aoeboot.c.
References abft_fill_data(), aoe_attach(), aoe_detach(), ata_device::backend, ata_device::blockdev, int13_drive::blockdev, container_of, int13_drive::drive, ENOMEM, free(), init_atadev(), int13_boot(), keep_san(), last_opened_netdev(), netdev, printf(), register_int13_drive(), strerror(), unregister_int13_drive(), and zalloc().
00015 { 00016 struct ata_device *ata; 00017 struct int13_drive *drive; 00018 int rc; 00019 00020 ata = zalloc ( sizeof ( *ata ) ); 00021 if ( ! ata ) { 00022 rc = -ENOMEM; 00023 goto err_alloc_ata; 00024 } 00025 drive = zalloc ( sizeof ( *drive ) ); 00026 if ( ! drive ) { 00027 rc = -ENOMEM; 00028 goto err_alloc_drive; 00029 } 00030 00031 /* FIXME: ugly, ugly hack */ 00032 struct net_device *netdev = last_opened_netdev(); 00033 00034 if ( ( rc = aoe_attach ( ata, netdev, root_path ) ) != 0 ) { 00035 printf ( "Could not attach AoE device: %s\n", 00036 strerror ( rc ) ); 00037 goto err_attach; 00038 } 00039 if ( ( rc = init_atadev ( ata ) ) != 0 ) { 00040 printf ( "Could not initialise AoE device: %s\n", 00041 strerror ( rc ) ); 00042 goto err_init; 00043 } 00044 00045 /* FIXME: ugly, ugly hack */ 00046 struct aoe_session *aoe = 00047 container_of ( ata->backend, struct aoe_session, refcnt ); 00048 abft_fill_data ( aoe ); 00049 00050 drive->blockdev = &ata->blockdev; 00051 00052 register_int13_drive ( drive ); 00053 printf ( "Registered as BIOS drive %#02x\n", drive->drive ); 00054 printf ( "Booting from BIOS drive %#02x\n", drive->drive ); 00055 rc = int13_boot ( drive->drive ); 00056 printf ( "Boot failed\n" ); 00057 00058 /* Leave drive registered, if instructed to do so */ 00059 if ( keep_san() ) 00060 return rc; 00061 00062 printf ( "Unregistering BIOS drive %#02x\n", drive->drive ); 00063 unregister_int13_drive ( drive ); 00064 00065 err_init: 00066 aoe_detach ( ata ); 00067 err_attach: 00068 free ( drive ); 00069 err_alloc_drive: 00070 free ( ata ); 00071 err_alloc_ata: 00072 return rc; 00073 }
| struct sanboot_protocol aoe_sanboot_protocol __sanboot_protocol |
1.5.7.1