|  | @@ -70,6 +70,31 @@ static void efi_udelay ( unsigned long usecs ) {
 | 
		
	
		
			
			| 70 | 70 |   */
 | 
		
	
		
			
			| 71 | 71 |  static unsigned long efi_currticks ( void ) {
 | 
		
	
		
			
			| 72 | 72 |  
 | 
		
	
		
			
			|  | 73 | +	/* EFI provides no clean way for device drivers to shut down
 | 
		
	
		
			
			|  | 74 | +	 * in preparation for handover to a booted operating system.
 | 
		
	
		
			
			|  | 75 | +	 * The platform firmware simply doesn't bother to call the
 | 
		
	
		
			
			|  | 76 | +	 * drivers' Stop() methods.  Instead, drivers must register an
 | 
		
	
		
			
			|  | 77 | +	 * EVT_SIGNAL_EXIT_BOOT_SERVICES event to be signalled when
 | 
		
	
		
			
			|  | 78 | +	 * ExitBootServices() is called, and clean up without any
 | 
		
	
		
			
			|  | 79 | +	 * reference to the EFI driver model.
 | 
		
	
		
			
			|  | 80 | +	 *
 | 
		
	
		
			
			|  | 81 | +	 * Unfortunately, all timers silently stop working when
 | 
		
	
		
			
			|  | 82 | +	 * ExitBootServices() is called.  Even more unfortunately, and
 | 
		
	
		
			
			|  | 83 | +	 * for no discernible reason, this happens before any
 | 
		
	
		
			
			|  | 84 | +	 * EVT_SIGNAL_EXIT_BOOT_SERVICES events are signalled.  The
 | 
		
	
		
			
			|  | 85 | +	 * net effect of this entertaining design choice is that any
 | 
		
	
		
			
			|  | 86 | +	 * timeout loops on the shutdown path (e.g. for gracefully
 | 
		
	
		
			
			|  | 87 | +	 * closing outstanding TCP connections) may wait indefinitely.
 | 
		
	
		
			
			|  | 88 | +	 *
 | 
		
	
		
			
			|  | 89 | +	 * There is no way to report failure from currticks(), since
 | 
		
	
		
			
			|  | 90 | +	 * the API lazily assumes that the host system continues to
 | 
		
	
		
			
			|  | 91 | +	 * travel through time in the usual direction.  Work around
 | 
		
	
		
			
			|  | 92 | +	 * EFI's violation of this assumption by falling back to a
 | 
		
	
		
			
			|  | 93 | +	 * simple free-running monotonic counter.
 | 
		
	
		
			
			|  | 94 | +	 */
 | 
		
	
		
			
			|  | 95 | +	if ( efi_shutdown_in_progress )
 | 
		
	
		
			
			|  | 96 | +		efi_jiffies++;
 | 
		
	
		
			
			|  | 97 | +
 | 
		
	
		
			
			| 73 | 98 |  	return efi_jiffies;
 | 
		
	
		
			
			| 74 | 99 |  }
 | 
		
	
		
			
			| 75 | 100 |  
 |