summaryrefslogtreecommitdiff
path: root/Core/EM/ACPI/CIR.ASL
blob: 6b834619b98a599fa1022a4326d2e01853ec5f3d (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
157
158
159
160
161
162
163
164
165
166
167
168
//**********************************************************************
//**********************************************************************
//**                                                                  **
//**        (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/CIR.ASL 4     3/26/09 4:53p Oleksiyy $
//
// $Revision: 4 $
//
// $Date: 3/26/09 4:53p $
//**********************************************************************;
// Revision History
// ----------------
// $Log: /Alaska/BIN/Modules/ACPI/Template/Core/CIR.ASL $
// 
// 4     3/26/09 4:53p Oleksiyy
// New ACPI Core implementation - improves logic, execution time and
// memory usage of ACPI module.
// 
// 3     4/19/06 1:37p Stacyh
// 
// 2     4/03/06 4:05p Felixp
// New Super I/O infrastructure Support
// 
// 1     3/24/05 5:01p Sivagarn
// 
// 1     2/03/05 6:42p Sivagarn
// 0ABHI001 Check in
// 
// 1     7/27/04 2:48p Yakovlevs
// 
// 1     03/04/07 5:48p Chung
// Add ASL core for new all I/O beta version
// 
// 4	 9/06/02 10:53a Alexp
// Add SourceSafe headers to all core asl files
// 
//**********************************************************************;
// Standalone InfraRed device //
//**********************************************************************;
// Category # :0x10 (Generic IO range 1)
Device(CIR){
	Name(_HID, EISAID("PNP0510"))		//PnP Device ID IrDA
	Method(_STA, 0) {Return(IRST(0x10))}	//Get status
	Method(_DIS, 0) {DCNT(0x10, 0)} 	//Disable
	Method(_CRS, 0) {Return(IRCR(0x10))}	//Get CIR current resources
	Method(_SRS, 1) {IRSR(Arg0, 0x10)}	//Set CIR recources
//	Method(_PRS, 0) {Return(IRPR)}		//Return possible resources

//-----------------------------------------------------------------------
// IRST - GET SIO DEVICE STATUS according to ACTR/IOAH/IOAL
//
//	Input - Arg0 : Device's category #
//	Return- Device Status Byte
//-----------------------------------------------------------------------
	Method(IRST, 1){
		ENFG(CGLD(Arg0))	//Enter Config Mode, Select LDN
		If(ACTR)
			{Store(0x0F, Local0)}	//Present & Active
		Else{
			If(IOAH)
				{Store(0x0D, Local0)}	//Then present & not active
			Else
				{Store(0, Local0)}	//Not present
		}
		EXFG()			//Exit Config Mode
		Return(Local0)		//Return device status
	} // End Of IRST

//-----------------------------------------------------------------------
// IrDa Possible Resources
//-----------------------------------------------------------------------
//NOTE: _PRS MUST be the NAME not a METHOD object 
//to have GENERICSIO.C working right! 
//-----------------------------------------------------------------------
	Name(_PRS, ResourceTemplate(){
		StartDependentFn(0, 0){
			IO(Decode16, 0x3E0, 0x3E0, 8, 8)
			IRQNoFlags() {10}
		}
		StartDependentFnNoPri(){
			IO(Decode16, 0x3E0, 0x3E0, 8, 8)
			IRQNoFlags() {3,4,5,6,7,9,10,11,12}
		}
		StartDependentFnNoPri(){
			IO(Decode16, 0x2E0, 0x2E0, 8, 8)
			IRQNoFlags() {3,4,5,6,7,9,10,11,12}
		}
		StartDependentFnNoPri(){
			IO(Decode16, 0x298, 0x298, 8, 8)
			IRQNoFlags() {3,4,5,6,7,9,10,11,12}
		}
		EndDependentFn()
	})

//-----------------------------------------------------------------------
// IRCR - Returns Byte stream of Current resources. May contain Resources such:
//
//	Input - Arg0 : Device's category #
//	Return- Buffer
//-----------------------------------------------------------------------
	Name(PBUF, ResourceTemplate() {
		IO(Decode16, 0, 0, 1, 8, PBP1)
		IRQNoFlags(PBI1) {0}
	})

	Method(IRCR, 1){
	// Arg0 - LDN
		CreateByteField(PBUF, 0x02, IOLO)	//Range Min Base LSB
		CreateByteField(PBUF, 0x03, IOHI)	//Range Min Base MSB
		CreateWordField(PBUF, 0x02, IOHL)	//Range Min Base Word
		CreateWordField(PBUF, 0x04, IORL)	//Range Max Base Word
		CreateByteField(PBUF, 0x06, ALMN)	//Alignment
		CreateByteField(PBUF, 0x07, LENG)	//Number of IO ports
		CreateWordField(PBUF, 0x09, IRQL)	//IRQ Mask

		ENFG(CGLD(Arg0))	//Enter Config Mode, Select LDN

	// Write Current Settings into Buffer for IO Descriptor
		Store(IOAH, IOHI)	//Get IO Base MSB
		Store(IOAL, IOLO)	//Get IO Base LSB
		Store(IOHL, IORL)	//Set MaxBase = MinBase
		Store(0x01, ALMN)	//Set alignment
		Store(0x08, LENG)	//Set IO length

	// Write Current Settings into IRQ descriptor
		Store(One, Local0)
		ShiftLeft(Local0, INTR, IRQL)

		EXFG()			//Exit Config Mode
		Return(PBUF)		//Return Byte Stream
	}

//-----------------------------------------------------------------------
// IRSR - Configures new Resources to be decoded by a Device
//
//	Input - Arg0 : PnP Resource String to set
//		Arg1 : Device's category #
//	Return- nothing
//-----------------------------------------------------------------------
	Method(IRSR, 2){
		CreateByteField (Arg0, 0x02, POLB)	//Range Min Base LSB
		CreateByteField (Arg0, 0x03, POHB)	//Range Min Base MSB
		CreateWordField (Arg0, 0x09, PIRQ)	//IRQ number

		ENFG(CGLD(Arg1))	//Enter Config Mode, Select LDN

	// Set Base IO Address
		Store(POLB, IOAL)	//Set IO Base LSB
		Store(POHB, IOAH)	//Set IO Base MSB

	// Set IRQ
		FindSetRightBit(PIRQ, Local0)
		Subtract(Local0, 1, INTR)

		Store(One, ACTR)	//Activate
		EXFG()			//Exit Config Mode
	}

} // End Of IRDA //