hc
2024-03-25 edb30157bad0c0001c32b854271ace01d3b9a16a
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
/** @file
  PCH DMI library with S3 boot script support.
 
  Copyright (c) 2019 Intel Corporation. All rights reserved. <BR>
 
  SPDX-License-Identifier: BSD-2-Clause-Patent
**/
 
#include <Base.h>
#include <Uefi/UefiBaseType.h>
#include <Library/IoLib.h>
#include <Library/DebugLib.h>
#include <Library/BaseLib.h>
#include <Library/PchPcrLib.h>
#include <Library/PchInfoLib.h>
#include <Library/S3BootScriptLib.h>
#include <Register/PchRegsPcr.h>
#include <Register/PchRegsDmi.h>
 
#include "PchDmi14.h"
#include "PchDmi15.h"
 
/**
  Configure PCH DMI Lock
**/
VOID
PchDmiSetLockWithS3BootScript (
  VOID
  )
{
  UINT32  Data32Or;
  UINT32  Data32And;
  UINT16  Address;
 
  Data32And = 0xFFFFFFFF;
  if (IsPchWithPdmi ()) {
    PchDmi15SrlRegData (&Address, &Data32Or);
  } else {
    PchDmi14SrlRegData (&Address, &Data32Or);
  }
 
  PchPcrAndThenOr32 (
    PID_DMI, Address,
    Data32And,
    Data32Or
    );
  PCH_PCR_BOOT_SCRIPT_READ_WRITE (
    S3BootScriptWidthUint32,
    PID_DMI, Address,
    &Data32Or,
    &Data32And
    );
}
 
/**
  Set BIOS interface Lock-Down
**/
VOID
PchDmiSetBiosLockDownWithS3BootScript (
  VOID
  )
{
  UINT32  Data32Or;
  UINT32  Data32And;
 
  //
  // Set BIOS Lock-Down (BILD)
  // When set, prevents GCS.BBS from being changed
  //
  Data32And = 0xFFFFFFFF;
  Data32Or = B_PCH_DMI_PCR_BILD;
  PchPcrAndThenOr32 (PID_DMI, R_PCH_DMI_PCR_GCS, Data32And, Data32Or);
  PCH_PCR_BOOT_SCRIPT_READ_WRITE (
    S3BootScriptWidthUint32,
    PID_DMI, R_PCH_DMI_PCR_GCS,
    &Data32Or,
    &Data32And
    );
}