Browse 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 17 years ago
parent
commit
7d9267561b
3 changed files with 46 additions and 25 deletions
  1. 14
    9
      src/arch/i386/drivers/net/undinet.c
  2. 22
    11
      src/arch/i386/include/undi.h
  3. 10
    5
      src/arch/i386/prefix/pxeprefix.S

+ 14
- 9
src/arch/i386/drivers/net/undinet.c View File

605
 	DBGC ( undinic, "UNDINIC %p using UNDI %p\n", undinic, undi );
605
 	DBGC ( undinic, "UNDINIC %p using UNDI %p\n", undinic, undi );
606
 
606
 
607
 	/* Hook in UNDI stack */
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
 	/* Bring up UNDI stack */
622
 	/* Bring up UNDI stack */
619
 	memset ( &undi_startup, 0, sizeof ( undi_startup ) );
623
 	memset ( &undi_startup, 0, sizeof ( undi_startup ) );
703
 	memset ( &stop_undi, 0, sizeof ( stop_undi ) );
707
 	memset ( &stop_undi, 0, sizeof ( stop_undi ) );
704
 	undinet_call ( undinic, PXENV_STOP_UNDI, &stop_undi,
708
 	undinet_call ( undinic, PXENV_STOP_UNDI, &stop_undi,
705
 		       sizeof ( stop_undi ) );
709
 		       sizeof ( stop_undi ) );
710
+	undi->flags &= ~UNDI_FL_STARTED;
706
 
711
 
707
 	/* Free network device */
712
 	/* Free network device */
708
 	free_netdev ( netdev );
713
 	free_netdev ( netdev );

+ 22
- 11
src/arch/i386/include/undi.h View File

7
  *
7
  *
8
  */
8
  */
9
 
9
 
10
+#ifndef ASSEMBLY
11
+
10
 #include <gpxe/device.h>
12
 #include <gpxe/device.h>
11
 #include <pxe_types.h>
13
 #include <pxe_types.h>
12
 
14
 
42
 	 * Filled in only for the preloaded UNDI device by pxeprefix.S
44
 	 * Filled in only for the preloaded UNDI device by pxeprefix.S
43
 	 */
45
 	 */
44
 	UINT16_t pci_device;
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
 	/** Generic device */
54
 	/** Generic device */
49
 	struct device dev;
55
 	struct device dev;
55
 	void *priv;
61
 	void *priv;
56
 } __attribute__ (( packed ));
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
  * Set UNDI driver-private data
65
  * Set UNDI driver-private data
69
  *
66
  *
84
 	return undi->priv;
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
 #endif /* _UNDI_H */
98
 #endif /* _UNDI_H */

+ 10
- 5
src/arch/i386/prefix/pxeprefix.S View File

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

Loading…
Cancel
Save