From owner-svn-src-all@FreeBSD.ORG Mon Feb 4 09:43:44 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 372C7D17; Mon, 4 Feb 2013 09:43:44 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-qc0-f172.google.com (mail-qc0-f172.google.com [209.85.216.172]) by mx1.freebsd.org (Postfix) with ESMTP id 93B55810; Mon, 4 Feb 2013 09:43:43 +0000 (UTC) Received: by mail-qc0-f172.google.com with SMTP id b25so2575811qca.17 for ; Mon, 04 Feb 2013 01:43:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=S94FPYgOd9WzTsAQUHiVxjZK2S0WB3ISKEsSB9xnzdo=; b=wT88VWwl7pROJD0U4y1KnSE/rVSH05E+/AZ01l0ciOuhzC/BJPWWVjmLGoJe4a0OIx 4ukbk8iBZaLsrFb5VjaI9iJaUJ3DC1jtbK1a3vI7zHABlUbXS+ljz46p9CqQlP57aF67 N425lld/MhBeRzMgYDdwcn58uUtnoSZ3/kHbdi3KgMzyRAyVta2mQKcbIW+THwKRNCSI b0y6nDQfAZWyiTWq+CmFZVpoR2Xk4pEOoicl2qOper28ykJTJfEbyr/5Arca8+0VTeeh V2wFov6ea0BXNkrAGBiSuYyr6gARt6sNAdTSkp6ops4dQLDEYCPy8Zw7/NwbCLO7xFx5 gBQA== MIME-Version: 1.0 X-Received: by 10.229.180.41 with SMTP id bs41mr4121510qcb.38.1359971016967; Mon, 04 Feb 2013 01:43:36 -0800 (PST) Sender: pluknet@gmail.com Received: by 10.229.105.201 with HTTP; Mon, 4 Feb 2013 01:43:36 -0800 (PST) In-Reply-To: <201301231834.r0NIYLnp006407@svn.freebsd.org> References: <201301231834.r0NIYLnp006407@svn.freebsd.org> Date: Mon, 4 Feb 2013 12:43:36 +0300 X-Google-Sender-Auth: Cl1el2EvG_flZlKGTm2BMgVMux0 Message-ID: Subject: Re: svn commit: r245848 - head/sys/boot/i386/libi386 From: Sergey Kandaurov To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2013 09:43:44 -0000 On 23 January 2013 22:34, John Baldwin wrote: > Author: jhb > Date: Wed Jan 23 18:34:21 2013 > New Revision: 245848 > URL: http://svnweb.freebsd.org/changeset/base/245848 > > Log: > Always update the hw.uart.console hint anytime a change is made to the > comconsole setup. Previously the hint would be set when if you set a > custom port, but it would not be updated if you later set a custom speed. > > Also, leave the hw.uart.console hint mutable so it can be overridden or > unset by the user if needed. > > Reviewed by: kib (earlier version) > MFC after: 1 week Looks like this results in something wrong. I have a serial console at COM2 (uart1), but it chooses uart0 (1016 == 0x3F8), compare .flags and the final hw.uart.console value. hint.uart.0.at="isa" hint.uart.0.irq="4" hint.uart.0.port="0x3F8" hint.uart.1.at="isa" hint.uart.1.flags="0x10" hint.uart.1.irq="3" hint.uart.1.port="0x2F8" hw.uart.console="io:1016,br:9600" Or even: hint.uart.0.at="isa" hint.uart.0.disabled="1" hint.uart.0.irq="4" hint.uart.0.port="0x3F8" hint.uart.1.at="isa" hint.uart.1.flags="0x10" hint.uart.1.irq="3" hint.uart.1.port="0x2F8" hw.uart.console="io:1016,br:9600" > > Modified: > head/sys/boot/i386/libi386/comconsole.c > > Modified: head/sys/boot/i386/libi386/comconsole.c > ============================================================================== > --- head/sys/boot/i386/libi386/comconsole.c Wed Jan 23 18:19:50 2013 (r245847) > +++ head/sys/boot/i386/libi386/comconsole.c Wed Jan 23 18:34:21 2013 (r245848) > @@ -50,7 +50,6 @@ static int comc_init(int arg); > static void comc_putchar(int c); > static int comc_getchar(void); > static int comc_getspeed(void); > -static void set_hw_console_hint(void); > static int comc_ischar(void); > static int comc_parseint(const char *string); > static uint32_t comc_parse_pcidev(const char *string); > @@ -202,27 +201,14 @@ comc_port_set(struct env_var *ev, int fl > } > > if ((comconsole.c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) != 0 && > - comc_port != port) { > + comc_port != port) > comc_setup(comc_curspeed, port); > - set_hw_console_hint(); > - } > > env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); > > return (CMD_OK); > } > > -static void > -set_hw_console_hint(void) > -{ > - char intbuf[64]; > - > - unsetenv("hw.uart.console"); > - sprintf(intbuf, "io:%d,br:%d", comc_port, comc_curspeed); > - env_setenv("hw.uart.console", EV_VOLATILE, intbuf, > - env_noset, env_nounset); > -} > - > /* > * Input: bus:dev:func[:bar]. If bar is not specified, it is 0x10. > * Output: bar[24:16] bus[15:8] dev[7:3] func[2:0] > @@ -288,7 +274,6 @@ comc_pcidev_handle(uint32_t locator) > comc_port_set, env_nounset); > > comc_setup(comc_curspeed, port); > - set_hw_console_hint(); > comc_locator = locator; > > return (CMD_OK); > @@ -318,8 +303,10 @@ static void > comc_setup(int speed, int port) > { > static int TRY_COUNT = 1000000; > + char intbuf[64]; > int tries; > > + unsetenv("hw.uart.console"); > comc_curspeed = speed; > comc_port = port; > > @@ -334,9 +321,11 @@ comc_setup(int speed, int port) > inb(comc_port + com_data); > while (inb(comc_port + com_lsr) & LSR_RXRDY && ++tries < TRY_COUNT); > > - if (tries < TRY_COUNT) > + if (tries < TRY_COUNT) { > comconsole.c_flags |= (C_PRESENTIN | C_PRESENTOUT); > - else > + sprintf(intbuf, "io:%d,br:%d", comc_port, comc_curspeed); > + env_setenv("hw.uart.console", EV_VOLATILE, intbuf, NULL, NULL); > + } else > comconsole.c_flags &= ~(C_PRESENTIN | C_PRESENTOUT); > } > -- wbr, pluknet