mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-13 22:23:45 +00:00
ahci: remove usage of deprecated env()
The remaining warnings are false-positives because os/attached_mmio.h contains both constructor variants. Issue #2280.
This commit is contained in:
parent
eab477370f
commit
69925ee126
@ -11,22 +11,13 @@
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
|
||||
/* Genode includes */
|
||||
#include <timer_session/connection.h>
|
||||
#include "ata_driver.h"
|
||||
#include "atapi_driver.h"
|
||||
|
||||
|
||||
struct Timer_delayer : Mmio::Delayer, Timer::Connection
|
||||
{
|
||||
void usleep(unsigned us) { Timer::Connection::usleep(us); }
|
||||
};
|
||||
|
||||
|
||||
Mmio::Delayer &Hba::delayer()
|
||||
{
|
||||
static Timer_delayer d;
|
||||
return d;
|
||||
}
|
||||
/* local includes */
|
||||
#include <ata_driver.h>
|
||||
#include <atapi_driver.h>
|
||||
|
||||
|
||||
struct Ahci
|
||||
@ -41,9 +32,17 @@ struct Ahci
|
||||
ATAPI_SIG_QEMU = 0xeb140000, /* will be fixed in Qemu */
|
||||
};
|
||||
|
||||
struct Timer_delayer : Mmio::Delayer, Timer::Connection
|
||||
{
|
||||
Timer_delayer(Genode::Env &env)
|
||||
: Timer::Connection(env) { }
|
||||
|
||||
void usleep(unsigned us) { Timer::Connection::usleep(us); }
|
||||
} _delayer { env };
|
||||
|
||||
Ahci_root &root;
|
||||
Platform::Hba &platform_hba = Platform::init(env, Hba::delayer());
|
||||
Hba hba = { platform_hba };
|
||||
Platform::Hba &platform_hba = Platform::init(env, _delayer);
|
||||
Hba hba { env, platform_hba, _delayer };
|
||||
|
||||
enum { MAX_PORTS = 32 };
|
||||
Port_driver *ports[MAX_PORTS];
|
||||
@ -238,5 +237,3 @@ long Ahci_driver::device_number(char const *model_num, char const *serial_num)
|
||||
{
|
||||
return sata_ahci()->device_number(model_num, serial_num);
|
||||
}
|
||||
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include <block/component.h>
|
||||
#include <os/attached_mmio.h>
|
||||
#include <os/server.h>
|
||||
#include <util/retry.h>
|
||||
#include <util/reconstructible.h>
|
||||
|
||||
@ -74,8 +73,10 @@ struct Platform::Hba
|
||||
*/
|
||||
struct Hba : Genode::Attached_mmio
|
||||
{
|
||||
Hba(Platform::Hba &hba)
|
||||
: Attached_mmio(hba.base(), hba.size()) { }
|
||||
Mmio::Delayer &_delayer;
|
||||
|
||||
Hba(Genode::Env &env, Platform::Hba &hba, Mmio::Delayer &delayer)
|
||||
: Attached_mmio(env, hba.base(), hba.size()), _delayer(delayer) { }
|
||||
|
||||
/**
|
||||
* Host capabilites
|
||||
@ -136,7 +137,7 @@ struct Hba : Genode::Attached_mmio
|
||||
write<Ghc::Ie>(1);
|
||||
}
|
||||
|
||||
static Mmio::Delayer &delayer();
|
||||
Mmio::Delayer &delayer() { return _delayer; }
|
||||
};
|
||||
|
||||
|
||||
@ -426,7 +427,7 @@ struct Port : Genode::Mmio
|
||||
rm(rm), hba(hba), platform_hba(platform_hba)
|
||||
{
|
||||
stop();
|
||||
if (!wait_for<Cmd::Cr>(0, Hba::delayer(), 500, 1000))
|
||||
if (!wait_for<Cmd::Cr>(0, hba.delayer(), 500, 1000))
|
||||
Genode::error("failed to stop command list processing");
|
||||
}
|
||||
|
||||
@ -667,7 +668,7 @@ struct Port : Genode::Mmio
|
||||
/**
|
||||
* Serial ATA control
|
||||
*/
|
||||
struct Sctl : Register<0x2c, 32>
|
||||
struct Sctl : Register<0x2c, 32>
|
||||
{
|
||||
struct Det : Bitfield<0, 4> { }; /* device dectection initialization */
|
||||
struct Ipmt : Bitfield<8, 4> { }; /* allowed power management transitions */
|
||||
|
@ -187,5 +187,4 @@ struct Block::Main
|
||||
};
|
||||
|
||||
|
||||
|
||||
void Component::construct(Genode::Env &env) { static Block::Main server(env); }
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2015 Genode Labs GmbH
|
||||
* Copyright (C) 2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
@ -78,8 +78,9 @@ struct I2c_interface : Attached_mmio
|
||||
* \param base physical MMIO base
|
||||
* \param slave_addr ID of the targeted slave
|
||||
*/
|
||||
I2c_interface(addr_t base, unsigned slave_addr, Mmio::Delayer &delayer)
|
||||
: Attached_mmio(base, 0x10000), delayer(delayer),
|
||||
I2c_interface(Genode::Env &env,
|
||||
addr_t base, unsigned slave_addr, Mmio::Delayer &delayer)
|
||||
: Attached_mmio(env, base, 0x10000), delayer(delayer),
|
||||
start_msg(Start_msg::Addr::bits(slave_addr))
|
||||
{ }
|
||||
|
||||
@ -166,8 +167,8 @@ struct I2c_sataphy : I2c_interface
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
I2c_sataphy(Mmio::Delayer &delayer)
|
||||
: I2c_interface(0x121d0000, SLAVE_ADDR, delayer)
|
||||
I2c_sataphy(Genode::Env &env, Mmio::Delayer &delayer)
|
||||
: I2c_interface(env, 0x121d0000, SLAVE_ADDR, delayer)
|
||||
{ }
|
||||
|
||||
/**
|
||||
@ -221,7 +222,7 @@ struct I2c_sataphy : I2c_interface
|
||||
struct Sata_phy_ctrl : Attached_mmio
|
||||
{
|
||||
Mmio::Delayer &delayer;
|
||||
I2c_sataphy i2c_sataphy { delayer };
|
||||
I2c_sataphy i2c_sataphy;
|
||||
|
||||
/********************************
|
||||
** MMIO structure description **
|
||||
@ -259,8 +260,10 @@ struct Sata_phy_ctrl : Attached_mmio
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Sata_phy_ctrl(Mmio::Delayer &delayer)
|
||||
: Attached_mmio(0x12170000, 0x10000), delayer(delayer)
|
||||
Sata_phy_ctrl(Genode::Env &env, Mmio::Delayer &delayer)
|
||||
:
|
||||
Attached_mmio(env, 0x12170000, 0x10000), delayer(delayer),
|
||||
i2c_sataphy(env, delayer)
|
||||
{
|
||||
i2c_sataphy.init();
|
||||
}
|
||||
@ -317,7 +320,7 @@ struct Exynos5_hba : Platform::Hba
|
||||
{
|
||||
Genode::Env &env;
|
||||
|
||||
Irq_connection irq { Board_base::SATA_IRQ };
|
||||
Irq_connection irq { env, Board_base::SATA_IRQ };
|
||||
Regulator::Connection clock_src { env, Regulator::CLK_SATA };
|
||||
Regulator::Connection power_src { env, Regulator::PWR_SATA };
|
||||
|
||||
@ -327,20 +330,20 @@ struct Exynos5_hba : Platform::Hba
|
||||
clock_src.state(true);
|
||||
power_src.state(true);
|
||||
|
||||
Sata_phy_ctrl phy(delayer);
|
||||
Sata_phy_ctrl phy(env, delayer);
|
||||
|
||||
if (phy.init())
|
||||
throw Root::Unavailable();
|
||||
|
||||
/* additionally perform some generic initializations */
|
||||
::Hba hba(*this);
|
||||
::Hba hba(env, *this, delayer);
|
||||
|
||||
::Hba::Cap::access_t cap = hba.read< ::Hba::Cap>();
|
||||
::Hba::Cap2::access_t cap2 = hba.read< ::Hba::Cap2>();
|
||||
|
||||
/* reset */
|
||||
hba.write< ::Hba::Ghc::Hr>(1);
|
||||
if (!hba.wait_for< ::Hba::Ghc::Hr>(0, ::Hba::delayer(), 1000, 1000)) {
|
||||
if (!hba.wait_for< ::Hba::Ghc::Hr>(0, hba.delayer(), 1000, 1000)) {
|
||||
Genode::error("HBA reset failed");
|
||||
throw Root::Unavailable();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user