From nobody@FreeBSD.org  Tue Nov  1 16:55:59 2005
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 DB65116A420
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  1 Nov 2005 16:55:59 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 166F843D58
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  1 Nov 2005 16:55:58 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id jA1GtvfZ039413
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 1 Nov 2005 16:55:57 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id jA1Gtv3L039412;
	Tue, 1 Nov 2005 16:55:57 GMT
	(envelope-from nobody)
Message-Id: <200511011655.jA1Gtv3L039412@www.freebsd.org>
Date: Tue, 1 Nov 2005 16:55:57 GMT
From: Martin <nobody@junk.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: enabling AGP on an ASUS K8V-X motherboard locks up/freezes/hangs the machine (Xorg, ATI Radeon 9250 graphics card, 0x5960, 0x1102; 0x1106, 0x0282; 0x1106, 0xb188)
X-Send-Pr-Version: www-2.3

>Number:         88340
>Category:       i386
>Synopsis:       enabling AGP on an ASUS K8V-X motherboard locks up/freezes/hangs the machine (Xorg, ATI Radeon 9250 graphics card, 0x5960, 0x1102; 0x1106, 0x0282; 0x1106, 0xb188)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    jkim
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 01 17:00:29 GMT 2005
>Closed-Date:    Wed Nov 02 01:03:07 GMT 2005
>Last-Modified:  Fri Nov 18 19:30:28 GMT 2005
>Originator:     Martin
>Release:        RELENG_6_0 as of 2005-10-30
>Organization:
>Environment:
FreeBSD marvin.xyzzy 6.0-RC1 FreeBSD 6.0-RC1 #0: Mon Oct 31 09:12:20 CET 2005     root@marvin.xyzzy:/usr/VOL/OBJ/FreeBSD/RELENG_6_0/src/sys/MARVIN  i386

>Description:
Environment:
  - Motherboard ASUS K8V-X SE
  - Graphics (no-name) ATI 9250 (probes as PCI id 1002:5960, with a
    secondary card as 1002:5940 - see below)
  - Running RELENG_6_0 as of 2005-10-30, in i386 mode (not 64 bit)
  - Running XORG-6_8_99_901

Problem:
  - Enabling DRI in the X server freezes/hangs the system

Possible cause:
  - I have a feeling that it is either wrong or not enough to set
    the K8T880Pro CPU to PCI Bridge (1106:0282), as seen from dmesg.boot.
    There still is the Apollo K8HTB CPU to AGP 2.0/3.0 Bridge (1106:b188),
    and it seems that nothing in the kernel sources touches/sets that.
    Could some insightful soul please look into this?

Comments:
  - What is intriguing to me is that a very similar PCI id of 1106:3188
    is also handled in agp_amd64.c, but the (again similar) PCI id of
    1106:3189 is handled in agp_via.c. I am wondering what would happen
    if I just commented out both 1106:0282 and 1106:3188 from agp_amd64.c,
    and added the latter to agp_via.c. But I don't really dare doing this
    for fear of burning up my hardware.
  - On Linux, the system freezes both with the Xorg stuff (but this then
    is only SuSE 9.2, so somewhat dated), and the fglrx proprietary driver.
    I don't know what would possibly happen with the latest Linux sources.
    I looked at the stuff in http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;h=0e6c3a31d3448a820f4f8a95d8f43d6d6d2a9915;hb=1e4c85f97fe26fbd70da12148b3992c0e00361fd;f=drivers/char/agp/amd64-agp.c,
    and it looks a lot more complicated than what we have in FreeBSD.

Output of pciconf -l -v follows:
--------------------------------------------------
hostb0@pci0:0:0:        class=0x060000 card=0x80a31043 chip=0x02821106 rev=0x00 hdr=0x00
    vendor   = 'VIA Technologies Inc'
    device   = 'K8T880Pro CPU to PCI Bridge'
    class    = bridge
    subclass = HOST-PCI
hostb1@pci0:0:1:        class=0x060000 card=0x00000000 chip=0x12821106 rev=0x00 hdr=0x00
    vendor   = 'VIA Technologies Inc'
    device   = 'K8T880Pro CPU to PCI Bridge'
    class    = bridge
    subclass = HOST-PCI
