]>
Commit | Line | Data |
---|---|---|
6515b203 FB |
1 | /* |
2 | * ACPI implementation | |
5fafdf24 | 3 | * |
6515b203 | 4 | * Copyright (c) 2006 Fabrice Bellard |
5fafdf24 | 5 | * |
6515b203 FB |
6 | * This library is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU Lesser General Public | |
8 | * License version 2 as published by the Free Software Foundation. | |
9 | * | |
10 | * This library is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public | |
8167ee88 | 16 | * License along with this library; if not, see <http://www.gnu.org/licenses/> |
6b620ca3 PB |
17 | * |
18 | * Contributions after 2012-01-13 are licensed under the terms of the | |
19 | * GNU GPL, version 2 or (at your option) any later version. | |
6515b203 | 20 | */ |
04dc308f | 21 | #include "sysemu.h" |
87ecb68b PB |
22 | #include "hw.h" |
23 | #include "pc.h" | |
990b150e | 24 | #include "acpi.h" |
25df49f6 | 25 | #include "monitor.h" |
6515b203 | 26 | |
104bf02e MT |
27 | struct acpi_table_header { |
28 | uint16_t _length; /* our length, not actual part of the hdr */ | |
29 | /* XXX why we have 2 length fields here? */ | |
30 | char sig[4]; /* ACPI signature (4 ASCII characters) */ | |
8a92ea2f AL |
31 | uint32_t length; /* Length of table, in bytes, including header */ |
32 | uint8_t revision; /* ACPI Specification minor version # */ | |
33 | uint8_t checksum; /* To make sum of entire table == 0 */ | |
104bf02e MT |
34 | char oem_id[6]; /* OEM identification */ |
35 | char oem_table_id[8]; /* OEM table identification */ | |
8a92ea2f | 36 | uint32_t oem_revision; /* OEM revision number */ |
104bf02e | 37 | char asl_compiler_id[4]; /* ASL compiler vendor ID */ |
8a92ea2f | 38 | uint32_t asl_compiler_revision; /* ASL compiler revision number */ |
541dc0d4 | 39 | } QEMU_PACKED; |
8a92ea2f | 40 | |
104bf02e MT |
41 | #define ACPI_TABLE_HDR_SIZE sizeof(struct acpi_table_header) |
42 | #define ACPI_TABLE_PFX_SIZE sizeof(uint16_t) /* size of the extra prefix */ | |
43 | ||
44 | static const char dfl_hdr[ACPI_TABLE_HDR_SIZE] = | |
45 | "\0\0" /* fake _length (2) */ | |
46 | "QEMU\0\0\0\0\1\0" /* sig (4), len(4), revno (1), csum (1) */ | |
47 | "QEMUQEQEMUQEMU\1\0\0\0" /* OEM id (6), table (8), revno (4) */ | |
48 | "QEMU\1\0\0\0" /* ASL compiler ID (4), version (4) */ | |
49 | ; | |
50 | ||
8a92ea2f AL |
51 | char *acpi_tables; |
52 | size_t acpi_tables_len; | |
53 | ||
54 | static int acpi_checksum(const uint8_t *data, int len) | |
55 | { | |
56 | int sum, i; | |
57 | sum = 0; | |
104bf02e | 58 | for (i = 0; i < len; i++) { |
8a92ea2f | 59 | sum += data[i]; |
104bf02e | 60 | } |
8a92ea2f AL |
61 | return (-sum) & 0xff; |
62 | } | |
63 | ||
104bf02e MT |
64 | /* like strncpy() but zero-fills the tail of destination */ |
65 | static void strzcpy(char *dst, const char *src, size_t size) | |
66 | { | |
67 | size_t len = strlen(src); | |
68 | if (len >= size) { | |
69 | len = size; | |
70 | } else { | |
71 | memset(dst + len, 0, size - len); | |
72 | } | |
73 | memcpy(dst, src, len); | |
74 | } | |
75 | ||
76 | /* XXX fixme: this function uses obsolete argument parsing interface */ | |
8a92ea2f AL |
77 | int acpi_table_add(const char *t) |
78 | { | |
8a92ea2f | 79 | char buf[1024], *p, *f; |
8a92ea2f | 80 | unsigned long val; |
104bf02e MT |
81 | size_t len, start, allen; |
82 | bool has_header; | |
83 | int changed; | |
84 | int r; | |
85 | struct acpi_table_header hdr; | |
8a92ea2f | 86 | |
104bf02e MT |
87 | r = 0; |
88 | r |= get_param_value(buf, sizeof(buf), "data", t) ? 1 : 0; | |
89 | r |= get_param_value(buf, sizeof(buf), "file", t) ? 2 : 0; | |
90 | switch (r) { | |
91 | case 0: | |
92 | buf[0] = '\0'; | |
93 | /* fallthrough for default behavior */ | |
94 | case 1: | |
95 | has_header = false; | |
96 | break; | |
97 | case 2: | |
98 | has_header = true; | |
99 | break; | |
100 | default: | |
101 | fprintf(stderr, "acpitable: both data and file are specified\n"); | |
102 | return -1; | |
103 | } | |
104 | ||
105 | if (!acpi_tables) { | |
106 | allen = sizeof(uint16_t); | |
7267c094 | 107 | acpi_tables = g_malloc0(allen); |
8a92ea2f | 108 | } else { |
104bf02e MT |
109 | allen = acpi_tables_len; |
110 | } | |
111 | ||
112 | start = allen; | |
7267c094 | 113 | acpi_tables = g_realloc(acpi_tables, start + ACPI_TABLE_HDR_SIZE); |
104bf02e MT |
114 | allen += has_header ? ACPI_TABLE_PFX_SIZE : ACPI_TABLE_HDR_SIZE; |
115 | ||
116 | /* now read in the data files, reallocating buffer as needed */ | |
117 | ||
118 | for (f = strtok(buf, ":"); f; f = strtok(NULL, ":")) { | |
119 | int fd = open(f, O_RDONLY); | |
120 | ||
121 | if (fd < 0) { | |
122 | fprintf(stderr, "can't open file %s: %s\n", f, strerror(errno)); | |
123 | return -1; | |
124 | } | |
125 | ||
126 | for (;;) { | |
127 | char data[8192]; | |
128 | r = read(fd, data, sizeof(data)); | |
129 | if (r == 0) { | |
130 | break; | |
131 | } else if (r > 0) { | |
7267c094 | 132 | acpi_tables = g_realloc(acpi_tables, allen + r); |
104bf02e MT |
133 | memcpy(acpi_tables + allen, data, r); |
134 | allen += r; | |
135 | } else if (errno != EINTR) { | |
136 | fprintf(stderr, "can't read file %s: %s\n", | |
137 | f, strerror(errno)); | |
138 | close(fd); | |
139 | return -1; | |
140 | } | |
141 | } | |
142 | ||
143 | close(fd); | |
144 | } | |
145 | ||
146 | /* now fill in the header fields */ | |
147 | ||
148 | f = acpi_tables + start; /* start of the table */ | |
149 | changed = 0; | |
150 | ||
151 | /* copy the header to temp place to align the fields */ | |
152 | memcpy(&hdr, has_header ? f : dfl_hdr, ACPI_TABLE_HDR_SIZE); | |
153 | ||
154 | /* length of the table minus our prefix */ | |
155 | len = allen - start - ACPI_TABLE_PFX_SIZE; | |
156 | ||
157 | hdr._length = cpu_to_le16(len); | |
158 | ||
159 | if (get_param_value(buf, sizeof(buf), "sig", t)) { | |
160 | strzcpy(hdr.sig, buf, sizeof(hdr.sig)); | |
161 | ++changed; | |
162 | } | |
163 | ||
164 | /* length of the table including header, in bytes */ | |
165 | if (has_header) { | |
166 | /* check if actual length is correct */ | |
167 | val = le32_to_cpu(hdr.length); | |
168 | if (val != len) { | |
169 | fprintf(stderr, | |
170 | "warning: acpitable has wrong length," | |
171 | " header says %lu, actual size %zu bytes\n", | |
172 | val, len); | |
173 | ++changed; | |
174 | } | |
8a92ea2f | 175 | } |
104bf02e MT |
176 | /* we may avoid putting length here if has_header is true */ |
177 | hdr.length = cpu_to_le32(len); | |
178 | ||
8a92ea2f | 179 | if (get_param_value(buf, sizeof(buf), "rev", t)) { |
104bf02e MT |
180 | val = strtoul(buf, &p, 0); |
181 | if (val > 255 || *p) { | |
182 | fprintf(stderr, "acpitable: \"rev=%s\" is invalid\n", buf); | |
183 | return -1; | |
184 | } | |
185 | hdr.revision = (uint8_t)val; | |
186 | ++changed; | |
8a92ea2f | 187 | } |
8a92ea2f AL |
188 | |
189 | if (get_param_value(buf, sizeof(buf), "oem_id", t)) { | |
104bf02e MT |
190 | strzcpy(hdr.oem_id, buf, sizeof(hdr.oem_id)); |
191 | ++changed; | |
8a92ea2f AL |
192 | } |
193 | ||
194 | if (get_param_value(buf, sizeof(buf), "oem_table_id", t)) { | |
104bf02e MT |
195 | strzcpy(hdr.oem_table_id, buf, sizeof(hdr.oem_table_id)); |
196 | ++changed; | |
8a92ea2f AL |
197 | } |
198 | ||
199 | if (get_param_value(buf, sizeof(buf), "oem_rev", t)) { | |
104bf02e MT |
200 | val = strtol(buf, &p, 0); |
201 | if (*p) { | |
202 | fprintf(stderr, "acpitable: \"oem_rev=%s\" is invalid\n", buf); | |
203 | return -1; | |
204 | } | |
205 | hdr.oem_revision = cpu_to_le32(val); | |
206 | ++changed; | |
8a92ea2f | 207 | } |
8a92ea2f AL |
208 | |
209 | if (get_param_value(buf, sizeof(buf), "asl_compiler_id", t)) { | |
104bf02e MT |
210 | strzcpy(hdr.asl_compiler_id, buf, sizeof(hdr.asl_compiler_id)); |
211 | ++changed; | |
8a92ea2f AL |
212 | } |
213 | ||
214 | if (get_param_value(buf, sizeof(buf), "asl_compiler_rev", t)) { | |
104bf02e MT |
215 | val = strtol(buf, &p, 0); |
216 | if (*p) { | |
217 | fprintf(stderr, "acpitable: \"%s=%s\" is invalid\n", | |
218 | "asl_compiler_rev", buf); | |
219 | return -1; | |
220 | } | |
221 | hdr.asl_compiler_revision = cpu_to_le32(val); | |
222 | ++changed; | |
8a92ea2f AL |
223 | } |
224 | ||
104bf02e MT |
225 | if (!has_header && !changed) { |
226 | fprintf(stderr, "warning: acpitable: no table headers are specified\n"); | |
8a92ea2f AL |
227 | } |
228 | ||
8a92ea2f | 229 | |
104bf02e MT |
230 | /* now calculate checksum of the table, complete with the header */ |
231 | /* we may as well leave checksum intact if has_header is true */ | |
232 | /* alternatively there may be a way to set cksum to a given value */ | |
233 | hdr.checksum = 0; /* for checksum calculation */ | |
8a92ea2f | 234 | |
104bf02e MT |
235 | /* put header back */ |
236 | memcpy(f, &hdr, sizeof(hdr)); | |
237 | ||
238 | if (changed || !has_header || 1) { | |
239 | ((struct acpi_table_header *)f)->checksum = | |
240 | acpi_checksum((uint8_t *)f + ACPI_TABLE_PFX_SIZE, len); | |
d729bb9a | 241 | } |
8a92ea2f | 242 | |
8a92ea2f | 243 | /* increase number of tables */ |
104bf02e MT |
244 | (*(uint16_t *)acpi_tables) = |
245 | cpu_to_le32(le32_to_cpu(*(uint16_t *)acpi_tables) + 1); | |
246 | ||
247 | acpi_tables_len = allen; | |
8a92ea2f | 248 | return 0; |
104bf02e | 249 | |
8a92ea2f | 250 | } |
a54d41a8 | 251 | |
da98c8eb GH |
252 | static void acpi_notify_wakeup(Notifier *notifier, void *data) |
253 | { | |
254 | ACPIREGS *ar = container_of(notifier, ACPIREGS, wakeup); | |
255 | WakeupReason *reason = data; | |
256 | ||
257 | switch (*reason) { | |
62aeb0f7 GH |
258 | case QEMU_WAKEUP_REASON_RTC: |
259 | ar->pm1.evt.sts |= | |
260 | (ACPI_BITMASK_WAKE_STATUS | ACPI_BITMASK_RT_CLOCK_STATUS); | |
261 | break; | |
6595abc0 GH |
262 | case QEMU_WAKEUP_REASON_PMTIMER: |
263 | ar->pm1.evt.sts |= | |
264 | (ACPI_BITMASK_WAKE_STATUS | ACPI_BITMASK_TIMER_STATUS); | |
265 | break; | |
da98c8eb GH |
266 | case QEMU_WAKEUP_REASON_OTHER: |
267 | default: | |
268 | /* ACPI_BITMASK_WAKE_STATUS should be set on resume. | |
269 | Pretend that resume was caused by power button */ | |
270 | ar->pm1.evt.sts |= | |
271 | (ACPI_BITMASK_WAKE_STATUS | ACPI_BITMASK_POWER_BUTTON_STATUS); | |
272 | break; | |
273 | } | |
274 | } | |
275 | ||
04dc308f | 276 | /* ACPI PM1a EVT */ |
2886be1b | 277 | uint16_t acpi_pm1_evt_get_sts(ACPIREGS *ar) |
04dc308f IY |
278 | { |
279 | int64_t d = acpi_pm_tmr_get_clock(); | |
2886be1b | 280 | if (d >= ar->tmr.overflow_time) { |
355bf2e5 | 281 | ar->pm1.evt.sts |= ACPI_BITMASK_TIMER_STATUS; |
04dc308f | 282 | } |
355bf2e5 | 283 | return ar->pm1.evt.sts; |
04dc308f IY |
284 | } |
285 | ||
355bf2e5 | 286 | void acpi_pm1_evt_write_sts(ACPIREGS *ar, uint16_t val) |
04dc308f | 287 | { |
2886be1b | 288 | uint16_t pm1_sts = acpi_pm1_evt_get_sts(ar); |
04dc308f IY |
289 | if (pm1_sts & val & ACPI_BITMASK_TIMER_STATUS) { |
290 | /* if TMRSTS is reset, then compute the new overflow time */ | |
355bf2e5 | 291 | acpi_pm_tmr_calc_overflow_time(ar); |
04dc308f | 292 | } |
355bf2e5 | 293 | ar->pm1.evt.sts &= ~val; |
04dc308f IY |
294 | } |
295 | ||
8283c4f5 GH |
296 | void acpi_pm1_evt_write_en(ACPIREGS *ar, uint16_t val) |
297 | { | |
298 | ar->pm1.evt.en = val; | |
62aeb0f7 GH |
299 | qemu_system_wakeup_enable(QEMU_WAKEUP_REASON_RTC, |
300 | val & ACPI_BITMASK_RT_CLOCK_ENABLE); | |
6595abc0 GH |
301 | qemu_system_wakeup_enable(QEMU_WAKEUP_REASON_PMTIMER, |
302 | val & ACPI_BITMASK_TIMER_ENABLE); | |
8283c4f5 GH |
303 | } |
304 | ||
355bf2e5 | 305 | void acpi_pm1_evt_power_down(ACPIREGS *ar) |
04dc308f | 306 | { |
355bf2e5 GH |
307 | if (ar->pm1.evt.en & ACPI_BITMASK_POWER_BUTTON_ENABLE) { |
308 | ar->pm1.evt.sts |= ACPI_BITMASK_POWER_BUTTON_STATUS; | |
309 | ar->tmr.update_sci(ar); | |
04dc308f IY |
310 | } |
311 | } | |
312 | ||
355bf2e5 | 313 | void acpi_pm1_evt_reset(ACPIREGS *ar) |
04dc308f | 314 | { |
355bf2e5 GH |
315 | ar->pm1.evt.sts = 0; |
316 | ar->pm1.evt.en = 0; | |
62aeb0f7 | 317 | qemu_system_wakeup_enable(QEMU_WAKEUP_REASON_RTC, 0); |
6595abc0 | 318 | qemu_system_wakeup_enable(QEMU_WAKEUP_REASON_PMTIMER, 0); |
04dc308f IY |
319 | } |
320 | ||
a54d41a8 | 321 | /* ACPI PM_TMR */ |
355bf2e5 | 322 | void acpi_pm_tmr_update(ACPIREGS *ar, bool enable) |
a54d41a8 IY |
323 | { |
324 | int64_t expire_time; | |
325 | ||
326 | /* schedule a timer interruption if needed */ | |
327 | if (enable) { | |
355bf2e5 | 328 | expire_time = muldiv64(ar->tmr.overflow_time, get_ticks_per_sec(), |
a54d41a8 | 329 | PM_TIMER_FREQUENCY); |
355bf2e5 | 330 | qemu_mod_timer(ar->tmr.timer, expire_time); |
a54d41a8 | 331 | } else { |
355bf2e5 | 332 | qemu_del_timer(ar->tmr.timer); |
a54d41a8 IY |
333 | } |
334 | } | |
335 | ||
355bf2e5 | 336 | void acpi_pm_tmr_calc_overflow_time(ACPIREGS *ar) |
a54d41a8 IY |
337 | { |
338 | int64_t d = acpi_pm_tmr_get_clock(); | |
355bf2e5 | 339 | ar->tmr.overflow_time = (d + 0x800000LL) & ~0x7fffffLL; |
a54d41a8 IY |
340 | } |
341 | ||
355bf2e5 | 342 | uint32_t acpi_pm_tmr_get(ACPIREGS *ar) |
a54d41a8 | 343 | { |
3a93113a | 344 | uint32_t d = acpi_pm_tmr_get_clock(); |
a54d41a8 IY |
345 | return d & 0xffffff; |
346 | } | |
347 | ||
348 | static void acpi_pm_tmr_timer(void *opaque) | |
349 | { | |
355bf2e5 | 350 | ACPIREGS *ar = opaque; |
6595abc0 | 351 | qemu_system_wakeup_request(QEMU_WAKEUP_REASON_PMTIMER); |
355bf2e5 | 352 | ar->tmr.update_sci(ar); |
a54d41a8 IY |
353 | } |
354 | ||
355bf2e5 | 355 | void acpi_pm_tmr_init(ACPIREGS *ar, acpi_update_sci_fn update_sci) |
a54d41a8 | 356 | { |
355bf2e5 GH |
357 | ar->tmr.update_sci = update_sci; |
358 | ar->tmr.timer = qemu_new_timer_ns(vm_clock, acpi_pm_tmr_timer, ar); | |
a54d41a8 IY |
359 | } |
360 | ||
355bf2e5 | 361 | void acpi_pm_tmr_reset(ACPIREGS *ar) |
a54d41a8 | 362 | { |
355bf2e5 GH |
363 | ar->tmr.overflow_time = 0; |
364 | qemu_del_timer(ar->tmr.timer); | |
a54d41a8 | 365 | } |
eaba51c5 IY |
366 | |
367 | /* ACPI PM1aCNT */ | |
da98c8eb | 368 | void acpi_pm1_cnt_init(ACPIREGS *ar) |
eaba51c5 | 369 | { |
da98c8eb GH |
370 | ar->wakeup.notify = acpi_notify_wakeup; |
371 | qemu_register_wakeup_notifier(&ar->wakeup); | |
eaba51c5 IY |
372 | } |
373 | ||
459ae5ea | 374 | void acpi_pm1_cnt_write(ACPIREGS *ar, uint16_t val, char s4) |
eaba51c5 | 375 | { |
355bf2e5 | 376 | ar->pm1.cnt.cnt = val & ~(ACPI_BITMASK_SLEEP_ENABLE); |
eaba51c5 IY |
377 | |
378 | if (val & ACPI_BITMASK_SLEEP_ENABLE) { | |
379 | /* change suspend type */ | |
380 | uint16_t sus_typ = (val >> 10) & 7; | |
381 | switch(sus_typ) { | |
382 | case 0: /* soft power off */ | |
383 | qemu_system_shutdown_request(); | |
384 | break; | |
385 | case 1: | |
da98c8eb GH |
386 | qemu_system_suspend_request(); |
387 | break; | |
eaba51c5 | 388 | default: |
459ae5ea | 389 | if (sus_typ == s4) { /* S4 request */ |
25df49f6 | 390 | monitor_protocol_event(QEVENT_SUSPEND_DISK, NULL); |
459ae5ea GN |
391 | qemu_system_shutdown_request(); |
392 | } | |
eaba51c5 IY |
393 | break; |
394 | } | |
395 | } | |
396 | } | |
397 | ||
355bf2e5 | 398 | void acpi_pm1_cnt_update(ACPIREGS *ar, |
eaba51c5 IY |
399 | bool sci_enable, bool sci_disable) |
400 | { | |
401 | /* ACPI specs 3.0, 4.7.2.5 */ | |
402 | if (sci_enable) { | |
355bf2e5 | 403 | ar->pm1.cnt.cnt |= ACPI_BITMASK_SCI_ENABLE; |
eaba51c5 | 404 | } else if (sci_disable) { |
355bf2e5 | 405 | ar->pm1.cnt.cnt &= ~ACPI_BITMASK_SCI_ENABLE; |
eaba51c5 IY |
406 | } |
407 | } | |
408 | ||
355bf2e5 | 409 | void acpi_pm1_cnt_reset(ACPIREGS *ar) |
eaba51c5 | 410 | { |
355bf2e5 | 411 | ar->pm1.cnt.cnt = 0; |
eaba51c5 | 412 | } |
23910d3f IY |
413 | |
414 | /* ACPI GPE */ | |
355bf2e5 | 415 | void acpi_gpe_init(ACPIREGS *ar, uint8_t len) |
23910d3f | 416 | { |
355bf2e5 GH |
417 | ar->gpe.len = len; |
418 | ar->gpe.sts = g_malloc0(len / 2); | |
419 | ar->gpe.en = g_malloc0(len / 2); | |
23910d3f IY |
420 | } |
421 | ||
355bf2e5 | 422 | void acpi_gpe_blk(ACPIREGS *ar, uint32_t blk) |
23910d3f | 423 | { |
355bf2e5 | 424 | ar->gpe.blk = blk; |
23910d3f IY |
425 | } |
426 | ||
355bf2e5 | 427 | void acpi_gpe_reset(ACPIREGS *ar) |
23910d3f | 428 | { |
355bf2e5 GH |
429 | memset(ar->gpe.sts, 0, ar->gpe.len / 2); |
430 | memset(ar->gpe.en, 0, ar->gpe.len / 2); | |
23910d3f IY |
431 | } |
432 | ||
355bf2e5 | 433 | static uint8_t *acpi_gpe_ioport_get_ptr(ACPIREGS *ar, uint32_t addr) |
23910d3f IY |
434 | { |
435 | uint8_t *cur = NULL; | |
436 | ||
355bf2e5 GH |
437 | if (addr < ar->gpe.len / 2) { |
438 | cur = ar->gpe.sts + addr; | |
439 | } else if (addr < ar->gpe.len) { | |
440 | cur = ar->gpe.en + addr - ar->gpe.len / 2; | |
23910d3f IY |
441 | } else { |
442 | abort(); | |
443 | } | |
444 | ||
445 | return cur; | |
446 | } | |
447 | ||
355bf2e5 | 448 | void acpi_gpe_ioport_writeb(ACPIREGS *ar, uint32_t addr, uint32_t val) |
23910d3f IY |
449 | { |
450 | uint8_t *cur; | |
451 | ||
355bf2e5 GH |
452 | addr -= ar->gpe.blk; |
453 | cur = acpi_gpe_ioport_get_ptr(ar, addr); | |
454 | if (addr < ar->gpe.len / 2) { | |
23910d3f IY |
455 | /* GPE_STS */ |
456 | *cur = (*cur) & ~val; | |
355bf2e5 | 457 | } else if (addr < ar->gpe.len) { |
23910d3f IY |
458 | /* GPE_EN */ |
459 | *cur = val; | |
460 | } else { | |
461 | abort(); | |
462 | } | |
463 | } | |
464 | ||
355bf2e5 | 465 | uint32_t acpi_gpe_ioport_readb(ACPIREGS *ar, uint32_t addr) |
23910d3f IY |
466 | { |
467 | uint8_t *cur; | |
468 | uint32_t val; | |
469 | ||
355bf2e5 GH |
470 | addr -= ar->gpe.blk; |
471 | cur = acpi_gpe_ioport_get_ptr(ar, addr); | |
23910d3f IY |
472 | val = 0; |
473 | if (cur != NULL) { | |
474 | val = *cur; | |
475 | } | |
476 | ||
477 | return val; | |
478 | } |