Commit 7f114818 authored by Russell King's avatar Russell King

[SERIAL] Pass "iomap" base from probe modules

Patch from Randolph Chung, slightly modified by rmk.

When displaying the details of memory mapped serial ports, we want to show
some sane base value.  The cookie returned from ioremap can be meaningless
to users (and developers), especially when the cookie could be a dynamically
allocated virtual address.

The more useful cookie is the value passed into ioremap.  We already have
support for handling this cookie internally - we haven't allowed the PCI
probe module to hand it to the higher levels until now.
parent d6f75078
...@@ -517,7 +517,7 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags) ...@@ -517,7 +517,7 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags)
unsigned char save_lcr, save_mcr; unsigned char save_lcr, save_mcr;
unsigned long flags; unsigned long flags;
if (!up->port.iobase && !up->port.membase) if (!up->port.iobase && !up->port.mapbase && !up->port.membase)
return; return;
DEBUG_AUTOCONF("ttyS%d: autoconf (0x%04x, 0x%08lx): ", DEBUG_AUTOCONF("ttyS%d: autoconf (0x%04x, 0x%08lx): ",
...@@ -1950,6 +1950,7 @@ static int __register_serial(struct serial_struct *req, int line) ...@@ -1950,6 +1950,7 @@ static int __register_serial(struct serial_struct *req, int line)
port.regshift = req->iomem_reg_shift; port.regshift = req->iomem_reg_shift;
port.iotype = req->io_type; port.iotype = req->io_type;
port.flags = req->flags | UPF_BOOT_AUTOCONF; port.flags = req->flags | UPF_BOOT_AUTOCONF;
port.mapbase = req->iomap_base;
port.line = line; port.line = line;
if (share_irqs) if (share_irqs)
......
...@@ -176,6 +176,7 @@ get_pci_port(struct pci_dev *dev, struct pci_board *board, ...@@ -176,6 +176,7 @@ get_pci_port(struct pci_dev *dev, struct pci_board *board,
return 0; return 0;
} }
req->io_type = SERIAL_IO_MEM; req->io_type = SERIAL_IO_MEM;
req->iomap_base = port;
req->iomem_base = ioremap(port, board->uart_offset); req->iomem_base = ioremap(port, board->uart_offset);
if (req->iomem_base == NULL) if (req->iomem_base == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -2009,7 +2009,7 @@ __uart_register_port(struct uart_driver *drv, struct uart_state *state, ...@@ -2009,7 +2009,7 @@ __uart_register_port(struct uart_driver *drv, struct uart_state *state,
/* /*
* If there isn't a port here, don't do anything further. * If there isn't a port here, don't do anything further.
*/ */
if (!port->iobase && !port->mapbase) if (!port->iobase && !port->mapbase && !port->membase)
return; return;
/* /*
...@@ -2418,6 +2418,7 @@ int uart_register_port(struct uart_driver *drv, struct uart_port *port) ...@@ -2418,6 +2418,7 @@ int uart_register_port(struct uart_driver *drv, struct uart_port *port)
state->port->iotype = port->iotype; state->port->iotype = port->iotype;
state->port->flags = port->flags; state->port->flags = port->flags;
state->port->line = state - drv->state; state->port->line = state - drv->state;
state->port->mapbase = port->mapbase;
__uart_register_port(drv, state, state->port); __uart_register_port(drv, state, state->port);
} }
......
...@@ -48,6 +48,7 @@ struct serial_struct { ...@@ -48,6 +48,7 @@ struct serial_struct {
unsigned char *iomem_base; unsigned char *iomem_base;
unsigned short iomem_reg_shift; unsigned short iomem_reg_shift;
unsigned int port_high; unsigned int port_high;
unsigned long iomap_base; /* cookie passed into ioremap */
int reserved[1]; int reserved[1];
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment