| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2001 Dave Engebretsen, IBM Corporation |
|---|
| 3 | 4 | * Copyright (C) 2003 Anton Blanchard <anton@au.ibm.com>, IBM |
|---|
| 4 | 5 | * |
|---|
| 5 | 6 | * pSeries specific routines for PCI. |
|---|
| 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 as published by |
|---|
| 9 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 10 | | - * (at your option) any later version. |
|---|
| 11 | | - * |
|---|
| 12 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 13 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 15 | | - * GNU General Public License for more details. |
|---|
| 16 | | - * |
|---|
| 17 | | - * You should have received a copy of the GNU General Public License |
|---|
| 18 | | - * along with this program; if not, write to the Free Software |
|---|
| 19 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 20 | 7 | */ |
|---|
| 21 | 8 | |
|---|
| 22 | 9 | #include <linux/init.h> |
|---|
| .. | .. |
|---|
| 29 | 16 | #include <asm/pci-bridge.h> |
|---|
| 30 | 17 | #include <asm/prom.h> |
|---|
| 31 | 18 | #include <asm/ppc-pci.h> |
|---|
| 19 | +#include <asm/pci.h> |
|---|
| 32 | 20 | #include "pseries.h" |
|---|
| 33 | 21 | |
|---|
| 34 | 22 | #if 0 |
|---|
| .. | .. |
|---|
| 204 | 192 | int pseries_pcibios_sriov_enable(struct pci_dev *pdev, u16 num_vfs) |
|---|
| 205 | 193 | { |
|---|
| 206 | 194 | /* Allocate PCI data */ |
|---|
| 207 | | - add_dev_pci_data(pdev); |
|---|
| 195 | + add_sriov_vf_pdns(pdev); |
|---|
| 208 | 196 | return pseries_pci_sriov_enable(pdev, num_vfs); |
|---|
| 209 | 197 | } |
|---|
| 210 | 198 | |
|---|
| .. | .. |
|---|
| 216 | 204 | /* Releasing pe_num_map */ |
|---|
| 217 | 205 | kfree(pdn->pe_num_map); |
|---|
| 218 | 206 | /* Release PCI data */ |
|---|
| 219 | | - remove_dev_pci_data(pdev); |
|---|
| 207 | + remove_sriov_vf_pdns(pdev); |
|---|
| 220 | 208 | pci_vf_drivers_autoprobe(pdev, true); |
|---|
| 221 | 209 | return 0; |
|---|
| 222 | 210 | } |
|---|
| .. | .. |
|---|
| 237 | 225 | |
|---|
| 238 | 226 | void __init pSeries_final_fixup(void) |
|---|
| 239 | 227 | { |
|---|
| 228 | + struct pci_controller *hose; |
|---|
| 229 | + |
|---|
| 240 | 230 | pSeries_request_regions(); |
|---|
| 241 | 231 | |
|---|
| 242 | | - eeh_addr_cache_build(); |
|---|
| 232 | + eeh_show_enabled(); |
|---|
| 243 | 233 | |
|---|
| 244 | 234 | #ifdef CONFIG_PCI_IOV |
|---|
| 245 | 235 | ppc_md.pcibios_sriov_enable = pseries_pcibios_sriov_enable; |
|---|
| 246 | 236 | ppc_md.pcibios_sriov_disable = pseries_pcibios_sriov_disable; |
|---|
| 247 | 237 | #endif |
|---|
| 238 | + list_for_each_entry(hose, &hose_list, list_node) { |
|---|
| 239 | + struct device_node *dn = hose->dn, *nvdn; |
|---|
| 240 | + |
|---|
| 241 | + while (1) { |
|---|
| 242 | + dn = of_find_all_nodes(dn); |
|---|
| 243 | + if (!dn) |
|---|
| 244 | + break; |
|---|
| 245 | + nvdn = of_parse_phandle(dn, "ibm,nvlink", 0); |
|---|
| 246 | + if (!nvdn) |
|---|
| 247 | + continue; |
|---|
| 248 | + if (!of_device_is_compatible(nvdn, "ibm,npu-link")) |
|---|
| 249 | + continue; |
|---|
| 250 | + if (!of_device_is_compatible(nvdn->parent, |
|---|
| 251 | + "ibm,power9-npu")) |
|---|
| 252 | + continue; |
|---|
| 253 | +#ifdef CONFIG_PPC_POWERNV |
|---|
| 254 | + WARN_ON_ONCE(pnv_npu2_init(hose)); |
|---|
| 255 | +#endif |
|---|
| 256 | + break; |
|---|
| 257 | + } |
|---|
| 258 | + } |
|---|
| 248 | 259 | } |
|---|
| 249 | 260 | |
|---|
| 250 | 261 | /* |
|---|