From d3902aada61e6adf4c354fe9273e3f9caf70944c Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Sun, 5 Oct 2003 23:58:04 +0100 Subject: [PATCH] [SERIAL] removing legacy UART cruft I'm trying to remove all the legacy UART cruft from ia64. In theory we should be able to discover all UARTs on ia64 via ACPI and PCI enumeration, so we shouldn't need SERIAL_PORT_DFNS. But SERIAL_PORT_DFNS currently does two things: 1) it tells you about legacy devices you can't discover via a standard enumeration method, and 2) it sizes old_serial_port[], which determines UART_NR, which is the maximum number of ports the driver will support So here's a proposal to make SERIAL_PORT_DFNS optional and provide another mechanism for configuring the number of ports to support. --- drivers/serial/8250.c | 14 ++++++++++++-- drivers/serial/8250_pci.c | 4 +++- drivers/serial/Kconfig | 14 ++++++++++++-- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index 7d0479c472ca4..869267047d346 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c @@ -105,11 +105,20 @@ unsigned int share_irqs = SERIAL8250_SHARE_IRQS; #include +/* + * SERIAL_PORT_DFNS tells us about built-in ports that have no + * standard enumeration mechanism. Platforms that can find all + * serial ports via mechanisms like ACPI or PCI need not supply it. + */ +#ifndef SERIAL_PORT_DFNS +#define SERIAL_PORT_DFNS +#endif + static struct old_serial_port old_serial_port[] = { SERIAL_PORT_DFNS /* defined in asm/serial.h */ }; -#define UART_NR ARRAY_SIZE(old_serial_port) +#define UART_NR (ARRAY_SIZE(old_serial_port) + CONFIG_SERIAL_8250_NR_UARTS) #if defined(CONFIG_SERIAL_8250_RSA) && defined(MODULE) @@ -2136,7 +2145,8 @@ static int __init serial8250_init(void) int ret, i; printk(KERN_INFO "Serial: 8250/16550 driver $Revision: 1.90 $ " - "IRQ sharing %sabled\n", share_irqs ? "en" : "dis"); + "%d ports, IRQ sharing %sabled\n", (int) UART_NR, + share_irqs ? "en" : "dis"); for (i = 0; i < NR_IRQS; i++) spin_lock_init(&irq_lists[i].lock); diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c index 778cd1eea5ba9..bb13d16c8a2f5 100644 --- a/drivers/serial/8250_pci.c +++ b/drivers/serial/8250_pci.c @@ -1552,8 +1552,10 @@ pciserial_init_one(struct pci_dev *dev, const struct pci_device_id *ent) #endif priv->line[i] = register_serial(&serial_req); - if (priv->line[i] < 0) + if (priv->line[i] < 0) { + printk(KERN_WARNING "Couldn't register serial port %s: %d\n", pci_name(dev), priv->line[i]); break; + } } priv->nr = i; diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index b514f5dccc91b..ba80e22f2e871 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -93,6 +93,16 @@ config SERIAL_8250_HCDP purpose port, say Y here. See . +config SERIAL_8250_NR_UARTS + int "Maximum number of non-legacy 8250/16550 serial ports" + depends on SERIAL_8250 + default "4" + ---help--- + Set this to the number of non-legacy serial ports you want + the driver to support. This includes any ports discovered + via ACPI or PCI enumeration and any ports that may be added + at run-time via hot-plug. + config SERIAL_8250_EXTENDED bool "Extended 8250/16550 serial driver options" depends on SERIAL_8250 @@ -107,8 +117,8 @@ config SERIAL_8250_EXTENDED the questions about serial driver options. If unsure, say N. config SERIAL_8250_MANY_PORTS - bool "Support more than 4 serial ports" - depends on SERIAL_8250_EXTENDED + bool "Support more than 4 legacy serial ports" + depends on SERIAL_8250_EXTENDED && !IA64 help Say Y here if you have dumb serial boards other than the four standard COM 1/2/3/4 ports. This may happen if you have an AST -- 2.53.0