.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * apei-base.c - ACPI Platform Error Interface (APEI) supporting |
---|
3 | 4 | * infrastructure |
---|
.. | .. |
---|
15 | 16 | * |
---|
16 | 17 | * Copyright (C) 2009, Intel Corp. |
---|
17 | 18 | * Author: Huang Ying <ying.huang@intel.com> |
---|
18 | | - * |
---|
19 | | - * This program is free software; you can redistribute it and/or |
---|
20 | | - * modify it under the terms of the GNU General Public License version |
---|
21 | | - * 2 as published by the Free Software Foundation. |
---|
22 | | - * |
---|
23 | | - * This program is distributed in the hope that it will be useful, |
---|
24 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
25 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
26 | | - * GNU General Public License for more details. |
---|
27 | 19 | */ |
---|
28 | 20 | |
---|
29 | 21 | #include <linux/kernel.h> |
---|
.. | .. |
---|
178 | 170 | if (ip == ctx->ip) { |
---|
179 | 171 | if (entry->instruction >= ctx->instructions || |
---|
180 | 172 | !ctx->ins_table[entry->instruction].run) { |
---|
181 | | - pr_warning(FW_WARN APEI_PFX |
---|
182 | | - "Invalid action table, unknown instruction type: %d\n", |
---|
183 | | - entry->instruction); |
---|
| 173 | + pr_warn(FW_WARN APEI_PFX |
---|
| 174 | + "Invalid action table, unknown instruction type: %d\n", |
---|
| 175 | + entry->instruction); |
---|
184 | 176 | return -EINVAL; |
---|
185 | 177 | } |
---|
186 | 178 | run = ctx->ins_table[entry->instruction].run; |
---|
.. | .. |
---|
219 | 211 | if (end) |
---|
220 | 212 | *end = i; |
---|
221 | 213 | if (ins >= ctx->instructions || !ins_table[ins].run) { |
---|
222 | | - pr_warning(FW_WARN APEI_PFX |
---|
223 | | - "Invalid action table, unknown instruction type: %d\n", |
---|
224 | | - ins); |
---|
| 214 | + pr_warn(FW_WARN APEI_PFX |
---|
| 215 | + "Invalid action table, unknown instruction type: %d\n", |
---|
| 216 | + ins); |
---|
225 | 217 | return -EINVAL; |
---|
226 | 218 | } |
---|
227 | 219 | rc = func(ctx, entry, data); |
---|
.. | .. |
---|
587 | 579 | space_id = reg->space_id; |
---|
588 | 580 | *paddr = get_unaligned(®->address); |
---|
589 | 581 | if (!*paddr) { |
---|
590 | | - pr_warning(FW_BUG APEI_PFX |
---|
591 | | - "Invalid physical address in GAR [0x%llx/%u/%u/%u/%u]\n", |
---|
592 | | - *paddr, bit_width, bit_offset, access_size_code, |
---|
593 | | - space_id); |
---|
| 582 | + pr_warn(FW_BUG APEI_PFX |
---|
| 583 | + "Invalid physical address in GAR [0x%llx/%u/%u/%u/%u]\n", |
---|
| 584 | + *paddr, bit_width, bit_offset, access_size_code, |
---|
| 585 | + space_id); |
---|
594 | 586 | return -EINVAL; |
---|
595 | 587 | } |
---|
596 | 588 | |
---|
597 | 589 | if (access_size_code < 1 || access_size_code > 4) { |
---|
598 | | - pr_warning(FW_BUG APEI_PFX |
---|
599 | | - "Invalid access size code in GAR [0x%llx/%u/%u/%u/%u]\n", |
---|
600 | | - *paddr, bit_width, bit_offset, access_size_code, |
---|
601 | | - space_id); |
---|
| 590 | + pr_warn(FW_BUG APEI_PFX |
---|
| 591 | + "Invalid access size code in GAR [0x%llx/%u/%u/%u/%u]\n", |
---|
| 592 | + *paddr, bit_width, bit_offset, access_size_code, |
---|
| 593 | + space_id); |
---|
602 | 594 | return -EINVAL; |
---|
603 | 595 | } |
---|
604 | 596 | *access_bit_width = 1UL << (access_size_code + 2); |
---|
.. | .. |
---|
612 | 604 | *access_bit_width = 64; |
---|
613 | 605 | |
---|
614 | 606 | if ((bit_width + bit_offset) > *access_bit_width) { |
---|
615 | | - pr_warning(FW_BUG APEI_PFX |
---|
616 | | - "Invalid bit width + offset in GAR [0x%llx/%u/%u/%u/%u]\n", |
---|
617 | | - *paddr, bit_width, bit_offset, access_size_code, |
---|
618 | | - space_id); |
---|
| 607 | + pr_warn(FW_BUG APEI_PFX |
---|
| 608 | + "Invalid bit width + offset in GAR [0x%llx/%u/%u/%u/%u]\n", |
---|
| 609 | + *paddr, bit_width, bit_offset, access_size_code, |
---|
| 610 | + space_id); |
---|
619 | 611 | return -EINVAL; |
---|
620 | 612 | } |
---|
621 | 613 | |
---|
622 | 614 | if (space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY && |
---|
623 | 615 | space_id != ACPI_ADR_SPACE_SYSTEM_IO) { |
---|
624 | | - pr_warning(FW_BUG APEI_PFX |
---|
625 | | - "Invalid address space type in GAR [0x%llx/%u/%u/%u/%u]\n", |
---|
626 | | - *paddr, bit_width, bit_offset, access_size_code, |
---|
627 | | - space_id); |
---|
| 616 | + pr_warn(FW_BUG APEI_PFX |
---|
| 617 | + "Invalid address space type in GAR [0x%llx/%u/%u/%u/%u]\n", |
---|
| 618 | + *paddr, bit_width, bit_offset, access_size_code, |
---|
| 619 | + space_id); |
---|
628 | 620 | return -EINVAL; |
---|
629 | 621 | } |
---|
630 | 622 | |
---|
.. | .. |
---|
640 | 632 | rc = apei_check_gar(reg, &address, &access_bit_width); |
---|
641 | 633 | if (rc) |
---|
642 | 634 | return rc; |
---|
643 | | - return acpi_os_map_generic_address(reg); |
---|
| 635 | + |
---|
| 636 | + /* IO space doesn't need mapping */ |
---|
| 637 | + if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) |
---|
| 638 | + return 0; |
---|
| 639 | + |
---|
| 640 | + if (!acpi_os_map_generic_address(reg)) |
---|
| 641 | + return -ENXIO; |
---|
| 642 | + |
---|
| 643 | + return 0; |
---|
644 | 644 | } |
---|
645 | 645 | EXPORT_SYMBOL_GPL(apei_map_generic_address); |
---|
646 | 646 | |
---|