mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: Tom Rini <trini@kernel.crashing.org>
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org, rmk@arm.linux.org.uk
Subject: Re: [patch 04/16] I/O driver for 8250-compatible UARTs
Date: Wed, 31 Aug 2005 13:38:52 -0600	[thread overview]
Message-ID: <200508311338.52225.bjorn.helgaas@hp.com> (raw)
In-Reply-To: <resend.4.2982005.trini@kernel.crashing.org>

On Monday 29 August 2005 10:09 am, Tom Rini wrote:
>  linux-2.6.13-trini/drivers/serial/kgdb_8250.c  |  594 +++++++++++++++++++++

The existing stuff in drivers/serial is named "8250_*"; is
there a reason you're using "kgdb_8250" rather than "8250_kgdb"?

> + *	serial8250_unregister_by_port - remove a 16x50 serial port
> + *	at runtime.
> + *	@port: A &struct uart_port that describes the port to remove.
> + *
> + *	Remove one serial port.  This may not be called from interrupt
> + *	context.  We hand the port back to the our control.

Hand the port back to whose control?

> +MODULE_PARM_DESC(kgdb8250, " kgdb8250=<port number>,<baud rate>\n");

Document IRQ/MMIO/IOport stuff here too (whatever it turns out to be,
see below).

It seems wrong to me to have kgdb8250 use "ttyS" names for devices.
In general you don't know the ttyS name for a device until after the
8250 driver claims it.  Sure, it's a convenience to use "ttyS0"
instead of "io,0x3f8", but it also makes it hard to run kgdb on a
PCI or MMIO UART, because you don't know what its name will be.

If you gave up the convenience and just always required an I/O port
or MMIO address, you could nuke all the old_rs_table[] and
kgdb8250_ports[] stuff, not to mention a bunch of config options.

