@@ -288,7 +288,7 @@ impl AmlValue {
288
288
}
289
289
}
290
290
291
- pub fn as_integer ( & self , context : & AmlContext ) -> Result < u64 , AmlError > {
291
+ pub fn as_integer ( & self , context : & mut AmlContext ) -> Result < u64 , AmlError > {
292
292
match self {
293
293
AmlValue :: Integer ( value) => Ok ( * value) ,
294
294
AmlValue :: Boolean ( value) => Ok ( if * value { u64:: max_value ( ) } else { 0 } ) ,
@@ -320,7 +320,7 @@ impl AmlValue {
320
320
}
321
321
}
322
322
323
- pub fn as_buffer ( & self , context : & AmlContext ) -> Result < Arc < Spinlock < Vec < u8 > > > , AmlError > {
323
+ pub fn as_buffer ( & self , context : & mut AmlContext ) -> Result < Arc < Spinlock < Vec < u8 > > > , AmlError > {
324
324
match self {
325
325
AmlValue :: Buffer ( ref bytes) => Ok ( bytes. clone ( ) ) ,
326
326
// TODO: implement conversion of String and Integer to Buffer
@@ -330,7 +330,7 @@ impl AmlValue {
330
330
}
331
331
}
332
332
333
- pub fn as_string ( & self , context : & AmlContext ) -> Result < String , AmlError > {
333
+ pub fn as_string ( & self , context : & mut AmlContext ) -> Result < String , AmlError > {
334
334
match self {
335
335
AmlValue :: String ( ref string) => Ok ( string. clone ( ) ) ,
336
336
// TODO: implement conversion of Buffer to String
@@ -404,7 +404,7 @@ impl AmlValue {
404
404
/// `Integer` from: `Buffer`, `BufferField`, `DdbHandle`, `FieldUnit`, `String`, `Debug`
405
405
/// `Package` from: `Debug`
406
406
/// `String` from: `Integer`, `Buffer`, `Debug`
407
- pub fn as_type ( & self , desired_type : AmlType , context : & AmlContext ) -> Result < AmlValue , AmlError > {
407
+ pub fn as_type ( & self , desired_type : AmlType , context : & mut AmlContext ) -> Result < AmlValue , AmlError > {
408
408
// If the value is already of the correct type, just return it as is
409
409
if self . type_of ( ) == desired_type {
410
410
return Ok ( self . clone ( ) ) ;
@@ -423,7 +423,7 @@ impl AmlValue {
423
423
424
424
/// Reads from a field of an opregion, returning either a `AmlValue::Integer` or an `AmlValue::Buffer`,
425
425
/// depending on the size of the field.
426
- pub fn read_field ( & self , context : & AmlContext ) -> Result < AmlValue , AmlError > {
426
+ pub fn read_field ( & self , context : & mut AmlContext ) -> Result < AmlValue , AmlError > {
427
427
if let AmlValue :: Field { region, flags, offset, length } = self {
428
428
let _maximum_access_size = {
429
429
if let AmlValue :: OpRegion { region, .. } = context. namespace . get ( * region) ? {
0 commit comments