summaryrefslogtreecommitdiff
path: root/Core/EM/KbcEmul/KbcEmulAcpi.c
blob: c926707437f09631f0f28178f8227ed229c3408b (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
//*************************************************************************
//*************************************************************************
//**                                                                     **
//**        (C)Copyright 1985-2011, American Megatrends, Inc.            **
//**                                                                     **
//**                       All Rights Reserved.                          **
//**                                                                     **
//**      5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093           **
//**                                                                     **
//**                       Phone: (770)-246-8600                         **
//**                                                                     **
//*************************************************************************
//*************************************************************************

//*************************************************************************
// $Header: /Alaska/SOURCE/Modules/KbcEmulation/ALASKA/KBCEMUL/KbcEmulAcpi.c 2     4/10/14 2:28a Rameshr $
//
// $Revision: 2 $
//
// $Date: 4/10/14 2:28a $
//*************************************************************************
// Revision History
// ----------------
// $Log: /Alaska/SOURCE/Modules/KbcEmulation/ALASKA/KBCEMUL/KbcEmulAcpi.c $
// 
// 2     4/10/14 2:28a Rameshr
// [TAG]  		EIP160392
// [Category]  	Improvement
// [Description]  	Junk Character from check-in History removed. 
// [Files]  		KbcEmulAcpi.c
// 
// 1     1/09/12 1:22a Rameshr
// [TAG]  		EIP74128
// [Category]  	Improvement
// [Description]  	Disable the KbcEmulation Smis on ACPI enable and
// Disable SMI call
// [Files]  		Kbccore.c, KbcEmuulAcpi.c, KbcEmul.c, KbcEmul.cif,
// KbcEmul.h, KbcEmul.sdl
// 
// 
//*************************************************************************
//<AMI_FHDR_START>
//
// Name:        KbcEmulAcpi.c
//
// Description: This file contains Emulation SMI disable function on ACPI 
//              enable/Disable SMI 
//
//<AMI_FHDR_END>
//*************************************************************************

//----------------------------------------------------------------------------
// Include(s)
//----------------------------------------------------------------------------

#include <Token.h>
#include <AmiDxeLib.h>
#include <AmiCspLib.h>
#include <Protocol\SmmSwDispatch.h>
#include "KbcEmul.h"

#ifdef EMULATION_ACPI_ENABLE_DISPATCH
#include    <Chipset\SB\AcpiModeEnable.h>
EFI_GUID	gEfiAcpiEnDispatchProtocolGuid = EFI_ACPI_EN_DISPATCH_PROTOCOL_GUID;
EFI_GUID    gEfiAcpiDisDispatchProtocolGuid = EFI_ACPI_DIS_DISPATCH_PROTOCOL_GUID;
#endif

extern BOOLEAN  AcpiEmulationDisable;

//<AMI_PHDR_START>
//----------------------------------------------------------------------------
//
// Procedure:   KbcEmulationDisable
//
// Description: This routine will be called when ACPI enabled or disabled SMI happens.
//
// Input:       DispatchHandle  - Handle to the Dispatcher
//
// Output:      None
//
// Notes:       None
//----------------------------------------------------------------------------
//<AMI_PHDR_END>

VOID KbcEmulationDisable (
	IN EFI_HANDLE   DispatchHandle
)
{
    AcpiEmulationDisable=TRUE;
    TrapEnable(FALSE);
    return;
}


//<AMI_PHDR_START>
//----------------------------------------------------------------------------
//
// Procedure:   RegisterAcpiEnableCallBack
//
// Description: This routine will be called by KbcEmulation Init 
//              to register the callback function on Acpi Enable/Disable SMI.
//
// Input:       None 
//
// Output:      None
//
// Notes:       None
//----------------------------------------------------------------------------
//<AMI_PHDR_END>

EFI_STATUS
RegisterAcpiEnableCallBack(
)
{
#ifdef EMULATION_ACPI_ENABLE_DISPATCH
	EFI_STATUS          Status;
	EFI_HANDLE	        EnableHandle;
	EFI_HANDLE	        DisableHandle;
	EFI_ACPI_DISPATCH_PROTOCOL	*AcpiEnDispatch;
	EFI_ACPI_DISPATCH_PROTOCOL	*AcpiDisDispatch;

	Status = pBS->LocateProtocol(&gEfiAcpiEnDispatchProtocolGuid, NULL, &AcpiEnDispatch);
	if (EFI_ERROR(Status)) { 
        return Status;
    }

	Status = AcpiEnDispatch->Register(AcpiEnDispatch, KbcEmulationDisable, &EnableHandle);
	ASSERT_EFI_ERROR(Status);

	Status = pBS->LocateProtocol(&gEfiAcpiDisDispatchProtocolGuid, NULL, &AcpiDisDispatch);
	if (EFI_ERROR(Status)) { 
        return Status;
    }

	Status = AcpiDisDispatch->Register(AcpiDisDispatch, KbcEmulationDisable, &DisableHandle);
	ASSERT_EFI_ERROR(Status);

	return Status;
#else
    return EFI_SUCCESS;
#endif
}

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