summaryrefslogtreecommitdiffstats
path: root/sys/pci
diff options
context:
space:
mode:
authoryongari <yongari@FreeBSD.org>2007-10-12 03:32:55 +0000
committeryongari <yongari@FreeBSD.org>2007-10-12 03:32:55 +0000
commite279fe58cfce32d714c22d04c3909696223222a2 (patch)
tree89d0b120e47cd0d2a20b2d552b4025a3de8b470c /sys/pci
parent077949141caa2f215bb8b94d2cba31674587b28c (diff)
downloadFreeBSD-src-e279fe58cfce32d714c22d04c3909696223222a2.zip
FreeBSD-src-e279fe58cfce32d714c22d04c3909696223222a2.tar.gz
Not all VIA Rhine chips support 256 register space. So touching
VR_STICKHW register would result in unexpected results on these hardwares. wpaul said the following for the issue. The vr_attach() routine unconditionally does this for all supported chips: /* * Windows may put the chip in suspend mode when it * shuts down. Be sure to kick it in the head to wake it * up again. */ VR_CLRBIT(sc, VR_STICKHW, (VR_STICKHW_DS0|VR_STICKHW_DS1)); The problem is, the VR_STICKHW register is not valid on all Rhine devices. The VT86C100A chip, which is present on the D-Link DFE-530TX boards, doesn't support power management, and its register space is only 128 bytes wide. The VR_STICKHW register offset falls outside this range. This may go unnoticed in most scenarios, but if you happen to have another PCI device in your system which is assigned the register space immediately after that of the Rhine, the vr(4) driver will incorrectly stomp it. In my case, the BIOS on my test board decided to put the register space for my PRO/100 ethernet board right next to the Rhine, and the Rhine driver ended up clobbering the IMR register of the PRO/100 device. (Long story short: the board kept locking up on boot. Took me the better part of the morning suss out why.) The strictly correct thing to do would be to check the PCI config space to make sure the device supports the power management capability and only write to the VR_STICKHW register if it does. Instead of inspecting chip revision numbers for the availability of VR_STICKHW register, check the existence of power management capability of the hardware as wpaul suggested. Reported by: wpaul Suggested by: wpaul OK'ed by: jhb
Diffstat (limited to 'sys/pci')
-rw-r--r--sys/pci/if_vr.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/pci/if_vr.c b/sys/pci/if_vr.c
index e5a7d7d..dd514ee 100644
--- a/sys/pci/if_vr.c
+++ b/sys/pci/if_vr.c
@@ -90,6 +90,7 @@ __FBSDID("$FreeBSD$");
#include <dev/mii/miivar.h>
+#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#define VR_USEIOSPACE
@@ -513,6 +514,7 @@ vr_attach(device_t dev)
struct ifnet *ifp;
int error = 0, rid;
struct vr_type *t;
+ int pmc;
sc = device_get_softc(dev);
sc->vr_dev = dev;
@@ -591,7 +593,8 @@ vr_attach(device_t dev)
* shuts down. Be sure to kick it in the head to wake it
* up again.
*/
- VR_CLRBIT(sc, VR_STICKHW, (VR_STICKHW_DS0|VR_STICKHW_DS1));
+ if (pci_find_extcap(dev, PCIY_PMG, &pmc) == 0)
+ VR_CLRBIT(sc, VR_STICKHW, (VR_STICKHW_DS0|VR_STICKHW_DS1));
/* Reset the adapter. */
vr_reset(sc);
OpenPOWER on IntegriCloud