seoul: fix raw disc boot for 512B sectorsize

Fixes #1702
This commit is contained in:
Alexander Boettcher 2015-09-06 11:24:42 +02:00 committed by Christian Helmuth
parent 21e86227bc
commit 36947cef3a
9 changed files with 38 additions and 16 deletions

View File

@ -12,6 +12,7 @@ assert_spec nova
set use_multiboot 1
set use_genode_iso 0
set use_block_ram 0
set use_block_sata 0
set use_nic_session 1

View File

@ -10,7 +10,8 @@
set use_multiboot 0
set use_genode_iso 0
set use_block_sata 1
set use_block_ram 1
set use_block_sata 0
set use_nic_session 0
set use_nic_bridge 0

View File

@ -13,6 +13,7 @@
set use_multiboot 1
set use_genode_iso 0
set use_block_ram 0
set use_block_sata 0
set use_nic_session 1

View File

@ -11,6 +11,7 @@
set use_multiboot 1
set use_genode_iso 1
set use_block_ram 0
set use_block_sata 0
set use_nic_session 1

View File

@ -17,6 +17,7 @@ if {[have_include power_on/qemu]} {
set use_multiboot 1
set use_genode_iso 0
set use_block_ram 0
set use_block_sata 0
set use_nic_session 0

View File

@ -10,6 +10,7 @@
set use_multiboot 1
set use_genode_iso 0
set use_block_ram 0
set use_block_sata 0
set use_nic_session 1

View File

@ -31,6 +31,7 @@ set build_components {
if {$use_fancy_stuff} { set use_framebuffer 1 }
lappend_if $use_usb build_components drivers/usb
lappend_if $use_block_ram build_components server/ram_blk
lappend_if $use_block_sata build_components drivers/ahci
lappend_if $use_nic_session build_components drivers/nic
lappend_if $use_nic_bridge build_components server/nic_bridge
@ -170,15 +171,21 @@ append_if [expr !$use_usb] config {
</start> }
append_if $use_block_sata config {
<start name="ahci" priority="-1">
<binary name="ahci_drv" />
<start name="ahci_drv" priority="-1">
<resource name="RAM" quantum="1M" />
<provides><service name="Block"/></provides>
<config>
<policy label="seoul" device="0" />
<policy label="seoul -> VirtualDisk 0" device="0" />
</config>
</start>}
append_if $use_block_ram config {
<start name="ram_blk" priority="-1">
<resource name="RAM" quantum="1M" />
<provides><service name="Block"/></provides>
<config file="seoul-disc.raw" block_size="512"/>
</start>}
append_if $use_genode_iso config {
<start name="rom_blk" priority="-1">
<resource name="RAM" quantum="16M" />
@ -405,6 +412,7 @@ set boot_modules {
lappend_if [expr !$use_usb] boot_modules ps2_drv
lappend_if $use_usb boot_modules usb_drv
lappend_if $use_block_ram boot_modules ram_blk
lappend_if $use_block_sata boot_modules ahci_drv
lappend_if $use_nic_session boot_modules nic_drv
lappend_if $use_nic_bridge boot_modules nic_bridge
@ -423,6 +431,8 @@ lappend_if $use_genode_iso boot_modules rom_blk
lappend_if $use_genode_iso boot_modules iso9660
lappend_if $use_genode_iso boot_modules genode.iso
lappend_if $use_block_ram boot_modules seoul-disc.raw
#
# Add OS binaries of guest
#

View File

@ -46,6 +46,16 @@ static Genode::Signal_receiver* disk_receiver()
static Genode::Heap * disk_heap() {
using namespace Genode;
static Heap heap(env()->ram_session(), env()->rm_session());
return &heap;
}
static Genode::Heap * disk_heap_msg() {
using namespace Genode;
static Heap heap(env()->ram_session(), env()->rm_session(), 4096);
return &heap;
}
static Genode::Heap * disk_heap_avl() {
using namespace Genode;
static Heap heap(env()->ram_session(), env()->rm_session(), 4096);
return &heap;
@ -60,7 +70,8 @@ Vancouver_disk::Vancouver_disk(Synced_motherboard &mb,
_motherboard(mb),
_backing_store_base(backing_store_base),
_backing_store_size(backing_store_size),
_tslab_msg(disk_heap()), _tslab_dma(disk_heap()), _tslab_avl(disk_heap())
_tslab_msg(disk_heap_msg()),
_tslab_avl(disk_heap_avl())
{
/* initialize struct with 0 size */
for (int i=0; i < MAX_DISKS; i++) {
@ -154,7 +165,7 @@ void Vancouver_disk::_signal_dispatch_entry(unsigned disknr)
sector += msg->dma[i].bytecount;
}
destroy(&_tslab_dma, msg->dma);
destroy(disk_heap(), msg->dma);
msg->dma = 0;
}
@ -180,11 +191,10 @@ bool Vancouver_disk::receive(MessageDisk &msg)
* If we receive a message for this disk the first time, create the
* structure for it.
*/
char label[14];
Genode::snprintf(label, 14, "VirtualDisk %2u", msg.disknr);
char label[16];
Genode::snprintf(label, 16, "VirtualDisk %u", msg.disknr);
if (!_diskcon[msg.disknr].blk_size) {
try {
Genode::Allocator_avl * block_alloc =
new Genode::Allocator_avl(disk_heap());
@ -276,7 +286,7 @@ bool Vancouver_disk::receive(MessageDisk &msg)
/* copy DMA descriptors for read requests - they may change */
if (!write) {
msg_cpy->dma = new (&_tslab_dma) DmaDescriptor[msg_cpy->dmacount];
msg_cpy->dma = new (disk_heap()) DmaDescriptor[msg_cpy->dmacount];
for (unsigned i = 0; i < msg_cpy->dmacount; i++)
memcpy(msg_cpy->dma + i, msg.dma + i, sizeof(DmaDescriptor));
}
@ -295,7 +305,7 @@ bool Vancouver_disk::receive(MessageDisk &msg)
|| dma_addr < _backing_store_base) {
/* drop allocated objects not needed in error case */
if (write)
destroy(&_tslab_dma, msg_cpy->dma);
destroy(disk_heap(), msg_cpy->dma);
destroy(&_tslab_msg, msg_cpy);
source->release_packet(packet);
return false;

View File

@ -98,15 +98,11 @@ class Vancouver_disk : public Genode::Thread<8192>, public StaticReceiver<Vancou
char * const _backing_store_base;
size_t const _backing_store_size;
/* slabs for temporary holding DMADescriptor and MessageDisk objects */
/* slabs for temporary holding MessageDisk objects */
typedef Genode::Tslab<MessageDisk, 128> MessageDisk_Slab;
typedef Genode::Synced_allocator<MessageDisk_Slab> MessageDisk_Slab_Sync;
typedef Genode::Tslab<DmaDescriptor, 256> DmaDesc_Slab;
typedef Genode::Synced_allocator<DmaDesc_Slab> DmaDesc_Slab_Sync;
MessageDisk_Slab_Sync _tslab_msg;
DmaDesc_Slab_Sync _tslab_dma;
/* Structure to find back the MessageDisk object out of a Block Ack */
typedef Genode::Tslab<Avl_entry, 128> Avl_entry_slab;