From owner-freebsd-current@FreeBSD.ORG Fri Nov 23 14:57:24 2007 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6095616A49E; Fri, 23 Nov 2007 14:57:24 +0000 (UTC) (envelope-from frank@pinky.sax.de) Received: from post.frank-behrens.de (post.frank-behrens.de [82.139.255.138]) by mx1.freebsd.org (Postfix) with ESMTP id A9CE313C46E; Fri, 23 Nov 2007 14:57:23 +0000 (UTC) (envelope-from frank@pinky.sax.de) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pinky.sax.de; h=from:to:date:mime-version:subject:cc:in-reply-to:references:content-type:content-transfer-encoding:content-description; q=dns/txt; s=pinky1; t=1195829842; i=frank@pinky.sax.de; bh=L8wYpUGemttbVrwstI6N1ExA0uIQnnN2XbZV1zERtA8=; b=fiAY7mP1ttKB1Pv4MhhhmBsUu9VsKnMni56m4qAaTr+8QXnm/tDoDaLzeE+Eh6a41hs/boojuhnPTg9Ojbh6Kg== Received: from [192.168.20.32] (sun.behrens [192.168.20.32]) by post.frank-behrens.de (8.14.2/8.14.1) with ESMTP-MSA id lANEv4KU002862; Fri, 23 Nov 2007 15:57:04 +0100 (CET) (envelope-from frank@pinky.sax.de) Message-Id: <200711231457.lANEv4KU002862@post.frank-behrens.de> From: "Frank Behrens" To: freebsd-current@freebsd.org Date: Fri, 23 Nov 2007 15:57:04 +0100 MIME-Version: 1.0 Priority: normal In-reply-to: <200711231020.lANAKvSr003061@post.frank-behrens.de> References: <200711221554.lAMFsRdS002781@post.frank-behrens.de> X-mailer: Pegasus Mail for Windows (4.31, DE v4.31 R1) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Hashcash: 1:24:071123:marcel@freebsd.org::e3akoZW+VbtnPk/i:00lmE X-Hashcash: 1:24:071123:freebsd-current@freebsd.org::cLNZj/cGeJV9YfjP:000000kJ+u Cc: marcel@freebsd.org Subject: Re: Can not boot 7.0-BETA3 with puc X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Nov 2007 14:57:24 -0000 Hi, dear FreeBSD developers! Frank Behrens wrote on 23 Nov 2007 11:20: > 1. The sio(4) does not attach as in RELENG_6 to the ports provided by puc(4) driver. In > RELENG_7 it shows as > > puc0: port 0xdf00-0xdf1f,0xdec0-0xdedf mem 0xfe6f8000-0xfe6f8fff,0xfe6f7000-0xfe6f7fff irq 21 at device 13.0 on pci2 > puc0: Reserved 0x20 bytes for rid 0x10 type 4 at 0xdf00 > ioapic0: routing intpin 21 (PCI IRQ 21) to vector 54 > puc0: [FILTER] > sio0 on puc0 > sio0: type 16550A, console > sio0: [FILTER] > sio1: reserved for low-level i/o > > where RELENG_6 shows > > puc0: port 0xdf00-0xdf1f,0xdec0-0xdedf mem 0xfe6f8000-0xfe6f8fff,0xfe6f7000-0xfe6f7fff irq 21 at device 13.0 on pci2 > sio4: on puc0 > sio4: type 16550A > sio4: unable to activate interrupt in fast mode - using normal mode > sio5: on puc0 > sio5: type 16550A > sio5: unable to activate interrupt in fast mode - using normal mode > .... > sio0: <16550A-compatible COM port> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0 > sio0: type 16550A, console > sio1: reserved for low-level i/o Meanwhile I was able to restore the previous behavior. My RELENG_7 kernel boots with right sio port assignments. :-)) IMHO the reason for the error in 7.0 is, that it calls device_add_child(dev, NULL, -1); The unit is not determined, so the bus subsystem assigns the 1st sio unit. That is 0 and wrong in my case. The patch uses some code from RELENG_6 to determine the 1st free sio unit. I know this is a hack, but you should see, where the problem is to be searched. Regards, Frank =================================================================== RCS file: /data/freebsd/src/sys/dev/puc/puc.c,v retrieving revision 1.50 diff -u -w -p -r1.50 puc.c --- puc.c 6 Jun 2007 22:17:01 -0000 1.50 +++ puc.c 23 Nov 2007 14:17:29 -0000 @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD: src/sys/dev/puc/puc. #include #define PUC_ISRCCNT 5 +#define PUC_DEBUG 1 struct puc_port { struct puc_bar *p_bar; @@ -70,6 +71,31 @@ const char puc_driver_name[] = "puc"; MALLOC_DEFINE(M_PUC, "PUC", "PUC driver"); + +static int +puc_find_free_unit(device_t dev, char *name) +{ + devclass_t dc; + int start; + int unit; + + unit = 0; + start = 0; + while (resource_int_value(name, unit, "port", &start) == 0 && + start > 0) + unit++; + dc = devclass_find(name); + if (dc == NULL) + return (-1); + while (devclass_get_device(dc, unit)) + unit++; +#if PUC_DEBUG + device_printf(dev, "Using %s%d\n", name, unit); +#endif + return (unit); +} + + struct puc_bar * puc_get_bar(struct puc_softc *sc, int rid) { @@ -201,6 +227,13 @@ puc_bfe_attach(device_t dev) bus_space_handle_t bsh; bus_space_tag_t bst; int error, idx; +#if PUC_DEBUG + int oldverbose = bootverbose; + bootverbose = 1; + + device_printf(dev, "puc_bfe_attach\n"); +#endif + sc = device_get_softc(dev); @@ -296,9 +329,16 @@ puc_bfe_attach(device_t dev) goto fail; port->p_rclk = res; - port->p_dev = device_add_child(dev, NULL, -1); + port->p_dev = device_add_child(dev, "sio", puc_find_free_unit(dev, "sio")); if (port->p_dev != NULL) device_set_ivars(port->p_dev, (void *)port); +#if PUC_DEBUG + device_printf(dev, "child attached: nr %d, start %x, offset %x, dev %s\n", + port->p_nr, + start, + ofs, + device_get_nameunit(port->p_dev)); +#endif } error = puc_config(sc, PUC_CFG_GET_ILR, 0, &res); @@ -352,6 +392,10 @@ puc_bfe_attach(device_t dev) if (sc->sc_serdevs == 0UL) bus_teardown_intr(dev, sc->sc_ires, sc->sc_icookie); +#if PUC_DEBUG + bootverbose = oldverbose; +#endif + return (0); fail: @@ -377,6 +421,9 @@ fail: rman_fini(&sc->sc_ioport); free(__DECONST(void *, sc->sc_ioport.rm_descr), M_PUC); free(sc->sc_port, M_PUC); +#if PUC_DEBUG + bootverbose = oldverbose; +#endif return (error); } -- Frank Behrens, Osterwieck, Germany PGP-key 0x5B7C47ED on public servers available.