@@ -130,10 +130,9 @@ where
130130 Ok ( ( ) )
131131 }
132132
133- /// Invoke a method by its name, with the given set of arguments. If the referenced object is
134- /// not a method, the object will instead be returned - this is useful for objects that can
135- /// either be defined directly, or through a method (e.g. a `_CRS` object).
136- pub fn invoke_method ( & self , path : AmlName , args : Vec < WrappedObject > ) -> Result < WrappedObject , AmlError > {
133+ /// Evaluate an object at the given path in the namespace. If the object is a method, this
134+ /// invokes the method with the given set of arguments.
135+ pub fn evaluate ( & self , path : AmlName , args : Vec < WrappedObject > ) -> Result < WrappedObject , AmlError > {
137136 trace ! ( "Invoking AML method: {}" , path) ;
138137
139138 let object = self . namespace . lock ( ) . get ( path. clone ( ) ) ?. clone ( ) ;
@@ -147,12 +146,12 @@ where
147146 }
148147 }
149148
150- pub fn invoke_method_if_present (
149+ pub fn evaluate_if_present (
151150 & self ,
152151 path : AmlName ,
153152 args : Vec < WrappedObject > ,
154153 ) -> Result < Option < WrappedObject > , AmlError > {
155- match self . invoke_method ( path. clone ( ) , args) {
154+ match self . evaluate ( path. clone ( ) , args) {
156155 Ok ( result) => Ok ( Some ( result) ) ,
157156 Err ( AmlError :: ObjectDoesNotExist ( not_present) ) => {
158157 if path == not_present {
@@ -181,10 +180,10 @@ where
181180 /*
182181 * This should match the initialization order of ACPICA and uACPI.
183182 */
184- if let Err ( err) = self . invoke_method_if_present ( AmlName :: from_str ( "\\ _INI" ) . unwrap ( ) , vec ! [ ] ) {
183+ if let Err ( err) = self . evaluate ( AmlName :: from_str ( "\\ _INI" ) . unwrap ( ) , vec ! [ ] ) {
185184 warn ! ( "Invoking \\ _INI failed: {:?}" , err) ;
186185 }
187- if let Err ( err) = self . invoke_method_if_present ( AmlName :: from_str ( "\\ _SB._INI" ) . unwrap ( ) , vec ! [ ] ) {
186+ if let Err ( err) = self . evaluate ( AmlName :: from_str ( "\\ _SB._INI" ) . unwrap ( ) , vec ! [ ] ) {
188187 warn ! ( "Invoking \\ _SB._INI failed: {:?}" , err) ;
189188 }
190189
@@ -214,7 +213,7 @@ where
214213 | NamespaceLevelKind :: ThermalZone
215214 | NamespaceLevelKind :: PowerResource => {
216215 let should_initialize = match self
217- . invoke_method_if_present ( AmlName :: from_str ( "_STA" ) . unwrap ( ) . resolve ( path) ?, vec ! [ ] )
216+ . evaluate_if_present ( AmlName :: from_str ( "_STA" ) . unwrap ( ) . resolve ( path) ?, vec ! [ ] )
218217 {
219218 Ok ( Some ( result) ) => {
220219 let Object :: Integer ( result) = * result else { panic ! ( ) } ;
@@ -230,8 +229,8 @@ where
230229
231230 if should_initialize {
232231 num_devices_initialized += 1 ;
233- if let Err ( err) = self
234- . invoke_method_if_present ( AmlName :: from_str ( "_INI" ) . unwrap ( ) . resolve ( path) ?, vec ! [ ] )
232+ if let Err ( err) =
233+ self . evaluate_if_present ( AmlName :: from_str ( "_INI" ) . unwrap ( ) . resolve ( path) ?, vec ! [ ] )
235234 {
236235 warn ! ( "Failed to evaluate _INI for device {}: {:?}" , path, err) ;
237236 }
@@ -1367,10 +1366,14 @@ where
13671366 field_offset += length;
13681367 }
13691368 ACCESS_FIELD => {
1370- let access_type = context. next ( ) ?;
1371- let access_attrib = context. next ( ) ?;
1369+ /*
1370+ * These aren't actually fields themselves, but are created by `AccessAs` AML
1371+ * elements. They change the access type and attributes for remaining fields in
1372+ * the list.
1373+ */
1374+ let _access_type = context. next ( ) ?;
1375+ let _access_attrib = context. next ( ) ?;
13721376 todo ! ( )
1373- // TODO
13741377 }
13751378 CONNECT_FIELD => {
13761379 // TODO: either consume a namestring or `BufferData` (it's not
@@ -2256,16 +2259,16 @@ where
22562259 * TODO: it's not ideal to do these reads for every native access. See if we can
22572260 * cache them somewhere?
22582261 */
2259- let seg = match self . invoke_method_if_present ( AmlName :: from_str ( "_SEG" ) . unwrap ( ) . resolve ( path) ?, vec ! [ ] ) ? {
2262+ let seg = match self . evaluate_if_present ( AmlName :: from_str ( "_SEG" ) . unwrap ( ) . resolve ( path) ?, vec ! [ ] ) ? {
22602263 Some ( value) => value. as_integer ( ) ?,
22612264 None => 0 ,
22622265 } ;
2263- let bus = match self . invoke_method_if_present ( AmlName :: from_str ( "_BBR" ) . unwrap ( ) . resolve ( path) ?, vec ! [ ] ) ? {
2266+ let bus = match self . evaluate_if_present ( AmlName :: from_str ( "_BBR" ) . unwrap ( ) . resolve ( path) ?, vec ! [ ] ) ? {
22642267 Some ( value) => value. as_integer ( ) ?,
22652268 None => 0 ,
22662269 } ;
22672270 let ( device, function) = {
2268- let adr = self . invoke_method_if_present ( AmlName :: from_str ( "_ADR" ) . unwrap ( ) . resolve ( path) ?, vec ! [ ] ) ?;
2271+ let adr = self . evaluate_if_present ( AmlName :: from_str ( "_ADR" ) . unwrap ( ) . resolve ( path) ?, vec ! [ ] ) ?;
22692272 let adr = match adr {
22702273 Some ( adr) => adr. as_integer ( ) ?,
22712274 None => 0 ,
0 commit comments