2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License along
13 * with this program; if not, see <http://www.gnu.org/licenses/>.
16 External(\_SB.PCI0.MEMORY_HOTPLUG_DEVICE.MEMORY_SLOT_SCAN_METHOD, MethodObj)
19 Device(MEMORY_HOTPLUG_DEVICE) {
21 Name(_UID, "Memory hotplug resources")
23 /* Memory hotplug IO registers */
24 External(MEMORY_SLOT_ADDR_LOW, FieldUnitObj) // read only
25 External(MEMORY_SLOT_ADDR_HIGH, FieldUnitObj) // read only
26 External(MEMORY_SLOT_SIZE_LOW, FieldUnitObj) // read only
27 External(MEMORY_SLOT_SIZE_HIGH, FieldUnitObj) // read only
28 External(MEMORY_SLOT_PROXIMITY, FieldUnitObj) // read only
29 External(MEMORY_SLOT_ENABLED, FieldUnitObj) // 1 if enabled, read only
30 External(MEMORY_SLOT_EJECT, FieldUnitObj) // initiates device eject, write only
31 External(MEMORY_SLOT_SLECTOR, FieldUnitObj) // DIMM selector, write only
32 External(MEMORY_SLOT_OST_EVENT, FieldUnitObj) // _OST event code, write only
33 External(MEMORY_SLOT_OST_STATUS, FieldUnitObj) // _OST status code, write only
34 External(MEMORY_SLOT_LOCK, MutexObj)
36 Method(MEMORY_SLOT_STATUS_METHOD, 1) {
39 Acquire(MEMORY_SLOT_LOCK, 0xFFFF)
40 Store(ToInteger(Arg0), MEMORY_SLOT_SLECTOR) // select DIMM
42 If (LEqual(MEMORY_SLOT_ENABLED, One)) {
46 Release(MEMORY_SLOT_LOCK)
50 Method(MEMORY_SLOT_CRS_METHOD, 1, Serialized) {
51 Acquire(MEMORY_SLOT_LOCK, 0xFFFF)
52 Store(ToInteger(Arg0), MEMORY_SLOT_SLECTOR) // select DIMM
54 Name(MR64, ResourceTemplate() {
55 QWordMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed,
57 0x0000000000000000, // Address Space Granularity
58 0x0000000000000000, // Address Range Minimum
59 0xFFFFFFFFFFFFFFFE, // Address Range Maximum
60 0x0000000000000000, // Address Translation Offset
61 0xFFFFFFFFFFFFFFFF, // Address Length
62 ,, MW64, AddressRangeMemory, TypeStatic)
65 CreateDWordField(MR64, 14, MINL)
66 CreateDWordField(MR64, 18, MINH)
67 CreateDWordField(MR64, 38, LENL)
68 CreateDWordField(MR64, 42, LENH)
69 CreateDWordField(MR64, 22, MAXL)
70 CreateDWordField(MR64, 26, MAXH)
72 Store(MEMORY_SLOT_ADDR_HIGH, MINH)
73 Store(MEMORY_SLOT_ADDR_LOW, MINL)
74 Store(MEMORY_SLOT_SIZE_HIGH, LENH)
75 Store(MEMORY_SLOT_SIZE_LOW, LENL)
77 // 64-bit math: MAX = MIN + LEN - 1
80 If (LLess(MAXL, MINL)) {
83 If (LLess(MAXL, One)) {
84 Subtract(MAXH, One, MAXH)
86 Subtract(MAXL, One, MAXL)
88 If (LEqual(MAXH, Zero)){
89 Name(MR32, ResourceTemplate() {
90 DWordMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed,
92 0x00000000, // Address Space Granularity
93 0x00000000, // Address Range Minimum
94 0xFFFFFFFE, // Address Range Maximum
95 0x00000000, // Address Translation Offset
96 0xFFFFFFFF, // Address Length
97 ,, MW32, AddressRangeMemory, TypeStatic)
99 CreateDWordField(MR32, MW32._MIN, MIN)
100 CreateDWordField(MR32, MW32._MAX, MAX)
101 CreateDWordField(MR32, MW32._LEN, LEN)
106 Release(MEMORY_SLOT_LOCK)
110 Release(MEMORY_SLOT_LOCK)
114 Method(MEMORY_SLOT_PROXIMITY_METHOD, 1) {
115 Acquire(MEMORY_SLOT_LOCK, 0xFFFF)
116 Store(ToInteger(Arg0), MEMORY_SLOT_SLECTOR) // select DIMM
117 Store(MEMORY_SLOT_PROXIMITY, Local0)
118 Release(MEMORY_SLOT_LOCK)
122 Method(MEMORY_SLOT_OST_METHOD, 4) {
123 Acquire(MEMORY_SLOT_LOCK, 0xFFFF)
124 Store(ToInteger(Arg0), MEMORY_SLOT_SLECTOR) // select DIMM
125 Store(Arg1, MEMORY_SLOT_OST_EVENT)
126 Store(Arg2, MEMORY_SLOT_OST_STATUS)
127 Release(MEMORY_SLOT_LOCK)
130 Method(MEMORY_SLOT_EJECT_METHOD, 2) {
131 Acquire(MEMORY_SLOT_LOCK, 0xFFFF)
132 Store(ToInteger(Arg0), MEMORY_SLOT_SLECTOR) // select DIMM
133 Store(1, MEMORY_SLOT_EJECT)
134 Release(MEMORY_SLOT_LOCK)