From: Matthew Dillon Date: Mon, 8 Nov 2004 16:50:33 +0000 (+0000) Subject: Do not explicitly set PCIM_CMD_SERRESPEN or PCIM_CMD_PERRESPEN. This was X-Git-Tag: v2.0.1~9821 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/60955de8ed4d81bdfa25167b4506f1f1b7c80754 Do not explicitly set PCIM_CMD_SERRESPEN or PCIM_CMD_PERRESPEN. This was set in FreeBSD to try to catch device problems, but it looks like we actually found a device that blows up with an NMI during fwohci_init() so we no longer set these bits. OpenBSD doesn't set it. My theory is that the device is not clearing its internal memory leaving some of it in a parity-adverse state, causing accesses to the uninitialized memory to fail. Alternatively the hardware is just plain broken, but it seems to probe fine without the bit set so... Gabor's-hardware: AMD Athlon 64 3000+ based system. fwohci0: mem 0xd0000000-0xd0003fff,0xd0008000-0xd00087ff irq 11 at device 6.0 on pci0 fwohci0: OHCI version 1.10 (ROM=1) fwohci0: No. of Isochronous channel is 4. fwohci0: EUI64 00:90:f5:00:00:32:10:37 fwohci0: Phy 1394a available S400, 1 ports. fwohci0: Link S400, max_rec 2048 bytes. NMI-Reported-by: Gabor MICSKO --- diff --git a/sys/bus/firewire/fwohci_pci.c b/sys/bus/firewire/fwohci_pci.c index 10368ba0f7..61ee30c0f1 100644 --- a/sys/bus/firewire/fwohci_pci.c +++ b/sys/bus/firewire/fwohci_pci.c @@ -32,7 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/firewire/fwohci_pci.c,v 1.38 2004/01/23 17:37:09 simokawa Exp $ - * $DragonFly: src/sys/bus/firewire/fwohci_pci.c,v 1.15 2004/07/18 12:37:03 asmodai Exp $ + * $DragonFly: src/sys/bus/firewire/fwohci_pci.c,v 1.16 2004/11/08 16:50:33 dillon Exp $ */ #define BOUNCE_BUFFER_TEST 0 @@ -233,12 +233,23 @@ fwohci_pci_init(device_t self) int olatency, latency, ocache_line, cache_line; u_int16_t cmd; + /* + * Clear PCIM_CMD_MWRICEN as per FreeBSD/1.20, but note that the + * problem may have been related to SERR and PERR being + * unconditionally enabled in that rev. + * + * Do not change the SERRESPEN or PERRESPEN bits. Use the BIOS + * values (probably off). This crashes some machines in fwohci_init(). + * + * The theory here is that the device may not be properly initializing + * its on-chip memory, leaving some of it in a parity errored state, + * and enabling parity check may result in the device blowing up. + * It's also possible that some hardware is just plain broken. OpenBSD + * does not turn on SERRESPEN or PERRESPEN so we won't either. + */ cmd = pci_read_config(self, PCIR_COMMAND, 2); - cmd |= PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN | PCIM_CMD_MWRICEN | - PCIM_CMD_SERRESPEN | PCIM_CMD_PERRESPEN; -#if 1 + cmd |= PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN; cmd &= ~PCIM_CMD_MWRICEN; -#endif pci_write_config(self, PCIR_COMMAND, cmd, 2); latency = olatency = pci_read_config(self, PCIR_LATTIMER, 1);