From e3e41e5ca011d0b9157505436e3042401ca4b0fa Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Thu, 6 Apr 2017 21:02:32 +0200 Subject: [PATCH] ahci: avoid deprecated warnings Issue #1987 --- repos/os/run/ahci_bench.run | 10 +--------- repos/os/src/drivers/ahci/ahci.h | 13 ++++++++++--- .../src/drivers/ahci/spec/exynos5/platform.cc | 17 +++++++++++++---- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/repos/os/run/ahci_bench.run b/repos/os/run/ahci_bench.run index 283b91aab..bbfb9c891 100644 --- a/repos/os/run/ahci_bench.run +++ b/repos/os/run/ahci_bench.run @@ -64,13 +64,6 @@ append config { - - - - - - - @@ -83,8 +76,7 @@ install_config $config # # Boot modules # -set boot_modules { core init timer ahci_drv test-blk-bench libc.lib.so - ld.lib.so } +set boot_modules { core init timer ahci_drv test-blk-bench ld.lib.so } append_platform_drv_boot_modules diff --git a/repos/os/src/drivers/ahci/ahci.h b/repos/os/src/drivers/ahci/ahci.h index cd516336b..e4ebe0f94 100644 --- a/repos/os/src/drivers/ahci/ahci.h +++ b/repos/os/src/drivers/ahci/ahci.h @@ -591,12 +591,16 @@ struct Port : Port_base if (read()) return; - if (!wait_for(0, hba.delayer(), 500, 1000)) { + try { + wait_for(hba.delayer(), Tfd::Sts_bsy::Equal(0)); + } catch (Polling_timeout) { Genode::error("HBA busy unable to start command processing."); return; } - if (!wait_for(0, hba.delayer(), 500, 1000)) { + try { + wait_for(hba.delayer(), Tfd::Sts_drq::Equal(0)); + } catch (Polling_timeout) { Genode::error("HBA in DRQ unable to start command processing."); return; } @@ -694,8 +698,11 @@ struct Port : Port_base hba.delayer().usleep(1000); write(0); - if (!wait_for(Ssts::Dec::ESTABLISHED, hba.delayer())) + try { + wait_for(hba.delayer(), Ssts::Dec::Equal(Ssts::Dec::ESTABLISHED)); + } catch (Polling_timeout) { Genode::warning("Port reset failed"); + } } /** diff --git a/repos/os/src/drivers/ahci/spec/exynos5/platform.cc b/repos/os/src/drivers/ahci/spec/exynos5/platform.cc index 2216d60c6..d9f1d95ce 100644 --- a/repos/os/src/drivers/ahci/spec/exynos5/platform.cc +++ b/repos/os/src/drivers/ahci/spec/exynos5/platform.cc @@ -121,7 +121,9 @@ struct I2c_interface : Attached_mmio int send(uint8_t * msg, size_t msg_size) { /* initiate message transfer */ - if (!wait_for(0, delayer)) { + try { + wait_for(delayer, Stat::Busy::Equal(0)); + } catch (Polling_timeout) { Genode::error("I2C busy"); return -1; } @@ -148,7 +150,9 @@ struct I2c_interface : Attached_mmio write(0); write(0); /* FIXME fixup */ if (arbitration_error()) return -1; - if (!wait_for(0, delayer)) { + try { + wait_for(delayer, Stat::Busy::Equal(0)); + } catch (Polling_timeout) { Genode::error("I2C end transfer failed"); return -1; } @@ -304,7 +308,9 @@ struct Sata_phy_ctrl : Attached_mmio * at this point we should study the Linux behavior * in more depth. */ - if (!wait_for(1, delayer)) { + try { + wait_for(delayer, Phstatm::Pll_locked::Equal(1)); + } catch (Polling_timeout) { Genode::error("PLL lock failed"); return -1; } @@ -343,7 +349,10 @@ struct Exynos5_hba : Platform::Hba /* reset */ hba.write< ::Hba::Ghc::Hr>(1); - if (!hba.wait_for< ::Hba::Ghc::Hr>(0, hba.delayer(), 1000, 1000)) { + try { + hba.wait_for(::Hba::Attempts(1000), ::Hba::Microseconds(1000), + hba.delayer(), ::Hba::Ghc::Hr::Equal(0)); + } catch (::Hba::Polling_timeout) { Genode::error("HBA reset failed"); throw Root::Unavailable(); }