Skip to content

Commit 4ceaa01

Browse files
committed
aml: handle legacy DefProcessor operations
1 parent 5185140 commit 4ceaa01

File tree

2 files changed

+28
-6
lines changed

2 files changed

+28
-6
lines changed

aml/src/lib.rs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,25 @@ impl Interpreter {
616616
let old_scope = mem::replace(&mut context.current_scope, new_scope);
617617
context.start_new_block(BlockKind::Scope { old_scope }, remaining_length);
618618
}
619+
Opcode::Processor => {
620+
let start_pc = context.current_block.pc;
621+
let pkg_length = context.pkglength()?;
622+
let name = context.namestring()?;
623+
let proc_id = context.next()?;
624+
let pblk_address = context.next_u32()?;
625+
let pblk_length = context.next()?;
626+
627+
let remaining_length = pkg_length - (context.current_block.pc - start_pc);
628+
629+
let new_scope = name.resolve(&context.current_scope)?;
630+
let object = Object::Processor { proc_id, pblk_address, pblk_length };
631+
let mut namespace = self.namespace.lock();
632+
namespace.add_level(new_scope.clone(), NamespaceLevelKind::Processor)?;
633+
namespace.insert(new_scope.clone(), Arc::new(object))?;
634+
635+
let old_scope = mem::replace(&mut context.current_scope, new_scope);
636+
context.start_new_block(BlockKind::Scope { old_scope }, remaining_length);
637+
}
619638
Opcode::PowerRes => {
620639
let start_pc = context.current_block.pc;
621640
let pkg_length = context.pkglength()?;
@@ -626,9 +645,10 @@ impl Interpreter {
626645
let remaining_length = pkg_length - (context.current_block.pc - start_pc);
627646

628647
let new_scope = name.resolve(&context.current_scope)?;
648+
let object = Object::PowerResource { system_level, resource_order };
629649
let mut namespace = self.namespace.lock();
630650
namespace.add_level(new_scope.clone(), NamespaceLevelKind::PowerResource)?;
631-
namespace.insert(new_scope.clone(), Arc::new(Object::PowerResource))?;
651+
namespace.insert(new_scope.clone(), Arc::new(object))?;
632652

633653
let old_scope = mem::replace(&mut context.current_scope, new_scope);
634654
context.start_new_block(BlockKind::Scope { old_scope }, remaining_length);
@@ -982,6 +1002,7 @@ impl MethodContext {
9821002
0x5b80 => Opcode::OpRegion,
9831003
0x5b81 => Opcode::Field,
9841004
0x5b82 => Opcode::Device,
1005+
0x5b83 => Opcode::Processor,
9851006
0x5b84 => Opcode::PowerRes,
9861007
0x5b85 => Opcode::ThermalZone,
9871008
0x5b86 => Opcode::IndexField,
@@ -1232,6 +1253,7 @@ enum Opcode {
12321253
OpRegion,
12331254
Field,
12341255
Device,
1256+
Processor,
12351257
PowerRes,
12361258
ThermalZone,
12371259
IndexField,

aml/src/object.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::{AmlError, op_region::OpRegion};
2-
use alloc::{sync::Arc, vec::Vec};
2+
use alloc::{string::String, sync::Arc, vec::Vec};
33
use bit_field::BitField;
44

55
#[derive(Debug)]
@@ -16,8 +16,8 @@ pub enum Object {
1616
Reference(Arc<Object>),
1717
OpRegion(OpRegion),
1818
Package(Vec<Arc<Object>>),
19-
PowerResource,
20-
Processor,
19+
PowerResource { system_level: u8, resource_order: u16 },
20+
Processor { proc_id: u8, pblk_address: u32, pblk_length: u8 },
2121
RawDataBuffer,
2222
String(String),
2323
ThermalZone,
@@ -80,8 +80,8 @@ impl Object {
8080
Object::Reference(object) => object.typ(),
8181
Object::OpRegion(_) => ObjectType::OpRegion,
8282
Object::Package(_) => ObjectType::Package,
83-
Object::PowerResource => ObjectType::PowerResource,
84-
Object::Processor => ObjectType::Processor,
83+
Object::PowerResource { .. } => ObjectType::PowerResource,
84+
Object::Processor { .. } => ObjectType::Processor,
8585
Object::RawDataBuffer => ObjectType::RawDataBuffer,
8686
Object::String(_) => ObjectType::String,
8787
Object::ThermalZone => ObjectType::ThermalZone,

0 commit comments

Comments
 (0)