mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
When the '8250_exar' module is loaded into the kernel, a kernel trace
with 'WARN_ON(legacy_iomap_table[bar])' is dumped to the console,
because the old pci table mapping is still used in '8250_pcilib'.
The old function have been deprecated in commit e354bb84a4 ("PCI:
Deprecate pcim_iomap_table(), pcim_iomap_regions_request_all()").
The remapping already takes or must take place in the driver that calls
the function 'serial8250_pci_setup_port()'. The remapping should only be
called once via 'pcim_iomap()'. Therefore the remapping moved to the
caller of 'serial8250_pci_setup_port()'.
To replace the outdated/legacy iomap_table processing in '8250_pcilib' the
function signature of 'serial8250_pci_setup_port()' has been extended with
an already iomapped address value. So this can be used directly without
io mapping again.
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
Link: https://patch.msgid.link/20250930072743.791580-1-fe@dev.tdt.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
50 lines
1.3 KiB
C
50 lines
1.3 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* 8250 PCI library.
|
|
*
|
|
* Copyright (C) 2001 Russell King, All Rights Reserved.
|
|
*/
|
|
#include <linux/errno.h>
|
|
#include <linux/ioport.h>
|
|
#include <linux/pci.h>
|
|
#include <linux/types.h>
|
|
|
|
#include "8250.h"
|
|
#include "8250_pcilib.h"
|
|
|
|
int serial_8250_warn_need_ioport(struct pci_dev *dev)
|
|
{
|
|
dev_warn(&dev->dev,
|
|
"Serial port not supported because of missing I/O resource\n");
|
|
|
|
return -ENXIO;
|
|
}
|
|
EXPORT_SYMBOL_NS_GPL(serial_8250_warn_need_ioport, "SERIAL_8250_PCI");
|
|
|
|
int serial8250_pci_setup_port(struct pci_dev *dev, struct uart_8250_port *port,
|
|
u8 bar, unsigned int offset, int regshift, void __iomem *iomem)
|
|
{
|
|
if (bar >= PCI_STD_NUM_BARS)
|
|
return -EINVAL;
|
|
|
|
if (pci_resource_flags(dev, bar) & IORESOURCE_MEM) {
|
|
port->port.iotype = UPIO_MEM;
|
|
port->port.iobase = 0;
|
|
port->port.mapbase = pci_resource_start(dev, bar) + offset;
|
|
port->port.membase = iomem + offset;
|
|
port->port.regshift = regshift;
|
|
} else if (IS_ENABLED(CONFIG_HAS_IOPORT)) {
|
|
port->port.iotype = UPIO_PORT;
|
|
port->port.iobase = pci_resource_start(dev, bar) + offset;
|
|
port->port.mapbase = 0;
|
|
port->port.membase = NULL;
|
|
port->port.regshift = 0;
|
|
} else {
|
|
return serial_8250_warn_need_ioport(dev);
|
|
}
|
|
return 0;
|
|
}
|
|
EXPORT_SYMBOL_NS_GPL(serial8250_pci_setup_port, "SERIAL_8250_PCI");
|
|
MODULE_DESCRIPTION("8250 PCI library");
|
|
MODULE_LICENSE("GPL");
|