mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-06 01:11:46 +00:00
block: extend interface of generic driver class
To support read-only devices like CDROMs, or rom_blk the supported block operations have to be stated by specific the device driver. Ref #966
This commit is contained in:
parent
5a4cb7fcfb
commit
0c8a4f9f3a
@ -136,8 +136,7 @@ class Block::Session_component : public Block::Session_rpc_object
|
|||||||
{
|
{
|
||||||
*blk_count = _driver.block_count();
|
*blk_count = _driver.block_count();
|
||||||
*blk_size = _driver.block_size();
|
*blk_size = _driver.block_size();
|
||||||
ops->set_operation(Packet_descriptor::READ);
|
*ops = _driver.ops();
|
||||||
ops->set_operation(Packet_descriptor::WRITE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void sync() { _driver.sync(); }
|
void sync() { _driver.sync(); }
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include <base/stdint.h>
|
#include <base/stdint.h>
|
||||||
|
|
||||||
#include <ram_session/ram_session.h>
|
#include <ram_session/ram_session.h>
|
||||||
|
#include <block_session/block_session.h>
|
||||||
|
|
||||||
namespace Block {
|
namespace Block {
|
||||||
|
|
||||||
@ -43,6 +43,11 @@ namespace Block {
|
|||||||
*/
|
*/
|
||||||
virtual Genode::size_t block_count() = 0;
|
virtual Genode::size_t block_count() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request operations supported by the device
|
||||||
|
*/
|
||||||
|
virtual Session::Operations ops() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read from medium
|
* Read from medium
|
||||||
*
|
*
|
||||||
|
@ -46,6 +46,15 @@ class Ahci_driver_base : public Block::Driver
|
|||||||
|
|
||||||
size_t block_size() { return Ahci_device::block_size(); }
|
size_t block_size() { return Ahci_device::block_size(); }
|
||||||
size_t block_count() { return _device ? _device->block_count() : 0; }
|
size_t block_count() { return _device ? _device->block_count() : 0; }
|
||||||
|
|
||||||
|
Block::Session::Operations ops()
|
||||||
|
{
|
||||||
|
Block::Session::Operations o;
|
||||||
|
o.set_operation(Block::Packet_descriptor::READ);
|
||||||
|
o.set_operation(Block::Packet_descriptor::WRITE);
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
bool dma_enabled() { return true; }
|
bool dma_enabled() { return true; }
|
||||||
|
|
||||||
void read_dma(size_t block_number,
|
void read_dma(size_t block_number,
|
||||||
|
@ -89,6 +89,14 @@ class Block::Exynos5_driver : public Block::Driver
|
|||||||
return _controller.card_info().capacity_mb() * 1024 * 2;
|
return _controller.card_info().capacity_mb() * 1024 * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Block::Session::Operations ops()
|
||||||
|
{
|
||||||
|
Block::Session::Operations o;
|
||||||
|
o.set_operation(Block::Packet_descriptor::READ);
|
||||||
|
o.set_operation(Block::Packet_descriptor::WRITE);
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
void read(Genode::size_t block_number,
|
void read(Genode::size_t block_number,
|
||||||
Genode::size_t block_count,
|
Genode::size_t block_count,
|
||||||
char *out_buffer)
|
char *out_buffer)
|
||||||
|
@ -82,6 +82,14 @@ class Block::Omap4_driver : public Block::Driver
|
|||||||
return _controller.card_info().capacity_mb() * 1024 * 2;
|
return _controller.card_info().capacity_mb() * 1024 * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Block::Session::Operations ops()
|
||||||
|
{
|
||||||
|
Block::Session::Operations o;
|
||||||
|
o.set_operation(Block::Packet_descriptor::READ);
|
||||||
|
o.set_operation(Block::Packet_descriptor::WRITE);
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
void read(Genode::size_t block_number,
|
void read(Genode::size_t block_number,
|
||||||
Genode::size_t block_count,
|
Genode::size_t block_count,
|
||||||
char *out_buffer)
|
char *out_buffer)
|
||||||
|
@ -79,6 +79,14 @@ class Sd_card : public Block::Driver
|
|||||||
*/
|
*/
|
||||||
Genode::size_t block_count() { return 0x20000000 / BLOCK_SIZE; }
|
Genode::size_t block_count() { return 0x20000000 / BLOCK_SIZE; }
|
||||||
|
|
||||||
|
Block::Session::Operations ops()
|
||||||
|
{
|
||||||
|
Block::Session::Operations o;
|
||||||
|
o.set_operation(Block::Packet_descriptor::READ);
|
||||||
|
o.set_operation(Block::Packet_descriptor::WRITE);
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
void read(Genode::size_t block_number,
|
void read(Genode::size_t block_number,
|
||||||
Genode::size_t block_count,
|
Genode::size_t block_count,
|
||||||
char *out_buffer)
|
char *out_buffer)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user