lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <47A8F27D.3030004@web.de>
Date:	Wed, 06 Feb 2008 00:34:21 +0100
From:	Jan Kiszka <jan.kiszka@....de>
To:	Jason Wessel <jason.wessel@...driver.com>,
	Ingo Molnar <mingo@...e.hu>
CC:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	kgdb-bugreport@...ts.sourceforge.net,
	Thomas Gleixner <tglx@...utronix.de>,
	"H. Peter Anvin" <hpa@...or.com>
Subject: [PATCH 2/3] KGDB_8250: consolidate config string

Merge mmio and mmap of the KGDB_8250 config string into mmio (with
mapping semantic). I see no point in current mmio that accepts
pre-mapped addresses from the user. Moreover, this conforms to the
interface of 8250_early.

Signed-off-by: Jan Kiszka <jan.kiszka@....de>

---
 drivers/serial/8250_kgdb.c |   36 ++++++++++++++----------------------
 lib/Kconfig.kgdb           |    2 +-
 2 files changed, 15 insertions(+), 23 deletions(-)

Index: b/drivers/serial/8250_kgdb.c
===================================================================
--- a/drivers/serial/8250_kgdb.c
+++ b/drivers/serial/8250_kgdb.c
@@ -208,7 +208,7 @@ static int kgdb8250_uart_init(void)
 
 /*
  * Syntax for this cmdline option is:
- *   <io|mmio|mmap>,<address>[/<regshift>],<baud rate>,<irq> or
+ *   <io|mmio>,<address>[/<regshift>],<baud rate>,<irq> or
  *   ttyS<n>,<baud rate>
  */
 static int kgdb8250_parse_config(char *str)
@@ -225,13 +225,9 @@ static int kgdb8250_parse_config(char *s
 	if (!strncmp(str, "io", 2)) {
 		kgdb8250_port.iotype = UPIO_PORT;
 		str += 2;
-	} else if (!strncmp(str, "mmap", 4)) {
-		kgdb8250_port.iotype = UPIO_MEM;
-		kgdb8250_port.flags |= UPF_IOREMAP;
-		str += 4;
 	} else if (!strncmp(str, "mmio", 4)) {
 		kgdb8250_port.iotype = UPIO_MEM;
-		kgdb8250_port.flags &= ~UPF_IOREMAP;
+		kgdb8250_port.flags = UPF_IOREMAP;
 		str += 4;
 	} else if (!strncmp(str, "ttyS", 4)) {
 		str += 4;
@@ -246,7 +242,7 @@ static int kgdb8250_parse_config(char *s
 			if (late_init_passed)
 				return err;
 			printk(KERN_WARNING "kgdb8250: ttyS%d init delayed, "
-			       "use io|mmio|mmap syntax for early init.\n",
+			       "use io/mmio syntax for early init.\n",
 			       line);
 			return 0;
 		}
@@ -272,14 +268,9 @@ static int kgdb8250_parse_config(char *s
 
 	if (kgdb8250_port.iotype == UPIO_PORT)
 		kgdb8250_port.iobase = simple_strtoul(str, &str, 16);
-	else {
-		if (kgdb8250_port.flags & UPF_IOREMAP)
-			kgdb8250_port.mapbase =
-				(unsigned long) simple_strtoul(str, &str, 16);
-		else
-			kgdb8250_port.membase =
-				(void *) simple_strtoul(str, &str, 16);
-	}
+	else
+		kgdb8250_port.mapbase =
+			(unsigned long)simple_strtoul(str, &str, 16);
 
 	if (*str == '/') {
 		str++;
@@ -362,11 +353,11 @@ static int kgdb8250_late_init(void)
 	kgdb8250_uart_init();
 
 	/* Request memory/io regions that we use. */
-	if (kgdb8250_port.flags & UPF_IOREMAP) {
+	if (kgdb8250_port.iotype == UPIO_MEM) {
 		if (!request_mem_region(kgdb8250_port.mapbase,
 					8 << kgdb8250_port.regshift, "kgdb"))
 			goto rollback;
-	} else if (kgdb8250_port.iotype == UPIO_PORT) {
+	} else {
 		if (!request_region(kgdb8250_port.iobase,
 				    8 << kgdb8250_port.regshift, "kgdb"))
 			goto rollback;
@@ -423,14 +414,15 @@ static void kgdb8250_cleanup(void)
 
 	fully_initialized = 0;
 
-	if (kgdb8250_port.iotype == UPIO_PORT) {
+	if (kgdb8250_port.iotype == UPIO_MEM) {
+		if (kgdb8250_port.flags & UPF_IOREMAP)
+			iounmap(kgdb8250_port.membase);
+		release_mem_region(kgdb8250_port.mapbase,
+				   8 << kgdb8250_port.regshift);
+	} else {
 		ioport_unmap(ioaddr);
 		release_region(kgdb8250_port.iobase,
 			       8 << kgdb8250_port.regshift);
-	} else if (kgdb8250_port.flags & UPF_IOREMAP) {
-		iounmap(kgdb8250_port.membase);
-		release_mem_region(kgdb8250_port.mapbase,
-				   8 << kgdb8250_port.regshift);
 	}
 
 	/* Give the port back to the 8250 driver. */
Index: b/lib/Kconfig.kgdb
===================================================================
--- a/lib/Kconfig.kgdb
+++ b/lib/Kconfig.kgdb
@@ -43,7 +43,7 @@ config KGDB_8250
 	  passed as kernel or module parameter, respectively.  The
 	  configuration comes in two flavors:
 
-	  <io|mmio|mmap>,<address>[/<regshift>],<baud rate>,<irq>
+	  <io|mmio>,<address>[/<regshift>],<baud rate>,<irq>
 	    or
 	  ttyS<n>,<baud rate>
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