hostb2@pci0:0:2:        class=0x060000 card=0x00000000 chip=0x22821106 rev=0x00 hdr=0x00
    vendor   = 'VIA Technologies Inc'
    device   = 'K8T880Pro CPU to PCI Bridge'
    class    = bridge
    subclass = HOST-PCI
hostb3@pci0:0:3:        class=0x060000 card=0x00000000 chip=0x32821106 rev=0x00 hdr=0x00
    vendor   = 'VIA Technologies Inc'
    device   = 'K8T880Pro CPU to PCI Bridge'
    class    = bridge
    subclass = HOST-PCI
hostb4@pci0:0:4:        class=0x060000 card=0x00000000 chip=0x42821106 rev=0x00 hdr=0x00
    vendor   = 'VIA Technologies Inc'
    device   = 'K8T880Pro CPU to PCI Bridge'
    class    = bridge
    subclass = HOST-PCI
hostb5@pci0:0:7:        class=0x060000 card=0x00000000 chip=0x72821106 rev=0x00 hdr=0x00
    vendor   = 'VIA Technologies Inc'
    device   = 'K8T880Pro CPU to PCI Bridge'
    class    = bridge
    subclass = HOST-PCI
pcib1@pci0:1:0: class=0x060400 card=0x00000080 chip=0xb1881106 rev=0x00 hdr=0x01
    vendor   = 'VIA Technologies Inc'
    device   = 'Apollo K8HTB CPU to AGP 2.0/3.0 Bridge'
    class    = bridge
    subclass = PCI-PCI
atapci0@pci0:15:0:      class=0x010400 card=0x80ed1043 chip=0x31491106 rev=0x80 hdr=0x00
    vendor   = 'VIA Technologies Inc'
    device   = 'VT8237  VT6410 SATA RAID Controller'
    class    = mass storage
    subclass = RAID
atapci1@pci0:15:1:      class=0x01018a card=0x80ed1043 chip=0x05711106 rev=0x06 hdr=0x00
    vendor   = 'VIA Technologies Inc'
    device   = 'VT82xxxx EIDE Controller (All VIA Chipsets)'
    class    = mass storage
    subclass = ATA
uhci0@pci0:16:0:        class=0x0c0300 card=0x80ed1043 chip=0x30381106 rev=0x81 hdr=0x00
    vendor   = 'VIA Technologies Inc'
    device   = 'VT82xxxxx UHCI USB 1.1 Controller (All VIA Chipsets)'
    class    = serial bus
    subclass = USB
uhci1@pci0:16:1:        class=0x0c0300 card=0x80ed1043 chip=0x30381106 rev=0x81 hdr=0x00
    vendor   = 'VIA Technologies Inc'
    device   = 'VT82xxxxx UHCI USB 1.1 Controller (All VIA Chipsets)'
    class    = serial bus
    subclass = USB
uhci2@pci0:16:2:        class=0x0c0300 card=0x80ed1043 chip=0x30381106 rev=0x81 hdr=0x00
    vendor   = 'VIA Technologies Inc'
    device   = 'VT82xxxxx UHCI USB 1.1 Controller (All VIA Chipsets)'
    class    = serial bus
    subclass = USB
uhci3@pci0:16:3:        class=0x0c0300 card=0x80ed1043 chip=0x30381106 rev=0x81 hdr=0x00
    vendor   = 'VIA Technologies Inc'
    device   = 'VT82xxxxx UHCI USB 1.1 Controller (All VIA Chipsets)'
    class    = serial bus
    subclass = USB
ehci0@pci0:16:4:        class=0x0c0320 card=0x80ed1043 chip=0x31041106 rev=0x86 hdr=0x00
    vendor   = 'VIA Technologies Inc'
    device   = 'VT6202 USB 2.0 Enhanced Host Controller'
    class    = serial bus
    subclass = USB
isab0@pci0:17:0:        class=0x060100 card=0x80ed1043 chip=0x32271106 rev=0x00 hdr=0x00
    vendor   = 'VIA Technologies Inc'
    device   = 'VT8237 PCI-to-ISA Bridge'
    class    = bridge
    subclass = PCI-ISA
pcm0@pci0:17:5: class=0x040100 card=0x810d1043 chip=0x30591106 rev=0x60 hdr=0x00
    vendor   = 'VIA Technologies Inc'
    device   = 'VT8233/33A/8235/8237 AC97 Enhanced Audio Controller'
    class    = multimedia
    subclass = audio
