LKML Archive on lore.kernel.org help / color / mirror / Atom feed
From: Bjorn Helgaas <bjorn.helgaas@hp.com> To: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: linux-kernel@vger.kernel.org Cc: linux-serial@vger.kernel.org Cc: Russell King <rmk+serial@arm.linux.org.uk> Cc: Jeff Garzik <jeff@garzik.org> Cc: Andrew Morton <akpm@linux-foundation.org> Subject: [patch 2/2] 8250_pnp: register x86 COM ports at the conventional ttyS names Date: Wed, 16 Jan 2008 10:05:43 -0700 [thread overview] Message-ID: <20080116170914.959390017@ldl.fc.hp.com> (raw) In-Reply-To: 20080116170541.511233227@ldl.fc.hp.com [-- Attachment #1: 8250-pnp-names --] [-- Type: text/plain, Size: 1808 bytes --] x86 users expect COM1-COM4 ports at the conventional ioport addresses to be named ttyS0-ttyS3. For PNP devices, the BIOS determines the order we discover them, so we might discover COM2 before COM1. We currently always get the correct names, even without this patch. But that's only because serial8250_isa_init_ports() first registers the hard-coded list of COM port addresses from SERIAL_PORT_DFNS. When PNP rediscovers one of those ports, it gets the already-established line. This patch removes the implicit dependency on SERIAL_PORT_DFNS by requesting the names we desire. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Index: work5/drivers/serial/8250_pnp.c =================================================================== --- work5.orig/drivers/serial/8250_pnp.c 2008-01-16 09:29:33.000000000 -0700 +++ work5/drivers/serial/8250_pnp.c 2008-01-16 09:51:09.000000000 -0700 @@ -427,6 +427,21 @@ } static int __devinit +serial_pnp_line(struct uart_port *port) +{ +#ifdef CONFIG_X86 + switch (port->iobase) { + case 0x3f8: return 0; /* COM1 -> ttyS0 */ + case 0x2f8: return 1; /* COM2 -> ttyS1 */ + case 0x3e8: return 2; /* COM3 -> ttyS2 */ + case 0x2e8: return 3; /* COM4 -> ttyS3 */ + } +#endif + + return -ENODEV; +} + +static int __devinit serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) { struct uart_port port; @@ -462,7 +477,17 @@ port.uartclk = 1843200; port.dev = &dev->dev; - line = serial8250_register_port(&port); + line = serial_pnp_line(&port); + if (line >= 0) + line = serial8250_register_port_at(&port, line); + + /* + * If the desired line was busy, or if we don't care which line + * we get, use the regular registration. + */ + if (line < 0) + line = serial8250_register_port(&port); + if (line < 0) return -ENODEV; --
next prev parent reply other threads:[~2008-01-16 17:09 UTC|newest] Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top 2008-01-16 17:05 [patch 0/2] serial: explicitly request ttyS0-3 for COM1-4 Bjorn Helgaas 2008-01-16 17:05 ` [patch 1/2] 8250: add serial8250_register_port_at() for requesting specific ttyS lines Bjorn Helgaas 2008-01-16 17:05 ` Bjorn Helgaas [this message] 2008-01-16 18:42 ` [patch 2/2] 8250_pnp: register x86 COM ports at the conventional ttyS names Russell King 2008-01-16 18:44 ` H. Peter Anvin 2008-01-16 19:47 ` Bjorn Helgaas 2008-01-16 19:49 ` H. Peter Anvin 2008-01-16 18:39 ` [patch 0/2] serial: explicitly request ttyS0-3 for COM1-4 Russell King 2008-01-16 19:59 ` Bjorn Helgaas 2008-01-16 20:14 ` Russell King 2008-01-17 16:07 ` Bjorn Helgaas 2008-01-17 16:16 ` Russell King 2008-01-17 17:56 ` Bjorn Helgaas [not found] <9MjWa-VI-9@gated-at.bofh.it> [not found] ` <9MjWb-VI-11@gated-at.bofh.it> [not found] ` <9MlEG-3Mx-13@gated-at.bofh.it> [not found] ` <9Mmra-56f-29@gated-at.bofh.it> 2008-01-16 20:33 ` [patch 2/2] 8250_pnp: register x86 COM ports at the conventional ttyS names Bodo Eggert 2008-01-16 20:42 ` H. Peter Anvin 2008-01-16 23:34 ` Rene Herman 2008-01-18 18:10 ` H. Peter Anvin
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20080116170914.959390017@ldl.fc.hp.com \ --to=bjorn.helgaas@hp.com \ --cc=alan@lxorguk.ukuu.org.uk \ --cc=linux-kernel@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).