Skip to content

Commit

Permalink
sq fix compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
berkus committed Feb 12, 2022
1 parent a644bde commit 6ac6e45
Show file tree
Hide file tree
Showing 5 changed files with 209 additions and 25 deletions.
184 changes: 182 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 12 additions & 9 deletions machine/src/device_tree.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
#![allow(dead_code)]

use {
core::alloc::Layout,
fdt_rs::{
base::DevTree,
error::DevTreeError,
index::{
iters::DevTreeIndexNodeSiblingIter,
{DevTreeIndex, DevTreeIndexNode, DevTreeIndexProp},
},
prelude::{FallibleIterator, PropReader},
index::{DevTreeIndex, DevTreeIndexNode, DevTreeIndexProp},
prelude::PropReader,
},
shrinkwraprs::Shrinkwrap,
};
//iters::DevTreeIndexNodeSiblingIter,
//FallibleIterator,

/// Uses DevTreeIndex implementation for simpler navigation.
/// This requires allocation of a single buffer, which is done at boot time via bump allocator.
Expand Down Expand Up @@ -38,8 +39,9 @@ impl<'a> DeviceTree<'a> {
path.move_next();
}
while !path.is_finished() {
node = node_iter
.try_find::<_, _, DevTreeError>(|node| Ok(node.name()? == path.component()))?;
let res: Result<_, DevTreeError> =
node_iter.try_find(|node| Ok(node.name()? == path.component()));
node = res?;
if node.is_none() {
return Err(DevTreeError::InvalidParameter("Invalid path")); // @todo
}
Expand All @@ -49,8 +51,9 @@ impl<'a> DeviceTree<'a> {
assert!(path.is_finished()); // tbd
assert!(node.is_some());
let mut prop_iter = node.unwrap().props();
let prop = prop_iter
.try_find::<_, _, DevTreeError>(|prop| Ok(prop.name()? == path.component()))?;
let res: Result<_, DevTreeError> =
prop_iter.try_find(|prop| Ok(prop.name()? == path.component()));
let prop = res?;
if prop.is_none() {
return Err(DevTreeError::InvalidParameter("Invalid path")); // @todo
}
Expand Down
4 changes: 3 additions & 1 deletion machine/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![no_std]
#![no_main]
#![feature(try_find)] // For DeviceTree iterators
#![feature(decl_macro)]
#![feature(allocator_api)]
#![feature(format_args_nl)]
Expand All @@ -23,6 +24,7 @@ pub mod arch;

pub use arch::*;

pub mod device_tree;
pub mod devices;
pub mod macros;
mod mm;
Expand All @@ -39,7 +41,7 @@ pub static CONSOLE: sync::NullLock<devices::Console> = sync::NullLock::new(devic
/// The global allocator for DMA-able memory. That is, memory which is tagged
/// non-cacheable in the page tables.
#[allow(dead_code)]
static DMA_ALLOCATOR: sync::NullLock<mm::BumpAllocator> =
pub static DMA_ALLOCATOR: sync::NullLock<mm::BumpAllocator> =
sync::NullLock::new(mm::BumpAllocator::new(
// @todo Init this after we loaded boot memory map
memory::map::virt::DMA_HEAP_START as usize,
Expand Down
1 change: 1 addition & 0 deletions nucleus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ bit_field = "0.10"
bitflags = "1.3"
cfg-if = "1.0"
snafu = { version = "0.7", default-features = false }
fdt-rs = { version = "0.4", default-features = false }
Loading

0 comments on commit 6ac6e45

Please sign in to comment.