vr0@pci0:18:0:  class=0x020000 card=0x80ed1043 chip=0x30651106 rev=0x78 hdr=0x00
    vendor   = 'VIA Technologies Inc'
    device   = 'VT6102 Rhine II PCI Fast Ethernet Controller'
    class    = network
    subclass = ethernet
hostb6@pci0:24:0:       class=0x060000 card=0x00000000 chip=0x11001022 rev=0x00 hdr=0x00
    vendor   = 'Advanced Micro Devices (AMD)'
    device   = 'Athlon 64 / Opteron HyperTransport Technology Configuration'
    class    = bridge
    subclass = HOST-PCI
hostb7@pci0:24:1:       class=0x060000 card=0x00000000 chip=0x11011022 rev=0x00 hdr=0x00
    vendor   = 'Advanced Micro Devices (AMD)'
    device   = 'Athlon 64 / Opteron Address Map'
    class    = bridge
    subclass = HOST-PCI
hostb8@pci0:24:2:       class=0x060000 card=0x00000000 chip=0x11021022 rev=0x00 hdr=0x00
    vendor   = 'Advanced Micro Devices (AMD)'
    device   = 'Athlon 64 / Opteron DRAM Controller'
    class    = bridge
    subclass = HOST-PCI
hostb9@pci0:24:3:       class=0x060000 card=0x00000000 chip=0x11031022 rev=0x00 hdr=0x00
    vendor   = 'Advanced Micro Devices (AMD)'
    device   = 'Athlon 64 / Opteron Miscellaneous Control'
    class    = bridge
    subclass = HOST-PCI
none0@pci1:0:0: class=0x030000 card=0x00011536 chip=0x59601002 rev=0x01 hdr=0x00
    vendor   = 'ATI Technologies Inc'
    device   = 'RV280 Radeon 9200 Pro'
    class    = display
    subclass = VGA
none1@pci1:0:1: class=0x038000 card=0x00001536 chip=0x59401002 rev=0x01 hdr=0x00
    vendor   = 'ATI Technologies Inc'
    device   = 'RV280 Radeon 9200 Pro - Secondary'
    class    = display
--------------------------------------------------

