parent
954aff7002
commit
f23579532e
|
@ -124,7 +124,7 @@ class Audio_out::Out
|
||||||
/* convert float to S16LE */
|
/* convert float to S16LE */
|
||||||
static short data[Audio_out::PERIOD * Audio_out::MAX_CHANNELS];
|
static short data[Audio_out::PERIOD * Audio_out::MAX_CHANNELS];
|
||||||
|
|
||||||
for (int i = 0; i < Audio_out::PERIOD * Audio_out::MAX_CHANNELS; i += 2) {
|
for (unsigned i = 0; i < Audio_out::PERIOD * Audio_out::MAX_CHANNELS; i += 2) {
|
||||||
data[i] = p_left->content()[i / 2] * 32767;
|
data[i] = p_left->content()[i / 2] * 32767;
|
||||||
data[i + 1] = p_right->content()[i / 2] * 32767;
|
data[i + 1] = p_right->content()[i / 2] * 32767;
|
||||||
}
|
}
|
||||||
|
@ -494,7 +494,7 @@ struct Main
|
||||||
void handle_config_update()
|
void handle_config_update()
|
||||||
{
|
{
|
||||||
config.update();
|
config.update();
|
||||||
if (!config.is_valid()) { return; }
|
if (!config.valid()) { return; }
|
||||||
Audio::update_config(env, config.xml());
|
Audio::update_config(env, config.xml());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -334,17 +334,17 @@ static void configure_mixer(Genode::Env &env, Mixer &mixer, Genode::Xml_node con
|
||||||
mixer_reporter.enabled(v);
|
mixer_reporter.enabled(v);
|
||||||
|
|
||||||
config.for_each_sub_node("mixer", [&] (Xml_node node) {
|
config.for_each_sub_node("mixer", [&] (Xml_node node) {
|
||||||
char field[32];
|
|
||||||
char value[16];
|
|
||||||
try {
|
|
||||||
node.attribute("field").value(field, sizeof(field));
|
|
||||||
node.attribute("value").value(value, sizeof(value));
|
|
||||||
|
|
||||||
set_mixer_value(mixer, field, value);
|
typedef String<32> Field;
|
||||||
} catch (Xml_attribute::Nonexistent_attribute) { }
|
typedef String<16> Value;
|
||||||
|
|
||||||
|
Field const field = node.attribute_value("field", Field());
|
||||||
|
Value const value = node.attribute_value("value", Value());
|
||||||
|
|
||||||
|
set_mixer_value(mixer, field.string(), value.string());
|
||||||
});
|
});
|
||||||
|
|
||||||
if (mixer_reporter.is_enabled()) try {
|
if (mixer_reporter.enabled()) try {
|
||||||
Genode::Reporter::Xml_generator xml(mixer_reporter, [&]() {
|
Genode::Reporter::Xml_generator xml(mixer_reporter, [&]() {
|
||||||
|
|
||||||
for (unsigned i = 0; i < mixer.num; i++) {
|
for (unsigned i = 0; i < mixer.num; i++) {
|
||||||
|
|
|
@ -57,7 +57,7 @@ class Bsd::Slab_backend_alloc : public Genode::Allocator,
|
||||||
addr_t _ds_phys[ELEMENTS]; /* physical bases of dataspaces */
|
addr_t _ds_phys[ELEMENTS]; /* physical bases of dataspaces */
|
||||||
int _index; /* current index in ds_cap */
|
int _index; /* current index in ds_cap */
|
||||||
Genode::Allocator_avl _range; /* manage allocations */
|
Genode::Allocator_avl _range; /* manage allocations */
|
||||||
Genode::Ram_session &_ram; /* ram session to allocate ds from */
|
Genode::Ram_allocator &_ram; /* allocator to allocate ds from */
|
||||||
|
|
||||||
bool _alloc_block()
|
bool _alloc_block()
|
||||||
{
|
{
|
||||||
|
@ -81,7 +81,7 @@ class Bsd::Slab_backend_alloc : public Genode::Allocator,
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Slab_backend_alloc(Genode::Env &env, Genode::Ram_session &ram,
|
Slab_backend_alloc(Genode::Env &env, Genode::Ram_allocator &ram,
|
||||||
Genode::Region_map &rm, Genode::Allocator &md_alloc)
|
Genode::Region_map &rm, Genode::Allocator &md_alloc)
|
||||||
:
|
:
|
||||||
Rm_connection(env),
|
Rm_connection(env),
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Genode includes */
|
/* Genode includes */
|
||||||
#include <base/printf.h>
|
|
||||||
#include <base/sleep.h>
|
#include <base/sleep.h>
|
||||||
#include <base/snprintf.h>
|
#include <base/snprintf.h>
|
||||||
#include <util/string.h>
|
#include <util/string.h>
|
||||||
|
@ -40,27 +39,36 @@ void mtx_leave(struct mutex *mtx) {
|
||||||
** sys/systm.h **
|
** sys/systm.h **
|
||||||
*****************/
|
*****************/
|
||||||
|
|
||||||
extern "C" void panic(const char *fmt, ...)
|
static int _vprintf(char const *format, va_list list)
|
||||||
{
|
{
|
||||||
va_list va;
|
char buf[128] { };
|
||||||
|
Genode::String_console sc(buf, sizeof(buf));
|
||||||
|
sc.vprintf(format, list);
|
||||||
|
return sc.len();
|
||||||
|
}
|
||||||
|
|
||||||
va_start(va, fmt);
|
|
||||||
Genode::vprintf(fmt, va);
|
extern "C" void panic(char const *format, ...)
|
||||||
va_end(va);
|
{
|
||||||
|
va_list list;
|
||||||
|
|
||||||
|
va_start(list, format);
|
||||||
|
_vprintf(format, list);
|
||||||
|
va_end(list);
|
||||||
|
|
||||||
Genode::sleep_forever();
|
Genode::sleep_forever();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern "C" int printf(const char *fmt, ...)
|
extern "C" int printf(const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list va;
|
va_list list;
|
||||||
|
|
||||||
va_start(va, fmt);
|
va_start(list, format);
|
||||||
Genode::vprintf(fmt, va);
|
int const result = _vprintf(format, list);
|
||||||
va_end(va);
|
va_end(list);
|
||||||
|
|
||||||
return 0; /* XXX proper return value */
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
/* Genode includes */
|
/* Genode includes */
|
||||||
#include <base/log.h>
|
#include <base/log.h>
|
||||||
#include <base/sleep.h>
|
#include <base/sleep.h>
|
||||||
|
#include <base/allocator.h>
|
||||||
|
|
||||||
/* local includes */
|
/* local includes */
|
||||||
#include <bsd.h>
|
#include <bsd.h>
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
/* Genode includes */
|
/* Genode includes */
|
||||||
#include <base/allocator_avl.h>
|
#include <base/allocator_avl.h>
|
||||||
#include <base/env.h>
|
#include <base/env.h>
|
||||||
#include <base/printf.h>
|
|
||||||
#include <base/log.h>
|
#include <base/log.h>
|
||||||
#include <base/slab.h>
|
#include <base/slab.h>
|
||||||
#include <dataspace/client.h>
|
#include <dataspace/client.h>
|
||||||
|
@ -72,8 +71,14 @@ extern "C" int dde_support_initialized(void)
|
||||||
** printf **
|
** printf **
|
||||||
************/
|
************/
|
||||||
|
|
||||||
extern "C" void dde_vprintf(const char *fmt, va_list va) {
|
extern "C" void dde_vprintf(const char *format, va_list list)
|
||||||
Genode::vprintf(fmt, va); }
|
{
|
||||||
|
using namespace Genode;
|
||||||
|
|
||||||
|
char buf[128] { };
|
||||||
|
String_console(buf, sizeof(buf)).vprintf(format, list);
|
||||||
|
log(Cstring(buf));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
extern "C" void dde_printf(const char *fmt, ...)
|
extern "C" void dde_printf(const char *fmt, ...)
|
||||||
|
@ -467,7 +472,7 @@ struct Slab_backend_alloc : public Genode::Allocator,
|
||||||
Genode::Ram_dataspace_capability _ds_cap[ELEMENTS];
|
Genode::Ram_dataspace_capability _ds_cap[ELEMENTS];
|
||||||
int _index;
|
int _index;
|
||||||
Genode::Allocator_avl _range;
|
Genode::Allocator_avl _range;
|
||||||
Genode::Ram_session &_ram;
|
Genode::Ram_allocator &_ram;
|
||||||
|
|
||||||
bool _alloc_block()
|
bool _alloc_block()
|
||||||
{
|
{
|
||||||
|
@ -492,7 +497,7 @@ struct Slab_backend_alloc : public Genode::Allocator,
|
||||||
}
|
}
|
||||||
|
|
||||||
Slab_backend_alloc(Genode::Env &env, Genode::Region_map &rm,
|
Slab_backend_alloc(Genode::Env &env, Genode::Region_map &rm,
|
||||||
Genode::Ram_session &ram,
|
Genode::Ram_allocator &ram,
|
||||||
Genode::Allocator &md_alloc)
|
Genode::Allocator &md_alloc)
|
||||||
:
|
:
|
||||||
Rm_connection(env),
|
Rm_connection(env),
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
2019-01-13 f7ccf2c2c0820f4e9b2153f6aeb7fe6a5194e309
|
2019-01-19-b ae0b702188012c3d8c790eb087706823ea81c7ae
|
||||||
|
|
|
@ -113,7 +113,7 @@ class Framebuffer::Session_component : public Genode::Rpc_object<Session>
|
||||||
Genode::Attached_rom_dataspace &_config;
|
Genode::Attached_rom_dataspace &_config;
|
||||||
Genode::Signal_context_capability _mode_sigh;
|
Genode::Signal_context_capability _mode_sigh;
|
||||||
Timer::Connection _timer;
|
Timer::Connection _timer;
|
||||||
Genode::Ram_session &_ram;
|
Genode::Ram_allocator &_ram;
|
||||||
Genode::Attached_ram_dataspace _ds;
|
Genode::Attached_ram_dataspace _ds;
|
||||||
bool _in_mode_change = true;
|
bool _in_mode_change = true;
|
||||||
|
|
||||||
|
|
|
@ -106,9 +106,9 @@ Framebuffer::Driver::_preferred_mode(drm_connector *connector,
|
||||||
if (!xn.has_type("connector"))
|
if (!xn.has_type("connector"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
String<64> con_policy;
|
typedef String<64> Name;
|
||||||
xn.attribute("name").value(&con_policy);
|
Name const con_policy = xn.attribute_value("name", Name());
|
||||||
if (Genode::strcmp(con_policy.string(), connector->name) != 0)
|
if (con_policy != connector->name)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
bool enabled = xn.attribute_value("enabled", true);
|
bool enabled = xn.attribute_value("enabled", true);
|
||||||
|
@ -118,11 +118,9 @@ Framebuffer::Driver::_preferred_mode(drm_connector *connector,
|
||||||
brightness = xn.attribute_value("brightness",
|
brightness = xn.attribute_value("brightness",
|
||||||
(unsigned)MAX_BRIGHTNESS + 1);
|
(unsigned)MAX_BRIGHTNESS + 1);
|
||||||
|
|
||||||
unsigned long width = 0;
|
unsigned long const width = xn.attribute_value("width", 0UL);
|
||||||
unsigned long height = 0;
|
unsigned long const height = xn.attribute_value("height", 0UL);
|
||||||
long hz = xn.attribute_value("hz", 0L);
|
long const hz = xn.attribute_value("hz", 0L);
|
||||||
xn.attribute("width").value(&width);
|
|
||||||
xn.attribute("height").value(&height);
|
|
||||||
|
|
||||||
struct drm_display_mode *mode;
|
struct drm_display_mode *mode;
|
||||||
list_for_each_entry(mode, &connector->modes, head) {
|
list_for_each_entry(mode, &connector->modes, head) {
|
||||||
|
@ -275,7 +273,7 @@ void Framebuffer::Driver::generate_report()
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
_reporter.enabled(false);
|
_reporter.enabled(false);
|
||||||
}
|
}
|
||||||
if (!_reporter.is_enabled()) return;
|
if (!_reporter.enabled()) return;
|
||||||
|
|
||||||
/* write new report */
|
/* write new report */
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
** lx_kit/backend_alloc.h **
|
** lx_kit/backend_alloc.h **
|
||||||
****************************/
|
****************************/
|
||||||
|
|
||||||
void backend_alloc_init(Genode::Env&, Genode::Ram_session&,
|
void backend_alloc_init(Genode::Env&, Genode::Ram_allocator&,
|
||||||
Genode::Allocator&)
|
Genode::Allocator&)
|
||||||
{
|
{
|
||||||
/* intentionally left blank */
|
/* intentionally left blank */
|
||||||
|
|
|
@ -172,8 +172,8 @@ void Driver::main_task_entry(void * arg)
|
||||||
try {
|
try {
|
||||||
Genode::Xml_node config_node = Lx_kit::env().config_rom().xml();
|
Genode::Xml_node config_node = Lx_kit::env().config_rom().xml();
|
||||||
use_report = config_node.attribute_value("use_report", false);
|
use_report = config_node.attribute_value("use_report", false);
|
||||||
config_node.attribute("width").value(&screen_x);
|
config_node.attribute("width").value(screen_x);
|
||||||
config_node.attribute("height").value(&screen_y);
|
config_node.attribute("height").value(screen_y);
|
||||||
multi_touch = config_node.attribute_value("multitouch", false);
|
multi_touch = config_node.attribute_value("multitouch", false);
|
||||||
} catch(...) { }
|
} catch(...) { }
|
||||||
|
|
||||||
|
@ -211,11 +211,11 @@ void Driver::scan_report()
|
||||||
report_node.for_each_sub_node([&] (Genode::Xml_node & dev_node)
|
report_node.for_each_sub_node([&] (Genode::Xml_node & dev_node)
|
||||||
{
|
{
|
||||||
unsigned long c = 0;
|
unsigned long c = 0;
|
||||||
dev_node.attribute("class").value(&c);
|
dev_node.attribute("class").value(c);
|
||||||
if (c != USB_CLASS_HID) return;
|
if (c != USB_CLASS_HID) return;
|
||||||
|
|
||||||
Label label;
|
Label label;
|
||||||
dev_node.attribute("label").value(&label);
|
dev_node.attribute("label").value(label);
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ struct Services
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void backend_alloc_init(Genode::Env &env, Genode::Ram_session &ram, Genode::Allocator &alloc);
|
void backend_alloc_init(Genode::Env &env, Genode::Ram_allocator &ram, Genode::Allocator &alloc);
|
||||||
|
|
||||||
void platform_hcd_init(Services *services);
|
void platform_hcd_init(Services *services);
|
||||||
Genode::Irq_session_capability platform_irq_activate(int irq);
|
Genode::Irq_session_capability platform_irq_activate(int irq);
|
||||||
|
|
|
@ -960,7 +960,8 @@ class Usb::Root : public Genode::Root_component<Session_component>
|
||||||
if (xhci) xml.attribute("xhci", "yes");
|
if (xhci) xml.attribute("xhci", "yes");
|
||||||
if (ohci) xml.attribute("ohci", "yes");
|
if (ohci) xml.attribute("ohci", "yes");
|
||||||
|
|
||||||
xml.append(config.content_base(), config.content_size());
|
config.with_raw_content([&] (char const *start, size_t length) {
|
||||||
|
xml.append(start, length); });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ class Signal_helper
|
||||||
Genode::Signal_transmitter &sender() { return _sender; }
|
Genode::Signal_transmitter &sender() { return _sender; }
|
||||||
Genode::Parent &parent() { return _env.parent(); }
|
Genode::Parent &parent() { return _env.parent(); }
|
||||||
Genode::Env &env() { return _env; }
|
Genode::Env &env() { return _env; }
|
||||||
Genode::Ram_session &ram() { return _env.ram(); }
|
Genode::Ram_allocator &ram() { return _env.ram(); }
|
||||||
Genode::Region_map &rm() { return _env.rm(); }
|
Genode::Region_map &rm() { return _env.rm(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
** lx_kit/backend_alloc.h **
|
** lx_kit/backend_alloc.h **
|
||||||
****************************/
|
****************************/
|
||||||
|
|
||||||
void backend_alloc_init(Genode::Env&, Genode::Ram_session&,
|
void backend_alloc_init(Genode::Env&, Genode::Ram_allocator&,
|
||||||
Genode::Allocator&)
|
Genode::Allocator&)
|
||||||
{
|
{
|
||||||
/* intentionally left blank */
|
/* intentionally left blank */
|
||||||
|
|
|
@ -198,7 +198,7 @@ int request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
|
||||||
** Platform backend alloc init **
|
** Platform backend alloc init **
|
||||||
*********************************/
|
*********************************/
|
||||||
|
|
||||||
void backend_alloc_init(Genode::Env &env, Genode::Ram_session &ram,
|
void backend_alloc_init(Genode::Env &env, Genode::Ram_allocator &ram,
|
||||||
Genode::Allocator &alloc)
|
Genode::Allocator &alloc)
|
||||||
{
|
{
|
||||||
Lx::pci_init(env, ram, alloc);
|
Lx::pci_init(env, ram, alloc);
|
||||||
|
|
|
@ -300,7 +300,7 @@ static void random_ether_addr(u8 *addr)
|
||||||
/* try using configured mac */
|
/* try using configured mac */
|
||||||
try {
|
try {
|
||||||
Xml_node::Attribute mac_node = config_node.attribute("mac");
|
Xml_node::Attribute mac_node = config_node.attribute("mac");
|
||||||
mac_node.value(&mac);
|
mac_node.value(mac);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
/* use fallback mac */
|
/* use fallback mac */
|
||||||
snprint_mac(str, fallback);
|
snprint_mac(str, fallback);
|
||||||
|
|
|
@ -42,7 +42,7 @@ class Lx_kit::Env
|
||||||
Genode::Env &env() { return _env; }
|
Genode::Env &env() { return _env; }
|
||||||
Genode::Heap &heap() { return _heap; }
|
Genode::Heap &heap() { return _heap; }
|
||||||
Genode::Attached_rom_dataspace &config_rom() { return _config; }
|
Genode::Attached_rom_dataspace &config_rom() { return _config; }
|
||||||
Genode::Ram_session &ram() { return _env.ram(); }
|
Genode::Ram_allocator &ram() { return _env.ram(); }
|
||||||
Genode::Region_map &rm() { return _env.rm(); }
|
Genode::Region_map &rm() { return _env.rm(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -16,11 +16,12 @@
|
||||||
|
|
||||||
/* Genode includes */
|
/* Genode includes */
|
||||||
#include <base/env.h>
|
#include <base/env.h>
|
||||||
|
#include <base/allocator.h>
|
||||||
|
|
||||||
|
|
||||||
namespace Lx {
|
namespace Lx {
|
||||||
|
|
||||||
void pci_init(Genode::Env&, Genode::Ram_session&, Genode::Allocator&);
|
void pci_init(Genode::Env&, Genode::Ram_allocator&, Genode::Allocator&);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* _LX_KIT__PCI_H_ */
|
#endif /* _LX_KIT__PCI_H_ */
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
/* Genode includes */
|
/* Genode includes */
|
||||||
#include <base/entrypoint.h>
|
#include <base/entrypoint.h>
|
||||||
|
#include <base/allocator.h>
|
||||||
|
|
||||||
namespace Lx {
|
namespace Lx {
|
||||||
|
|
||||||
|
|
|
@ -195,38 +195,30 @@ Plugin::Plugin()
|
||||||
|
|
||||||
void Plugin::init(Genode::Env &env)
|
void Plugin::init(Genode::Env &env)
|
||||||
{
|
{
|
||||||
char ip_addr_str[16] = {0};
|
|
||||||
char netmask_str[16] = {0};
|
|
||||||
char gateway_str[16] = {0};
|
|
||||||
|
|
||||||
Genode::Attached_rom_dataspace config { env, "config"} ;
|
Genode::Attached_rom_dataspace config { env, "config"} ;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Genode::Xml_node libc_node = config.xml().sub_node("libc");
|
Genode::Xml_node libc_node = config.xml().sub_node("libc");
|
||||||
|
|
||||||
try {
|
typedef Genode::String<20> Ip_addr;
|
||||||
libc_node.attribute("ip_addr").value(ip_addr_str, sizeof(ip_addr_str));
|
|
||||||
} catch(...) { }
|
|
||||||
|
|
||||||
try {
|
Ip_addr const ip_addr = libc_node.attribute_value("ip_addr", Ip_addr());
|
||||||
libc_node.attribute("netmask").value(netmask_str, sizeof(netmask_str));
|
Ip_addr const netmask = libc_node.attribute_value("netmask", Ip_addr());
|
||||||
} catch(...) { }
|
Ip_addr const gateway = libc_node.attribute_value("gateway", Ip_addr());
|
||||||
|
|
||||||
try {
|
|
||||||
libc_node.attribute("gateway").value(gateway_str, sizeof(gateway_str));
|
|
||||||
} catch(...) { }
|
|
||||||
|
|
||||||
/* either none or all 3 interface attributes must exist */
|
/* either none or all 3 interface attributes must exist */
|
||||||
if ((Genode::strlen(ip_addr_str) != 0) ||
|
if (ip_addr.valid() || netmask.valid() || gateway.valid()) {
|
||||||
(Genode::strlen(netmask_str) != 0) ||
|
|
||||||
(Genode::strlen(gateway_str) != 0)) {
|
if (!ip_addr.valid()) {
|
||||||
if (Genode::strlen(ip_addr_str) == 0) {
|
|
||||||
Genode::error("missing \"ip_addr\" attribute. Ignoring network interface config.");
|
Genode::error("missing \"ip_addr\" attribute. Ignoring network interface config.");
|
||||||
throw Genode::Xml_node::Nonexistent_attribute();
|
throw Genode::Xml_node::Nonexistent_attribute();
|
||||||
} else if (Genode::strlen(netmask_str) == 0) {
|
}
|
||||||
|
if (!netmask.valid()) {
|
||||||
Genode::error("missing \"netmask\" attribute. Ignoring network interface config.");
|
Genode::error("missing \"netmask\" attribute. Ignoring network interface config.");
|
||||||
throw Genode::Xml_node::Nonexistent_attribute();
|
throw Genode::Xml_node::Nonexistent_attribute();
|
||||||
} else if (Genode::strlen(gateway_str) == 0) {
|
}
|
||||||
|
if (!gateway.valid()) {
|
||||||
Genode::error("missing \"gateway\" attribute. Ignoring network interface config.");
|
Genode::error("missing \"gateway\" attribute. Ignoring network interface config.");
|
||||||
throw Genode::Xml_node::Nonexistent_attribute();
|
throw Genode::Xml_node::Nonexistent_attribute();
|
||||||
}
|
}
|
||||||
|
@ -234,15 +226,19 @@ void Plugin::init(Genode::Env &env)
|
||||||
throw -1;
|
throw -1;
|
||||||
|
|
||||||
Genode::log("static network interface: ",
|
Genode::log("static network interface: ",
|
||||||
"ip_addr=", Genode::Cstring(ip_addr_str), " "
|
"ip_addr=", ip_addr, " "
|
||||||
"netmask=", Genode::Cstring(netmask_str), " "
|
"netmask=", netmask, " "
|
||||||
"gateway=", Genode::Cstring(gateway_str));
|
"gateway=", gateway);
|
||||||
|
|
||||||
|
socketconstruct.construct(env, ip_addr.string(),
|
||||||
|
netmask.string(),
|
||||||
|
gateway.string());
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
Genode::log("Using DHCP for interface configuration.");
|
Genode::log("Using DHCP for interface configuration.");
|
||||||
}
|
}
|
||||||
|
|
||||||
socketconstruct.construct(env, ip_addr_str, netmask_str, gateway_str);
|
socketconstruct.construct(env, "", "", "");
|
||||||
};
|
};
|
||||||
|
|
||||||
/* TODO shameful copied from lwip... generalize this */
|
/* TODO shameful copied from lwip... generalize this */
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
/* Genode includes */
|
/* Genode includes */
|
||||||
#include <base/env.h>
|
#include <base/env.h>
|
||||||
|
#include <base/allocator.h>
|
||||||
#include <base/signal.h>
|
#include <base/signal.h>
|
||||||
#include <base/log.h>
|
#include <base/log.h>
|
||||||
#include <base/thread.h>
|
#include <base/thread.h>
|
||||||
|
|
|
@ -61,8 +61,8 @@ struct Services
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Genode::Xml_node node_screen = node_hid.sub_node("touchscreen");
|
Genode::Xml_node node_screen = node_hid.sub_node("touchscreen");
|
||||||
node_screen.attribute("width").value(&screen_width);
|
node_screen.attribute("width").value(screen_width);
|
||||||
node_screen.attribute("height").value(&screen_height);
|
node_screen.attribute("height").value(screen_height);
|
||||||
multitouch = node_screen.attribute_value("multitouch", false);
|
multitouch = node_screen.attribute_value("multitouch", false);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
screen_width = screen_height = 0;
|
screen_width = screen_height = 0;
|
||||||
|
@ -127,7 +127,7 @@ struct Services
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void backend_alloc_init(Genode::Env &env, Genode::Ram_session &ram, Genode::Allocator &alloc);
|
void backend_alloc_init(Genode::Env &env, Genode::Ram_allocator &ram, Genode::Allocator &alloc);
|
||||||
|
|
||||||
void platform_hcd_init(Services *services);
|
void platform_hcd_init(Services *services);
|
||||||
Genode::Irq_session_capability platform_irq_activate(int irq);
|
Genode::Irq_session_capability platform_irq_activate(int irq);
|
||||||
|
|
|
@ -38,7 +38,7 @@ class Signal_helper
|
||||||
Genode::Signal_transmitter &sender() { return _sender; }
|
Genode::Signal_transmitter &sender() { return _sender; }
|
||||||
Genode::Parent &parent() { return _env.parent(); }
|
Genode::Parent &parent() { return _env.parent(); }
|
||||||
Genode::Env &env() { return _env; }
|
Genode::Env &env() { return _env; }
|
||||||
Genode::Ram_session &ram() { return _env.ram(); }
|
Genode::Ram_allocator &ram() { return _env.ram(); }
|
||||||
Genode::Region_map &rm() { return _env.rm(); }
|
Genode::Region_map &rm() { return _env.rm(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -708,7 +708,7 @@ void random_ether_addr(u8 *addr)
|
||||||
try {
|
try {
|
||||||
Xml_node nic_config = config_node.sub_node("nic");
|
Xml_node nic_config = config_node.sub_node("nic");
|
||||||
Xml_node::Attribute mac_node = nic_config.attribute("mac");
|
Xml_node::Attribute mac_node = nic_config.attribute("mac");
|
||||||
mac_node.value(&mac);
|
mac_node.value(mac);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
/* use fallback mac */
|
/* use fallback mac */
|
||||||
snprint_mac(str, fallback);
|
snprint_mac(str, fallback);
|
||||||
|
|
|
@ -932,7 +932,8 @@ class Usb::Root : public Genode::Root_component<Session_component>
|
||||||
if (xhci) xml.attribute("xhci", "yes");
|
if (xhci) xml.attribute("xhci", "yes");
|
||||||
if (ohci) xml.attribute("ohci", "yes");
|
if (ohci) xml.attribute("ohci", "yes");
|
||||||
|
|
||||||
xml.append(config.content_base(), config.content_size());
|
config.with_raw_content([&] (char const *start, size_t length) {
|
||||||
|
xml.append(start, length); });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
** lx_kit/backend_alloc.h **
|
** lx_kit/backend_alloc.h **
|
||||||
****************************/
|
****************************/
|
||||||
|
|
||||||
void backend_alloc_init(Genode::Env&, Genode::Ram_session&,
|
void backend_alloc_init(Genode::Env&, Genode::Ram_allocator&,
|
||||||
Genode::Allocator&)
|
Genode::Allocator&)
|
||||||
{
|
{
|
||||||
/* intentionally left blank */
|
/* intentionally left blank */
|
||||||
|
|
|
@ -191,7 +191,7 @@ int request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
|
||||||
** Platform backend alloc init **
|
** Platform backend alloc init **
|
||||||
*********************************/
|
*********************************/
|
||||||
|
|
||||||
void backend_alloc_init(Genode::Env &env, Genode::Ram_session &ram,
|
void backend_alloc_init(Genode::Env &env, Genode::Ram_allocator &ram,
|
||||||
Genode::Allocator &alloc)
|
Genode::Allocator &alloc)
|
||||||
{
|
{
|
||||||
Lx::pci_init(env, ram, alloc);
|
Lx::pci_init(env, ram, alloc);
|
||||||
|
|
|
@ -137,7 +137,7 @@ class Storage_device : public Genode::List<Storage_device>::Element,
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Storage_device(Genode::Ram_session &ram, struct scsi_device *sdev)
|
Storage_device(Genode::Ram_allocator &ram, struct scsi_device *sdev)
|
||||||
: Block::Driver(ram), _sdev(sdev)
|
: Block::Driver(ram), _sdev(sdev)
|
||||||
{
|
{
|
||||||
/* read device capacity */
|
/* read device capacity */
|
||||||
|
@ -185,7 +185,7 @@ struct Factory : Block::Driver_factory
|
||||||
{
|
{
|
||||||
Storage_device device;
|
Storage_device device;
|
||||||
|
|
||||||
Factory(Genode::Ram_session &ram, struct scsi_device *sdev)
|
Factory(Genode::Ram_allocator &ram, struct scsi_device *sdev)
|
||||||
: device(ram, sdev) {}
|
: device(ram, sdev) {}
|
||||||
|
|
||||||
Block::Driver *create() { return &device; }
|
Block::Driver *create() { return &device; }
|
||||||
|
|
|
@ -14,6 +14,9 @@
|
||||||
#ifndef _LX_H_
|
#ifndef _LX_H_
|
||||||
#define _LX_H_
|
#define _LX_H_
|
||||||
|
|
||||||
|
/* Genode includes */
|
||||||
|
#include <base/allocator.h>
|
||||||
|
|
||||||
/* local includes */
|
/* local includes */
|
||||||
#include <lx_kit/scheduler.h>
|
#include <lx_kit/scheduler.h>
|
||||||
|
|
||||||
|
|
|
@ -53,9 +53,9 @@ struct Lx_kit::Memory_object_base : Genode::Object_pool<Memory_object_base>::Ent
|
||||||
|
|
||||||
struct Lx_kit::Ram_object : Memory_object_base
|
struct Lx_kit::Ram_object : Memory_object_base
|
||||||
{
|
{
|
||||||
Genode::Ram_session &_ram;
|
Genode::Ram_allocator &_ram;
|
||||||
|
|
||||||
Ram_object(Genode::Ram_session &ram,
|
Ram_object(Genode::Ram_allocator &ram,
|
||||||
Genode::Ram_dataspace_capability cap)
|
Genode::Ram_dataspace_capability cap)
|
||||||
: Memory_object_base(cap), _ram(ram) {}
|
: Memory_object_base(cap), _ram(ram) {}
|
||||||
|
|
||||||
|
@ -80,11 +80,11 @@ struct Lx_kit::Dma_object : Memory_object_base
|
||||||
********************/
|
********************/
|
||||||
|
|
||||||
static Genode::Constructible<Platform::Connection> _global_pci;
|
static Genode::Constructible<Platform::Connection> _global_pci;
|
||||||
static Genode::Allocator *_global_md_alloc;
|
static Genode::Allocator *_global_md_alloc;
|
||||||
static Genode::Ram_session *_global_ram;
|
static Genode::Ram_allocator *_global_ram;
|
||||||
|
|
||||||
|
|
||||||
void Lx::pci_init(Genode::Env &env, Genode::Ram_session &ram,
|
void Lx::pci_init(Genode::Env &env, Genode::Ram_allocator &ram,
|
||||||
Genode::Allocator &md_alloc)
|
Genode::Allocator &md_alloc)
|
||||||
{
|
{
|
||||||
_global_pci.construct(env);
|
_global_pci.construct(env);
|
||||||
|
|
|
@ -36,7 +36,7 @@ struct Framebuffer_controller
|
||||||
Signal_handler<Framebuffer_controller> timer_handler;
|
Signal_handler<Framebuffer_controller> timer_handler;
|
||||||
|
|
||||||
void update_connector_config(Xml_generator & xml, Xml_node & node);
|
void update_connector_config(Xml_generator & xml, Xml_node & node);
|
||||||
void update_fb_config(Xml_node & report);
|
void update_fb_config(Xml_node const &report);
|
||||||
void report_changed();
|
void report_changed();
|
||||||
void handle_timer();
|
void handle_timer();
|
||||||
|
|
||||||
|
@ -66,9 +66,8 @@ void Framebuffer_controller::update_connector_config(Xml_generator & xml,
|
||||||
Xml_node & node)
|
Xml_node & node)
|
||||||
{
|
{
|
||||||
xml.node("connector", [&] {
|
xml.node("connector", [&] {
|
||||||
String<64> name;
|
|
||||||
node.attribute("name").value(&name);
|
xml.attribute("name", node.attribute_value("name", String<64>()));
|
||||||
xml.attribute("name", name.string());
|
|
||||||
|
|
||||||
bool connected = node.attribute_value("connected", false);
|
bool connected = node.attribute_value("connected", false);
|
||||||
xml.attribute("enabled", connected ? "true" : "false");
|
xml.attribute("enabled", connected ? "true" : "false");
|
||||||
|
@ -97,7 +96,7 @@ void Framebuffer_controller::update_connector_config(Xml_generator & xml,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Framebuffer_controller::update_fb_config(Xml_node & report)
|
void Framebuffer_controller::update_fb_config(Xml_node const &report)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
static char buf[4096];
|
static char buf[4096];
|
||||||
|
@ -128,21 +127,15 @@ void Framebuffer_controller::update_fb_config(Xml_node & report)
|
||||||
void Framebuffer_controller::report_changed()
|
void Framebuffer_controller::report_changed()
|
||||||
{
|
{
|
||||||
rom.update();
|
rom.update();
|
||||||
if (!rom.is_valid()) return;
|
|
||||||
|
|
||||||
Xml_node report(rom.local_addr<char>(), rom.size());
|
update_fb_config(rom.xml());
|
||||||
update_fb_config(report);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Framebuffer_controller::handle_timer()
|
void Framebuffer_controller::handle_timer()
|
||||||
{
|
{
|
||||||
if (!rom.is_valid())
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* artificial update */
|
/* artificial update */
|
||||||
Xml_node report(rom.local_addr<char>(), rom.size());
|
update_fb_config(rom.xml());
|
||||||
update_fb_config(report);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
|
|
||||||
#include "sched.h"
|
#include "sched.h"
|
||||||
#include <base/allocator_avl.h>
|
#include <base/allocator_avl.h>
|
||||||
#include <base/printf.h>
|
|
||||||
#include <block_session/connection.h>
|
#include <block_session/connection.h>
|
||||||
#include <rump/env.h>
|
#include <rump/env.h>
|
||||||
#include <rump_fs/fs.h>
|
#include <rump_fs/fs.h>
|
||||||
|
@ -176,12 +175,14 @@ void rump_io_backend_init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void rumpuser_dprintf(const char *fmt, ...)
|
void rumpuser_dprintf(const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list list;
|
va_list list;
|
||||||
va_start(list, fmt);
|
va_start(list, format);
|
||||||
|
|
||||||
Genode::vprintf(fmt, list);
|
char buf[128] { };
|
||||||
|
Genode::String_console(buf, sizeof(buf)).vprintf(format, list);
|
||||||
|
Genode::log(Genode::Cstring(buf));
|
||||||
|
|
||||||
va_end(list);
|
va_end(list);
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ void File_system::init()
|
||||||
|
|
||||||
Genode::log("Using ", fs_type, " as file system");
|
Genode::log("Using ", fs_type, " as file system");
|
||||||
|
|
||||||
size_t const avail = Rump::env().env().ram().avail_ram().value;
|
size_t const avail = Rump::env().env().pd().avail_ram().value;
|
||||||
rump_set_memlimit(avail);
|
rump_set_memlimit(avail);
|
||||||
|
|
||||||
/* start rump kernel */
|
/* start rump kernel */
|
||||||
|
|
|
@ -484,30 +484,27 @@ class Rump_fs::Root : public Root_component<Session_component>
|
||||||
}
|
}
|
||||||
ram_quota -= session_size;
|
ram_quota -= session_size;
|
||||||
|
|
||||||
char tmp[MAX_PATH_LEN];
|
Session_policy const policy(label, _config.xml());
|
||||||
try {
|
|
||||||
Session_policy policy(label, _config.xml());
|
|
||||||
|
|
||||||
/* determine policy root offset */
|
/* determine policy root offset */
|
||||||
try {
|
typedef String<MAX_PATH_LEN> Root;
|
||||||
policy.attribute("root").value(tmp, sizeof(tmp));
|
session_root.import(policy.attribute_value("root", Root()).string(), "/mnt");
|
||||||
session_root.import(tmp, "/mnt");
|
|
||||||
} catch (Xml_node::Nonexistent_attribute) { }
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Determine if the session is writeable.
|
* Determine if the session is writeable.
|
||||||
* Policy overrides client argument, both default to false.
|
* Policy overrides client argument, both default to false.
|
||||||
*/
|
*/
|
||||||
if (policy.attribute_value("writeable", false))
|
if (policy.attribute_value("writeable", false))
|
||||||
writeable = Arg_string::find_arg(args, "writeable").bool_value(false);
|
writeable = Arg_string::find_arg(args, "writeable").bool_value(false);
|
||||||
}
|
|
||||||
catch (Session_policy::No_policy_defined) { throw Service_denied(); }
|
|
||||||
|
|
||||||
/* apply client's root offset */
|
/* apply client's root offset */
|
||||||
Arg_string::find_arg(args, "root").string(tmp, sizeof(tmp), "/");
|
{
|
||||||
if (Genode::strcmp("/", tmp, sizeof(tmp))) {
|
char tmp[MAX_PATH_LEN] { };
|
||||||
session_root.append("/");
|
Arg_string::find_arg(args, "root").string(tmp, sizeof(tmp), "/");
|
||||||
session_root.append(tmp);
|
if (Genode::strcmp("/", tmp, sizeof(tmp))) {
|
||||||
|
session_root.append("/");
|
||||||
|
session_root.append(tmp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
session_root.remove_trailing('/');
|
session_root.remove_trailing('/');
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue