Bug 123734 - [patch] Chipset VIA CX700 requires extra initialization
Summary: [patch] Chipset VIA CX700 requires extra initialization
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: 7.0-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2008-05-16 17:50 UTC by skif
Modified: 2022-10-17 12:36 UTC (History)
0 users

See Also:


Attachments
file.txt (737 bytes, text/plain)
2008-05-16 17:50 UTC, skif
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description skif 2008-05-16 17:50:00 UTC
I had got mini PC eBox-4854 made by DMP Electronics Inc. ( http://www.compactpc.com.tw/ebox-4854.htm ) and found onboard NIC (Realtek 8100B) and mini-PCI Wi-Fi module didn't work with errors:
rl0: watchdog timeout
and
ath0: ath_chan_set: unable to reset channel ...
Booting FreeBSD on another eBox-4854, playing with BIOS and sysctl settings, switching  ACPI/APIC and compiling custom kernels didn't help.
OpenBSD 4.3 experienced the same problems.
But in Linux (fc7) both devices worked OK.
This box uses VIA CX700M chipset, so I grep-ped linux kernel sources and found interesting piece of code:

/*
 * Disable PCI Bus Parking and PCI Master read caching on CX700
 * which causes unspecified timing errors with a VT6212L on the PCI
 * bus leading to USB2.0 packet loss. The defaults are that these
 * features are turned off but some BIOSes turn them on.
 */

uint8_t b;
if (pci_read_config_byte(dev, 0x76, &b) == 0) {
  if (b & 0x40) {
    /* Turn off PCI Bus Parking */
    pci_write_config_byte(dev, 0x76, b ^ 0x40);

    dev_info(&dev->dev,
      "Disabling VIA CX700 PCI parking\n");
   }
}

if (pci_read_config_byte(dev, 0x72, &b) == 0) {
  if (b != 0) {
    /* Turn off PCI Master read caching */
    pci_write_config_byte(dev, 0x72, 0x0);

    /* Set PCI Master Bus time-out to "1x16 PCLK" */
    pci_write_config_byte(dev, 0x75, 0x1);

    /* Disable "Read FIFO Timer" */
    pci_write_config_byte(dev, 0x77, 0x0);

    dev_info(&dev->dev,
      "Disabling VIA CX700 PCI caching\n");
  }
}

Here dev is
    vendor = 0x1106 'VIA Technologies Inc'
    device = 0x324e 'CX700 Internal Module Bus'
    class  = 0x060000 'HOST-PCI bridge'

Being done on FreeBSD, these steps fix the problem till the next system boot.

Fix: I think BIOS developers but not OS developers must fix this problem. But as long as not all of them do it, it will be good to include this quirk in FreeBSD's kernel code. Anyway, there is my script /usr/local/etc/rc.d/cx700fix in the attach.

Patch attached with submission follows:
How-To-Repeat: Boot FreeBSD on PC, based on VIA CX700* chipset. If BIOS doesn't initialize chipset correctly, like in my case, problem with some PCI devices using DMA transfer should appear.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2008-05-19 00:59:12 UTC
Responsible Changed
From-To: freebsd-i386->freebsd-rc

The patch is for a new rc file, but I'm not entirely sure that this 
is the best approach.  Perhaps the rc folks can evaluate.
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:00:16 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 3 Graham Perrin freebsd_committer freebsd_triage 2022-10-17 12:36:56 UTC
Keyword: 

    patch
or  patch-ready

– in lieu of summary line prefix: 

    [patch]

* bulk change for the keyword
* summary lines may be edited manually (not in bulk). 

Keyword descriptions and search interface: 

    <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>