Bug 157568

Summary: amdsbwd driver does not attach
Product: Base System Reporter: Tino <tinotom>
Component: kernAssignee: Andriy Gapon <avg>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 8.2-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
dmesg.boot none

Description Tino 2011-06-03 21:10:08 UTC
amdsbwd driver does not attach to wd with the following error (from /var/run/dmesg.boot):

amdsbwd0: <AMD SB600/SB7xx Watchdog Timer> at iomem 0xbafe00-0xbafe03,0xbafe04-0xbafe07 on isa0
amdsbwd0: bus_alloc_resource for ctrl failed device_attach: amdsbwd0 attach returned 6

The mainboard is an E35M1-I deluxe from Asus ( http://www.asus.com/Motherboards/AMD_CPU_on_Board/E35M1I_DELUXE/ )
compile options in make.conf:

CFLAGS=-O -pipe
NOPROFILE=true

        Here's kernel boot:

Copyright (c) 1992-2011 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 is a registered trademark of The FreeBSD Foundation.
FreeBSD 8.2-STABLE #9: Wed Jun  1 22:14:01 CEST 2011
    tinotom@stone:/storage/systembuild/usr/src/sys/STONE amd64
Timecounter "i8254" frequency 1193182 Hz quality 0
CPU: AMD E-350 Processor (1599.97-MHz K8-class CPU)
  Origin = "AuthenticAMD"  Id = 0x500f10  Family = 14  Model = 1  Stepping = 0
  Features=0x178bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2,HTT>
  Features2=0x802209<SSE3,MON,SSSE3,CX16,POPCNT>
  AMD Features=0x2e500800<SYSCALL,NX,MMX+,FFXSR,Page1GB,RDTSCP,LM>
  AMD Features2=0x35ff<LAHF,CMP,SVM,ExtAPIC,CR8,ABM,SSE4A,MAS,Prefetch,IBS,SKINIT,WDT>
  TSC: P-state invariant
real memory  = 8589934592 (8192 MB)
avail memory = 7821377536 (7459 MB)
ACPI APIC Table: <ALASKA A M I>
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
FreeBSD/SMP: 1 package(s) x 2 core(s)
 cpu0 (BSP): APIC ID:  0
 cpu1 (AP): APIC ID:  1
ACPI Warning: Optional field Pm2ControlBlock has zero address or length: 0x0000000000000000/0x1 (20101013/tbfadt-655)
ioapic0: Changing APIC ID to 0
ioapic0 <Version 2.1> irqs 0-23 on motherboard
Cuse4BSD v0.1.14 @ /dev/cuse
kbd1 at kbdmux0
acpi0: <ALASKA A M I> on motherboard
acpi0: [ITHREAD]
ACPI Error: [RAMB] Namespace lookup failure, AE_NOT_FOUND (20101013/psargs-464)
ACPI Exception: AE_NOT_FOUND, Could not execute arguments for [RAMW] (Region) (20101013/nsinit-452)
acpi0: Power Button (fixed)
Timecounter "ACPI-fast" frequency 3579545 Hz quality 1000
acpi_timer0: <32-bit timer at 3.579545MHz> port 0x808-0x80b on acpi0
cpu0: <ACPI CPU> on acpi0
cpu1: <ACPI CPU> on acpi0
acpi_hpet0: <High Precision Event Timer> iomem 0xfed00000-0xfed003ff on acpi0
Timecounter "HPET" frequency 14318180 Hz quality 900
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
pci0: <ACPI PCI bus> on pcib0
vgapci0: <VGA-compatible display> port 0xf000-0xf0ff mem 0xc0000000-0xcfffffff,0xfeb00000-0xfeb3ffff,0xfe700000-0xfe7fffff irq 18 at device 1.0 on pci0
pci0: <multimedia, HDA> at device 1.1 (no driver attached)
pcib1: <ACPI PCI-PCI bridge> irq 16 at device 4.0 on pci0
pci1: <ACPI PCI bus> on pcib1
ahci0: <ATI IXP700 AHCI SATA controller> port 0xf140-0xf147,0xf130-0xf133,0xf120-0xf127,0xf110-0xf113,0xf100-0xf10f mem 0xfeb4b000-0xfeb4b3ff irq 19 at device 17.0 on pci0
ahci0: [ITHREAD]
ahci0: AHCI v1.20 with 6 6Gbps ports, Port Multiplier supported
ahcich0: <AHCI channel> at channel 0 on ahci0
ahcich0: [ITHREAD]
ahcich1: <AHCI channel> at channel 1 on ahci0
ahcich1: [ITHREAD]
ahcich2: <AHCI channel> at channel 2 on ahci0
ahcich2: [ITHREAD]
ahcich3: <AHCI channel> at channel 3 on ahci0
ahcich3: [ITHREAD]
ahcich4: <AHCI channel> at channel 4 on ahci0
ahcich4: [ITHREAD]
ahcich5: <AHCI channel> at channel 5 on ahci0
ahcich5: [ITHREAD]
ohci0: <OHCI (generic) USB controller> mem 0xfeb4a000-0xfeb4afff irq 18 at device 18.0 on pci0
ohci0: [ITHREAD]
usbus0: <OHCI (generic) USB controller> on ohci0
ehci0: <EHCI (generic) USB 2.0 controller> mem 0xfeb49000-0xfeb490ff irq 17 at device 18.2 on pci0
ehci0: [ITHREAD]
usbus1: EHCI version 1.0
usbus1: <EHCI (generic) USB 2.0 controller> on ehci0
ohci1: <OHCI (generic) USB controller> mem 0xfeb48000-0xfeb48fff irq 18 at device 19.0 on pci0
ohci1: [ITHREAD]
usbus2: <OHCI (generic) USB controller> on ohci1
ehci1: <EHCI (generic) USB 2.0 controller> mem 0xfeb47000-0xfeb470ff irq 17 at device 19.2 on pci0
ehci1: [ITHREAD]
usbus3: EHCI version 1.0
usbus3: <EHCI (generic) USB 2.0 controller> on ehci1
pci0: <serial bus, SMBus> at device 20.0 (no driver attached)
isab0: <PCI-ISA bridge> at device 20.3 on pci0
isa0: <ISA bus> on isab0
pcib2: <ACPI PCI-PCI bridge> at device 20.4 on pci0
pci2: <ACPI PCI bus> on pcib2
ohci2: <OHCI (generic) USB controller> mem 0xfeb46000-0xfeb46fff irq 18 at device 20.5 on pci0
ohci2: [ITHREAD]
usbus4: <OHCI (generic) USB controller> on ohci2
pcib3: <ACPI PCI-PCI bridge> at device 21.0 on pci0
pci3: <ACPI PCI bus> on pcib3
ath0: <Atheros 9285> mem 0xfea00000-0xfea0ffff irq 16 at device 0.0 on pci3
ath0: [ITHREAD]
ath0: AR9285 mac 192.2 RF5133 phy 14.0
pcib4: <ACPI PCI-PCI bridge> at device 21.1 on pci0
pci4: <ACPI PCI bus> on pcib4
re0: <RealTek 8168/8111 B/C/CP/D/DP/E PCIe Gigabit Ethernet> port 0xe000-0xe0ff mem 0xd0004000-0xd0004fff,0xd0000000-0xd0003fff irq 17 at device 0.0 on pci4
re0: Using 1 MSI-X message
re0: Chip rev. 0x2c000000
re0: MAC rev. 0x00000000
miibus0: <MII bus> on re0
rgephy0: <RTL8169S/8110S/8211B media interface> PHY 1 on miibus0
rgephy0:  10baseT, 10baseT-FDX, 10baseT-FDX-flow, 100baseTX, 100baseTX-FDX, 100baseTX-FDX-flow, 1000baseT, 1000baseT-master, 1000baseT-FDX, 1000baseT-FDX-master, 1000baseT-FDX-flow, 1000baseT-FDX-flow-master, auto, auto-flow
re0: Ethernet address: f4:6d:04:d9:94:74
re0: [ITHREAD]
pcib5: <ACPI PCI-PCI bridge> at device 21.2 on pci0
pci5: <ACPI PCI bus> on pcib5
xhci0: <XHCI (generic) USB 3.0 controller> mem 0xfe900000-0xfe901fff irq 18 at device 0.0 on pci5
xhci0: [ITHREAD]
xhci0: 32 byte context size.
usbus5 on xhci0
pcib6: <ACPI PCI-PCI bridge> at device 21.3 on pci0
pci6: <ACPI PCI bus> on pcib6
xhci1: <XHCI (generic) USB 3.0 controller> mem 0xfe800000-0xfe801fff irq 19 at device 0.0 on pci6
xhci1: [ITHREAD]
xhci1: 32 byte context size.
usbus6 on xhci1
ohci3: <OHCI (generic) USB controller> mem 0xfeb45000-0xfeb45fff irq 18 at device 22.0 on pci0
ohci3: [ITHREAD]
usbus7: <OHCI (generic) USB controller> on ohci3
ehci2: <EHCI (generic) USB 2.0 controller> mem 0xfeb44000-0xfeb440ff irq 17 at device 22.2 on pci0
ehci2: [ITHREAD]
usbus8: EHCI version 1.0
usbus8: <EHCI (generic) USB 2.0 controller> on ehci2
amdtemp0: <AMD K8 Thermal Sensors> on hostb4
acpi_button0: <Power Button> on acpi0
atrtc0: <AT realtime clock> port 0x70-0x71 irq 8 on acpi0
uart0: <16550 or compatible> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
uart0: [FILTER]
amdsbwd0: <AMD SB600/SB7xx Watchdog Timer> at iomem 0xbafe00-0xbafe03,0xbafe04-0xbafe07 on isa0
amdsbwd0: bus_alloc_resource for ctrl failed
device_attach: amdsbwd0 attach returned 6
sc0: <System console> at flags 0x100 on isa0
sc0: VGA <16 virtual consoles, flags=0x300>
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
atkbdc0: <Keyboard controller (i8042)> at port 0x60,0x64 on isa0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
kbd0 at atkbd0
atkbd0: [GIANT-LOCKED]
atkbd0: [ITHREAD]
hwpstate0: <Cool`n'Quiet 2.0> on cpu0
ZFS filesystem version 4
ZFS storage pool version 15
Timecounters tick every 1.000 msec
ipfw2 (+ipv6) initialized, divert enabled, nat loadable, rule-based forwarding disabled, default to accept, logging disabled
usbus0: 12Mbps Full Speed USB v1.0
usbus1: 480Mbps High Speed USB v2.0
usbus2: 12Mbps Full Speed USB v1.0
usbus3: 480Mbps High Speed USB v2.0
usbus4: 12Mbps Full Speed USB v1.0
usbus5: 5.0Gbps Super Speed USB v3.0
usbus6: 5.0Gbps Super Speed USB v3.0
usbus7: 12Mbps Full Speed USB v1.0
usbus8: 480Mbps High Speed USB v2.0
ugen0.1: <ATI> at usbus0
uhub0: <ATI OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus0
ugen1.1: <ATI> at usbus1
uhub1: <ATI EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus1
ugen2.1: <ATI> at usbus2
uhub2: <ATI OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus2
ugen3.1: <ATI> at usbus3
uhub3: <ATI EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus3
ugen4.1: <ATI> at usbus4
uhub4: <ATI OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus4
ugen5.1: <0x1033> at usbus5
uhub5: <0x1033 XHCI root HUB, class 9/0, rev 3.00/1.00, addr 1> on usbus5
ugen6.1: <0x1033> at usbus6
uhub6: <0x1033 XHCI root HUB, class 9/0, rev 3.00/1.00, addr 1> on usbus6
ugen7.1: <ATI> at usbus7
uhub7: <ATI OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus7
ugen8.1: <ATI> at usbus8
uhub8: <ATI EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus8
ada0 at ahcich1 bus 0 scbus1 target 0 lun 0
ada0: <ST32000542AS CC34> ATA-8 SATA 2.x device
ada0: 300.000MB/s transfers (SATA 2.x, UDMA6, PIO 8192bytes)
ada0: Command Queueing enabled
ada0: 1907729MB (3907029168 512 byte sectors: 16H 63S/T 16383C)
ada1 at ahcich2 bus 0 scbus2 target 0 lun 0
ada1: <ST31500541AS CC34> ATA-8 SATA 2.x device
ada1: 300.000MB/s transfers (SATA 2.x, UDMA6, PIO 8192bytes)
ada1: Command Queueing enabled
ada1: 1430799MB (2930277168 512 byte sectors: 16H 63S/T 16383C)
ada2 at ahcich4 bus 0 scbus4 target 0 lun 0
ada2: <WDC WD20EARS-00MVWB0 51.0AB51> ATA-8 SATA 2.x device
ada2: 300.000MB/s transfers (SATA 2.x, UDMA6, PIO 8192bytes)
ada2: Command Queueing enabled
ada2: 1907729MB (3907029168 512 byte sectors: 16H 63S/T 16383C)
SMP: AP CPU #1 Launched!
uhub4: 2 ports with 2 removable, self powered
uhub7: 4 ports with 4 removable, self powered
uhub0: 5 ports with 5 removable, self powered
uhub2: 5 ports with 5 removable, self powered
uhub5: 4 ports with 4 removable, self powered
uhub6: 4 ports with 4 removable, self powered
Root mount waiting for: usbus8 usbus5 usbus3 usbus1
ugen5.2: <American Power Conversion> at usbus5
uhub8: 4 ports with 4 removable, self powered
uhub1: 5 ports with 5 removable, self powered
uhub3: 5 ports with 5 removable, self powered
Root mount waiting for: usbus8 usbus1
Trying to mount root from zfs:zfs/root
ugen7.2: <vendor 0x0cf3> at usbus7
ugen0.2: <ADMtek> at usbus0
aue0: <ADMtek USB To LAN Converter, rev 1.10/2.01, addr 2> on usbus0
miibus1: <MII bus> on aue0
ukphy0: <Generic IEEE 802.3u media interface> PHY 1 on miibus1
ukphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
ue0: <USB Ethernet> on aue0
ue0: Ethernet address: 00:60:6e:00:05:dc
wlan0: Ethernet address: e0:b9:a2:7f:dc:1e

        Here's the output of pciconf -lv:

hostb0@pci0:0:0:0:      class=0x060000 card=0x84a51043 chip=0x15101022 rev=0x00 hdr=0x00
    vendor     = 'Advanced Micro Devices (AMD)'
    class      = bridge
    subclass   = HOST-PCI
vgapci0@pci0:0:1:0:     class=0x030000 card=0x84a51043 chip=0x98021002 rev=0x00 hdr=0x00
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    class      = display
    subclass   = VGA
none0@pci0:0:1:1:       class=0x040300 card=0x84a51043 chip=0x13141002 rev=0x00 hdr=0x00
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    class      = multimedia
    subclass   = HDA
pcib1@pci0:0:4:0:       class=0x060400 card=0x12341022 chip=0x15121022 rev=0x00 hdr=0x01
    vendor     = 'Advanced Micro Devices (AMD)'
    class      = bridge
    subclass   = PCI-PCI
ahci0@pci0:0:17:0:      class=0x010601 card=0x84961043 chip=0x43911002 rev=0x40 hdr=0x00
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'SB700 SATA Controller [AHCI mode]'
    class      = mass storage
    subclass   = SATA
ohci0@pci0:0:18:0:      class=0x0c0310 card=0x84961043 chip=0x43971002 rev=0x00 hdr=0x00
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'SB700 USB OHCI0 Controller'
    class      = serial bus
    subclass   = USB
ehci0@pci0:0:18:2:      class=0x0c0320 card=0x84961043 chip=0x43961002 rev=0x00 hdr=0x00
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'SB700 USB EHCI Controller'
    class      = serial bus
    subclass   = USB
ohci1@pci0:0:19:0:      class=0x0c0310 card=0x84961043 chip=0x43971002 rev=0x00 hdr=0x00
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'SB700 USB OHCI0 Controller'
    class      = serial bus
    subclass   = USB
ehci1@pci0:0:19:2:      class=0x0c0320 card=0x84961043 chip=0x43961002 rev=0x00 hdr=0x00
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'SB700 USB EHCI Controller'
    class      = serial bus
    subclass   = USB
none1@pci0:0:20:0:      class=0x0c0500 card=0x84961043 chip=0x43851002 rev=0x42 hdr=0x00
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'ATI SMBus (ATI RD600/RS600)'
    class      = serial bus
    subclass   = SMBus
isab0@pci0:0:20:3:      class=0x060100 card=0x84961043 chip=0x439d1002 rev=0x40 hdr=0x00
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'SB700 LPC host controller'
    class      = bridge
    subclass   = PCI-ISA
pcib2@pci0:0:20:4:      class=0x060401 card=0x00000000 chip=0x43841002 rev=0x40 hdr=0x01
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'IXP SB600 PCI to PCI Bridge'
    class      = bridge
    subclass   = PCI-PCI
ohci2@pci0:0:20:5:      class=0x0c0310 card=0x84961043 chip=0x43991002 rev=0x00 hdr=0x00
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'SB700 USB OHCI2 Controller'
    class      = serial bus
    subclass   = USB
pcib3@pci0:0:21:0:      class=0x060400 card=0x00001002 chip=0x43a01002 rev=0x00 hdr=0x01
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    class      = bridge
    subclass   = PCI-PCI
pcib4@pci0:0:21:1:      class=0x060400 card=0x00001002 chip=0x43a11002 rev=0x00 hdr=0x01
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    class      = bridge
    subclass   = PCI-PCI
pcib5@pci0:0:21:2:      class=0x060400 card=0x00001002 chip=0x43a21002 rev=0x00 hdr=0x01
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    class      = bridge
    subclass   = PCI-PCI
pcib6@pci0:0:21:3:      class=0x060400 card=0x00001002 chip=0x43a31002 rev=0x00 hdr=0x01
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    class      = bridge
    subclass   = PCI-PCI
ohci3@pci0:0:22:0:      class=0x0c0310 card=0x84961043 chip=0x43971002 rev=0x00 hdr=0x00
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'SB700 USB OHCI0 Controller'
    class      = serial bus
    subclass   = USB
ehci2@pci0:0:22:2:      class=0x0c0320 card=0x84961043 chip=0x43961002 rev=0x00 hdr=0x00
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'SB700 USB EHCI Controller'
    class      = serial bus
    subclass   = USB
hostb1@pci0:0:24:0:     class=0x060000 card=0x00000000 chip=0x17001022 rev=0x43 hdr=0x00
    vendor     = 'Advanced Micro Devices (AMD)'
    class      = bridge
    subclass   = HOST-PCI
hostb2@pci0:0:24:1:     class=0x060000 card=0x00000000 chip=0x17011022 rev=0x00 hdr=0x00
    vendor     = 'Advanced Micro Devices (AMD)'
    class      = bridge
    subclass   = HOST-PCI
hostb3@pci0:0:24:2:     class=0x060000 card=0x00000000 chip=0x17021022 rev=0x00 hdr=0x00
    vendor     = 'Advanced Micro Devices (AMD)'
    class      = bridge
    subclass   = HOST-PCI
hostb4@pci0:0:24:3:     class=0x060000 card=0x00000000 chip=0x17031022 rev=0x00 hdr=0x00
    vendor     = 'Advanced Micro Devices (AMD)'
    class      = bridge
    subclass   = HOST-PCI
hostb5@pci0:0:24:4:     class=0x060000 card=0x00000000 chip=0x17041022 rev=0x00 hdr=0x00
    vendor     = 'Advanced Micro Devices (AMD)'
    class      = bridge
    subclass   = HOST-PCI
hostb6@pci0:0:24:5:     class=0x060000 card=0x00000000 chip=0x17181022 rev=0x00 hdr=0x00
    vendor     = 'Advanced Micro Devices (AMD)'
    class      = bridge
    subclass   = HOST-PCI
hostb7@pci0:0:24:6:     class=0x060000 card=0x00000000 chip=0x17161022 rev=0x00 hdr=0x00
    vendor     = 'Advanced Micro Devices (AMD)'
    class      = bridge
    subclass   = HOST-PCI
hostb8@pci0:0:24:7:     class=0x060000 card=0x00000000 chip=0x17191022 rev=0x00 hdr=0x00
    vendor     = 'Advanced Micro Devices (AMD)'
    class      = bridge
    subclass   = HOST-PCI
ath0@pci0:3:0:0:        class=0x028000 card=0x1d891a3b chip=0x002b168c rev=0x01 hdr=0x00
    vendor     = 'Atheros Communications Inc.'
    device     = 'Atheros AR9285 Wireless LAN 802.11 a/b/g/n Controller (AR928x)'
    class      = network
re0@pci0:4:0:0: class=0x020000 card=0x84321043 chip=0x816810ec rev=0x06 hdr=0x00
    vendor     = 'Realtek Semiconductor'
    device     = 'Gigabit Ethernet NIC(NDIS 6.0) (RTL8168/8111/8111c)'
    class      = network
    subclass   = ethernet
xhci0@pci0:5:0:0:       class=0x0c0330 card=0x84131043 chip=0x01941033 rev=0x03 hdr=0x00
    vendor     = 'NEC Electronics Hong Kong'
    class      = serial bus
    subclass   = USB
xhci1@pci0:6:0:0:       class=0x0c0330 card=0x84131043 chip=0x01941033 rev=0x03 hdr=0x00
    vendor     = 'NEC Electronics Hong Kong'
    class      = serial bus
    subclass   = USB

Fix: 

No fix found
How-To-Repeat: It happens on every boot. The driver does not attach at all.
Comment 1 Andriy Gapon freebsd_committer freebsd_triage 2011-06-04 08:04:29 UTC
Responsible Changed
From-To: freebsd-bugs->avg

Take.
Comment 2 Andriy Gapon freebsd_committer freebsd_triage 2011-06-04 08:08:50 UTC
Can you please provide a verbose dmesg?
Just select verbose boot in the loader menu.

-- 
Andriy Gapon
Comment 3 Tino 2011-06-04 09:18:32 UTC
On 6/4/11 9:08 AM, Andriy Gapon wrote:
> 
> Can you please provide a verbose dmesg?
> Just select verbose boot in the loader menu.
> 
Hi,

thank you for your interest.
Please find attached the verbose /var/run/dmesg.boot
Thank you,

--
Tino
Comment 4 Andriy Gapon freebsd_committer freebsd_triage 2011-06-04 10:45:16 UTC
on 04/06/2011 11:18 Tino said the following:
> On 6/4/11 9:08 AM, Andriy Gapon wrote:
>>
>> Can you please provide a verbose dmesg?
>> Just select verbose boot in the loader menu.
>>
> Hi,
> 
> thank you for your interest.
> Please find attached the verbose /var/run/dmesg.boot

Thanks.  It seems like I've rushed a little bit and haven't noticed what kind of
system you have.  This is a new chipset for which there is no public
specifications available yet.  So I don't know if it has a watchdog and if it
has the same interface.  So I am not sure if amdsbwd is supposed to work for
you.  Address reported here looks strange/unexpected:
amdsbwd0: memory base address = 0x00bafe00

This chipset has the same device ID for SMBus PCI device, but a different
revision.  Yours:
none1@pci0:0:20:0: class=0x0c0500 card=0x84961043 chip=0x43851002 rev=0x42 hdr=0x00
Mine:
intsmb0@pci0:0:20:0:    class=0x0c0500 card=0x43851458 chip=0x43851002 rev=0x3a
hdr=0x00

Likely I will have to limit revision numbers which amdsbwd supports.
But until AMD publishes the specifications I am afraid I can't provide amdsbwd
support for you.

-- 
Andriy Gapon
Comment 5 Andriy Gapon freebsd_committer freebsd_triage 2011-06-04 11:00:46 UTC
on 04/06/2011 12:45 Andriy Gapon said the following:
> Likely I will have to limit revision numbers which amdsbwd supports.
> But until AMD publishes the specifications I am afraid I can't provide amdsbwd
> support for you.

But, just in case, could you please report the following?
$ pciconf -r pci0:0:20:0 0x00:0xfc

-- 
Andriy Gapon
Comment 6 Tino 2011-06-04 11:32:13 UTC
On 6/4/11 12:00 PM, Andriy Gapon wrote:
> on 04/06/2011 12:45 Andriy Gapon said the following:
>> Likely I will have to limit revision numbers which amdsbwd supports.
>> But until AMD publishes the specifications I am afraid I can't provide amdsbwd
>> support for you.
> 
> But, just in case, could you please report the following?
> $ pciconf -r pci0:0:20:0 0x00:0xfc
> 
This is the output of pciconf -r pci0:0:20:0 0x00:0xfc :

43851002 02200403 0c050042 00800000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 84961043
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000

please do not hesitate to contact me for any further tries I can do.
Thank you very much,
best regards,

--
Tino
Comment 7 Garrett Wollman 2011-06-04 22:07:48 UTC
tinotom@gmail.com writes:

>amdsbwd driver does not attach to wd with the following error (from
>/var/run/dmesg.boot):
>
>amdsbwd0: <AMD SB600/SB7xx Watchdog Timer> at iomem
>0xbafe00-0xbafe03,0xbafe04-0xbafe07 on isa0
>amdsbwd0: bus_alloc_resource for ctrl failed device_attach: amdsbwd0
>attach returned 6

Identical symptoms here:

amdsbwd0: <AMD SB600/SB7xx Watchdog Timer> at iomem 0xb8fe00-0xb8fe03,0xb8fe04-0xb8fe07 on isa0
amdsbwd0: bus_alloc_resource for ctrl failed
device_attach: amdsbwd0 attach returned 6

The processor is reported as:

CPU: AMD Athlon(tm) II X2 250 Processor (3000.18-MHz K8-class CPU)
  Origin = "AuthenticAMD"  Id = 0x100f62  Family = 10  Model = 6  Stepping = 2
  Features=0x178bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,C

The motherboard is an MSI 890FXA-GD70.

-GAWollman
Comment 8 Andriy Gapon 2011-06-05 11:02:05 UTC
Also, could you please check with acpidump -dt if your system provides WDDT table?

-- 
Andriy Gapon
Comment 9 Garrett Wollman 2011-06-05 18:16:48 UTC
<<On Sun, 05 Jun 2011 10:47:08 +0300, Andriy Gapon <avg@FreeBSD.org> said:

>> The motherboard is an MSI 890FXA-GD70.

> Can you please add pciconf -lv output to the PR?

hostb0@pci0:0:0:0:	class=0x060000 card=0x5a111002 chip=0x5a111002 rev=0x02 hdr=0x00
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'RD890 single slot GFX Hydra'
    class      = bridge
    subclass   = HOST-PCI
pcib1@pci0:0:2:0:	class=0x060400 card=0x5a111002 chip=0x5a161002 rev=0x00 hdr=0x01
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'RD890 PCI to PCI bridge (PCIe gpp port B)'
    class      = bridge
    subclass   = PCI-PCI
pcib2@pci0:0:3:0:	class=0x060400 card=0x5a111002 chip=0x5a171002 rev=0x00 hdr=0x01
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'RD890 PCI to PCI bridge (PCIe gpp port C)'
    class      = bridge
    subclass   = PCI-PCI
pcib3@pci0:0:4:0:	class=0x060400 card=0x5a111002 chip=0x5a181002 rev=0x00 hdr=0x01
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'RD890 PCI to PCI bridge (PCIe gpp port D)'
    class      = bridge
    subclass   = PCI-PCI
pcib4@pci0:0:5:0:	class=0x060400 card=0x5a111002 chip=0x5a191002 rev=0x00 hdr=0x01
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'RD890 PCI to PCI bridge (PCIe gpp port E)'
    class      = bridge
    subclass   = PCI-PCI
pcib5@pci0:0:6:0:	class=0x060400 card=0x5a111002 chip=0x5a1a1002 rev=0x00 hdr=0x01
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'RD890 PCI to PCI bridge (PCIe gpp port F)'
    class      = bridge
    subclass   = PCI-PCI
pcib6@pci0:0:9:0:	class=0x060400 card=0x5a111002 chip=0x5a1c1002 rev=0x00 hdr=0x01
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'RD890 PCI to PCI bridge (PCIe gpp port H)'
    class      = bridge
    subclass   = PCI-PCI
ahci0@pci0:0:17:0:	class=0x010601 card=0x76401462 chip=0x43911002 rev=0x40 hdr=0x00
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'SB700 SATA Controller [AHCI mode]'
    class      = mass storage
    subclass   = SATA
ohci0@pci0:0:18:0:	class=0x0c0310 card=0x76401462 chip=0x43971002 rev=0x00 hdr=0x00
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'SB700 USB OHCI0 Controller'
    class      = serial bus
    subclass   = USB
ehci0@pci0:0:18:2:	class=0x0c0320 card=0x76401462 chip=0x43961002 rev=0x00 hdr=0x00
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'SB700 USB EHCI Controller'
    class      = serial bus
    subclass   = USB
ohci1@pci0:0:19:0:	class=0x0c0310 card=0x76401462 chip=0x43971002 rev=0x00 hdr=0x00
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'SB700 USB OHCI0 Controller'
    class      = serial bus
    subclass   = USB
ehci1@pci0:0:19:2:	class=0x0c0320 card=0x76401462 chip=0x43961002 rev=0x00 hdr=0x00
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'SB700 USB EHCI Controller'
    class      = serial bus
    subclass   = USB
none0@pci0:0:20:0:	class=0x0c0500 card=0x00000000 chip=0x43851002 rev=0x41 hdr=0x00
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'ATI SMBus (ATI RD600/RS600)'
    class      = serial bus
    subclass   = SMBus
hdac1@pci0:0:20:2:	class=0x040300 card=0x76401462 chip=0x43831002 rev=0x40 hdr=0x00
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'IXP SB600 High Definition Audio Controller'
    class      = multimedia
    subclass   = HDA
isab0@pci0:0:20:3:	class=0x060100 card=0x76401462 chip=0x439d1002 rev=0x40 hdr=0x00
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'SB700 LPC host controller'
    class      = bridge
    subclass   = PCI-ISA
pcib7@pci0:0:20:4:	class=0x060401 card=0x00000000 chip=0x43841002 rev=0x40 hdr=0x01
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'IXP SB600 PCI to PCI Bridge'
    class      = bridge
    subclass   = PCI-PCI
ohci2@pci0:0:20:5:	class=0x0c0310 card=0x76401462 chip=0x43991002 rev=0x00 hdr=0x00
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'SB700 USB OHCI2 Controller'
    class      = serial bus
    subclass   = USB
pcib8@pci0:0:21:0:	class=0x060400 card=0x00001002 chip=0x43a01002 rev=0x00 hdr=0x01
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    class      = bridge
    subclass   = PCI-PCI
pcib9@pci0:0:21:1:	class=0x060400 card=0x00001002 chip=0x43a11002 rev=0x00 hdr=0x01
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    class      = bridge
    subclass   = PCI-PCI
ohci3@pci0:0:22:0:	class=0x0c0310 card=0x76401462 chip=0x43971002 rev=0x00 hdr=0x00
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'SB700 USB OHCI0 Controller'
    class      = serial bus
    subclass   = USB
ehci2@pci0:0:22:2:	class=0x0c0320 card=0x76401462 chip=0x43961002 rev=0x00 hdr=0x00
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'SB700 USB EHCI Controller'
    class      = serial bus
    subclass   = USB
hostb1@pci0:0:24:0:	class=0x060000 card=0x00000000 chip=0x12001022 rev=0x00 hdr=0x00
    vendor     = 'Advanced Micro Devices (AMD)'
    device     = '(Family 10h) Athlon64/Opteron/Sempron HyperTransport Technology Configuration'
    class      = bridge
    subclass   = HOST-PCI
hostb2@pci0:0:24:1:	class=0x060000 card=0x00000000 chip=0x12011022 rev=0x00 hdr=0x00
    vendor     = 'Advanced Micro Devices (AMD)'
    device     = '(Family 10h) Athlon64/Opteron/Sempron Address Map'
    class      = bridge
    subclass   = HOST-PCI
hostb3@pci0:0:24:2:	class=0x060000 card=0x00000000 chip=0x12021022 rev=0x00 hdr=0x00
    vendor     = 'Advanced Micro Devices (AMD)'
    device     = '(Family 10h) Athlon64/Opteron/Sempron DRAM Controller'
    class      = bridge
    subclass   = HOST-PCI
hostb4@pci0:0:24:3:	class=0x060000 card=0x00000000 chip=0x12031022 rev=0x00 hdr=0x00
    vendor     = 'Advanced Micro Devices (AMD)'
    device     = '(Family 10h) Athlon64/Opteron/Sempron Miscellaneous Control'
    class      = bridge
    subclass   = HOST-PCI
hostb5@pci0:0:24:4:	class=0x060000 card=0x00000000 chip=0x12041022 rev=0x00 hdr=0x00
    vendor     = 'Advanced Micro Devices (AMD)'
    device     = '(Family 10h) Athlon64/Opteron/Sempron Link Control'
    class      = bridge
    subclass   = HOST-PCI
vgapci0@pci0:9:0:0:	class=0x030000 card=0x80601462 chip=0x0a6510de rev=0xa2 hdr=0x00
    vendor     = 'NVIDIA Corporation'
    device     = 'Nvidia 200 Series (GeForce 210)'
    class      = display
    subclass   = VGA
hdac0@pci0:9:0:1:	class=0x040300 card=0x80601462 chip=0x0be310de rev=0xa1 hdr=0x00
    vendor     = 'NVIDIA Corporation'
    class      = multimedia
    subclass   = HDA
em0@pci0:8:0:0:	class=0x020000 card=0xa01f8086 chip=0x10d38086 rev=0x00 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Intel 82574L Gigabit Ethernet Controller (82574L)'
    class      = network
    subclass   = ethernet
none1@pci0:7:0:0:	class=0x0c0010 card=0x76401462 chip=0x34031106 rev=0x00 hdr=0x00
    vendor     = 'VIA Technologies, Inc.'
    class      = serial bus
    subclass   = FireWire
none2@pci0:4:0:0:	class=0x0c0330 card=0x76401462 chip=0x01941033 rev=0x03 hdr=0x00
    vendor     = 'NEC Electronics Hong Kong'
    class      = serial bus
    subclass   = USB
none3@pci0:1:0:0:	class=0x010185 card=0x76401462 chip=0x2363197b rev=0x03 hdr=0x00
    vendor     = 'JMicron Technology Corp.'
    device     = 'JMicron JMB362/JMB363 AHCI Controller (JMB36X)'
    class      = mass storage
    subclass   = ATA
Comment 10 Andriy Gapon freebsd_committer freebsd_triage 2011-06-05 18:28:22 UTC
Actually AMD has already published SB800 specifications and there are indeed a
few significant differences.
Here's my quick attempt at accounting for them:
http://people.freebsd.org/~avg/amdsbwd-sb800.diff

-- 
Andriy Gapon
Comment 11 Tino 2011-06-05 21:44:33 UTC
On 6/5/11 7:28 PM, Andriy Gapon wrote:
> 
> Actually AMD has already published SB800 specifications and there are indeed a
> few significant differences.
> Here's my quick attempt at accounting for them:
> http://people.freebsd.org/~avg/amdsbwd-sb800.diff
> 
Hi,

I applied the patch, but the driver does not attach again. From
dmesg.boot now these lines are shown:

amdsbwd0: <AMD SB8xx Watchdog Timer> at iomem
0xf1800000-0xf1800003,0xf1800004-0xf1800007 on isa0
amdsbwd0: watchdog hardware is disabled
device_attach: amdsbwd0 attach returned 6

Perhaps watchdog is forcibly disabled by hardware ?
However, in bios configuration there is no configuration about watchdog.
Thank you very much for your interest and feel free to contact me if I
can be of help,
bye,

--
Tino
Comment 12 Andriy Gapon freebsd_committer freebsd_triage 2011-06-05 22:11:12 UTC
on 05/06/2011 23:44 Tino said the following:
> On 6/5/11 7:28 PM, Andriy Gapon wrote:
>>
>> Actually AMD has already published SB800 specifications and there are indeed a
>> few significant differences.
>> Here's my quick attempt at accounting for them:
>> http://people.freebsd.org/~avg/amdsbwd-sb800.diff
>>
> Hi,
> 
> I applied the patch, but the driver does not attach again. From
> dmesg.boot now these lines are shown:
> 
> amdsbwd0: <AMD SB8xx Watchdog Timer> at iomem
> 0xf1800000-0xf1800003,0xf1800004-0xf1800007 on isa0

This looks better.

> amdsbwd0: watchdog hardware is disabled
> device_attach: amdsbwd0 attach returned 6

This is not so good.

> Perhaps watchdog is forcibly disabled by hardware ?
> However, in bios configuration there is no configuration about watchdog.
> Thank you very much for your interest and feel free to contact me if I
> can be of help,

Looks like I've made a mistake at one place (at minimum).
I rerolled the patch at the same URL.
Alternatively you can edit sys/dev/amdsbwd/amdsbwd.c to change
AMDSB8_PM_WDT_CTRL => AMDSB8_PM_WDT_EN in the following block:

        /*
         * Enable watchdog device (in stopped state)
         * and decoding of its address.
         */
        val = pmio_read(pmres, AMDSB8_PM_WDT_EN);
        val &= ~AMDSB8_WDT_DISABLE;
        val |= AMDSB8_WDT_DEC_EN;
        pmio_write(pmres, AMDSB8_PM_WDT_EN, val);


-- 
Andriy Gapon
Comment 13 Tino 2011-06-05 22:42:49 UTC
On 6/5/11 11:11 PM, Andriy Gapon wrote:
> on 05/06/2011 23:44 Tino said the following:
>> On 6/5/11 7:28 PM, Andriy Gapon wrote:
>>>
>>> Actually AMD has already published SB800 specifications and there are indeed a
>>> few significant differences.
>>> Here's my quick attempt at accounting for them:
>>> http://people.freebsd.org/~avg/amdsbwd-sb800.diff
>>>
>> Hi,
>>
>> I applied the patch, but the driver does not attach again. From
>> dmesg.boot now these lines are shown:
>>
>> amdsbwd0: <AMD SB8xx Watchdog Timer> at iomem
>> 0xf1800000-0xf1800003,0xf1800004-0xf1800007 on isa0
> 
> This looks better.
> 
>> amdsbwd0: watchdog hardware is disabled
>> device_attach: amdsbwd0 attach returned 6
> 
> This is not so good.
> 
>> Perhaps watchdog is forcibly disabled by hardware ?
>> However, in bios configuration there is no configuration about watchdog.
>> Thank you very much for your interest and feel free to contact me if I
>> can be of help,
> 
> Looks like I've made a mistake at one place (at minimum).
> I rerolled the patch at the same URL.
> Alternatively you can edit sys/dev/amdsbwd/amdsbwd.c to change
> AMDSB8_PM_WDT_CTRL => AMDSB8_PM_WDT_EN in the following block:
> 
>         /*
>          * Enable watchdog device (in stopped state)
>          * and decoding of its address.
>          */
>         val = pmio_read(pmres, AMDSB8_PM_WDT_EN);
>         val &= ~AMDSB8_WDT_DISABLE;
>         val |= AMDSB8_WDT_DEC_EN;
>         pmio_write(pmres, AMDSB8_PM_WDT_EN, val);
> 
> 
Hi,

I applied the new patch but result is exactly as before:

amdsbwd0: <AMD SB8xx Watchdog Timer> at iomem
0xf1800000-0xf1800003,0xf1800004-0xf1800007 on isa0
amdsbwd0: watchdog hardware is disabled
device_attach: amdsbwd0 attach returned 6

Thank you,

--
Tino
Comment 14 Andriy Gapon freebsd_committer freebsd_triage 2011-06-06 07:30:23 UTC
on 06/06/2011 00:42 Tino said the following:
> I applied the new patch but result is exactly as before:
> 
> amdsbwd0: <AMD SB8xx Watchdog Timer> at iomem
> 0xf1800000-0xf1800003,0xf1800004-0xf1800007 on isa0
> amdsbwd0: watchdog hardware is disabled
> device_attach: amdsbwd0 attach returned 6

Found another bug.  The patch is re-rolled at the same URL.

-- 
Andriy Gapon
Comment 15 Tino 2011-06-06 08:38:21 UTC
On 6/6/11 8:30 AM, Andriy Gapon wrote:
> on 06/06/2011 00:42 Tino said the following:
>> I applied the new patch but result is exactly as before:
>>
>> amdsbwd0: <AMD SB8xx Watchdog Timer> at iomem
>> 0xf1800000-0xf1800003,0xf1800004-0xf1800007 on isa0
>> amdsbwd0: watchdog hardware is disabled
>> device_attach: amdsbwd0 attach returned 6
> 
> Found another bug.  The patch is re-rolled at the same URL.
> 
Hi,

I reapplied the patch and it seems it is working now! but perhaps too
much, because I have few seconds before the pc reboots. so I cannot be
sure if I enabled watchdogd and it is ignored by driver or if I forgot
to add it in rc.conf.
However, I was too late for work this morning, so I will investigate
thoroughly at lunch time or, in the worst case, this evening and
obviously I 'll let you know.
Thank you very much!
have a nice day,

--
Tino
Comment 16 Tino 2011-06-06 13:50:50 UTC
On 6/6/11 8:30 AM, Andriy Gapon wrote:
> on 06/06/2011 00:42 Tino said the following:
>> I applied the new patch but result is exactly as before:
>>
>> amdsbwd0: <AMD SB8xx Watchdog Timer> at iomem
>> 0xf1800000-0xf1800003,0xf1800004-0xf1800007 on isa0
>> amdsbwd0: watchdog hardware is disabled
>> device_attach: amdsbwd0 attach returned 6
> 
> Found another bug.  The patch is re-rolled at the same URL.
> 
Hi,

your last patch definitely works!
Machine is hardware reset as expected. Thank you!!
But in my case the hardware reset comes just before the whole boot
process finishes and in particular before the watchdogd daemon is
started, so putting machine in perpetual reboot cycle.
Could you please suggest me a solution smarter than disabling all
daemons in rc.conf?
Should I play with WD_ACTIVE or WD_INTERNAL in src/sys/sys/watchdog.h ?
Thank you very much,
best regards,

--
Tino
Comment 17 Andriy Gapon freebsd_committer freebsd_triage 2011-06-07 06:51:56 UTC
Thanks to a lot of great testing and feedback from the reporter
(tinotom@gmail.com) we have finally got a working version of the driver for
SB800-series southbridges.  The patch is at the same URL.

I will integrate the changes to FreeBSD source tree.

-- 
Andriy Gapon
Comment 18 dfilter service freebsd_committer freebsd_triage 2011-06-07 07:18:12 UTC
Author: avg
Date: Tue Jun  7 06:18:02 2011
New Revision: 222805
URL: http://svn.freebsd.org/changeset/base/222805

Log:
  amdsbwd: update to support SB8xx southbridges
  
  Many thanks to Tino <tinotom@gmail.com> for drawing my attention to
  this, for doing a lot of testing and providing great feedback.
  Many thanks to AMD for continuing to release public specifications for
  their chipsets.
  
  PR:		kern/157568
  Tested by:	Tino <tinotom@gmail.com>
  MFC after:	1 week

Modified:
  head/share/man/man4/amdsbwd.4
  head/sys/dev/amdsbwd/amdsbwd.c

Modified: head/share/man/man4/amdsbwd.4
==============================================================================
--- head/share/man/man4/amdsbwd.4	Tue Jun  7 05:04:37 2011	(r222804)
+++ head/share/man/man4/amdsbwd.4	Tue Jun  7 06:18:02 2011	(r222805)
@@ -25,12 +25,12 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 30, 2009
+.Dd June 7, 2011
 .Dt AMDSBWD 4
 .Os
 .Sh NAME
 .Nm amdsbwd
-.Nd device driver for the AMD SB600/SB700/SB710/SB750 watchdog timer
+.Nd device driver for the AMD SB600/SB7xx/SB8xx watchdog timers
 .Sh SYNOPSIS
 To compile this driver into the kernel,
 place the following line in your
@@ -51,7 +51,7 @@ The
 driver provides
 .Xr watchdog 4
 support for the watchdog timers present on
-AMD SB600 and SB7xx south bridge chips.
+AMD SB600, SB7xx and SB8xx southbridges.
 .Sh SEE ALSO
 .Xr watchdog 4 ,
 .Xr watchdog 8 ,

Modified: head/sys/dev/amdsbwd/amdsbwd.c
==============================================================================
--- head/sys/dev/amdsbwd/amdsbwd.c	Tue Jun  7 05:04:37 2011	(r222804)
+++ head/sys/dev/amdsbwd/amdsbwd.c	Tue Jun  7 06:18:02 2011	(r222805)
@@ -25,8 +25,8 @@
  */
 
 /*
- * This is a driver for watchdog timer present in AMD SB600/SB7xx
- * south bridges and other watchdog timers advertised via WDRT ACPI table.
+ * This is a driver for watchdog timer present in AMD SB600/SB7xx/SB8xx
+ * southbridges.
  * Please see the following specifications for the descriptions of the
  * registers and flags:
  * - AMD SB600 Register Reference Guide, Public Version,  Rev. 3.03 (SB600 RRG)
@@ -35,11 +35,13 @@
  *   http://developer.amd.com/assets/43009_sb7xx_rrg_pub_1.00.pdf
  * - AMD SB700/710/750 Register Programming Requirements (RPR)
  *   http://developer.amd.com/assets/42413_sb7xx_rpr_pub_1.00.pdf
+ * - AMD SB800-Series Southbridges Register Reference Guide (RRG)
+ *   http://support.amd.com/us/Embedded_TechDocs/45482.pdf
  * Please see the following for Watchdog Resource Table specification:
  * - Watchdog Timer Hardware Requirements for Windows Server 2003 (WDRT)
  *   http://www.microsoft.com/whdc/system/sysinternals/watchdog.mspx
- * AMD SB600/SB7xx watchdog hardware seems to conform to the above,
- * but my system doesn't provide the table.
+ * AMD SB600/SB7xx/SB8xx watchdog hardware seems to conform to the above
+ * specifications, but the table hasn't been spotted in the wild yet.
  */
 
 #include <sys/cdefs.h>
@@ -59,15 +61,15 @@ __FBSDID("$FreeBSD$");
 #include <dev/pci/pcivar.h>
 #include <isa/isavar.h>
 
-/* RRG 2.3.3.1.1, page 161. */
+/* SB7xx RRG 2.3.3.1.1. */
 #define	AMDSB_PMIO_INDEX		0xcd6
 #define	AMDSB_PMIO_DATA			(PMIO_INDEX + 1)
 #define	AMDSB_PMIO_WIDTH		2
-/* RRG 2.3.3.2, page 181. */
+/* SB7xx RRG 2.3.3.2. */
 #define	AMDSB_PM_RESET_STATUS0		0x44
 #define	AMDSB_PM_RESET_STATUS1		0x45
 #define		AMDSB_WD_RST_STS	0x02
-/* RRG 2.3.3.2, page 188; RPR 2.36, page 30. */
+/* SB7xx RRG 2.3.3.2, RPR 2.36. */
 #define	AMDSB_PM_WDT_CTRL		0x69
 #define		AMDSB_WDT_DISABLE	0x01
 #define		AMDSB_WDT_RES_MASK	(0x02 | 0x04)
@@ -77,7 +79,18 @@ __FBSDID("$FreeBSD$");
 #define		AMDSB_WDT_RES_1S	0x06
 #define	AMDSB_PM_WDT_BASE_LSB		0x6c
 #define	AMDSB_PM_WDT_BASE_MSB		0x6f
-/* RRG 2.3.4, page 223, WDRT. */
+/* SB8xx RRG 2.3.3. */
+#define	AMDSB8_PM_WDT_EN		0x48
+#define		AMDSB8_WDT_DEC_EN	0x01
+#define		AMDSB8_WDT_DISABLE	0x02
+#define	AMDSB8_PM_WDT_CTRL		0x4c
+#define		AMDSB8_WDT_32KHZ	0x00
+#define		AMDSB8_WDT_1HZ		0x03
+#define		AMDSB8_WDT_RES_MASK	0x03
+#define	AMDSB8_PM_RESET_STATUS0		0xC0
+#define	AMDSB8_PM_RESET_STATUS1		0xC1
+#define		AMDSB8_WD_RST_STS	0x20
+/* SB7xx RRG 2.3.4, WDRT. */
 #define	AMDSB_WD_CTRL			0x00
 #define		AMDSB_WD_RUN		0x01
 #define		AMDSB_WD_FIRED		0x02
@@ -90,8 +103,9 @@ __FBSDID("$FreeBSD$");
 #define	AMDSB_WDIO_REG_WIDTH		4
 /* WDRT */
 #define	MAXCOUNT_MIN_VALUE		511
-/* RRG 2.3.1.1, page 122; SB600 RRG 2.3.1.1, page 97. */
-#define	AMDSB7xx_SMBUS_DEVID		0x43851002
+/* SB7xx RRG 2.3.1.1, SB600 RRG 2.3.1.1, SB8xx RRG 2.3.1.  */
+#define	AMDSB_SMBUS_DEVID		0x43851002
+#define	AMDSB8_SMBUS_REVID		0x40
 
 #define	amdsbwd_verbose_printf(dev, ...)	\
 	do {						\
@@ -265,7 +279,7 @@ amdsbwd_identify(driver_t *driver, devic
 	smb_dev = pci_find_bsf(0, 20, 0);
 	if (smb_dev == NULL)
 		return;
-	if (pci_get_devid(smb_dev) != AMDSB7xx_SMBUS_DEVID)
+	if (pci_get_devid(smb_dev) != AMDSB_SMBUS_DEVID)
 		return;
 
 	child = BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "amdsbwd", -1);
@@ -273,15 +287,102 @@ amdsbwd_identify(driver_t *driver, devic
 		device_printf(parent, "add amdsbwd child failed\n");
 }
 
+
+static void
+amdsbwd_probe_sb7xx(device_t dev, struct resource *pmres, uint32_t *addr)
+{
+	uint32_t	val;
+	int		i;
+
+	/* Report cause of previous reset for user's convenience. */
+	val = pmio_read(pmres, AMDSB_PM_RESET_STATUS0);
+	if (val != 0)
+		amdsbwd_verbose_printf(dev, "ResetStatus0 = %#04x\n", val);
+	val = pmio_read(pmres, AMDSB_PM_RESET_STATUS1);
+	if (val != 0)
+		amdsbwd_verbose_printf(dev, "ResetStatus1 = %#04x\n", val);
+	if ((val & AMDSB_WD_RST_STS) != 0)
+		device_printf(dev, "Previous Reset was caused by Watchdog\n");
+
+	/* Find base address of memory mapped WDT registers. */
+	for (*addr = 0, i = 0; i < 4; i++) {
+		*addr <<= 8;
+		*addr |= pmio_read(pmres, AMDSB_PM_WDT_BASE_MSB - i);
+	}
+	/* Set watchdog timer tick to 1s. */
+	val = pmio_read(pmres, AMDSB_PM_WDT_CTRL);
+	val &= ~AMDSB_WDT_RES_MASK;
+	val |= AMDSB_WDT_RES_10MS;
+	pmio_write(pmres, AMDSB_PM_WDT_CTRL, val);
+
+	/* Enable watchdog device (in stopped state). */
+	val = pmio_read(pmres, AMDSB_PM_WDT_CTRL);
+	val &= ~AMDSB_WDT_DISABLE;
+	pmio_write(pmres, AMDSB_PM_WDT_CTRL, val);
+
+	/*
+	 * XXX TODO: Ensure that watchdog decode is enabled
+	 * (register 0x41, bit 3).
+	 */
+	device_set_desc(dev, "AMD SB600/SB7xx Watchdog Timer");
+}
+
+static void
+amdsbwd_probe_sb8xx(device_t dev, struct resource *pmres, uint32_t *addr)
+{
+	uint32_t	val;
+	int		i;
+
+	/* Report cause of previous reset for user's convenience. */
+	val = pmio_read(pmres, AMDSB8_PM_RESET_STATUS0);
+	if (val != 0)
+		amdsbwd_verbose_printf(dev, "ResetStatus0 = %#04x\n", val);
+	val = pmio_read(pmres, AMDSB8_PM_RESET_STATUS1);
+	if (val != 0)
+		amdsbwd_verbose_printf(dev, "ResetStatus1 = %#04x\n", val);
+	if ((val & AMDSB8_WD_RST_STS) != 0)
+		device_printf(dev, "Previous Reset was caused by Watchdog\n");
+
+	/* Find base address of memory mapped WDT registers. */
+	for (*addr = 0, i = 0; i < 4; i++) {
+		*addr <<= 8;
+		*addr |= pmio_read(pmres, AMDSB8_PM_WDT_EN + 3 - i);
+	}
+	*addr &= ~0x07u;
+
+	/* Set watchdog timer tick to 1s. */
+	val = pmio_read(pmres, AMDSB8_PM_WDT_CTRL);
+	val &= ~AMDSB8_WDT_RES_MASK;
+	val |= AMDSB8_WDT_1HZ;
+	pmio_write(pmres, AMDSB8_PM_WDT_CTRL, val);
+#ifdef AMDSBWD_DEBUG
+	val = pmio_read(pmres, AMDSB8_PM_WDT_CTRL);
+	amdsbwd_verbose_printf(dev, "AMDSB8_PM_WDT_CTRL value = %#02x\n", val);
+#endif
+
+	/*
+	 * Enable watchdog device (in stopped state)
+	 * and decoding of its address.
+	 */
+	val = pmio_read(pmres, AMDSB8_PM_WDT_EN);
+	val &= ~AMDSB8_WDT_DISABLE;
+	val |= AMDSB8_WDT_DEC_EN;
+	pmio_write(pmres, AMDSB8_PM_WDT_EN, val);
+#ifdef AMDSBWD_DEBUG
+	val = pmio_read(pmres, AMDSB8_PM_WDT_EN);
+	device_printf(dev, "AMDSB8_PM_WDT_EN value = %#02x\n", val);
+#endif
+	device_set_desc(dev, "AMD SB8xx Watchdog Timer");
+}
+
 static int
 amdsbwd_probe(device_t dev)
 {
 	struct resource		*res;
+	device_t		smb_dev;
 	uint32_t		addr;
-	uint32_t		val;
 	int			rid;
 	int			rc;
-	int			i;
 
 	/* Do not claim some ISA PnP device by accident. */
 	if (isa_get_logicalid(dev) != 0)
@@ -301,21 +402,16 @@ amdsbwd_probe(device_t dev)
 		return (ENXIO);
 	}
 
-	/* Report cause of previous reset for user's convenience. */
-	val = pmio_read(res, AMDSB_PM_RESET_STATUS0);
-	if (val != 0)
-		amdsbwd_verbose_printf(dev, "ResetStatus0 = %#04x\n", val);
-	val = pmio_read(res, AMDSB_PM_RESET_STATUS1);
-	if (val != 0)
-		amdsbwd_verbose_printf(dev, "ResetStatus1 = %#04x\n", val);
-	if ((val & AMDSB_WD_RST_STS) != 0)
-		device_printf(dev, "Previous Reset was caused by Watchdog\n");
+	smb_dev = pci_find_bsf(0, 20, 0);
+	KASSERT(smb_dev != NULL, ("can't find SMBus PCI device\n"));
+	if (pci_get_revid(smb_dev) < AMDSB8_SMBUS_REVID)
+		amdsbwd_probe_sb7xx(dev, res, &addr);
+	else
+		amdsbwd_probe_sb8xx(dev, res, &addr);
+
+	bus_release_resource(dev, SYS_RES_IOPORT, rid, res);
+	bus_delete_resource(dev, SYS_RES_IOPORT, rid);
 
-	/* Find base address of memory mapped WDT registers. */
-	for (addr = 0, i = 0; i < 4; i++) {
-		addr <<= 8;
-		addr |= pmio_read(res, AMDSB_PM_WDT_BASE_MSB - i);
-	}
 	amdsbwd_verbose_printf(dev, "memory base address = %#010x\n", addr);
 	rc = bus_set_resource(dev, SYS_RES_MEMORY, 0, addr + AMDSB_WD_CTRL,
 	    AMDSB_WDIO_REG_WIDTH);
@@ -330,36 +426,25 @@ amdsbwd_probe(device_t dev)
 		return (ENXIO);
 	}
 
-	/* Set watchdog timer tick to 10ms. */
-	val = pmio_read(res, AMDSB_PM_WDT_CTRL);
-	val &= ~AMDSB_WDT_RES_MASK;
-	val |= AMDSB_WDT_RES_10MS;
-	pmio_write(res, AMDSB_PM_WDT_CTRL, val);
-
-	/* Enable watchdog device (in stopped state). */
-	val = pmio_read(res, AMDSB_PM_WDT_CTRL);
-	val &= ~AMDSB_WDT_DISABLE;
-	pmio_write(res, AMDSB_PM_WDT_CTRL, val);
-
-	/*
-	 * XXX TODO: Ensure that watchdog decode is enabled
-	 * (register 0x41, bit 3).
-	 */
-	bus_release_resource(dev, SYS_RES_IOPORT, rid, res);
-	bus_delete_resource(dev, SYS_RES_IOPORT, rid);
-
-	device_set_desc(dev, "AMD SB600/SB7xx Watchdog Timer");
 	return (0);
 }
 
 static int
 amdsbwd_attach_sb(device_t dev, struct amdsbwd_softc *sc)
 {
+	device_t	smb_dev;
+
 	sc->max_ticks = UINT16_MAX;
-	sc->ms_per_tick = 10;
 	sc->rid_ctrl = 0;
 	sc->rid_count = 1;
 
+	smb_dev = pci_find_bsf(0, 20, 0);
+	KASSERT(smb_dev != NULL, ("can't find SMBus PCI device\n"));
+	if (pci_get_revid(smb_dev) < AMDSB8_SMBUS_REVID)
+		sc->ms_per_tick = 10;
+	else
+		sc->ms_per_tick = 1000;
+
 	sc->res_ctrl = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
 	    &sc->rid_ctrl, RF_ACTIVE);
 	if (sc->res_ctrl == NULL) {
@@ -388,6 +473,11 @@ amdsbwd_attach(device_t dev)
 	if (rc != 0)
 		goto fail;
 
+#ifdef AMDSBWD_DEBUG
+	device_printf(dev, "wd ctrl = %#04x\n", wdctrl_read(sc));
+	device_printf(dev, "wd count = %#04x\n", wdcount_read(sc));
+#endif
+
 	/* Setup initial state of Watchdog Control. */
 	wdctrl_write(sc, AMDSB_WD_FIRED);
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 19 Andriy Gapon freebsd_committer freebsd_triage 2011-06-07 07:22:59 UTC
State Changed
From-To: open->patched

Support for SB8xx southbridges is committed to head.
Comment 20 dfilter service freebsd_committer freebsd_triage 2011-06-22 07:45:50 UTC
Author: avg
Date: Wed Jun 22 06:45:34 2011
New Revision: 223409
URL: http://svn.freebsd.org/changeset/base/223409

Log:
  MFC r222805: amdsbwd: update to support SB8xx southbridges
  
  PR:		kern/157568

Modified:
  stable/8/share/man/man4/amdsbwd.4
  stable/8/sys/dev/amdsbwd/amdsbwd.c
Directory Properties:
  stable/8/share/man/man4/   (props changed)
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/share/man/man4/amdsbwd.4
==============================================================================
--- stable/8/share/man/man4/amdsbwd.4	Wed Jun 22 06:27:32 2011	(r223408)
+++ stable/8/share/man/man4/amdsbwd.4	Wed Jun 22 06:45:34 2011	(r223409)
@@ -25,12 +25,12 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 30, 2009
+.Dd June 7, 2011
 .Dt AMDSBWD 4
 .Os
 .Sh NAME
 .Nm amdsbwd
-.Nd device driver for the AMD SB600/SB700/SB710/SB750 watchdog timer
+.Nd device driver for the AMD SB600/SB7xx/SB8xx watchdog timers
 .Sh SYNOPSIS
 To compile this driver into the kernel,
 place the following line in your
@@ -51,7 +51,7 @@ The
 driver provides
 .Xr watchdog 4
 support for the watchdog timers present on
-AMD SB600 and SB7xx south bridge chips.
+AMD SB600, SB7xx and SB8xx southbridges.
 .Sh SEE ALSO
 .Xr watchdog 4 ,
 .Xr watchdog 8 ,

Modified: stable/8/sys/dev/amdsbwd/amdsbwd.c
==============================================================================
--- stable/8/sys/dev/amdsbwd/amdsbwd.c	Wed Jun 22 06:27:32 2011	(r223408)
+++ stable/8/sys/dev/amdsbwd/amdsbwd.c	Wed Jun 22 06:45:34 2011	(r223409)
@@ -25,8 +25,8 @@
  */
 
 /*
- * This is a driver for watchdog timer present in AMD SB600/SB7xx
- * south bridges and other watchdog timers advertised via WDRT ACPI table.
+ * This is a driver for watchdog timer present in AMD SB600/SB7xx/SB8xx
+ * southbridges.
  * Please see the following specifications for the descriptions of the
  * registers and flags:
  * - AMD SB600 Register Reference Guide, Public Version,  Rev. 3.03 (SB600 RRG)
@@ -35,11 +35,13 @@
  *   http://developer.amd.com/assets/43009_sb7xx_rrg_pub_1.00.pdf
  * - AMD SB700/710/750 Register Programming Requirements (RPR)
  *   http://developer.amd.com/assets/42413_sb7xx_rpr_pub_1.00.pdf
+ * - AMD SB800-Series Southbridges Register Reference Guide (RRG)
+ *   http://support.amd.com/us/Embedded_TechDocs/45482.pdf
  * Please see the following for Watchdog Resource Table specification:
  * - Watchdog Timer Hardware Requirements for Windows Server 2003 (WDRT)
  *   http://www.microsoft.com/whdc/system/sysinternals/watchdog.mspx
- * AMD SB600/SB7xx watchdog hardware seems to conform to the above,
- * but my system doesn't provide the table.
+ * AMD SB600/SB7xx/SB8xx watchdog hardware seems to conform to the above
+ * specifications, but the table hasn't been spotted in the wild yet.
  */
 
 #include <sys/cdefs.h>
@@ -59,15 +61,15 @@ __FBSDID("$FreeBSD$");
 #include <dev/pci/pcivar.h>
 #include <isa/isavar.h>
 
-/* RRG 2.3.3.1.1, page 161. */
+/* SB7xx RRG 2.3.3.1.1. */
 #define	AMDSB_PMIO_INDEX		0xcd6
 #define	AMDSB_PMIO_DATA			(PMIO_INDEX + 1)
 #define	AMDSB_PMIO_WIDTH		2
-/* RRG 2.3.3.2, page 181. */
+/* SB7xx RRG 2.3.3.2. */
 #define	AMDSB_PM_RESET_STATUS0		0x44
 #define	AMDSB_PM_RESET_STATUS1		0x45
 #define		AMDSB_WD_RST_STS	0x02
-/* RRG 2.3.3.2, page 188; RPR 2.36, page 30. */
+/* SB7xx RRG 2.3.3.2, RPR 2.36. */
 #define	AMDSB_PM_WDT_CTRL		0x69
 #define		AMDSB_WDT_DISABLE	0x01
 #define		AMDSB_WDT_RES_MASK	(0x02 | 0x04)
@@ -77,7 +79,18 @@ __FBSDID("$FreeBSD$");
 #define		AMDSB_WDT_RES_1S	0x06
 #define	AMDSB_PM_WDT_BASE_LSB		0x6c
 #define	AMDSB_PM_WDT_BASE_MSB		0x6f
-/* RRG 2.3.4, page 223, WDRT. */
+/* SB8xx RRG 2.3.3. */
+#define	AMDSB8_PM_WDT_EN		0x48
+#define		AMDSB8_WDT_DEC_EN	0x01
+#define		AMDSB8_WDT_DISABLE	0x02
+#define	AMDSB8_PM_WDT_CTRL		0x4c
+#define		AMDSB8_WDT_32KHZ	0x00
+#define		AMDSB8_WDT_1HZ		0x03
+#define		AMDSB8_WDT_RES_MASK	0x03
+#define	AMDSB8_PM_RESET_STATUS0		0xC0
+#define	AMDSB8_PM_RESET_STATUS1		0xC1
+#define		AMDSB8_WD_RST_STS	0x20
+/* SB7xx RRG 2.3.4, WDRT. */
 #define	AMDSB_WD_CTRL			0x00
 #define		AMDSB_WD_RUN		0x01
 #define		AMDSB_WD_FIRED		0x02
@@ -90,8 +103,9 @@ __FBSDID("$FreeBSD$");
 #define	AMDSB_WDIO_REG_WIDTH		4
 /* WDRT */
 #define	MAXCOUNT_MIN_VALUE		511
-/* RRG 2.3.1.1, page 122; SB600 RRG 2.3.1.1, page 97. */
-#define	AMDSB7xx_SMBUS_DEVID		0x43851002
+/* SB7xx RRG 2.3.1.1, SB600 RRG 2.3.1.1, SB8xx RRG 2.3.1.  */
+#define	AMDSB_SMBUS_DEVID		0x43851002
+#define	AMDSB8_SMBUS_REVID		0x40
 
 #define	amdsbwd_verbose_printf(dev, ...)	\
 	do {						\
@@ -265,7 +279,7 @@ amdsbwd_identify(driver_t *driver, devic
 	smb_dev = pci_find_bsf(0, 20, 0);
 	if (smb_dev == NULL)
 		return;
-	if (pci_get_devid(smb_dev) != AMDSB7xx_SMBUS_DEVID)
+	if (pci_get_devid(smb_dev) != AMDSB_SMBUS_DEVID)
 		return;
 
 	child = BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "amdsbwd", -1);
@@ -273,15 +287,102 @@ amdsbwd_identify(driver_t *driver, devic
 		device_printf(parent, "add amdsbwd child failed\n");
 }
 
+
+static void
+amdsbwd_probe_sb7xx(device_t dev, struct resource *pmres, uint32_t *addr)
+{
+	uint32_t	val;
+	int		i;
+
+	/* Report cause of previous reset for user's convenience. */
+	val = pmio_read(pmres, AMDSB_PM_RESET_STATUS0);
+	if (val != 0)
+		amdsbwd_verbose_printf(dev, "ResetStatus0 = %#04x\n", val);
+	val = pmio_read(pmres, AMDSB_PM_RESET_STATUS1);
+	if (val != 0)
+		amdsbwd_verbose_printf(dev, "ResetStatus1 = %#04x\n", val);
+	if ((val & AMDSB_WD_RST_STS) != 0)
+		device_printf(dev, "Previous Reset was caused by Watchdog\n");
+
+	/* Find base address of memory mapped WDT registers. */
+	for (*addr = 0, i = 0; i < 4; i++) {
+		*addr <<= 8;
+		*addr |= pmio_read(pmres, AMDSB_PM_WDT_BASE_MSB - i);
+	}
+	/* Set watchdog timer tick to 1s. */
+	val = pmio_read(pmres, AMDSB_PM_WDT_CTRL);
+	val &= ~AMDSB_WDT_RES_MASK;
+	val |= AMDSB_WDT_RES_10MS;
+	pmio_write(pmres, AMDSB_PM_WDT_CTRL, val);
+
+	/* Enable watchdog device (in stopped state). */
+	val = pmio_read(pmres, AMDSB_PM_WDT_CTRL);
+	val &= ~AMDSB_WDT_DISABLE;
+	pmio_write(pmres, AMDSB_PM_WDT_CTRL, val);
+
+	/*
+	 * XXX TODO: Ensure that watchdog decode is enabled
+	 * (register 0x41, bit 3).
+	 */
+	device_set_desc(dev, "AMD SB600/SB7xx Watchdog Timer");
+}
+
+static void
+amdsbwd_probe_sb8xx(device_t dev, struct resource *pmres, uint32_t *addr)
+{
+	uint32_t	val;
+	int		i;
+
+	/* Report cause of previous reset for user's convenience. */
+	val = pmio_read(pmres, AMDSB8_PM_RESET_STATUS0);
+	if (val != 0)
+		amdsbwd_verbose_printf(dev, "ResetStatus0 = %#04x\n", val);
+	val = pmio_read(pmres, AMDSB8_PM_RESET_STATUS1);
+	if (val != 0)
+		amdsbwd_verbose_printf(dev, "ResetStatus1 = %#04x\n", val);
+	if ((val & AMDSB8_WD_RST_STS) != 0)
+		device_printf(dev, "Previous Reset was caused by Watchdog\n");
+
+	/* Find base address of memory mapped WDT registers. */
+	for (*addr = 0, i = 0; i < 4; i++) {
+		*addr <<= 8;
+		*addr |= pmio_read(pmres, AMDSB8_PM_WDT_EN + 3 - i);
+	}
+	*addr &= ~0x07u;
+
+	/* Set watchdog timer tick to 1s. */
+	val = pmio_read(pmres, AMDSB8_PM_WDT_CTRL);
+	val &= ~AMDSB8_WDT_RES_MASK;
+	val |= AMDSB8_WDT_1HZ;
+	pmio_write(pmres, AMDSB8_PM_WDT_CTRL, val);
+#ifdef AMDSBWD_DEBUG
+	val = pmio_read(pmres, AMDSB8_PM_WDT_CTRL);
+	amdsbwd_verbose_printf(dev, "AMDSB8_PM_WDT_CTRL value = %#02x\n", val);
+#endif
+
+	/*
+	 * Enable watchdog device (in stopped state)
+	 * and decoding of its address.
+	 */
+	val = pmio_read(pmres, AMDSB8_PM_WDT_EN);
+	val &= ~AMDSB8_WDT_DISABLE;
+	val |= AMDSB8_WDT_DEC_EN;
+	pmio_write(pmres, AMDSB8_PM_WDT_EN, val);
+#ifdef AMDSBWD_DEBUG
+	val = pmio_read(pmres, AMDSB8_PM_WDT_EN);
+	device_printf(dev, "AMDSB8_PM_WDT_EN value = %#02x\n", val);
+#endif
+	device_set_desc(dev, "AMD SB8xx Watchdog Timer");
+}
+
 static int
 amdsbwd_probe(device_t dev)
 {
 	struct resource		*res;
+	device_t		smb_dev;
 	uint32_t		addr;
-	uint32_t		val;
 	int			rid;
 	int			rc;
-	int			i;
 
 	/* Do not claim some ISA PnP device by accident. */
 	if (isa_get_logicalid(dev) != 0)
@@ -301,21 +402,16 @@ amdsbwd_probe(device_t dev)
 		return (ENXIO);
 	}
 
-	/* Report cause of previous reset for user's convenience. */
-	val = pmio_read(res, AMDSB_PM_RESET_STATUS0);
-	if (val != 0)
-		amdsbwd_verbose_printf(dev, "ResetStatus0 = %#04x\n", val);
-	val = pmio_read(res, AMDSB_PM_RESET_STATUS1);
-	if (val != 0)
-		amdsbwd_verbose_printf(dev, "ResetStatus1 = %#04x\n", val);
-	if ((val & AMDSB_WD_RST_STS) != 0)
-		device_printf(dev, "Previous Reset was caused by Watchdog\n");
+	smb_dev = pci_find_bsf(0, 20, 0);
+	KASSERT(smb_dev != NULL, ("can't find SMBus PCI device\n"));
+	if (pci_get_revid(smb_dev) < AMDSB8_SMBUS_REVID)
+		amdsbwd_probe_sb7xx(dev, res, &addr);
+	else
+		amdsbwd_probe_sb8xx(dev, res, &addr);
+
+	bus_release_resource(dev, SYS_RES_IOPORT, rid, res);
+	bus_delete_resource(dev, SYS_RES_IOPORT, rid);
 
-	/* Find base address of memory mapped WDT registers. */
-	for (addr = 0, i = 0; i < 4; i++) {
-		addr <<= 8;
-		addr |= pmio_read(res, AMDSB_PM_WDT_BASE_MSB - i);
-	}
 	amdsbwd_verbose_printf(dev, "memory base address = %#010x\n", addr);
 	rc = bus_set_resource(dev, SYS_RES_MEMORY, 0, addr + AMDSB_WD_CTRL,
 	    AMDSB_WDIO_REG_WIDTH);
@@ -330,36 +426,25 @@ amdsbwd_probe(device_t dev)
 		return (ENXIO);
 	}
 
-	/* Set watchdog timer tick to 10ms. */
-	val = pmio_read(res, AMDSB_PM_WDT_CTRL);
-	val &= ~AMDSB_WDT_RES_MASK;
-	val |= AMDSB_WDT_RES_10MS;
-	pmio_write(res, AMDSB_PM_WDT_CTRL, val);
-
-	/* Enable watchdog device (in stopped state). */
-	val = pmio_read(res, AMDSB_PM_WDT_CTRL);
-	val &= ~AMDSB_WDT_DISABLE;
-	pmio_write(res, AMDSB_PM_WDT_CTRL, val);
-
-	/*
-	 * XXX TODO: Ensure that watchdog decode is enabled
-	 * (register 0x41, bit 3).
-	 */
-	bus_release_resource(dev, SYS_RES_IOPORT, rid, res);
-	bus_delete_resource(dev, SYS_RES_IOPORT, rid);
-
-	device_set_desc(dev, "AMD SB600/SB7xx Watchdog Timer");
 	return (0);
 }
 
 static int
 amdsbwd_attach_sb(device_t dev, struct amdsbwd_softc *sc)
 {
+	device_t	smb_dev;
+
 	sc->max_ticks = UINT16_MAX;
-	sc->ms_per_tick = 10;
 	sc->rid_ctrl = 0;
 	sc->rid_count = 1;
 
+	smb_dev = pci_find_bsf(0, 20, 0);
+	KASSERT(smb_dev != NULL, ("can't find SMBus PCI device\n"));
+	if (pci_get_revid(smb_dev) < AMDSB8_SMBUS_REVID)
+		sc->ms_per_tick = 10;
+	else
+		sc->ms_per_tick = 1000;
+
 	sc->res_ctrl = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
 	    &sc->rid_ctrl, RF_ACTIVE);
 	if (sc->res_ctrl == NULL) {
@@ -388,6 +473,11 @@ amdsbwd_attach(device_t dev)
 	if (rc != 0)
 		goto fail;
 
+#ifdef AMDSBWD_DEBUG
+	device_printf(dev, "wd ctrl = %#04x\n", wdctrl_read(sc));
+	device_printf(dev, "wd count = %#04x\n", wdcount_read(sc));
+#endif
+
 	/* Setup initial state of Watchdog Control. */
 	wdctrl_write(sc, AMDSB_WD_FIRED);
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 21 dfilter service freebsd_committer freebsd_triage 2011-06-22 07:58:58 UTC
Author: avg
Date: Wed Jun 22 06:58:42 2011
New Revision: 223410
URL: http://svn.freebsd.org/changeset/base/223410

Log:
  MFC r222805: amdsbwd: update to support SB8xx southbridges
  
  PR:		kern/157568

Modified:
  stable/7/share/man/man4/amdsbwd.4
  stable/7/sys/dev/amdsbwd/amdsbwd.c
Directory Properties:
  stable/7/share/man/man4/   (props changed)
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/share/man/man4/amdsbwd.4
==============================================================================
--- stable/7/share/man/man4/amdsbwd.4	Wed Jun 22 06:45:34 2011	(r223409)
+++ stable/7/share/man/man4/amdsbwd.4	Wed Jun 22 06:58:42 2011	(r223410)
@@ -25,12 +25,12 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 30, 2009
+.Dd June 7, 2011
 .Dt AMDSBWD 4
 .Os
 .Sh NAME
 .Nm amdsbwd
-.Nd device driver for the AMD SB600/SB700/SB710/SB750 watchdog timer
+.Nd device driver for the AMD SB600/SB7xx/SB8xx watchdog timers
 .Sh SYNOPSIS
 To compile this driver into the kernel,
 place the following line in your
@@ -51,7 +51,7 @@ The
 driver provides
 .Xr watchdog 4
 support for the watchdog timers present on
-AMD SB600 and SB7xx south bridge chips.
+AMD SB600, SB7xx and SB8xx southbridges.
 .Sh SEE ALSO
 .Xr watchdog 4 ,
 .Xr watchdog 8 ,

Modified: stable/7/sys/dev/amdsbwd/amdsbwd.c
==============================================================================
--- stable/7/sys/dev/amdsbwd/amdsbwd.c	Wed Jun 22 06:45:34 2011	(r223409)
+++ stable/7/sys/dev/amdsbwd/amdsbwd.c	Wed Jun 22 06:58:42 2011	(r223410)
@@ -25,8 +25,8 @@
  */
 
 /*
- * This is a driver for watchdog timer present in AMD SB600/SB7xx
- * south bridges and other watchdog timers advertised via WDRT ACPI table.
+ * This is a driver for watchdog timer present in AMD SB600/SB7xx/SB8xx
+ * southbridges.
  * Please see the following specifications for the descriptions of the
  * registers and flags:
  * - AMD SB600 Register Reference Guide, Public Version,  Rev. 3.03 (SB600 RRG)
@@ -35,11 +35,13 @@
  *   http://developer.amd.com/assets/43009_sb7xx_rrg_pub_1.00.pdf
  * - AMD SB700/710/750 Register Programming Requirements (RPR)
  *   http://developer.amd.com/assets/42413_sb7xx_rpr_pub_1.00.pdf
+ * - AMD SB800-Series Southbridges Register Reference Guide (RRG)
+ *   http://support.amd.com/us/Embedded_TechDocs/45482.pdf
  * Please see the following for Watchdog Resource Table specification:
  * - Watchdog Timer Hardware Requirements for Windows Server 2003 (WDRT)
  *   http://www.microsoft.com/whdc/system/sysinternals/watchdog.mspx
- * AMD SB600/SB7xx watchdog hardware seems to conform to the above,
- * but my system doesn't provide the table.
+ * AMD SB600/SB7xx/SB8xx watchdog hardware seems to conform to the above
+ * specifications, but the table hasn't been spotted in the wild yet.
  */
 
 #include <sys/cdefs.h>
@@ -59,15 +61,15 @@ __FBSDID("$FreeBSD$");
 #include <dev/pci/pcivar.h>
 #include <isa/isavar.h>
 
-/* RRG 2.3.3.1.1, page 161. */
+/* SB7xx RRG 2.3.3.1.1. */
 #define	AMDSB_PMIO_INDEX		0xcd6
 #define	AMDSB_PMIO_DATA			(PMIO_INDEX + 1)
 #define	AMDSB_PMIO_WIDTH		2
-/* RRG 2.3.3.2, page 181. */
+/* SB7xx RRG 2.3.3.2. */
 #define	AMDSB_PM_RESET_STATUS0		0x44
 #define	AMDSB_PM_RESET_STATUS1		0x45
 #define		AMDSB_WD_RST_STS	0x02
-/* RRG 2.3.3.2, page 188; RPR 2.36, page 30. */
+/* SB7xx RRG 2.3.3.2, RPR 2.36. */
 #define	AMDSB_PM_WDT_CTRL		0x69
 #define		AMDSB_WDT_DISABLE	0x01
 #define		AMDSB_WDT_RES_MASK	(0x02 | 0x04)
@@ -77,7 +79,18 @@ __FBSDID("$FreeBSD$");
 #define		AMDSB_WDT_RES_1S	0x06
 #define	AMDSB_PM_WDT_BASE_LSB		0x6c
 #define	AMDSB_PM_WDT_BASE_MSB		0x6f
-/* RRG 2.3.4, page 223, WDRT. */
+/* SB8xx RRG 2.3.3. */
+#define	AMDSB8_PM_WDT_EN		0x48
+#define		AMDSB8_WDT_DEC_EN	0x01
+#define		AMDSB8_WDT_DISABLE	0x02
+#define	AMDSB8_PM_WDT_CTRL		0x4c
+#define		AMDSB8_WDT_32KHZ	0x00
+#define		AMDSB8_WDT_1HZ		0x03
+#define		AMDSB8_WDT_RES_MASK	0x03
+#define	AMDSB8_PM_RESET_STATUS0		0xC0
+#define	AMDSB8_PM_RESET_STATUS1		0xC1
+#define		AMDSB8_WD_RST_STS	0x20
+/* SB7xx RRG 2.3.4, WDRT. */
 #define	AMDSB_WD_CTRL			0x00
 #define		AMDSB_WD_RUN		0x01
 #define		AMDSB_WD_FIRED		0x02
@@ -90,8 +103,9 @@ __FBSDID("$FreeBSD$");
 #define	AMDSB_WDIO_REG_WIDTH		4
 /* WDRT */
 #define	MAXCOUNT_MIN_VALUE		511
-/* RRG 2.3.1.1, page 122; SB600 RRG 2.3.1.1, page 97. */
-#define	AMDSB7xx_SMBUS_DEVID		0x43851002
+/* SB7xx RRG 2.3.1.1, SB600 RRG 2.3.1.1, SB8xx RRG 2.3.1.  */
+#define	AMDSB_SMBUS_DEVID		0x43851002
+#define	AMDSB8_SMBUS_REVID		0x40
 
 #define	amdsbwd_verbose_printf(dev, ...)	\
 	do {						\
@@ -265,7 +279,7 @@ amdsbwd_identify(driver_t *driver, devic
 	smb_dev = pci_find_bsf(0, 20, 0);
 	if (smb_dev == NULL)
 		return;
-	if (pci_get_devid(smb_dev) != AMDSB7xx_SMBUS_DEVID)
+	if (pci_get_devid(smb_dev) != AMDSB_SMBUS_DEVID)
 		return;
 
 	child = BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "amdsbwd", -1);
@@ -273,15 +287,102 @@ amdsbwd_identify(driver_t *driver, devic
 		device_printf(parent, "add amdsbwd child failed\n");
 }
 
+
+static void
+amdsbwd_probe_sb7xx(device_t dev, struct resource *pmres, uint32_t *addr)
+{
+	uint32_t	val;
+	int		i;
+
+	/* Report cause of previous reset for user's convenience. */
+	val = pmio_read(pmres, AMDSB_PM_RESET_STATUS0);
+	if (val != 0)
+		amdsbwd_verbose_printf(dev, "ResetStatus0 = %#04x\n", val);
+	val = pmio_read(pmres, AMDSB_PM_RESET_STATUS1);
+	if (val != 0)
+		amdsbwd_verbose_printf(dev, "ResetStatus1 = %#04x\n", val);
+	if ((val & AMDSB_WD_RST_STS) != 0)
+		device_printf(dev, "Previous Reset was caused by Watchdog\n");
+
+	/* Find base address of memory mapped WDT registers. */
+	for (*addr = 0, i = 0; i < 4; i++) {
+		*addr <<= 8;
+		*addr |= pmio_read(pmres, AMDSB_PM_WDT_BASE_MSB - i);
+	}
+	/* Set watchdog timer tick to 1s. */
+	val = pmio_read(pmres, AMDSB_PM_WDT_CTRL);
+	val &= ~AMDSB_WDT_RES_MASK;
+	val |= AMDSB_WDT_RES_10MS;
+	pmio_write(pmres, AMDSB_PM_WDT_CTRL, val);
+
+	/* Enable watchdog device (in stopped state). */
+	val = pmio_read(pmres, AMDSB_PM_WDT_CTRL);
+	val &= ~AMDSB_WDT_DISABLE;
+	pmio_write(pmres, AMDSB_PM_WDT_CTRL, val);
+
+	/*
+	 * XXX TODO: Ensure that watchdog decode is enabled
+	 * (register 0x41, bit 3).
+	 */
+	device_set_desc(dev, "AMD SB600/SB7xx Watchdog Timer");
+}
+
+static void
+amdsbwd_probe_sb8xx(device_t dev, struct resource *pmres, uint32_t *addr)
+{
+	uint32_t	val;
+	int		i;
+
+	/* Report cause of previous reset for user's convenience. */
+	val = pmio_read(pmres, AMDSB8_PM_RESET_STATUS0);
+	if (val != 0)
+		amdsbwd_verbose_printf(dev, "ResetStatus0 = %#04x\n", val);
+	val = pmio_read(pmres, AMDSB8_PM_RESET_STATUS1);
+	if (val != 0)
+		amdsbwd_verbose_printf(dev, "ResetStatus1 = %#04x\n", val);
+	if ((val & AMDSB8_WD_RST_STS) != 0)
+		device_printf(dev, "Previous Reset was caused by Watchdog\n");
+
+	/* Find base address of memory mapped WDT registers. */
+	for (*addr = 0, i = 0; i < 4; i++) {
+		*addr <<= 8;
+		*addr |= pmio_read(pmres, AMDSB8_PM_WDT_EN + 3 - i);
+	}
+	*addr &= ~0x07u;
+
+	/* Set watchdog timer tick to 1s. */
+	val = pmio_read(pmres, AMDSB8_PM_WDT_CTRL);
+	val &= ~AMDSB8_WDT_RES_MASK;
+	val |= AMDSB8_WDT_1HZ;
+	pmio_write(pmres, AMDSB8_PM_WDT_CTRL, val);
+#ifdef AMDSBWD_DEBUG
+	val = pmio_read(pmres, AMDSB8_PM_WDT_CTRL);
+	amdsbwd_verbose_printf(dev, "AMDSB8_PM_WDT_CTRL value = %#02x\n", val);
+#endif
+
+	/*
+	 * Enable watchdog device (in stopped state)
+	 * and decoding of its address.
+	 */
+	val = pmio_read(pmres, AMDSB8_PM_WDT_EN);
+	val &= ~AMDSB8_WDT_DISABLE;
+	val |= AMDSB8_WDT_DEC_EN;
+	pmio_write(pmres, AMDSB8_PM_WDT_EN, val);
+#ifdef AMDSBWD_DEBUG
+	val = pmio_read(pmres, AMDSB8_PM_WDT_EN);
+	device_printf(dev, "AMDSB8_PM_WDT_EN value = %#02x\n", val);
+#endif
+	device_set_desc(dev, "AMD SB8xx Watchdog Timer");
+}
+
 static int
 amdsbwd_probe(device_t dev)
 {
 	struct resource		*res;
+	device_t		smb_dev;
 	uint32_t		addr;
-	uint32_t		val;
 	int			rid;
 	int			rc;
-	int			i;
 
 	/* Do not claim some ISA PnP device by accident. */
 	if (isa_get_logicalid(dev) != 0)
@@ -301,21 +402,16 @@ amdsbwd_probe(device_t dev)
 		return (ENXIO);
 	}
 
-	/* Report cause of previous reset for user's convenience. */
-	val = pmio_read(res, AMDSB_PM_RESET_STATUS0);
-	if (val != 0)
-		amdsbwd_verbose_printf(dev, "ResetStatus0 = %#04x\n", val);
-	val = pmio_read(res, AMDSB_PM_RESET_STATUS1);
-	if (val != 0)
-		amdsbwd_verbose_printf(dev, "ResetStatus1 = %#04x\n", val);
-	if ((val & AMDSB_WD_RST_STS) != 0)
-		device_printf(dev, "Previous Reset was caused by Watchdog\n");
+	smb_dev = pci_find_bsf(0, 20, 0);
+	KASSERT(smb_dev != NULL, ("can't find SMBus PCI device\n"));
+	if (pci_get_revid(smb_dev) < AMDSB8_SMBUS_REVID)
+		amdsbwd_probe_sb7xx(dev, res, &addr);
+	else
+		amdsbwd_probe_sb8xx(dev, res, &addr);
+
+	bus_release_resource(dev, SYS_RES_IOPORT, rid, res);
+	bus_delete_resource(dev, SYS_RES_IOPORT, rid);
 
-	/* Find base address of memory mapped WDT registers. */
-	for (addr = 0, i = 0; i < 4; i++) {
-		addr <<= 8;
-		addr |= pmio_read(res, AMDSB_PM_WDT_BASE_MSB - i);
-	}
 	amdsbwd_verbose_printf(dev, "memory base address = %#010x\n", addr);
 	rc = bus_set_resource(dev, SYS_RES_MEMORY, 0, addr + AMDSB_WD_CTRL,
 	    AMDSB_WDIO_REG_WIDTH);
@@ -330,36 +426,25 @@ amdsbwd_probe(device_t dev)
 		return (ENXIO);
 	}
 
-	/* Set watchdog timer tick to 10ms. */
-	val = pmio_read(res, AMDSB_PM_WDT_CTRL);
-	val &= ~AMDSB_WDT_RES_MASK;
-	val |= AMDSB_WDT_RES_10MS;
-	pmio_write(res, AMDSB_PM_WDT_CTRL, val);
-
-	/* Enable watchdog device (in stopped state). */
-	val = pmio_read(res, AMDSB_PM_WDT_CTRL);
-	val &= ~AMDSB_WDT_DISABLE;
-	pmio_write(res, AMDSB_PM_WDT_CTRL, val);
-
-	/*
-	 * XXX TODO: Ensure that watchdog decode is enabled
-	 * (register 0x41, bit 3).
-	 */
-	bus_release_resource(dev, SYS_RES_IOPORT, rid, res);
-	bus_delete_resource(dev, SYS_RES_IOPORT, rid);
-
-	device_set_desc(dev, "AMD SB600/SB7xx Watchdog Timer");
 	return (0);
 }
 
 static int
 amdsbwd_attach_sb(device_t dev, struct amdsbwd_softc *sc)
 {
+	device_t	smb_dev;
+
 	sc->max_ticks = UINT16_MAX;
-	sc->ms_per_tick = 10;
 	sc->rid_ctrl = 0;
 	sc->rid_count = 1;
 
+	smb_dev = pci_find_bsf(0, 20, 0);
+	KASSERT(smb_dev != NULL, ("can't find SMBus PCI device\n"));
+	if (pci_get_revid(smb_dev) < AMDSB8_SMBUS_REVID)
+		sc->ms_per_tick = 10;
+	else
+		sc->ms_per_tick = 1000;
+
 	sc->res_ctrl = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
 	    &sc->rid_ctrl, RF_ACTIVE);
 	if (sc->res_ctrl == NULL) {
@@ -388,6 +473,11 @@ amdsbwd_attach(device_t dev)
 	if (rc != 0)
 		goto fail;
 
+#ifdef AMDSBWD_DEBUG
+	device_printf(dev, "wd ctrl = %#04x\n", wdctrl_read(sc));
+	device_printf(dev, "wd count = %#04x\n", wdcount_read(sc));
+#endif
+
 	/* Setup initial state of Watchdog Control. */
 	wdctrl_write(sc, AMDSB_WD_FIRED);
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 22 Andriy Gapon freebsd_committer freebsd_triage 2011-06-22 08:21:58 UTC
State Changed
From-To: patched->closed

Support for the new chipset has been added.