/** @file
  Comet Lake U LP3 SMM Multi-Board ACPI Support library


  Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
  SPDX-License-Identifier: BSD-2-Clause-Patent
**/

#include <Base.h>
#include <Uefi.h>
#include <PiDxe.h>
#include <Library/BaseLib.h>
#include <Library/IoLib.h>
#include <Library/BoardAcpiEnableLib.h>
#include <Library/MultiBoardAcpiSupportLib.h>
#include <Library/PcdLib.h>
#include <Library/DebugLib.h>

#include <PlatformBoardId.h>

EFI_STATUS
EFIAPI
CometlakeURvpBoardEnableAcpi(
  IN BOOLEAN  EnableSci
  );

EFI_STATUS
EFIAPI
CometlakeURvpBoardDisableAcpi(
  IN BOOLEAN  DisableSci
  );

EFI_STATUS
EFIAPI
SiliconEnableAcpi (
  IN BOOLEAN  EnableSci
  );

EFI_STATUS
EFIAPI
SiliconDisableAcpi (
  IN BOOLEAN  DisableSci
  );

EFI_STATUS
EFIAPI
CometlakeURvpMultiBoardEnableAcpi (
  IN BOOLEAN  EnableSci
  )
{
  SiliconEnableAcpi (EnableSci);
  return CometlakeURvpBoardEnableAcpi(EnableSci);
}

EFI_STATUS
EFIAPI
CometlakeURvpMultiBoardDisableAcpi (
  IN BOOLEAN  DisableSci
  )
{
  SiliconDisableAcpi (DisableSci);
  return CometlakeURvpBoardDisableAcpi(DisableSci);
}

BOARD_ACPI_ENABLE_FUNC  mCometlakeURvpBoardAcpiEnableFunc = {
  CometlakeURvpMultiBoardEnableAcpi,
  CometlakeURvpMultiBoardDisableAcpi,
};

EFI_STATUS
EFIAPI
SmmCometlakeURvpMultiBoardAcpiSupportLibConstructor (
  VOID
  )
{
  if (LibPcdGetSku () == BoardIdCometLakeULpddr3Rvp) {
    return RegisterBoardAcpiEnableFunc (&mCometlakeURvpBoardAcpiEnableFunc);
  }
  return EFI_SUCCESS;
}


