Skip to content

Commit ac4e3b0

Browse files
committed
mips: fix PCI_IOBASE definition
After my previous patch, the ioport_map() function changed from the lib/iomap.c version to the asm-generic/io.h version, which requires a correct PCI_IOBASE definition. Unfortunately the types are also different, so add the correct definition for ioport_map() in asm/io.h and change the machine specific ones to have the correct type. Signed-off-by: Arnd Bergmann <arnd@arndb.de>
1 parent 9d48cc0 commit ac4e3b0

4 files changed

Lines changed: 11 additions & 6 deletions

File tree

arch/mips/include/asm/io.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,12 +544,16 @@ extern void (*_dma_cache_inv)(unsigned long start, unsigned long size);
544544

545545
void __ioread64_copy(void *to, const void __iomem *from, size_t count);
546546

547-
#ifdef CONFIG_PCI_DRIVERS_LEGACY
547+
#if defined(CONFIG_PCI) && defined(CONFIG_PCI_DRIVERS_LEGACY)
548548
struct pci_dev;
549549
void pci_iounmap(struct pci_dev *dev, void __iomem *addr);
550550
#define pci_iounmap pci_iounmap
551551
#endif
552552

553+
#ifndef PCI_IOBASE
554+
#define PCI_IOBASE ((void __iomem *)mips_io_port_base)
555+
#endif
556+
553557
#include <asm-generic/io.h>
554558

555559
static inline void *isa_bus_to_virt(unsigned long address)

arch/mips/include/asm/mach-loongson64/spaces.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
#endif /* CONFIG_64BIT */
88

99
/* Skip 128k to trap NULL pointer dereferences */
10-
#define PCI_IOBASE _AC(0xc000000000000000 + SZ_128K, UL)
10+
#define PCI_PORT_BASE _AC(0xc000000000000000 + SZ_128K, UL)
11+
#define PCI_IOBASE (void __iomem *)PCI_PORT_BASE
1112
#define PCI_IOSIZE SZ_16M
12-
#define MAP_BASE (PCI_IOBASE + PCI_IOSIZE)
13+
#define MAP_BASE (PCI_PORT_BASE + PCI_IOSIZE)
1314

1415
#define IO_SPACE_LIMIT (PCI_IOSIZE - 1)
1516

arch/mips/include/asm/mach-ralink/spaces.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#ifndef __ASM_MACH_RALINK_SPACES_H_
33
#define __ASM_MACH_RALINK_SPACES_H_
44

5-
#define PCI_IOBASE mips_io_port_base
5+
#define PCI_IOBASE (void __iomem *)mips_io_port_base
66
#define PCI_IOSIZE SZ_64K
77
#define IO_SPACE_LIMIT (PCI_IOSIZE - 1)
88

arch/mips/loongson64/init.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ void __init prom_init(void)
128128
}
129129

130130
/* init base address of io space */
131-
set_io_port_base(PCI_IOBASE);
131+
set_io_port_base((unsigned long)PCI_IOBASE);
132132

133133
if (loongson_sysconf.early_config)
134134
loongson_sysconf.early_config();
@@ -178,7 +178,7 @@ static int __init add_legacy_isa_io(struct fwnode_handle *fwnode, resource_size_
178178
return -EINVAL;
179179
}
180180

181-
vaddr = PCI_IOBASE + range->io_start;
181+
vaddr = (unsigned long)PCI_IOBASE + range->io_start;
182182

183183
vmap_page_range(vaddr, vaddr + size, hw_start, pgprot_device(PAGE_KERNEL));
184184

0 commit comments

Comments
 (0)