summaryrefslogtreecommitdiff
path: root/Board/NB/NBSetup/NBSetupReset.c
blob: 1be4b634d6eccb4212959d2394c754784cb3e0d2 (plain)
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
//*************************************************************************
//*************************************************************************
//**                                                                     **
//**        (C)Copyright 1985-2011, American Megatrends, Inc.            **
//**                                                                     **
//**                       All Rights Reserved.                          **
//**                                                                     **
//**      5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093           **
//**                                                                     **
//**                       Phone: (770)-246-8600                         **
//**                                                                     **
//*************************************************************************
//*************************************************************************

//*************************************************************************
// $Header: /Alaska/BIN/Chipset/Intel/NorthBridge/Haswell/Intel SystemAgent NB Board/NBSetup/NBSetupReset.c 4     3/13/14 11:16p Dennisliu $
//
// $Revision: 4 $
//
// $Date: 3/13/14 11:16p $
//*************************************************************************
// Revision History
// ----------------
// $Log: /Alaska/BIN/Chipset/Intel/NorthBridge/Haswell/Intel SystemAgent NB Board/NBSetup/NBSetupReset.c $
// 
// 4     3/13/14 11:16p Dennisliu
// [TAG]           None
// [Category]      Improvement
// [Description]   Add new item "PrimaryDisplay" in NBSetupResetHook.
// [Files]         NBSetupReset.c
// 
// 3     10/14/12 12:38a Jeffch
// [TAG]          None
// [Severity]     Important
// [Description]  Follow Update by Mahobay.
// [Files]        NBPei.c, NBDxe.c;
// 
// 2     4/26/12 2:57a Yurenlai
// [TAG]           None
// [Category]      Improvement
// [Severity]      Important
// [Description]   Adjust Intel System Agent module the Setup item and
// Policy.
// [Description]   GetSetupData.c, NB.sdl, NB.sd, NB.uni, NBDxe.c,
// NBPEI.c,
//                 NBSetup.c, NBSetupReset.c, NbSetupData.h
// 
// 1     2/08/12 4:33a Yurenlai
// Intel Haswell/NB eChipset initially releases.
// 
//*************************************************************************
//<AMI_FHDR_START>
//
// Name:        NBSetupReset.c
//
// Description: North Bridge Setup Reset Rountines
//
//<AMI_FHDR_END>
//*************************************************************************
#include <EFI.h>
#include <Token.h>
#include <AmiLib.h>
#include <AmiDxeLib.h>
#include <Setup.h>
#if defined(RESET_RUNTIME_SERVICES_SUPPORT) && (RESET_RUNTIME_SERVICES_SUPPORT == 0)
#include <Protocol\PchReset\PchReset.h>
#else
#include <AmiCSPLib.h>
#include <PchRegsLpc.h>
#endif
//----------------------------------------------------------------------------
// Variable and External Declaration(s)
//----------------------------------------------------------------------------
// Variable Declaration(s)
static SETUP_DATA            gNewSetupData;
static SETUP_DATA            gOldSetupData;

// GUID Definition(s)
static EFI_GUID              gEfiSetupGuid = SETUP_GUID;


//<AMI_PHDR_START>
//----------------------------------------------------------------------------
// Procedure:	NBProcessEnterSetup
//
// Description:	This function is a hook called when TSE determines
//              that it has to load the boot options in the boot
//              order. This function is available as ELINK.
//
// Input:               VOID
//
// Output:              VOID
//
//----------------------------------------------------------------------------
//<AMI_PHDR_END>
VOID NBProcessEnterSetup(VOID)
{
  EFI_STATUS            Status;
  UINTN                 VariableSize;

  VariableSize = sizeof (SETUP_DATA);
  Status = pRS->GetVariable (
                  L"Setup",
                  &gEfiSetupGuid,
                  NULL,
                  &VariableSize,
                  &gOldSetupData
                  );

}

//<AMI_PHDR_START>
//----------------------------------------------------------------------------
// Procedure:	NBSetupResetHook
//
// Description:	This function is a hook called after some control 
//              modified in the setup utility by user. This
//              function is available as ELINK.
//
// Input:               VOID
//
// Output:              VOID
//
//----------------------------------------------------------------------------
//<AMI_PHDR_END>
VOID NBSetupResetHook(VOID)
{

  EFI_STATUS            Status;
  UINTN                 VariableSize;

  VariableSize = sizeof (SETUP_DATA);
  Status = pRS->GetVariable (
                  L"Setup",
                  &gEfiSetupGuid,
                  NULL,
                  &VariableSize,
                  &gNewSetupData
                  );
  if (!EFI_ERROR (Status)) {
      if ((gNewSetupData.EnableVtd != gOldSetupData.EnableVtd) ||
      (gNewSetupData.BdatAcpiTableSupport != gOldSetupData.BdatAcpiTableSupport) ||
      (gNewSetupData.PegGenx0 != gOldSetupData.PegGenx0) ||
      (gNewSetupData.PegGenx1 != gOldSetupData.PegGenx1) ||
      (gNewSetupData.PegGenx2 != gOldSetupData.PegGenx2) ||
      (gNewSetupData.ExitMode != gOldSetupData.ExitMode) ||
      (gNewSetupData.DmiGen2 != gOldSetupData.DmiGen2) ||
      (gNewSetupData.NBDmiAspm != gOldSetupData.NBDmiAspm) ||
      (gNewSetupData.NBDmiExtSync != gOldSetupData.NBDmiExtSync) ||
      (gNewSetupData.DetectNonComplaint != gOldSetupData.DetectNonComplaint) ||
      (gNewSetupData.AlwaysEnablePeg != gOldSetupData.AlwaysEnablePeg) ||
      (gNewSetupData.PowerDownMode0 != gOldSetupData.PowerDownMode0) ||
      (gNewSetupData.PrimaryDisplay != gOldSetupData.PrimaryDisplay) ||
      (gNewSetupData.PowerDownMode1 != gOldSetupData.PowerDownMode1)) {
          //
          // Powe Cycle Reset
          //
#if defined(RESET_RUNTIME_SERVICES_SUPPORT) && (RESET_RUNTIME_SERVICES_SUPPORT == 0)
          pRS->ResetSystem (PowerCycleReset, EFI_SUCCESS, 0, NULL);
#else
          SBLib_ExtResetSystem (SbResetFull);
#endif

      }
  }


}
//*************************************************************************
//*************************************************************************
//**                                                                     **
//**        (C)Copyright 1985-2011, American Megatrends, Inc.            **
//**                                                                     **
//**                       All Rights Reserved.                          **
//**                                                                     **
//**      5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093           **
//**                                                                     **
//**                       Phone: (770)-246-8600                         **
//**                                                                     **
//*************************************************************************
//*************************************************************************