From owner-svn-src-head@freebsd.org Thu Mar 12 06:45:11 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F1AD8276749; Thu, 12 Mar 2020 06:45:10 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48dK846cq1z3PJ5; Thu, 12 Mar 2020 06:45:08 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A5EEA213AC; Thu, 12 Mar 2020 06:45:08 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 02C6j8A4068981; Thu, 12 Mar 2020 06:45:08 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 02C6j8Yj068980; Thu, 12 Mar 2020 06:45:08 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <202003120645.02C6j8Yj068980@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Thu, 12 Mar 2020 06:45:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r358906 - head/stand/i386/libi386 X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/i386/libi386 X-SVN-Commit-Revision: 358906 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Mar 2020 06:45:11 -0000 Author: tsoome Date: Thu Mar 12 06:45:08 2020 New Revision: 358906 URL: https://svnweb.freebsd.org/changeset/base/358906 Log: test if port does exist via using scratch register The SCR, scratch register was not present on the 8250 and 8250B UART, so we can use to test if we actually do have serial port. We need this test because some systems will get long delays while attempting to write to non-existing port and this will slow down the console IO to extreme. MFC after: 1 week Modified: head/stand/i386/libi386/comconsole.c Modified: head/stand/i386/libi386/comconsole.c ============================================================================== --- head/stand/i386/libi386/comconsole.c Thu Mar 12 03:59:51 2020 (r358905) +++ head/stand/i386/libi386/comconsole.c Thu Mar 12 06:45:08 2020 (r358906) @@ -330,6 +330,16 @@ comc_setup(int speed, int port) if ((comconsole.c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) == 0) return; +#define COMC_TEST 0xbb + /* + * Write byte to scratch register and read it out. + */ + outb(comc_port + com_scr, COMC_TEST); + if (inb(comc_port + com_scr) != COMC_TEST) { + comconsole.c_flags &= ~(C_PRESENTIN | C_PRESENTOUT); + return; + } + outb(comc_port + com_cfcr, CFCR_DLAB | COMC_FMT); outb(comc_port + com_dlbl, COMC_BPS(speed) & 0xff); outb(comc_port + com_dlbh, COMC_BPS(speed) >> 8);