public void GetPackgeData(AcpiNS acpiNS) { if (acpiLib != null) { int type = -1; type = acpiLib.GetType(acpiNS.Path); if (type != -1) { ushort utype = (ushort)type; IntPtr intPtr = acpiLib.GetValue(acpiNS.Path, ref utype); if (intPtr != IntPtr.Zero) { UInt32 val = (UInt32)Marshal.ReadInt32(intPtr); if (val == 0x426F6541) { int DataLength = Marshal.ReadInt32(intPtr + 0x4); // copy the package buffer to byte if (acpiNS.pbValue == null) { acpiNS.pbValue = new byte[DataLength]; Marshal.Copy(intPtr, acpiNS.pbValue, 0, DataLength); } } acpiLib.FreeArg(intPtr); } } } }
/// <summary> /// Check any data defined in method is not created by acpi subsystem and recreate it /// </summary> /// <param name="acpiNS">acpi name space</param> public void GetMethodData(AcpiNS acpiNS) { if (acpiLib != null) { //Get the AML of Method //int type = -1; //type = acpiLib.GetType(acpiNS.Path); //if (type != -1) //{ // ushort utype = (ushort)type; // IntPtr intPtr = acpiLib.GetValue(acpiNS.Path, ref utype); // if (intPtr != IntPtr.Zero) // { // int DataLength = Marshal.ReadInt32(intPtr + 0x4); // // copy the method buffer to byte // if (acpiNS.pbValue == null) // { // acpiNS.pbValue = new byte[DataLength]; // Marshal.Copy(intPtr, acpiNS.pbValue, 0, DataLength); // } // acpiLib.FreeArg(intPtr); // } //} // Get the text of method //acpiLib.GetAslCode(acpiNS.Path, ref acpiNS.strValue); } }
public AcpiNS GetNS(string path, int type) { AcpiNS acpiNS = new AcpiNS(path, type); if (mAcpiGetDataMap.ContainsKey(acpiNS.Type)) { mAcpiGetDataMap[acpiNS.Type].Invoke(acpiNS); } return(acpiNS); }
public AcpiNS AddChildItem(string path, int type) { AcpiNS acpiNS = new AcpiNS(path, type); //acpiNS.SetParent(acpiNSRoot); acpiScope.AddChild(acpiNS); if (mAcpiGetDataMap.ContainsKey(acpiNS.Type)) { mAcpiGetDataMap[acpiNS.Type].Invoke(acpiNS); } return(acpiNS); }
/* * Get the raw interger data from acpi libary */ public void GetIntData(AcpiNS acpiNS) { if (acpiLib != null) { int type = -1; type = acpiLib.GetType(acpiNS.Path); if (type != -1) { ushort utype = (ushort)type; IntPtr intPtr = acpiLib.GetValue(acpiNS.Path, ref utype); if (intPtr != IntPtr.Zero) { acpiNS.ulValue = (UInt64)Marshal.ReadInt64(intPtr + 0x10); acpiLib.FreeArg(intPtr); } } } }
public void GetFieldData(AcpiNS acpiNS) { if (acpiLib != null) { //int type = -1; //type = acpiLib.GetType(acpiNS.Path); //if (type != -1) //{ // ushort utype = (ushort)type; // IntPtr intPtr = acpiLib.GetValue(acpiNS.Path, ref utype); // if (intPtr != IntPtr.Zero) // { // int DataLength = Marshal.ReadInt32(intPtr + 0x4); // acpiLib.FreeArg(intPtr); // } //} } }
public void GetStringData(AcpiNS acpiNS) { if (acpiLib != null) { int type = -1; type = acpiLib.GetType(acpiNS.Path); if (type != -1) { ushort utype = (ushort)type; IntPtr intPtr = acpiLib.GetValue(acpiNS.Path, ref utype); if (intPtr != IntPtr.Zero) { // acpi string is all ansi code acpiNS.strValue = Marshal.PtrToStringAnsi(intPtr + 0x10); acpiLib.FreeArg(intPtr); } } } }
/// <summary> /// Constructor - Initialize the private data before furthur operation. /// </summary> public AmlBuilder() { if (mAcpiTypeMap.Count == 0) { InitAcpiTypeMap(); } if (mAcpiGetDataMap.Count == 0) { mAcpiGetDataMap["Method"] = GetMethodData; mAcpiGetDataMap["Integer"] = GetIntData; mAcpiGetDataMap["String"] = GetStringData; mAcpiGetDataMap["Buffer"] = GetBufferData; mAcpiGetDataMap["Pacakge"] = GetPackgeData; mAcpiGetDataMap["FieldUnit"] = GetFieldData; } if (acpiNSRoot == null) { acpiNSRoot = new AcpiNS("\\___", -1); } acpiScope = acpiNSRoot; }
/// <summary> /// Add a child name space to current name space /// </summary> /// <param name="childItem">child item</param> public void AddChild(AcpiNS childItem) { childItem.Parent = this; ChildItems.Add(childItem); }
public void SetCurrentPath(AcpiNS acpiNS) { //acpiScope.GetLast(); acpiScope = acpiNS; }