From nobody@FreeBSD.org  Fri Apr  9 05:24:00 2004
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 6B66A16A4CF
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  9 Apr 2004 05:24:00 -0700 (PDT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 2812143D58
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  9 Apr 2004 05:24:00 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.10/8.12.10) with ESMTP id i39CNx72003057
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 9 Apr 2004 05:23:59 -0700 (PDT)
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.10/8.12.10/Submit) id i39CNxBD003044;
	Fri, 9 Apr 2004 05:23:59 -0700 (PDT)
	(envelope-from nobody)
Message-Id: <200404091223.i39CNxBD003044@www.freebsd.org>
Date: Fri, 9 Apr 2004 05:23:59 -0700 (PDT)
From: Milan Obuch <milan@bluegrass.sk>
To: freebsd-gnats-submit@FreeBSD.org
Subject: TC1000 serial ports need enabling
X-Send-Pr-Version: www-2.3

>Number:         65355
>Category:       kern
>Synopsis:       [pci] [patch] TC1000 serial ports need enabling
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 09 05:30:15 PDT 2004
>Closed-Date:    Tue Nov 13 20:51:06 UTC 2012
>Last-Modified:  Tue Nov 13 20:51:06 UTC 2012
>Originator:     Milan Obuch
>Release:        5.2.1-RELEASE
>Organization:
>Environment:
FreeBSD tablet.dino.sk 5.2.1-RELEASE FreeBSD 5.2.1-RELEASE #13: Thu Apr  8 05:56:24 CEST 2004     root@tablet.dino.sk:/usr/src/sys/i386/compile/TABLET  i386
>Description:
Booting FreeBSD on Compaq's TC1000 TabletPC gives
sio0: configured irq 4 not in bitmap of probed irqs 0
sio0: port may not be enabled
sio1: configured irq 3 not in bitmap of probed irqs 0
sio1: port may not be enabled
when serial ports are probed. First serial port is connected to pen digitizer.
This platform uses Via Technologies VT82C686A chip, and PhoenixBIOS does not fully initialize its SuperI/O controller
>How-To-Repeat:
Install FreeBSD on TC1000 and boot
>Fix:
--- sys/dev/pci/isa_pci.c.orig  Sun Aug 24 19:54:15 2003
+++ sys/dev/pci/isa_pci.c       Wed Apr  7 11:07:16 2004
@@ -159,6 +159,7 @@
 {
     struct isab_softc *sc = device_get_softc(dev);
     int error, rid;
+    u_int32_t u;

     /*
      * Attach an ISA bus.  Note that we can only have one ISA bus.
@@ -180,6 +181,30 @@
        if (sc->elcr_res == NULL)
            device_printf(dev, "failed to allocate ELCR resource\n");
         break;
+    case 0x06861106: /* VIA 82C686 */
+       /*
+        * PhoenixBIOS used in Compaq's TabletPC TC1000 does not initialises
+        * chip to enable serial ports, so we handle it ourselves.
+        */
+
+#define CONFIG_INDEX 0x3F0
+#define CONFIG_DATA 0x3F1
+
+        device_printf(dev, "TC1000 Serial1 port enabler\n");
+        u = pci_read_config(dev,0x85,1);
+        pci_write_config(dev, 0x85, u | 2, 1); // enable SuperI/O configuration
+
+        outb(CONFIG_INDEX, 0xE7);
+        outb(CONFIG_DATA, 0xFE); // Serial1 addr set to 0x3F8
+
+        outb(CONFIG_INDEX, 0xE2);
+        u = inb(CONFIG_DATA);
+
+        outb(CONFIG_INDEX, 0xE2);
+        outb(CONFIG_DATA, u | 4); // enable Serial1
+
+        u = pci_read_config(dev,0x85,1);
+        pci_write_config(dev, 0x85, u & ~2, 1); // disable SuperI/O configuration
     }

     return(0);

Maybe some #ifdef kernel option could be used here, say TC1000_SIO_ENABLE_HACK, but I did not bother with this.
>Release-Note:
>Audit-Trail:

From: Milan Obuch <milan@dino.sk>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: kern/65355: [patch] TC1000 serial ports need enabling
Date: Thu, 14 Apr 2005 07:17:06 +0200

 Could someone look into this or suggest some way to polish this patch?
 I did upgrade the box to 5.3-RELEASE, then 5.3-STABLE, now I am going to 
 5.4-RC, the issue is still the same and the same patch works.
 Milan
State-Changed-From-To: open->feedback 
State-Changed-By: eadler 
State-Changed-When: Tue Nov 15 17:27:42 UTC 2011 
State-Changed-Why:  
this patch no longer applies. Is this still a problem in recent versions 
of FreeBSD? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=65355 
State-Changed-From-To: feedback->closed 
State-Changed-By: eadler 
State-Changed-When: Tue Nov 13 20:51:05 UTC 2012 
State-Changed-Why:  
Feedback timeout. Please email me and I will reopen if needed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=65355 
>Unformatted:
