summaryrefslogtreecommitdiff
path: root/Core/EM/ACPI/SMB_EC.ASL
blob: b82bdfbf51d2aea378f1402daefe6d73ac75ddff (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
//**********************************************************************
//**********************************************************************
//**                                                                  **
//**        (C)Copyright 1985-2009, American Megatrends, Inc.         **
//**                                                                  **
//**                       All Rights Reserved.                       **
//**                                                                  **
//**             5555 Oakbrook Pkwy, Norcross, GA 30093               **
//**                                                                  **
//**                       Phone: (770)-246-8600                      **
//**                                                                  **
//**********************************************************************
//**********************************************************************
// $Header: /Alaska/BIN/Modules/ACPI/Template/Core/SMB_EC.ASL 2     3/26/09 4:53p Oleksiyy $
//
// $Revision: 2 $
//
// $Date: 3/26/09 4:53p $
//**********************************************************************;
// Revision History
// ----------------
// $Log: /Alaska/BIN/Modules/ACPI/Template/Core/SMB_EC.ASL $
// 
// 2     3/26/09 4:53p Oleksiyy
// New ACPI Core implementation - improves logic, execution time and
// memory usage of ACPI module.
// 
// 1     3/24/05 5:01p Sivagarn
// 
// 1     2/03/05 6:42p Sivagarn
// 0ABHI001 Check in
// 
// 1     7/27/04 2:48p Yakovlevs
// 
// 2     9/06/02 10:53a Alexp
// Add SourceSafe headers to all core asl files
// 
//
//**********************************************************************;
//**********************************************************************;
//		DON'T CHANGE ANY NAMES UNLESS REQUIRED !!!
//**********************************************************************;
//     ACPI Embedded controller SMBus interface methods
//**********************************************************************;

// SMBR - SMBus read method
//
//	Arg0 - Device address
// 	Arg1 - Command Code
//	Arg2 - Data to write
//	Arg3 - Protocol (basically RDWD, WRWD or RDBL)

        Method(SMBR,4) {
                If (LEqual(Arg3,RDBL)) {Store(0,DATB)}
        	Store(5, Local0)
        	While(Local0) {
        		Store(Arg0, ADDR)	// Set the device address
        		Store(Arg1, SCMD)	// Read Power unit value 0x3 offset
			If (LEqual(Arg3, WRWD))	{Store(Arg2, DAT0)}
        		Store(Arg3, PRTC)       // Set protocol - start SMBus transaction
        		Wait(SMBF, 0xFFF)	// Wait till SMBus transaction completed

        		Reset(SMBF)

// One of known problems - ReadBlock of GLW SmartBattery may return BCNT=3
// and data as FF FF FF with no any SMBus errors. To avoid this:
//        		If(Or(SSTS,And(LEqual(Arg2,RDBL),And(LEqual(BCNT,3),LEqual(DAT0,0xFFFF)))))
			If(SSTS)
				{Decrement(Local0)}  // If any SMBus error

                	Else {
				Return(Ones)	// exit on OK
                        }
        	}
		Return(Zero)			// exit on failure
        }

//**********************************************************************;
//     *****************************************************************;
//     *****************************************************************;
//     **                                                             **;
//     **      (C)Copyright 1985-1996, American Megatrends, Inc.      **;
//     **                                                             **;
//     **                     All Rights Reserved.                    **;
//     **                                                             **;
//     **           6145-F Northbelt Pkwy, Norcross, GA 30071         **;
//     **                                                             **;
//     **                     Phone (770)-246-8600                    **;
//     **                                                             **;
//     *****************************************************************;
//     *****************************************************************;