Procházet zdrojové kódy

Add `AmlError::UnexpectedResourceType`

Also set target type for several `AmlError::IncompatibleValueConversion`
usages.
Casper Verhaar před 4 roky
rodič
revize
939a06b1eb
3 změnil soubory, kde provedl 6 přidání a 2 odebrání
  1. 1 0
      aml/src/lib.rs
  2. 1 1
      aml/src/pci_routing.rs
  3. 4 1
      aml/src/value.rs

+ 1 - 0
aml/src/lib.rs

@@ -778,6 +778,7 @@ pub enum AmlError {
     ReservedResourceType,
     ResourceDescriptorTooShort,
     ResourceDescriptorTooLong,
+    UnexpectedResourceType,
 
     /*
      * Errors produced working with AML values.

+ 1 - 1
aml/src/pci_routing.rs

@@ -178,7 +178,7 @@ impl PciRoutingTable {
                 let resources = resource::resource_descriptor_list(link_crs)?;
                 match resources.as_slice() {
                     [Resource::Irq(descriptor)] => Ok(descriptor.clone()),
-                    _ => Err(AmlError::IncompatibleValueConversion { current: todo!(), target: todo!() }),
+                    _ => Err(AmlError::UnexpectedResourceType),
                 }
             }
         }

+ 4 - 1
aml/src/value.rs

@@ -402,7 +402,10 @@ impl AmlValue {
         let field_update_rule = if let AmlValue::Field { region, flags, offset, length } = self {
             flags.field_update_rule()?
         } else {
-            return Err(AmlError::IncompatibleValueConversion { current: self.type_of(), target: todo!() });
+            return Err(AmlError::IncompatibleValueConversion {
+                current: self.type_of(),
+                target: AmlType::FieldUnit,
+            });
         };
         let mut field_value = match field_update_rule {
             FieldUpdateRule::Preserve => self.read_field(context)?.as_integer(context)?,