|  | @@ -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 );
 |