1 /** @file 2 MicroSecondDelay implementation of ACPI Timer. 3 4 Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR> 5 6 This program and the accompanying materials are licensed and made available under 7 the terms and conditions of the BSD License that accompanies this distribution. 8 The full text of the license may be found at 9 http://opensource.org/licenses/bsd-license.php. 10 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 14 --*/ 15 16 #include "PiPei.h" 17 #include "I2CAccess.h" 18 #include "I2CDelayPei.h" 19 #include <Library/DebugLib.h> 20 #include <Library/PeiServicesTablePointerLib.h> 21 #include <Ppi/Stall.h> 22 23 /** 24 Stalls the CPU for at least the given number of microseconds. 25 Stalls the CPU for the number of microseconds specified by MicroSeconds. 26 27 @param MicroSeconds The minimum number of microseconds to delay. 28 29 @return EFI_STATUS 30 31 **/ 32 EFI_STATUS 33 EFIAPI MicroSecondDelay(IN UINTN MicroSeconds)34MicroSecondDelay ( 35 IN UINTN MicroSeconds 36 ) 37 { 38 39 EFI_PEI_STALL_PPI *StallPpi; 40 EFI_STATUS Status; 41 CONST EFI_PEI_SERVICES **PeiServices; 42 43 PeiServices = GetPeiServicesTablePointer(); 44 45 46 Status = (**PeiServices).LocatePpi (PeiServices, &gEfiPeiStallPpiGuid, 0, NULL, &StallPpi); 47 ASSERT(!EFI_ERROR(Status)); 48 49 StallPpi->Stall (PeiServices, StallPpi, MicroSeconds); 50 51 return EFI_SUCCESS; 52 } 53