@@ -288,7 +288,7 @@ impl AmlValue {
288288 }
289289 }
290290
291- pub fn as_integer ( & self , context : & AmlContext ) -> Result < u64 , AmlError > {
291+ pub fn as_integer ( & self , context : & mut AmlContext ) -> Result < u64 , AmlError > {
292292 match self {
293293 AmlValue :: Integer ( value) => Ok ( * value) ,
294294 AmlValue :: Boolean ( value) => Ok ( if * value { u64:: max_value ( ) } else { 0 } ) ,
@@ -320,7 +320,7 @@ impl AmlValue {
320320 }
321321 }
322322
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 > {
324324 match self {
325325 AmlValue :: Buffer ( ref bytes) => Ok ( bytes. clone ( ) ) ,
326326 // TODO: implement conversion of String and Integer to Buffer
@@ -330,7 +330,7 @@ impl AmlValue {
330330 }
331331 }
332332
333- pub fn as_string ( & self , context : & AmlContext ) -> Result < String , AmlError > {
333+ pub fn as_string ( & self , context : & mut AmlContext ) -> Result < String , AmlError > {
334334 match self {
335335 AmlValue :: String ( ref string) => Ok ( string. clone ( ) ) ,
336336 // TODO: implement conversion of Buffer to String
@@ -404,7 +404,7 @@ impl AmlValue {
404404 /// `Integer` from: `Buffer`, `BufferField`, `DdbHandle`, `FieldUnit`, `String`, `Debug`
405405 /// `Package` from: `Debug`
406406 /// `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 > {
408408 // If the value is already of the correct type, just return it as is
409409 if self . type_of ( ) == desired_type {
410410 return Ok ( self . clone ( ) ) ;
@@ -423,7 +423,7 @@ impl AmlValue {
423423
424424 /// Reads from a field of an opregion, returning either a `AmlValue::Integer` or an `AmlValue::Buffer`,
425425 /// 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 > {
427427 if let AmlValue :: Field { region, flags, offset, length } = self {
428428 let _maximum_access_size = {
429429 if let AmlValue :: OpRegion { region, .. } = context. namespace . get ( * region) ? {
0 commit comments