Contents of /var/run/dmesg.boot follows:
--------------------------------------------------
Copyright (c) 1992-2005 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 6.0-RC1 #0: Mon Oct 31 09:12:20 CET 2005
root@marvin.xyzzy:/usr/VOL/OBJ/FreeBSD/RELENG_6_0/src/sys/MARVIN
WARNING: debug.mpsafenet forced to 0 as ipsec requires Giant
WARNING: MPSAFE network stack disabled, expect reduced performance.
ACPI APIC Table: <A M I  OEMAPIC >
Timecounter "i8254" frequency 1193182 Hz quality 0
CPU: AMD Sempron(tm) Processor 2800+ (1602.06-MHz 686-class CPU)
Origin = "AuthenticAMD"  Id = 0x20fc2  Stepping = 2
Features=0x78bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2>
Features2=0x1<SSE3>
AMD Features=0xe2500800<SYSCALL,NX,MMX+,<b25>,LM,3DNow+,3DNow>
real memory  = 536543232 (511 MB)
avail memory = 515715072 (491 MB)
MADT: Forcing active-low polarity and level trigger for SCI
ioapic0 <Version 0.3> irqs 0-23 on motherboard
npx0: [FAST]
npx0: <math processor> on motherboard
npx0: INT 16 interface
acpi0: <A M I OEMXSDT> on motherboard
acpi0: Power Button (fixed)
pci_link0: <ACPI PCI Link LNKA> irq 11 on acpi0
pci_link1: <ACPI PCI Link LNKB> irq 10 on acpi0
pci_link2: <ACPI PCI Link LNKC> irq 5 on acpi0
pci_link3: <ACPI PCI Link LNKD> irq 0 on acpi0
pci_link4: <ACPI PCI Link LNKE> irq 0 on acpi0
pci_link5: <ACPI PCI Link LNKF> irq 0 on acpi0
pci_link6: <ACPI PCI Link LNKG> irq 0 on acpi0
pci_link7: <ACPI PCI Link LNKH> irq 0 on acpi0
Timecounter "ACPI-fast" frequency 3579545 Hz quality 1000
acpi_timer0: <24-bit timer at 3.579545MHz> port 0x808-0x80b on acpi0
cpu0: <ACPI CPU> on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
pci0: <ACPI PCI bus> on pcib0
agp0: <VIA K8T800Pro host to PCI bridge> mem 0xe4000000-0xe7ffffff at device 0.0 on pci0
pcib1: <ACPI PCI-PCI bridge> at device 1.0 on pci0
pci1: <ACPI PCI bus> on pcib1
pci1: <display, VGA> at device 0.0 (no driver attached)
pci1: <display> at device 0.1 (no driver attached)
atapci0: <VIA 6420 SATA150 controller> port 0xd800-0xd807,0xd400-0xd403,0xd000-0xd007,0xc800-0xc803,0xc400-0xc40f,0xc000-0xc0ff irq 20 at device 15.0 on pci0
ata2: <ATA channel 0> on atapci0
ata3: <ATA channel 1> on atapci0
atapci1: <VIA 8237 UDMA133 controller> port 0x1f0-0x1f7,0x3f6,0x170-0x177,0x376,0xfc00-0xfc0f at device 15.1 on pci0
ata0: <ATA channel 0> on atapci1
ata1: <ATA channel 1> on atapci1
uhci0: <VIA 83C572 USB controller> port 0xa800-0xa81f irq 21 at device 16.0 on pci0
uhci0: [GIANT-LOCKED]
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
uhci1: <VIA 83C572 USB controller> port 0xb000-0xb01f irq 21 at device 16.1 on pci0
uhci1: [GIANT-LOCKED]
usb1: <VIA 83C572 USB controller> on uhci1
usb1: USB revision 1.0
uhub1: VIA UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub1: 2 ports with 2 removable, self powered
uhci2: <VIA 83C572 USB controller> port 0xb400-0xb41f irq 21 at device 16.2 on pci0
uhci2: [GIANT-LOCKED]
usb2: <VIA 83C572 USB controller> on uhci2
usb2: 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
uhci3: <VIA 83C572 USB controller> port 0xb800-0xb81f irq 21 at device 16.3 on pci0
uhci3: [GIANT-LOCKED]
usb3: <VIA 83C572 USB controller> on uhci3
usb3: 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
ehci0: <VIA VT6202 USB 2.0 controller> mem 0xfbb00000-0xfbb000ff irq 21 at device 16.4 on pci0
ehci0: [GIANT-LOCKED]
usb4: EHCI version 1.0
usb4: companion controllers, 2 ports each: usb0 usb1 usb2 usb3
usb4: <VIA VT6202 USB 2.0 controller> on ehci0
usb4: USB revision 2.0
uhub4: VIA EHCI root hub, class 9/0, rev 2.00/1.00, addr 1
uhub4: 8 ports with 8 removable, self powered
isab0: <PCI-ISA bridge> at device 17.0 on pci0
isa0: <ISA bus> on isab0
pcm0: <VIA VT8237> port 0xa400-0xa4ff irq 22 at device 17.5 on pci0
pcm0: [GIANT-LOCKED]
pcm0: <Analog Devices AD1888 AC97 Codec>
vr0: <VIA VT6102 Rhine II 10/100BaseTX> port 0xa000-0xa0ff mem 0xfba00000-0xfba000ff irq 23 at device 18.0 on pci0
miibus0: <MII bus> on vr0
rlphy0: <RTL8201L 10/100 media interface> on miibus0
rlphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
vr0: Ethernet address: 00:13:d4:bc:cb:d5
vr0: [GIANT-LOCKED]
acpi_button0: <Power Button> on acpi0
acpi_button1: <Sleep Button> on acpi0
atkbdc0: <Keyboard controller (i8042)> port 0x60,0x64 irq 1 on acpi0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
kbd0 at atkbd0
atkbd0: [GIANT-LOCKED]
psm0: <PS/2 Mouse> irq 12 on atkbdc0
psm0: [GIANT-LOCKED]
psm0: model IntelliMouse Explorer, device ID 4
speaker0: <PC speaker> port 0x61 on acpi0
fdc0: <floppy drive controller (FDE)> port 0x3f0-0x3f5,0x3f7 irq 6 drq 2 on acpi0
fdc0: [FAST]
fd0: <1440-KB 3.5" drive> on fdc0 drive 0
ppc0: <ECP parallel printer port> port 0x378-0x37f,0x778-0x77b irq 7 drq 3 on acpi0
ppc0: SMC-like chipset (ECP/EPP/PS2/NIBBLE) in COMPATIBLE mode
ppc0: FIFO with 16/16/9 bytes threshold
ppbus0: <Parallel port bus> on ppc0
lpt0: <Printer> on ppbus0
lpt0: Interrupt-driven port
sio0: configured irq 4 not in bitmap of probed irqs 0
sio0: port may not be enabled
sio0: <16550A-compatible COM port> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
sio0: type 16550A
pmtimer0 on isa0
orm0: <ISA Option ROM> at iomem 0xc0000-0xccfff on isa0
sc0: <System console> at flags 0x100 on isa0
sc0: VGA <8 virtual consoles, flags=0x300>
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
sio1: configured irq 3 not in bitmap of probed irqs 0
sio1: port may not be enabled
Timecounter "TSC" frequency 1602060382 Hz quality 800
Timecounters tick every 1.000 msec
IPsec: Initialized Security Association Processing.
ad0: 152627MB <SAMSUNG SP1634N UZ100-03> at ata0-master UDMA100
acd0: CDROM <MATSHITA CR-587/7S13> at ata1-master PIO4
cd0 at ata1 bus 0 target 0 lun 0
cd0: <MATSHITA CD-ROM CR-587 7S13> Removable CD-ROM SCSI-0 device 
cd0: 16.000MB/s transfers
cd0: Attempt to query device size failed: NOT READY, Medium not present
Trying to mount root from ufs:/dev/ad0s3a
drm0: <ATI Radeon RV280 9200> port 0xe000-0xe0ff mem 0xe8000000-0xefffffff,0xfbe00000-0xfbe0ffff irq 16 at device 0.0 on pci1
info: [drm] AGP at 0xe4000000 64MB
info: [drm] Initialized radeon 1.16.0 20050311 on minor 0
info: [drm] Loading R200 Microcode
--------------------------------------------------