> +static int kgdb8250_local_init(void)
> +{
> +	if (old_rs_table_copied == 0)
> +		kgdb8250_copy_rs_table();

This would be easier to maintain if the "if (old_rs_table_copied)"
test were in the callee, not in every caller.

> +	switch (CURRENTPORT.iotype) {
> +	case UPIO_MEM:
> +		if (CURRENTPORT.mapbase)
> +			kgdb8250_needs_request_mem_region = 1;
> +		if (CURRENTPORT.flags & UPF_IOREMAP) {
> +			CURRENTPORT.membase = ioport_map(CURRENTPORT.mapbase,
> +						      8 << KGDB8250_REG_SHIFT);

Shouldn't this be ioremap instead of ioport_map?

> +static int kgdb_init_io(void)
> +{
> +#ifdef CONFIG_KGDB_8250_MODULE
> +	if (strlen(config)) {
> +		if (kgdb8250_opt(config))
> +			return -EINVAL;
> +	} else {
> +		printk(KERN_ERR "kgdb8250: argument error, usage: "
> +		       "kgdb8250=<port number>,<baud rate>");
> +#ifdef CONFIG_IA64
> +		printk(",<irq>,<iomem base>");
> +#endif

This isn't ia64-specific.

> +static void __init kgdb8250_hookup_irq(void)
> +{
> +#if defined(CONFIG_SERIAL_8250) || defined (CONFIG_SERIAL_8250_MODULE)
> +	/* Take the port away from the main driver. */
> +	serial8250_unregister_by_port(&CURRENTPORT);
> +
> +	/* Now reinit the port as the above has disabled things. */
> +	kgdb8250_init();
> +#endif
> +	/* We may need to call request_mem_region() first. */
> +	if (kgdb8250_needs_request_mem_region)
> +		request_mem_region(CURRENTPORT.mapbase,
> +				   8 << KGDB8250_REG_SHIFT, "kgdb");

The unregister/init/request_mem_region stuff doesn't sound very much
like "hookup_irq".

> + * Syntax for this cmdline option is "kgdb8250=ttyno,baudrate"
> + * with ",irq,iomembase" tacked on the end on IA64.

This syntax doesn't really make sense on ia64, because there are
no fixed "ttyno/iomembase" mappings.  It would be unambiguous to
specify either ttyno OR iomembase, but there's no good way to use
both.

And there should be syntax to specify either MMIO or I/O port space
devices.  Intel ia64 boxes typically have I/O port UARTs (0x3f8, etc),
and HP boxes typically have MMIO devices.

> +#ifdef CONFIG_IA64
> +	if (*str == ',') {
> +		str++;
> +		KGDB8250_IRQ = simple_strtoul(str, &str, 10);
> +		if (*str == ',') {
> +			str++;
> +			CURRENTPORT.iotype = SERIAL_IO_MEM;
> +			CURRENTPORT.membase =
> +			    (unsigned char *)simple_strtoul(str, &str, 0);
> +		}
> +	}
> +#endif

Not ia64-specific.

> +config KGDB_SIMPLE_SERIAL
> +	bool "Simple selection of KGDB serial port"
> +	depends on KGDB_8250
> +	default y
> +	help
> +	  If you say Y here, you will only have to pick the baud rate
> +	  and serial port (ttyS) that you wish to use for KGDB.  If you
> +	  say N, you will have provide the I/O port and IRQ number.  Note
> +	  that if your serial ports are iomapped, such as on ia64, then
> +	  you must say Y here.  If in doubt, say Y.

How about: "... you will have to provide the address (I/O port or MMIO
address) and IRQ ..."

I don't understand the "iomapped" bit -- does that mean MMIO?  And why
would it make any difference whether they're in I/O port or MMIO space?

I expect that if you use "ttyS" naming to select a port, that doesn't
work early in boot on ia64, because ia64 doesn't have compiled-in
knowledge of where ttyS devices live.  Is that related to what this is
trying to say?

> +config KGDB_PORT
> +	hex "hex I/O port address of the debug serial port"
> +	depends on !KGDB_SIMPLE_SERIAL && KGDB_8250 && !IA64
> +	default 3f8
> +	help
> +	  This is the unmapped (and on platforms with 1:1 mapping
> +	  this is typically, but not always the same as the mapped)
> +	  address of the serial port.  The stanards on your architecture
> +	  may be found in include/asm-$(ARCH)/serial.h.

Not ia64-specific.  The description sounds like it applies to MMIO,
not to I/O port space.    And s/stanards/standards/.

> +config KGDB_IRQ
> +	int "IRQ of the debug serial port"
> +	depends on !KGDB_SIMPLE_SERIAL && KGDB_8250 && !IA64
> +	default 4
> +	help
> +	  This is the IRQ for the debug port.  This must be known so that
> +	  KGDB can interrupt the running system (either for a new
> +	  connection or when in gdb and control-C is issued).

Not ia64-specific.

  parent reply	other threads:[~2005-08-31 19:39 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-29 16:08 [patch 01/16] Add a KGDB core Tom Rini
     [not found] ` <1.2982005.trini@kernel.crashing.org>
2005-08-29 16:09   ` [patch 02/16] Add support for i386 platforms to KGDB Tom Rini
2005-08-29 19:55     ` [patch 2/3] x86_64: Run setup_per_cpu_areas and trap_init sooner Andi Kleen
2005-08-29 20:03       ` Tom Rini
2005-08-29 16:09   ` [patch 03/16] Add support for PowerPC32 platforms to KGDB Tom Rini
2005-08-29 16:09   ` [patch 04/16] I/O driver for 8250-compatible UARTs Tom Rini
2005-08-29 16:18     ` Russell King
2005-08-29 16:28       ` Tom Rini
2005-08-31 19:38     ` Bjorn Helgaas [this message]
2005-08-31 20:10       ` Tom Rini
2005-08-31 21:03         ` Russell King
2005-08-31 21:23           ` Tom Rini
2005-08-31 21:19         ` Bjorn Helgaas
2005-08-31 22:15           ` Tom Rini
2005-08-29 16:09   ` [patch 05/16] Add support for MIPS platforms to KGDB Tom Rini
2005-08-29 16:10   ` [patch 06/16] Add support for IA64 " Tom Rini
2005-08-29 16:10   ` [patch 07/16] x86_64: Rename KDB_VECTOR to DEBUGGER_VECTOR Tom Rini
2005-08-29 16:10   ` [patch 08/16] Add support for X86_64 platforms to KGDB Tom Rini
2005-08-29 17:13     ` Andi Kleen
2005-08-29 17:45       ` Tom Rini
2005-08-29 18:46         ` Andi Kleen
2005-08-29 18:49           ` Tom Rini
2005-08-29 16:10   ` [patch 09/16] Add support for SuperH " Tom Rini
2005-08-29 16:10   ` [patch 10/16] Add support for ARM " Tom Rini
2005-08-29 16:11   ` [patch 11/16] Add support for PowerPC64 " Tom Rini
2005-08-29 16:11   ` [patch 12/16] KGDBoE I/O driver Tom Rini
2005-08-29 16:11   ` [patch 13/16] Add CFI DWARF2 annotation support Tom Rini
2005-08-29 16:11   ` [patch 14/16] Minor SysRq keyboard bugfix for KGDB Tom Rini
2005-08-29 16:11   ` [patch 15/16] Allow KGDB to work well with loaded modules Tom Rini
2005-08-29 16:12   ` [patch 16/16] Add hardware breakpoint support for i386 Tom Rini
2005-08-29 21:23     ` Andi Kleen
2005-08-31 14:39       ` Tom Rini
2005-08-30  1:06     ` Keith Owens
2005-08-30  7:33 ` [patch 1/3] x86_64: Add a notify_die() call to the "no context" part of do_page_fault() George Anzinger
2005-08-30 14:06   ` Tom Rini
2005-08-30 14:50     ` George Anzinger
2005-08-30 19:53       ` Tom Rini

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=200508311338.52225.bjorn.helgaas@hp.com \
    --to=bjorn.helgaas@hp.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk@arm.linux.org.uk \
    --cc=trini@kernel.crashing.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: 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®