mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-07 11:27:29 +00:00
block: support for block number >32 bit (Fix #968)
This commit is contained in:
parent
1bc16f3a23
commit
b10b9e20a2
@ -43,7 +43,7 @@ class Storage_device : public Genode::List<Storage_device>::Element,
|
||||
Block::Packet_descriptor *packet = static_cast<Block::Packet_descriptor *>(cmnd->packet);
|
||||
|
||||
if (verbose)
|
||||
PDBG("ACK packet for block: %zu status: %d", packet->block_number(), cmnd->result);
|
||||
PDBG("ACK packet for block: %llu status: %d", packet->block_number(), cmnd->result);
|
||||
|
||||
session->complete_packet(*packet);
|
||||
Genode::destroy(Genode::env()->heap(), packet);
|
||||
@ -86,7 +86,7 @@ class Storage_device : public Genode::List<Storage_device>::Element,
|
||||
_scsi_free_command(cmnd);
|
||||
}
|
||||
|
||||
void _io(Genode::size_t block_nr, Genode::size_t block_count,
|
||||
void _io(Block::sector_t block_nr, Genode::size_t block_count,
|
||||
Block::Packet_descriptor packet,
|
||||
Genode::addr_t virt, Genode::addr_t phys, bool read)
|
||||
{
|
||||
@ -94,7 +94,7 @@ class Storage_device : public Genode::List<Storage_device>::Element,
|
||||
throw Io_error();
|
||||
|
||||
if (verbose)
|
||||
PDBG("PACKET: phys: %lx block: %zu count: %u %s",
|
||||
PDBG("PACKET: phys: %lx block: %llu count: %u %s",
|
||||
phys, block_nr, block_count, read ? "read" : "write");
|
||||
|
||||
struct scsi_cmnd *cmnd = _scsi_alloc_command();
|
||||
@ -142,8 +142,8 @@ class Storage_device : public Genode::List<Storage_device>::Element,
|
||||
_capacity();
|
||||
}
|
||||
|
||||
Genode::size_t block_size() { return _block_size; }
|
||||
Genode::size_t block_count() { return _block_count; }
|
||||
Genode::size_t block_size() { return _block_size; }
|
||||
Block::sector_t block_count() { return _block_count; }
|
||||
|
||||
Block::Session::Operations ops()
|
||||
{
|
||||
@ -153,7 +153,7 @@ class Storage_device : public Genode::List<Storage_device>::Element,
|
||||
return o;
|
||||
}
|
||||
|
||||
void read_dma(Genode::size_t block_number,
|
||||
void read_dma(Block::sector_t block_number,
|
||||
Genode::size_t block_count,
|
||||
Genode::addr_t phys,
|
||||
Block::Packet_descriptor &packet)
|
||||
@ -163,7 +163,7 @@ class Storage_device : public Genode::List<Storage_device>::Element,
|
||||
phys, true);
|
||||
}
|
||||
|
||||
void write_dma(Genode::size_t block_number,
|
||||
void write_dma(Block::sector_t block_number,
|
||||
Genode::size_t block_count,
|
||||
Genode::addr_t phys,
|
||||
Block::Packet_descriptor &packet)
|
||||
|
@ -39,8 +39,8 @@ class Driver : public Block::Driver
|
||||
** Block::Driver interface **
|
||||
*******************************/
|
||||
|
||||
Genode::size_t block_size() { return _block_size; }
|
||||
Genode::size_t block_count() { return _http.file_size() / _block_size; }
|
||||
Genode::size_t block_size() { return _block_size; }
|
||||
Block::sector_t block_count() { return _http.file_size() / _block_size; }
|
||||
|
||||
Block::Session::Operations ops()
|
||||
{
|
||||
@ -49,7 +49,7 @@ class Driver : public Block::Driver
|
||||
return o;
|
||||
}
|
||||
|
||||
void read(Genode::size_t block_nr,
|
||||
void read(Block::sector_t block_nr,
|
||||
Genode::size_t block_count,
|
||||
char *buffer,
|
||||
Block::Packet_descriptor &packet)
|
||||
|
@ -28,7 +28,7 @@ static bool const verbose = false;
|
||||
static Genode::Allocator_avl _block_alloc(Genode::env()->heap());
|
||||
static Block::Connection *_block_connection;
|
||||
static size_t _blk_size = 0;
|
||||
static size_t _blk_cnt = 0;
|
||||
static Block::sector_t _blk_cnt = 0;
|
||||
static Block::Session::Tx::Source *_source;
|
||||
|
||||
|
||||
@ -72,7 +72,7 @@ extern "C" DSTATUS disk_initialize (BYTE drv)
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
PDBG("We have %zu blocks with a size of %zu bytes",
|
||||
PDBG("We have %llu blocks with a size of %zu bytes",
|
||||
_blk_cnt, _blk_size);
|
||||
|
||||
initialized = true;
|
||||
|
@ -58,7 +58,7 @@ namespace {
|
||||
|
||||
Block::Connection *_block;
|
||||
size_t _block_size;
|
||||
size_t _block_count;
|
||||
Block::sector_t _block_count;
|
||||
Block::Session::Operations _block_ops;
|
||||
Block::Session::Tx::Source *_tx_source;
|
||||
|
||||
@ -94,7 +94,7 @@ namespace {
|
||||
_block_buffer = reinterpret_cast<char*>(malloc(BUFFER_BLOCK_NUMBER * _block_size));
|
||||
|
||||
if (verbose) {
|
||||
PDBG("number of blocks: %zu with block size: %zu (bytes)"
|
||||
PDBG("number of blocks: %llu with block size: %zu (bytes)"
|
||||
" , readable: %d writeable: %d",
|
||||
_block_count, _block_size, _readable, _writeable);
|
||||
}
|
||||
|
@ -142,7 +142,18 @@ class Block::Session_component : public Block::Session_rpc_object
|
||||
_driver_factory.destroy(&_driver);
|
||||
}
|
||||
|
||||
void info(size_t *blk_count, size_t *blk_size,
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~Session_component() {
|
||||
_driver_factory.destroy(&_driver); }
|
||||
|
||||
|
||||
/*******************************
|
||||
** Block session interface **
|
||||
*******************************/
|
||||
|
||||
void info(sector_t *blk_count, size_t *blk_size,
|
||||
Operations *ops)
|
||||
{
|
||||
*blk_count = _driver.block_count();
|
||||
|
@ -50,7 +50,7 @@ struct Block::Driver
|
||||
/**
|
||||
* Request capacity of medium in blocks
|
||||
*/
|
||||
virtual Genode::size_t block_count() = 0;
|
||||
virtual Block::sector_t block_count() = 0;
|
||||
|
||||
/**
|
||||
* Request operations supported by the device
|
||||
@ -64,7 +64,7 @@ struct Block::Driver
|
||||
* \param block_count number of blocks to read
|
||||
* \param buffer output buffer for read request
|
||||
*/
|
||||
virtual void read(Genode::size_t block_number,
|
||||
virtual void read(sector_t block_number,
|
||||
Genode::size_t block_count,
|
||||
char * buffer,
|
||||
Packet_descriptor &packet) {
|
||||
@ -77,7 +77,7 @@ struct Block::Driver
|
||||
* \param block_count number of blocks to write
|
||||
* \param buffer buffer for write request
|
||||
*/
|
||||
virtual void write(Genode::size_t block_number,
|
||||
virtual void write(sector_t block_number,
|
||||
Genode::size_t block_count,
|
||||
const char * buffer,
|
||||
Packet_descriptor &packet) {
|
||||
@ -90,7 +90,7 @@ struct Block::Driver
|
||||
* \param block_count number of blocks to read
|
||||
* \param phys phyiscal address of read buffer
|
||||
*/
|
||||
virtual void read_dma(Genode::size_t block_number,
|
||||
virtual void read_dma(sector_t block_number,
|
||||
Genode::size_t block_count,
|
||||
Genode::addr_t phys,
|
||||
Packet_descriptor &packet) {
|
||||
@ -103,7 +103,7 @@ struct Block::Driver
|
||||
* \param block_count number of blocks to write
|
||||
* \param phys physical address of write buffer
|
||||
*/
|
||||
virtual void write_dma(Genode::size_t block_number,
|
||||
virtual void write_dma(sector_t block_number,
|
||||
Genode::size_t block_count,
|
||||
Genode::addr_t phys,
|
||||
Packet_descriptor &packet) {
|
||||
|
@ -51,7 +51,7 @@ namespace Block {
|
||||
private:
|
||||
|
||||
Opcode _op; /* requested operation */
|
||||
Genode::size_t _block_number; /* requested block number */
|
||||
sector_t _block_number; /* requested block number */
|
||||
Genode::size_t _block_count; /* number of blocks to transfer */
|
||||
unsigned _success :1; /* indicates success of operation */
|
||||
|
||||
@ -68,13 +68,13 @@ namespace Block {
|
||||
* Constructor
|
||||
*/
|
||||
Packet_descriptor(Packet_descriptor p, Opcode op,
|
||||
Genode::size_t blk_nr, Genode::size_t blk_count = 1)
|
||||
sector_t blk_nr, Genode::size_t blk_count = 1)
|
||||
: ::Packet_descriptor(p.offset(), p.size()),
|
||||
_op(op), _block_number(blk_nr),
|
||||
_block_count(blk_count), _success(false) { }
|
||||
|
||||
Opcode operation() const { return _op; }
|
||||
Genode::size_t block_number() const { return _block_number; }
|
||||
sector_t block_number() const { return _block_number; }
|
||||
Genode::size_t block_count() const { return _block_count; }
|
||||
bool succeeded() const { return _success; }
|
||||
|
||||
@ -125,7 +125,7 @@ namespace Block {
|
||||
* \param blk_size will contain total size in bytes
|
||||
* \param ops supported operations
|
||||
*/
|
||||
virtual void info(Genode::size_t *blk_count,
|
||||
virtual void info(sector_t *blk_count,
|
||||
Genode::size_t *blk_size,
|
||||
Operations *ops) = 0;
|
||||
|
||||
@ -149,7 +149,8 @@ namespace Block {
|
||||
** RPC interface **
|
||||
*******************/
|
||||
|
||||
GENODE_RPC(Rpc_info, void, info, Genode::size_t *, Genode::size_t *, Operations *);
|
||||
GENODE_RPC(Rpc_info, void, info, Block::sector_t *,
|
||||
Genode::size_t *, Operations *);
|
||||
GENODE_RPC(Rpc_tx_cap, Genode::Capability<Tx>, _tx_cap);
|
||||
GENODE_RPC(Rpc_sync, void, sync);
|
||||
GENODE_RPC_INTERFACE(Rpc_info, Rpc_tx_cap, Rpc_sync);
|
||||
|
@ -47,7 +47,7 @@ namespace Block {
|
||||
** Block session interface **
|
||||
*****************************/
|
||||
|
||||
void info(Genode::size_t *blk_count, Genode::size_t *blk_size,
|
||||
void info(sector_t *blk_count, Genode::size_t *blk_size,
|
||||
Operations *ops)
|
||||
{
|
||||
call<Rpc_info>(blk_count, blk_size, ops);
|
||||
|
@ -1947,5 +1947,5 @@ int Ahci_driver::_ncq_command(uint64_t lba, unsigned cnt, addr_t phys, bool w)
|
||||
return ret;
|
||||
}
|
||||
|
||||
size_t Ahci_driver::block_count() { return sata_ahci()->block_cnt; }
|
||||
size_t Ahci_driver::block_size() { return Sata_ahci::BLOCK_SIZE; }
|
||||
Block::sector_t Ahci_driver::block_count() { return sata_ahci()->block_cnt; }
|
||||
size_t Ahci_driver::block_size() { return Sata_ahci::BLOCK_SIZE; }
|
||||
|
@ -52,11 +52,11 @@ class Ahci_driver : public Block::Driver
|
||||
return o;
|
||||
}
|
||||
|
||||
size_t block_size();
|
||||
size_t block_count();
|
||||
size_t block_size();
|
||||
Block::sector_t block_count();
|
||||
bool dma_enabled() { return true; }
|
||||
|
||||
void read_dma(size_t block_nr, size_t block_cnt, addr_t phys,
|
||||
void read_dma(Block::sector_t block_nr, size_t block_cnt, addr_t phys,
|
||||
Block::Packet_descriptor &packet)
|
||||
{
|
||||
if (_ncq_command(block_nr, block_cnt, phys, 0))
|
||||
@ -64,7 +64,7 @@ class Ahci_driver : public Block::Driver
|
||||
session->complete_packet(packet);
|
||||
}
|
||||
|
||||
void write_dma(size_t block_nr, size_t block_cnt, addr_t phys,
|
||||
void write_dma(Block::sector_t block_nr, size_t block_cnt, addr_t phys,
|
||||
Block::Packet_descriptor &packet)
|
||||
{
|
||||
if (_ncq_command(block_nr, block_cnt, phys, 1))
|
||||
|
@ -316,7 +316,7 @@ struct Command_table
|
||||
/**
|
||||
* Setup FIS and PRD
|
||||
*/
|
||||
void setup_command(uint8_t cmd, uint32_t lba48, uint16_t blk_cnt, addr_t phys_addr)
|
||||
void setup_command(uint8_t cmd, uint64_t lba48, uint16_t blk_cnt, addr_t phys_addr)
|
||||
{
|
||||
enum { MAX_BYTES = 1 << 22 }; /* 4MB = one PRD */
|
||||
uint8_t *fis = (uint8_t *)this;
|
||||
@ -332,8 +332,8 @@ struct Command_table
|
||||
fis[6] = (lba48 >> 16) & 0xff; /* LBA 16 - 23 */
|
||||
fis[7] = 0x40; /* LBA mode flag */
|
||||
fis[8] = (lba48 >> 24) & 0xff; /* LBA 24 - 31 */
|
||||
fis[9] = 0x0; /* LBA 32 - 39 */
|
||||
fis[10] = 0x0; /* LBA 40 - 47 */
|
||||
fis[9] = (lba48 >> 32) & 0xff; /* LBA 32 - 39 */
|
||||
fis[10] = (lba48 >> 40) & 0xff; /* LBA 40 - 47 */
|
||||
fis[12] = blk_cnt & 0xff; /* sector count 0 - 7 */
|
||||
fis[13] = (blk_cnt >> 8) & 0xff; /* sector count 8 - 15 */
|
||||
|
||||
@ -537,24 +537,28 @@ class Ahci_device_base
|
||||
/**
|
||||
* Issue ATA 'READ_DMA_EXT' command
|
||||
*/
|
||||
void read(size_t block_number, size_t block_count, addr_t phys)
|
||||
void read(Block::sector_t block_number, size_t block_count,
|
||||
addr_t phys)
|
||||
{
|
||||
_cmd_list->w = 0;
|
||||
|
||||
enum { READ_DMA_EXT = 0x25 };
|
||||
_cmd_table->setup_command(READ_DMA_EXT, block_number, block_count, phys);
|
||||
_cmd_table->setup_command(READ_DMA_EXT, block_number,
|
||||
block_count, phys);
|
||||
_execute_command();
|
||||
}
|
||||
|
||||
/**
|
||||
* Issue ATA 'WRITE_DMA_EXT' command
|
||||
*/
|
||||
void write(size_t block_number, size_t block_count, addr_t phys)
|
||||
void write(Block::sector_t block_number, size_t block_count,
|
||||
addr_t phys)
|
||||
{
|
||||
_cmd_list->w = 1;
|
||||
|
||||
enum { WRITE_DMA_EXT = 0x35 };
|
||||
_cmd_table->setup_command(WRITE_DMA_EXT, block_number, block_count, phys);
|
||||
_cmd_table->setup_command(WRITE_DMA_EXT, block_number,
|
||||
block_count, phys);
|
||||
_execute_command();
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,8 @@ class Ahci_driver_base : public Block::Driver
|
||||
}
|
||||
|
||||
size_t block_size() { return Ahci_device::block_size(); }
|
||||
size_t block_count() { return _device ? _device->block_count() : 0; }
|
||||
Block::sector_t block_count() {
|
||||
return _device ? _device->block_count() : 0; }
|
||||
|
||||
Block::Session::Operations ops()
|
||||
{
|
||||
@ -58,9 +59,9 @@ class Ahci_driver_base : public Block::Driver
|
||||
|
||||
bool dma_enabled() { return true; }
|
||||
|
||||
void read_dma(size_t block_number,
|
||||
size_t block_count,
|
||||
addr_t phys,
|
||||
void read_dma(Block::sector_t block_number,
|
||||
size_t block_count,
|
||||
addr_t phys,
|
||||
Block::Packet_descriptor &packet)
|
||||
{
|
||||
_sanity_check(block_number, block_count);
|
||||
@ -68,9 +69,9 @@ class Ahci_driver_base : public Block::Driver
|
||||
if (session) session->complete_packet(packet);
|
||||
}
|
||||
|
||||
void write_dma(size_t block_number,
|
||||
size_t block_count,
|
||||
addr_t phys,
|
||||
void write_dma(Block::sector_t block_number,
|
||||
size_t block_count,
|
||||
addr_t phys,
|
||||
Block::Packet_descriptor &packet)
|
||||
{
|
||||
_sanity_check(block_number, block_count);
|
||||
|
@ -148,7 +148,7 @@ void Ata::Device::read_capacity()
|
||||
}
|
||||
|
||||
|
||||
void Ata::Device::_read(Genode::size_t block_nr,
|
||||
void Ata::Device::_read(Block::sector_t block_nr,
|
||||
Genode::size_t count,
|
||||
char *buffer,
|
||||
bool dma)
|
||||
@ -161,7 +161,7 @@ void Ata::Device::_read(Genode::size_t block_nr,
|
||||
if (dma) {
|
||||
|
||||
if (verbose)
|
||||
PDBG("DMA read: block %zu, c %zu, buffer: %p",
|
||||
PDBG("DMA read: block %llu, c %zu, buffer: %p",
|
||||
block_nr, c, (void*)(buffer + offset));
|
||||
|
||||
if (!_lba48)
|
||||
@ -196,7 +196,7 @@ void Ata::Device::_read(Genode::size_t block_nr,
|
||||
}
|
||||
|
||||
|
||||
void Ata::Device::_write(Genode::size_t block_nr,
|
||||
void Ata::Device::_write(Block::sector_t block_nr,
|
||||
Genode::size_t count,
|
||||
char const *buffer,
|
||||
bool dma)
|
||||
@ -209,7 +209,7 @@ void Ata::Device::_write(Genode::size_t block_nr,
|
||||
if (dma) {
|
||||
|
||||
if (verbose)
|
||||
PDBG("DMA read: block %zu, c %zu, buffer: %p",
|
||||
PDBG("DMA read: block %llu, c %zu, buffer: %p",
|
||||
block_nr, c, (void*)(buffer + offset));
|
||||
|
||||
if (!_lba48)
|
||||
|
@ -61,11 +61,11 @@ namespace Ata {
|
||||
Genode::Irq_connection *irq() { return _irq; }
|
||||
Genode::Io_port_session *io() { return _pio; }
|
||||
|
||||
virtual void _read(Genode::size_t block_number,
|
||||
virtual void _read(Block::sector_t block_number,
|
||||
Genode::size_t block_count,
|
||||
char *out_buffer,
|
||||
bool dma);
|
||||
virtual void _write(Genode::size_t block_number,
|
||||
virtual void _write(Block::sector_t block_number,
|
||||
Genode::size_t block_count,
|
||||
char const *buffer,
|
||||
bool dma);
|
||||
@ -112,13 +112,13 @@ namespace Ata {
|
||||
** Block::Driver interface **
|
||||
*******************************/
|
||||
|
||||
Genode::size_t block_count() {
|
||||
Block::sector_t block_count() {
|
||||
return _block_end - _block_start + 1; }
|
||||
Genode::size_t block_size() { return _block_size; }
|
||||
|
||||
virtual Block::Session::Operations ops();
|
||||
|
||||
void read(Genode::size_t block_number,
|
||||
void read(Block::sector_t block_number,
|
||||
Genode::size_t block_count,
|
||||
char *buffer,
|
||||
Block::Packet_descriptor &packet)
|
||||
@ -127,7 +127,7 @@ namespace Ata {
|
||||
session->complete_packet(packet);
|
||||
}
|
||||
|
||||
void write(Genode::size_t block_number,
|
||||
void write(Block::sector_t block_number,
|
||||
Genode::size_t block_count,
|
||||
char const *buffer,
|
||||
Block::Packet_descriptor &packet)
|
||||
@ -136,16 +136,16 @@ namespace Ata {
|
||||
session->complete_packet(packet);
|
||||
}
|
||||
|
||||
void read_dma(Genode::size_t block_number,
|
||||
Genode::size_t block_count,
|
||||
Genode::addr_t phys,
|
||||
void read_dma(Block::sector_t block_number,
|
||||
Genode::size_t block_count,
|
||||
Genode::addr_t phys,
|
||||
Block::Packet_descriptor &packet)
|
||||
{
|
||||
_read(block_number, block_count, (char*)phys, true);
|
||||
session->complete_packet(packet);
|
||||
}
|
||||
|
||||
void write_dma(Genode::size_t block_number,
|
||||
void write_dma(Block::sector_t block_number,
|
||||
Genode::size_t block_count,
|
||||
Genode::addr_t phys,
|
||||
Block::Packet_descriptor &packet)
|
||||
@ -165,11 +165,11 @@ namespace Ata {
|
||||
int read_sense(unsigned char *sense, int length);
|
||||
void read_capacity();
|
||||
|
||||
void _read(Genode::size_t block_number,
|
||||
void _read(Block::sector_t block_number,
|
||||
Genode::size_t block_count,
|
||||
char *out_buffer,
|
||||
bool dma);
|
||||
void _write(Genode::size_t block_number,
|
||||
void _write(Block::sector_t block_number,
|
||||
Genode::size_t block_count,
|
||||
char const *buffer,
|
||||
bool dma);
|
||||
|
@ -42,7 +42,7 @@ Atapi_device::Atapi_device(unsigned base_cmd, unsigned base_ctrl)
|
||||
int Atapi_device::read_sense(unsigned char *sense, int length)
|
||||
{
|
||||
unsigned char cmd_sense[12];
|
||||
|
||||
|
||||
memset(cmd_sense, 0, 12);
|
||||
memset(sense, 0, length);
|
||||
|
||||
@ -83,7 +83,7 @@ void Atapi_device::read_capacity()
|
||||
memset(buffer, 0, 8);
|
||||
|
||||
cmd[0] = CMD_READ_CAPACITY;
|
||||
|
||||
|
||||
if (!test_unit_ready())
|
||||
throw Io_error();
|
||||
|
||||
@ -100,7 +100,7 @@ void Atapi_device::read_capacity()
|
||||
}
|
||||
|
||||
|
||||
void Atapi_device::_read(Genode::size_t block_nr,
|
||||
void Atapi_device::_read(Block::sector_t block_nr,
|
||||
Genode::size_t count,
|
||||
char *buffer,
|
||||
bool dma)
|
||||
@ -127,7 +127,7 @@ void Atapi_device::_read(Genode::size_t block_nr,
|
||||
|
||||
if (dma) {
|
||||
if (verbose)
|
||||
PDBG("DMA read: block %zu, count %zu, buffer: %p",
|
||||
PDBG("DMA read: block %llu, count %zu, buffer: %p",
|
||||
block_nr, count, (void*)buffer);
|
||||
|
||||
if (dma_pci_packet(dev_num(), 12, cmd, 0, count * _block_size,
|
||||
@ -141,7 +141,7 @@ void Atapi_device::_read(Genode::size_t block_nr,
|
||||
}
|
||||
|
||||
|
||||
void Atapi_device::_write(Genode::size_t block_number,
|
||||
void Atapi_device::_write(Block::sector_t block_number,
|
||||
Genode::size_t block_count,
|
||||
char const *buffer,
|
||||
bool dma) { throw Io_error(); }
|
||||
|
@ -84,7 +84,7 @@ class Block::Exynos5_driver : public Block::Driver
|
||||
|
||||
Genode::size_t block_size() { return 512; }
|
||||
|
||||
virtual Genode::size_t block_count()
|
||||
virtual Block::sector_t block_count()
|
||||
{
|
||||
return _controller.card_info().capacity_mb() * 1024 * 2;
|
||||
}
|
||||
@ -97,27 +97,7 @@ class Block::Exynos5_driver : public Block::Driver
|
||||
return o;
|
||||
}
|
||||
|
||||
void read(Genode::size_t block_number,
|
||||
Genode::size_t block_count,
|
||||
char *out_buffer,
|
||||
Packet_descriptor &packet)
|
||||
{
|
||||
if (!_controller.read_blocks(block_number, block_count, out_buffer))
|
||||
throw Io_error();
|
||||
session->complete_packet(packet);
|
||||
}
|
||||
|
||||
void write(Genode::size_t block_number,
|
||||
Genode::size_t block_count,
|
||||
char const *buffer,
|
||||
Packet_descriptor &packet)
|
||||
{
|
||||
if (!_controller.write_blocks(block_number, block_count, buffer))
|
||||
throw Io_error();
|
||||
session->complete_packet(packet);
|
||||
}
|
||||
|
||||
void read_dma(Genode::size_t block_number,
|
||||
void read_dma(Block::sector_t block_number,
|
||||
Genode::size_t block_count,
|
||||
Genode::addr_t phys,
|
||||
Packet_descriptor &packet)
|
||||
@ -127,7 +107,7 @@ class Block::Exynos5_driver : public Block::Driver
|
||||
session->complete_packet(packet);
|
||||
}
|
||||
|
||||
void write_dma(Genode::size_t block_number,
|
||||
void write_dma(Block::sector_t block_number,
|
||||
Genode::size_t block_count,
|
||||
Genode::addr_t phys,
|
||||
Packet_descriptor &packet)
|
||||
|
@ -325,7 +325,7 @@ struct Exynos5_msh_controller : private Dwmmc, Sd_card::Host_controller
|
||||
using namespace Sd_card;
|
||||
|
||||
powerup();
|
||||
|
||||
|
||||
if (!reset(_delayer))
|
||||
throw Detection_failed();
|
||||
|
||||
@ -628,7 +628,7 @@ struct Exynos5_msh_controller : private Dwmmc, Sd_card::Host_controller
|
||||
|
||||
/* return sector count */
|
||||
uint64_t capacity = csd.read<Sd_card::Ext_csd::Sector_count>() * BLOCK_SIZE;
|
||||
|
||||
|
||||
/* to MB */
|
||||
return capacity / (1024 * 1024);
|
||||
}
|
||||
@ -638,19 +638,7 @@ struct Exynos5_msh_controller : private Dwmmc, Sd_card::Host_controller
|
||||
return _card_info;
|
||||
}
|
||||
|
||||
bool read_blocks(size_t block_number, size_t block_count, char *out_buffer)
|
||||
{
|
||||
PWRN("'read_blocks' not implemented");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool write_blocks(size_t block_number, size_t block_count, char const *buffer)
|
||||
{
|
||||
PWRN("'write_blocks' not implemented");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool read_blocks_dma(size_t block_number, size_t block_count,
|
||||
bool read_blocks_dma(Block::sector_t block_number, size_t block_count,
|
||||
Genode::addr_t buffer_phys)
|
||||
{
|
||||
if (!_setup_idmac_descriptor_table(block_count, buffer_phys))
|
||||
@ -671,7 +659,7 @@ struct Exynos5_msh_controller : private Dwmmc, Sd_card::Host_controller
|
||||
return complete;
|
||||
}
|
||||
|
||||
bool write_blocks_dma(size_t block_number, size_t block_count,
|
||||
bool write_blocks_dma(Block::sector_t block_number, size_t block_count,
|
||||
Genode::addr_t buffer_phys)
|
||||
{
|
||||
if (!_setup_idmac_descriptor_table(block_count, buffer_phys))
|
||||
|
@ -77,7 +77,7 @@ class Block::Omap4_driver : public Block::Driver
|
||||
|
||||
Genode::size_t block_size() { return 512; }
|
||||
|
||||
virtual Genode::size_t block_count()
|
||||
virtual Block::sector_t block_count()
|
||||
{
|
||||
return _controller.card_info().capacity_mb() * 1024 * 2;
|
||||
}
|
||||
@ -90,7 +90,7 @@ class Block::Omap4_driver : public Block::Driver
|
||||
return o;
|
||||
}
|
||||
|
||||
void read(Genode::size_t block_number,
|
||||
void read(Block::sector_t block_number,
|
||||
Genode::size_t block_count,
|
||||
char *out_buffer,
|
||||
Packet_descriptor &packet)
|
||||
@ -100,7 +100,7 @@ class Block::Omap4_driver : public Block::Driver
|
||||
session->complete_packet(packet);
|
||||
}
|
||||
|
||||
void write(Genode::size_t block_number,
|
||||
void write(Block::sector_t block_number,
|
||||
Genode::size_t block_count,
|
||||
char const *buffer,
|
||||
Packet_descriptor &packet)
|
||||
@ -110,7 +110,7 @@ class Block::Omap4_driver : public Block::Driver
|
||||
session->complete_packet(packet);
|
||||
}
|
||||
|
||||
void read_dma(Genode::size_t block_number,
|
||||
void read_dma(Block::sector_t block_number,
|
||||
Genode::size_t block_count,
|
||||
Genode::addr_t phys,
|
||||
Packet_descriptor &packet)
|
||||
@ -120,7 +120,7 @@ class Block::Omap4_driver : public Block::Driver
|
||||
session->complete_packet(packet);
|
||||
}
|
||||
|
||||
void write_dma(Genode::size_t block_number,
|
||||
void write_dma(Block::sector_t block_number,
|
||||
Genode::size_t block_count,
|
||||
Genode::addr_t phys,
|
||||
Packet_descriptor &packet)
|
||||
|
@ -78,7 +78,7 @@ class Sd_card : public Block::Driver
|
||||
/*
|
||||
* TODO report (and support) real capacity not just 512M
|
||||
*/
|
||||
Genode::size_t block_count() { return 0x20000000 / BLOCK_SIZE; }
|
||||
Block::sector_t block_count() { return 0x20000000 / BLOCK_SIZE; }
|
||||
|
||||
Block::Session::Operations ops()
|
||||
{
|
||||
@ -88,7 +88,7 @@ class Sd_card : public Block::Driver
|
||||
return o;
|
||||
}
|
||||
|
||||
void read(Genode::size_t block_number,
|
||||
void read(Block::sector_t block_number,
|
||||
Genode::size_t block_count,
|
||||
char *out_buffer,
|
||||
Block::Packet_descriptor &packet)
|
||||
@ -110,7 +110,7 @@ class Sd_card : public Block::Driver
|
||||
session->complete_packet(packet);
|
||||
}
|
||||
|
||||
void write(Genode::size_t block_number,
|
||||
void write(Block::sector_t block_number,
|
||||
Genode::size_t block_count,
|
||||
char const *buffer,
|
||||
Block::Packet_descriptor &packet)
|
||||
|
@ -489,7 +489,7 @@ namespace Iso {
|
||||
Sector::_blk = &_blk;
|
||||
Sector::_source = _blk.tx();
|
||||
|
||||
size_t blk_cnt = 0;
|
||||
Block::sector_t blk_cnt = 0;
|
||||
Block::Session::Operations ops;
|
||||
_blk.info(&blk_cnt, &Sector::_blk_size, &ops);
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ namespace Partition {
|
||||
_alloc_sem.up();
|
||||
|
||||
if (!_p.succeeded()) {
|
||||
PERR("Could not access block %zu", _p.block_number());
|
||||
PERR("Could not access block %llu", _p.block_number());
|
||||
throw Io_error();
|
||||
}
|
||||
}
|
||||
|
@ -47,8 +47,8 @@ class Rom_blk : public Block::Driver
|
||||
** Block-driver interface **
|
||||
****************************/
|
||||
|
||||
Genode::size_t block_size() { return _blk_sz; }
|
||||
Genode::size_t block_count() { return _blk_cnt; }
|
||||
Genode::size_t block_size() { return _blk_sz; }
|
||||
Block::sector_t block_count() { return _blk_cnt; }
|
||||
|
||||
Block::Session::Operations ops()
|
||||
{
|
||||
@ -57,7 +57,7 @@ class Rom_blk : public Block::Driver
|
||||
return o;
|
||||
}
|
||||
|
||||
void read(Genode::size_t block_number,
|
||||
void read(Block::sector_t block_number,
|
||||
Genode::size_t block_count,
|
||||
char* buffer,
|
||||
Block::Packet_descriptor &packet)
|
||||
@ -65,12 +65,12 @@ class Rom_blk : public Block::Driver
|
||||
/* sanity check block number */
|
||||
if ((block_number + block_count > _file_sz / _blk_sz)
|
||||
|| block_number < 0) {
|
||||
PWRN("requested blocks %zd-%zd out of range!",
|
||||
PWRN("requested blocks %lld-%lld out of range!",
|
||||
block_number, block_number + block_count);
|
||||
return;
|
||||
}
|
||||
|
||||
size_t offset = block_number * _blk_sz;
|
||||
size_t offset = (size_t) block_number * _blk_sz;
|
||||
size_t size = block_count * _blk_sz;
|
||||
|
||||
/* copy file content to packet payload */
|
||||
|
@ -158,7 +158,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* check block-connection info */
|
||||
Genode::size_t _blk_size = 0;
|
||||
size_t blk_cnt = 0;
|
||||
Block::sector_t blk_cnt = 0;
|
||||
Block::Session::Operations ops;
|
||||
_blk_con.info(&blk_cnt, &_blk_size, &ops);
|
||||
if (!ops.supported(Block::Packet_descriptor::READ)) {
|
||||
|
@ -47,8 +47,8 @@ class Driver : public Block::Driver
|
||||
** Block::Driver interface **
|
||||
*******************************/
|
||||
|
||||
Genode::size_t block_size() { return BLOCK_SIZE; }
|
||||
Genode::size_t block_count() { return _fb_size / BLOCK_SIZE; }
|
||||
Genode::size_t block_size() { return BLOCK_SIZE; }
|
||||
Block::sector_t block_count() { return _fb_size / BLOCK_SIZE; }
|
||||
|
||||
Block::Session::Operations ops()
|
||||
{
|
||||
@ -58,14 +58,14 @@ class Driver : public Block::Driver
|
||||
return ops;
|
||||
}
|
||||
|
||||
void read(Genode::size_t block_number,
|
||||
void read(Block::sector_t block_number,
|
||||
Genode::size_t block_count,
|
||||
char *buffer,
|
||||
Block::Packet_descriptor &packet)
|
||||
{
|
||||
/* sanity check block number */
|
||||
if (block_number + block_count > _fb_size / BLOCK_SIZE) {
|
||||
PWRN("Out of range: requested %zd blocks from block %zd",
|
||||
PWRN("Out of range: requested %zd blocks from block %llu",
|
||||
block_count, block_number);
|
||||
return;
|
||||
}
|
||||
@ -77,14 +77,14 @@ class Driver : public Block::Driver
|
||||
session->complete_packet(packet);
|
||||
}
|
||||
|
||||
void write(Genode::size_t block_number,
|
||||
void write(Block::sector_t block_number,
|
||||
Genode::size_t block_count,
|
||||
char const *buffer,
|
||||
Block::Packet_descriptor &packet)
|
||||
{
|
||||
/* sanity check block number */
|
||||
if (block_number + block_count > _fb_size / BLOCK_SIZE) {
|
||||
PWRN("Out of range: requested %zd blocks from block %zd",
|
||||
PWRN("Out of range: requested %zd blocks from block %llu",
|
||||
block_count, block_number);
|
||||
return;
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ class Sector
|
||||
_p = _blk.tx()->get_acked_packet();
|
||||
|
||||
if (!_p.succeeded())
|
||||
PERR("Could not access block %zu", _p.block_number());
|
||||
PERR("Could not access block %llu", _p.block_number());
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -51,7 +51,7 @@ class Comparer : public Genode::Thread<8192>
|
||||
|
||||
Block::Session::Tx::Source *source = _blk_con.tx();
|
||||
size_t blk_size = 0;
|
||||
size_t blk_cnt = 0;
|
||||
Block::sector_t blk_cnt = 0;
|
||||
Genode::addr_t end =
|
||||
_addr + Dataspace_client(_rom.dataspace()).size();
|
||||
Block::Session::Operations ops;
|
||||
@ -61,7 +61,7 @@ class Comparer : public Genode::Thread<8192>
|
||||
PERR("Block device not readable!");
|
||||
}
|
||||
|
||||
PINF("We have %zx blocks with a size of %zx bytes", blk_cnt, blk_size);
|
||||
PINF("We have %llu blocks with a size of 0x%zx bytes", blk_cnt, blk_size);
|
||||
|
||||
for (size_t i = 0; i < blk_cnt; i += BLOCK_REQ_PARALLEL) {
|
||||
try {
|
||||
|
@ -91,7 +91,7 @@ namespace {
|
||||
Genode::Allocator_avl _alloc;
|
||||
Block::Connection _session;
|
||||
Genode::size_t _blk_size;
|
||||
Genode::size_t _blk_cnt;
|
||||
Block::sector_t _blk_cnt;
|
||||
Block::Session::Operations _blk_ops;
|
||||
Genode::Native_capability _irq_cap;
|
||||
Genode::Signal_context _tx;
|
||||
|
@ -91,7 +91,7 @@ class Vancouver_disk : public Genode::Thread<8192>, public StaticReceiver<Vancou
|
||||
Block::Connection *blk_con;
|
||||
Block::Session::Operations ops;
|
||||
Genode::size_t blk_size;
|
||||
Genode::size_t blk_cnt;
|
||||
Block::sector_t blk_cnt;
|
||||
Vancouver_disk_signal *dispatcher;
|
||||
} _diskcon[MAX_DISKS];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user