summaryrefslogtreecommitdiff
path: root/Board/EM/Pfat/HandlePfatLegacy/HandlePfatLegacy.c
blob: 42818b48f95759a5474fdb98ea4aa28b1305d9d6 (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
//*************************************************************************
//*************************************************************************
//**                                                                     **
//**        (C)Copyright 1985-2009, American Megatrends, Inc.            **
//**                                                                     **
//**                       All Rights Reserved.                          **
//**                                                                     **
//**      5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093           **
//**                                                                     **
//**                       Phone: (770)-246-8600                         **
//**                                                                     **
//*************************************************************************
//*************************************************************************

//**********************************************************************
// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/IntelPfat/Pfatflashlib/HandlePfatLegacy/HandlePfatLegacy.c 2     11/08/12 3:24a Fredericko $
//
// $Revision: 2 $
//
// $Date: 11/08/12 3:24a $
//
// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/IntelPfat/Pfatflashlib/HandlePfatLegacy/HandlePfatLegacy.c $
// 
// 2     11/08/12 3:24a Fredericko
// 
// 1     11/02/12 8:23p Fredericko
// [TAG]  		EIP105153
// [Files]  		HandlePfatLegacy.cif
// HandlePfatLegacy.sdl
// HandlePfatLegacy.mak
// HandlePfatLegacy.c
// 
//**********************************************************************
//<AMI_FHDR_START>
//
// Name:   HandlePfatLegacy.c
//
// Description: Code listing file for HandlePfatLegacy
//
//<AMI_FHDR_END>
//**********************************************************************

//----------------------------------------------------------------------
// Includes
#include <efi.h>
#include "token.h"
#include <AmiDxeLib.h>

EFI_EVENT   PfatLegacyBootEvent;

#define PFAT_VAR_GUID \
  { \
    0x6aae75ee, 0xa4bc, 0x40c8, 0x81, 0x3b, 0x8, 0x4e, 0x28, 0x53, 0x5e, 0x79 \
  }

//**********************************************************************
//<AMI_PHDR_START>
//
// Procedure:   HandlePfatOnLegacyBoot
//
// Description: Callback on LegacyBoot Event
//
// Input:       IN  EFI_EVENT       efiev
//              IN  VOID            *ctx
//
// Output:      EFI_STATUS
//
// Modified:
//
// Referrals:
//
// Notes:
//<AMI_PHDR_END>
//**********************************************************************
void HandlePfatOnLegacyBoot(
    IN EFI_EVENT efiev,
    IN VOID      *ctx )
{
    EFI_STATUS Status;
    UINT32 PfatVar=0;
    UINTN  PfatVarSize = sizeof(UINT32);
    EFI_GUID PfatVarGuid = PFAT_VAR_GUID ;

    Status = pRS->GetVariable(L"PfatVariable", &PfatVarGuid, NULL, &PfatVarSize, &PfatVar);

    PfatVar+=1;

    Status = pRS->SetVariable(L"PfatVariable", 
                              &PfatVarGuid, 
                              (EFI_VARIABLE_BOOTSERVICE_ACCESS | 
                              EFI_VARIABLE_RUNTIME_ACCESS |
                              EFI_VARIABLE_NON_VOLATILE),
                              PfatVarSize,
                              &PfatVar);

     pBS->CloseEvent (PfatLegacyBootEvent);
}


//**********************************************************************
//<AMI_PHDR_START>
//
// Procedure:    HandlePfatLegacyBoot
//
// Description: Entry point for subcomponent
//
// Input:       IN    EFI_HANDLE ImageHandle,
//              IN    EFI_SYSTEM_TABLE *SystemTable
//
// Output: EFI_STATUS
//
// Modified:
//
// Referrals:
//
// Notes:
//
//<AMI_PHDR_END>
//**********************************************************************
EFI_STATUS HandlePfatLegacyBoot(
    IN EFI_HANDLE       ImageHandle,
    IN EFI_SYSTEM_TABLE *SystemTable )
{
    EFI_STATUS                   Status;

    InitAmiLib( ImageHandle, SystemTable );

    Status = CreateReadyToBootEvent( TPL_CALLBACK,
                                     HandlePfatOnLegacyBoot,
                                     NULL,
                                     &PfatLegacyBootEvent );

    return Status;
}

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