Bladeren bron

Added sample AoE test code to tree

tags/v0.9.3
Michael Brown 18 jaren geleden
bovenliggende
commit
d21fc3610f
2 gewijzigde bestanden met toevoegingen van 43 en 0 verwijderingen
  1. 1
    0
      src/Makefile
  2. 42
    0
      src/tests/aoeboot.c

+ 1
- 0
src/Makefile Bestand weergeven

@@ -141,6 +141,7 @@ SRCDIRS		+= drivers/scsi
141 141
 SRCDIRS		+= drivers/ata
142 142
 SRCDIRS		+= drivers/nvs
143 143
 SRCDIRS		+= interface/pxe
144
+SRCDIRS		+= tests
144 145
 
145 146
 # NON_AUTO_SRCS lists files that are excluded from the normal
146 147
 # automatic build system.

+ 42
- 0
src/tests/aoeboot.c Bestand weergeven

@@ -0,0 +1,42 @@
1
+#include <stdint.h>
2
+#include <vsprintf.h>
3
+#include <console.h>
4
+#include <gpxe/netdevice.h>
5
+#include <gpxe/aoe.h>
6
+#include <int13.h>
7
+
8
+static struct aoe_device test_aoedev = {
9
+	.aoe = {
10
+		.major = 0,
11
+		.minor = 0,
12
+	},
13
+};
14
+
15
+int test_aoeboot ( struct net_device *netdev ) {
16
+	struct int13_drive drive;
17
+	int rc;
18
+
19
+	test_aoedev.aoe.netdev = netdev;
20
+	printf ( "Initialising AoE device e%d.%d\n",
21
+		 test_aoedev.aoe.major, test_aoedev.aoe.minor );
22
+	if ( ( rc = init_aoedev ( &test_aoedev ) ) != 0 ) {
23
+		printf ( "Could not reach AoE device e%d.%d\n",
24
+			 test_aoedev.aoe.major, test_aoedev.aoe.minor );
25
+		return rc;
26
+	}
27
+
28
+	memset ( &drive, 0, sizeof ( drive ) );
29
+	drive.blockdev = &test_aoedev.ata.blockdev;
30
+	register_int13_drive ( &drive );
31
+	printf ( "Registered AoE device e%d.%d as BIOS drive %#02x\n",
32
+		 test_aoedev.aoe.major, test_aoedev.aoe.minor, drive.drive );
33
+
34
+	printf ( "Booting from BIOS drive %#02x\n", drive.drive );
35
+	rc = int13_boot ( drive.drive );
36
+	printf ( "Boot failed\n" );
37
+
38
+	printf ( "Unregistering BIOS drive %#02x\n", drive.drive );
39
+	unregister_int13_drive ( &drive );
40
+
41
+	return rc;
42
+}

Laden…
Annuleren
Opslaan