remove dtb unwraps
This commit is contained in:
+11
-3
@@ -69,9 +69,17 @@ impl IrqChipList {
|
||||
fn init_inner1(&mut self, fdt: &Fdt) {
|
||||
for node in fdt.all_nodes() {
|
||||
if node.property("interrupt-controller").is_some() {
|
||||
let compatible = node.property("compatible").unwrap().as_str().unwrap();
|
||||
let phandle = node.property("phandle").unwrap().as_usize().unwrap() as u32;
|
||||
let intr_cells = node.interrupt_cells().unwrap();
|
||||
let Some(compatible) = node.compatible() else {
|
||||
continue;
|
||||
};
|
||||
let compatible = compatible.first();
|
||||
let Some(phandle) = node.property("phandle") else {
|
||||
continue;
|
||||
};
|
||||
let phandle = phandle.as_usize().unwrap() as u32;
|
||||
let Some(intr_cells) = node.interrupt_cells() else {
|
||||
continue;
|
||||
};
|
||||
|
||||
debug!(
|
||||
"{}, compatible = {}, #interrupt-cells = 0x{:08x}, phandle = 0x{:08x}",
|
||||
|
||||
+24
-17
@@ -44,24 +44,31 @@ pub fn travel_interrupt_ctrl(fdt: &Fdt) {
|
||||
}
|
||||
for node in fdt.all_nodes() {
|
||||
if node.property("interrupt-controller").is_some() {
|
||||
let compatible = node.property("compatible").unwrap().as_str().unwrap();
|
||||
let phandle = node.property("phandle").unwrap().as_usize().unwrap();
|
||||
let intr_cells = node.interrupt_cells().unwrap();
|
||||
let _intr = node
|
||||
.property("interrupt-parent")
|
||||
.and_then(NodeProperty::as_usize);
|
||||
let _intr_data = node.property("interrupts");
|
||||
let Some(compatible) = node.property("compatible") else {
|
||||
continue;
|
||||
};
|
||||
let compatible = compatible.as_str().unwrap();
|
||||
let Some(phandle) = node.property("phandle") else {
|
||||
continue;
|
||||
};
|
||||
let phandle = phandle.as_usize().unwrap();
|
||||
if let Some(intr_cells) = node.interrupt_cells() {
|
||||
let _intr = node
|
||||
.property("interrupt-parent")
|
||||
.and_then(NodeProperty::as_usize);
|
||||
let _intr_data = node.property("interrupts");
|
||||
|
||||
debug!(
|
||||
"{}, compatible = {}, #interrupt-cells = 0x{:08x}, phandle = 0x{:08x}",
|
||||
node.name, compatible, intr_cells, phandle
|
||||
);
|
||||
if let Some(intr) = _intr {
|
||||
if let Some(intr_data) = _intr_data {
|
||||
debug!("interrupt-parent = 0x{:08x}", intr);
|
||||
debug!("interrupts begin:");
|
||||
for chunk in intr_data.value.chunks(4) {
|
||||
debug!("0x{:08x}, ", BE::read_u32(chunk));
|
||||
debug!(
|
||||
"{}, compatible = {}, #interrupt-cells = 0x{:08x}, phandle = 0x{:08x}",
|
||||
node.name, compatible, intr_cells, phandle
|
||||
);
|
||||
if let Some(intr) = _intr {
|
||||
if let Some(intr_data) = _intr_data {
|
||||
debug!("interrupt-parent = 0x{:08x}", intr);
|
||||
debug!("interrupts begin:");
|
||||
for chunk in intr_data.value.chunks(4) {
|
||||
debug!("0x{:08x}, ", BE::read_u32(chunk));
|
||||
}
|
||||
}
|
||||
debug!("interrupts end");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user