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

//*************************************************************************
// $Header: /Alaska/SOURCE/Modules/CMOS Manager/CMOS SMM/CmosAccess.asl 4     1/25/12 2:36p Michaela $
//
// $Revision: 4 $
//
// $Date: 1/25/12 2:36p $
//*************************************************************************
// Revision History
// ----------------
// $Log: /Alaska/SOURCE/Modules/CMOS Manager/CMOS SMM/CmosAccess.asl $
// 
// 4     1/25/12 2:36p Michaela
// 
// 3     12/11/11 8:52p Michaela
// 
// 2     11/30/11 11:49p Michaela
// [TAG]         EIP56197
// [Category]    New Feature
// [Severity]    Normal
// [Description] CMOS Manager Support in Runtime Code
// [Files]       CmosManager.sdl
//               CmosSetup.uni
//               CmosMessages.uni
//               CmosManagerSmm.cif
//               CmosAccess.h
//               CmosManagerSmm.c
//               CmosAccess.asl
// 
// 1     3/16/11 2:44p Michaela
//
//*************************************************************************
//<AMI_FHDR_START>
//
// Name:    CmosAccess.asl
//
// Description:
//      This file contains an ASL method for accessing CMOS from
//      ASL code.
//
//<AMI_FHDR_END>
//*************************************************************************

Device(CMOS)
{
	Name(_HID, EISAID("PNP0C02"))	// System board resources
	Name(_UID, 0x18)				// Unique ID. 
	
	OperationRegion (SRB0, SystemIO, SRSI, 1)		
	Field (SRB0, ByteAcc, NoLock, Preserve) 
	{
		SRSM,	8 // SW-SMI ctrl port
	}

	// Define a location in root scope to be updated during
	// boot to specify the location of a communication buffer.
	// Search CMOS_SMM_CONTEXT for data size/type info
	// for this operation region (communication buffer).
	// Search gAslContext for additional information regarding
	// initialization and implemenataion details.

	Name(\CCOM, 0x0123456789ABCDEF)

	OperationRegion (CMOP, SystemMemory, CCOM, 40)
	Field (CMOP, AnyAcc, NoLock, Preserve)
	{
		CODE,   8,   // 1 byte Opcode
		TOKN,   16,  // 2 byte CMOS Token
		BYTE,   8,   // 1 byte Data value
		STAT,   8    // 1 byte status value
	}

	//--------------------------------------------------------------------
	// ACCE: access CMOS 
	//      Arg0 - Opcode (0 = Write, 1 = Read)
	//      Arg1 - CmosToken
	//      Arg2 - CmosByte
	//
	//      return - 0/FALSE = unsuccessful
	//               1/TRUE = successful
	//--------------------------------------------------------------------
	Method(ACCE, 3, Serialized){

		// if \CCOM is not updated, there was an error allocating the
		// communication buffer.

		if (LEqual(\CCOM, 0x0123456789ABCDEF)) {
			Return(0)
		}

		// Write code & value to the communication buffer
		Store(Arg0, CODE)
		Store(Arg1, TOKN)
		Store(Arg2, BYTE)
		
		// Generate SMI type = CSMI
		Store(CSMI, SRSM)
        Store(BYTE, Arg2)
        
		// Arg2 (BTYE) contains the CMOS value on read
		// The method return value is Boolean
		Return(STAT)
	}
}

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