>How-To-Repeat:
Run the (mostly latest) Xorg on the (mostly) latest RELENG_6_0 and try to enable DRI, using an ASUS K8V-X SE motherboard.
>Fix:
See my suggestions in the full description above.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-i386->jkim 
Responsible-Changed-By: jkim 
Responsible-Changed-When: Tue Nov 1 17:22:38 GMT 2005 
Responsible-Changed-Why:  
I'll take this. 

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

From: Jung-uk Kim <jkim@FreeBSD.org>
To: bug-followup@FreeBSD.org, nobody@junk.com
Cc:  
Subject: Re: i386/88340: enabling AGP on an ASUS K8V-X motherboard locks up/freezes/hangs the machine (Xorg, ATI Radeon 9250 graphics card, 0x5960, 0x1102; 0x1106, 0x0282; 0x1106, 0xb188)
Date: Tue, 1 Nov 2005 19:50:09 -0500

 Have you tried xorg-server or xorg-server-snap from ports?  Did you 
 install dri or dri-devel from ports?  If you have built it from Xorg 
 source, you won't have the correct DRI.  AFAIK, Xorg 6.8.99.901 is 
 not compatible with drm(4) in FreeBSD source tree.
 
 FYI, FreeBSD agp(4) driver is a lot simpler because we don't need some 
 stuff. ;-)
 
 Jung-uk Kim
State-Changed-From-To: open->closed 
State-Changed-By: jkim 
State-Changed-When: Wed Nov 2 01:01:12 GMT 2005 
State-Changed-Why:  
The originator entered an invalid e-mail address.


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

From: Jung-uk Kim <jkim@FreeBSD.org>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: i386/88340: enabling AGP on an ASUS K8V-X motherboard locks up/freezes/hangs the machine (Xorg, ATI Radeon 9250 graphics card, 0x5960, 0x1102; 0x1106, 0x0282; 0x1106, 0xb188)
Date: Fri, 18 Nov 2005 14:26:57 -0500

 The originator reported the latest agp_amd64.c and Xorg 6.8.99.16 with 
 patches from x11-servers/xorg-server-snap fixed his problem.
>Unformatted:
