From 8da1c13b737c6af68b37a79b9415671c4dbfd95f Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Wed, 4 Sep 2019 20:44:24 -0600 Subject: [PATCH] Use BAR size for ihda --- ihdad/config.toml | 3 +-- ihdad/src/main.rs | 10 ++++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ihdad/config.toml b/ihdad/config.toml index 2bee08c1f4..11fc35efb1 100644 --- a/ihdad/config.toml +++ b/ihdad/config.toml @@ -2,5 +2,4 @@ name = "Intel HD Audio" class = 4 subclass = 3 -command = ["ihdad", "$NAME", "$BAR0", "$IRQ", "$VENID", "$DEVID"] - +command = ["ihdad", "$NAME", "$BAR0", "$BARSIZE0", "$IRQ", "$VENID", "$DEVID"] diff --git a/ihdad/src/main.rs b/ihdad/src/main.rs index d1f37307be..3fe24d8713 100755 --- a/ihdad/src/main.rs +++ b/ihdad/src/main.rs @@ -34,6 +34,9 @@ fn main() { let bar_str = args.next().expect("ihda: no address provided"); let bar = usize::from_str_radix(&bar_str, 16).expect("ihda: failed to parse address"); + let bar_size_str = args.next().expect("ihda: no address size provided"); + let bar_size = usize::from_str_radix(&bar_size_str, 16).expect("ihda: failed to parse address size"); + let irq_str = args.next().expect("ihda: no irq provided"); let irq = irq_str.parse::().expect("ihda: failed to parse irq"); @@ -43,11 +46,14 @@ fn main() { let prod_str = args.next().expect("ihda: no product id provided"); let prod = usize::from_str_radix(&prod_str, 16).expect("ihda: failed to parse product id"); - print!("{}", format!(" + ihda {} on: {:X} IRQ: {}\n", name, bar, irq)); + print!("{}", format!(" + ihda {} on: {:X} size: {} IRQ: {}\n", name, bar, bar_size, irq)); // Daemonize if unsafe { syscall::clone(0).unwrap() } == 0 { - let address = unsafe { syscall::physmap(bar, 0x4000, PHYSMAP_WRITE | PHYSMAP_NO_CACHE).expect("ihdad: failed to map address") }; + let address = unsafe { + syscall::physmap(bar, bar_size, PHYSMAP_WRITE | PHYSMAP_NO_CACHE) + .expect("ihdad: failed to map address") + }; { let mut irq_file = File::open(format!("irq:{}", irq)).expect("IHDA: failed to open IRQ file");