alder_lake_bios/Oem/L05/FeatureCommon/InsydeL05ModulePkg/Library/DxeOemSvcFeatureLib/OemSvcAcAdapterString.c

67 lines
1.9 KiB
C

/** @file
Provide an interface for Project to get AC charging status.
;******************************************************************************
;* Copyright (c) 2013, Insyde Software Corp. All Rights Reserved.
;*
;* You may not reproduce, distribute, publish, display, perform, modify, adapt,
;* transmit, broadcast, present, recite, release, license or otherwise exploit
;* any part of this publication in any form, by any means, without the prior
;* written permission of Insyde Software Corporation.
;*
;******************************************************************************
*/
#include <Library/FeatureLib/OemSvcAcAdapterString.h>
#include <Library/LfcEcLib.h>
//[-start-210908-QINGLIN0054-add]//
#ifdef S370_SUPPORT
#include <Library/OemSvcLfcPeiGetBoardID.h>
#endif
//[-end-210908-QINGLIN0054-add]//
/**
Provide an interface for Project to get charging status.
@param Chargingstatus 0: Not charing.
1: Connect nominal charging.
2: Connect slow charging.
3: Connect incompatible charging.
4: Connect unknow charging.
@retval EFI_UNSUPPORTED Returns unsupported by default. The return status will not be referenced.
**/
EFI_STATUS
OemSvcAcAdapterString (
IN OUT UINT8 *Chargingstatus
)
{
/*++
Todo:
Add project specific code in here.
--*/
UINT8 ECData = 0;
//[-start-210908-QINGLIN0054-add]//
#if defined(S370_SUPPORT)
UINT8 Project_Type = 0;
OemSvcLfcGetBoardID(PROJECT_ID, &Project_Type);
if (Project_Type == PROJECT_ID_S170) {
return EFI_UNSUPPORTED;
}
#endif
//[-end-210908-QINGLIN0054-add]//
LfcEcLibEcRamRead(0xA3, &ECData);
if((ECData & BIT1) == BIT1){
*Chargingstatus = 0x03;
return EFI_SUCCESS;
}else{
return EFI_UNSUPPORTED;
}
}