genode/repos/os/src/drivers/ahci/main.cc
Stefan Kalkowski 2380fc442f ahci: avoid to reinstantiate backend driver
Instead of fixing the missing dynamic facilities of the AHCI driver
backends for x86 and Exynos5, just avoid to create/destroy the backend
for every new connection, but always use one and the same object.
The AHCI drivers need to be re-written anyway, see issue #1352 for instance,
we can make it more robust for the dynamic case then.

Fixes #786
Fixes #1133
2015-01-12 14:24:55 +01:00

64 lines
1.4 KiB
C++

/*
* \brief Minimal AHCI-ATA driver
* \author Sebastian Sumpf <Sebastian.Sumpf@genode-labs.com>
* \date 2011-08-10
*
* This driver currently supports only one command slot, one FIS, and one PRD
* per FIS, thus limiting the request size to 4MB per request. Since the packet
* interface currently only supports a synchronous mode of operation the above
* limitations seems reasonable.
*/
/*
* Copyright (C) 2011-2013 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.
*/
/* Genode includes */
#include <block/component.h>
#include <os/server.h>
/* local includes */
#include <ahci_driver.h>
using namespace Genode;
struct Main
{
Server::Entrypoint &ep;
struct Factory : Block::Driver_factory
{
Block::Driver *create() {
static Ahci_driver driver;
return &driver; }
void destroy(Block::Driver *driver) { }
} factory;
Block::Root root;
Main(Server::Entrypoint &ep)
: ep(ep), root(ep, Genode::env()->heap(), factory)
{
printf("--- AHCI driver started ---\n");
Genode::env()->parent()->announce(ep.manage(root));
}
};
/************
** Server **
************/
namespace Server {
char const *name() { return "ahci_ep"; }
size_t stack_size() { return 2*1024*sizeof(long); }
void construct(Entrypoint &ep) { static Main server(ep); }
}