From nobody@FreeBSD.org  Fri Feb  6 07:26:07 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 219A016A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  6 Feb 2004 07:26:07 -0800 (PST)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 3868B43D58
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  6 Feb 2004 07:25:30 -0800 (PST)
	(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 i16FPTdL010472
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 6 Feb 2004 07:25:29 -0800 (PST)
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.10/8.12.10/Submit) id i16FPTKF010471;
	Fri, 6 Feb 2004 07:25:29 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200402061525.i16FPTKF010471@www.freebsd.org>
Date: Fri, 6 Feb 2004 07:25:29 -0800 (PST)
From: FUJIMOTO Kou <fujimoto@j.dendai.ac.jp>
To: freebsd-gnats-submit@FreeBSD.org
Subject: viapm patch for VT8235
X-Send-Pr-Version: www-2.0

>Number:         62438
>Category:       kern
>Synopsis:       [viapm] [patch] viapm patch for VT8235
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    jhb
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Feb 06 07:30:10 PST 2004
>Closed-Date:    Tue Nov 08 15:59:19 GMT 2005
>Last-Modified:  Tue Nov 08 15:59:19 GMT 2005
>Originator:     FUJIMOTO Kou
>Release:        5.2-RELEASE-p2
>Organization:
Tokyo Denki University
>Environment:
FreeBSD fosters.ddo.jp 5.2-RELEASE-p2 FreeBSD 5.2-RELEASE-p2 #13: Fri Feb  6 22:11:21 JST 2004    root@fosters:/usr/src/sys/i386/compile/FOSTERS  i386

>Description:
      VIA VT8235 southbridge looks like VT8233 in terms of SMBus feature. 
So I hacked sys/pci/viapm.c to recognize VT8235 as if it is VT8233. 
It runs properly except frozen console one reported as PR kern/45574.
I guess the problem isn't due to my patch, but viapm driver itself. 

Following lines are the output of dmesg.
===================================================================
Copyright (c) 1992-2004 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD 5.2-RELEASE-p2 #13: Fri Feb  6 22:11:21 JST 2004
    root@fosters.ddo.jp:/usr/src/sys/i386/compile/FOSTERS
Preloaded elf kernel "/boot/kernel/kernel" at 0xc0877000.
Timecounter "i8254" frequency 1193182 Hz quality 0
CPU: Intel(R) Celeron(TM) CPU                1300MHz (1297.79-MHz 686-class CPU)
  Origin = "GenuineIntel"  Id = 0x6b1  Stepping = 1
  Features=0x383f9ff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PA
