Переглянути джерело

[undi] Ensure only one UNDI instance is loaded

Loading multiple UNDI instances would be useful in systems that have
several network cards with vendor PXE ROMs.  However, we cannot rely on
UNDI ROMs working correctly with multiple instances loaded
simultaneously.

The gPXE UNDI driver supports the following multi-NIC configurations:
1. Chainloading undionly.kpxe on a specific NIC.
2. Loading the UNDI driver for the first probed device and ignoring all
   other UNDI devices in the system.

This patch refuses to probe additional UNDI devices so there can never
be multiple instances of UNDI loaded.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Marty Connor <mdc@etherboot.org>
tags/v1.20.1
Stefan Hajnoczi 15 роки тому
джерело
коміт
b7af0aa34e
1 змінених файлів з 12 додано та 0 видалено
  1. 12
    0
      src/arch/i386/drivers/net/undiload.c

+ 12
- 0
src/arch/i386/drivers/net/undiload.c Переглянути файл

@@ -58,6 +58,12 @@ int undi_load ( struct undi_device *undi, struct undi_rom *undirom ) {
58 58
 	uint16_t exit;
59 59
 	int rc;
60 60
 
61
+	/* Only one UNDI instance may be loaded at any given time */
62
+	if ( undi_loader_entry.segment ) {
63
+		DBG ( "UNDI %p cannot load multiple instances\n", undi );
64
+		return -EBUSY;
65
+	}
66
+
61 67
 	/* Set up START_UNDI parameters */
62 68
 	memset ( &undi_loader, 0, sizeof ( undi_loader ) );
63 69
 	undi_loader.AX = undi->pci_busdevfn;
@@ -109,6 +115,9 @@ int undi_load ( struct undi_device *undi, struct undi_rom *undirom ) {
109 115
 	gateA20_set();
110 116
 
111 117
 	if ( exit != PXENV_EXIT_SUCCESS ) {
118
+		/* Clear entry point */
119
+		memset ( &undi_loader_entry, 0, sizeof ( undi_loader_entry ) );
120
+
112 121
 		rc = -undi_loader.Status;
113 122
 		if ( rc == 0 ) /* Paranoia */
114 123
 			rc = -EIO;
@@ -151,6 +160,9 @@ int undi_unload ( struct undi_device *undi ) {
151 160
 
152 161
 	DBGC ( undi, "UNDI %p unloading\n", undi );
153 162
 
163
+	/* Clear entry point */
164
+	memset ( &undi_loader_entry, 0, sizeof ( undi_loader_entry ) );
165
+
154 166
 	/* Erase signatures */
155 167
 	if ( undi->pxenv.segment )
156 168
 		put_real ( dead, undi->pxenv.segment, undi->pxenv.offset );

Завантаження…
Відмінити
Зберегти