Skip to content

[feat] Enhance dyn driver #270

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

ZR233
Copy link
Contributor

@ZR233 ZR233 commented Jun 26, 2025

feat(axdriver):

  • Enhanced dynamic driver probing with dtb.
  • Driver registration method similar to Linux module_driver.
  • Add gic and block dyn driver.
  • Supports dependency injection, obtaining drivers of the specified type through get::<T:Class> and get_list::<T:Class>.
  • Supports type conversion through downcast, which allows converting a Class driver to a specific type. For example, Device<Intc>.downcast -> Device<Gicv3>.

test cmd:

make A=examples/shell ARCH=aarch64 LOG=debug FEATURES=driver-dyn LOG=info BUS=mmio BLK=y run

@ZR233 ZR233 requested a review from Azure-stars June 26, 2025 08:47

#[allow(unused)]
/// maps a mmio physical address to a virtual address.
fn iomap(addr: PhysAddr, size: usize) -> Result<NonNull<u8>, Box<dyn Error>> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why return Box<dyn Error> as error type?

Maybe you just return a string? Can we return AxError?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OnProbeError uses Box<dyn Error>, these two error type are in other crates, if we want to use ? to convert err, need to create new type to warp a String or AxError,and boxed error has more err msg than AxError, make it easier to find error location.

@ZR233 ZR233 requested a review from Azure-stars June 27, 2025 04:27
@Azure-stars Azure-stars requested a review from equation314 June 27, 2025 05:02
@equation314
Copy link
Member

This PR is scheduled to be included in the next release window (0.3.0, expected 9/30), and PRs marked 0.2.0 will be processed first.

@equation314 equation314 added this to the 0.3.0 milestone Jun 27, 2025
[fix] 优化错误处理格式,简化 MMIO 区域映射失败的错误信息

feat(axdriver): update rdrive dependency and add block driver support

- Updated rdrive dependency version from 0.14 to 0.14.4 in Cargo.toml.
- Introduced a new block driver module with implementations for block operations.
- Added virtio block driver support with MMIO transport.
- Refactored interrupt controller (GIC) driver probes to use OnProbeError for error handling.
- Enhanced dynamic driver probing to include block devices when the "block" feature is enabled.
- Improved error handling in block driver operations by mapping errors between driver and I/O layers.
@ZR233 ZR233 force-pushed the dev-dyn-driver branch from b05c144 to cc72384 Compare July 7, 2025 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants