Parcourir la source

Don't call PXENV_STOP_UNDI in the kpxeprefix. This slighy breaks the

clean separation between loading and starting, but does mean that more
PXE stacks survive the process.
tags/v0.9.3
Michael Brown il y a 17 ans
Parent
révision
7d9267561b

+ 14
- 9
src/arch/i386/drivers/net/undinet.c Voir le fichier

@@ -605,15 +605,19 @@ int undinet_probe ( struct undi_device *undi ) {
605 605
 	DBGC ( undinic, "UNDINIC %p using UNDI %p\n", undinic, undi );
606 606
 
607 607
 	/* Hook in UNDI stack */
608
-	memset ( &start_undi, 0, sizeof ( start_undi ) );
609
-	start_undi.AX = undi->pci_busdevfn;
610
-	start_undi.BX = undi->isapnp_csn;
611
-	start_undi.DX = undi->isapnp_read_port;
612
-	start_undi.ES = BIOS_SEG;
613
-	start_undi.DI = find_pnp_bios();
614
-	if ( ( rc = undinet_call ( undinic, PXENV_START_UNDI, &start_undi,
615
-				   sizeof ( start_undi ) ) ) != 0 )
616
-		goto err_start_undi;
608
+	if ( ! ( undi->flags & UNDI_FL_STARTED ) ) {
609
+		memset ( &start_undi, 0, sizeof ( start_undi ) );
610
+		start_undi.AX = undi->pci_busdevfn;
611
+		start_undi.BX = undi->isapnp_csn;
612
+		start_undi.DX = undi->isapnp_read_port;
613
+		start_undi.ES = BIOS_SEG;
614
+		start_undi.DI = find_pnp_bios();
615
+		if ( ( rc = undinet_call ( undinic, PXENV_START_UNDI,
616
+					   &start_undi,
617
+					   sizeof ( start_undi ) ) ) != 0 )
618
+			goto err_start_undi;
619
+	}
620
+	undi->flags |= UNDI_FL_STARTED;
617 621
 
618 622
 	/* Bring up UNDI stack */
619 623
 	memset ( &undi_startup, 0, sizeof ( undi_startup ) );
@@ -703,6 +707,7 @@ void undinet_remove ( struct undi_device *undi ) {
703 707
 	memset ( &stop_undi, 0, sizeof ( stop_undi ) );
704 708
 	undinet_call ( undinic, PXENV_STOP_UNDI, &stop_undi,
705 709
 		       sizeof ( stop_undi ) );
710
+	undi->flags &= ~UNDI_FL_STARTED;
706 711
 
707 712
 	/* Free network device */
708 713
 	free_netdev ( netdev );

+ 22
- 11
src/arch/i386/include/undi.h Voir le fichier

@@ -7,6 +7,8 @@
7 7
  *
8 8
  */
9 9
 
10
+#ifndef ASSEMBLY
11
+
10 12
 #include <gpxe/device.h>
11 13
 #include <pxe_types.h>
12 14
 
@@ -42,8 +44,12 @@ struct undi_device {
42 44
 	 * Filled in only for the preloaded UNDI device by pxeprefix.S
43 45
 	 */
44 46
 	UINT16_t pci_device;
45
-	/** Padding */
46
-	UINT16_t pad;
47
+	/** Flags
48
+	 *
49
+	 * This is the bitwise OR of zero or more UNDI_FL_XXX
50
+	 * constants.
51
+	 */
52
+	UINT16_t flags;
47 53
 
48 54
 	/** Generic device */
49 55
 	struct device dev;
@@ -55,15 +61,6 @@ struct undi_device {
55 61
 	void *priv;
56 62
 } __attribute__ (( packed ));
57 63
 
58
-/** PCI bus:dev.fn field is invalid */
59
-#define UNDI_NO_PCI_BUSDEVFN 0xffff
60
-
61
-/** ISAPnP card select number field is invalid */
62
-#define UNDI_NO_ISAPNP_CSN 0xffff
63
-
64
-/** ISAPnP read port field is invalid */
65
-#define UNDI_NO_ISAPNP_READ_PORT 0xffff
66
-
67 64
 /**
68 65
  * Set UNDI driver-private data
69 66
  *
@@ -84,4 +81,18 @@ static inline void * undi_get_drvdata ( struct undi_device *undi ) {
84 81
 	return undi->priv;
85 82
 }
86 83
 
84
+#endif /* ASSEMBLY */
85
+
86
+/** PCI bus:dev.fn field is invalid */
87
+#define UNDI_NO_PCI_BUSDEVFN 0xffff
88
+
89
+/** ISAPnP card select number field is invalid */
90
+#define UNDI_NO_ISAPNP_CSN 0xffff
91
+
92
+/** ISAPnP read port field is invalid */
93
+#define UNDI_NO_ISAPNP_READ_PORT 0xffff
94
+
95
+/** UNDI flag: START_UNDI has been called */
96
+#define UNDI_FL_STARTED 0x0001
97
+
87 98
 #endif /* _UNDI_H */

+ 10
- 5
src/arch/i386/prefix/pxeprefix.S Voir le fichier

@@ -10,6 +10,8 @@
10 10
 	.section ".prefix.data", "aw", @progbits
11 11
 	.code16
12 12
 
13
+#include <undi.h>
14
+
13 15
 /*****************************************************************************
14 16
  * Entry point:	set operating context, print welcome message
15 17
  *****************************************************************************
@@ -278,6 +280,7 @@ unload_base_code:
278 280
  * Unload UNDI driver
279 281
  *****************************************************************************
280 282
  */
283
+#ifndef PXELOADER_KEEP_UNDI
281 284
 unload_undi:
282 285
 	/* Issue PXENV_STOP_UNDI */
283 286
 	movw	$PXENV_STOP_UNDI, %bx
@@ -286,12 +289,13 @@ unload_undi:
286 289
 	call	print_pxe_error
287 290
 	jmp	99f
288 291
 1:	/* Free base memory used by UNDI */
289
-#ifndef PXELOADER_KEEP_UNDI
290 292
 	movw	undi_fbms_start, %si
291 293
 	movw	undi_fbms_end, %di
292 294
 	call	free_basemem
293
-#endif /* PXELOADER_KEEP_UNDI */
295
+	/* Clear UNDI_FL_STARTED */
296
+	andw	$~UNDI_FL_STARTED, flags
294 297
 99:	
298
+#endif /* PXELOADER_KEEP_UNDI */
295 299
 
296 300
 /*****************************************************************************
297 301
  * Print remaining free base memory
@@ -678,12 +682,13 @@ entry_segment:		.word 0
678 682
 undi_fbms_start:	.word 0
679 683
 undi_fbms_end:		.word 0
680 684
 
681
-pci_busdevfn:		.word 0xffff
682
-isapnp_csn:		.word 0xffff
683
-isapnp_read_port:	.word 0xffff
685
+pci_busdevfn:		.word UNDI_NO_PCI_BUSDEVFN
686
+isapnp_csn:		.word UNDI_NO_ISAPNP_CSN
687
+isapnp_read_port:	.word UNDI_NO_ISAPNP_READ_PORT
684 688
 
685 689
 pci_vendor:		.word 0
686 690
 pci_device:		.word 0
691
+flags:			.word UNDI_FL_STARTED
687 692
 
688 693
 	.equ undi_device_size, ( . - undi_device )
689 694
 

Chargement…
Annuler
Enregistrer