@@ -130,10 +130,9 @@ where
130
130
Ok ( ( ) )
131
131
}
132
132
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 > {
137
136
trace ! ( "Invoking AML method: {}" , path) ;
138
137
139
138
let object = self . namespace . lock ( ) . get ( path. clone ( ) ) ?. clone ( ) ;
@@ -147,12 +146,12 @@ where
147
146
}
148
147
}
149
148
150
- pub fn invoke_method_if_present (
149
+ pub fn evaluate_if_present (
151
150
& self ,
152
151
path : AmlName ,
153
152
args : Vec < WrappedObject > ,
154
153
) -> Result < Option < WrappedObject > , AmlError > {
155
- match self . invoke_method ( path. clone ( ) , args) {
154
+ match self . evaluate ( path. clone ( ) , args) {
156
155
Ok ( result) => Ok ( Some ( result) ) ,
157
156
Err ( AmlError :: ObjectDoesNotExist ( not_present) ) => {
158
157
if path == not_present {
@@ -181,10 +180,10 @@ where
181
180
/*
182
181
* This should match the initialization order of ACPICA and uACPI.
183
182
*/
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 ! [ ] ) {
185
184
warn ! ( "Invoking \\ _INI failed: {:?}" , err) ;
186
185
}
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 ! [ ] ) {
188
187
warn ! ( "Invoking \\ _SB._INI failed: {:?}" , err) ;
189
188
}
190
189
@@ -214,7 +213,7 @@ where
214
213
| NamespaceLevelKind :: ThermalZone
215
214
| NamespaceLevelKind :: PowerResource => {
216
215
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 ! [ ] )
218
217
{
219
218
Ok ( Some ( result) ) => {
220
219
let Object :: Integer ( result) = * result else { panic ! ( ) } ;
@@ -230,8 +229,8 @@ where
230
229
231
230
if should_initialize {
232
231
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 ! [ ] )
235
234
{
236
235
warn ! ( "Failed to evaluate _INI for device {}: {:?}" , path, err) ;
237
236
}
@@ -1367,10 +1366,14 @@ where
1367
1366
field_offset += length;
1368
1367
}
1369
1368
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 ( ) ?;
1372
1376
todo ! ( )
1373
- // TODO
1374
1377
}
1375
1378
CONNECT_FIELD => {
1376
1379
// TODO: either consume a namestring or `BufferData` (it's not
@@ -2256,16 +2259,16 @@ where
2256
2259
* TODO: it's not ideal to do these reads for every native access. See if we can
2257
2260
* cache them somewhere?
2258
2261
*/
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 ! [ ] ) ? {
2260
2263
Some ( value) => value. as_integer ( ) ?,
2261
2264
None => 0 ,
2262
2265
} ;
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 ! [ ] ) ? {
2264
2267
Some ( value) => value. as_integer ( ) ?,
2265
2268
None => 0 ,
2266
2269
} ;
2267
2270
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 ! [ ] ) ?;
2269
2272
let adr = match adr {
2270
2273
Some ( adr) => adr. as_integer ( ) ?,
2271
2274
None => 0 ,
0 commit comments