T,PSE36,MMX,FXSR,SSE>
real memory  = 503250944 (479 MB)
avail memory = 479174656 (456 MB)
Pentium Pro MTRR support enabled
acpi0: <VT9174 AWRDACPI> on motherboard
pcibios: BIOS version 2.10
Using $PIR table, 5 entries at 0xc00fded0
acpi0: Power Button (fixed)
Timecounter "ACPI-fast" frequency 3579545 Hz quality 1000
acpi_timer0: <24-bit timer at 3.579545MHz> port 0x408-0x40b on acpi0
acpi_cpu0: <CPU> port 0x530-0x537 on acpi0
acpi_button0: <Power Button> on acpi0
pcib0: <ACPI Host-PCI bridge> port 0x500-0x50f,0x400-0x47f,0xcf8-0xcff on acpi0
pci0: <ACPI PCI bus> on pcib0
pcib0: slot 8 INTA is routed to irq 15
pcib0: slot 13 INTA is routed to irq 12
pcib0: slot 16 INTA is routed to irq 15
pcib0: slot 16 INTB is routed to irq 12
pcib0: slot 16 INTC is routed to irq 11
pcib0: slot 16 INTD is routed to irq 5
pcib0: slot 17 INTC is routed to irq 11
pcib0: slot 18 INTA is routed to irq 15
agp0: <VIA Generic host to PCI bridge> mem 0xe0000000-0xe3ffffff at device 0.0 o
n pci0
pcib1: <PCI-PCI bridge> at device 1.0 on pci0
pci1: <PCI bus> on pcib1
pcib0: slot 1 INTA is routed to irq 15
pcib1: slot 0 INTA is routed to irq 15
pci1: <display, VGA> at device 0.0 (no driver attached)
sis0: <NatSemi DP8381[56] 10/100BaseTX> port 0xd000-0xd0ff mem 0xeb000000-0xeb00
0fff irq 15 at device 8.0 on pci0
sis0: Silicon Revision: DP83815D
sis0: Ethernet address: 00:a0:b0:30:9b:76
miibus0: <MII bus> on sis0
ukphy0: <Generic IEEE 802.3u media interface> on miibus0
ukphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
fwohci0: <VIA VT6306> port 0xd400-0xd47f mem 0xeb001000-0xeb0017ff irq 12 at dev
ice 13.0 on pci0
fwohci0: OHCI version 1.0 (ROM=1)
fwohci0: No. of Isochronous channel is 4.
fwohci0: EUI64 00:40:63:00:00:03:4b:7d
fwohci0: Phy 1394a available S400, 2 ports.
fwohci0: Link S400, max_rec 2048 bytes.
firewire0: <IEEE1394(FireWire) bus> on fwohci0
fwe0: <Ethernet over FireWire> on firewire0
if_fwe0: Fake Ethernet address: 02:40:63:03:4b:7d
sbp0: <SBP-2/SCSI over FireWire> on firewire0
fwohci0: Initiate bus reset
fwohci0: BUS reset
fwohci0: node_id=0xc800ffc0, gen=1, CYCLEMASTER mode
firewire0: 1 nodes, maxhop <= 0, cable IRM = 0 (me)
firewire0: bus manager 0 (me)
uhci0: <VIA 83C572 USB controller> port 0xd800-0xd81f irq 15 at device 16.0 on p
ci0
usb0: <VIA 83C572 USB controller> on uhci0
usb0: USB revision 1.0
uhub0: VIA UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 2 ports with 2 removable, self powered
uhub1: Chicony Generic USB Hub, class 9/0, rev 1.10/1.00, addr 2
uhub1: 3 ports with 2 removable, bus powered
ukbd0: Chicony PFU-65 USB Keyboard, rev 1.10/1.00, addr 3, iclass 3/1
kbd0 at ukbd0
ums0: Logitech USB-PS/2 Trackball, rev 1.00/2.10, addr 4, iclass 3/1
ums0: 3 buttons and Z dir.
uhci1: <VIA 83C572 USB controller> port 0xdc00-0xdc1f irq 12 at device 16.1 on p
ci0
usb1: <VIA 83C572 USB controller> on uhci1
usb1: USB revision 1.0
uhub2: VIA UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub2: 2 ports with 2 removable, self powered
uhci2: <VIA 83C572 USB controller> port 0xe000-0xe01f irq 11 at device 16.2 on p
ci0
usb2: <VIA 83C572 USB controller> on uhci2
usb2: USB revision 1.0
uhub3: VIA UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub3: 2 ports with 2 removable, self powered
pci0: <serial bus, USB> at device 16.3 (no driver attached)
viapropm0: SMBus I/O base at 0x500
viapropm0: <VIA VT8233/8235 Power Management Unit> port 0x500-0x50f at device 17
.0 on pci0
viapropm0: SMBus revision code 0x0
smbus0: <System Management Bus> on viapropm0
smb0: <SMBus generic I/O> on smbus0
atapci0: <VIA 8235 UDMA133 controller> port 0xe400-0xe40f at device 17.1 on pci0
ata0: at 0x1f0 irq 14 on atapci0
ata0: [MPSAFE]
ata1: at 0x170 irq 15 on atapci0
ata1: [MPSAFE]
pcm0: <VIA VT8235> port 0xe800-0xe8ff irq 11 at device 17.5 on pci0
pcm0: <ICEnsemble VT1616 AC97 Codec>
vr0: <VIA VT6102 Rhine II 10/100BaseTX> port 0xec00-0xecff mem 0xeb003000-0xeb00
30ff irq 15 at device 18.0 on pci0
vr0: Ethernet address: 00:40:63:ca:a9:18
miibus1: <MII bus> on vr0
ukphy1: <Generic IEEE 802.3u media interface> on miibus1
ukphy1:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
npx0: [FAST]
npx0: <math processor> on motherboard
npx0: INT 16 interface
Timecounter "TSC" frequency 1297791943 Hz quality 800
Timecounters tick every 1.000 msec
ipfw2 initialized, divert enabled, rule-based forwarding enabled, default to den
y, logging unlimited
acpi_cpu: throttling enabled, 2 steps (100% to 50.0%), currently 100.0%
GEOM: create disk ad0 dp=0xc4661660
ad0: 117246MB <Maxtor 4R120L0> [238216/16/63] at ata0-master UDMA133
Mounting root from ufs:/dev/ad0s1a
sis0: Applying short cable fix (reg=f1)
sis0: Applying short cable fix (reg=e8)
sis0: Applying short cable fix (reg=e8)
sis0: Applying short cable fix (reg=e8)

