| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2016 Broadcom |
|---|
| 3 | 4 | * Author: Jayachandran C <jchandra@broadcom.com> |
|---|
| 4 | 5 | * Copyright (C) 2016 Semihalf |
|---|
| 5 | 6 | * Author: Tomasz Nowicki <tn@semihalf.com> |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 8 | | - * it under the terms of the GNU General Public License, version 2, as |
|---|
| 9 | | - * published by the Free Software Foundation (the "GPL"). |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is distributed in the hope that it will be useful, but |
|---|
| 12 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 14 | | - * General Public License version 2 (GPLv2) for more details. |
|---|
| 15 | | - * |
|---|
| 16 | | - * You should have received a copy of the GNU General Public License |
|---|
| 17 | | - * version 2 (GPLv2) along with this source code. |
|---|
| 18 | 7 | */ |
|---|
| 19 | 8 | |
|---|
| 20 | 9 | #define pr_fmt(fmt) "ACPI: " fmt |
|---|
| .. | .. |
|---|
| 40 | 29 | u32 oem_revision; |
|---|
| 41 | 30 | u16 segment; |
|---|
| 42 | 31 | struct resource bus_range; |
|---|
| 43 | | - struct pci_ecam_ops *ops; |
|---|
| 32 | + const struct pci_ecam_ops *ops; |
|---|
| 44 | 33 | struct resource cfgres; |
|---|
| 45 | 34 | }; |
|---|
| 46 | 35 | |
|---|
| .. | .. |
|---|
| 51 | 40 | |
|---|
| 52 | 41 | static struct mcfg_fixup mcfg_quirks[] = { |
|---|
| 53 | 42 | /* { OEM_ID, OEM_TABLE_ID, REV, SEGMENT, BUS_RANGE, ops, cfgres }, */ |
|---|
| 43 | + |
|---|
| 44 | +#ifdef CONFIG_ARM64 |
|---|
| 45 | + |
|---|
| 46 | +#define AL_ECAM(table_id, rev, seg, ops) \ |
|---|
| 47 | + { "AMAZON", table_id, rev, seg, MCFG_BUS_ANY, ops } |
|---|
| 48 | + |
|---|
| 49 | + AL_ECAM("GRAVITON", 0, 0, &al_pcie_ops), |
|---|
| 50 | + AL_ECAM("GRAVITON", 0, 1, &al_pcie_ops), |
|---|
| 51 | + AL_ECAM("GRAVITON", 0, 2, &al_pcie_ops), |
|---|
| 52 | + AL_ECAM("GRAVITON", 0, 3, &al_pcie_ops), |
|---|
| 53 | + AL_ECAM("GRAVITON", 0, 4, &al_pcie_ops), |
|---|
| 54 | + AL_ECAM("GRAVITON", 0, 5, &al_pcie_ops), |
|---|
| 55 | + AL_ECAM("GRAVITON", 0, 6, &al_pcie_ops), |
|---|
| 56 | + AL_ECAM("GRAVITON", 0, 7, &al_pcie_ops), |
|---|
| 54 | 57 | |
|---|
| 55 | 58 | #define QCOM_ECAM32(seg) \ |
|---|
| 56 | 59 | { "QCOM ", "QDF2432 ", 1, seg, MCFG_BUS_ANY, &pci_32b_ops } |
|---|
| .. | .. |
|---|
| 63 | 66 | QCOM_ECAM32(5), |
|---|
| 64 | 67 | QCOM_ECAM32(6), |
|---|
| 65 | 68 | QCOM_ECAM32(7), |
|---|
| 69 | + |
|---|
| 70 | +#define RKCP_ECAM(seg, table_id, ops) \ |
|---|
| 71 | + { "RKCP ", table_id, 0x0000, seg, MCFG_BUS_ANY, ops } |
|---|
| 72 | + |
|---|
| 73 | + RKCP_ECAM(0, "RK3588 ", &rk_pcie_ecam_ops), /* pcie3x4: Name (_SEG, Zero) */ |
|---|
| 66 | 74 | |
|---|
| 67 | 75 | #define HISI_QUAD_DOM(table_id, seg, ops) \ |
|---|
| 68 | 76 | { "HISI ", table_id, 0, (seg) + 0, MCFG_BUS_ANY, ops }, \ |
|---|
| .. | .. |
|---|
| 141 | 149 | XGENE_V2_ECAM_MCFG(4, 0), |
|---|
| 142 | 150 | XGENE_V2_ECAM_MCFG(4, 1), |
|---|
| 143 | 151 | XGENE_V2_ECAM_MCFG(4, 2), |
|---|
| 152 | + |
|---|
| 153 | +#define ALTRA_ECAM_QUIRK(rev, seg) \ |
|---|
| 154 | + { "Ampere", "Altra ", rev, seg, MCFG_BUS_ANY, &pci_32b_read_ops } |
|---|
| 155 | + |
|---|
| 156 | + ALTRA_ECAM_QUIRK(1, 0), |
|---|
| 157 | + ALTRA_ECAM_QUIRK(1, 1), |
|---|
| 158 | + ALTRA_ECAM_QUIRK(1, 2), |
|---|
| 159 | + ALTRA_ECAM_QUIRK(1, 3), |
|---|
| 160 | + ALTRA_ECAM_QUIRK(1, 4), |
|---|
| 161 | + ALTRA_ECAM_QUIRK(1, 5), |
|---|
| 162 | + ALTRA_ECAM_QUIRK(1, 6), |
|---|
| 163 | + ALTRA_ECAM_QUIRK(1, 7), |
|---|
| 164 | + ALTRA_ECAM_QUIRK(1, 8), |
|---|
| 165 | + ALTRA_ECAM_QUIRK(1, 9), |
|---|
| 166 | + ALTRA_ECAM_QUIRK(1, 10), |
|---|
| 167 | + ALTRA_ECAM_QUIRK(1, 11), |
|---|
| 168 | + ALTRA_ECAM_QUIRK(1, 12), |
|---|
| 169 | + ALTRA_ECAM_QUIRK(1, 13), |
|---|
| 170 | + ALTRA_ECAM_QUIRK(1, 14), |
|---|
| 171 | + ALTRA_ECAM_QUIRK(1, 15), |
|---|
| 172 | +#endif /* ARM64 */ |
|---|
| 144 | 173 | }; |
|---|
| 145 | 174 | |
|---|
| 146 | 175 | static char mcfg_oem_id[ACPI_OEM_ID_SIZE]; |
|---|
| .. | .. |
|---|
| 152 | 181 | { |
|---|
| 153 | 182 | if (!memcmp(f->oem_id, mcfg_oem_id, ACPI_OEM_ID_SIZE) && |
|---|
| 154 | 183 | !memcmp(f->oem_table_id, mcfg_oem_table_id, |
|---|
| 155 | | - ACPI_OEM_TABLE_ID_SIZE) && |
|---|
| 184 | + ACPI_OEM_TABLE_ID_SIZE) && |
|---|
| 156 | 185 | f->oem_revision == mcfg_oem_revision && |
|---|
| 157 | 186 | f->segment == segment && |
|---|
| 158 | 187 | resource_contains(&f->bus_range, bus_range)) |
|---|
| .. | .. |
|---|
| 164 | 193 | |
|---|
| 165 | 194 | static void pci_mcfg_apply_quirks(struct acpi_pci_root *root, |
|---|
| 166 | 195 | struct resource *cfgres, |
|---|
| 167 | | - struct pci_ecam_ops **ecam_ops) |
|---|
| 196 | + const struct pci_ecam_ops **ecam_ops) |
|---|
| 168 | 197 | { |
|---|
| 169 | 198 | #ifdef CONFIG_PCI_QUIRKS |
|---|
| 170 | 199 | u16 segment = root->segment; |
|---|
| .. | .. |
|---|
| 190 | 219 | static LIST_HEAD(pci_mcfg_list); |
|---|
| 191 | 220 | |
|---|
| 192 | 221 | int pci_mcfg_lookup(struct acpi_pci_root *root, struct resource *cfgres, |
|---|
| 193 | | - struct pci_ecam_ops **ecam_ops) |
|---|
| 222 | + const struct pci_ecam_ops **ecam_ops) |
|---|
| 194 | 223 | { |
|---|
| 195 | | - struct pci_ecam_ops *ops = &pci_generic_ecam_ops; |
|---|
| 224 | + const struct pci_ecam_ops *ops = &pci_generic_ecam_ops; |
|---|
| 196 | 225 | struct resource *bus_res = &root->secondary; |
|---|
| 197 | 226 | u16 seg = root->segment; |
|---|
| 198 | 227 | struct mcfg_entry *e; |
|---|
| .. | .. |
|---|
| 279 | 308 | { |
|---|
| 280 | 309 | int err = acpi_table_parse(ACPI_SIG_MCFG, pci_mcfg_parse); |
|---|
| 281 | 310 | if (err) |
|---|
| 282 | | - pr_err("Failed to parse MCFG (%d)\n", err); |
|---|
| 311 | + pr_debug("Failed to parse MCFG (%d)\n", err); |
|---|
| 283 | 312 | } |
|---|