mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ed Vance <EdV@macrolink.com>
To: "'linux-serial'" <linux-serial@vger.kernel.org>
Cc: "'linux-kernel'" <linux-kernel@vger.kernel.org>,
	"'Russell King'" <rmk@arm.linux.org.uk>,
	"'Alan Cox'" <alan@lxorguk.ukuu.org.uk>
Subject: [PATCH] serial.c procfs kudzu - discussion
Date: Thu, 7 Mar 2002 14:23:48 -0800	[thread overview]
Message-ID: <11E89240C407D311958800A0C9ACF7D13A76E3@EXCHANGE> (raw)

Patch submitted for discussion:

This serial driver patch modifies function line_info() which assembles text 
to be read from /proc/tty/driver/serial. For example, the text line for the 
COM2 port, which is mapped to I/O space, is as follows:

    "1: uart:16550A port:2F8 irq:3 tx:0 rx:0"

The patch corrects handling of ports that are on memory mapped devices. 
The unpatched function generates a short text line for such ports because 
the I/O port address field is zero on memory mapped ports:

    "4: uart:16C950/954 port:0 irq:14"

This is the format used for nonexistent ports. Truly nonexistent ports 
always have a port type of "unknown port". kudzu depends on that. The bug 
causes the short format to be used for all memory mapped ports which have 
known types. The absence of the tx: and rx: fields in the short format 
causes kudzu to die during system initialization at the "Checking for new 
hardware" step:

    S05kudzu: Line 78: 237 Segmentation fault

This is caused by a null-pointer de-reference in kudzu's not-so-robust 
parser, when it lemmings off the end of the short line. 

This patch adds logic to check both the I/O port field and the I/O memory 
base address field to detect the presence of hardware. The patched driver 
generates the longer format text for memory mapped ports:

    "4: uart:16C950/954 port:C4800000 irq:14 tx:0 rx:0 "

Created on kernel files rev 2.4.19-pre2

Contributor: Ed Vance

ISSUES AND CONCERNS FOR DISCUSSION:

1. The patch depends on the I/O port address field and the I/O memory 
address field both being zero for unconfigured ports. Anybody know of any 
exception corner cases where a port gets partially configured and gives 
up with one of these fields left non-zero? 

2. The label on the displayed I/O memory address is "port:", just like 
an I/O port address. Should it display "iomem:" instead of "port:"?

3. A trailing space has been added to all text lines as a cushion for 
kudzu. Should this stay in?

4. Should a bug be turned in against kudzu for the weak parser? 


diff -urN -X dontdiff.txt linux-2.4.19-pre2/drivers/char/serial.c
patched/drivers/char/serial.c
--- linux-2.4.19-pre2/drivers/char/serial.c	Sat Mar  2 10:38:11 2002
+++ patched/drivers/char/serial.c	Wed Mar  6 14:31:44 2002
@@ -3260,10 +3260,12 @@
 
 	ret = sprintf(buf, "%d: uart:%s port:%lX irq:%d",
 		      state->line, uart_config[state->type].name, 
-		      state->port, state->irq);
+		      (state->port ? state->port : (long)state->iomem_base),
+		      state->irq);
 
-	if (!state->port || (state->type == PORT_UNKNOWN)) {
-		ret += sprintf(buf+ret, "\n");
+	if ((!state->port && !state->iomem_base) ||
+	    (state->type == PORT_UNKNOWN)) {
+		ret += sprintf(buf+ret, " \n");
 		return ret;
 	}
 

---------------------------------------------------------------- 
Ed Vance              edv@macrolink.com
Macrolink, Inc.       1500 N. Kellogg Dr  Anaheim, CA  92807
----------------------------------------------------------------



             reply	other threads:[~2002-03-07 22:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-07 22:23 Ed Vance [this message]
2002-03-07 22:34 ` Bill Nottingham
2002-03-07 23:12 Ed Vance
2002-03-08  9:49 ` Russell King
2002-03-08 10:25 ` David Woodhouse
2002-03-08 18:12 Ed Vance
2002-03-08 19:15 Ed Vance
2002-03-09  0:34 Ed Vance

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=11E89240C407D311958800A0C9ACF7D13A76E3@EXCHANGE \
    --to=edv@macrolink.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=rmk@arm.linux.org.uk \
    /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: link
Be 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

all inboxes | Powered by JetHome®