rootsystemdescriptiontable.java

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

JAVA
92
字号
/*
 * $Id: RootSystemDescriptionTable.java,v 1.1 2003/11/25 11:42:14 epr Exp $
 */
package org.jnode.driver.acpi;

import java.util.Hashtable;

import org.jnode.driver.acpi.aml.ParseNode;
import org.jnode.system.MemoryResource;
import org.jnode.system.ResourceManager;
import org.jnode.system.ResourceNotFreeException;
import org.jnode.system.ResourceOwner;
import org.jnode.system.SimpleResourceOwner;

/**
 * RootSystemDescriptionTable.
 * 
 * <p>
 * Title:
 * </p>
 * <p>
 * Description:
 * </p>
 * <p>
 * Licence: GNU LGPL
 * </p>
 * <p>
 * </p>
 * 
 * @author Francois-Frederic Ozog
 * @version 1.0
 */

public class RootSystemDescriptionTable extends AcpiSystemTable {

	Hashtable tables = new Hashtable();

	public RootSystemDescriptionTable(ResourceManager rm, MemoryResource tableResource) {
		super(rm, tableResource);

	}

	public DifferentiatedSystemDescriptionTable getDSDT() {
		FixedAcpiDescriptionTable facp = getFACP();
		if (facp != null)
			return facp.getDSDT();
		else
			return null;
	}

	public FirmwareAcpiControlStructure getFACS() {
		FixedAcpiDescriptionTable facp = getFACP();
		if (facp != null)
			return facp.getFACS();
		else
			return null;
	}

	public FixedAcpiDescriptionTable getFACP() {
		FixedAcpiDescriptionTable facp = (FixedAcpiDescriptionTable) tables.get("FACP");
		return facp;
	}

	public void parse() throws ResourceNotFreeException {
		int startOfTablePointers = 36;
		int tablesCount = (this.table.length - startOfTablePointers) / 4;
		final ResourceOwner owner = new SimpleResourceOwner("ACPI-RootSystemDescriptionTable");
		for (int index = 0; index < tablesCount; index++) {
			// log.debug("Handling RSDT index " + index + "/" + tablesCount);
			AcpiTable newtable = null;
			try {
				if (index < 1)
					newtable = AcpiTable.getTable(owner, rm, tableResource.getInt(startOfTablePointers + index * 4));
			} catch (Exception ex) {
				ex.printStackTrace();
			}
			if (newtable != null) {
				tables.put(newtable.signature, newtable);
				newtable.parse();
			}

		}
	}

	public ParseNode getParsedAml() {
		DifferentiatedSystemDescriptionTable dsdt = this.getDSDT();
		if (dsdt != null)
			return dsdt.getParsedAml();
		return null;
	}

}

⌨️ 快捷键说明

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