Home | History | Annotate | Download | only in BaseS3StallLib
      1 /** @file
      2   Stall Services that do stall and also enable the Stall operatation
      3   to be replayed during an S3 resume. This library class maps directly on top
      4   of the Timer class.
      5 
      6   Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
      7 
      8   This program and the accompanying materials
      9   are licensed and made available under the terms and conditions
     10   of the BSD License which accompanies this distribution.  The
     11   full text of the license may be found at
     12   http://opensource.org/licenses/bsd-license.php
     13 
     14   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     15   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     16 
     17 **/
     18 
     19 #include <Base.h>
     20 
     21 #include <Library/TimerLib.h>
     22 #include <Library/DebugLib.h>
     23 #include <Library/S3BootScriptLib.h>
     24 #include <Library/S3StallLib.h>
     25 
     26 
     27 /**
     28   Stalls the CPU for at least the given number of microseconds and and saves
     29   the value in the S3 script to be replayed on S3 resume.
     30 
     31   Stalls the CPU for the number of microseconds specified by MicroSeconds.
     32 
     33   @param  MicroSeconds  The minimum number of microseconds to delay.
     34 
     35   @return MicroSeconds
     36 
     37 **/
     38 UINTN
     39 EFIAPI
     40 S3Stall (
     41   IN UINTN                     MicroSeconds
     42   )
     43 {
     44   RETURN_STATUS    Status;
     45 
     46   Status = S3BootScriptSaveStall (MicroSecondDelay (MicroSeconds));
     47   ASSERT (Status == RETURN_SUCCESS);
     48 
     49   return MicroSeconds;
     50 }
     51 
     52 
     53