|
@@ -1,4 +1,5 @@
|
1
|
1
|
#include <stdint.h>
|
|
2
|
+#include <stdlib.h>
|
2
|
3
|
#include <vsprintf.h>
|
3
|
4
|
#include <console.h>
|
4
|
5
|
#include <gpxe/netdevice.h>
|
|
@@ -12,13 +13,39 @@ static struct aoe_device test_aoedev = {
|
12
|
13
|
},
|
13
|
14
|
};
|
14
|
15
|
|
15
|
|
-int test_aoeboot ( struct net_device *netdev ) {
|
|
16
|
+static int aoe_parse ( const char *aoename, struct aoe_session *aoe ) {
|
|
17
|
+ char *ptr = ( ( char * ) aoename );
|
|
18
|
+
|
|
19
|
+ if ( *ptr++ != 'e' )
|
|
20
|
+ return -EINVAL;
|
|
21
|
+
|
|
22
|
+ aoe->major = strtoul ( ptr, &ptr, 10 );
|
|
23
|
+ if ( *ptr++ != '.' )
|
|
24
|
+ return -EINVAL;
|
|
25
|
+
|
|
26
|
+ aoe->minor = strtoul ( ptr, &ptr, 10 );
|
|
27
|
+ if ( *ptr )
|
|
28
|
+ return -EINVAL;
|
|
29
|
+
|
|
30
|
+ return 0;
|
|
31
|
+}
|
|
32
|
+
|
|
33
|
+int test_aoeboot ( struct net_device *netdev, const char *aoename,
|
|
34
|
+ unsigned int drivenum ) {
|
16
|
35
|
struct int13_drive drive;
|
17
|
36
|
int rc;
|
18
|
37
|
|
19
|
|
- test_aoedev.aoe.netdev = netdev;
|
|
38
|
+ printf ( "Attempting to boot from AoE device %s via %s\n",
|
|
39
|
+ aoename, netdev_name ( netdev ) );
|
|
40
|
+
|
|
41
|
+ if ( ( rc = aoe_parse ( aoename, &test_aoedev.aoe ) ) != 0 ) {
|
|
42
|
+ printf ( "Invalid AoE device name \"%s\"\n", aoename );
|
|
43
|
+ return rc;
|
|
44
|
+ }
|
|
45
|
+
|
20
|
46
|
printf ( "Initialising AoE device e%d.%d\n",
|
21
|
47
|
test_aoedev.aoe.major, test_aoedev.aoe.minor );
|
|
48
|
+ test_aoedev.aoe.netdev = netdev;
|
22
|
49
|
if ( ( rc = init_aoedev ( &test_aoedev ) ) != 0 ) {
|
23
|
50
|
printf ( "Could not reach AoE device e%d.%d\n",
|
24
|
51
|
test_aoedev.aoe.major, test_aoedev.aoe.minor );
|
|
@@ -26,6 +53,7 @@ int test_aoeboot ( struct net_device *netdev ) {
|
26
|
53
|
}
|
27
|
54
|
|
28
|
55
|
memset ( &drive, 0, sizeof ( drive ) );
|
|
56
|
+ drive.drive = drivenum;
|
29
|
57
|
drive.blockdev = &test_aoedev.ata.blockdev;
|
30
|
58
|
register_int13_drive ( &drive );
|
31
|
59
|
printf ( "Registered AoE device e%d.%d as BIOS drive %#02x\n",
|