Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Dec 2002 19:13:18 -0800 (PST)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 22685 for review
Message-ID:  <200212240313.gBO3DIFq095168@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=22685

Change 22685 by marcel@marcel_nfs on 2002/12/23 19:12:24

	Scan the hints for a serial console if we haven't found
	any tables. This provides backward compatibility and is
	what the BigSur kludge was all about. Move COM_CONSOLE
	to siovar.h now that we need it in sio_machdep.c.
	
	Remove COM_FORCECONSOLE. It's broken and doesn't provide
	any functionality we already have in different ways. The
	brokenness is in the fact that it's a global property (ie
	the desire to have a serial console) attached to a non-
	global entity (ie a single UART) that may not be checked
	(an UART with lower unit number is flagged as console) or
	may have conflicting attributes (not a console or disabled).
	Additional brokenness is caused by us not using hints at
	all if we have an HCDP table or a SPCR table.

Affected files ...

.. //depot/projects/ia64/sys/dev/sio/sio.c#25 edit
.. //depot/projects/ia64/sys/dev/sio/siovar.h#11 edit
.. //depot/projects/ia64/sys/ia64/ia64/sio_machdep.c#5 edit

Differences ...

==== //depot/projects/ia64/sys/dev/sio/sio.c#25 (text+ko) ====

@@ -88,8 +88,6 @@
 #define	UNIT_TO_MINOR(unit)	((((unit) & ~0x1fU) << (8 + 3)) \
 				 | ((unit) & 0x1f))
 
-#define	COM_CONSOLE(flags)	((flags) & 0x10)
-#define	COM_FORCECONSOLE(flags)	((flags) & 0x20)
 #define	COM_LLCONSOLE(flags)	((flags) & 0x40)
 #define	COM_DEBUGGER(flags)	((flags) & 0x80)
 #define	COM_LOSESOUTINTS(flags)	((flags) & 0x08)

==== //depot/projects/ia64/sys/dev/sio/siovar.h#11 (text+ko) ====

@@ -60,6 +60,8 @@
 #define SET_IFTYPE(type)	((type) << 24)
 #endif /* PC98 */
 
+#define	COM_CONSOLE(flags)	((flags) & 0x10)
+
 #define	CE_NTYPES		3
 
 typedef u_char	bool_t;		/* boolean */

==== //depot/projects/ia64/sys/ia64/ia64/sio_machdep.c#5 (text+ko) ====

@@ -79,7 +79,9 @@
 {
 	struct dig64_hcdp_table *tbl;
 	struct dig64_hcdp_entry *ent;
-	unsigned int i;
+	unsigned int i, ivar;
+
+	bzero(cd, sizeof(*cd));
 
 	/*
 	 * Use the DIG64 HCDP table if present.
@@ -100,7 +102,6 @@
 			/* XXX - We should have pre-mapped all UC memory. */
 			if (cd->bst == IA64_BUS_SPACE_MEM)
 				(void)sio_map(cd->bsh, 6);
-			cd->regshft = 0;
 			cd->rclk = (ent->pclock) ? ent->pclock : 115200L;
 			cd->rclk <<= 4;		/* rclk = 16 * pclock */
 			cd->baud = ent->baud_high;
@@ -115,20 +116,34 @@
 		/* FALLTHROUGH */
 	}
 
+	/* XXX - Try ACPI SPCR descriptor */
+
 	/*
-	 * XXX - Try alternate methods, such as:
-	 * o  ACPI SPCR descriptor,
-	 * o  hints.
+	 * Scan the hints for backward compatibility. We only try units
+	 * 0 to 3 (inclusive). This covers the ISA legacy where 4 UARTs
+	 * had their resources predefined.
 	 */
-#if 0
-	/* BigSur settings... */
-	cd->bsh = 0x3f8;
-	cd->bst = IA64_BUS_SPACE_IO;
-	cd->regshft = 0;
-	cd->baud = 115200L;
-	cd->rclk = cd->baud << 4;
-	return (0);
-#else
+	for (i = 0; i < 4; i++) {
+		if (resource_int_value("sio", i, "flags", &ivar))
+			continue;
+		if (!COM_CONSOLE(ivar))
+			continue;
+		/* We have a possible console. Make sure it's enabled. */
+		if (resource_int_value("sio", i, "disabled", &ivar) == 0 &&
+		    ivar != 0)
+			continue;
+		/* It's alive. Get the port. */
+		if (resource_int_value("sio", i, "port", &ivar) != 0 ||
+		    ivar == 0)
+			continue;
+		cd->bsh = ivar;
+		cd->bst = IA64_BUS_SPACE_IO;
+		cd->baud = 0;	/* Keep current baud. */
+		cd->databits = 8;
+		cd->stopbits = 1;
+		cd->parity = 0;
+		return (0);
+	}
+
 	return (ENXIO);
-#endif
 }

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




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