mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-23 23:42:32 +00:00
virtdev_rom: Add RISC-V platform support.
The location of the VirtIO device block is different on RISC-V virt qemu machine.
This commit is contained in:
parent
6e4c3b2fd6
commit
e7fb38834a
@ -21,6 +21,9 @@
|
||||
#include <root/component.h>
|
||||
#include <util/xml_generator.h>
|
||||
|
||||
/* local includes */
|
||||
#include "platform_config.h"
|
||||
|
||||
namespace Virtdev_rom {
|
||||
using namespace Genode;
|
||||
class Session_component;
|
||||
@ -81,16 +84,7 @@ class Virtdev_rom::Root : public Root_component<Session_component>
|
||||
|
||||
struct Virtdev_rom::Main
|
||||
{
|
||||
enum {
|
||||
/* Taken from include/hw/arm/virt.h in Qemu source tree. */
|
||||
NUM_VIRTIO_TRANSPORTS = 32,
|
||||
/* Taken from hw/arm/virt.c in Qemu source tree. */
|
||||
BASE_ADDRESS = 0x0A000000,
|
||||
DEVICE_SIZE = 0x200,
|
||||
IRQ_BASE = 48,
|
||||
VIRTIO_MMIO_MAGIC = 0x74726976,
|
||||
};
|
||||
|
||||
enum { VIRTIO_MMIO_MAGIC = 0x74726976 };
|
||||
enum { MAX_ROM_SIZE = 4096, DEVICE_NAME_LEN = 64 };
|
||||
|
||||
Env &_env;
|
||||
@ -147,7 +141,7 @@ struct Virtdev_rom::Main
|
||||
Device device { _env, BASE_ADDRESS + idx * DEVICE_SIZE, DEVICE_SIZE };
|
||||
|
||||
if (device.read<Device::Magic>() != VIRTIO_MMIO_MAGIC) {
|
||||
warning("Found non VirtIO MMIO device @ ", addr);
|
||||
warning("Found non VirtIO MMIO device @ ", Hex(addr));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
23
repos/os/src/drivers/virtdev_rom/spec/arm/platform_config.h
Normal file
23
repos/os/src/drivers/virtdev_rom/spec/arm/platform_config.h
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* \brief ARM specific config for virtio device ROM.
|
||||
* \author Piotr Tworek
|
||||
* \date 2022-06-12
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2022 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
namespace Virtdev_rom {
|
||||
enum {
|
||||
/* Taken from include/hw/arm/virt.h in Qemu source tree. */
|
||||
NUM_VIRTIO_TRANSPORTS = 32,
|
||||
/* Taken from hw/arm/virt.c in Qemu source tree. */
|
||||
BASE_ADDRESS = 0x0A000000,
|
||||
DEVICE_SIZE = 0x200,
|
||||
IRQ_BASE = 48,
|
||||
};
|
||||
}
|
5
repos/os/src/drivers/virtdev_rom/spec/arm/target.mk
Normal file
5
repos/os/src/drivers/virtdev_rom/spec/arm/target.mk
Normal file
@ -0,0 +1,5 @@
|
||||
REQUIRES = arm
|
||||
|
||||
INC_DIR = $(PRG_DIR)
|
||||
|
||||
include $(REP_DIR)/src/drivers/virtdev_rom/target.inc
|
5
repos/os/src/drivers/virtdev_rom/spec/arm_64/target.mk
Normal file
5
repos/os/src/drivers/virtdev_rom/spec/arm_64/target.mk
Normal file
@ -0,0 +1,5 @@
|
||||
REQUIRES = arm_64
|
||||
|
||||
INC_DIR = $(PRG_DIR)/../arm
|
||||
|
||||
include $(REP_DIR)/src/drivers/virtdev_rom/target.inc
|
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* \brief RISC-V specific config for virtio device ROM.
|
||||
* \author Piotr Tworek
|
||||
* \date 2022-06-12
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2022 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
namespace Virtdev_rom {
|
||||
enum {
|
||||
/* Taken from include/hw/riscv/virt.h in Qemu source tree. */
|
||||
NUM_VIRTIO_TRANSPORTS = 8,
|
||||
IRQ_BASE = 1,
|
||||
/* Taken from hw/riscv/virt.c in Qemu source tree. */
|
||||
BASE_ADDRESS = 0x10001000,
|
||||
DEVICE_SIZE = 0x1000,
|
||||
};
|
||||
}
|
5
repos/os/src/drivers/virtdev_rom/spec/riscv/target.mk
Normal file
5
repos/os/src/drivers/virtdev_rom/spec/riscv/target.mk
Normal file
@ -0,0 +1,5 @@
|
||||
REQUIRES = riscv
|
||||
|
||||
INC_DIR = $(PRG_DIR)
|
||||
|
||||
include $(REP_DIR)/src/drivers/virtdev_rom/target.inc
|
@ -1,3 +1,5 @@
|
||||
TARGET = virtdev_rom
|
||||
SRC_CC = main.cc
|
||||
LIBS = base
|
||||
|
||||
vpath main.cc $(REP_DIR)/src/drivers/virtdev_rom
|
Loading…
Reference in New Issue
Block a user