I2cDebugPortTplDxe.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /** @file
  2. Serial I/O Port library implementation for the HDMI I2C Debug Port
  3. DXE Library implementation
  4. Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
  5. SPDX-License-Identifier: BSD-2-Clause-Patent
  6. **/
  7. #include <Uefi.h>
  8. #include <Library/UefiBootServicesTableLib.h>
  9. #include <Library/UefiLib.h>
  10. STATIC EFI_TPL mPreviousTpl = 0;
  11. /**
  12. For boot phases that utilize task priority levels (TPLs), this function raises
  13. the TPL to the appriopriate level needed to execute I/O to the I2C Debug Port
  14. **/
  15. VOID
  16. RaiseTplForI2cDebugPortAccess (
  17. VOID
  18. )
  19. {
  20. if (EfiGetCurrentTpl () < TPL_NOTIFY) {
  21. mPreviousTpl = gBS->RaiseTPL (TPL_NOTIFY);
  22. }
  23. }
  24. /**
  25. For boot phases that utilize task priority levels (TPLs), this function
  26. restores the TPL to the previous level after I/O to the I2C Debug Port is
  27. complete
  28. **/
  29. VOID
  30. RestoreTplAfterI2cDebugPortAccess (
  31. VOID
  32. )
  33. {
  34. if (mPreviousTpl > 0) {
  35. gBS->RestoreTPL (mPreviousTpl);
  36. mPreviousTpl = 0;
  37. }
  38. }