Skip to content

Commit

Permalink
Update ACPILib with last @MishaTy changes
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinbreiz committed Jun 19, 2022
1 parent 0dadc0b commit 78d9068
Show file tree
Hide file tree
Showing 9 changed files with 755 additions and 524 deletions.
6 changes: 5 additions & 1 deletion source/Cosmos.Core/ACPI/ACPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -814,8 +814,11 @@ private static void SearchPackage(ParseNode op)

if (op.Arguments[x].ToString() == "Package")
{
var arg = (ParseNode)op.Arguments[x];
Global.mDebugger.Send("Package found!");

//var arg = (ParseNode)op.Arguments[x];

/*
for (int y = 0; y < arg.Nodes.Count; y++)
{
List<ParseNode> package = arg.Nodes[y].Nodes;
Expand All @@ -830,6 +833,7 @@ private static void SearchPackage(ParseNode op)
IrqRoutingTable.Add(irqRouting);
}
*/
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion source/Cosmos.Core/ACPI/AML/Definitions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace ACPILib.AML
namespace ACPILibs.AML
{
public class Definitions
{
Expand Down
2 changes: 1 addition & 1 deletion source/Cosmos.Core/ACPI/AML/OpCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ private string GetName(OpCodeEnum code)
return name;
}

public override string ToString()
public override string ToString()
{
return Name;
}
Expand Down
236 changes: 118 additions & 118 deletions source/Cosmos.Core/ACPI/AML/OpCodeTable.cs

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions source/Cosmos.Core/ACPI/Interupter/EisaId.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ACPIAML.Interupter
{
public class EisaId
{
public static string ToText(long ID)
{
var vendor = ID & 0xFFFF;
var device = ID >> 16;
var device1 = device & 0xFF;
var device2 = device >> 8;
var vendor_rev = ((vendor & 0xFF) << 8) | vendor >> 8;
var vendor1 = ((vendor_rev >> 10)&0x1f)+64;
var vendor2 = ((vendor_rev >> 5)&0x1f)+64;
var vendor3= ((vendor_rev >> 0)&0x1f)+64;

string vendorStr = new(new char[] { (char)vendor1 , (char)vendor2 , (char)vendor3 });
return vendorStr + device1.ToString("X2") + device2.ToString("X2");
}
}
}
69 changes: 69 additions & 0 deletions source/Cosmos.Core/ACPI/Interupter/StackObject.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
using ACPILib.Parser2;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ACPIAML.Interupter
{
public class StackObject
{
private StackObject()
{

}

public object? Value;
public StackObjectType Type;

public static StackObject Create(string s)
{
return new() { Type = StackObjectType.String, Value = s };
}
public static StackObject Create(ParseNode s)
{
return new() { Type = StackObjectType.ParseNode, Value = s };
}
public static StackObject Create(byte s)
{
return new() { Type = StackObjectType.Byte, Value = s };
}
public static StackObject Create(short s)
{
return new() { Type = StackObjectType.Word, Value = s };
}
public static StackObject Create(int s)
{
return new() { Type = StackObjectType.DWord, Value = s };
}
public static StackObject Create(long s)
{
return new() { Type = StackObjectType.QWord, Value = s };
}
public static StackObject Create(byte[] s)
{
return new() { Type = StackObjectType.ByteArray, Value = s };
}
}
public enum StackObjectType
{
Null,
ParseNode,
String,
Byte,
ByteArray,
/// <summary>
/// short
/// </summary>
Word,
/// <summary>
/// int
/// </summary>
DWord,
/// <summary>
/// long
/// </summary>
QWord,
}
}
2 changes: 1 addition & 1 deletion source/Cosmos.Core/ACPI/Parser/Parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ private void ParseOp(AMLOp op, bool isMethodBody)
break;

default:
throw new NotImplementedException();
throw new NotImplementedException("Unknown opcode");
}
}
}
Expand Down
7 changes: 4 additions & 3 deletions source/Cosmos.Core/ACPI/Parser2/ParseNode.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using ACPILib.AML;
using ACPIAML.Interupter;
using ACPILib.AML;
using System.Collections.Generic;

namespace ACPILib.Parser2
Expand All @@ -17,8 +18,8 @@ public long End
get { return Start + Length + Op.CodeByteSize; }
}

public object ConstantValue;
public List<object> Arguments = new List<object>();
public StackObject? ConstantValue;
public List<StackObject> Arguments = new List<StackObject>();
public List<ParseNode> Nodes = new List<ParseNode>();

public override string ToString()
Expand Down

0 comments on commit 78d9068

Please sign in to comment.