Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Jan 2012 01:38:26 +0000 (UTC)
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r230517 - projects/pseries/dev/uart
Message-ID:  <201201250138.q0P1cQAm001161@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: nwhitehorn
Date: Wed Jan 25 01:38:25 2012
New Revision: 230517
URL: http://svn.freebsd.org/changeset/base/230517

Log:
  Revert all the changes to uart(4) on this branch. They were a bad idea.

Modified:
  projects/pseries/dev/uart/uart_bus_pci.c
  projects/pseries/dev/uart/uart_core.c
  projects/pseries/dev/uart/uart_cpu_powerpc.c

Modified: projects/pseries/dev/uart/uart_bus_pci.c
==============================================================================
--- projects/pseries/dev/uart/uart_bus_pci.c	Wed Jan 25 00:22:53 2012	(r230516)
+++ projects/pseries/dev/uart/uart_bus_pci.c	Wed Jan 25 01:38:25 2012	(r230517)
@@ -110,6 +110,7 @@ static struct pci_id pci_ns8250_ids[] = 
 	8 * DEFAULT_RCLK },
 { 0x1415, 0x950b, 0xffff, 0, "Oxford Semiconductor OXCB950 Cardbus 16950 UART",
 	0x10, 16384000 },
+{ 0x14e4, 0x4344, 0xffff, 0, "Sony Ericsson GC89 PC Card", 0x10},
 { 0x151f, 0x0000, 0xffff, 0, "TOPIC Semiconductor TP560 56k modem", 0x10 },
 { 0x8086, 0x1c3d, 0xffff, 0, "Intel AMT - KT Controller", 0x10 },
 { 0x8086, 0x3b67, 0xffff, 0, "5 Series/3400 Series Chipset KT Controller",

Modified: projects/pseries/dev/uart/uart_core.c
==============================================================================
--- projects/pseries/dev/uart/uart_core.c	Wed Jan 25 00:22:53 2012	(r230516)
+++ projects/pseries/dev/uart/uart_core.c	Wed Jan 25 01:38:25 2012	(r230517)
@@ -342,6 +342,8 @@ uart_bus_probe(device_t dev, int regshft
 		sc->sc_rres = bus_alloc_resource(dev, sc->sc_rtype,
 		    &sc->sc_rrid, 0, ~0, uart_getrange(sc->sc_class),
 		    RF_ACTIVE);
+		if (sc->sc_rres == NULL)
+			return (ENXIO);
 	}
 
 	/*
@@ -351,10 +353,8 @@ uart_bus_probe(device_t dev, int regshft
 	 * accordingly. In general, you don't want to permanently disrupt
 	 * console I/O.
 	 */
-	if (sc->sc_rres != NULL) {
-		sc->sc_bas.bsh = rman_get_bushandle(sc->sc_rres);
-		sc->sc_bas.bst = rman_get_bustag(sc->sc_rres);
-	}
+	sc->sc_bas.bsh = rman_get_bushandle(sc->sc_rres);
+	sc->sc_bas.bst = rman_get_bustag(sc->sc_rres);
 	sc->sc_bas.chan = chan;
 	sc->sc_bas.regshft = regshft;
 	sc->sc_bas.rclk = (rclk == 0) ? sc->sc_class->uc_rclk : rclk;
@@ -369,9 +369,7 @@ uart_bus_probe(device_t dev, int regshft
 	}
 
 	error = UART_PROBE(sc);
-	if (sc->sc_rres != NULL)
-		bus_release_resource(dev, sc->sc_rtype, sc->sc_rrid,
-		    sc->sc_rres);
+	bus_release_resource(dev, sc->sc_rtype, sc->sc_rrid, sc->sc_rres);
 	return ((error) ? error : BUS_PROBE_DEFAULT);
 }
 
@@ -428,7 +426,8 @@ uart_bus_attach(device_t dev)
 		if (error)
 			error = bus_setup_intr(dev,
 			    sc->sc_ires, INTR_TYPE_TTY | INTR_MPSAFE,
-			    NULL, (driver_intr_t *)uart_intr, sc, &sc->sc_icookie);
+			    NULL, (driver_intr_t *)uart_intr, sc,
+			    &sc->sc_icookie);
 		else
 			sc->sc_fastintr = 1;
 
@@ -438,8 +437,7 @@ uart_bus_attach(device_t dev)
 			    sc->sc_ires);
 			sc->sc_ires = NULL;
 		}
-	}
-	if (sc->sc_ires == NULL) {
+	} else {
 		/* XXX no interrupt resource. Force polled mode. */
 		sc->sc_polled = 1;
 	}

