/** @file
|
This file is SampleCode for Intel PEI Platform Policy initialization.
|
|
Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
**/
|
|
#include <Uefi.h>
|
#include "DxeSaPolicyInit.h"
|
|
/**
|
Performs silicon late policy initialization.
|
|
The meaning of Policy is defined by silicon code.
|
It could be the raw data, a handle, a protocol, etc.
|
|
The returned data must be used as input data for SiliconPolicyDoneLate(),
|
and SiliconPolicyUpdateLib.SiliconPolicyUpdateLate().
|
|
In FSP or non-FSP path, the input policy could be NULL.
|
The return data is the initialized policy.
|
|
@param[in, out] Policy Pointer to policy.
|
|
@return the initialized policy.
|
**/
|
VOID *
|
EFIAPI
|
SiliconPolicyInitLate (
|
IN OUT VOID *Policy
|
)
|
{
|
EFI_STATUS Status;
|
SA_POLICY_PROTOCOL *SaPolicy;
|
|
ASSERT (Policy == NULL);
|
|
//
|
// Call CreateSaDxeConfigBlocks to create & initialize platform policy structure
|
// and get all Intel default policy settings.
|
//
|
Status = CreateSaDxeConfigBlocks(&SaPolicy);
|
DEBUG((DEBUG_INFO, "SaPolicy->TableHeader.NumberOfBlocks = 0x%x\n ", SaPolicy->TableHeader.NumberOfBlocks));
|
ASSERT_EFI_ERROR(Status);
|
|
return SaPolicy;
|
}
|
|
/*
|
The silicon late policy is finalized.
|
Silicon code can do initialization based upon the policy data.
|
|
The input Policy must be returned by SiliconPolicyInitLate().
|
|
@param[in] Policy Pointer to policy.
|
|
@retval EFI_SUCCESS The policy is handled consumed by silicon code.
|
*/
|
EFI_STATUS
|
EFIAPI
|
SiliconPolicyDoneLate (
|
IN VOID *Policy
|
)
|
{
|
EFI_STATUS Status;
|
SA_POLICY_PROTOCOL *SaPolicy;
|
|
SaPolicy = Policy;
|
|
//
|
// Install SaInstallPolicyProtocol.
|
// While installed, RC assumes the Policy is ready and finalized. So please
|
// update and override any setting before calling this function.
|
//
|
Status = SaInstallPolicyProtocol (gImageHandle, SaPolicy);
|
ASSERT_EFI_ERROR (Status);
|
|
return EFI_SUCCESS;
|
}
|