hc
2024-03-22 a0752693d998599af469473b8dc239ef973a012f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/** @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;
}