summaryrefslogtreecommitdiff
path: root/Core/CPU/MicrocodeUpdate/MicrocodeUpdate.h
blob: 73b5deaf02b6fba6f518b6588b00075e244dbedf (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
//*************************************************************************
//*************************************************************************
//**                                                                     **
//**        (C)Copyright 1987-2013, American Megatrends, Inc.            **
//**                                                                     **
//**                       All Rights Reserved.                          **
//**                                                                     **
//**      5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093           **
//**                                                                     **
//**                       Phone: (770)-246-8600                         **
//**                                                                     **
//*************************************************************************
//*************************************************************************

//****************************************************************************
// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/AMI Cpu PKG/CPU Core/MicrocodeUpdate/MicrocodeUpdate.h 1     2/07/12 3:59a Davidhsieh $
//
// $Revision: 1 $
//
// $Date: 2/07/12 3:59a $
//
//****************************************************************************
// Revision History
// ----------------
// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/AMI Cpu PKG/CPU Core/MicrocodeUpdate/MicrocodeUpdate.h $
// 
// 1     2/07/12 3:59a Davidhsieh
// 
// 
//****************************************************************************

//<AMI_FHDR_START>
//----------------------------------------------------------------------------
//
// Name:		MicrocodeUpdate.h
//
// Description:	  Header file for Microcode Update SMI handler.
//
//----------------------------------------------------------------------------
//<AMI_FHDR_END>

#ifndef _MICROCODE_UPDATE_H_
#define _MICROCODE_UPDATE_H_

#ifdef __cplusplus
extern "C" {
#endif

//#define SIG_PART_ONE        0x0494e5445 // 'INTE'
//#define SIG_PART_TWO        0x04c504550 // 'LPEP'


#define CARRY_FLAG 1

#define UC_LOADER_VERSION   1

#define UC_HEADER_VERSION   1
#define UC_LOADER_REVISION  1

#define UC_INT15_ENABLE         0x01

#define UC_PRESCENCE_TEST       0
#define UC_WRITE_UPDATE_DATA    1
#define UC_UPDATE_CONTROL       2
#define UC_READ_UPDATE_DATA     3

#define UC_SUCCESS              0x0000
#define UC_NOT_IMPLEMENTED      0x8600
#define UC_ERASE_FAILURE        0x9000
#define UC_WRITE_FAILURE        0x9100
#define UC_READ_FAILURE         0x9200
#define UC_STORAGE_FULL         0x9300
#define UC_CPU_NOT_PRESENT      0x9400
#define UC_INVALID_HEADER       0x9500
#define UC_INVALID_HEADER_CS    0x9600
#define UC_SECURITY_FAILURE     0x9700
#define UC_INVALID_REVISION     0x9800
#define UC_UPDATE_NUM_INVALID   0x9900
#define UC_NOT_EMPTY            0x9a00

typedef struct {
    UINT32  EAX;
    UINT32  EBX;
    UINT32  ECX;
    UINT32  EDX;
    UINT32  ESI;
    UINT32  EDI;
    UINT32  EFLAGS;
    UINT16  ES;
    UINT16  CS;
    UINT16  SS;
    UINT16  DS;
    UINT16  FS;
    UINT16  GS;
    UINT32  EBP;
} SMI_UC_DWORD_REGS;

VOID PresenceTest(SMI_UC_DWORD_REGS *Regs);
VOID WriteUpdateData(SMI_UC_DWORD_REGS *Regs);
VOID UpdateControl(SMI_UC_DWORD_REGS *Regs);
VOID ReadUpdateData(SMI_UC_DWORD_REGS *Regs);

EFI_STATUS FwhErase(
  IN UINTN      Address,
  IN UINTN      NumberOfBytes
);

EFI_STATUS FwhWrite(
  IN UINT8      *Buffer, 
  IN UINTN      Address, 
  IN UINTN      NumberOfBytes
);


/****** DO NOT WRITE BELOW THIS LINE *******/
#ifdef __cplusplus
}
#endif
#endif

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