viaquirks.java

来自「纯java操作系统jnode,安装简单和操作简单的个人使用的Java操作系统」· Java 代码 · 共 54 行

JAVA
54
字号
/*
 * $Id: ViaQuirks.java,v 1.1 2003/11/25 11:42:32 epr Exp $
 */
package org.jnode.driver.chipset.via;

import org.apache.log4j.Logger;
import org.jnode.driver.pci.PCIDevice;
import org.jnode.driver.pci.PCI_IDs;

/**
 * Various fixed for the Via chipset.
 * 
 * @author Ewout Prangsma (epr@users.sourceforge.net)
 */
public class ViaQuirks {

	/**
	 * Lantency fix with the system contains a buggy southbridge.
	 * @param dev
	 * @param log
	 */
	public static void applyLatencyFix(PCIDevice dev, Logger log) {

		PCIDevice d = dev.getPCIBusAPI().findDevice(PCI_IDs.PCI_VENDOR_ID_VIATEC, 0x686);
		if (d != null) {
			// For revision 0x40-0x42 we have a buggy southbridge.
			final int rev = d.getConfig().getRevision();

			if ((rev >= 0x40) && (rev <= 0x42)) {
				/*
				 * Ok we have the problem. Now set the PCI master grant to occur every master
				 * grant. The apparent bug is that under high PCI load (quite common in Linux of
				 * course) you can get data loss when the CPU is held off the bus for 3 bus master
				 * requests This happens to include the IDE controllers....
				 * 
				 * VIA only apply this fix when an SB Live! is present but under both Linux and
				 * Windows this isnt enough, and we have seen corruption without SB Live! but with
				 * things like 3 UDMA IDE controllers. So we ignore that bit of the VIA
				 * recommendation..
				 */

				int busarb = dev.readConfigByte(0x76);
				/*
				 * Set bit 4 and bi 5 of byte 76 to 0x01
				 */
				busarb &= ~(1 << 5);
				busarb |= (1 << 4);
				dev.writeConfigByte(0x76, busarb);
				log.debug("Applying VIA southbridge workaround on device " + dev.getPCIName());
			}
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?