Modified: projects/pseries/dev/uart/uart_cpu_powerpc.c
==============================================================================
--- projects/pseries/dev/uart/uart_cpu_powerpc.c	Wed Jan 25 00:22:53 2012	(r230516)
+++ projects/pseries/dev/uart/uart_cpu_powerpc.c	Wed Jan 25 01:38:25 2012	(r230517)
@@ -42,18 +42,11 @@ __FBSDID("$FreeBSD$");
 bus_space_tag_t uart_bus_space_io = &bs_le_tag;
 bus_space_tag_t uart_bus_space_mem = &bs_le_tag;
 
-extern struct uart_class uart_phyp_class __attribute__((weak));
-
 int
 uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2)
 {
-	if (b1->bst == NULL && b2->bst == NULL)
-		return ((b1->bsh == b2->bsh) ? 1 : 0);
-	else if (b1->bst != NULL && b2->bst != NULL)
-		return ((pmap_kextract(b1->bsh) == pmap_kextract(b2->bsh)) ?
-		    1 : 0);
-	else
-		return (0);
+
+	return ((pmap_kextract(b1->bsh) == pmap_kextract(b2->bsh)) ? 1 : 0);
 }
 
 static int
@@ -61,21 +54,16 @@ ofw_get_uart_console(phandle_t opts, pha
     const char *outputdev)
 {
 	char buf[64];
-	phandle_t input, output;
+	phandle_t input;
 
-	*result = -1;
 	if (OF_getprop(opts, inputdev, buf, sizeof(buf)) == -1)
-		return (ENOENT);
+		return (ENXIO);
 	input = OF_finddevice(buf);
 	if (input == -1)
-		return (ENOENT);
+		return (ENXIO);
 	if (OF_getprop(opts, outputdev, buf, sizeof(buf)) == -1)
-		return (ENOENT);
-	output = OF_finddevice(buf);
-	if (output == -1)
-		return (ENOENT);
-
-	if (input != output) /* UARTs are bidirectional */
+		return (ENXIO);
+	if (OF_finddevice(buf) != input)
 		return (ENXIO);
 
 	*result = input;
@@ -87,42 +75,28 @@ uart_cpu_getdev(int devtype, struct uart
 {
 	char buf[64];
 	struct uart_class *class;
-	ihandle_t stdout;
-	phandle_t input, opts, chosen;
-	cell_t reg;
+	phandle_t input, opts;
 	int error;
 
-	if ((opts = OF_finddevice("/options")) == -1)
+	class = &uart_z8530_class;
+	if (class == NULL)
 		return (ENXIO);
-	if ((chosen = OF_finddevice("/chosen")) == -1)
+
+	if ((opts = OF_finddevice("/options")) == -1)
 		return (ENXIO);
 	switch (devtype) {
 	case UART_DEV_CONSOLE:
-		do {
-			/* Check if OF has an active stdin/stdout */
-			input = -1;
-			if (OF_getprop(chosen, "stdout", &stdout,
-			    sizeof(stdout)) == sizeof(stdout) && stdout != 0)
-				input = OF_instance_to_package(stdout);
-			if (input != -1)
-				break;
-
-			/* Guess what OF would have done had it had such */
-			if (ofw_get_uart_console(opts, &input, "input-device",
-			    "output-device") == 0)
-				break;
-
+		if (ofw_get_uart_console(opts, &input, "input-device",
+		    "output-device")) {
 			/*
 			 * At least some G5 Xserves require that we
 			 * probe input-device-1 as well
 			 */
+	
 			if (ofw_get_uart_console(opts, &input, "input-device-1",
-			    "output-device-1") == 0)
-				break;
-		} while (0);
-
-		if (input == -1)
-			return (ENXIO);
+			    "output-device-1"))
+				return (ENXIO);
+		}
 		break;
 	case UART_DEV_DBGPORT:
 		if (!getenv_string("hw.uart.dbgport", buf, sizeof(buf)))
@@ -150,24 +124,12 @@ uart_cpu_getdev(int devtype, struct uart
 		class = &uart_ns8250_class;
 		di->bas.regshft = 0;
 		di->bas.chan = 0;
-	} else if (strcmp(buf,"vty") == 0) {
-		class = &uart_phyp_class;
-		di->bas.regshft = 0;
-		di->bas.chan = input;
 	} else
 		return (ENXIO);
 
-	if (strcmp(buf,"vty") == 0) {
-		if (OF_getproplen(input, "reg") != sizeof(reg))
-			return (ENXIO);
-		OF_getprop(input, "reg", &reg, sizeof(reg));
-		di->bas.bsh = reg;
-		di->bas.bst = NULL;
-	} else {
-		error = OF_decode_addr(input, 0, &di->bas.bst, &di->bas.bsh);
-		if (error)
-			return (error);
-	}
+	error = OF_decode_addr(input, 0, &di->bas.bst, &di->bas.bsh);
+	if (error)
+		return (error);
 
 	di->ops = uart_getops(class);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201250138.q0P1cQAm001161>