public static AcpiTable GetAcpiTable(UInt32 tableId) { var data = FirmwareTables.GetFirmwareTable(FirmwareTableType.Acpi, tableId); return(new AcpiTable(data)); }
protected override Int32 Execute() { if (_commandLineParser.IsOptionSet("l", "list")) { foreach (FirmwareTableType tableType in Enum.GetValues(typeof(FirmwareTableType))) { var tableIds = FirmwareTables.EnumFirmwareTables(tableType); foreach (var tableId in tableIds) { Console.WriteLine("0x{0:X8} '{1}' - 0x{2:X8} '{3}'", (UInt32)tableType, tableType.ToString().ToUpper(), tableId, FirmwareTables.UInt32ToString(tableId)); } } } else if (_commandLineParser.IsOptionSet("s", "save")) { if ((_commandLineParser.FileNames.Length < 2) || (_commandLineParser.FileNames.Length > 3)) { Help(); } var tableType = MakeUInt32(_commandLineParser.FileNames[0]); var tableId = MakeUInt32(_commandLineParser.FileNames[1]); var data = FirmwareTables.GetFirmwareTable(tableType, tableId); var fileName = 3 == _commandLineParser.FileNames.Length ? _commandLineParser.FileNames[2] : FormatFileName(tableType, tableId); File.WriteAllBytes(fileName, data); Console.WriteLine("OK: '{0}' ({1:N0} bytes)", fileName, data.Length); } else if (_commandLineParser.IsOptionSet("a", "all")) { foreach (FirmwareTableType tableType in Enum.GetValues(typeof(FirmwareTableType))) { var tableIds = FirmwareTables.EnumFirmwareTables(tableType); foreach (var tableId in tableIds) { var data = FirmwareTables.GetFirmwareTable(tableType, tableId); var fileName = FormatFileName((UInt32)tableType, tableId); File.WriteAllBytes(fileName, data); Console.WriteLine("'{0}' ({1:N0} bytes)", fileName, data.Length); } } Console.WriteLine("All OK"); } else if (_commandLineParser.IsOptionSet("d", "decode")) { if ((_commandLineParser.FileNames.Length < 1) || (_commandLineParser.FileNames.Length > 2)) { Help(); } var tableType = MakeUInt32(_commandLineParser.FileNames[0]); if (tableType != (UInt32)FirmwareTableType.Acpi) { throw new NotSupportedException("Only the following frimware tables can be decoded: ACPI"); } if (2 == _commandLineParser.FileNames.Length) { var tableId = MakeUInt32(_commandLineParser.FileNames[1]); DecodeAcpiTable(tableId); } else { var tableIds = FirmwareTables.EnumFirmwareTables(tableType); foreach (var tableId in tableIds) { DecodeAcpiTable(tableId); Console.WriteLine(); } } } #if false else if (_commandLineParser.IsOptionSet("i", "info")) { var tableIds = FirmwareTables.EnumFirmwareTables(FirmwareTableType.Acpi); foreach (var tableId in tableIds) { var acpiTable = FirmwareTables.GetAcpiTable(tableId); switch (acpiTable.Signature.ToUpper()) { case "DBGP": break; } } } #endif else { Help(); } return(0); }