From owner-p4-projects Mon Dec 23 19:13:23 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id DFD5B37B405; Mon, 23 Dec 2002 19:13:19 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7494537B401 for ; Mon, 23 Dec 2002 19:13:19 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 204C643EF1 for ; Mon, 23 Dec 2002 19:13:19 -0800 (PST) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id gBO3DIfh095171 for ; Mon, 23 Dec 2002 19:13:18 -0800 (PST) (envelope-from marcel@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id gBO3DIFq095168 for perforce@freebsd.org; Mon, 23 Dec 2002 19:13:18 -0800 (PST) Date: Mon, 23 Dec 2002 19:13:18 -0800 (PST) Message-Id: <200212240313.gBO3DIFq095168@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to marcel@freebsd.org using -f From: Marcel Moolenaar Subject: PERFORCE change 22685 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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