genode/ports/src/vancouver/device_model_registry.cc
Markus Partheymueller cbf4a7b0c3 vancouver: Disk support
Vancouver can now assign block devices to guests using the Block
interface. The machine has to be configured to use a specified drive,
which could be theoretically routed to different partitions or services
via policy definitions. Currently the USB driver only supports one
device. Genode's AHCI driver is untested.

If the session quota is too low, random pagefaults can occur on the
stack.

According to @Nils-TUD, it is necessary to protect the DiskCommit
messages with a lock against deadlocking with the timer. Observations
showed that this mitigates some problems with Gentoo on real hardware.
2013-02-13 15:09:23 +01:00

102 lines
3.1 KiB
C++

/*
* \brief Meta-data registry about the device models of Vancouver
* \author Norman Feske
* \author Markus Partheymueller
* \date 2011-11-18
*/
/*
* Copyright (C) 2011-2013 Genode Labs GmbH
* Copyright (C) 2012 Intel Corporation
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*
* The code is partially based on the Vancouver VMM, which is distributed
* under the terms of the GNU General Public License version 2.
*
* Modifications by Intel Corporation are contributed under the terms and
* conditions of the GNU General Public License version 2.
*/
/* local includes */
#include <device_model_registry.h>
Device_model_registry *device_model_registry()
{
static Device_model_registry inst;
return &inst;
}
Device_model_info::Device_model_info(char const *name, Create create,
char const *arg_names[])
:
name(name), create(create), arg_names(arg_names)
{
device_model_registry()->insert(this);
}
/**
* Helper macro to create global 'Device_model_info' objects
*/
#define MODEL_INFO(name, ...) \
extern "C" void __parameter_##name##_function(Motherboard &, unsigned long *, \
const char *, unsigned); \
static char const * name##_arg_names[] = { __VA_ARGS__ , 0 }; \
static Device_model_info \
name##_model_info(#name, __parameter_##name##_function, name##_arg_names);
#define MODEL_INFO_NO_ARG(name) MODEL_INFO(name, 0)
/*******************************
** Registry of device models **
*******************************/
/*
* For each device model, a dedicated global 'Device_model_info' object is
* created. At construction time, each 'Device_model_info' adds itself to
* the 'Device_model_registry'.
*
* We supplement the device models with the information about their argument
* names. This enables us to describe a virtual machine via a simple XML format
* instead of using a special syntax.
*/
MODEL_INFO(mem, "start", "end")
MODEL_INFO(nullio, "io_base", "size")
MODEL_INFO(pic, "io_base", "irq", "elcr_base")
MODEL_INFO(pit, "io_base", "irq")
MODEL_INFO(scp, "io_port_a", "io_port_b")
MODEL_INFO(kbc, "io_base", "irq_kbd", "irq_aux")
MODEL_INFO(keyb, "ps2_port", "host_keyboard")
MODEL_INFO(mouse, "ps2_port", "host_mouse")
MODEL_INFO(rtc, "io_base", "irq")
MODEL_INFO(serial, "io_base", "irq", "host_serial")
MODEL_INFO(vga, "io_base", "fb_size")
MODEL_INFO(pmtimer, "io_port")
MODEL_INFO(pcihostbridge, "bus_num", "bus_count", "io_base", "mem_base")
MODEL_INFO(i82576vf, "promisc", "mem_mmio", "mem_msix", "txpoll_us", "rx_map")
MODEL_INFO(ahci, "mem", "irq", "bdf")
MODEL_INFO(drive, "sigma0drive", "controller", "port")
MODEL_INFO_NO_ARG(vbios_disk)
MODEL_INFO_NO_ARG(vbios_keyboard)
MODEL_INFO_NO_ARG(vbios_mem)
MODEL_INFO_NO_ARG(vbios_time)
MODEL_INFO_NO_ARG(vbios_reset)
MODEL_INFO_NO_ARG(vbios_multiboot)
MODEL_INFO_NO_ARG(msi)
MODEL_INFO_NO_ARG(ioapic)
MODEL_INFO_NO_ARG(vcpu)
MODEL_INFO_NO_ARG(halifax)
MODEL_INFO_NO_ARG(vbios)
MODEL_INFO_NO_ARG(lapic)
MODEL_INFO(hostsink, "host_dev", "buffer")