| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Support PCI IO workaround |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2006 Benjamin Herrenschmidt <benh@kernel.crashing.org> |
|---|
| 5 | 6 | * IBM, Corp. |
|---|
| 6 | 7 | * (C) Copyright 2007-2008 TOSHIBA CORPORATION |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 9 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 10 | | - * published by the Free Software Foundation. |
|---|
| 11 | 8 | */ |
|---|
| 12 | 9 | #undef DEBUG |
|---|
| 13 | 10 | |
|---|
| 14 | 11 | #include <linux/kernel.h> |
|---|
| 15 | 12 | #include <linux/sched/mm.h> /* for init_mm */ |
|---|
| 13 | +#include <linux/pgtable.h> |
|---|
| 16 | 14 | |
|---|
| 17 | 15 | #include <asm/io.h> |
|---|
| 18 | 16 | #include <asm/machdep.h> |
|---|
| 19 | | -#include <asm/pgtable.h> |
|---|
| 20 | 17 | #include <asm/ppc-pci.h> |
|---|
| 21 | 18 | #include <asm/io-workarounds.h> |
|---|
| 22 | 19 | #include <asm/pte-walk.h> |
|---|
| .. | .. |
|---|
| 152 | 149 | }; |
|---|
| 153 | 150 | |
|---|
| 154 | 151 | #ifdef CONFIG_PPC_INDIRECT_MMIO |
|---|
| 155 | | -static void __iomem *iowa_ioremap(phys_addr_t addr, unsigned long size, |
|---|
| 156 | | - unsigned long flags, void *caller) |
|---|
| 152 | +void __iomem *iowa_ioremap(phys_addr_t addr, unsigned long size, |
|---|
| 153 | + pgprot_t prot, void *caller) |
|---|
| 157 | 154 | { |
|---|
| 158 | 155 | struct iowa_bus *bus; |
|---|
| 159 | | - void __iomem *res = __ioremap_caller(addr, size, flags, caller); |
|---|
| 156 | + void __iomem *res = __ioremap_caller(addr, size, prot, caller); |
|---|
| 160 | 157 | int busno; |
|---|
| 161 | 158 | |
|---|
| 162 | 159 | bus = iowa_pci_find(0, (unsigned long)addr); |
|---|
| .. | .. |
|---|
| 166 | 163 | } |
|---|
| 167 | 164 | return res; |
|---|
| 168 | 165 | } |
|---|
| 169 | | -#else /* CONFIG_PPC_INDIRECT_MMIO */ |
|---|
| 170 | | -#define iowa_ioremap NULL |
|---|
| 171 | 166 | #endif /* !CONFIG_PPC_INDIRECT_MMIO */ |
|---|
| 167 | + |
|---|
| 168 | +bool io_workaround_inited; |
|---|
| 172 | 169 | |
|---|
| 173 | 170 | /* Enable IO workaround */ |
|---|
| 174 | 171 | static void io_workaround_init(void) |
|---|
| 175 | 172 | { |
|---|
| 176 | | - static int io_workaround_inited; |
|---|
| 177 | | - |
|---|
| 178 | 173 | if (io_workaround_inited) |
|---|
| 179 | 174 | return; |
|---|
| 180 | 175 | ppc_pci_io = iowa_pci_io; |
|---|
| 181 | | - ppc_md.ioremap = iowa_ioremap; |
|---|
| 182 | | - io_workaround_inited = 1; |
|---|
| 176 | + io_workaround_inited = true; |
|---|
| 183 | 177 | } |
|---|
| 184 | 178 | |
|---|
| 185 | 179 | /* Register new bus to support workaround */ |
|---|