Skip to contentSkip to conversation

Support for HCDP console

PATCH New Khalid Aziz 1 participant 1 message Nov 21, 2002 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Support for HCDP console

Attached patch adds support for HCDP described serial console to 2.5 kernel. This patch applies on top of 2.5.45+Mosberger's 021031 patch.

David, please apply.

--
Khalid

====================================================================
Khalid Aziz Linux and Open Source Lab
(970)898-9214 Hewlett-Packard
[email protected] Fort Collins, CO

"The Linux kernel is subject to relentless development"
- Alessandro Rubini

arch/ia64/kernel/setup.c +1 -1
diff -urN linux-2.5.45/arch/ia64/kernel/setup.c linux-2.5.45-hcdp/arch/ia64/kernel/setup.c
@@ -421,7 +421,7 @@
 #ifdef CONFIG_ACPI_BOOT
 	acpi_boot_init(*cmdline_p);
 #endif
-#ifdef CONFIG_SERIAL_HCDP
+#ifdef CONFIG_SERIAL_8250_HCDP
 	if (efi.hcdp) {
 		void setup_serial_hcdp(void *);
 
drivers/serial/8250.c +27 -9
diff -urN linux-2.5.45/drivers/serial/8250.c linux-2.5.45-hcdp/drivers/serial/8250.c
@@ -1692,8 +1692,27 @@
 		return;
 	first = 0;
 
-	for (i = 0, up = serial8250_ports; i < ARRAY_SIZE(old_serial_port);
-	     i++, up++) {
+	for (i = 0, up = serial8250_ports; i < UART_NR; i++, up++) {
+		/*
+		 * Is this entry available? If not, look for the first 
+		 * available one. If we run out of available entries,
+		 * we are done.
+		 */
+		while ((up->port.iobase != 0) || (up->port.membase != 0)) {
+			if ((++up) > (up+UART_NR))
+				return;
+		}
+
+		/*
+		 * A placeholder entry in old_serial_port will have a 
+		 * membase and iobase of -1. Skip such entries. These ports
+		 * will be added separately.
+		 */
+		while ((old_serial_port[i].port == -1) && 
+				(old_serial_port[i].iomem_base == (unsigned char *) -1)) {
+			if (++i >= UART_NR)
+				return;
+		}
 		up->port.iobase   = old_serial_port[i].port;
 		up->port.irq      = irq_cannonicalize(old_serial_port[i].irq);
 		up->port.uartclk  = old_serial_port[i].baud_base * 16;
@@ -1915,14 +1936,13 @@
 	return __register_serial(req, -1);
 }
 
-int __init early_register_port (struct uart_port *port)
+int __init early_serial_setup(struct uart_port *port)
 {
-	if (port->line >= ARRAY_SIZE(serial8250_ports))
-		return -ENODEV;
-
-	serial8250_isa_init_ports();	/* force ISA defaults */
-	serial8250_ports[port->line].port = *port;
-	serial8250_ports[port->line].port.ops = &serial8250_pops;
+	serial8250_ports[port->line].port        = *port;
+	serial8250_ports[port->line].port.irq    = irq_cannonicalize(port->irq);
+	serial8250_ports[port->line].port.uartclk= port->uartclk * 16;
+	serial8250_ports[port->line].port.flags  = port->flags | UPF_RESOURCES;
+	serial8250_ports[port->line].port.ops     = &serial8250_pops;
 	return 0;
 }
 
drivers/serial/8250_hcdp.c +80 -95

278 lines not on this page · raw message

drivers/serial/8250_hcdp.h +79 -0

79 lines not on this page · raw message

drivers/serial/Kconfig +8 -7
diff -urN linux-2.5.45/drivers/serial/Kconfig linux-2.5.45-hcdp/drivers/serial/Kconfig
@@ -77,6 +77,14 @@
 	  a module, say M here and read <file:Documentation/modules.txt>.
 	  If unsure, say N.
 
+config SERIAL_8250_HCDP
+	bool "8250/16550 device discovery support via EFI HCDP table"
+	depends on IA64
+	---help---
+	  If you wish to make the serial console port described by the EFI 
+	  HCDP table available for use as serial console or general
+	  purpose port, say Y here.
+
 config SERIAL_8250_EXTENDED
 	bool "Extended 8250/16550 serial driver options"
 	depends on SERIAL_8250
@@ -155,13 +163,6 @@
 	  Locate serial ports via the Microsoft proprietary ACPI SPCR/DBGP tables.
 	  This table has been superseded by the EFI HCDP table.
 
-config SERIAL_8250_HCDP
-	tristate "8250/16550 device discovery support via EFI HCDP table"
-	depends on IA64
-	help
-	  Locate console and debug serial ports via the EFI HCDP table.  See
-	  <http://www.dig64.org/specifications/DIG64_HCDPv10a_01.pdf>.
-
 config SERIAL_ANAKIN
 	bool "Anakin serial port support"
 	depends on ARM && ARCH_ANAKIN
drivers/serial/Makefile +1 -1
diff -urN linux-2.5.45/drivers/serial/Makefile linux-2.5.45-hcdp/drivers/serial/Makefile
@@ -10,12 +10,12 @@
 serial-8250-$(CONFIG_PCI) += 8250_pci.o
 serial-8250-$(CONFIG_PNP) += 8250_pnp.o
 serial-8250-$(CONFIG_SERIAL_8250_ACPI) += 8250_acpi.o
-serial-8250-$(CONFIG_SERIAL_8250_HCDP) += 8250_hcdp.o
 obj-$(CONFIG_SERIAL_CORE) += core.o
 obj-$(CONFIG_SERIAL_21285) += 21285.o
 obj-$(CONFIG_SERIAL_8250) += 8250.o $(serial-8250-y)
 obj-$(CONFIG_SERIAL_8250_CS) += 8250_cs.o
 obj-$(CONFIG_SERIAL_8250_ACORN) += 8250_acorn.o
+obj-$(CONFIG_SERIAL_8250_HCDP) += 8250_hcdp.o
 obj-$(CONFIG_SERIAL_ANAKIN) += anakin.o
 obj-$(CONFIG_SERIAL_AMBA) += amba.o
 obj-$(CONFIG_SERIAL_CLPS711X) += clps711x.o
drivers/serial/core.c +2 -2
diff -urN linux-2.5.45/drivers/serial/core.c linux-2.5.45-hcdp/drivers/serial/core.c
@@ -1132,7 +1132,7 @@
 
 	state = info->state;
 
-	DPRINTK("uart_close() called\n");
+	DPRINTK("uart_close(%d) called\n", port->line);
 
 	/*
 	 * This is safe, as long as the BKL exists in
@@ -1990,7 +1990,7 @@
 		printk("I/O 0x%x offset 0x%x", port->iobase, port->hub6);
 		break;
 	case UPIO_MEM:
-		printk("MMIO 0x%lx", port->mapbase);
+		printk("MMIO 0x%p", port->membase);
 		break;
 	}
 	printk(" (irq = %d) is a %s\n", port->irq, uart_type(port));
include/asm-ia64/serial.h +6 -0
diff -urN linux-2.5.45/include/asm-ia64/serial.h linux-2.5.45-hcdp/include/asm-ia64/serial.h
@@ -59,6 +59,11 @@
 	{ 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS },	/* ttyS2 */	\
 	{ 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS },	/* ttyS3 */
 
+/*
+ * placeholder for HCDP described serial console port
+ */
+#define HCDP_SERIAL_PORT_DEFNS			\
+	{0, BASE_BAUD, -1, 0, STD_COM_FLAGS, 0, UPIO_MEM, -1, 0},
 
 #ifdef CONFIG_SERIAL_MANY_PORTS
 #define EXTRA_SERIAL_PORT_DEFNS			\
@@ -117,6 +122,7 @@
 
 #define SERIAL_PORT_DFNS		\
 	STD_SERIAL_PORT_DEFNS		\
+	HCDP_SERIAL_PORT_DEFNS		\
 	EXTRA_SERIAL_PORT_DEFNS		\
 	HUB6_SERIAL_PORT_DFNS
 
include/linux/serial.h +0 -9
diff -urN linux-2.5.45/include/linux/serial.h linux-2.5.45-hcdp/include/linux/serial.h
@@ -182,14 +182,5 @@
 struct uart_port;	/* forward declaration */
 extern int early_register_port(struct uart_port *port);
 
-#ifdef CONFIG_ACPI
-/* tty ports reserved for the ACPI serial console port and debug port */
-#define ACPI_SERIAL_CONSOLE_PORT        0
-#define ACPI_SERIAL_DEBUG_PORT          5
-#endif
-
-/* tty port reserved for the HCDP serial console port */
-#define HCDP_SERIAL_CONSOLE_PORT	4
-
 #endif /* __KERNEL__ */
 #endif /* _LINUX_SERIAL_H */