From owner-p4-projects@FreeBSD.ORG Tue Jul 8 22:29:09 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D75FA37B404; Tue, 8 Jul 2003 22:29:08 -0700 (PDT) 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 8F82537B401 for ; Tue, 8 Jul 2003 22:29:08 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1474843FBF for ; Tue, 8 Jul 2003 22:29:08 -0700 (PDT) (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 h695T70U071335 for ; Tue, 8 Jul 2003 22:29:07 -0700 (PDT) (envelope-from marcel@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h695T7np071332 for perforce@freebsd.org; Tue, 8 Jul 2003 22:29:07 -0700 (PDT) Date: Tue, 8 Jul 2003 22:29:07 -0700 (PDT) Message-Id: <200307090529.h695T7np071332@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to marcel@freebsd.org using -f From: Marcel Moolenaar To: Perforce Change Reviews Subject: PERFORCE change 34228 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jul 2003 05:29:09 -0000 http://perforce.freebsd.org/chv.cgi?CH=34228 Change 34228 by marcel@marcel_nfs on 2003/07/08 22:28:10 Add address decoding so that we can actually access the UART. While here, use the device name instead of probing() to determine the UART type. It's much safer. Also, don't compare the bus tag when we compare the bas. Low-level consoles have a fake tag, so they will not match. Comparing only the handle is not sufficient in general, but will do for now. Affected files ... .. //depot/projects/uart/dev/uart/uart_cpu_sparc64.c#2 edit Differences ... ==== //depot/projects/uart/dev/uart/uart_cpu_sparc64.c#2 (text+ko) ==== @@ -32,23 +32,24 @@ #include #include -#include #include #include #include +int OF_decode_addr(phandle_t node, int *space, bus_addr_t *addr); + static struct bus_space_tag bst_store[2]; int uart_cpu_getdev(int devtype, struct uart_devinfo *di) { char buffer[8]; - struct upa_regs regs; phandle_t chosen, consin, consout; ihandle_t stdin, stdout; - int space; + bus_addr_t addr; + int error, space; /* * Get the address of the UART that is selected as the console, if @@ -72,18 +73,14 @@ return (ENXIO); if (strcmp(buffer, "serial")) return (ENXIO); - if (OF_getprop(consout, "reg", ®s, sizeof(regs)) == -1) - return (ENXIO); - /* - * Figure out which of the spaces is most appropriate. - */ - space = UPA_BUS_SPACE; /* XXX yeah, right... */ + error = OF_decode_addr(consout, &space, &addr); + if (error) + return (error); /* Fill in the device info. */ di->bas.bst = &bst_store[devtype]; - di->bas.bsh = sparc64_fake_bustag(space, UPA_REG_PHYS(®s), - di->bas.bst); + di->bas.bsh = sparc64_fake_bustag(space, addr, di->bas.bst); di->bas.regshft = 0; di->bas.rclk = 0; di->baudrate = 9600; @@ -91,22 +88,22 @@ di->stopbits = 1; di->parity = UART_PARITY_NONE; - /* - * Figure out what kind of UART we have. - */ - di->ops = uart_ns8250_ops; - if (uart_probe(di) == 0) + if (OF_getprop(consout, "name", buffer, sizeof(buffer)) == -1) + return (ENXIO); + if (!strcmp(buffer, "se")) { + di->ops = uart_sab82532_ops; return (0); - di->ops = uart_sab82532_ops; - if (uart_probe(di) == 0) + } + if (!strcmp(buffer, "su")) { + di->ops = uart_ns8250_ops; return (0); - + } return (ENXIO); } int uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2) { - - return ((b1->bsh == b2->bsh && b1->bst == b2->bst) ? 1 : 0); + + return ((b1->bsh == b2->bsh) ? 1 : 0); }