>How-To-Repeat:
      The patch is as follows:

--- ./pci/viapm.c.orig  Sun Feb  1 02:58:38 2004
+++ ./pci/viapm.c       Sun Feb  1 02:59:57 2004
@@ -67,6 +67,7 @@
 #define VIA_686A_PMU_ID                0x30571106
 #define VIA_8233_PMU_ID                0x30741106
 #define        VIA_8233A_PMU_ID        0x31471106
+#define        VIA_8235_PMU_ID         0x31771106

 #define VIAPM_INB(port) \
        ((u_char)bus_space_read_1(viapm->st, viapm->sh, port))
@@ -268,7 +269,8 @@

        case VIA_8233_PMU_ID:
        case VIA_8233A_PMU_ID:
-               desc = "VIA VT8233 Power Management Unit";
+       case VIA_8235_PMU_ID:
+               desc = "VIA VT8233/8235 Power Management Unit";
                viapm->type = VIAPM_TYP_UNKNOWN;
                base_cfgreg = VIAPM_8233_BASE;
                goto viapro;

>Fix:
      I hope PR 45574 will be re-opened.

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: bms 
State-Changed-When: Sat Jul 3 06:24:42 GMT 2004 
State-Changed-Why:  
Do you get the same results if you try using ACPI instead and dropping 
the power management drivers from your kernel? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=62438 

From: FUJIMOTO Kou <fujimoto@j.dendai.ac.jp>
To: Bruce M Simpson <bms@FreeBSD.org>
Cc: freebsd-bugs@FreeBSD.org
Subject: Re: kern/62438: viapm patch for VT8235
Date: Mon, 05 Jul 2004 17:54:05 +0900

 Everytime when I enable acpi function I get the same result,
 while the patch works without any problem when I disable acpi
 (either on boot time or in kernel config).
 
 This workaround is reported on FreeBSD-users-jp ML (in Japanese):
 http://home.jp.freebsd.org/cgi-bin/showmail/FreeBSD-users-jp/78394
 
 In the message above, Ito-san suggests 'isab' (PCI-ISA bridge) is
 not probed with the patch and acpi enabled.
 
 Bruce M Simpson wrote:
 
 > Do you get the same results if you try using ACPI instead and dropping
 > the power management drivers from your kernel?
 
 -- 
 FUJIMOTO Kou: Tokyo Denki University
 
State-Changed-From-To: feedback->open 
State-Changed-By: arved 
State-Changed-When: Sat Aug 28 18:42:47 GMT 2004 
State-Changed-Why:  
feedback arrived. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=62438 

Adding to audit trail:

See discussion in kern/45574 and kern/87363.
State-Changed-From-To: open->patched 
State-Changed-By: jhb 
State-Changed-When: Mon Oct 31 18:43:42 GMT 2005 
State-Changed-Why:  
Patch applied to HEAD, will be MFC'd after 6.0 is out.  Note that I don't 
think adding a new device ID really warrants serious/high. :) 


Responsible-Changed-From-To: freebsd-bugs->jhb 
Responsible-Changed-By: jhb 
Responsible-Changed-When: Mon Oct 31 18:43:42 GMT 2005 
Responsible-Changed-Why:  
Patch applied to HEAD, will be MFC'd after 6.0 is out.  Note that I don't 
think adding a new device ID really warrants serious/high. :) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=62438 
State-Changed-From-To: patched->closed 
State-Changed-By: jhb 
State-Changed-When: Tue Nov 8 15:59:02 GMT 2005 
State-Changed-Why:  
Merged to 5.x and 6.x. 

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