Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

aoeboot.c 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #include <stdint.h>
  2. #include <string.h>
  3. #include <stdio.h>
  4. #include <byteswap.h>
  5. #include <gpxe/aoe.h>
  6. #include <gpxe/ata.h>
  7. #include <gpxe/netdevice.h>
  8. #include <gpxe/settings.h>
  9. #include <gpxe/sanboot.h>
  10. #include <gpxe/abft.h>
  11. #include <int13.h>
  12. FILE_LICENCE ( GPL2_OR_LATER );
  13. static int aoeboot ( const char *root_path ) {
  14. struct ata_device ata;
  15. struct int13_drive drive;
  16. int rc;
  17. memset ( &ata, 0, sizeof ( ata ) );
  18. memset ( &drive, 0, sizeof ( drive ) );
  19. /* FIXME: ugly, ugly hack */
  20. struct net_device *netdev = last_opened_netdev();
  21. if ( ( rc = aoe_attach ( &ata, netdev, root_path ) ) != 0 ) {
  22. printf ( "Could not attach AoE device: %s\n",
  23. strerror ( rc ) );
  24. goto error_attach;
  25. }
  26. if ( ( rc = init_atadev ( &ata ) ) != 0 ) {
  27. printf ( "Could not initialise AoE device: %s\n",
  28. strerror ( rc ) );
  29. goto error_init;
  30. }
  31. /* FIXME: ugly, ugly hack */
  32. struct aoe_session *aoe =
  33. container_of ( ata.backend, struct aoe_session, refcnt );
  34. abft_fill_data ( aoe );
  35. drive.blockdev = &ata.blockdev;
  36. register_int13_drive ( &drive );
  37. printf ( "Registered as BIOS drive %#02x\n", drive.drive );
  38. printf ( "Booting from BIOS drive %#02x\n", drive.drive );
  39. rc = int13_boot ( drive.drive );
  40. printf ( "Boot failed\n" );
  41. /* Leave drive registered, if instructed to do so */
  42. if ( keep_san() )
  43. return rc;
  44. printf ( "Unregistering BIOS drive %#02x\n", drive.drive );
  45. unregister_int13_drive ( &drive );
  46. error_init:
  47. aoe_detach ( &ata );
  48. error_attach:
  49. return rc;
  50. }
  51. struct sanboot_protocol aoe_sanboot_protocol __sanboot_protocol = {
  52. .prefix = "aoe:",
  53. .boot = aoeboot,
  54. };