mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-18 21:27:56 +00:00
parent
f52c44647f
commit
582e4aec02
@ -584,13 +584,6 @@ Runtime environments
|
||||
that enables the use of unmodified command-line based GNU software. For using
|
||||
noux, refer to the run script 'ports/run/noux.run'.
|
||||
|
||||
:'ports-foc/src/l4linux': L4Linux is a paravirtualized Linux kernel that
|
||||
enables the use of Linux-based OSes as subsystems on the Fiasco.OC kernel.
|
||||
For using L4Linux, refer to the run script 'ports-foc/run/l4linux.run'.
|
||||
|
||||
:'ports-foc/src/l4android': L4Android is a variant of L4Linux that is able
|
||||
to execute the Android software stack on top of the Fiasco.OC kernel.
|
||||
|
||||
:'ports/src/app/seoul': Seoul is a virtual-machine monitor developed for
|
||||
the use with the NOVA platform. It virtualizes 32bit x86 PC hardware
|
||||
including various peripherals.
|
||||
|
@ -120,14 +120,6 @@ but build upon of each other:
|
||||
as used for the 'libports' repository. Please consult 'libports/README'
|
||||
for further information.
|
||||
|
||||
:'ports-<platform>':
|
||||
|
||||
These platform-specific source-code repositories contain software that
|
||||
capitalizes special features of the respective kernel platform.
|
||||
For the Fiasco.OC platform, 'ports-foc' hosts a port of the L4Linux
|
||||
kernel. For further information, please refer to the README file at the
|
||||
top level of the respective repository.
|
||||
|
||||
:'gems':
|
||||
|
||||
This source-code repository contains Genode applications that use
|
||||
|
@ -83,34 +83,6 @@ instead of building everything:
|
||||
! make run/demo
|
||||
|
||||
|
||||
Running L4Linux on top of Genode
|
||||
################################
|
||||
|
||||
To get the L4Linux running on top of Genode, you have to change prepare its
|
||||
sources:
|
||||
|
||||
! ./tool/ports/prepare_port l4linux
|
||||
|
||||
This will fetch the currently supported version from the L4Linux subversion
|
||||
repository, and apply a patch to it, that is needed to execute it on top of
|
||||
Genode.
|
||||
|
||||
Before compiling L4Linux for Genode/Fiasco.OC you have to integrate the 'ports-foc'
|
||||
repository into your build environment. Therefore edit the 'etc/build.conf' file
|
||||
in your build directory, and uncomment the following line:
|
||||
|
||||
! REPOSITORIES += $(GENODE_DIR)/repos/ports-foc
|
||||
|
||||
After that you can build and run L4Linux by issuing:
|
||||
|
||||
! make run/l4linux
|
||||
|
||||
in your build directory. This run-script boots a single L4Linux instance into
|
||||
a minimal console environment. After booting completes, the run-scripts tries
|
||||
to download the Genode project webpage via the 'wget' tool within the L4Linux
|
||||
environment. If all wents fine the run-script completes successfully.
|
||||
|
||||
|
||||
Further Information
|
||||
###################
|
||||
|
||||
|
@ -1,126 +0,0 @@
|
||||
assert_spec foc
|
||||
assert_spec panda
|
||||
|
||||
#
|
||||
# Build
|
||||
#
|
||||
build {
|
||||
core
|
||||
init
|
||||
drivers/timer
|
||||
drivers/framebuffer
|
||||
drivers/sd_card
|
||||
drivers/usb
|
||||
drivers/gpio
|
||||
server/nic_bridge
|
||||
server/part_blk
|
||||
l4linux
|
||||
}
|
||||
|
||||
create_boot_directory
|
||||
|
||||
#
|
||||
# Config
|
||||
#
|
||||
set config {
|
||||
<config prio_levels="2">
|
||||
<parent-provides>
|
||||
<service name="ROM"/>
|
||||
<service name="RAM"/>
|
||||
<service name="IRQ"/>
|
||||
<service name="IO_MEM"/>
|
||||
<service name="IO_PORT"/>
|
||||
<service name="PD"/>
|
||||
<service name="RM"/>
|
||||
<service name="CPU"/>
|
||||
<service name="LOG"/>
|
||||
</parent-provides>
|
||||
<default-route>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</default-route>
|
||||
<start name="timer">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides><service name="Timer"/></provides>
|
||||
</start>
|
||||
<start name="fb_drv">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides><service name="Framebuffer"/></provides>
|
||||
</start>
|
||||
<start name="sd_card_drv" priority="-1">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides><service name="Block"/></provides>
|
||||
</start>
|
||||
<start name="gpio_drv">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides><service name="Gpio"/></provides>
|
||||
<config/>
|
||||
</start>
|
||||
<start name="usb_drv">
|
||||
<resource name="RAM" quantum="12M"/>
|
||||
<provides>
|
||||
<service name="Input"/>
|
||||
<service name="Nic"/>
|
||||
</provides>
|
||||
<config ehci="yes">
|
||||
<hid/>
|
||||
<nic mac="02:00:00:00:01:01" />
|
||||
</config>
|
||||
</start>
|
||||
<start name="part_blk" priority="-1">
|
||||
<resource name="RAM" quantum="2M"/>
|
||||
<provides><service name="Block"/></provides>
|
||||
<config>
|
||||
<policy label="vmlinux.1 -> sda" partition="1" />
|
||||
<policy label="vmlinux.2 -> sda" partition="2" />
|
||||
<policy label_prefix="test-libc_ffat" partition="3" />
|
||||
</config>
|
||||
<route>
|
||||
<service name="Block"> <child name="sd_card_drv"/> </service>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
<start name="vmlinux.1">
|
||||
<binary name="l4linux"/>
|
||||
<resource name="RAM" quantum="96M"/>
|
||||
<config args="mem=54M l4x_rd=initrd.gz">
|
||||
<block label="sda" />
|
||||
</config>
|
||||
<route>
|
||||
<service name="Input"> <child name="usb_drv"/> </service>
|
||||
<service name="Framebuffer"> <child name="fb_drv"/> </service>
|
||||
<service name="Block"> <child name="part_blk"/> </service>
|
||||
<service name="Nic"> <child name="usb_drv"/> </service>
|
||||
<service name="Timer"> <child name="timer"/> </service>
|
||||
<any-service> <parent/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
</config>}
|
||||
|
||||
install_config $config
|
||||
|
||||
#
|
||||
# Boot modules
|
||||
#
|
||||
set boot_modules {
|
||||
core
|
||||
ld.lib.so
|
||||
init
|
||||
timer
|
||||
part_blk
|
||||
l4linux
|
||||
initrd.gz
|
||||
fb_drv
|
||||
sd_card_drv
|
||||
gpio_drv
|
||||
usb_drv
|
||||
}
|
||||
|
||||
set uri "https://github.com/downloads/skalk/genode/busybox-initrd-arm-20120710.gz"
|
||||
|
||||
if {![file exists bin/initrd.gz]} {
|
||||
puts "Download initramfs ..."
|
||||
exec >& /dev/null wget -c -O bin/initrd.gz $uri
|
||||
}
|
||||
|
||||
build_boot_image [join $boot_modules " "]
|
||||
|
@ -1,226 +0,0 @@
|
||||
This repository contains the port of L4Linux/L4Android for Genode.
|
||||
|
||||
L4Linux is a para-virtualized version of Linux running on top of the
|
||||
micro-kernel Fiasco.OC. The original code uses the L4RE framework. This package
|
||||
contains a small L4Linux support library as well as a patch for L4Linux, that
|
||||
replaces L4RE by the Genode framework. Nevertheless, L4Linux stays to be
|
||||
dependent on Fiasco.OC, meaning that you can only use it in combination with
|
||||
Genode running on top of Fiasco.OC.
|
||||
|
||||
L4Android is a fork of L4Linux which in addition comprises the Android kernel
|
||||
patches.
|
||||
|
||||
|
||||
Quickstart
|
||||
==========
|
||||
|
||||
L4Linux on Genode/Fiasco.OC IA32
|
||||
----------------------------------
|
||||
Prepare the L4Linux sources via:
|
||||
|
||||
! ./tool/ports/prepare_port l4linux
|
||||
|
||||
Create a new build-directory:
|
||||
|
||||
! <path_to_genode_repo>/tool/create_builddir foc_x86_32 BUILD_DIR=l4linux
|
||||
|
||||
Edit the 'etc/build.conf' file in your build directory, and uncomment the following
|
||||
lines:
|
||||
|
||||
! REPOSITORIES += $(GENODE_DIR)/repos/ports-foc
|
||||
! REPOSITORIES += $(GENODE_DIR)/repos/dde_ipxe
|
||||
|
||||
The dde_ipxe repository contains the networking drivers for Genode. Please make
|
||||
sure that you have followed the preparation steps for this repository as
|
||||
described in 'dde_ipxe/README'.
|
||||
|
||||
Optionally, add an appropriate '-j' option to the make command in the same file:
|
||||
|
||||
! MAKE += -j4
|
||||
|
||||
Go to your newly created build directory, and execute the run-script for L4Android:
|
||||
|
||||
! make run/l4linux
|
||||
|
||||
L4Android on Genode/Fiasco.OC IA32
|
||||
----------------------------------
|
||||
Prepare the L4Android sources:
|
||||
|
||||
! ./tool/ports/prepare_port l4android
|
||||
|
||||
Create a new build-directory:
|
||||
|
||||
! <path_to_genode_repo>/tool/create_builddir foc_x86_32 BUILD_DIR=l4android
|
||||
|
||||
Edit the 'etc/build.conf' file in your build directory, and uncomment the following
|
||||
lines:
|
||||
|
||||
! REPOSITORIES += $(GENODE_DIR)/repos/ports-foc
|
||||
! REPOSITORIES += $(GENODE_DIR)/repos/dde_gpxe
|
||||
|
||||
Please do not forget to issue:
|
||||
|
||||
! ./tool/ports/prepare_port dde_ipxe base-foc
|
||||
|
||||
Optionally, add an appropriate '-j' option to the make command in the same file:
|
||||
|
||||
! MAKE += -j4
|
||||
|
||||
Normally, Genode applications for Fiasco.OC are started without KVM support in
|
||||
Qemu as we ran into trouble with KVM/Fiasco.OC in the past. Nevertheless, using
|
||||
Android without KVM-support gets sometimes painful with regard to the boot-time,
|
||||
so feel to add the following line in 'etc/build.conf':
|
||||
|
||||
! QEMU_OPT = -no-kvm-irqchip
|
||||
|
||||
Go to your newly created build directory, and execute the run-script for L4Android:
|
||||
|
||||
! make run/l4android
|
||||
|
||||
That's it! In addition to using the graphical interface of Android in the framebuffer
|
||||
window, provided by Qemu, you can use a Linux shell in the terminal
|
||||
that runs the 'make' command, and you can connect to the Fiasco.OC's kernel debugger
|
||||
via a serial connection that is established as a pipe in '/tmp/qemu-pipe'.
|
||||
|
||||
|
||||
Detailed instructions
|
||||
=====================
|
||||
|
||||
Fiasco.OC prerequisites
|
||||
-----------------------
|
||||
|
||||
If you haven't build Genode for Fiasco.OC yet, please refer to the following
|
||||
document:
|
||||
|
||||
:[http://genode.org/community/wiki/GenodeOnFiascoOC - Genode on Fiasco.OC Wiki page]:
|
||||
This Wiki page contains the information on how to build and use
|
||||
Genode with Fiasco.OC
|
||||
|
||||
Preparing the L4Linux/L4android kernel source code
|
||||
--------------------------------------------------
|
||||
|
||||
For building L4Linux for Genode, you first need to checkout and patch the
|
||||
original sources. The 'prepare_port' tool automates this task. Just issue:
|
||||
|
||||
! ./tool/ports/prepare_port l4linux
|
||||
|
||||
If you like to build the L4Android kernel version as well, additionally type:
|
||||
|
||||
! ./tool/ports/prepare_port l4android
|
||||
|
||||
Afterwards you need to include the L4Linux repository into the Genode build
|
||||
process. Just add the path to this directory to the 'REPOSITORIES' declaration
|
||||
of the 'etc/build.conf' file within your build directory.
|
||||
|
||||
Building and running L4Linux/L4android
|
||||
--------------------------------------
|
||||
|
||||
Now, you can change to your build directory and issue:
|
||||
|
||||
! make l4linux
|
||||
|
||||
If you want to build the L4Android kernel, instead type:
|
||||
|
||||
! make l4android
|
||||
|
||||
The 'bin/' directory within your build directory should now contain a symbolic
|
||||
link to the L4Linux resp. L4Android binary.
|
||||
|
||||
To test your Linux binary, you also need to tweak the config file for init and
|
||||
potentially your bootloader script. You will find examples for this in the
|
||||
'config/' directory of this repository.
|
||||
|
||||
For a quick test of running L4Linux with Genode you can execute the Genode run
|
||||
script 'ports-foc/run/l4linux.run' or 'ports-foc/run/l4android.run' by issuing
|
||||
one of the following commands from the Genode build directory:
|
||||
|
||||
! make run/l4linux
|
||||
|
||||
or:
|
||||
|
||||
! make run/l4android
|
||||
|
||||
The run script will build all executables including the L4Linux kernel,
|
||||
downloads necessary system images, performs the integration of all components
|
||||
into a bootable image, and boot the image in Qemu. To inspect those individual
|
||||
steps more closely, please refer to the run script and the Fiasco.OC specific
|
||||
run environment implemented in 'base-foc/run/env'.
|
||||
|
||||
Kernel command line
|
||||
-------------------
|
||||
|
||||
You can state the Linux kernel command line by using the XML configuration of
|
||||
the start entry of your Linux instance, e.g.:
|
||||
|
||||
! <config args="mem=64M l4x_rd=initrd.gz"/>
|
||||
|
||||
Nic session connection
|
||||
----------------------
|
||||
|
||||
When you provide a nic service to your L4Linux instance, the kernel will auto-detect
|
||||
that, and runs a nic-driver, which will provide the nic-session as ethernet device
|
||||
'eth0'. Currently, only one nic-session per instance is supported.
|
||||
|
||||
Terminal session
|
||||
----------------
|
||||
|
||||
When providing a terminal-session to your Linux instance, it will automatically
|
||||
register an appropriated serial and console driver in the kernel, that is
|
||||
available as device 'ttyS0'. Currently, only one such device instance is supported.
|
||||
|
||||
Block session connection
|
||||
------------------------
|
||||
|
||||
To use a block session of the underlying Genode system, we provide a special
|
||||
block-driver stub in L4Linux. You need to state how much block devices you want
|
||||
to use, and their name internally used by Linux, e.g.:
|
||||
|
||||
! <config>
|
||||
! <block label="sda"/>
|
||||
! <block label="sdb"/>
|
||||
! <config/>
|
||||
|
||||
Initramfs
|
||||
---------
|
||||
|
||||
If you need to start Linux with an initramfs, you have to provide the name of the
|
||||
archive within the kernel command line, such as:
|
||||
|
||||
! "l4x_rd=initrd.gz"
|
||||
|
||||
You can find a working example initramfs for here:
|
||||
|
||||
:[http://genode.org/files/release-11.11/l4lx/initrd-ia32.gz]
|
||||
_initramfs for the x86 architecture_
|
||||
|
||||
:[http://genode.org/files/release-11.11/l4lx/initrd-arm.gz]
|
||||
_initramfs for the ARM architecture_
|
||||
|
||||
Configuring Linux
|
||||
-----------------
|
||||
|
||||
This L4Linux package contains a minimal Linux configuration that should work
|
||||
out of the box. Hardware drivers are disabled as Genode doesn't allow Linux
|
||||
to directly access device hardware. If you want to enable/disable options in
|
||||
Linux, you can do so by using the normal Linux build system. You will find the
|
||||
'.config' file Linux is using within the 'l4linux/' directory of your build
|
||||
directory. If you don't want to tweak '.config' directly, you can also change
|
||||
to the 'l4linux/' directory of your build directory and issue:
|
||||
|
||||
! make menuconfig
|
||||
|
||||
Then you will get the well known ncurses interface.
|
||||
|
||||
When manually changing the Linux configuration for ARM platforms, you need
|
||||
to additionally specify the corresponding 'L4ARCH' value at the command line:
|
||||
|
||||
! make menuconfig L4ARCH=arm
|
||||
|
||||
Troubleshooting
|
||||
---------------
|
||||
|
||||
If you run into problems when building L4Linux and you want the build process
|
||||
to be somehow more verbose, you can build L4Linux this way:
|
||||
|
||||
! VERBOSE_LX_MK=1 make l4linux
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,21 +0,0 @@
|
||||
/*
|
||||
* \brief L4Re functions needed by L4Linux
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-03-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _L4__UTIL__L4_MACROS_H_
|
||||
#define _L4__UTIL__L4_MACROS_H_
|
||||
|
||||
#define l4util_idfmt "%lx"
|
||||
#define l4_addr_fmt "%08lx"
|
||||
#define l4util_idstr(tid) (tid >> L4_CAP_SHIFT)
|
||||
|
||||
#endif /* _L4__UTIL__L4_MACROS_H_ */
|
@ -1,21 +0,0 @@
|
||||
/*
|
||||
* \brief L4Re functions needed by L4Linux
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-03-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _L4__UTIL__L4_MACROS_H_
|
||||
#define _L4__UTIL__L4_MACROS_H_
|
||||
|
||||
#define l4util_idfmt "%lx"
|
||||
#define l4_addr_fmt "%016lx"
|
||||
#define l4util_idstr(tid) (tid >> L4_CAP_SHIFT)
|
||||
|
||||
#endif /* _L4__UTIL__L4_MACROS_H_ */
|
@ -1,36 +0,0 @@
|
||||
/*
|
||||
* \brief Genode C API balloon functions
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2013-09-19
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE__GENODE__BALLOON_H_
|
||||
#define _INCLUDE__GENODE__BALLOON_H_
|
||||
|
||||
#include <l4/sys/compiler.h>
|
||||
#include <l4/sys/types.h>
|
||||
|
||||
#include <genode/linkage.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
L4_CV l4_cap_idx_t genode_balloon_irq_cap(void);
|
||||
|
||||
L4_CV void genode_balloon_free_chunk(unsigned long addr);
|
||||
|
||||
L4_CV void genode_balloon_free_done(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _INCLUDE__GENODE__BALLOON_H_ */
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* \brief Genode C API block driver related functions needed by L4Linux
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2010-07-08
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2010-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE__GENODE__BLOCK_H_
|
||||
#define _INCLUDE__GENODE__BLOCK_H_
|
||||
|
||||
#include <l4/sys/compiler.h>
|
||||
#include <l4/sys/types.h>
|
||||
|
||||
#include <genode/linkage.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
L4_CV unsigned genode_block_count(void);
|
||||
|
||||
L4_CV const char *genode_block_name(unsigned idx);
|
||||
|
||||
L4_CV l4_cap_idx_t genode_block_irq_cap(unsigned idx);
|
||||
|
||||
L4_CV void genode_block_register_callback(FASTCALL void (*func)(void*, short,
|
||||
void*, unsigned long));
|
||||
|
||||
L4_CV void genode_block_geometry(unsigned idx, unsigned long *blk_cnt,
|
||||
unsigned long *blk_sz, int *writeable,
|
||||
unsigned long *req_queue_sz);
|
||||
|
||||
L4_CV void* genode_block_request(unsigned idx, unsigned long sz,
|
||||
void *req, unsigned long *offset);
|
||||
|
||||
L4_CV void genode_block_submit(unsigned idx, unsigned long queue_offset,
|
||||
unsigned long size, unsigned long long disc_offset,
|
||||
int write);
|
||||
|
||||
L4_CV void genode_block_collect_responses(unsigned idx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //_INCLUDE__GENODE__BLOCK_H_
|
@ -1,97 +0,0 @@
|
||||
/*
|
||||
* \brief Genode C API framebuffer functions needed by Linux
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2009-06-08
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE__GENODE__FRAMEBUFFER_H_
|
||||
#define _INCLUDE__GENODE__FRAMEBUFFER_H_
|
||||
|
||||
|
||||
#include <l4/sys/compiler.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Returns the count of screens (framebuffer + input devices)
|
||||
* given by config-file information
|
||||
*/
|
||||
L4_CV int genode_screen_count(void);
|
||||
|
||||
/**
|
||||
* Get the size of the framebuffer
|
||||
*
|
||||
* \param screen the index of the framebuffer
|
||||
* \return the size
|
||||
*/
|
||||
L4_CV unsigned long genode_fb_size(unsigned int screen);
|
||||
|
||||
/**
|
||||
* Attach the framebuffer to our address space
|
||||
*
|
||||
* \param screen the index of the framebuffer
|
||||
* \return the virtual address the framebuffer was attached to
|
||||
*/
|
||||
L4_CV void *genode_fb_attach(unsigned int screen);
|
||||
|
||||
/**
|
||||
* Get information about the resolution of the framebuffer
|
||||
*
|
||||
* \param screen the index of the framebuffer
|
||||
* \param out_w resulting pointer to the horizontal resolution info
|
||||
* \param out_h resulting pointer to the vertical resolution info
|
||||
*/
|
||||
L4_CV void genode_fb_info(unsigned int screen, int *out_w, int *out_h);
|
||||
|
||||
/**
|
||||
* Refresh a specified area of the framebuffer
|
||||
*
|
||||
* \param screen the index of the framebuffer
|
||||
* \param x x-coordinate of the area's position
|
||||
* \param y y-coordinate of the area's position
|
||||
* \param w width of the area
|
||||
* \param h height of the area
|
||||
*/
|
||||
L4_CV void genode_fb_refresh(unsigned int screen, int x, int y, int w, int h);
|
||||
|
||||
/**
|
||||
* Close the framebuffer session
|
||||
*
|
||||
* \param screen the index of the framebuffer
|
||||
*/
|
||||
L4_CV void genode_fb_close(unsigned screen);
|
||||
|
||||
//int genode_nit_view_create(unsigned screen, unsigned view);
|
||||
//
|
||||
//void genode_nit_view_destroy(unsigned screen, unsigned view);
|
||||
//
|
||||
//void genode_nit_view_back(unsigned screen, unsigned view);
|
||||
//
|
||||
//void genode_nit_view_place(unsigned screen, unsigned view, int x,
|
||||
// int y, int w, int h);
|
||||
//
|
||||
//void genode_nit_view_stack(unsigned int screen, unsigned view,
|
||||
// unsigned neighbor, int behind);
|
||||
//
|
||||
///**
|
||||
// * Close all views of a nitpicker session
|
||||
// *
|
||||
// * \param screen the index of the framebuffer
|
||||
// */
|
||||
//void genode_nit_close_all_views(unsigned screen);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif //_INCLUDE__GENODE__FRAMEBUFFER_H_
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* \brief Genode C API input functions needed by Linux
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2009-06-08
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE__GENODE__INPUT_H_
|
||||
#define _INCLUDE__GENODE__INPUT_H_
|
||||
|
||||
|
||||
#include <l4/sys/compiler.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef i386
|
||||
#define FASTCALL __attribute__((regparm(3)))
|
||||
#else
|
||||
#define FASTCALL
|
||||
#endif
|
||||
|
||||
L4_CV void genode_input_register_callback(FASTCALL void (*genode_input_event)
|
||||
(void*,unsigned int, unsigned int, int));
|
||||
|
||||
L4_CV void genode_input_unregister_callback(void);
|
||||
|
||||
L4_CV void genode_input_register_keyb(unsigned int idx, void* dev);
|
||||
|
||||
L4_CV void genode_input_register_mouse(unsigned int idx, void* dev);
|
||||
|
||||
L4_CV void genode_input_unregister_keyb(unsigned int idx);
|
||||
|
||||
L4_CV void genode_input_unregister_mouse(unsigned int idx);
|
||||
|
||||
L4_CV void genode_input_handle_events(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif //_INCLUDE__GENODE__INPUT_H_
|
@ -1,23 +0,0 @@
|
||||
/*
|
||||
* \brief Genode linkage defines needed by L4Linux
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-11-24
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE__GENODE__LINKAGE_H_
|
||||
#define _INCLUDE__GENODE__LINKAGE_H_
|
||||
|
||||
#ifdef i386
|
||||
#define FASTCALL __attribute__((regparm(3)))
|
||||
#else
|
||||
#define FASTCALL
|
||||
#endif
|
||||
|
||||
#endif /* _INCLUDE__GENODE__LINKAGE_H_ */
|
@ -1,41 +0,0 @@
|
||||
/*
|
||||
* \brief Genode C API network functions needed by OKLinux
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2009-09-10
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE__GENODE__NET_H_
|
||||
#define _INCLUDE__GENODE__NET_H_
|
||||
|
||||
#include <l4/sys/compiler.h>
|
||||
#include <l4/sys/types.h>
|
||||
|
||||
#include <genode/linkage.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
L4_CV l4_cap_idx_t genode_net_irq_cap (void);
|
||||
L4_CV int genode_net_ready (void);
|
||||
L4_CV void genode_net_start (void *dev, FASTCALL void (*func)(void*, void*, unsigned long));
|
||||
L4_CV void genode_net_stop (void);
|
||||
L4_CV void genode_net_mac (void* mac_addr, unsigned long size);
|
||||
L4_CV int genode_net_tx (void* addr, unsigned long len);
|
||||
L4_CV int genode_net_tx_ack_avail(void);
|
||||
L4_CV void genode_net_tx_ack (void);
|
||||
L4_CV void genode_net_rx_receive (void);
|
||||
L4_CV void *genode_net_memcpy (void *dst, void const *src, unsigned long size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _INCLUDE__GENODE__NET_H_ */
|
@ -1,31 +0,0 @@
|
||||
/*
|
||||
* \brief Genode C API string related functions
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2013-06-26
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE__GENODE__STRING_H_
|
||||
#define _INCLUDE__GENODE__STRING_H_
|
||||
|
||||
#include <l4/sys/compiler.h>
|
||||
|
||||
#include <genode/linkage.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
L4_CV void genode_memcpy(void* dst, void *src, unsigned long size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //_INCLUDE__GENODE__STRING_H_
|
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* \brief Genode C API serial/console driver related functions needed by L4Linux
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-09-16
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE__GENODE__TERMINAL_H_
|
||||
#define _INCLUDE__GENODE__TERMINAL_H_
|
||||
|
||||
|
||||
#include <l4/sys/compiler.h>
|
||||
#include <l4/sys/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
L4_CV signed char genode_terminal_readchar(unsigned idx, char *buf, unsigned long sz);
|
||||
L4_CV void genode_terminal_writechar(unsigned idx, const char *buf, unsigned long sz);
|
||||
L4_CV l4_cap_idx_t genode_terminal_irq(unsigned idx);
|
||||
L4_CV void genode_terminal_stop(unsigned idx);
|
||||
L4_CV unsigned genode_terminal_count(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //_INCLUDE__GENODE__TERMINAL_H_
|
@ -1,103 +0,0 @@
|
||||
/*
|
||||
* \brief L4Re functions needed by L4Linux
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-03-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _L4__IO__IO_H_
|
||||
#define _L4__IO__IO_H_
|
||||
|
||||
#include <l4/sys/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum l4io_resource_types_t {
|
||||
L4IO_RESOURCE_INVALID = 0,
|
||||
L4IO_RESOURCE_IRQ,
|
||||
L4IO_RESOURCE_MEM,
|
||||
L4IO_RESOURCE_PORT,
|
||||
L4IO_RESOURCE_ANY = ~0
|
||||
};
|
||||
|
||||
/**
|
||||
* Flags for 'l4io_request_iomem'
|
||||
*
|
||||
* These flags are specified by 'map_dma_mem' in 'arch-arm/mach_setup.c'.
|
||||
*/
|
||||
enum {
|
||||
L4IO_MEM_NONCACHED = 1 << 0,
|
||||
L4IO_MEM_EAGER_MAP = 1 << 1
|
||||
};
|
||||
|
||||
typedef l4_mword_t l4io_device_handle_t;
|
||||
typedef int l4io_resource_handle_t;
|
||||
typedef l4_addr_t l4vbus_paddr_t;
|
||||
|
||||
typedef struct {
|
||||
int type;
|
||||
char name[64];
|
||||
unsigned num_resources;
|
||||
unsigned flags;
|
||||
} l4io_device_t;
|
||||
|
||||
typedef struct {
|
||||
l4_uint16_t type;
|
||||
l4_uint16_t flags;
|
||||
l4_addr_t start;
|
||||
l4_addr_t end;
|
||||
} l4io_resource_t;
|
||||
|
||||
l4io_device_handle_t l4io_get_root_device(void);
|
||||
|
||||
L4_CV int L4_EXPORT
|
||||
l4io_iterate_devices(l4io_device_handle_t *devhandle,
|
||||
l4io_device_t *dev, l4io_resource_handle_t *reshandle);
|
||||
|
||||
L4_CV int L4_EXPORT
|
||||
l4io_lookup_resource(l4io_device_handle_t devhandle,
|
||||
enum l4io_resource_types_t type,
|
||||
l4io_resource_handle_t *reshandle,
|
||||
l4io_resource_t *res);
|
||||
|
||||
L4_CV long L4_EXPORT
|
||||
l4io_request_ioport(unsigned portnum, unsigned len);
|
||||
|
||||
L4_CV long L4_EXPORT
|
||||
l4io_request_iomem_region(l4_addr_t phys, l4_addr_t virt,
|
||||
unsigned long size, int flags);
|
||||
|
||||
L4_CV long L4_EXPORT
|
||||
l4io_search_iomem_region(l4_addr_t phys, l4_addr_t size,
|
||||
l4_addr_t *rstart, l4_addr_t *rsize);
|
||||
|
||||
L4_CV long L4_EXPORT
|
||||
l4io_request_iomem(l4_addr_t phys, unsigned long size, int flags,
|
||||
l4_addr_t *virt);
|
||||
|
||||
L4_CV long L4_EXPORT
|
||||
l4io_release_iomem(l4_addr_t virt, unsigned long size);
|
||||
|
||||
L4_CV long L4_EXPORT
|
||||
l4io_request_irq(int irqnum, l4_cap_idx_t irqcap);
|
||||
|
||||
L4_CV long L4_EXPORT
|
||||
l4io_release_irq(int irqnum, l4_cap_idx_t irq_cap);
|
||||
|
||||
L4_CV int L4_EXPORT
|
||||
l4io_has_resource(enum l4io_resource_types_t type,
|
||||
l4vbus_paddr_t start, l4vbus_paddr_t end);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _L4__IO__IO_H_ */
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* \brief L4Re functions needed by L4Linux
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-03-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _L4__LOG__LOG_H_
|
||||
#define _L4__LOG__LOG_H_
|
||||
|
||||
#include <l4/sys/compiler.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
L4_CV void LOG_printf(const char *format, ...);
|
||||
L4_CV void LOG_vprintf(const char *format, va_list list);
|
||||
void LOG_flush(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _L4__LOG__LOG_H_ */
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* \brief L4Re functions needed by L4Linux
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-03-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _L4__RE__C__DATASPACE_H_
|
||||
#define _L4__RE__C__DATASPACE_H_
|
||||
|
||||
#include <l4/sys/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum l4re_ds_map_flags {
|
||||
L4RE_DS_MAP_FLAG_RO = 0,
|
||||
L4RE_DS_MAP_FLAG_RW = 1,
|
||||
};
|
||||
|
||||
typedef l4_cap_idx_t l4re_ds_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned long size;
|
||||
unsigned long flags;
|
||||
} l4re_ds_stats_t;
|
||||
|
||||
L4_CV int l4re_ds_map_region(const l4re_ds_t ds, l4_addr_t offset, unsigned long flags,
|
||||
l4_addr_t min_addr, l4_addr_t max_addr);
|
||||
|
||||
L4_CV long l4re_ds_size(const l4re_ds_t ds);
|
||||
|
||||
L4_CV int l4re_ds_phys(const l4re_ds_t ds, l4_addr_t offset,
|
||||
l4_addr_t *phys_addr, l4_size_t *phys_size);
|
||||
|
||||
L4_CV int l4re_ds_copy_in(const l4re_ds_t ds, l4_addr_t dst_offs, const l4re_ds_t src,
|
||||
l4_addr_t src_offs, unsigned long size);
|
||||
|
||||
L4_CV int l4re_ds_info(const l4re_ds_t ds, l4re_ds_stats_t *stats);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _L4__RE__C__DATASPACE_H_ */
|
@ -1,29 +0,0 @@
|
||||
/*
|
||||
* \brief L4Re functions needed by L4Linux
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-03-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _L4__RE__C__DEBUG_H_
|
||||
#define _L4__RE__C__DEBUG_H_
|
||||
|
||||
#include <l4/sys/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
L4_CV void l4re_debug_obj_debug(l4_cap_idx_t srv, unsigned long function);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _L4__RE__C__DEBUG_H_ */
|
@ -1,44 +0,0 @@
|
||||
/*
|
||||
* \brief L4Re functions needed by L4Linux
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-03-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _L4__RE__C__MEM_ALLOC_H_
|
||||
#define _L4__RE__C__MEM_ALLOC_H_
|
||||
|
||||
#include <l4/re/env.h>
|
||||
#include <l4/sys/consts.h>
|
||||
|
||||
#include <l4/re/c/dataspace.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum l4re_ma_flags {
|
||||
L4RE_MA_CONTINUOUS = 0x01,
|
||||
L4RE_MA_PINNED = 0x02,
|
||||
L4RE_MA_SUPER_PAGES = 0x04,
|
||||
};
|
||||
|
||||
L4_CV long l4re_ma_alloc(unsigned long size, l4re_ds_t const mem,
|
||||
unsigned long flags);
|
||||
|
||||
L4_CV long l4re_ma_alloc_align(unsigned long size, l4re_ds_t const mem,
|
||||
unsigned long flags, unsigned long align);
|
||||
|
||||
L4_CV long l4re_ma_free(l4re_ds_t const mem);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _L4__RE__C__MEM_ALLOC_H_ */
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* \brief L4Re functions needed by L4Linux
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-03-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _L4__RE__C__NAMESPACE_H_
|
||||
#define _L4__RE__C__NAMESPACE_H_
|
||||
|
||||
#include <l4/re/env.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef l4_cap_idx_t l4re_namespace_t;
|
||||
|
||||
L4_CV long l4re_ns_query_srv(l4re_namespace_t srv, char const *name,
|
||||
l4_cap_idx_t const cap);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _L4__RE__C__NAMESPACE_H_ */
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* \brief L4Re functions needed by L4Linux
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-03-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _L4__RE__C__RM_H_
|
||||
#define _L4__RE__C__RM_H_
|
||||
|
||||
#include <l4/re/c/dataspace.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum l4re_rm_flags_t {
|
||||
L4RE_RM_READ_ONLY = 0x01,
|
||||
L4RE_RM_SEARCH_ADDR = 0x20,
|
||||
L4RE_RM_IN_AREA = 0x40,
|
||||
L4RE_RM_EAGER_MAP = 0x80,
|
||||
};
|
||||
|
||||
L4_CV int l4re_rm_find(l4_addr_t *addr, unsigned long *size, l4_addr_t *offset,
|
||||
unsigned *flags, l4re_ds_t *m);
|
||||
|
||||
L4_CV int l4re_rm_attach(void **start, unsigned long size, unsigned long flags,
|
||||
l4re_ds_t const mem, l4_addr_t offs,
|
||||
unsigned char align);
|
||||
|
||||
L4_CV int l4re_rm_detach(void *addr);
|
||||
|
||||
L4_CV int l4re_rm_reserve_area(l4_addr_t *start, unsigned long size,
|
||||
unsigned flags, unsigned char align);
|
||||
|
||||
L4_CV int l4re_rm_free_area(l4_addr_t addr);
|
||||
|
||||
L4_CV void l4re_rm_show_lists(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _L4__RE__C__RM_H_ */
|
@ -1,29 +0,0 @@
|
||||
/*
|
||||
* \brief L4Re functions needed by L4Linux
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-03-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _L4__RE__C__UTIL__CAP_H_
|
||||
#define _L4__RE__C__UTIL__CAP_H_
|
||||
|
||||
#include <l4/sys/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
L4_CV l4_msgtag_t l4re_util_cap_release(l4_cap_idx_t cap);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _L4__RE__C__UTIL__CAP_H_ */
|
@ -1,30 +0,0 @@
|
||||
/*
|
||||
* \brief L4Re functions needed by L4Linux
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-03-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _L4__RE__C__UTIL__CAP_ALLOC_H_
|
||||
#define _L4__RE__C__UTIL__CAP_ALLOC_H_
|
||||
|
||||
#include <l4/sys/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
L4_CV l4_cap_idx_t l4re_util_cap_alloc(void);
|
||||
L4_CV void l4re_util_cap_free(l4_cap_idx_t cap);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _L4__RE__C__UTIL__CAP_ALLOC_H_ */
|
@ -1,23 +0,0 @@
|
||||
/*
|
||||
* \brief L4Re functions needed by L4Linux
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-03-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _L4__RE__CONSTS_H_
|
||||
#define _L4__RE__CONSTS_H_
|
||||
|
||||
#include <l4/sys/consts.h>
|
||||
|
||||
enum {
|
||||
L4RE_THIS_TASK_CAP = 1UL << L4_CAP_SHIFT,
|
||||
};
|
||||
|
||||
#endif /* _L4__RE__CONSTS_H_ */
|
@ -1,57 +0,0 @@
|
||||
/*
|
||||
* \brief L4Re functions needed by L4Linux
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-03-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _L4__RE__ENV_H_
|
||||
#define _L4__RE__ENV_H_
|
||||
|
||||
#include <l4/sys/kip.h>
|
||||
|
||||
#include <l4/re/consts.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct l4re_env_cap_entry_t
|
||||
{
|
||||
l4_cap_idx_t cap;
|
||||
// l4_umword_t flags;
|
||||
// char name[16];
|
||||
} l4re_env_cap_entry_t;
|
||||
|
||||
|
||||
typedef struct l4re_env_t
|
||||
{
|
||||
l4_cap_idx_t factory;
|
||||
l4_cap_idx_t scheduler;
|
||||
l4_cap_idx_t mem_alloc;
|
||||
l4_cap_idx_t log;
|
||||
l4_cap_idx_t main_thread;
|
||||
l4_cap_idx_t rm;
|
||||
l4_fpage_t utcb_area;
|
||||
l4_addr_t first_free_utcb;
|
||||
} l4re_env_t;
|
||||
|
||||
L4_CV l4re_env_cap_entry_t const * l4re_env_get_cap_l(char const *name,
|
||||
unsigned l,
|
||||
l4re_env_t const *e);
|
||||
|
||||
L4_CV l4_kernel_info_t *l4re_kip(void);
|
||||
|
||||
L4_CV l4re_env_t *l4re_env(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _L4__RE__ENV_H_ */
|
@ -1,31 +0,0 @@
|
||||
/*
|
||||
* \brief L4Re functions needed by L4Linux
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-03-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _L4__UTIL__ATOMIC_H_
|
||||
#define _L4__UTIL__ATOMIC_H_
|
||||
|
||||
#include <l4/sys/compiler.h>
|
||||
#include <l4/sys/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
L4_CV int l4util_cmpxchg(volatile l4_umword_t * dest,
|
||||
l4_umword_t cmp_val, l4_umword_t new_val);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _L4__UTIL__ATOMIC_H_ */
|
@ -1,29 +0,0 @@
|
||||
/*
|
||||
* \brief L4Re functions needed by L4Linux
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-03-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _L4__UTIL__CPU_H_
|
||||
#define _L4__UTIL__CPU_H_
|
||||
|
||||
#include <l4/sys/compiler.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
unsigned int l4util_cpu_capabilities(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _L4__UTIL__CPU_H_ */
|
@ -1,31 +0,0 @@
|
||||
/*
|
||||
* \brief L4Re functions needed by L4Linux
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-03-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _L4__UTIL__KIP_H_
|
||||
#define _L4__UTIL__KIP_H_
|
||||
|
||||
#include <l4/sys/kip.h>
|
||||
#include <l4/sys/compiler.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
L4_CV int l4util_kip_kernel_has_feature(l4_kernel_info_t *, const char *str);
|
||||
L4_CV unsigned long l4util_kip_kernel_abi_version(l4_kernel_info_t *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _L4__UTIL__KIP_H_ */
|
@ -1,17 +0,0 @@
|
||||
/*
|
||||
* \brief L4Re functions needed by L4Linux
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-03-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _L4__UTIL__KPRINTF_H_
|
||||
#define _L4__UTIL__KPRINTF_H_
|
||||
|
||||
#endif /* _L4__UTIL__KPRINTF_H_ */
|
@ -1,53 +0,0 @@
|
||||
/*
|
||||
* \brief L4Re functions needed by L4Linux
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-03-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _L4__UTIL__UTIL_H_
|
||||
#define _L4__UTIL__UTIL_H_
|
||||
|
||||
#include <l4/sys/types.h>
|
||||
#include <l4/sys/compiler.h>
|
||||
#include <l4/sys/ipc.h>
|
||||
|
||||
L4_CV void l4_sleep(int ms);
|
||||
|
||||
L4_CV void l4_sleep_forever(void) __attribute__((noreturn));
|
||||
|
||||
|
||||
static inline void
|
||||
l4_touch_ro(const void*addr, unsigned size)
|
||||
{
|
||||
volatile const char *bptr, *eptr;
|
||||
|
||||
bptr = (const char*)(((unsigned)addr) & L4_PAGEMASK);
|
||||
eptr = (const char*)(((unsigned)addr+size-1) & L4_PAGEMASK);
|
||||
for(;bptr<=eptr;bptr+=L4_PAGESIZE) {
|
||||
(void)(*bptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static inline void
|
||||
l4_touch_rw(const void*addr, unsigned size)
|
||||
{
|
||||
volatile char *bptr;
|
||||
volatile const char *eptr;
|
||||
|
||||
bptr = (char*)(((unsigned)addr) & L4_PAGEMASK);
|
||||
eptr = (const char*)(((unsigned)addr+size-1) & L4_PAGEMASK);
|
||||
for(;bptr<=eptr;bptr+=L4_PAGESIZE) {
|
||||
char x = *bptr;
|
||||
*bptr = x;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* _L4__UTIL__UTIL_H_ */
|
@ -1,41 +0,0 @@
|
||||
#
|
||||
# L4Linux support library
|
||||
#
|
||||
SRC_CC += env.cc \
|
||||
dataspace.cc \
|
||||
genode_block.cc \
|
||||
genode_framebuffer.cc \
|
||||
genode_input.cc \
|
||||
genode_net.cc \
|
||||
genode_terminal.cc \
|
||||
genode_string.cc \
|
||||
l4_io.cc \
|
||||
l4_log.cc \
|
||||
l4_re_c_dataspace.cc \
|
||||
l4_re_c_debug.cc \
|
||||
l4_re_c_mem_alloc.cc \
|
||||
l4_re_c_namespace.cc \
|
||||
l4_re_c_rm.cc \
|
||||
l4_re_c_util_cap.cc \
|
||||
l4_re_env.cc \
|
||||
l4_util_atomic.cc \
|
||||
l4_util_cpu.cc \
|
||||
l4_util_kip.cc \
|
||||
l4_util_util.cc \
|
||||
l4lx_irq.cc \
|
||||
l4lx_memory.cc \
|
||||
l4lx_task.cc \
|
||||
l4lx_thread.cc \
|
||||
l4x_pagefault.cc \
|
||||
rm.cc \
|
||||
startup.cc
|
||||
|
||||
INC_DIR += $(REP_DIR)/include \
|
||||
$(REP_DIR)/src/lib/l4lx/include \
|
||||
|
||||
# for reusing the 'Expanding_rm_session' from the platform env in dataspace.h
|
||||
INC_DIR += $(BASE_DIR)/src/include
|
||||
|
||||
LIBS = base-foc config syscall-foc
|
||||
|
||||
vpath %.cc $(REP_DIR)/src/lib/l4lx
|
@ -1,5 +0,0 @@
|
||||
SRC_C += errtostr.c
|
||||
|
||||
LIBS += syscall-foc
|
||||
|
||||
vpath errtostr.c $(LIB_CACHE_DIR)/syscall-foc/build/source/pkg/l4sys/lib/src
|
@ -1,43 +0,0 @@
|
||||
TARGET = vmlinux
|
||||
VERBOSE_LX_MK ?= 0
|
||||
REQUIRES += foc
|
||||
INC_DIR += $(REP_DIR)/include
|
||||
LIBS = l4lx l4sys syscall-foc
|
||||
GENODE_LIBS := base-foc base-foc-common startup-foc syscall-foc cxx l4lx l4sys config
|
||||
|
||||
GENODE_LIBS := $(foreach l,$(GENODE_LIBS),$(BUILD_BASE_DIR)/var/libcache/$l/$l.lib.a)
|
||||
GENODE_LIBS_SORTED = $(sort $(wildcard $(GENODE_LIBS)))
|
||||
GENODE_LIBS_SORTED += $(shell $(CC) $(CC_MARCH) -print-libgcc-file-name)
|
||||
|
||||
L4LX_CONTRIB_DIR := $(call select_from_ports,$(LX_TARGET))/src
|
||||
L4LX_BUILD = $(BUILD_BASE_DIR)/$(LX_TARGET)
|
||||
L4LX_BINARY = $(L4LX_BUILD)/$(TARGET)
|
||||
L4LX_SYMLINK = $(BUILD_BASE_DIR)/bin/$(LX_TARGET)
|
||||
L4LX_CONFIG = $(L4LX_BUILD)/.config
|
||||
|
||||
L4_BUILD_DIR := $(LIB_CACHE_DIR)/syscall-foc/build
|
||||
|
||||
BUILD_OUTPUT_FILTER = 2>&1 | sed "s/^/ [l4linux] /"
|
||||
|
||||
$(TARGET): $(L4LX_BINARY)
|
||||
|
||||
$(L4LX_BINARY): $(L4LX_CONFIG)
|
||||
$(VERBOSE_MK)$(MAKE) $(VERBOSE_DIR) \
|
||||
-C $(L4LX_CONTRIB_DIR)/$(LX_TARGET) \
|
||||
O=$(L4LX_BUILD) \
|
||||
CROSS_COMPILE="$(CROSS_DEV_PREFIX)" \
|
||||
CC="$(CC)" \
|
||||
KBUILD_VERBOSE=$(VERBOSE_LX_MK) \
|
||||
V=$(VERBOSE_LX_MK) \
|
||||
GENODE_INCLUDES="$(addprefix -I,$(INC_DIR))" \
|
||||
GENODE_LIBS="$(GENODE_LIBS_SORTED)" \
|
||||
L4ARCH="$(L4LX_L4ARCH)" $(BUILD_OUTPUT_FILTER) || false
|
||||
$(VERBOSE)ln -sf $@ $(L4LX_SYMLINK)
|
||||
|
||||
$(L4LX_CONFIG): $(SRC_L4LX_CONFIG)
|
||||
$(VERBOSE)sed -e "s/CONFIG_L4_OBJ_TREE.*/CONFIG_L4_OBJ_TREE=\"$(subst /,\/,$(L4_BUILD_DIR))\"/" $< > $@
|
||||
|
||||
clean:
|
||||
$(VERBOSE)rm -rf $(L4LX_BUILD)
|
||||
|
||||
.PHONY: $(L4LX_BINARY)
|
@ -1,110 +0,0 @@
|
||||
--- drivers/staging/android/binder.c
|
||||
+++ drivers/staging/android/binder.c
|
||||
@@ -34,6 +34,8 @@
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
+#include <linux/kthread.h>
|
||||
+
|
||||
#include "binder.h"
|
||||
|
||||
static DEFINE_MUTEX(binder_lock);
|
||||
@@ -49,6 +51,8 @@ static struct dentry *binder_debugfs_dir_entry_proc;
|
||||
static struct binder_node *binder_context_mgr_node;
|
||||
static uid_t binder_context_mgr_uid = -1;
|
||||
static int binder_last_id;
|
||||
+static struct task_struct *binder_deferred_task;
|
||||
+static DECLARE_WAIT_QUEUE_HEAD(binder_deferred_wq);
|
||||
static struct workqueue_struct *binder_deferred_workqueue;
|
||||
|
||||
#define BINDER_DEBUG_ENTRY(name) \
|
||||
@@ -3075,14 +3079,23 @@ static void binder_deferred_release(struct binder_proc *proc)
|
||||
kfree(proc);
|
||||
}
|
||||
|
||||
-static void binder_deferred_func(struct work_struct *work)
|
||||
+static int binder_deferred_thread(void *ignore)
|
||||
{
|
||||
struct binder_proc *proc;
|
||||
struct files_struct *files;
|
||||
-
|
||||
+ int ret;
|
||||
int defer;
|
||||
- do {
|
||||
+
|
||||
+ for (;;) {
|
||||
+
|
||||
+ do {
|
||||
+ ret = wait_event_interruptible(binder_deferred_wq, !hlist_empty(&binder_deferred_list));
|
||||
+ } while (ret == -ERESTARTSYS);
|
||||
+ if (kthread_should_stop())
|
||||
+ break;
|
||||
+
|
||||
mutex_lock(&binder_lock);
|
||||
+
|
||||
mutex_lock(&binder_deferred_lock);
|
||||
if (!hlist_empty(&binder_deferred_list)) {
|
||||
proc = hlist_entry(binder_deferred_list.first,
|
||||
@@ -3097,24 +3110,27 @@ static void binder_deferred_func(struct work_struct *work)
|
||||
mutex_unlock(&binder_deferred_lock);
|
||||
|
||||
files = NULL;
|
||||
- if (defer & BINDER_DEFERRED_PUT_FILES) {
|
||||
- files = proc->files;
|
||||
- if (files)
|
||||
- proc->files = NULL;
|
||||
- }
|
||||
+ if (proc != NULL) {
|
||||
|
||||
- if (defer & BINDER_DEFERRED_FLUSH)
|
||||
- binder_deferred_flush(proc);
|
||||
+ if (defer & BINDER_DEFERRED_PUT_FILES) {
|
||||
+ files = proc->files;
|
||||
+ if (files)
|
||||
+ proc->files = NULL;
|
||||
+ }
|
||||
|
||||
- if (defer & BINDER_DEFERRED_RELEASE)
|
||||
- binder_deferred_release(proc); /* frees proc */
|
||||
+ if (defer & BINDER_DEFERRED_FLUSH)
|
||||
+ binder_deferred_flush(proc);
|
||||
+
|
||||
+ if (defer & BINDER_DEFERRED_RELEASE)
|
||||
+ binder_deferred_release(proc); /* frees proc */
|
||||
+ }
|
||||
|
||||
mutex_unlock(&binder_lock);
|
||||
if (files)
|
||||
put_files_struct(files);
|
||||
- } while (proc);
|
||||
+ }
|
||||
+ return 0;
|
||||
}
|
||||
-static DECLARE_WORK(binder_deferred_work, binder_deferred_func);
|
||||
|
||||
static void
|
||||
binder_defer_work(struct binder_proc *proc, enum binder_deferred_state defer)
|
||||
@@ -3124,9 +3140,9 @@ binder_defer_work(struct binder_proc *proc, enum binder_deferred_state defer)
|
||||
if (hlist_unhashed(&proc->deferred_work_node)) {
|
||||
hlist_add_head(&proc->deferred_work_node,
|
||||
&binder_deferred_list);
|
||||
- queue_work(binder_deferred_workqueue, &binder_deferred_work);
|
||||
}
|
||||
mutex_unlock(&binder_deferred_lock);
|
||||
+ wake_up_interruptible(&binder_deferred_wq);
|
||||
}
|
||||
|
||||
static void print_binder_transaction(struct seq_file *m, const char *prefix,
|
||||
@@ -3603,6 +3619,12 @@ static int __init binder_init(void)
|
||||
&binder_transaction_log_failed,
|
||||
&binder_transaction_log_fops);
|
||||
}
|
||||
+
|
||||
+ if (ret == 0) {
|
||||
+ binder_deferred_task = kthread_run(binder_deferred_thread, NULL, "binder_deferred_thread");
|
||||
+ if (binder_deferred_task == NULL)
|
||||
+ ret = PTR_ERR(binder_deferred_task);
|
||||
+ }
|
||||
return ret;
|
||||
}
|
||||
|
@ -1,13 +0,0 @@
|
||||
Index: net/ipv4/icmp.c
|
||||
===================================================================
|
||||
--- net/ipv4/icmp.c (revision 23)
|
||||
+++ net/ipv4/icmp.c (working copy)
|
||||
@@ -818,7 +818,7 @@
|
||||
if (!net->ipv4.sysctl_icmp_echo_ignore_all) {
|
||||
struct icmp_bxm icmp_param;
|
||||
|
||||
- icmp_param.data.icmph = *icmp_hdr(skb);
|
||||
+ memcpy(&icmp_param.data.icmph, icmp_hdr(skb), sizeof(struct icmphdr));
|
||||
icmp_param.data.icmph.type = ICMP_ECHOREPLY;
|
||||
icmp_param.skb = skb;
|
||||
icmp_param.offset = 0;
|
File diff suppressed because it is too large
Load Diff
@ -1,29 +0,0 @@
|
||||
+++ arch/l4/kernel/arch-arm/vmlinux.lds.S
|
||||
@@ -108,6 +108,12 @@ SECTIONS
|
||||
LONG(0xffffffff);
|
||||
_parent_cap_local_name = .;
|
||||
LONG(0xffffffff);
|
||||
+ LONG(0xffffffff);
|
||||
+ LONG(0xffffffff);
|
||||
+ LONG(0xffffffff);
|
||||
+ LONG(0xffffffff);
|
||||
+ LONG(0xffffffff);
|
||||
+ LONG(0xffffffff);
|
||||
} : rw
|
||||
|
||||
. = ALIGN(4096);
|
||||
+++ arch/l4/kernel/arch-x86/vmlinux.lds.S
|
||||
@@ -101,6 +101,13 @@ SECTIONS
|
||||
LONG(0xffffffff);
|
||||
_parent_cap_local_name = .;
|
||||
LONG(0xffffffff);
|
||||
+ LONG(0xffffffff);
|
||||
+ LONG(0xffffffff);
|
||||
+ LONG(0xffffffff);
|
||||
+ LONG(0xffffffff);
|
||||
+ LONG(0xffffffff);
|
||||
+ LONG(0xffffffff);
|
||||
+ LONG(0xffffffff);
|
||||
|
||||
/*
|
||||
* Platform-specific entry for Fiasco.OC.
|
@ -1,18 +0,0 @@
|
||||
Index: net/ipv4/tcp.c
|
||||
===================================================================
|
||||
--- net/ipv4/tcp.c (revision 25)
|
||||
+++ net/ipv4/tcp.c (working copy)
|
||||
@@ -3549,6 +3549,13 @@
|
||||
tcp_init_mem(&init_net);
|
||||
/* Set per-socket limits to no more than 1/128 the pressure threshold */
|
||||
limit = nr_free_buffer_pages() << (PAGE_SHIFT - 7);
|
||||
+
|
||||
+ /*
|
||||
+ * Adjust limit so it performs well on systems with little memory. If
|
||||
+ * this causes errors increase L4Linux main memory
|
||||
+ */
|
||||
+ limit = limit < 768U * 1024 ? 768U * 1024 : limit;
|
||||
+
|
||||
max_wshare = min(4UL*1024*1024, limit);
|
||||
max_rshare = min(6UL*1024*1024, limit);
|
||||
|
@ -1 +0,0 @@
|
||||
1e6243ccb8f368ed15b7f42c339434e46d0062a9
|
@ -1,15 +0,0 @@
|
||||
LICENSE := GPLv2
|
||||
VERSION := git
|
||||
DOWNLOADS := l4android.git
|
||||
URL(l4android) := https://github.com/skalk/l4linux.git
|
||||
REV(l4android) := cea6e7ab97a5ad421e53d456dd940893d5a14866
|
||||
DIR(l4android) := src/l4android
|
||||
PATCHES := patches/parent_cap_ld_script.patch
|
||||
PATCH_OPT := -p0 -d src/l4android
|
||||
sym_link := src/l4android/arch/l4/drivers
|
||||
|
||||
default: $(sym_link)
|
||||
|
||||
# make sure to have downloaded the files before symlinking into it
|
||||
$(sym_link) : $(DOWNLOADS)
|
||||
$(VERBOSE)ln -sfT $(REP_DIR)/src/drivers $@
|
@ -1 +0,0 @@
|
||||
153fac6366d79b8380ccc97a3a7ed099cedb51b2
|
@ -1,15 +0,0 @@
|
||||
LICENSE := GPLv2
|
||||
VERSION := git
|
||||
DOWNLOADS := l4linux.git
|
||||
URL(l4linux) := https://github.com/skalk/l4linux.git
|
||||
REV(l4linux) := 25aa4a5f25c920e18aa18899e45c71974058d813
|
||||
DIR(l4linux) := src/l4linux
|
||||
PATCHES := patches/parent_cap_ld_script.patch
|
||||
PATCH_OPT := -p0 -d src/l4linux
|
||||
sym_link := src/l4linux/arch/l4/drivers
|
||||
|
||||
default: $(sym_link)
|
||||
|
||||
# make sure to have downloaded the files before symlinking into it
|
||||
$(sym_link) : $(DOWNLOADS)
|
||||
$(VERBOSE)ln -sfT $(REP_DIR)/src/drivers $@
|
@ -1,170 +0,0 @@
|
||||
assert_spec foc
|
||||
assert_spec 32bit
|
||||
|
||||
#
|
||||
# Build
|
||||
#
|
||||
set build_components {
|
||||
core
|
||||
init
|
||||
drivers/timer
|
||||
drivers/uart
|
||||
drivers/framebuffer
|
||||
l4linux }
|
||||
|
||||
set use_usb_driver [expr [have_spec omap4] || [have_spec arndale]]
|
||||
set use_nic_driver [expr !$use_usb_driver && [expr [have_spec lan9118] || [have_spec x86]]]
|
||||
|
||||
if {[expr !$use_usb_driver && !$use_nic_driver]} {
|
||||
puts "\n Run script is not supported on this platform. \n"; exit 0 }
|
||||
|
||||
lappend_if $use_usb_driver build_components drivers/usb
|
||||
lappend_if $use_nic_driver build_components drivers/nic
|
||||
lappend_if [have_spec ps2] build_components drivers/input/spec/ps2
|
||||
lappend_if [have_spec gpio] build_components drivers/gpio
|
||||
|
||||
source ${genode_dir}/repos/base/run/platform_drv.inc
|
||||
append_platform_drv_build_components
|
||||
|
||||
build $build_components
|
||||
|
||||
create_boot_directory
|
||||
|
||||
#
|
||||
# Config
|
||||
#
|
||||
set config {
|
||||
<config prio_levels="2">
|
||||
<parent-provides>
|
||||
<service name="ROM"/>
|
||||
<service name="RAM"/>
|
||||
<service name="IRQ"/>
|
||||
<service name="IO_MEM"/>
|
||||
<service name="IO_PORT"/>
|
||||
<service name="PD"/>
|
||||
<service name="RM"/>
|
||||
<service name="CPU"/>
|
||||
<service name="LOG"/>
|
||||
</parent-provides>
|
||||
<default-route>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</default-route>
|
||||
<start name="timer">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides><service name="Timer"/></provides>
|
||||
</start>
|
||||
<start name="kdb_uart_drv">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides>
|
||||
<service name="Terminal"/>
|
||||
<service name="Uart"/>
|
||||
</provides>
|
||||
<config><policy label_prefix="l4linux" uart="0"/></config>
|
||||
</start> }
|
||||
|
||||
append_platform_drv_config
|
||||
|
||||
append_if [have_spec framebuffer] config {
|
||||
<start name="fb_drv">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides><service name="Framebuffer"/></provides>
|
||||
</start> }
|
||||
|
||||
append_if [have_spec ps2] config {
|
||||
<start name="ps2_drv">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides><service name="Input"/></provides>
|
||||
</start> }
|
||||
|
||||
append_if [have_spec gpio] config {
|
||||
<start name="gpio_drv">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides><service name="Gpio"/></provides>
|
||||
<config/>
|
||||
</start>}
|
||||
|
||||
append_if $use_usb_driver config {
|
||||
<start name="usb_drv">
|
||||
<resource name="RAM" quantum="12M"/>
|
||||
<provides>
|
||||
<service name="Nic"/>
|
||||
<service name="Input"/>
|
||||
</provides>
|
||||
<config uhci="yes" ehci="yes">
|
||||
<nic mac="02:00:00:00:01:01"/>
|
||||
<hid />
|
||||
</config>
|
||||
</start>}
|
||||
|
||||
append_if $use_nic_driver config {
|
||||
<start name="nic_drv">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides><service name="Nic"/></provides>
|
||||
</start> }
|
||||
|
||||
append config {
|
||||
<start name="l4linux">
|
||||
<resource name="RAM" quantum="128M"/> }
|
||||
|
||||
append_if [have_spec x86] config {
|
||||
<config args="mem=64M l4x_rd=initrd.gz l4x_cpus=2 l4x_cpus_map=0,1"/> }
|
||||
|
||||
append_if [have_spec arm] config {
|
||||
<config args="mem=64M l4x_rd=initrd.gz"/> }
|
||||
|
||||
append config {
|
||||
</start>
|
||||
</config> }
|
||||
|
||||
install_config $config
|
||||
|
||||
#
|
||||
# Boot modules
|
||||
#
|
||||
set boot_modules { core ld.lib.so init timer kdb_uart_drv l4linux initrd.gz }
|
||||
lappend_if [have_spec ps2] boot_modules ps2_drv
|
||||
lappend_if [have_spec framebuffer] boot_modules fb_drv
|
||||
lappend_if $use_nic_driver boot_modules nic_drv
|
||||
lappend_if $use_usb_driver boot_modules usb_drv
|
||||
lappend_if [have_spec gpio] boot_modules gpio_drv
|
||||
|
||||
if {[have_spec x86]} {
|
||||
set uri "http://genode.org/files/release-11.11/l4lx/initrd-ia32.gz"
|
||||
} elseif {[have_spec arm]} {
|
||||
set uri "http://genode.org/files/release-11.11/l4lx/initrd-arm.gz"
|
||||
}
|
||||
if {![file exists bin/initrd.gz]} {
|
||||
puts "Download initramfs ..."
|
||||
exec >& /dev/null wget -c -O bin/initrd.gz $uri
|
||||
}
|
||||
exec >& /dev/null wget -O bin/initrd.gz.md5 $uri.md5
|
||||
cd bin
|
||||
exec md5sum -c initrd.gz.md5
|
||||
cd ..
|
||||
|
||||
append_platform_drv_boot_modules
|
||||
|
||||
build_boot_image [join $boot_modules " "]
|
||||
|
||||
#
|
||||
# Qemu
|
||||
#
|
||||
append qemu_args " -m 160 -nographic "
|
||||
append qemu_args " -serial mon:stdio "
|
||||
append_if [have_spec x86] qemu_args " -smp 2,cores=2 "
|
||||
append_if [have_spec x86] qemu_args " -net nic,model=e1000 -net user "
|
||||
append_if [have_spec lan9118] qemu_args " -net nic,model=lan9118 -net user "
|
||||
|
||||
#
|
||||
# Execute test case
|
||||
#
|
||||
run_genode_until {.*\/ #.*} 220
|
||||
set serial_id [output_spawn_id]
|
||||
|
||||
# Wait for network to settle down
|
||||
send -i $serial_id "sleep 5\n"
|
||||
send -i $serial_id "wget http://genode.org/\n"
|
||||
|
||||
run_genode_until "Connecting to genode.org.*index.html.*\/ #.*" 30 $serial_id
|
||||
|
||||
exec rm bin/initrd.gz bin/initrd.gz.md5
|
@ -1,139 +0,0 @@
|
||||
|
||||
#
|
||||
# settings
|
||||
#
|
||||
set interpose_part_blk 0
|
||||
|
||||
assert_spec foc
|
||||
assert_spec arndale
|
||||
|
||||
#
|
||||
# build
|
||||
#
|
||||
set build_components {
|
||||
core
|
||||
init
|
||||
drivers/timer
|
||||
drivers/uart
|
||||
drivers/ahci
|
||||
drivers/platform
|
||||
l4linux
|
||||
}
|
||||
|
||||
lappend_if $interpose_part_blk build_components server/part_blk
|
||||
|
||||
build $build_components
|
||||
create_boot_directory
|
||||
|
||||
#
|
||||
# genode config
|
||||
#
|
||||
set config {
|
||||
<config prio_levels="2">
|
||||
<parent-provides>
|
||||
<service name="ROM"/>
|
||||
<service name="RAM"/>
|
||||
<service name="IRQ"/>
|
||||
<service name="IO_MEM"/>
|
||||
<service name="IO_PORT"/>
|
||||
<service name="PD"/>
|
||||
<service name="RM"/>
|
||||
<service name="CPU"/>
|
||||
<service name="LOG"/>
|
||||
</parent-provides>
|
||||
<default-route>
|
||||
<any-service><parent/><any-child/></any-service>
|
||||
</default-route>
|
||||
<start name="timer">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides><service name="Timer"/></provides>
|
||||
</start>
|
||||
<start name="kdb_uart_drv">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides>
|
||||
<service name="Terminal"/>
|
||||
<service name="Uart"/>
|
||||
</provides>
|
||||
<config><policy label_prefix="l4linux" uart="0" detect_size="yes"/></config>
|
||||
</start>
|
||||
<start name="ahci_drv">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides><service name="Block"/></provides>
|
||||
</start>
|
||||
<start name="platform_drv">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides><service name="Regulator"/></provides>
|
||||
</start> }
|
||||
|
||||
append_if $interpose_part_blk config {
|
||||
<start name="part_blk">
|
||||
<resource name="RAM" quantum="10M" />
|
||||
<provides><service name="Block" /></provides>
|
||||
<route>
|
||||
<service name="Block"><child name="ahci" /></service>
|
||||
<any-service><parent/><any-child/></any-service>
|
||||
</route>
|
||||
<config>
|
||||
<policy label="l4linux -> sda" partition="0"/>
|
||||
</config>
|
||||
</start> }
|
||||
|
||||
append config {
|
||||
<start name="l4linux">
|
||||
<resource name="RAM" quantum="200M"/>
|
||||
<config args="mem=100M console=ttyS0 l4x_rd=initrd.gz l4x_cpus=2 l4x_cpus_map=0,1">
|
||||
<block label="sda" />
|
||||
</config> }
|
||||
|
||||
append_if $interpose_part_blk config {
|
||||
<route>
|
||||
<service name="Block"><child name="part_blk" /></service>
|
||||
<any-service><parent/><any-child/></any-service>
|
||||
</route> }
|
||||
|
||||
append config {
|
||||
</start>
|
||||
</config> }
|
||||
|
||||
install_config $config
|
||||
|
||||
#
|
||||
# boot modules
|
||||
#
|
||||
set boot_modules {
|
||||
core
|
||||
ld.lib.so
|
||||
init
|
||||
timer
|
||||
kdb_uart_drv
|
||||
l4linux
|
||||
initrd.gz
|
||||
ahci_drv
|
||||
platform_drv }
|
||||
|
||||
lappend_if $interpose_part_blk boot_modules part_blk
|
||||
|
||||
set uri "http://genode.org/files/l4linux/initrd-ahci-bench.gz"
|
||||
if {![file exists bin/initrd.gz]} {
|
||||
puts "Download initramfs ..."
|
||||
exec >& /dev/null wget -c -O bin/initrd.gz $uri
|
||||
}
|
||||
exec >& /dev/null wget -O bin/initrd.gz.md5 $uri.md5
|
||||
cd bin
|
||||
exec md5sum -c initrd.gz.md5
|
||||
cd ..
|
||||
|
||||
set fiasco_serial_esc_arg ""
|
||||
|
||||
build_boot_image [join $boot_modules " "]
|
||||
|
||||
#
|
||||
# qemu
|
||||
#
|
||||
append qemu_args " -m 512 -nographic "
|
||||
|
||||
#
|
||||
# execute test
|
||||
#
|
||||
run_genode_until forever
|
||||
|
@ -1,267 +0,0 @@
|
||||
#
|
||||
# \brief Test using netperf with l4linux
|
||||
# \author Sebastian Sumpf
|
||||
# \date 2013-07-08
|
||||
#
|
||||
|
||||
assert_spec foc
|
||||
assert_spec 32bit
|
||||
assert_spec arndale
|
||||
|
||||
set ip [check_installed ip]
|
||||
set wget [check_installed wget]
|
||||
set md5 [check_installed md5sum]
|
||||
|
||||
|
||||
if {$use_nic_bridge == 1} {
|
||||
set route_nic "nic_bridge"
|
||||
} else {
|
||||
set route_nic "usb_drv"
|
||||
}
|
||||
|
||||
set version "2.4.4"
|
||||
|
||||
# sanity check that the right version is used
|
||||
set wrong_version [catch {
|
||||
spawn netperf-$version -V
|
||||
expect {
|
||||
"Netperf version $version" { }
|
||||
eof { return }
|
||||
timeout { return }
|
||||
}
|
||||
spawn netserver-$version -V
|
||||
expect {
|
||||
"Netperf version $version" { }
|
||||
eof { return }
|
||||
timeout { return }
|
||||
}
|
||||
}]
|
||||
|
||||
if {$wrong_version} {
|
||||
puts -nonewline "\nPlease compile a netperf client of version $version "
|
||||
puts "for your host system."
|
||||
puts -nonewline "The sources are available via "
|
||||
puts "ftp://ftp.netperf.org/netperf/archive/netperf-2.4.4.tar.bz2"
|
||||
puts "Please name the binary netperf-$version and netserver-$version\n"
|
||||
exit 1;
|
||||
}
|
||||
|
||||
#
|
||||
# Build
|
||||
#
|
||||
set build_components {
|
||||
core
|
||||
init
|
||||
drivers/usb
|
||||
drivers/timer
|
||||
drivers/uart
|
||||
server/nic_bridge
|
||||
l4linux
|
||||
}
|
||||
|
||||
source ${genode_dir}/repos/base/run/platform_drv.inc
|
||||
append_platform_drv_build_components
|
||||
|
||||
build $build_components
|
||||
|
||||
create_boot_directory
|
||||
|
||||
#
|
||||
# Config
|
||||
#
|
||||
set config {
|
||||
<config>
|
||||
<parent-provides>
|
||||
<service name="ROM"/>
|
||||
<service name="RAM"/>
|
||||
<service name="IRQ"/>
|
||||
<service name="IO_MEM"/>
|
||||
<service name="IO_PORT"/>
|
||||
<service name="PD"/>
|
||||
<service name="RM"/>
|
||||
<service name="CPU"/>
|
||||
<service name="LOG"/>
|
||||
</parent-provides>
|
||||
<default-route>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</default-route>
|
||||
<start name="timer">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides><service name="Timer"/></provides>
|
||||
</start>
|
||||
}
|
||||
|
||||
append_platform_drv_config
|
||||
|
||||
append config {
|
||||
<start name="kdb_uart_drv">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides>
|
||||
<service name="Terminal"/>
|
||||
<service name="Uart"/>
|
||||
</provides>
|
||||
<config><policy label_prefix="l4linux" uart="0"/></config>
|
||||
</start>
|
||||
<start name="usb_drv">
|
||||
<binary name="usb_drv"/>
|
||||
<resource name="RAM" quantum="12M"/>
|
||||
<provides>
|
||||
<service name="Nic"/>
|
||||
</provides>
|
||||
}
|
||||
append config "
|
||||
<config uhci=\"$use_usb_11\" ehci=\"$use_usb_20\" xhci=\"$use_usb_30\">"
|
||||
append config {
|
||||
<nic mac="02:00:00:00:01:01" />
|
||||
</config>
|
||||
<route>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
}
|
||||
|
||||
append config {
|
||||
<start name="l4linux">
|
||||
<resource name="RAM" quantum="512M"/>
|
||||
<config args="mem=400M console=ttyS0 l4x_rd=initrd.gz l4x_cpus=1 l4x_cpus_map=0"/>
|
||||
<route>
|
||||
}
|
||||
append config "\t\t<service name=\"Nic\"><child name=\"$route_nic\" /> </service>"
|
||||
append config {
|
||||
<any-service> <any-child /><parent/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
}
|
||||
|
||||
append_if $use_nic_bridge config {
|
||||
<start name="nic_bridge">
|
||||
<resource name="RAM" quantum="6M"/>
|
||||
<provides><service name="Nic"/></provides>
|
||||
<config/>
|
||||
<route>
|
||||
<service name="Nic"> <child name="usb_drv"/> </service>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
}
|
||||
|
||||
|
||||
append config {
|
||||
</config>
|
||||
}
|
||||
|
||||
install_config $config
|
||||
|
||||
#
|
||||
# Boot modules
|
||||
#
|
||||
set boot_modules {
|
||||
core
|
||||
ld.lib.so
|
||||
init
|
||||
timer
|
||||
l4linux
|
||||
initrd.gz
|
||||
usb_drv
|
||||
nic_bridge
|
||||
kdb_uart_drv
|
||||
}
|
||||
|
||||
set uri "http://genode.org/files/l4linux/initrd-arm-netperf.gz"
|
||||
if {[have_spec x86]} {
|
||||
set uri "http://genode.org/files/l4linux/busybox-initrd-x86-20140506.gz"
|
||||
} elseif {[have_spec arm]} {
|
||||
set uri "http://genode.org/files/l4linux/initrd-arm-mdev.gz"
|
||||
}
|
||||
|
||||
if {![file exists bin/initrd.gz]} {
|
||||
puts "Download initramfs ..."
|
||||
exec >& /dev/null $wget -c -O bin/initrd.gz $uri
|
||||
exec >& /dev/null $wget -O bin/initrd.gz.md5 $uri.md5
|
||||
cd bin
|
||||
exec $md5 -c initrd.gz.md5
|
||||
cd ..
|
||||
}
|
||||
|
||||
append_platform_drv_boot_modules
|
||||
|
||||
build_boot_image $boot_modules
|
||||
|
||||
|
||||
#
|
||||
# Execute test case
|
||||
#
|
||||
set ip_match "(\[0-9]{1,3})\\.(\[0-9]{1,3})\\.(\[0-9]{1,3})\\.(\[0-9]{1,3})"
|
||||
|
||||
#
|
||||
# Local IP
|
||||
#
|
||||
set ip_string [ exec $ip addr show dev eth0 ]
|
||||
regexp $ip_match $ip_string ip_local
|
||||
|
||||
|
||||
#
|
||||
# Remote IP
|
||||
#
|
||||
run_genode_until "netif_info: register.*\n" 60
|
||||
set serial_id [output_spawn_id]
|
||||
sleep 8
|
||||
send -i $serial_id "ip addr show dev eth0\n"
|
||||
run_genode_until "inet.*\n" 3 $serial_id
|
||||
regexp $ip_match $output ip_remote
|
||||
|
||||
puts "Using local IP: $ip_local remote IP: $ip_remote"
|
||||
|
||||
|
||||
#
|
||||
# TX (from board to local)
|
||||
#
|
||||
puts "\nTransmission test:"
|
||||
|
||||
exec netserver-$version -p 8888 &
|
||||
send -i $serial_id "netperf -p 8888 -H $ip_local -c -C -t TCP_STREAM && uname\n"
|
||||
run_genode_until "Linux.*" 30 $serial_id
|
||||
|
||||
puts "\n\n"
|
||||
|
||||
# get throughput_tx from netperf output
|
||||
set throughput_tx [regexp -all -inline {([0-9]+[ ]+){3}[0-9]+\.[0-9]+[ ]+[0-9]+\.[0-9]+} $output]
|
||||
set throughput_tx [regexp -all -inline {[0-9]+\.[0-9]+} $throughput_tx]
|
||||
|
||||
#
|
||||
# RX
|
||||
#
|
||||
puts "Receive test:"
|
||||
|
||||
set results [exec netperf-$version -p 8888 -H $ip_remote -t TCP_STREAM]
|
||||
puts $results
|
||||
|
||||
# get throughput from netperf output
|
||||
set throughput_rx [regexp -all -inline {([0-9]+[ ]+){3}[0-9]+\.[0-9]+[ ]+[0-9]+\.[0-9]+} $results]
|
||||
set throughput_rx [regexp -all -inline {[0-9]+\.[0-9]+} $throughput_rx]
|
||||
|
||||
puts "\n"
|
||||
|
||||
#
|
||||
# format output parseable for post proccessing scripts
|
||||
#
|
||||
puts -nonewline "! PERF: TCP_TX"
|
||||
if {$use_nic_bridge} { puts -nonewline "_bridge" }
|
||||
if {![string compare $use_usb_11 "yes"]} { puts -nonewline "_uhci" }
|
||||
if {![string compare $use_usb_20 "yes"]} { puts -nonewline "_ohci" }
|
||||
if {![string compare $use_usb_30 "yes"]} { puts -nonewline "_xhci" }
|
||||
puts " [lindex $throughput_tx 1] MBit/s ok"
|
||||
|
||||
puts -nonewline "! PERF: TCP_RX"
|
||||
if {$use_nic_bridge} { puts -nonewline "_bridge" }
|
||||
if {![string compare $use_usb_11 "yes"]} { puts -nonewline "_uhci" }
|
||||
if {![string compare $use_usb_20 "yes"]} { puts -nonewline "_ohci" }
|
||||
if {![string compare $use_usb_30 "yes"]} { puts -nonewline "_xhci" }
|
||||
puts " [lindex $throughput_rx 1] MBit/s ok"
|
||||
|
||||
exec rm bin/initrd.gz bin/initrd.gz.md5
|
||||
|
||||
close -i $serial_id
|
||||
exec killall netserver-$version
|
||||
|
||||
# vi: set ft=tcl :
|
@ -1,18 +0,0 @@
|
||||
#
|
||||
# \brief Test using netperf with l4linux
|
||||
# \date 2013-07-08
|
||||
#
|
||||
|
||||
if {[have_include "power_on/qemu"]} {
|
||||
puts "\nNetperf running on Qemu is not supported.\n"
|
||||
exit
|
||||
}
|
||||
|
||||
# network configuration
|
||||
set use_nic_bridge 0
|
||||
|
||||
set use_usb_11 "no"
|
||||
set use_usb_20 "yes"
|
||||
set use_usb_30 "no"
|
||||
|
||||
source ${genode_dir}/repos/ports-foc/run/l4linux_netperf.inc
|
@ -1,18 +0,0 @@
|
||||
#
|
||||
# \brief Test using netperf with l4linux and bridge
|
||||
# \date 2013-07-08
|
||||
#
|
||||
|
||||
if {[have_include "power_on/qemu"]} {
|
||||
puts "\nNetperf running on Qemu is not supported.\n"
|
||||
exit
|
||||
}
|
||||
|
||||
# network configuration
|
||||
set use_nic_bridge 1
|
||||
|
||||
set use_usb_11 "no"
|
||||
set use_usb_20 "no"
|
||||
set use_usb_30 "yes"
|
||||
|
||||
source ${genode_dir}/repos/ports-foc/run/l4linux_netperf.inc
|
@ -1,18 +0,0 @@
|
||||
#
|
||||
# \brief Test using netperf with l4linux
|
||||
# \date 2013-07-08
|
||||
#
|
||||
|
||||
if {[have_include "power_on/qemu"]} {
|
||||
puts "\nNetperf running on Qemu is not supported.\n"
|
||||
exit
|
||||
}
|
||||
|
||||
# network configuration
|
||||
set use_nic_bridge 0
|
||||
|
||||
set use_usb_11 "no"
|
||||
set use_usb_20 "no"
|
||||
set use_usb_30 "yes"
|
||||
|
||||
source ${genode_dir}/repos/ports-foc/run/l4linux_netperf.inc
|
@ -1,135 +0,0 @@
|
||||
assert_spec foc
|
||||
assert_spec panda
|
||||
|
||||
#
|
||||
# Build
|
||||
#
|
||||
build {
|
||||
core
|
||||
init
|
||||
drivers/timer
|
||||
drivers/framebuffer
|
||||
drivers/sd_card
|
||||
drivers/usb
|
||||
drivers/gpio
|
||||
server/nic_bridge
|
||||
server/part_blk
|
||||
l4linux
|
||||
}
|
||||
|
||||
create_boot_directory
|
||||
|
||||
#
|
||||
# Config
|
||||
#
|
||||
set config {
|
||||
<config prio_levels="2">
|
||||
<parent-provides>
|
||||
<service name="ROM"/>
|
||||
<service name="RAM"/>
|
||||
<service name="IRQ"/>
|
||||
<service name="IO_MEM"/>
|
||||
<service name="IO_PORT"/>
|
||||
<service name="PD"/>
|
||||
<service name="RM"/>
|
||||
<service name="CPU"/>
|
||||
<service name="LOG"/>
|
||||
</parent-provides>
|
||||
<default-route>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</default-route>
|
||||
<start name="timer" priority="0">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides><service name="Timer"/></provides>
|
||||
</start>
|
||||
<start name="fb_drv" priority="-1">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides><service name="Framebuffer"/></provides>
|
||||
</start>
|
||||
<start name="sd_card_drv" priority="0">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides><service name="Block"/></provides>
|
||||
</start>
|
||||
<start name="gpio_drv">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides><service name="Gpio"/></provides>
|
||||
<config/>
|
||||
</start>
|
||||
<start name="usb_drv" priority="-1">
|
||||
<resource name="RAM" quantum="12M"/>
|
||||
<provides>
|
||||
<service name="Input"/>
|
||||
<service name="Nic"/>
|
||||
</provides>
|
||||
<config ehci="yes">
|
||||
<hid/>
|
||||
<nic mac="02:00:00:00:01:01" />
|
||||
</config>
|
||||
</start>
|
||||
<!--<start name="part_blk">
|
||||
<resource name="RAM" quantum="2M"/>
|
||||
<provides><service name="Block"/></provides>
|
||||
<config>
|
||||
<policy label="vmlinux.1 -> sda" partition="1" />
|
||||
<policy label="vmlinux.2 -> sda" partition="2" />
|
||||
<policy label_prefix="test-libc_ffat" partition="3" />
|
||||
</config>
|
||||
<route>
|
||||
<service name="Block"> <child name="sd_card_drv"/> </service>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</route>
|
||||
</start>-->
|
||||
<!--<start name="nic_bridge" priority="-1">
|
||||
<resource name="RAM" quantum="2M"/>
|
||||
<provides><service name="Nic"/></provides>
|
||||
<route>
|
||||
<service name="Nic"> <child name="usb_drv"/> </service>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</route>
|
||||
</start>-->
|
||||
<start name="vmlinux.1" priority="-1">
|
||||
<binary name="l4linux"/>
|
||||
<resource name="RAM" quantum="296M"/>
|
||||
<config args="mem=254M l4x_rd=initrd.gz">
|
||||
<block label="sda" />
|
||||
</config>
|
||||
<route>
|
||||
<service name="Block"> <child name="sd_card_drv"/> </service>
|
||||
<!--<service name="Nic"> <child name="nic_bridge"/> </service>-->
|
||||
<any-service> <any-child/> <parent/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
</config>}
|
||||
|
||||
install_config $config
|
||||
|
||||
#
|
||||
# Boot modules
|
||||
#
|
||||
set boot_modules {
|
||||
core
|
||||
ld.lib.so
|
||||
init
|
||||
timer
|
||||
nic_bridge
|
||||
part_blk
|
||||
l4linux
|
||||
initrd.gz
|
||||
fb_drv
|
||||
sd_card_drv
|
||||
gpio_drv
|
||||
usb_drv
|
||||
}
|
||||
|
||||
set uri "http://genode.org/files/l4linux/busybox-initrd-arm-20120710.gz"
|
||||
if {![file exists bin/initrd.gz]} {
|
||||
puts "Download initramfs ..."
|
||||
exec >& /dev/null wget -c -O bin/initrd.gz $uri
|
||||
}
|
||||
exec >& /dev/null wget -O bin/initrd.gz.md5 $uri.md5
|
||||
cd bin
|
||||
exec md5sum -c initrd.gz.md5
|
||||
cd ..
|
||||
|
||||
build_boot_image [join $boot_modules " "]
|
||||
|
@ -1,6 +0,0 @@
|
||||
obj-y += genode_serial.o
|
||||
obj-$(CONFIG_GENODE_BALLOON) += genode_balloon.o
|
||||
obj-$(CONFIG_RTC_CLASS) += genode_rtc.o
|
||||
obj-$(CONFIG_FB) += genode_fb.o
|
||||
obj-$(CONFIG_BLOCK) += genode_block.o
|
||||
obj-$(CONFIG_NET) += genode_net.o
|
@ -1,112 +0,0 @@
|
||||
|
||||
/*
|
||||
* \brief Balloon driver to use Genode's dynamic memory balancing
|
||||
* \author Stefan Kalkowski <stefan.kalkowski@genode-labs.com>
|
||||
* \date 2013-09-19
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Linux includes */
|
||||
#include <linux/errno.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/jiffies.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/highmem.h>
|
||||
#include <linux/sizes.h>
|
||||
|
||||
#include <asm/tlb.h>
|
||||
|
||||
#include <l4/log/log.h>
|
||||
#include <genode/balloon.h>
|
||||
|
||||
#define GFP_BALLOON \
|
||||
(__GFP_IO | __GFP_FS | __GFP_HARDWALL | __GFP_HIGHMEM | __GFP_NOWARN | __GFP_NORETRY | __GFP_NOMEMALLOC)
|
||||
|
||||
enum { CHUNK_CACHE_SIZE = 16384 };
|
||||
static void* chunk_cache[CHUNK_CACHE_SIZE];
|
||||
|
||||
|
||||
static void free_avail_pages(unsigned long data)
|
||||
{
|
||||
void *pages;
|
||||
unsigned i = 0;
|
||||
|
||||
LOG_printf("free_avail_pages\n");
|
||||
for (; i < CHUNK_CACHE_SIZE; i++) {
|
||||
pages = alloc_pages_exact(SZ_1M, GFP_BALLOON);
|
||||
if (!pages)
|
||||
break;
|
||||
chunk_cache[i] = pages;
|
||||
}
|
||||
|
||||
BUG_ON(i == CHUNK_CACHE_SIZE);
|
||||
|
||||
/* Ensure that ballooned highmem pages don't have kmaps. */
|
||||
kmap_flush_unused();
|
||||
flush_tlb_all();
|
||||
|
||||
for (; i > 0;) {
|
||||
genode_balloon_free_chunk((unsigned long)chunk_cache[--i]);
|
||||
free_pages_exact(chunk_cache[i], SZ_1M);
|
||||
}
|
||||
|
||||
LOG_printf("free_avail_pages done\n");
|
||||
genode_balloon_free_done();
|
||||
}
|
||||
|
||||
DECLARE_TASKLET(free_avail, free_avail_pages, 0);
|
||||
|
||||
static irqreturn_t event_interrupt(int irq, void *data)
|
||||
{
|
||||
tasklet_schedule(&free_avail);
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
|
||||
static struct platform_device genode_balloon_device = {
|
||||
.name = "balloon-genode",
|
||||
};
|
||||
|
||||
|
||||
static int __init balloon_init(void)
|
||||
{
|
||||
int ret = 0;
|
||||
unsigned irq;
|
||||
l4_cap_idx_t irq_cap;
|
||||
|
||||
/*
|
||||
* touch the memory eager otherwise we run into trouble
|
||||
* when memory is empty and we balloon
|
||||
*/
|
||||
memset(&chunk_cache, 0, sizeof(chunk_cache));
|
||||
|
||||
/**
|
||||
* Obtain an IRQ for the device.
|
||||
*/
|
||||
irq_cap = genode_balloon_irq_cap();
|
||||
if ((irq = l4x_register_irq(irq_cap)) < 0)
|
||||
return -ENOMEM;
|
||||
if ((ret = request_irq(irq, event_interrupt, 0,
|
||||
"Genode balloon", &genode_balloon_device))) {
|
||||
printk(KERN_WARNING "%s: request_irq failed: %d\n", __func__, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = platform_device_register(&genode_balloon_device);
|
||||
return ret;
|
||||
}
|
||||
|
||||
subsys_initcall(balloon_init);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
@ -1,301 +0,0 @@
|
||||
/*
|
||||
* \brief Block driver to access Genode's block service
|
||||
* \author Stefan Kalkowski <stefan.kalkowski@genode-labs.com>
|
||||
* \date 2010-07-08
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2010-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Linux includes */
|
||||
#include <linux/module.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/hdreg.h>
|
||||
#include <linux/semaphore.h>
|
||||
#include <linux/interrupt.h>
|
||||
|
||||
/* Genode support library includes */
|
||||
#include <genode/block.h>
|
||||
#include <genode/string.h>
|
||||
#include <l4/log/log.h>
|
||||
|
||||
enum Geometry {
|
||||
KERNEL_SECTOR_SIZE = 512, /* sector size used by kernel */
|
||||
GENODE_BLK_MINORS = 16 /* number of minor numbers */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* The internal representation of our device.
|
||||
*/
|
||||
struct genode_blk_device {
|
||||
unsigned blk_cnt; /* Total block count */
|
||||
unsigned long blk_sz; /* Single block size */
|
||||
spinlock_t lock; /* For mutual exclusion */
|
||||
struct gendisk *gd; /* Generic disk structure */
|
||||
struct request_queue *queue; /* The device request queue */
|
||||
struct semaphore queue_wait; /* Used to block, when queue is full */
|
||||
short stopped; /* Indicates queue availability */
|
||||
unsigned irq; /* IRQ number */
|
||||
l4_cap_idx_t irq_cap; /* IRQ capability slot */
|
||||
unsigned idx; /* drive index */
|
||||
};
|
||||
|
||||
enum { MAX_DISKS = 16 };
|
||||
static struct genode_blk_device blk_devs[MAX_DISKS];
|
||||
|
||||
/*
|
||||
* Handle an I/O request.
|
||||
*/
|
||||
static void genode_blk_request(struct request_queue *q)
|
||||
{
|
||||
struct request *req;
|
||||
unsigned long queue_offset;
|
||||
void *buf;
|
||||
unsigned long long offset;
|
||||
unsigned long nbytes;
|
||||
short write;
|
||||
struct genode_blk_device* dev;
|
||||
|
||||
while ((req = blk_fetch_request(q))) {
|
||||
dev = req->rq_disk->private_data;
|
||||
buf = 0;
|
||||
offset = blk_rq_pos(req) * KERNEL_SECTOR_SIZE;
|
||||
nbytes = blk_rq_bytes(req);
|
||||
write = rq_data_dir(req) == WRITE;
|
||||
|
||||
if (req->cmd_type != REQ_TYPE_FS) {
|
||||
printk(KERN_NOTICE "Skip non-fs request\n");
|
||||
__blk_end_request_all(req, -EIO);
|
||||
continue;
|
||||
}
|
||||
|
||||
while (!buf) {
|
||||
unsigned long flags;
|
||||
|
||||
if ((buf = genode_block_request(dev->idx, nbytes, req, &queue_offset)))
|
||||
break;
|
||||
|
||||
/* stop_queue needs disabled interrupts */
|
||||
local_irq_save(flags);
|
||||
blk_stop_queue(q);
|
||||
|
||||
dev->stopped = 1;
|
||||
|
||||
/*
|
||||
* This function is called with the request queue lock held, unlock to
|
||||
* enable VCPU IRQs
|
||||
*/
|
||||
spin_unlock_irqrestore(q->queue_lock, flags);
|
||||
/* block until new responses are available */
|
||||
down(&dev->queue_wait);
|
||||
spin_lock_irqsave(q->queue_lock, flags);
|
||||
|
||||
/* start_queue needs disabled interrupts */
|
||||
blk_start_queue(q);
|
||||
local_irq_restore(flags);
|
||||
}
|
||||
|
||||
if (write) {
|
||||
char *ptr = (char*) buf;
|
||||
struct req_iterator iter;
|
||||
struct bio_vec *bvec;
|
||||
|
||||
rq_for_each_segment(bvec, req, iter) {
|
||||
void *buffer = page_address(bvec->bv_page) + bvec->bv_offset;
|
||||
genode_memcpy((void*)ptr, buffer, bvec->bv_len);
|
||||
ptr += bvec->bv_len;
|
||||
}
|
||||
}
|
||||
|
||||
genode_block_submit(dev->idx, queue_offset, nbytes, offset, write);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void FASTCALL
|
||||
genode_end_request(void *request, short write,
|
||||
void *buf, unsigned long sz) {
|
||||
struct request *req = (struct request*) request;
|
||||
struct genode_blk_device *dev = req->rq_disk->private_data;
|
||||
char *ptr = (char*) buf;
|
||||
|
||||
if (!write) {
|
||||
struct req_iterator iter;
|
||||
struct bio_vec *bvec;
|
||||
|
||||
rq_for_each_segment(bvec, req, iter) {
|
||||
void *buffer = page_address(bvec->bv_page) + bvec->bv_offset;
|
||||
genode_memcpy(buffer, (void*)ptr, bvec->bv_len);
|
||||
ptr += bvec->bv_len;
|
||||
}
|
||||
}
|
||||
|
||||
__blk_end_request_all(req, 0);
|
||||
|
||||
if (dev->stopped) {
|
||||
dev->stopped = 0;
|
||||
up(&dev->queue_wait);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int genode_blk_getgeo(struct block_device *bdev, struct hd_geometry *geo)
|
||||
{
|
||||
struct genode_blk_device *dev = bdev->bd_disk->private_data;
|
||||
unsigned long size = dev->blk_cnt * dev->blk_sz *
|
||||
(dev->blk_sz / KERNEL_SECTOR_SIZE);
|
||||
geo->cylinders = size >> 7;
|
||||
geo->heads = 4;
|
||||
geo->sectors = 32;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* The device operations structure.
|
||||
*/
|
||||
static struct block_device_operations genode_blk_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.getgeo = genode_blk_getgeo
|
||||
};
|
||||
|
||||
|
||||
static irqreturn_t event_interrupt(int irq, void *data)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct genode_blk_device *dev = (struct genode_blk_device *)data;
|
||||
spin_lock_irqsave(dev->queue->queue_lock, flags);
|
||||
genode_block_collect_responses(dev->idx);
|
||||
spin_unlock_irqrestore(dev->queue->queue_lock, flags);
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
|
||||
static int __init genode_blk_init(void)
|
||||
{
|
||||
int err;
|
||||
unsigned drive;
|
||||
unsigned drive_cnt = (genode_block_count() > MAX_DISKS)
|
||||
? MAX_DISKS : genode_block_count();
|
||||
|
||||
/**
|
||||
* Loop through all Genode block devices and register them in Linux.
|
||||
*/
|
||||
for (drive = 0 ; drive < drive_cnt; drive++) {
|
||||
int major_num;
|
||||
int writeable = 0;
|
||||
unsigned long req_queue_sz = 0;
|
||||
|
||||
/* Initialize device structure */
|
||||
memset (&blk_devs[drive], 0, sizeof(struct genode_blk_device));
|
||||
blk_devs[drive].idx = drive;
|
||||
spin_lock_init(&blk_devs[drive].lock);
|
||||
|
||||
genode_block_geometry(drive, (unsigned long*)&blk_devs[drive].blk_cnt,
|
||||
&blk_devs[drive].blk_sz, &writeable, &req_queue_sz);
|
||||
|
||||
/**
|
||||
* Obtain an IRQ for the drive.
|
||||
*/
|
||||
blk_devs[drive].irq_cap = genode_block_irq_cap(drive);
|
||||
if ((blk_devs[drive].irq = l4x_register_irq(blk_devs[drive].irq_cap)) < 0)
|
||||
return -ENOMEM;
|
||||
if ((err = request_irq(blk_devs[drive].irq, event_interrupt, 0,
|
||||
"Genode block", &blk_devs[drive]))) {
|
||||
printk(KERN_WARNING "%s: request_irq failed: %d\n", __func__, err);
|
||||
return err;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get a request queue.
|
||||
*/
|
||||
if(!(blk_devs[drive].queue = blk_init_queue(genode_blk_request,
|
||||
&blk_devs[drive].lock)))
|
||||
return -ENOMEM;
|
||||
|
||||
/*
|
||||
* Align queue requests to hardware sector size.
|
||||
*/
|
||||
blk_queue_logical_block_size(blk_devs[drive].queue, blk_devs[drive].blk_sz);
|
||||
|
||||
/*
|
||||
* Important, limit number of sectors per request,
|
||||
* as Genode's block-session has a limited request-transmit-queue.
|
||||
*/
|
||||
blk_queue_max_hw_sectors(blk_devs[drive].queue, req_queue_sz / KERNEL_SECTOR_SIZE);
|
||||
blk_devs[drive].queue->queuedata = &blk_devs[drive];
|
||||
|
||||
sema_init(&blk_devs[drive].queue_wait, 0);
|
||||
blk_devs[drive].stopped = 0;
|
||||
|
||||
/*
|
||||
* Register block device and gain major number.
|
||||
*/
|
||||
major_num = register_blkdev(0, genode_block_name(drive));
|
||||
if(major_num < 1) {
|
||||
printk(KERN_WARNING "genode_blk: unable to get major number\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate and setup generic disk structure.
|
||||
*/
|
||||
if(!(blk_devs[drive].gd = alloc_disk(GENODE_BLK_MINORS))) {
|
||||
unregister_blkdev(major_num, genode_block_name(drive));
|
||||
return -ENOMEM;
|
||||
}
|
||||
blk_devs[drive].gd->major = major_num;
|
||||
blk_devs[drive].gd->first_minor = 0;
|
||||
blk_devs[drive].gd->fops = &genode_blk_ops;
|
||||
blk_devs[drive].gd->private_data = &blk_devs[drive];
|
||||
blk_devs[drive].gd->queue = blk_devs[drive].queue;
|
||||
strncpy(blk_devs[drive].gd->disk_name, genode_block_name(drive),
|
||||
sizeof(blk_devs[drive].gd->disk_name));
|
||||
set_capacity(blk_devs[drive].gd, blk_devs[drive].blk_cnt *
|
||||
(blk_devs[drive].blk_sz / KERNEL_SECTOR_SIZE));
|
||||
|
||||
/* Set it read-only or writeable */
|
||||
if (!writeable)
|
||||
set_disk_ro(blk_devs[drive].gd, 1);
|
||||
|
||||
if (drive == 0)
|
||||
genode_block_register_callback(genode_end_request);
|
||||
|
||||
/* Make the block device available to the system */
|
||||
add_disk(blk_devs[drive].gd);
|
||||
}
|
||||
|
||||
printk(KERN_NOTICE "Genode blk-file driver initialized\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void __exit
|
||||
genode_blk_exit(void)
|
||||
{
|
||||
unsigned drive, drive_cnt = (genode_block_count() > MAX_DISKS)
|
||||
? MAX_DISKS : genode_block_count();
|
||||
for (drive = 0 ; drive < drive_cnt; drive++) {
|
||||
del_gendisk(blk_devs[drive].gd);
|
||||
put_disk(blk_devs[drive].gd);
|
||||
unregister_blkdev(blk_devs[drive].gd->major, genode_block_name(drive));
|
||||
blk_cleanup_queue(blk_devs[drive].queue);
|
||||
}
|
||||
}
|
||||
|
||||
module_init(genode_blk_init);
|
||||
module_exit(genode_blk_exit);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
@ -1,526 +0,0 @@
|
||||
/*
|
||||
* \brief Genode screen driver
|
||||
* \author Stefan Kalkowski <kalkowski@genode-labs.com>
|
||||
* \date 2010-04-20
|
||||
*
|
||||
* This driver enables usage of any of Genode's framebuffer, input
|
||||
* and nitpicker sessions, as defined in Linux corresponding XML config stub.
|
||||
* The implementation is based on virtual (vfb.c) and
|
||||
* L4 (l4fb.c) framebuffer driver of L4Linux from TU-Dresden.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2010-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Linux includes */
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/tty.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/screen_info.h>
|
||||
#include <linux/sched.h>
|
||||
|
||||
/* Platform includes */
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
/* L4 includes */
|
||||
#include <l4/util/util.h>
|
||||
|
||||
/* Genode support lib includes */
|
||||
#include <genode/framebuffer.h>
|
||||
#include <genode/input.h>
|
||||
|
||||
|
||||
/**********************************
|
||||
** Datastructure declarations **
|
||||
**********************************/
|
||||
|
||||
/**
|
||||
* List of available framebuffers (used by device->driver_data)
|
||||
*/
|
||||
struct genodefb_infolist {
|
||||
struct fb_info *info;
|
||||
struct genodefb_infolist *next;
|
||||
};
|
||||
|
||||
|
||||
/**********************
|
||||
** Global variables **
|
||||
**********************/
|
||||
|
||||
static const int IRQ_KEYBOARD = 2;
|
||||
|
||||
static const char GENODEFB_DRV_NAME[] = "genodefb";
|
||||
|
||||
static unsigned int poll_sleep = HZ / 10;
|
||||
static struct timer_list input_timer;
|
||||
|
||||
static struct fb_var_screeninfo genodefb_var __initdata = {
|
||||
.activate = FB_ACTIVATE_NOW,
|
||||
.height = -1,
|
||||
.width = -1,
|
||||
.right_margin = 32,
|
||||
.upper_margin = 16,
|
||||
.lower_margin = 4,
|
||||
.vsync_len = 4,
|
||||
.vmode = FB_VMODE_NONINTERLACED,
|
||||
.bits_per_pixel = 16, // Genode only supports RGB565 by now */
|
||||
.red.length = 5,
|
||||
.red.offset = 11,
|
||||
.green.length = 6,
|
||||
.green.offset = 5,
|
||||
.blue.length = 5,
|
||||
.blue.offset = 0,
|
||||
.transp.length = 0,
|
||||
.transp.offset = 0,
|
||||
};
|
||||
|
||||
static struct fb_fix_screeninfo genodefb_fix __initdata = {
|
||||
.id = "genode_fb",
|
||||
.type = FB_TYPE_PACKED_PIXELS,
|
||||
.accel = FB_ACCEL_NONE,
|
||||
.visual = FB_VISUAL_TRUECOLOR,
|
||||
.ypanstep = 0,
|
||||
.ywrapstep = 0,
|
||||
};
|
||||
|
||||
static u32 pseudo_palette[17];
|
||||
|
||||
|
||||
/*************************
|
||||
** Device operations **
|
||||
*************************/
|
||||
|
||||
/*
|
||||
* Set a single color register. The values supplied are
|
||||
* already rounded down to the hardware's capabilities
|
||||
* (according to the entries in the `var' structure). Return
|
||||
* != 0 for invalid regno and pixel formats.
|
||||
*/
|
||||
static int genodefb_setcolreg(unsigned regno, unsigned red, unsigned green,
|
||||
unsigned blue, unsigned transp,
|
||||
struct fb_info *info)
|
||||
{
|
||||
if (regno >= info->cmap.len || info->var.bits_per_pixel != 16)
|
||||
return 1;
|
||||
|
||||
if (regno < 16)
|
||||
((u32*) (info->pseudo_palette))[regno] =
|
||||
((red >> (16 - info->var.red.length)) << info->var.red.offset) |
|
||||
((green >> (16 - info->var.green.length)) << info->var.green.offset) |
|
||||
((blue >> (16 - info->var.blue.length)) << info->var.blue.offset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Pan or Wrap the Display
|
||||
*
|
||||
* This call looks only at xoffset, yoffset and the FB_VMODE_YWRAP flag
|
||||
*/
|
||||
static int genodefb_pan_display(struct fb_var_screeninfo *var,
|
||||
struct fb_info *info)
|
||||
{
|
||||
if (var->vmode & FB_VMODE_YWRAP) {
|
||||
if (var->yoffset < 0
|
||||
|| var->yoffset >= info->var.yres_virtual
|
||||
|| var->xoffset)
|
||||
return -EINVAL;
|
||||
} else {
|
||||
if (var->xoffset + var->xres > info->var.xres_virtual ||
|
||||
var->yoffset + var->yres > info->var.yres_virtual)
|
||||
return -EINVAL;
|
||||
}
|
||||
info->var.xoffset = var->xoffset;
|
||||
info->var.yoffset = var->yoffset;
|
||||
if (var->vmode & FB_VMODE_YWRAP)
|
||||
info->var.vmode |= FB_VMODE_YWRAP;
|
||||
else
|
||||
info->var.vmode &= ~FB_VMODE_YWRAP;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void genodefb_copyarea(struct fb_info *info,
|
||||
const struct fb_copyarea *region)
|
||||
{
|
||||
cfb_copyarea(info, region);
|
||||
genode_fb_refresh(info->node, region->dx, region->dy,
|
||||
region->width, region->height);
|
||||
}
|
||||
|
||||
|
||||
static void genodefb_fillrect(struct fb_info *info,
|
||||
const struct fb_fillrect *rect)
|
||||
{
|
||||
cfb_fillrect(info, rect);
|
||||
genode_fb_refresh(info->node, rect->dx, rect->dy,
|
||||
rect->width, rect->height);
|
||||
}
|
||||
|
||||
|
||||
static void genodefb_imageblit(struct fb_info *info,
|
||||
const struct fb_image *image)
|
||||
{
|
||||
cfb_imageblit(info, image);
|
||||
genode_fb_refresh(info->node, image->dx, image->dy,
|
||||
image->width, image->height);
|
||||
}
|
||||
|
||||
|
||||
static int genodefb_mmap(struct fb_info *info,
|
||||
struct vm_area_struct *vma)
|
||||
{
|
||||
unsigned long start = vma->vm_start;
|
||||
unsigned long size = vma->vm_end - vma->vm_start;
|
||||
unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
|
||||
unsigned long pfn;
|
||||
|
||||
if (offset + size > info->fix.smem_len)
|
||||
return -EINVAL;
|
||||
|
||||
pfn = ((unsigned long)info->fix.smem_start + offset) >> PAGE_SHIFT;
|
||||
while (size > 0) {
|
||||
if (remap_pfn_range(vma, start, pfn, PAGE_SIZE, PAGE_SHARED)) {
|
||||
return -EAGAIN;
|
||||
}
|
||||
start += PAGE_SIZE;
|
||||
pfn++;
|
||||
if (size > PAGE_SIZE)
|
||||
size -= PAGE_SIZE;
|
||||
else
|
||||
size = 0;
|
||||
}
|
||||
l4_touch_rw((char *)info->fix.smem_start + offset,
|
||||
vma->vm_end - vma->vm_start);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int genodefb_open(struct fb_info *info, int user)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int genodefb_release(struct fb_info *info, int user)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static struct fb_ops genodefb_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.fb_open = genodefb_open,
|
||||
.fb_release = genodefb_release,
|
||||
.fb_setcolreg = genodefb_setcolreg,
|
||||
.fb_pan_display = genodefb_pan_display,
|
||||
.fb_fillrect = genodefb_fillrect,
|
||||
.fb_copyarea = genodefb_copyarea,
|
||||
.fb_imageblit = genodefb_imageblit,
|
||||
.fb_mmap = genodefb_mmap,
|
||||
};
|
||||
|
||||
|
||||
/***********************
|
||||
** Input callbacks **
|
||||
***********************/
|
||||
|
||||
void FASTCALL
|
||||
input_event_callback (void *dev, unsigned int type,
|
||||
unsigned int code, int value)
|
||||
{
|
||||
struct input_dev *input_dev = (struct input_dev*) dev;
|
||||
|
||||
#ifdef CONFIG_ANDROID
|
||||
if (type == EV_KEY && code == BTN_LEFT)
|
||||
code = BTN_TOUCH;
|
||||
#endif
|
||||
|
||||
input_event(input_dev, type, code, value);
|
||||
input_sync(input_dev);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void genodefb_poll_for_events(unsigned long data)
|
||||
{
|
||||
genode_input_handle_events();
|
||||
mod_timer(&input_timer, jiffies + poll_sleep);
|
||||
}
|
||||
|
||||
|
||||
/***************************************
|
||||
** Device initialization / removal **
|
||||
***************************************/
|
||||
|
||||
static int __init genodefb_register_input_devices(unsigned int idx,
|
||||
unsigned int xres,
|
||||
unsigned int yres)
|
||||
{
|
||||
int i;
|
||||
struct input_dev *mouse_dev = input_allocate_device();
|
||||
struct input_dev *keyb_dev = input_allocate_device();
|
||||
if (!keyb_dev || !mouse_dev)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
/****************
|
||||
** Keyboard **
|
||||
****************/
|
||||
|
||||
keyb_dev->name = "Genode input key";
|
||||
keyb_dev->phys = "Genode fb key";
|
||||
keyb_dev->id.bustype = BUS_USB;
|
||||
keyb_dev->id.vendor = 0;
|
||||
keyb_dev->id.product = 0;
|
||||
keyb_dev->id.version = 0;
|
||||
|
||||
/* We generate key events */
|
||||
set_bit(EV_KEY, keyb_dev->evbit);
|
||||
set_bit(EV_REP, keyb_dev->evbit);
|
||||
|
||||
/* We can generate every key */
|
||||
for (i = 0; i < 0x100; i++)
|
||||
set_bit(i, keyb_dev->keybit);
|
||||
|
||||
/* Register keyboard device */
|
||||
if (input_register_device(keyb_dev)) {
|
||||
input_free_device(keyb_dev);
|
||||
printk(KERN_WARNING "cannot register keyboard!");
|
||||
return -1;
|
||||
}
|
||||
genode_input_register_keyb(idx, (void*) keyb_dev);
|
||||
|
||||
|
||||
/*************
|
||||
** Mouse **
|
||||
*************/
|
||||
|
||||
mouse_dev->name = "Genode input mouse";
|
||||
mouse_dev->phys = "Genode mouse";
|
||||
mouse_dev->id.bustype = BUS_USB;
|
||||
mouse_dev->id.vendor = 0;
|
||||
mouse_dev->id.product = 0;
|
||||
mouse_dev->id.version = 0;
|
||||
|
||||
/* We generate key and relative mouse events */
|
||||
set_bit(EV_KEY, mouse_dev->evbit);
|
||||
set_bit(EV_REP, mouse_dev->evbit);
|
||||
#ifndef CONFIG_ANDROID
|
||||
set_bit(EV_REL, mouse_dev->evbit);
|
||||
#endif
|
||||
set_bit(EV_ABS, mouse_dev->evbit);
|
||||
set_bit(EV_SYN, mouse_dev->evbit);
|
||||
|
||||
/* Buttons */
|
||||
#ifdef CONFIG_ANDROID
|
||||
set_bit(BTN_TOUCH, mouse_dev->keybit);
|
||||
#else
|
||||
set_bit(BTN_0, mouse_dev->keybit);
|
||||
set_bit(BTN_1, mouse_dev->keybit);
|
||||
set_bit(BTN_2, mouse_dev->keybit);
|
||||
set_bit(BTN_3, mouse_dev->keybit);
|
||||
set_bit(BTN_4, mouse_dev->keybit);
|
||||
set_bit(BTN_LEFT, mouse_dev->keybit);
|
||||
set_bit(BTN_RIGHT, mouse_dev->keybit);
|
||||
set_bit(BTN_MIDDLE, mouse_dev->keybit);
|
||||
#endif
|
||||
|
||||
/* Movements */
|
||||
#ifndef CONFIG_ANDROID
|
||||
set_bit(REL_X, mouse_dev->relbit);
|
||||
set_bit(REL_Y, mouse_dev->relbit);
|
||||
#endif
|
||||
set_bit(ABS_X, mouse_dev->absbit);
|
||||
set_bit(ABS_Y, mouse_dev->absbit);
|
||||
|
||||
input_set_abs_params(mouse_dev, ABS_PRESSURE, 0, 1, 0, 0);
|
||||
|
||||
/* Coordinates are 1:1 pixel in frame buffer */
|
||||
input_set_abs_params(mouse_dev, ABS_X, 0, xres, 0, 0);
|
||||
input_set_abs_params(mouse_dev, ABS_Y, 0, yres, 0, 0);
|
||||
|
||||
/* Register mouse device */
|
||||
if (input_register_device(mouse_dev)) {
|
||||
input_free_device(mouse_dev);
|
||||
printk(KERN_WARNING "cannot register mouse!");
|
||||
return -1;
|
||||
}
|
||||
genode_input_register_mouse(idx, (void*) mouse_dev);
|
||||
|
||||
init_timer(&input_timer);
|
||||
input_timer.function = genodefb_poll_for_events;
|
||||
input_timer.expires = jiffies + poll_sleep;
|
||||
add_timer(&input_timer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int __init genodefb_probe(struct platform_device *dev)
|
||||
{
|
||||
struct genodefb_infolist *pred=0, *succ;
|
||||
int i, ret, cnt = genode_screen_count();
|
||||
|
||||
/*
|
||||
* Iterate through all available framebuffers
|
||||
*/
|
||||
for (i=0; i < cnt; i++) {
|
||||
|
||||
/* Allocate new framebuffer list entry */
|
||||
if(!(succ = kmalloc(sizeof(struct genodefb_infolist), GFP_KERNEL)))
|
||||
return -ENOMEM;
|
||||
succ->next = 0;
|
||||
|
||||
/* Set first entry as driver's private data, else concatenate it */
|
||||
if (!i)
|
||||
platform_set_drvdata(dev, succ);
|
||||
else
|
||||
pred->next = succ;
|
||||
pred = succ;
|
||||
|
||||
/* Allocate new framebuffer info struct */
|
||||
pred->info = framebuffer_alloc(0, &dev->dev);
|
||||
if (!pred->info)
|
||||
return -ENOMEM;
|
||||
|
||||
/* Copy default values */
|
||||
pred->info->var = genodefb_var;
|
||||
pred->info->fix = genodefb_fix;
|
||||
|
||||
/* Get framebuffer dimensions from Genode's support lib */
|
||||
pred->info->screen_base = genode_fb_attach(i);
|
||||
pred->info->screen_size = genode_fb_size(i);
|
||||
pred->info->fix.smem_start = (unsigned long) pred->info->screen_base;
|
||||
pred->info->fix.smem_len = pred->info->screen_size;
|
||||
if (!pred->info->screen_base || !pred->info->screen_size) {
|
||||
printk(KERN_ERR "genode_fb: abort, could not be initialized.\n");
|
||||
framebuffer_release(pred->info);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
/* Get framebuffer resolution from Genode's support lib */
|
||||
genode_fb_info(i, &pred->info->var.xres, &pred->info->var.yres);
|
||||
|
||||
/* We only support 16-Bit Pixel, so line length is xres*2 */
|
||||
pred->info->fix.line_length = pred->info->var.xres * 2;
|
||||
|
||||
/* Set virtual resolution to visible resolution */
|
||||
pred->info->var.xres_virtual = pred->info->var.xres;
|
||||
pred->info->var.yres_virtual = pred->info->screen_size
|
||||
/ pred->info->fix.line_length;
|
||||
|
||||
/* Some dummy values for timing to make fbset happy */
|
||||
pred->info->var.pixclock = 10000000 / pred->info->var.xres
|
||||
* 1000 / pred->info->var.yres;
|
||||
pred->info->var.left_margin = (pred->info->var.xres / 8) & 0xf8;
|
||||
pred->info->var.hsync_len = (pred->info->var.xres / 8) & 0xf8;
|
||||
|
||||
pred->info->fbops = &genodefb_ops;
|
||||
pred->info->pseudo_palette = pseudo_palette;
|
||||
pred->info->flags = FBINFO_FLAG_DEFAULT;
|
||||
|
||||
printk(KERN_INFO "genode_fb:framebuffer at 0x%p, size %dk\n",
|
||||
pred->info->screen_base, (int)(pred->info->screen_size >> 10));
|
||||
printk(KERN_INFO "genode_fb: mode is %dx%dx%d\n",
|
||||
pred->info->var.xres, pred->info->var.yres,
|
||||
pred->info->var.bits_per_pixel);
|
||||
|
||||
/* Allocate 16-Bit colormap */
|
||||
ret = fb_alloc_cmap(&pred->info->cmap, 16, 0);
|
||||
if (ret < 0) {
|
||||
framebuffer_release(pred->info);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Register framebuffer info structure */
|
||||
if (register_framebuffer(pred->info) < 0) {
|
||||
fb_dealloc_cmap(&pred->info->cmap);
|
||||
framebuffer_release(pred->info);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret = genodefb_register_input_devices(i, pred->info->var.xres,
|
||||
pred->info->var.yres);
|
||||
if (ret) {
|
||||
fb_dealloc_cmap(&pred->info->cmap);
|
||||
framebuffer_release(pred->info);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int genodefb_remove(struct platform_device *device)
|
||||
{
|
||||
struct genodefb_infolist *succ = platform_get_drvdata(device);
|
||||
|
||||
while (succ && succ->info) {
|
||||
struct genodefb_infolist *pred = succ;
|
||||
succ = succ->next;
|
||||
genode_fb_close(pred->info->node);
|
||||
unregister_framebuffer(pred->info);
|
||||
framebuffer_release(pred->info);
|
||||
kfree(pred);
|
||||
}
|
||||
platform_set_drvdata(device, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/***************************************
|
||||
** Module initialization / removal **
|
||||
***************************************/
|
||||
|
||||
static struct platform_driver __refdata genodefb_driver = {
|
||||
.probe = genodefb_probe,
|
||||
.remove = genodefb_remove,
|
||||
.driver.name = GENODEFB_DRV_NAME,
|
||||
};
|
||||
|
||||
static struct platform_device genodefb_device = {
|
||||
.name = GENODEFB_DRV_NAME,
|
||||
};
|
||||
|
||||
|
||||
static int __init genodefb_init(void)
|
||||
{
|
||||
int ret = platform_driver_register(&genodefb_driver);
|
||||
if (!ret) {
|
||||
ret = platform_device_register(&genodefb_device);
|
||||
if (ret)
|
||||
platform_driver_unregister(&genodefb_driver);
|
||||
}
|
||||
genode_input_register_callback(&input_event_callback);
|
||||
return ret;
|
||||
}
|
||||
module_init(genodefb_init);
|
||||
|
||||
|
||||
static void __exit genodefb_exit(void)
|
||||
{
|
||||
platform_device_unregister(&genodefb_device);
|
||||
platform_driver_unregister(&genodefb_driver);
|
||||
genode_input_unregister_callback();
|
||||
}
|
||||
module_exit(genodefb_exit);
|
||||
|
||||
|
||||
MODULE_AUTHOR("Stefan Kalkowski <stefan.kalkowski@genode-labs.com>");
|
||||
MODULE_DESCRIPTION("Frame buffer driver for Linux on Genode");
|
||||
MODULE_LICENSE("GPL v2");
|
@ -1,194 +0,0 @@
|
||||
/*
|
||||
* \brief NIC driver to access Genode's nic service
|
||||
* \author Stefan Kalkowski <stefan.kalkowski@genode-labs.com>
|
||||
* \date 2010-09-09
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2006-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Linux includes */
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/inet.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/jiffies.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
#include <genode/net.h>
|
||||
|
||||
static struct net_device *net_dev;
|
||||
|
||||
|
||||
static void FASTCALL
|
||||
genode_net_receive_packet(void* dev_addr, void *addr,
|
||||
unsigned long size)
|
||||
{
|
||||
struct net_device *dev = (struct net_device *) dev_addr;
|
||||
struct net_device_stats *stats = (struct net_device_stats*) netdev_priv(dev);
|
||||
|
||||
/* allocate skb */
|
||||
struct sk_buff *skb = dev_alloc_skb(size + 4);
|
||||
if (!skb) {
|
||||
if (printk_ratelimit())
|
||||
printk(KERN_NOTICE "genode_net_rx: low on mem - packet dropped!\n");
|
||||
stats->rx_dropped++;
|
||||
return;
|
||||
}
|
||||
|
||||
/* copy packet */
|
||||
genode_net_memcpy(skb_put(skb, size), addr, size);
|
||||
|
||||
skb->dev = dev;
|
||||
skb->protocol = eth_type_trans(skb, dev);
|
||||
skb->ip_summed = CHECKSUM_NONE;
|
||||
|
||||
netif_rx(skb);
|
||||
|
||||
stats->rx_packets++;
|
||||
stats->rx_bytes += size;
|
||||
}
|
||||
|
||||
|
||||
/********************************
|
||||
** Network driver functions **
|
||||
********************************/
|
||||
|
||||
int genode_net_open(struct net_device *dev)
|
||||
{
|
||||
genode_net_start(dev, genode_net_receive_packet);
|
||||
netif_start_queue(dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int genode_net_close(struct net_device *dev)
|
||||
{
|
||||
netif_stop_queue(dev);
|
||||
genode_net_stop();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int genode_net_xmit_frame(struct sk_buff *skb, struct net_device *dev)
|
||||
{
|
||||
struct net_device_stats *stats = (struct net_device_stats*) netdev_priv(dev);
|
||||
int len = skb->len;
|
||||
void* addr = skb->data;
|
||||
|
||||
/* collect acknowledgements of old packets */
|
||||
while (genode_net_tx_ack_avail())
|
||||
genode_net_tx_ack();
|
||||
|
||||
/* transmit to nic-session */
|
||||
while (genode_net_tx(addr, len)) {
|
||||
/* tx queue is full, could not enqueue packet */
|
||||
genode_net_tx_ack();
|
||||
}
|
||||
dev_kfree_skb(skb);
|
||||
|
||||
/* save timestamp */
|
||||
dev->trans_start = jiffies;
|
||||
|
||||
stats->tx_packets++;
|
||||
stats->tx_bytes += len;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
struct net_device_stats* genode_net_get_stats(struct net_device *dev)
|
||||
{
|
||||
return (struct net_device_stats*) netdev_priv(dev);
|
||||
}
|
||||
|
||||
|
||||
void genode_net_tx_timeout(struct net_device *dev)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
static irqreturn_t event_interrupt(int irq, void *data)
|
||||
{
|
||||
genode_net_rx_receive();
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
|
||||
/**************************
|
||||
** De-/Initialization **
|
||||
**************************/
|
||||
|
||||
static const struct net_device_ops genode_net_dev_ops =
|
||||
{
|
||||
.ndo_open = genode_net_open,
|
||||
.ndo_stop = genode_net_close,
|
||||
.ndo_start_xmit = genode_net_xmit_frame,
|
||||
.ndo_get_stats = genode_net_get_stats,
|
||||
.ndo_tx_timeout = genode_net_tx_timeout
|
||||
};
|
||||
|
||||
/* Setup and register the device. */
|
||||
static int __init genode_net_init(void)
|
||||
{
|
||||
int err = 0;
|
||||
unsigned irq;
|
||||
l4_cap_idx_t irq_cap;
|
||||
|
||||
if (!genode_net_ready())
|
||||
return 0;
|
||||
|
||||
/* allocate network device */
|
||||
if (!(net_dev = alloc_etherdev(sizeof(struct net_device_stats))))
|
||||
goto out;
|
||||
|
||||
net_dev->netdev_ops = &genode_net_dev_ops;
|
||||
net_dev->watchdog_timeo = 20 * HZ;
|
||||
|
||||
/* set MAC address */
|
||||
genode_net_mac(net_dev->dev_addr, ETH_ALEN);
|
||||
|
||||
/**
|
||||
* Obtain an IRQ for the device.
|
||||
*/
|
||||
irq_cap = genode_net_irq_cap();
|
||||
if ((irq = l4x_register_irq(irq_cap)) < 0)
|
||||
return -ENOMEM;
|
||||
if ((err = request_irq(irq, event_interrupt, 0, "Genode net", net_dev))) {
|
||||
printk(KERN_WARNING "%s: request_irq failed: %d\n", __func__, err);
|
||||
return err;
|
||||
}
|
||||
|
||||
/* register network device */
|
||||
if ((err = register_netdev(net_dev))) {
|
||||
panic("loopback: Failed to register netdevice: %d\n", err);
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
out_free:
|
||||
free_netdev(net_dev);
|
||||
out:
|
||||
return err;
|
||||
};
|
||||
|
||||
|
||||
static void __exit genode_net_exit(void)
|
||||
{
|
||||
unregister_netdev(net_dev);
|
||||
free_netdev(net_dev);
|
||||
}
|
||||
|
||||
|
||||
module_init(genode_net_init);
|
||||
module_exit(genode_net_exit);
|
@ -1,147 +0,0 @@
|
||||
/*
|
||||
* \brief Genode RTC driver
|
||||
* \author Stefan Kalkowski <kalkowski@genode-labs.com>
|
||||
* \date 2011-10-25
|
||||
*
|
||||
* Dummy driver taken from drivers/rtc/rtc-test.c.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Linux includes */
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/rtc.h>
|
||||
|
||||
#include <l4/sys/kdebug.h>
|
||||
|
||||
struct genode_rtc {
|
||||
struct rtc_device *rtc;
|
||||
};
|
||||
|
||||
|
||||
static int genode_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int genode_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int genode_rtc_read_time(struct device *dev, struct rtc_time *tm)
|
||||
{
|
||||
rtc_time_to_tm(get_seconds(), tm);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int genode_rtc_set_mmss(struct device *dev, unsigned long secs)
|
||||
{
|
||||
dev_info(dev, "%s, secs = %lu\n", __func__, secs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int genode_rtc_proc(struct device *dev, struct seq_file *seq)
|
||||
{
|
||||
struct platform_device *plat_dev = to_platform_device(dev);
|
||||
|
||||
seq_printf(seq, "genode_rtc\t\t: yes\n");
|
||||
seq_printf(seq, "id\t\t: %d\n", plat_dev->id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int genode_rtc_alarm_irq_enable(struct device *dev, unsigned int enable)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static const struct rtc_class_ops genode_rtc_ops = {
|
||||
.proc = genode_rtc_proc,
|
||||
.read_time = genode_rtc_read_time,
|
||||
.read_alarm = genode_rtc_read_alarm,
|
||||
.set_alarm = genode_rtc_set_alarm,
|
||||
.set_mmss = genode_rtc_set_mmss,
|
||||
.alarm_irq_enable = genode_rtc_alarm_irq_enable,
|
||||
};
|
||||
|
||||
|
||||
static int genode_rtc_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct genode_rtc *priv = platform_get_drvdata(pdev);
|
||||
rtc_device_unregister(priv->rtc);
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
kfree(priv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int genode_rtc_probe(struct platform_device *pdev)
|
||||
{
|
||||
int err;
|
||||
struct genode_rtc *priv = kzalloc(sizeof(*priv), GFP_KERNEL);
|
||||
if (!priv)
|
||||
return -ENOMEM;
|
||||
platform_set_drvdata(pdev, priv);
|
||||
|
||||
priv->rtc = rtc_device_register(pdev->name,
|
||||
&pdev->dev, &genode_rtc_ops, THIS_MODULE);
|
||||
if (IS_ERR(priv->rtc)) {
|
||||
err = PTR_ERR(priv->rtc);
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static struct platform_driver __refdata genode_rtc_driver = {
|
||||
.remove = genode_rtc_remove,
|
||||
.probe = genode_rtc_probe,
|
||||
.driver = {
|
||||
.name = "rtc-genode",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device genode_rtc_device = {
|
||||
.name = "rtc-genode",
|
||||
};
|
||||
|
||||
|
||||
static int __init genode_rtc_init(void)
|
||||
{
|
||||
int ret = platform_driver_register(&genode_rtc_driver);
|
||||
if (!ret) {
|
||||
ret = platform_device_register(&genode_rtc_device);
|
||||
if (ret)
|
||||
platform_driver_unregister(&genode_rtc_driver);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
module_init(genode_rtc_init);
|
||||
|
||||
|
||||
static void __exit genode_rtc_exit(void)
|
||||
{
|
||||
platform_device_register(&genode_rtc_device);
|
||||
platform_driver_unregister(&genode_rtc_driver);
|
||||
}
|
||||
module_exit(genode_rtc_exit);
|
||||
|
||||
|
||||
MODULE_AUTHOR("Stefan Kalkowski <stefan.kalkowski@genode-labs.com>");
|
||||
MODULE_DESCRIPTION("RTC driver for Genode");
|
||||
MODULE_LICENSE("GPL");
|
@ -1,344 +0,0 @@
|
||||
/*
|
||||
* \brief Serial and console driver to access Genode's terminal service
|
||||
* \author Stefan Kalkowski <stefan.kalkowski@genode-labs.com>
|
||||
* \date 2011-09-16
|
||||
*
|
||||
* Based on l4ser.c from TU-Dresden's L4Linux.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_MAGIC_SYSRQ)
|
||||
#define SUPPORT_SYSRQ
|
||||
#endif
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/console.h>
|
||||
#include <linux/sysrq.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/tty.h>
|
||||
#include <linux/tty_flip.h>
|
||||
#include <linux/serial_core.h>
|
||||
#include <linux/serial.h>
|
||||
|
||||
#include <genode/terminal.h>
|
||||
|
||||
enum { MAX_PORTS = 10 };
|
||||
|
||||
static struct genode_uart_port {
|
||||
struct uart_port port;
|
||||
l4_cap_idx_t irq_cap;
|
||||
int initialized;
|
||||
unsigned idx;
|
||||
} genode_serial_port[MAX_PORTS];
|
||||
|
||||
|
||||
static void genode_serial_stop_tx(struct uart_port *port) { }
|
||||
|
||||
|
||||
static void genode_serial_stop_rx(struct uart_port *port) { }
|
||||
|
||||
|
||||
static void genode_serial_enable_ms(struct uart_port *port) { }
|
||||
|
||||
|
||||
static void genode_serial_rx_chars(struct uart_port *port) {
|
||||
struct genode_uart_port *l4port = (struct genode_uart_port *)port;
|
||||
struct tty_port *tty_port = &port->state->port;
|
||||
unsigned long flags;
|
||||
unsigned int flg;
|
||||
char buf[64];
|
||||
unsigned cnt, i;
|
||||
|
||||
while (1) {
|
||||
local_irq_save(flags);
|
||||
cnt = genode_terminal_readchar(l4port->idx, buf, sizeof(buf));
|
||||
local_irq_restore(flags);
|
||||
|
||||
if (!cnt)
|
||||
break;
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
port->icount.rx++;
|
||||
flg = TTY_NORMAL;
|
||||
if (uart_handle_sysrq_char(port, buf[i]))
|
||||
continue;
|
||||
|
||||
tty_insert_flip_char(tty_port, buf[i], flg);
|
||||
}
|
||||
|
||||
if (cnt < sizeof(buf))
|
||||
break;
|
||||
}
|
||||
tty_flip_buffer_push(tty_port);
|
||||
return;
|
||||
}
|
||||
|
||||
static void genode_serial_tx_chars(struct uart_port *port) {
|
||||
struct genode_uart_port *l4port = (struct genode_uart_port *)port;
|
||||
struct circ_buf *xmit = &port->state->xmit;
|
||||
unsigned long flags;
|
||||
unsigned c;
|
||||
|
||||
if (port->x_char) {
|
||||
local_irq_save(flags);
|
||||
genode_terminal_writechar(l4port->idx, &port->x_char, sizeof(char));
|
||||
local_irq_restore(flags);
|
||||
port->icount.tx++;
|
||||
port->x_char = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
while (!uart_circ_empty(xmit)) {
|
||||
c = CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE);
|
||||
local_irq_save(flags);
|
||||
genode_terminal_writechar(l4port->idx, &xmit->buf[xmit->tail], c);
|
||||
local_irq_restore(flags);
|
||||
xmit->tail = (xmit->tail + c) & (UART_XMIT_SIZE - 1);
|
||||
port->icount.tx += c;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void genode_serial_start_tx(struct uart_port *port) {
|
||||
genode_serial_tx_chars(port); }
|
||||
|
||||
|
||||
static irqreturn_t genode_serial_int(int irq, void *dev_id) {
|
||||
struct uart_port *sport = dev_id;
|
||||
genode_serial_rx_chars(sport);
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
|
||||
static unsigned int genode_serial_tx_empty(struct uart_port *port) {
|
||||
return TIOCSER_TEMT; }
|
||||
|
||||
|
||||
static unsigned int genode_serial_get_mctrl(struct uart_port *port) {
|
||||
return 0; }
|
||||
|
||||
|
||||
static void genode_serial_set_mctrl(struct uart_port *port, unsigned int mctrl) { }
|
||||
|
||||
|
||||
static void genode_serial_break_ctl(struct uart_port *port, int break_state) { }
|
||||
|
||||
|
||||
static int genode_serial_startup(struct uart_port *port) {
|
||||
if (port->irq) {
|
||||
int retval = request_irq(port->irq, genode_serial_int, 0, "Genode uart", port);
|
||||
if (retval)
|
||||
return retval;
|
||||
genode_serial_rx_chars(port);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void genode_serial_shutdown(struct uart_port *port) {
|
||||
if (port->irq)
|
||||
free_irq(port->irq, port);
|
||||
}
|
||||
|
||||
|
||||
static void genode_serial_set_termios(struct uart_port *port, struct ktermios *termios,
|
||||
struct ktermios *old) { }
|
||||
|
||||
|
||||
static const char *genode_serial_type(struct uart_port *port) {
|
||||
return port->type == PORT_SA1100 ? "L4" : NULL; }
|
||||
|
||||
|
||||
static int genode_serial_request_port(struct uart_port *port) {
|
||||
return 0; }
|
||||
|
||||
|
||||
static void genode_serial_release_port(struct uart_port *port) { }
|
||||
|
||||
|
||||
static void genode_serial_config_port(struct uart_port *port, int flags) {
|
||||
if (flags & UART_CONFIG_TYPE)
|
||||
port->type = PORT_SA1100;
|
||||
}
|
||||
|
||||
|
||||
static int genode_serial_verify_port(struct uart_port *port, struct serial_struct *ser) {
|
||||
return 0; }
|
||||
|
||||
|
||||
static struct uart_ops genode_serial_pops = {
|
||||
.tx_empty = genode_serial_tx_empty,
|
||||
.set_mctrl = genode_serial_set_mctrl,
|
||||
.get_mctrl = genode_serial_get_mctrl,
|
||||
.stop_tx = genode_serial_stop_tx,
|
||||
.start_tx = genode_serial_start_tx,
|
||||
.stop_rx = genode_serial_stop_rx,
|
||||
.enable_ms = genode_serial_enable_ms,
|
||||
.break_ctl = genode_serial_break_ctl,
|
||||
.startup = genode_serial_startup,
|
||||
.shutdown = genode_serial_shutdown,
|
||||
.set_termios = genode_serial_set_termios,
|
||||
.type = genode_serial_type,
|
||||
.release_port = genode_serial_release_port,
|
||||
.request_port = genode_serial_request_port,
|
||||
.config_port = genode_serial_config_port,
|
||||
.verify_port = genode_serial_verify_port,
|
||||
};
|
||||
|
||||
|
||||
static int __init genode_serial_init_port(int num) {
|
||||
int irq;
|
||||
unsigned long flags;
|
||||
|
||||
if (genode_serial_port[num].initialized)
|
||||
return 0;
|
||||
genode_serial_port[num].initialized = 1;
|
||||
|
||||
local_irq_save(flags);
|
||||
genode_serial_port[num].irq_cap = genode_terminal_irq(num);
|
||||
local_irq_restore(flags);
|
||||
|
||||
if((irq = l4x_register_irq(genode_serial_port[num].irq_cap)) < 0) {
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
genode_serial_port[num].port.uartclk = 3686400;
|
||||
genode_serial_port[num].port.ops = &genode_serial_pops;
|
||||
genode_serial_port[num].port.fifosize = 8;
|
||||
genode_serial_port[num].port.line = num;
|
||||
genode_serial_port[num].port.iotype = UPIO_MEM;
|
||||
genode_serial_port[num].port.membase = (void *)1;
|
||||
genode_serial_port[num].port.mapbase = 1;
|
||||
genode_serial_port[num].port.flags = UPF_BOOT_AUTOCONF;
|
||||
genode_serial_port[num].port.irq = irq;
|
||||
genode_serial_port[num].idx = num;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int __init
|
||||
genode_console_setup(struct console *co, char *options) {
|
||||
struct uart_port *up;
|
||||
|
||||
if (co->index >= 1 + MAX_PORTS)
|
||||
co->index = 0;
|
||||
up = &genode_serial_port[co->index].port;
|
||||
if (!up)
|
||||
return -ENODEV;
|
||||
|
||||
return uart_set_options(up, co, 115200, 'n', 8, 'n');
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Interrupts are disabled on entering
|
||||
*/
|
||||
static void
|
||||
genode_console_write(struct console *co, const char *s, unsigned int count) {
|
||||
unsigned long flags;
|
||||
local_irq_save(flags);
|
||||
genode_terminal_writechar(genode_serial_port[co->index].idx, s, count);
|
||||
local_irq_restore(flags);
|
||||
}
|
||||
|
||||
|
||||
static struct uart_driver genode_reg;
|
||||
static struct console genode_console = {
|
||||
.name = "ttyS",
|
||||
.write = genode_console_write,
|
||||
.device = uart_console_device,
|
||||
.setup = genode_console_setup,
|
||||
.flags = CON_PRINTBUFFER,
|
||||
.index = -1,
|
||||
.data = &genode_reg,
|
||||
};
|
||||
|
||||
|
||||
static int __init genode_rs_console_init(void)
|
||||
{
|
||||
unsigned long flags;
|
||||
local_irq_save(flags);
|
||||
if (!genode_terminal_count()) {
|
||||
local_irq_restore(flags);
|
||||
return -ENODEV;
|
||||
}
|
||||
local_irq_restore(flags);
|
||||
|
||||
if (genode_serial_init_port(0))
|
||||
return -ENODEV;
|
||||
|
||||
register_console(&genode_console);
|
||||
return 0;
|
||||
}
|
||||
console_initcall(genode_rs_console_init);
|
||||
|
||||
|
||||
static struct uart_driver genode_reg = {
|
||||
.owner = THIS_MODULE,
|
||||
.driver_name = "ttyS",
|
||||
.dev_name = "ttyS",
|
||||
.major = 204,
|
||||
.minor = 5,
|
||||
.nr = 0,
|
||||
.cons = &genode_console,
|
||||
.state = 0,
|
||||
.tty_driver = 0,
|
||||
};
|
||||
|
||||
|
||||
static int __init genode_serial_init(void)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned long flags;
|
||||
local_irq_save(flags);
|
||||
genode_reg.nr = (genode_terminal_count() > MAX_PORTS)
|
||||
? MAX_PORTS : genode_terminal_count();
|
||||
local_irq_restore(flags);
|
||||
|
||||
if (genode_reg.nr == 0)
|
||||
return 0;
|
||||
|
||||
if (uart_register_driver(&genode_reg))
|
||||
return -ENODEV;
|
||||
|
||||
for (i = 0; i < genode_reg.nr; i++) {
|
||||
if (genode_serial_init_port(i))
|
||||
return -ENODEV;
|
||||
uart_add_one_port(&genode_reg, &genode_serial_port[i].port);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void __exit genode_serial_exit(void)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned long flags;
|
||||
|
||||
for (i = 0; i < genode_reg.nr; i++) {
|
||||
uart_remove_one_port(&genode_reg, &genode_serial_port[i].port);
|
||||
local_irq_save(flags);
|
||||
genode_terminal_stop(i);
|
||||
local_irq_restore(flags);
|
||||
}
|
||||
if (genode_reg.nr)
|
||||
uart_unregister_driver(&genode_reg);
|
||||
|
||||
}
|
||||
|
||||
|
||||
module_init(genode_serial_init);
|
||||
module_exit(genode_serial_exit);
|
||||
|
||||
MODULE_AUTHOR("Stefan Kalkowski <stefan.kalkowski@genode-labs.com");
|
||||
MODULE_DESCRIPTION("Genode serial driver");
|
||||
MODULE_LICENSE("GPL");
|
@ -1,7 +0,0 @@
|
||||
REQUIRES = foc arm
|
||||
INC_DIR += $(REP_DIR)/include/32-bit
|
||||
SRC_L4LX_CONFIG = $(REP_DIR)/config/android_config.arm
|
||||
LX_TARGET = l4android
|
||||
L4LX_L4ARCH = arm
|
||||
|
||||
-include $(REP_DIR)/mk/l4lx.mk
|
@ -1,6 +0,0 @@
|
||||
REQUIRES = x86 32bit
|
||||
INC_DIR += $(REP_DIR)/include/32-bit
|
||||
LX_TARGET = l4android
|
||||
SRC_L4LX_CONFIG = $(REP_DIR)/config/android_config.x86_32
|
||||
|
||||
-include $(REP_DIR)/mk/l4lx.mk
|
@ -1,7 +0,0 @@
|
||||
REQUIRES = foc arm
|
||||
INC_DIR += $(REP_DIR)/include/32-bit
|
||||
SRC_L4LX_CONFIG = $(REP_DIR)/config/linux_config.arm
|
||||
LX_TARGET = l4linux
|
||||
L4LX_L4ARCH = arm
|
||||
|
||||
-include $(REP_DIR)/mk/l4lx.mk
|
@ -1,6 +0,0 @@
|
||||
REQUIRES = x86 32bit
|
||||
INC_DIR += $(REP_DIR)/include/32-bit
|
||||
LX_TARGET = l4linux
|
||||
SRC_L4LX_CONFIG = $(REP_DIR)/config/linux_config.x86_32
|
||||
|
||||
include $(REP_DIR)/mk/l4lx.mk
|
@ -1,31 +0,0 @@
|
||||
/*
|
||||
* \brief Dataspace abstraction between Genode and L4Linux
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-03-20
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/env.h>
|
||||
|
||||
/* L4lx includes */
|
||||
#include <dataspace.h>
|
||||
|
||||
|
||||
L4lx::Dataspace* L4lx::Dataspace_tree::insert(const char* name,
|
||||
Genode::Dataspace_capability cap)
|
||||
{
|
||||
using namespace L4lx;
|
||||
|
||||
Genode::Dataspace_client dsc(cap);
|
||||
Dataspace *ds =
|
||||
new (Genode::env()->heap()) Single_dataspace(name, dsc.size(), cap);
|
||||
insert(ds);
|
||||
return ds;
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
/*
|
||||
* \brief Global environment for L4Linux support library
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-03-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/env.h>
|
||||
#include <base/printf.h>
|
||||
#include <dataspace/client.h>
|
||||
|
||||
/* L4lx library includes */
|
||||
#include <env.h>
|
||||
|
||||
namespace Fiasco {
|
||||
#include <l4/sys/consts.h>
|
||||
}
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
L4lx::Env* L4lx::Env::env()
|
||||
{
|
||||
try {
|
||||
static L4lx::Env _env;
|
||||
return &_env;
|
||||
} catch(Ram_session::Quota_exceeded) {
|
||||
PWRN("heap size exceeds available ram!");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
L4lx::Env::Env() : _rm(Genode::env()->heap()) {
|
||||
|
||||
/* Create an empty L4Linux specific region-map */
|
||||
_rm.add_range(0, ~0UL);
|
||||
|
||||
/*
|
||||
* The first page never gets used under Genode/Fiasco.OC
|
||||
* to notice null-pointer dereference, so reserve it.
|
||||
*/
|
||||
_rm.alloc_addr(L4_PAGESIZE, 0);
|
||||
}
|
@ -1,362 +0,0 @@
|
||||
/*
|
||||
* \brief Genode C API block API needed by L4Linux
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2009-05-19
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#include <base/env.h>
|
||||
#include <base/log.h>
|
||||
#include <base/allocator_avl.h>
|
||||
#include <block_session/connection.h>
|
||||
#include <os/config.h>
|
||||
#include <foc/capability_space.h>
|
||||
|
||||
#include <vcpu.h>
|
||||
#include <linux.h>
|
||||
|
||||
namespace Fiasco {
|
||||
#include <genode/block.h>
|
||||
#include <l4/sys/irq.h>
|
||||
#include <l4/sys/kdebug.h>
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
class Req_cache
|
||||
{
|
||||
private:
|
||||
|
||||
class Req_entry
|
||||
{
|
||||
public:
|
||||
|
||||
void *pkt;
|
||||
void *req;
|
||||
|
||||
Req_entry() : pkt(0), req(0) {}
|
||||
Req_entry(void *packet, void *request)
|
||||
: pkt(packet), req(request) {}
|
||||
};
|
||||
|
||||
|
||||
enum { MAX = Block::Session::TX_QUEUE_SIZE };
|
||||
|
||||
Req_entry _cache[MAX];
|
||||
|
||||
int _find(void *packet)
|
||||
{
|
||||
for (int i=0; i < MAX; i++)
|
||||
if (_cache[i].pkt == packet)
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
void insert(void *packet, void *request)
|
||||
{
|
||||
int idx = _find(0);
|
||||
if (idx == 0) {
|
||||
Genode::error("Req cache full!");
|
||||
enter_kdebug("Req_cache");
|
||||
}
|
||||
|
||||
_cache[idx] = Req_entry(packet, request);
|
||||
}
|
||||
|
||||
void remove(void *packet, void **request)
|
||||
{
|
||||
int idx = _find(packet);
|
||||
if (idx == 0) {
|
||||
Genode::error("Req cache entry not found!");
|
||||
enter_kdebug("Req_cache");
|
||||
}
|
||||
|
||||
*request = _cache[idx].req;
|
||||
_cache[idx].pkt = 0;
|
||||
_cache[idx].req = 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class Block_device
|
||||
{
|
||||
private:
|
||||
|
||||
enum Dimensions {
|
||||
TX_BUF_SIZE = 5 * 1024 * 1024
|
||||
};
|
||||
|
||||
Req_cache _cache;
|
||||
Genode::Allocator_avl _alloc;
|
||||
Block::Connection _session;
|
||||
Genode::size_t _blk_size;
|
||||
Block::sector_t _blk_cnt;
|
||||
Block::Session::Operations _blk_ops;
|
||||
Genode::Native_capability _irq_cap;
|
||||
Genode::Signal_context _tx;
|
||||
char _name[32];
|
||||
|
||||
Genode::Native_capability _alloc_irq()
|
||||
{
|
||||
Genode::Foc_native_cpu_client
|
||||
native_cpu(L4lx::cpu_connection()->native_cpu());
|
||||
|
||||
return native_cpu.alloc_irq();
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
Block_device(const char *label)
|
||||
: _alloc(Genode::env()->heap()),
|
||||
_session(&_alloc, TX_BUF_SIZE, label),
|
||||
_irq_cap(_alloc_irq())
|
||||
{
|
||||
_session.info(&_blk_cnt, &_blk_size, &_blk_ops);
|
||||
Genode::strncpy(_name, label, sizeof(_name));
|
||||
}
|
||||
|
||||
Fiasco::l4_cap_idx_t irq_cap()
|
||||
{
|
||||
return Genode::Capability_space::kcap(_irq_cap);
|
||||
}
|
||||
|
||||
Req_cache *cache() { return &_cache; }
|
||||
Block::Connection *session() { return &_session; }
|
||||
Genode::Signal_context *context() { return &_tx; }
|
||||
Genode::size_t block_size() { return _blk_size; }
|
||||
Genode::size_t block_count() { return _blk_cnt; }
|
||||
bool writeable() {
|
||||
return _blk_ops.supported(Block::Packet_descriptor::WRITE); }
|
||||
const char *name() { return _name; }
|
||||
};
|
||||
|
||||
|
||||
class Signal_thread : public Genode::Thread_deprecated<8192>
|
||||
{
|
||||
private:
|
||||
|
||||
unsigned _count;
|
||||
Block_device **_devs;
|
||||
Genode::Lock _ready_lock;
|
||||
|
||||
protected:
|
||||
|
||||
void entry()
|
||||
{
|
||||
using namespace Fiasco;
|
||||
using namespace Genode;
|
||||
|
||||
Signal_receiver receiver;
|
||||
for (unsigned i = 0; i < _count; i++) {
|
||||
Signal_context_capability cap(receiver.manage(_devs[i]->context()));
|
||||
_devs[i]->session()->tx_channel()->sigh_ready_to_submit(cap);
|
||||
_devs[i]->session()->tx_channel()->sigh_ack_avail(cap);
|
||||
}
|
||||
|
||||
_ready_lock.unlock();
|
||||
|
||||
while (true) {
|
||||
Signal s = receiver.wait_for_signal();
|
||||
for (unsigned i = 0; i < _count; i++) {
|
||||
if (_devs[i]->context() == s.context()) {
|
||||
if (l4_error(l4_irq_trigger(_devs[i]->irq_cap())) != -1)
|
||||
Genode::warning("IRQ block trigger failed");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
Signal_thread(Block_device **devs)
|
||||
: Genode::Thread_deprecated<8192>("blk-signal-thread"),
|
||||
_count(Fiasco::genode_block_count()), _devs(devs),
|
||||
_ready_lock(Genode::Lock::LOCKED) {}
|
||||
|
||||
void start()
|
||||
{
|
||||
Genode::Thread::start();
|
||||
|
||||
/*
|
||||
* Do not return until the new thread has initialized the
|
||||
* signal handlers.
|
||||
*/
|
||||
_ready_lock.lock();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
static FASTCALL void (*end_request)(void*, short, void*, unsigned long) = 0;
|
||||
static Block_device **devices = 0;
|
||||
|
||||
using namespace Fiasco;
|
||||
|
||||
extern "C" {
|
||||
|
||||
unsigned genode_block_count()
|
||||
{
|
||||
using namespace Genode;
|
||||
|
||||
Linux::Irq_guard guard;
|
||||
|
||||
static unsigned count = 0;
|
||||
if (count == 0) {
|
||||
try {
|
||||
Xml_node config = Genode::config()->xml_node();
|
||||
size_t sn_cnt = config.num_sub_nodes();
|
||||
for (unsigned i = 0; i < sn_cnt; i++)
|
||||
if (config.sub_node(i).has_type("block"))
|
||||
count++;
|
||||
|
||||
if (count == 0)
|
||||
return count;
|
||||
|
||||
devices = (Block_device**)
|
||||
env()->heap()->alloc(count * sizeof(Block_device*));
|
||||
|
||||
char label[64];
|
||||
for (unsigned i = 0, j = 0; i < sn_cnt; i++) {
|
||||
if (config.sub_node(i).has_type("block")) {
|
||||
config.sub_node(i).attribute("label").value(label,
|
||||
sizeof(label));
|
||||
devices[j] = new (env()->heap()) Block_device(label);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
} catch(...) { Genode::warning("config parsing error!"); }
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
const char* genode_block_name(unsigned idx)
|
||||
{
|
||||
if (idx >= genode_block_count()) {
|
||||
Genode::warning(__func__, ": invalid index!");
|
||||
return 0;
|
||||
}
|
||||
return devices[idx]->name();
|
||||
}
|
||||
|
||||
|
||||
l4_cap_idx_t genode_block_irq_cap(unsigned idx)
|
||||
{
|
||||
if (idx >= genode_block_count()) {
|
||||
Genode::warning(__func__, ": invalid index!");
|
||||
return 0;
|
||||
}
|
||||
return devices[idx]->irq_cap();
|
||||
}
|
||||
|
||||
|
||||
void genode_block_register_callback(FASTCALL void (*func)(void*, short,
|
||||
void*, unsigned long))
|
||||
{
|
||||
Linux::Irq_guard guard;
|
||||
|
||||
static Signal_thread thread(devices);
|
||||
if (!end_request) {
|
||||
end_request = func;
|
||||
thread.start();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
genode_block_geometry(unsigned idx, unsigned long *cnt, unsigned long *sz,
|
||||
int *write, unsigned long *queue_sz)
|
||||
{
|
||||
if (idx >= genode_block_count()) {
|
||||
Genode::warning(__func__, ": invalid index!");
|
||||
return;
|
||||
}
|
||||
|
||||
Linux::Irq_guard guard;
|
||||
|
||||
*cnt = devices[idx]->block_count();
|
||||
*sz = devices[idx]->block_size();
|
||||
*queue_sz = devices[idx]->session()->tx()->bulk_buffer_size();
|
||||
*write = devices[idx]->writeable() ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
void* genode_block_request(unsigned idx, unsigned long sz,
|
||||
void *req, unsigned long *offset)
|
||||
{
|
||||
if (idx >= genode_block_count()) {
|
||||
Genode::warning(__func__, ": invalid index!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
Linux::Irq_guard guard;
|
||||
|
||||
try {
|
||||
Block::Connection *session = devices[idx]->session();
|
||||
Block::Packet_descriptor p = session->tx()->alloc_packet(sz);
|
||||
void *addr = session->tx()->packet_content(p);
|
||||
devices[idx]->cache()->insert(addr, req);
|
||||
*offset = p.offset();
|
||||
return addr;
|
||||
} catch (Block::Session::Tx::Source::Packet_alloc_failed) { }
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void genode_block_submit(unsigned idx, unsigned long queue_offset,
|
||||
unsigned long size, unsigned long long disc_offset, int write)
|
||||
{
|
||||
if (idx >= genode_block_count()) {
|
||||
Genode::warning(__func__, ": invalid index!");
|
||||
return;
|
||||
}
|
||||
|
||||
Linux::Irq_guard guard;
|
||||
|
||||
Genode::size_t sector = disc_offset / devices[idx]->block_size();
|
||||
Genode::size_t sector_cnt = size / devices[idx]->block_size();
|
||||
Block::Packet_descriptor p(Block::Packet_descriptor(queue_offset, size),
|
||||
write ? Block::Packet_descriptor::WRITE
|
||||
: Block::Packet_descriptor::READ,
|
||||
sector, sector_cnt);
|
||||
devices[idx]->session()->tx()->submit_packet(p);
|
||||
}
|
||||
|
||||
|
||||
void genode_block_collect_responses(unsigned idx)
|
||||
{
|
||||
if (idx >= genode_block_count()) {
|
||||
Genode::warning(__func__, ": invalid index!");
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned long flags;
|
||||
l4x_irq_save(&flags);
|
||||
|
||||
Block::Connection *session = devices[idx]->session();
|
||||
void *req;
|
||||
while (session->tx()->ack_avail()) {
|
||||
Block::Packet_descriptor packet = session->tx()->get_acked_packet();
|
||||
void *addr = session->tx()->packet_content(packet);
|
||||
bool write = packet.operation() == Block::Packet_descriptor::WRITE;
|
||||
devices[idx]->cache()->remove(session->tx()->packet_content(packet), &req);
|
||||
if (req && end_request) {
|
||||
l4x_irq_restore(flags);
|
||||
end_request(req, write, addr, packet.size());
|
||||
l4x_irq_save(&flags);
|
||||
}
|
||||
session->tx()->release_packet(packet);
|
||||
}
|
||||
l4x_irq_restore(flags);
|
||||
}
|
||||
} // extern "C"
|
@ -1,95 +0,0 @@
|
||||
/*
|
||||
* \brief Genode C API framebuffer functions of the Linux support library
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2009-06-08
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/printf.h>
|
||||
#include <base/env.h>
|
||||
#include <framebuffer_session/connection.h>
|
||||
|
||||
/* L4lx includes */
|
||||
#include <env.h>
|
||||
#include <linux.h>
|
||||
#include <genode/framebuffer.h>
|
||||
|
||||
|
||||
static Framebuffer::Connection *framebuffer() {
|
||||
static bool initialized = false;
|
||||
static Framebuffer::Connection *f = 0;
|
||||
|
||||
if (!initialized) {
|
||||
try {
|
||||
static Framebuffer::Connection fb;
|
||||
f = &fb;
|
||||
} catch(...) {}
|
||||
initialized = true;
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
static Genode::Dataspace_capability fb_ds() {
|
||||
static Genode::Dataspace_capability ds = framebuffer()->dataspace();
|
||||
return ds;
|
||||
}
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
int genode_screen_count()
|
||||
{
|
||||
Linux::Irq_guard guard;
|
||||
|
||||
return framebuffer() ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
unsigned long genode_fb_size(unsigned screen)
|
||||
{
|
||||
Linux::Irq_guard guard;
|
||||
|
||||
return Genode::Dataspace_client(fb_ds()).size();
|
||||
}
|
||||
|
||||
|
||||
void *genode_fb_attach(unsigned screen)
|
||||
{
|
||||
Linux::Irq_guard guard;
|
||||
|
||||
return L4lx::Env::env()->rm()->attach(fb_ds(), "framebuffer");
|
||||
}
|
||||
|
||||
|
||||
void genode_fb_info(unsigned screen, int *out_w, int *out_h)
|
||||
{
|
||||
Linux::Irq_guard guard;
|
||||
|
||||
Framebuffer::Mode const mode = framebuffer()->mode();
|
||||
*out_w = mode.width();
|
||||
*out_h = mode.height();
|
||||
}
|
||||
|
||||
|
||||
void genode_fb_refresh(unsigned screen, int x, int y, int w, int h)
|
||||
{
|
||||
Linux::Irq_guard guard;
|
||||
|
||||
framebuffer()->refresh(x,y,w,h);
|
||||
}
|
||||
|
||||
|
||||
void genode_fb_close(unsigned screen)
|
||||
{
|
||||
NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
} // extern "C"
|
@ -1,158 +0,0 @@
|
||||
/*
|
||||
* \brief Genode C API input functions for the Linux support libary
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2010-04-21
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2010-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/env.h>
|
||||
#include <input_session/connection.h>
|
||||
#include <input/event.h>
|
||||
#include <input/keycodes.h>
|
||||
|
||||
#include <linux.h>
|
||||
#include <env.h>
|
||||
|
||||
enum Event_types {EV_SYN=0x00, EV_KEY=0x01, EV_REL=0x02, EV_ABS=0x03 };
|
||||
enum Relative_axes {REL_X=0x00, REL_Y=0x01, REL_WHEEL=0x08 };
|
||||
enum Absolute_axes {ABS_X=0x00, ABS_Y=0x01, ABS_WHEEL=0x08 };
|
||||
|
||||
|
||||
static Input::Connection *input() {
|
||||
static Input::Connection _inp;
|
||||
return &_inp;
|
||||
}
|
||||
|
||||
|
||||
static Input::Event *buffer() {
|
||||
static Input::Event *_ev_buf = 0;
|
||||
if (!_ev_buf) {
|
||||
Linux::Irq_guard guard;
|
||||
|
||||
_ev_buf = (Input::Event*) L4lx::Env::env()->rm()->attach(input()->dataspace(),
|
||||
"input buffer");
|
||||
}
|
||||
return _ev_buf;
|
||||
}
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
#include <genode/input.h>
|
||||
|
||||
FASTCALL static void (*genode_input_event) (void*,unsigned int, unsigned int, int) = 0;
|
||||
static void *keyboard = 0;
|
||||
static void *mouse = 0;
|
||||
|
||||
void genode_input_register_callback(FASTCALL void (*func)
|
||||
(void*,unsigned int, unsigned int, int))
|
||||
{
|
||||
genode_input_event = func;
|
||||
}
|
||||
|
||||
|
||||
void genode_input_unregister_callback(void)
|
||||
{
|
||||
genode_input_event = 0;
|
||||
}
|
||||
|
||||
|
||||
void genode_input_register_keyb(unsigned int idx, void* dev)
|
||||
{
|
||||
keyboard = dev;
|
||||
}
|
||||
|
||||
|
||||
void genode_input_unregister_keyb(unsigned int idx)
|
||||
{
|
||||
keyboard = 0;
|
||||
}
|
||||
|
||||
|
||||
void genode_input_register_mouse(unsigned int idx, void* dev)
|
||||
{
|
||||
mouse = dev;
|
||||
}
|
||||
|
||||
|
||||
void genode_input_unregister_mouse(unsigned int idx)
|
||||
{
|
||||
mouse = 0;
|
||||
}
|
||||
|
||||
|
||||
static void handle_event(void *mouse, void *keyb, Input::Event *ev)
|
||||
{
|
||||
using namespace Input;
|
||||
|
||||
switch(ev->type()) {
|
||||
case Event::MOTION:
|
||||
{
|
||||
if(ev->rx())
|
||||
genode_input_event(mouse, EV_REL, REL_X, ev->rx());
|
||||
if(ev->ry())
|
||||
genode_input_event(mouse, EV_REL, REL_Y, ev->ry());
|
||||
if(ev->ax())
|
||||
genode_input_event(mouse, EV_ABS, ABS_X, ev->ax());
|
||||
if(ev->ay())
|
||||
genode_input_event(mouse, EV_ABS, ABS_Y, ev->ay());
|
||||
return;
|
||||
}
|
||||
case Event::PRESS:
|
||||
{
|
||||
if (ev->code() < BTN_MISC)
|
||||
genode_input_event(keyb, EV_KEY, ev->code(), 1);
|
||||
else
|
||||
genode_input_event(mouse, EV_KEY, ev->code(), 1);
|
||||
return;
|
||||
}
|
||||
case Event::RELEASE:
|
||||
{
|
||||
if (ev->code() < BTN_MISC)
|
||||
genode_input_event(keyb, EV_KEY, ev->code(), 0);
|
||||
else
|
||||
genode_input_event(mouse, EV_KEY, ev->code(), 0);
|
||||
return;
|
||||
}
|
||||
case Event::WHEEL:
|
||||
{
|
||||
if(ev->rx())
|
||||
genode_input_event(mouse, EV_REL, REL_WHEEL, ev->rx());
|
||||
else
|
||||
genode_input_event(mouse, EV_ABS, ABS_WHEEL, ev->ax());
|
||||
return;
|
||||
}
|
||||
case Event::INVALID:
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void genode_input_handle_events(void)
|
||||
{
|
||||
if (!genode_input_event)
|
||||
return;
|
||||
|
||||
unsigned long flags;
|
||||
l4x_irq_save(&flags);
|
||||
|
||||
if ( mouse && keyboard && input()) {
|
||||
int num = input()->flush();
|
||||
l4x_irq_restore(flags);
|
||||
for (int i = 0; i < num; i++) {
|
||||
Input::Event ev = buffer()[i];
|
||||
handle_event(mouse, keyboard, &ev);
|
||||
}
|
||||
} else
|
||||
l4x_irq_restore(flags);
|
||||
}
|
||||
|
||||
} //extern "C"
|
@ -1,244 +0,0 @@
|
||||
/*
|
||||
* \brief Genode C API framebuffer functions of the L4Linux support library
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2009-06-08
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/allocator_avl.h>
|
||||
#include <base/env.h>
|
||||
#include <base/exception.h>
|
||||
#include <base/log.h>
|
||||
#include <util/misc_math.h>
|
||||
#include <util/string.h>
|
||||
#include <nic/packet_allocator.h>
|
||||
#include <nic_session/connection.h>
|
||||
#include <timer_session/connection.h>
|
||||
#include <foc/capability_space.h>
|
||||
|
||||
#include <vcpu.h>
|
||||
#include <linux.h>
|
||||
|
||||
namespace Fiasco {
|
||||
#include <genode/net.h>
|
||||
#include <l4/sys/irq.h>
|
||||
#include <l4/sys/kdebug.h>
|
||||
#include <l4/sys/ktrace.h>
|
||||
}
|
||||
|
||||
#define TX_BENCH 0
|
||||
#define RX_BENCH 0
|
||||
|
||||
|
||||
/**
|
||||
* Debugging/Tracing
|
||||
*/
|
||||
#if TX_BENCH | RX_BENCH
|
||||
struct Counter : public Genode::Thread_deprecated<8192>
|
||||
{
|
||||
int cnt;
|
||||
Genode::size_t size;
|
||||
|
||||
void entry()
|
||||
{
|
||||
Timer::Connection _timer;
|
||||
int interval = 5;
|
||||
while(1) {
|
||||
_timer.msleep(interval * 1000);
|
||||
Genode::log("LX Packets ", cnt/interval, "/s "
|
||||
"bytes/s: ", size / interval);
|
||||
cnt = 0;
|
||||
size = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void inc(Genode::size_t s) { cnt++; size += s; }
|
||||
|
||||
Counter() : Thread_deprecated("net-counter"), cnt(0), size(0) { start(); }
|
||||
};
|
||||
#else
|
||||
struct Counter { inline void inc(Genode::size_t s) { } };
|
||||
#endif
|
||||
|
||||
|
||||
static Nic::Connection *nic() {
|
||||
|
||||
enum {
|
||||
PACKET_SIZE = Nic::Packet_allocator::DEFAULT_PACKET_SIZE,
|
||||
BUF_SIZE = Nic::Session::QUEUE_SIZE * PACKET_SIZE,
|
||||
};
|
||||
|
||||
static Nic::Connection *n = 0;
|
||||
static bool initialized = false;
|
||||
|
||||
if (initialized)
|
||||
return n;
|
||||
|
||||
try {
|
||||
Linux::Irq_guard guard;
|
||||
static Nic::Packet_allocator tx_block_alloc(Genode::env()->heap());
|
||||
static Nic::Connection nic(&tx_block_alloc, BUF_SIZE, BUF_SIZE);
|
||||
n = &nic;
|
||||
} catch(...) { }
|
||||
initialized = true;
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
class Signal_thread : public Genode::Thread_deprecated<8192>
|
||||
{
|
||||
private:
|
||||
|
||||
Fiasco::l4_cap_idx_t _cap;
|
||||
Genode::Lock *_sync;
|
||||
|
||||
protected:
|
||||
|
||||
void entry()
|
||||
{
|
||||
using namespace Fiasco;
|
||||
using namespace Genode;
|
||||
|
||||
Signal_receiver receiver;
|
||||
Signal_context rx;
|
||||
Signal_context_capability cap(receiver.manage(&rx));
|
||||
nic()->rx_channel()->sigh_ready_to_ack(cap);
|
||||
nic()->rx_channel()->sigh_packet_avail(cap);
|
||||
|
||||
_sync->unlock();
|
||||
|
||||
while (true) {
|
||||
receiver.wait_for_signal();
|
||||
|
||||
if (l4_error(l4_irq_trigger(_cap)) != -1)
|
||||
warning("IRQ net trigger failed");
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
Signal_thread(Fiasco::l4_cap_idx_t cap, Genode::Lock *sync)
|
||||
: Genode::Thread_deprecated<8192>("net-signal-thread"), _cap(cap), _sync(sync) {
|
||||
start(); }
|
||||
};
|
||||
}
|
||||
|
||||
using namespace Fiasco;
|
||||
|
||||
extern "C" {
|
||||
|
||||
static FASTCALL void (*receive_packet)(void*, void*, unsigned long) = 0;
|
||||
static void *net_device = 0;
|
||||
|
||||
|
||||
void genode_net_start(void *dev, FASTCALL void (*func)(void*, void*, unsigned long))
|
||||
{
|
||||
receive_packet = func;
|
||||
net_device = dev;
|
||||
}
|
||||
|
||||
|
||||
l4_cap_idx_t genode_net_irq_cap()
|
||||
{
|
||||
Linux::Irq_guard guard;
|
||||
Genode::Foc_native_cpu_client
|
||||
native_cpu(L4lx::cpu_connection()->native_cpu());
|
||||
static Genode::Native_capability cap = native_cpu.alloc_irq();
|
||||
static Genode::Lock lock(Genode::Lock::LOCKED);
|
||||
static Fiasco::l4_cap_idx_t const kcap = Genode::Capability_space::kcap(cap);
|
||||
static Signal_thread th(kcap, &lock);
|
||||
lock.lock();
|
||||
return kcap;
|
||||
}
|
||||
|
||||
|
||||
void genode_net_stop()
|
||||
{
|
||||
net_device = 0;
|
||||
receive_packet = 0;
|
||||
}
|
||||
|
||||
|
||||
void genode_net_mac(void* mac, unsigned long size)
|
||||
{
|
||||
Linux::Irq_guard guard;
|
||||
using namespace Genode;
|
||||
|
||||
Nic::Mac_address m = nic()->mac_address();
|
||||
memcpy(mac, &m.addr, min(sizeof(m.addr), (size_t)size));
|
||||
}
|
||||
|
||||
|
||||
int genode_net_tx(void* addr, unsigned long len)
|
||||
{
|
||||
Linux::Irq_guard guard;
|
||||
static Counter counter;
|
||||
|
||||
try {
|
||||
Nic::Packet_descriptor packet = nic()->tx()->alloc_packet(len);
|
||||
void* content = nic()->tx()->packet_content(packet);
|
||||
|
||||
Genode::memcpy((char *)content, addr, len);
|
||||
nic()->tx()->submit_packet(packet);
|
||||
|
||||
counter.inc(len);
|
||||
|
||||
return 0;
|
||||
/* 'Packet_alloc_failed' */
|
||||
} catch(...) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int genode_net_tx_ack_avail() {
|
||||
return nic()->tx()->ack_avail(); }
|
||||
|
||||
|
||||
void genode_net_tx_ack()
|
||||
{
|
||||
Linux::Irq_guard guard;
|
||||
|
||||
Nic::Packet_descriptor packet = nic()->tx()->get_acked_packet();
|
||||
nic()->tx()->release_packet(packet);
|
||||
}
|
||||
|
||||
|
||||
void genode_net_rx_receive()
|
||||
{
|
||||
Linux::Irq_guard guard;
|
||||
static Counter counter;
|
||||
|
||||
if (nic()) {
|
||||
while(nic()->rx()->packet_avail()) {
|
||||
Nic::Packet_descriptor p = nic()->rx()->get_packet();
|
||||
|
||||
if (receive_packet && net_device)
|
||||
receive_packet(net_device, nic()->rx()->packet_content(p), p.size());
|
||||
|
||||
counter.inc(p.size());
|
||||
nic()->rx()->acknowledge_packet(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int genode_net_ready()
|
||||
{
|
||||
return nic() ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
void *genode_net_memcpy(void *dst, void const *src, unsigned long size) {
|
||||
return Genode::memcpy(dst, src, size); }
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
/*
|
||||
* \brief Genode C API string API
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2013-06-26
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#include <util/string.h>
|
||||
|
||||
namespace Fiasco {
|
||||
#include <genode/string.h>
|
||||
}
|
||||
using namespace Fiasco;
|
||||
|
||||
|
||||
extern "C" void genode_memcpy(void *dst, void *src, unsigned long size)
|
||||
{
|
||||
Genode::memcpy(dst, src, size);
|
||||
}
|
@ -1,118 +0,0 @@
|
||||
/*
|
||||
* \brief Genode C API terminal functions of the L4Linux support library
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-09-16
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/env.h>
|
||||
#include <base/thread.h>
|
||||
#include <terminal_session/connection.h>
|
||||
#include <foc/capability_space.h>
|
||||
|
||||
#include <linux.h>
|
||||
#include <vcpu.h>
|
||||
|
||||
namespace Fiasco {
|
||||
#include <genode/net.h>
|
||||
#include <l4/sys/irq.h>
|
||||
#include <l4/sys/kdebug.h>
|
||||
}
|
||||
|
||||
static Terminal::Connection *terminal() {
|
||||
static bool initialized = false;
|
||||
static Terminal::Connection *t = 0;
|
||||
|
||||
if (!initialized) {
|
||||
try {
|
||||
static Terminal::Connection terminal;
|
||||
t = &terminal;
|
||||
} catch(...) { }
|
||||
initialized = true;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
class Signal_thread : public Genode::Thread_deprecated<8192>
|
||||
{
|
||||
private:
|
||||
|
||||
Fiasco::l4_cap_idx_t _cap;
|
||||
|
||||
protected:
|
||||
|
||||
void entry()
|
||||
{
|
||||
using namespace Fiasco;
|
||||
using namespace Genode;
|
||||
|
||||
Signal_receiver receiver;
|
||||
Signal_context rx;
|
||||
Signal_context_capability cap(receiver.manage(&rx));
|
||||
terminal()->connected_sigh(cap);
|
||||
terminal()->read_avail_sigh(cap);
|
||||
|
||||
while (true) {
|
||||
receiver.wait_for_signal();
|
||||
if (l4_error(l4_irq_trigger(_cap)) != -1)
|
||||
PWRN("IRQ terminal trigger failed\n");
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
Signal_thread(Fiasco::l4_cap_idx_t cap)
|
||||
: Genode::Thread_deprecated<8192>("terminal-signal-thread"), _cap(cap) { start(); }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
static Signal_thread *signal_thread = 0;
|
||||
|
||||
|
||||
using namespace Fiasco;
|
||||
|
||||
extern "C" {
|
||||
|
||||
unsigned genode_terminal_readchar(unsigned idx, char *buf, unsigned long sz) {
|
||||
if (!terminal()->avail())
|
||||
return 0;
|
||||
return terminal()->read(buf, sz);
|
||||
}
|
||||
|
||||
|
||||
void genode_terminal_writechar(unsigned idx, const char *buf, unsigned long sz) {
|
||||
terminal()->write(buf, sz);
|
||||
}
|
||||
|
||||
|
||||
l4_cap_idx_t genode_terminal_irq(unsigned idx) {
|
||||
|
||||
Genode::Foc_native_cpu_client
|
||||
native_cpu(L4lx::cpu_connection()->native_cpu());
|
||||
|
||||
static Genode::Native_capability cap = native_cpu.alloc_irq();
|
||||
l4_cap_idx_t const kcap = Genode::Capability_space::kcap(cap);
|
||||
if (!signal_thread)
|
||||
signal_thread = new (Genode::env()->heap()) Signal_thread(kcap);
|
||||
return kcap;
|
||||
}
|
||||
|
||||
|
||||
unsigned genode_terminal_count(void) {
|
||||
return terminal() ? 1 : 0; }
|
||||
|
||||
|
||||
void genode_terminal_stop(unsigned idx) {
|
||||
destroy(Genode::env()->heap(), signal_thread);
|
||||
}
|
||||
}
|
@ -1,192 +0,0 @@
|
||||
/*
|
||||
* \brief Dataspace abstraction between Genode and L4Linux
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-03-20
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _L4LX__DATASPACE_H_
|
||||
#define _L4LX__DATASPACE_H_
|
||||
|
||||
/* Genode includes */
|
||||
#include <dataspace/client.h>
|
||||
#include <base/env.h>
|
||||
#include <util/avl_tree.h>
|
||||
#include <rm_session/connection.h>
|
||||
#include <region_map/client.h>
|
||||
#include <platform_env.h>
|
||||
#include <foc/capability_space.h>
|
||||
|
||||
namespace L4lx {
|
||||
|
||||
class Dataspace : public Genode::Avl_node<Dataspace>
|
||||
{
|
||||
private:
|
||||
|
||||
const char* _name;
|
||||
Genode::size_t _size;
|
||||
Fiasco::l4_cap_idx_t _ref;
|
||||
|
||||
public:
|
||||
|
||||
/******************
|
||||
** Constructors **
|
||||
******************/
|
||||
|
||||
Dataspace(const char* name,
|
||||
Genode::size_t size,
|
||||
Fiasco::l4_cap_idx_t ref)
|
||||
: _name(name), _size(size), _ref(ref) {}
|
||||
|
||||
|
||||
/***************
|
||||
** Accessors **
|
||||
***************/
|
||||
|
||||
const char* name() const { return _name; }
|
||||
Genode::size_t size() { return _size; }
|
||||
Fiasco::l4_cap_idx_t ref() { return _ref; }
|
||||
|
||||
virtual Genode::Dataspace_capability cap() = 0;
|
||||
virtual void map(Genode::size_t offset, bool greedy = false) = 0;
|
||||
virtual bool free(Genode::size_t offset) = 0;
|
||||
|
||||
/************************
|
||||
** Avl_node interface **
|
||||
************************/
|
||||
|
||||
bool higher(Dataspace *n) { return n->_ref > _ref; }
|
||||
|
||||
Dataspace *find_by_ref(Fiasco::l4_cap_idx_t ref)
|
||||
{
|
||||
if (_ref == ref) return this;
|
||||
|
||||
Dataspace *n = Genode::Avl_node<Dataspace>::child(ref > _ref);
|
||||
return n ? n->find_by_ref(ref) : 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class Single_dataspace : public Dataspace
|
||||
{
|
||||
private:
|
||||
|
||||
Genode::Dataspace_capability _cap;
|
||||
|
||||
public:
|
||||
|
||||
Single_dataspace(const char* name,
|
||||
Genode::size_t size,
|
||||
Genode::Dataspace_capability ds,
|
||||
Fiasco::l4_cap_idx_t ref =
|
||||
Genode::Capability_space::alloc_kcap())
|
||||
: Dataspace(name, size, ref), _cap(ds) {}
|
||||
|
||||
Genode::Dataspace_capability cap() { return _cap; }
|
||||
void map(Genode::size_t offset, bool greedy) { }
|
||||
bool free(Genode::size_t offset) { return false; }
|
||||
};
|
||||
|
||||
|
||||
struct Expanding_region_map : private Genode::Rm_connection,
|
||||
public Genode::Region_map_client
|
||||
{
|
||||
typedef Genode::size_t size_t;
|
||||
typedef Genode::off_t off_t;
|
||||
|
||||
Expanding_region_map(size_t size)
|
||||
:
|
||||
Genode::Region_map_client(Genode::Rm_connection::create(size))
|
||||
{ }
|
||||
|
||||
Local_addr attach(Genode::Dataspace_capability ds, size_t size, off_t offset,
|
||||
bool use_local_addr, Local_addr local_addr,
|
||||
bool executable) override
|
||||
{
|
||||
return retry<Genode::Region_map::Out_of_metadata>(
|
||||
[&] () {
|
||||
return Genode::Region_map_client::attach(ds, size, offset,
|
||||
use_local_addr,
|
||||
local_addr,
|
||||
executable); },
|
||||
[&] () { Rm_connection::upgrade_ram(8*1024); });
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class Chunked_dataspace : public Dataspace
|
||||
{
|
||||
private:
|
||||
|
||||
Expanding_region_map _rm;
|
||||
|
||||
Genode::Ram_dataspace_capability *_chunks;
|
||||
|
||||
public:
|
||||
|
||||
enum {
|
||||
CHUNK_SIZE_LOG2 = 20,
|
||||
CHUNK_SIZE = 1 << CHUNK_SIZE_LOG2,
|
||||
};
|
||||
|
||||
Chunked_dataspace(const char* name,
|
||||
Genode::size_t size,
|
||||
Fiasco::l4_cap_idx_t ref)
|
||||
: Dataspace(name, size, ref), _rm(size)
|
||||
{
|
||||
_chunks = (Genode::Ram_dataspace_capability*)
|
||||
Genode::env()->heap()->alloc(sizeof(Genode::Ram_dataspace_capability) * (size/CHUNK_SIZE));
|
||||
}
|
||||
|
||||
Genode::Dataspace_capability cap() { return _rm.dataspace(); }
|
||||
|
||||
void map(Genode::size_t off, bool greedy)
|
||||
{
|
||||
off = Genode::align_addr((off-(CHUNK_SIZE-1)), CHUNK_SIZE_LOG2);
|
||||
int i = off / CHUNK_SIZE;
|
||||
if (_chunks[i].valid()) return;
|
||||
|
||||
Genode::size_t ram_avail = Genode::env()->ram_session()->avail();
|
||||
if (greedy && ram_avail < 4*CHUNK_SIZE) {
|
||||
char buf[128];
|
||||
Genode::snprintf(buf, sizeof(buf), "ram_quota=%ld",
|
||||
4*CHUNK_SIZE - ram_avail);
|
||||
Genode::env()->parent()->resource_request(buf);
|
||||
}
|
||||
|
||||
_chunks[i] = Genode::env()->ram_session()->alloc(CHUNK_SIZE);
|
||||
_rm.attach(_chunks[i], 0, 0, true, off, false);
|
||||
}
|
||||
|
||||
bool free(Genode::size_t off)
|
||||
{
|
||||
off = Genode::align_addr((off-(CHUNK_SIZE-1)), CHUNK_SIZE_LOG2);
|
||||
int i = off / CHUNK_SIZE;
|
||||
if (!_chunks[i].valid()) return false;
|
||||
Genode::env()->ram_session()->free(_chunks[i]);
|
||||
_chunks[i] = Genode::Ram_dataspace_capability();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class Dataspace_tree : public Genode::Avl_tree<Dataspace>
|
||||
{
|
||||
public:
|
||||
|
||||
Dataspace* find_by_ref(Fiasco::l4_cap_idx_t ref) {
|
||||
return this->first() ? this->first()->find_by_ref(ref) : 0; }
|
||||
|
||||
Dataspace* insert(const char* name, Genode::Dataspace_capability cap);
|
||||
|
||||
void insert(Dataspace *ds) { Genode::Avl_tree<Dataspace>::insert(ds); }
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* _L4LX__DATASPACE_H_ */
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* \brief Global environment for L4Linux support library
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-03-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _L4LX__ENV_H_
|
||||
#define _L4LX__ENV_H_
|
||||
|
||||
/* L4lx includes */
|
||||
#include <dataspace.h>
|
||||
#include <rm.h>
|
||||
#include <task.h>
|
||||
|
||||
namespace L4lx {
|
||||
|
||||
enum {
|
||||
THREAD_MAX = (1 << 7),
|
||||
};
|
||||
|
||||
|
||||
class Env
|
||||
{
|
||||
private:
|
||||
|
||||
Region_manager _rm;
|
||||
Dataspace_tree _dataspaces;
|
||||
Task_tree _tasks;
|
||||
|
||||
Env();
|
||||
|
||||
public:
|
||||
|
||||
static Env *env();
|
||||
|
||||
Region_manager *rm() { return &_rm; }
|
||||
Dataspace_tree *dataspaces() { return &_dataspaces; };
|
||||
Task_tree *tasks() { return &_tasks; };
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* _L4LX__ENV_H_ */
|
@ -1,83 +0,0 @@
|
||||
/*
|
||||
* \brief L4lxapi library IRQ functions
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-04-29
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _L4LX__L4LX_IRQ_H_
|
||||
#define _L4LX__L4LX_IRQ_H_
|
||||
|
||||
#include <linux.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct l4x_irq_desc_private {
|
||||
Fiasco::l4_cap_idx_t irq_cap;
|
||||
Fiasco::l4_cap_idx_t irq_thread;
|
||||
unsigned enabled;
|
||||
unsigned cpu;
|
||||
unsigned char trigger;
|
||||
};
|
||||
|
||||
struct irq_data {
|
||||
unsigned int irq;
|
||||
unsigned long hwirq;
|
||||
unsigned int node;
|
||||
unsigned int state_use_accessors;
|
||||
struct irq_chip *chip;
|
||||
struct irq_domain *domain;
|
||||
void *handler_data;
|
||||
void *chip_data;
|
||||
};
|
||||
|
||||
/* Linux functions */
|
||||
FASTCALL int irq_set_chip_data(unsigned int irq, void *data);
|
||||
FASTCALL struct irq_data *irq_get_irq_data(unsigned int irq);
|
||||
|
||||
static inline void *irq_get_chip_data(unsigned int irq)
|
||||
{
|
||||
struct irq_data *d = irq_get_irq_data(irq);
|
||||
return d ? d->chip_data : 0;
|
||||
}
|
||||
|
||||
/* l4lxapi functions */
|
||||
FASTCALL void l4lx_irq_init(void);
|
||||
FASTCALL int l4lx_irq_prio_get(unsigned int irq);
|
||||
FASTCALL unsigned int l4lx_irq_dev_startup(struct irq_data *data);
|
||||
FASTCALL void l4lx_irq_dev_shutdown(struct irq_data *data);
|
||||
FASTCALL int l4lx_irq_set_type(struct irq_data *data, unsigned int type);
|
||||
FASTCALL void l4lx_irq_dev_enable(struct irq_data *data);
|
||||
FASTCALL void l4lx_irq_dev_disable(struct irq_data *data);
|
||||
FASTCALL void l4lx_irq_dev_ack(struct irq_data *data);
|
||||
FASTCALL void l4lx_irq_dev_mask(struct irq_data *data);
|
||||
FASTCALL void l4lx_irq_dev_unmask(struct irq_data *data);
|
||||
FASTCALL int l4lx_irq_dev_set_affinity(struct irq_data *data,
|
||||
const struct cpumask *dest, bool force);
|
||||
FASTCALL void l4lx_irq_dev_eoi(struct irq_data *data);
|
||||
FASTCALL unsigned int l4lx_irq_timer_startup(struct irq_data *data);
|
||||
FASTCALL void l4lx_irq_timer_shutdown(struct irq_data *data);
|
||||
FASTCALL void l4lx_irq_timer_enable(struct irq_data *data);
|
||||
FASTCALL void l4lx_irq_timer_disable(struct irq_data *data);
|
||||
FASTCALL void l4lx_irq_timer_ack(struct irq_data *data);
|
||||
FASTCALL void l4lx_irq_timer_mask(struct irq_data *data);
|
||||
FASTCALL void l4lx_irq_timer_unmask(struct irq_data *data);
|
||||
FASTCALL int l4lx_irq_timer_set_affinity(struct irq_data *data,
|
||||
const struct cpumask *dest);
|
||||
FASTCALL void l4lx_irq_dev_enable(struct irq_data *data);
|
||||
FASTCALL void l4lx_irq_dev_mask_ack(struct irq_data *data);
|
||||
FASTCALL int l4x_alloc_irq_desc_data(int irq);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _L4LX__L4LX_IRQ_H_ */
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* \brief L4lxapi library memory functions
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-04-29
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _L4LX__L4LX_MEMORY_H_
|
||||
#define _L4LX__L4LX_MEMORY_H_
|
||||
|
||||
#include <linux.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
FASTCALL int l4lx_memory_map_virtual_page(unsigned long address, unsigned long page,
|
||||
int map_rw);
|
||||
FASTCALL int l4lx_memory_unmap_virtual_page(unsigned long address);
|
||||
FASTCALL int l4lx_memory_page_mapped(unsigned long address);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _L4LX__L4LX_MEMORY_H_ */
|
@ -1,46 +0,0 @@
|
||||
/*
|
||||
* \brief L4lxapi library task functions
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-04-29
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _L4LX__L4LX_TASK_H_
|
||||
#define _L4LX__L4LX_TASK_H_
|
||||
|
||||
#include <linux.h>
|
||||
|
||||
namespace Fiasco {
|
||||
#include <l4/sys/types.h>
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
FASTCALL void l4lx_task_init(void);
|
||||
FASTCALL Fiasco::l4_cap_idx_t l4lx_task_number_allocate(void);
|
||||
FASTCALL int l4lx_task_number_free(Fiasco::l4_cap_idx_t task);
|
||||
FASTCALL int l4lx_task_get_new_task(Fiasco::l4_cap_idx_t parent_id,
|
||||
Fiasco::l4_cap_idx_t *id);
|
||||
FASTCALL int l4lx_task_create(Fiasco::l4_cap_idx_t task_no);
|
||||
FASTCALL int l4lx_task_create_thread_in_task(Fiasco::l4_cap_idx_t thread,
|
||||
Fiasco::l4_cap_idx_t task,
|
||||
Fiasco::l4_cap_idx_t pager,
|
||||
unsigned cpu);
|
||||
FASTCALL int l4lx_task_create_pager(Fiasco::l4_cap_idx_t task_no,
|
||||
Fiasco::l4_cap_idx_t pager);
|
||||
FASTCALL int l4lx_task_delete_thread(Fiasco::l4_cap_idx_t thread);
|
||||
FASTCALL int l4lx_task_delete_task(Fiasco::l4_cap_idx_t task, unsigned option);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _L4LX__L4LX_TASK_H_ */
|
@ -1,64 +0,0 @@
|
||||
/*
|
||||
* \brief L4lxapi library thread functions
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-04-29
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _L4LX__L4LX_THREAD_H_
|
||||
#define _L4LX__L4LX_THREAD_H_
|
||||
|
||||
#include <linux.h>
|
||||
|
||||
namespace Fiasco {
|
||||
#include <l4/sys/types.h>
|
||||
#include <l4/sys/utcb.h>
|
||||
#include <l4/sys/vcpu.h>
|
||||
}
|
||||
|
||||
typedef Fiasco::l4_utcb_t *l4lx_thread_t;
|
||||
|
||||
struct l4lx_thread_start_info_t {
|
||||
Fiasco::l4_cap_idx_t l4cap;
|
||||
Fiasco::l4_umword_t ip, sp;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
FASTCALL Fiasco::l4_cap_idx_t l4x_cpu_thread_get_cap(int cpu);
|
||||
|
||||
FASTCALL void l4lx_thread_init(void);
|
||||
FASTCALL void l4lx_thread_alloc_irq(Fiasco::l4_cap_idx_t c);
|
||||
FASTCALL l4lx_thread_t l4lx_thread_create(L4_CV void (*thread_func)(void *data),
|
||||
unsigned cpu_nr,
|
||||
void *stack_pointer,
|
||||
void *stack_data, unsigned stack_data_size,
|
||||
Fiasco::l4_cap_idx_t l4cap, int prio,
|
||||
Fiasco::l4_vcpu_state_t **vcpu_state,
|
||||
const char *name,
|
||||
struct l4lx_thread_start_info_t *deferstart);
|
||||
FASTCALL int l4lx_thread_start(struct l4lx_thread_start_info_t *startinfo);
|
||||
FASTCALL int l4lx_thread_is_valid(l4lx_thread_t t);
|
||||
FASTCALL void l4lx_thread_name_set(Fiasco::l4_cap_idx_t thread, const char *name);
|
||||
|
||||
FASTCALL Fiasco::l4_cap_idx_t l4lx_thread_get_cap(l4lx_thread_t t);
|
||||
FASTCALL void l4lx_thread_pager_change(Fiasco::l4_cap_idx_t thread,
|
||||
Fiasco::l4_cap_idx_t pager);
|
||||
FASTCALL void l4lx_thread_set_kernel_pager(Fiasco::l4_cap_idx_t thread);
|
||||
FASTCALL void l4lx_thread_shutdown(l4lx_thread_t u, void *v);
|
||||
FASTCALL int l4lx_thread_equal(Fiasco::l4_cap_idx_t t1, Fiasco::l4_cap_idx_t t2);
|
||||
FASTCALL void l4lx_thread_utcb_alloc_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _L4LX__L4LX_THREAD_H_ */
|
@ -1,78 +0,0 @@
|
||||
/*
|
||||
* \brief Linux kernel functions
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-04-29
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _L4LX__LINUX_H_
|
||||
#define _L4LX__LINUX_H_
|
||||
|
||||
#include <base/printf.h>
|
||||
#include <base/thread.h>
|
||||
|
||||
#include <genode/linkage.h>
|
||||
#include <vcpu.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
FASTCALL void l4x_irq_save(unsigned long *flags);
|
||||
FASTCALL void l4x_irq_restore(unsigned long flags);
|
||||
FASTCALL void l4x_migrate_lock(unsigned long *flags);
|
||||
FASTCALL void l4x_migrate_unlock(unsigned long flags);
|
||||
FASTCALL unsigned long l4x_hz();
|
||||
FASTCALL int l4x_nr_irqs(void);
|
||||
|
||||
FASTCALL unsigned l4x_smp_processor_id();
|
||||
FASTCALL unsigned l4x_cpu_physmap_get_id(unsigned);
|
||||
FASTCALL unsigned l4x_target_cpu(const struct cpumask*);
|
||||
FASTCALL void l4x_cpumask_copy(struct irq_data*, const struct cpumask*);
|
||||
|
||||
#define IRQ_SAFE(x) do { \
|
||||
unsigned long flags = 0; \
|
||||
l4x_irq_save(&flags); \
|
||||
x; \
|
||||
l4x_irq_restore(flags); \
|
||||
} while(0)
|
||||
|
||||
#define NOT_IMPLEMENTED IRQ_SAFE(PWRN("%s: not implemented yet!", __func__););
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace Linux {
|
||||
|
||||
class Irq_guard
|
||||
{
|
||||
private:
|
||||
|
||||
unsigned long _flags;
|
||||
bool _vcpu;
|
||||
|
||||
public:
|
||||
|
||||
Irq_guard()
|
||||
: _flags(0),
|
||||
_vcpu(dynamic_cast<L4lx::Vcpu*>(Genode::Thread::myself()))
|
||||
{
|
||||
if (_vcpu)
|
||||
l4x_irq_save(&_flags);
|
||||
}
|
||||
|
||||
~Irq_guard()
|
||||
{
|
||||
if (_vcpu)
|
||||
l4x_irq_restore(_flags);
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif /* _L4LX__LINUX_H_ */
|
@ -1,59 +0,0 @@
|
||||
/*
|
||||
* \brief Platform environment of Genode process
|
||||
* \author Norman Feske
|
||||
* \author Christian Helmuth
|
||||
* \date 2006-07-28
|
||||
*
|
||||
* This file is a generic variant of the platform environment, which is
|
||||
* suitable for platforms such as L4ka::Pistachio and L4/Fiasco. On other
|
||||
* platforms, it may be replaced by a platform-specific version residing
|
||||
* in the corresponding 'base-<platform>' repository.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2006-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _PLATFORM_ENV_H_
|
||||
#define _PLATFORM_ENV_H_
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/log.h>
|
||||
#include <base/env.h>
|
||||
#include <base/heap.h>
|
||||
#include <rm_session/client.h>
|
||||
#include <util/arg_string.h>
|
||||
|
||||
namespace Genode {
|
||||
struct Expanding_rm_session_client;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Repeatedly try to execute a function 'func'
|
||||
*
|
||||
* If the function 'func' throws an exception of type 'EXC', the 'handler'
|
||||
* is called and the function call is retried.
|
||||
*
|
||||
* \param EXC exception type to handle
|
||||
* \param func functor to execute
|
||||
* \param handler exception handler executed if 'func' raised an exception
|
||||
* of type 'EXC'
|
||||
* \param attempts number of attempts to execute 'func' before giving up
|
||||
* and reflecting the exception 'EXC' to the caller. If not
|
||||
* specified, attempt infinitely.
|
||||
*/
|
||||
template <typename EXC, typename FUNC, typename HANDLER>
|
||||
auto retry(FUNC func, HANDLER handler, unsigned attempts = ~0U) -> decltype(func())
|
||||
{
|
||||
for (unsigned i = 0; attempts == ~0U || i < attempts; i++)
|
||||
try { return func(); }
|
||||
catch (EXC) { handler(); }
|
||||
|
||||
throw EXC();
|
||||
}
|
||||
|
||||
#endif /* _PLATFORM_ENV_H_ */
|
@ -1,165 +0,0 @@
|
||||
/*
|
||||
* \brief Region map for l4lx support library.
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-04-11
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _L4LX__RM_H_
|
||||
#define _L4LX__RM_H_
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/allocator_avl.h>
|
||||
#include <util/avl_tree.h>
|
||||
#include <util/list.h>
|
||||
|
||||
/* L4lx includes */
|
||||
#include <dataspace.h>
|
||||
|
||||
namespace L4lx {
|
||||
|
||||
class Region
|
||||
{
|
||||
private:
|
||||
|
||||
Genode::addr_t _addr;
|
||||
Genode::size_t _size;
|
||||
Dataspace *_ds;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
/******************
|
||||
** Constructors **
|
||||
******************/
|
||||
|
||||
Region(Genode::addr_t addr, Genode::size_t size)
|
||||
: _addr(addr), _size(size), _ds(0) {}
|
||||
|
||||
Region(Genode::addr_t addr, Genode::size_t size, Dataspace *ds)
|
||||
: _addr(addr), _size(size), _ds(ds) {}
|
||||
|
||||
|
||||
/***************
|
||||
** Accessors **
|
||||
***************/
|
||||
|
||||
Genode::addr_t addr() { return _addr; }
|
||||
Genode::size_t size() { return _size; }
|
||||
Dataspace *ds() { return _ds; }
|
||||
};
|
||||
|
||||
|
||||
class Mapping : public Genode::Avl_node<Mapping>,
|
||||
public Genode::List<Mapping>::Element
|
||||
{
|
||||
private:
|
||||
|
||||
void *_virt;
|
||||
void *_phys;
|
||||
bool _rw;
|
||||
|
||||
public:
|
||||
|
||||
Mapping(void *virt, void *v, bool rw)
|
||||
: _virt(virt), _phys(v), _rw(rw) { }
|
||||
|
||||
/************************
|
||||
** Avl node interface **
|
||||
************************/
|
||||
|
||||
void *phys() { return _phys; }
|
||||
void *virt() { return _virt; }
|
||||
bool writeable() { return _rw; }
|
||||
|
||||
bool higher(Mapping *m) { return m->_virt > _virt; }
|
||||
|
||||
Mapping *find_by_virt(void *virt)
|
||||
{
|
||||
if (virt == _virt) return this;
|
||||
|
||||
Mapping *m = Genode::Avl_node<Mapping>::child(virt > _virt);
|
||||
return m ? m->find_by_virt(virt) : 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class Phys_mapping : public Genode::Avl_node<Phys_mapping>
|
||||
{
|
||||
private:
|
||||
|
||||
void *_phys;
|
||||
Genode::List<Mapping> _list;
|
||||
|
||||
public:
|
||||
|
||||
Phys_mapping(void *phys) : _phys(phys) { }
|
||||
|
||||
Genode::List<Mapping> *mappings() { return &_list; }
|
||||
|
||||
bool higher(Phys_mapping *m) { return m->_phys > _phys; }
|
||||
|
||||
Phys_mapping *find_by_phys(void *phys)
|
||||
{
|
||||
if (phys == _phys) return this;
|
||||
|
||||
Phys_mapping *m = Genode::Avl_node<Phys_mapping>::child(phys > _phys);
|
||||
return m ? m->find_by_phys(phys) : 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class Region_manager : public Genode::Allocator_avl_tpl<Region>
|
||||
{
|
||||
private:
|
||||
|
||||
Genode::Avl_tree<Mapping> _virt_tree;
|
||||
Genode::Avl_tree<Phys_mapping> _phys_tree;
|
||||
|
||||
Mapping* _virt_to_phys(void *virt);
|
||||
Phys_mapping* _phys_to_virt(void *phys);
|
||||
|
||||
public:
|
||||
|
||||
/*****************
|
||||
** Constructor **
|
||||
*****************/
|
||||
|
||||
Region_manager(Allocator *md_alloc)
|
||||
: Genode::Allocator_avl_tpl<Region>(md_alloc) { }
|
||||
|
||||
|
||||
/***************************
|
||||
** Convenience functions **
|
||||
***************************/
|
||||
|
||||
Region *find_region(Genode::addr_t *addr, Genode::size_t *size);
|
||||
void *attach(Genode::Dataspace_capability cap, const char* name);
|
||||
void *attach(Dataspace *ds);
|
||||
bool attach_at(Dataspace *ds, Genode::size_t size,
|
||||
Genode::size_t offset, void* addr);
|
||||
Region *reserve_range(Genode::size_t size, int align,
|
||||
Genode::addr_t start=0);
|
||||
void reserve_range(Genode::addr_t addr, Genode::size_t size,
|
||||
const char *name);
|
||||
|
||||
void add_mapping(void *phys, void *virt, bool rw);
|
||||
void remove_mapping(void *virt);
|
||||
void map(void *phys);
|
||||
void* phys(void *virt);
|
||||
|
||||
/***********
|
||||
** Debug **
|
||||
***********/
|
||||
|
||||
void dump();
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* _L4LX__RM_H_ */
|
@ -1,92 +0,0 @@
|
||||
/*
|
||||
* \brief Tasks for l4lx support library.
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-04-27
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _L4LX__TASK_H_
|
||||
#define _L4LX__TASK_H_
|
||||
|
||||
/* Genode includes */
|
||||
#include <pd_session/connection.h>
|
||||
#include <foc_native_pd/client.h>
|
||||
#include <util/avl_tree.h>
|
||||
|
||||
namespace Fiasco {
|
||||
#include <l4/sys/types.h>
|
||||
#include <l4/sys/consts.h>
|
||||
#include <l4/sys/task.h>
|
||||
}
|
||||
|
||||
namespace L4lx {
|
||||
|
||||
|
||||
class Task : public Genode::Avl_node<Task>
|
||||
{
|
||||
private:
|
||||
|
||||
Fiasco::l4_cap_idx_t _ref;
|
||||
Genode::Pd_connection _pd;
|
||||
Genode::Foc_native_pd_client _native_pd { _pd.native_pd() };
|
||||
Genode::Native_capability _cap;
|
||||
|
||||
public:
|
||||
|
||||
/*****************
|
||||
** Constructor **
|
||||
*****************/
|
||||
|
||||
Task(Fiasco::l4_cap_idx_t ref)
|
||||
:
|
||||
_ref(ref), _cap(_native_pd.task_cap())
|
||||
{
|
||||
using namespace Fiasco;
|
||||
|
||||
/* remap task cap to given cap slot */
|
||||
l4_task_map(L4_BASE_TASK_CAP, L4_BASE_TASK_CAP,
|
||||
l4_obj_fpage(Genode::Capability_space::kcap(_cap),
|
||||
0, L4_FPAGE_RWX),
|
||||
_ref | L4_ITEM_MAP);
|
||||
}
|
||||
|
||||
|
||||
/***************
|
||||
** Accessors **
|
||||
***************/
|
||||
|
||||
Fiasco::l4_cap_idx_t ref() { return _ref; }
|
||||
|
||||
|
||||
/************************
|
||||
** Avl_node interface **
|
||||
************************/
|
||||
|
||||
bool higher(Task *n) { return n->_ref > _ref; }
|
||||
|
||||
Task *find_by_ref(Fiasco::l4_cap_idx_t ref)
|
||||
{
|
||||
if (_ref == ref) return this;
|
||||
|
||||
Task *n = Genode::Avl_node<Task>::child(ref > _ref);
|
||||
return n ? n->find_by_ref(ref) : 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class Task_tree : public Genode::Avl_tree<Task>
|
||||
{
|
||||
public:
|
||||
|
||||
Task* find_by_ref(Fiasco::l4_cap_idx_t ref) {
|
||||
return this->first() ? this->first()->find_by_ref(ref) : 0; }
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* _L4LX__TASK_H_ */
|
@ -1,111 +0,0 @@
|
||||
/*
|
||||
* \brief Vcpus for l4lx support library.
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-04-11
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _L4LX__VCPU_H_
|
||||
#define _L4LX__VCPU_H_
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/ipc.h>
|
||||
#include <base/sleep.h>
|
||||
#include <base/thread.h>
|
||||
#include <foc_native_cpu/client.h>
|
||||
#include <foc/native_thread.h>
|
||||
#include <cpu_session/client.h>
|
||||
#include <cpu_thread/client.h>
|
||||
#include <timer_session/connection.h>
|
||||
|
||||
namespace Fiasco {
|
||||
#include <l4/sys/utcb.h>
|
||||
}
|
||||
|
||||
namespace L4lx {
|
||||
|
||||
extern Genode::Cpu_session *cpu_connection();
|
||||
|
||||
|
||||
class Vcpu : public Genode::Thread
|
||||
{
|
||||
private:
|
||||
|
||||
enum { WEIGHT = Genode::Cpu_session::Weight::DEFAULT_WEIGHT };
|
||||
|
||||
Genode::Lock _lock;
|
||||
L4_CV void (*_func)(void *data);
|
||||
unsigned long _data;
|
||||
Genode::addr_t _vcpu_state;
|
||||
Timer::Connection _timer;
|
||||
unsigned _cpu_nr;
|
||||
Fiasco::l4_utcb_t * const _utcb;
|
||||
|
||||
Fiasco::l4_utcb_t *_init_utcb()
|
||||
{
|
||||
using namespace Genode;
|
||||
Foc_native_cpu_client native_cpu(env()->cpu_session()->native_cpu());
|
||||
return (Fiasco::l4_utcb_t *)native_cpu.thread_state(cap()).utcb;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
Vcpu(const char *str,
|
||||
L4_CV void (*func)(void *data),
|
||||
unsigned long *data,
|
||||
Genode::size_t stack_size,
|
||||
Genode::addr_t vcpu_state,
|
||||
unsigned cpu_nr)
|
||||
: Genode::Thread(WEIGHT, str, stack_size,
|
||||
Genode::Affinity::Location(cpu_nr, 0)),
|
||||
_lock(Genode::Cancelable_lock::LOCKED),
|
||||
_func(func),
|
||||
_data(data ? *data : 0),
|
||||
_vcpu_state(vcpu_state),
|
||||
_cpu_nr(cpu_nr),
|
||||
_utcb(_init_utcb())
|
||||
{
|
||||
start();
|
||||
|
||||
/* set l4linux specific utcb entry: L4X_UTCB_TCR_ID */
|
||||
l4_utcb_tcr_u(_utcb)->user[0] = native_thread().kcap;
|
||||
|
||||
/* enable vcpu functionality respectively */
|
||||
if (_vcpu_state) {
|
||||
Genode::Foc_native_cpu_client native_cpu(cpu_connection()->native_cpu());
|
||||
native_cpu.enable_vcpu(_thread_cap, _vcpu_state);
|
||||
}
|
||||
}
|
||||
|
||||
void entry()
|
||||
{
|
||||
_lock.lock();
|
||||
_func(&_data);
|
||||
Genode::sleep_forever();
|
||||
}
|
||||
|
||||
void unblock() { _lock.unlock(); }
|
||||
|
||||
Genode::addr_t sp() { return (Genode::addr_t)stack_top(); }
|
||||
|
||||
Genode::addr_t ip() { return (Genode::addr_t)_func; }
|
||||
|
||||
Fiasco::l4_utcb_t *utcb() { return _utcb; };
|
||||
|
||||
Timer::Connection* timer() { return &_timer; }
|
||||
|
||||
void set_affinity(unsigned i)
|
||||
{
|
||||
Genode::Cpu_thread_client(_thread_cap).affinity(Genode::Affinity::Location(i, 0));
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* _L4LX__VCPU_H_ */
|
@ -1,123 +0,0 @@
|
||||
/*
|
||||
* \brief L4Re functions needed by L4Linux.
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-04-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/env.h>
|
||||
#include <base/log.h>
|
||||
#include <io_mem_session/connection.h>
|
||||
|
||||
#include <env.h>
|
||||
|
||||
namespace Fiasco {
|
||||
#include <l4/io/io.h>
|
||||
}
|
||||
|
||||
using namespace Fiasco;
|
||||
|
||||
extern "C" {
|
||||
|
||||
l4io_device_handle_t l4io_get_root_device(void)
|
||||
{
|
||||
Genode::warning(__func__, " not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int l4io_iterate_devices(l4io_device_handle_t *devhandle,
|
||||
l4io_device_t *dev, l4io_resource_handle_t *reshandle)
|
||||
{
|
||||
Genode::warning(__func__, " not implemented");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int l4io_lookup_resource(l4io_device_handle_t devhandle,
|
||||
enum l4io_resource_types_t type,
|
||||
l4io_resource_handle_t *reshandle,
|
||||
l4io_resource_t *res)
|
||||
{
|
||||
Genode::warning(__func__, " not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
long l4io_request_ioport(unsigned portnum, unsigned len)
|
||||
{
|
||||
Genode::warning(__func__, " not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
long l4io_request_iomem_region(l4_addr_t phys, l4_addr_t virt,
|
||||
unsigned long size, int flags)
|
||||
{
|
||||
using namespace Genode;
|
||||
|
||||
Io_mem_connection *iomem = new (env()->heap()) Io_mem_connection(phys, size);
|
||||
L4lx::Dataspace *ds =
|
||||
L4lx::Env::env()->dataspaces()->insert("iomem", iomem->dataspace());
|
||||
if (!L4lx::Env::env()->rm()->attach_at(ds, size, 0, (void*)virt)) {
|
||||
error("could not reserve IO mem region at ", Hex(virt));
|
||||
L4lx::Env::env()->dataspaces()->remove(ds);
|
||||
destroy(env()->heap(), iomem);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
long l4io_search_iomem_region(l4_addr_t phys, l4_addr_t size,
|
||||
l4_addr_t *rstart, l4_addr_t *rsize)
|
||||
{
|
||||
Genode::warning(__func__, " not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
long l4io_request_iomem(l4_addr_t phys, unsigned long size, int flags,
|
||||
l4_addr_t *virt)
|
||||
{
|
||||
Genode::warning(__func__, " not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
long l4io_release_iomem(l4_addr_t virt, unsigned long size)
|
||||
{
|
||||
Genode::warning(__func__, " not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
long l4io_request_irq(int irqnum, l4_cap_idx_t irqcap)
|
||||
{
|
||||
Genode::warning(__func__, " not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
long l4io_release_irq(int irqnum, l4_cap_idx_t irq_cap)
|
||||
{
|
||||
Genode::warning(__func__, " not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int l4io_has_resource(enum l4io_resource_types_t type,
|
||||
l4vbus_paddr_t start, l4vbus_paddr_t end)
|
||||
{
|
||||
Genode::warning(__func__, " not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* \brief L4Re functions needed by L4Linux.
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-04-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/printf.h>
|
||||
|
||||
#include <linux.h>
|
||||
|
||||
namespace Fiasco {
|
||||
#include <l4/log/log.h>
|
||||
#include <l4/sys/kdebug.h>
|
||||
}
|
||||
|
||||
using namespace Fiasco;
|
||||
|
||||
extern "C" {
|
||||
|
||||
void LOG_printf(const char *format, ...)
|
||||
{
|
||||
Linux::Irq_guard guard;
|
||||
|
||||
va_list list;
|
||||
va_start(list, format);
|
||||
Genode::vprintf(format, list);
|
||||
}
|
||||
|
||||
|
||||
void LOG_vprintf(const char *format, va_list list)
|
||||
{
|
||||
Linux::Irq_guard guard;
|
||||
|
||||
Genode::vprintf(format, list);
|
||||
}
|
||||
|
||||
|
||||
void LOG_flush(void) {}
|
||||
|
||||
}
|
@ -1,117 +0,0 @@
|
||||
/*
|
||||
* \brief L4Re functions needed by L4Linux.
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-04-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/env.h>
|
||||
#include <base/log.h>
|
||||
#include <dataspace/client.h>
|
||||
|
||||
/* L4lx includes */
|
||||
#include <env.h>
|
||||
|
||||
namespace Fiasco {
|
||||
#include <l4/re/c/dataspace.h>
|
||||
#include <l4/sys/err.h>
|
||||
#include <l4/sys/kdebug.h>
|
||||
}
|
||||
|
||||
using namespace Fiasco;
|
||||
|
||||
extern "C" {
|
||||
|
||||
int l4re_ds_map_region(const l4re_ds_t ds, l4_addr_t offset, unsigned long flags,
|
||||
l4_addr_t min_addr, l4_addr_t max_addr)
|
||||
{
|
||||
using namespace L4lx;
|
||||
|
||||
Dataspace *ref = Env::env()->dataspaces()->find_by_ref(ds);
|
||||
if (!ref) {
|
||||
Genode::warning(__func__, ": ds=", Genode::Hex(ds), " doesn't exist");
|
||||
enter_kdebug("ENOTF");
|
||||
return L4_ERANGE;
|
||||
}
|
||||
|
||||
try {
|
||||
Genode::env()->rm_session()->attach_at(ref->cap(), min_addr);
|
||||
} catch(...) {
|
||||
Genode::warning(__func__, ": could not attach "
|
||||
"dataspace ", ref->name(), " at ", (void*)min_addr);
|
||||
enter_kdebug("EXC");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
long l4re_ds_size(const l4re_ds_t ds)
|
||||
{
|
||||
using namespace L4lx;
|
||||
|
||||
Dataspace *ref = Env::env()->dataspaces()->find_by_ref(ds);
|
||||
if (!ref) {
|
||||
Genode::warning(__func__, ": ds=", Genode::Hex(ds), " doesn't exist");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ref->size();
|
||||
}
|
||||
|
||||
|
||||
int l4re_ds_phys(const l4re_ds_t ds, l4_addr_t offset,
|
||||
l4_addr_t *phys_addr, l4_size_t *phys_size)
|
||||
{
|
||||
using namespace L4lx;
|
||||
|
||||
Dataspace *ref = Env::env()->dataspaces()->find_by_ref(ds);
|
||||
if (!ref) {
|
||||
Genode::warning(__func__, ": ds=", Genode::Hex(ds), " doesn't exist");
|
||||
enter_kdebug("ERR");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!ref->cap().valid()) {
|
||||
Genode::warning(__func__, ": cannot determine physical address for "
|
||||
"dataspace ", ref->name());
|
||||
return -1;
|
||||
}
|
||||
|
||||
Genode::Dataspace_client dsc(ref->cap());
|
||||
*phys_addr = dsc.phys_addr() + offset;
|
||||
*phys_size = dsc.size() - offset;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int l4re_ds_copy_in(const l4re_ds_t ds, l4_addr_t dst_offs, const l4re_ds_t src,
|
||||
l4_addr_t src_offs, unsigned long size)
|
||||
{
|
||||
Genode::warning(__func__, ": not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int l4re_ds_info(const l4re_ds_t ds, l4re_ds_stats_t *stats)
|
||||
{
|
||||
using namespace L4lx;
|
||||
|
||||
Dataspace *ref = Env::env()->dataspaces()->find_by_ref(ds);
|
||||
if (!ref) {
|
||||
Genode::warning(__func__, ": ds=", Genode::Hex(ds), " doesn't exist");
|
||||
return -1;
|
||||
}
|
||||
|
||||
stats->size = ref->size();
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
/*
|
||||
* \brief L4Re functions needed by L4Linux.
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-04-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/printf.h>
|
||||
|
||||
namespace Fiasco {
|
||||
#include <l4/re/c/debug.h>
|
||||
}
|
||||
|
||||
using namespace Fiasco;
|
||||
|
||||
extern "C" {
|
||||
|
||||
void l4re_debug_obj_debug(l4_cap_idx_t srv, unsigned long function)
|
||||
{
|
||||
PWRN("%s: Not implemented yet!",__func__);
|
||||
}
|
||||
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
/*
|
||||
* \brief L4Re functions needed by L4Linux.
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-04-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/log.h>
|
||||
#include <base/capability.h>
|
||||
#include <rm_session/connection.h>
|
||||
|
||||
/* L4lx includes */
|
||||
#include <dataspace.h>
|
||||
#include <env.h>
|
||||
|
||||
namespace Fiasco {
|
||||
#include <l4/re/c/mem_alloc.h>
|
||||
}
|
||||
|
||||
using namespace Fiasco;
|
||||
|
||||
extern "C" {
|
||||
|
||||
long l4re_ma_alloc(unsigned long size, l4re_ds_t const mem,
|
||||
unsigned long flags)
|
||||
{
|
||||
using namespace L4lx;
|
||||
|
||||
Dataspace *ds;
|
||||
if (Genode::log2(size) >= Chunked_dataspace::CHUNK_SIZE_LOG2) {
|
||||
ds = new (Genode::env()->heap())
|
||||
Chunked_dataspace("lx_memory", size, mem);
|
||||
} else {
|
||||
Genode::Dataspace_capability cap =
|
||||
Genode::env()->ram_session()->alloc(size);
|
||||
ds = new (Genode::env()->heap())
|
||||
Single_dataspace("lx_memory", size, cap, mem);
|
||||
}
|
||||
Env::env()->dataspaces()->insert(ds);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
long l4re_ma_alloc_align(unsigned long size, l4re_ds_t const mem,
|
||||
unsigned long flags, unsigned long align) {
|
||||
return l4re_ma_alloc(size, mem, flags); }
|
||||
|
||||
|
||||
long l4re_ma_free(l4re_ds_t const mem)
|
||||
{
|
||||
Genode::warning(__func__, " not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* \brief L4Re functions needed by L4Linux.
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-04-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/log.h>
|
||||
|
||||
namespace Fiasco {
|
||||
#include <l4/re/c/namespace.h>
|
||||
}
|
||||
|
||||
using namespace Fiasco;
|
||||
|
||||
extern "C" {
|
||||
|
||||
long l4re_ns_query_srv(l4re_namespace_t srv, char const *name,
|
||||
l4_cap_idx_t const cap)
|
||||
{
|
||||
Genode::log(__func__, ": srv=", Genode::Hex(srv), " name=", name, " "
|
||||
"cap=", Genode::Hex(cap));
|
||||
|
||||
Genode::warning(__func__, " not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
@ -1,150 +0,0 @@
|
||||
/*
|
||||
* \brief L4Re functions needed by L4Linux.
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-04-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/env.h>
|
||||
#include <base/log.h>
|
||||
#include <base/stdint.h>
|
||||
#include <util/touch.h>
|
||||
|
||||
#include <env.h>
|
||||
|
||||
namespace Fiasco {
|
||||
#include <l4/re/c/rm.h>
|
||||
#include <l4/sys/err.h>
|
||||
#include <l4/sys/kdebug.h>
|
||||
}
|
||||
|
||||
using namespace Fiasco;
|
||||
|
||||
enum {
|
||||
L4RE_SEARCH_FOR_REGION = 0x20,
|
||||
L4RE_REGION_RESERVED = 0x08
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
|
||||
int l4re_rm_find(l4_addr_t *addr, unsigned long *size, l4_addr_t *offset,
|
||||
unsigned *flags, l4re_ds_t *m)
|
||||
{
|
||||
using namespace L4lx;
|
||||
|
||||
*m = L4_INVALID_CAP;
|
||||
Region *r = Env::env()->rm()->find_region(addr, (Genode::size_t*)size);
|
||||
if (r) {
|
||||
if (r->ds())
|
||||
*m = r->ds()->ref();
|
||||
*flags = L4RE_REGION_RESERVED;
|
||||
} else
|
||||
*flags = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int l4re_rm_attach(void **start, unsigned long size, unsigned long flags,
|
||||
l4re_ds_t const mem, l4_addr_t offs,
|
||||
unsigned char align)
|
||||
{
|
||||
using namespace Genode;
|
||||
|
||||
void *original_start = *start;
|
||||
|
||||
L4lx::Dataspace *ds = L4lx::Env::env()->dataspaces()->find_by_ref(mem);
|
||||
if (!ds) {
|
||||
error(__func__, "mem=", Hex(mem), " doesn't exist");
|
||||
return -L4_ERANGE;
|
||||
}
|
||||
|
||||
while (!L4lx::Env::env()->rm()->attach_at(ds, size, offs, *start)) {
|
||||
if (flags & L4RE_SEARCH_FOR_REGION) /* search flag */ {
|
||||
/* the original start address might have a different alignment */
|
||||
l4_addr_t start_addr = (l4_addr_t)*start;
|
||||
l4_addr_t aligned_start_addr = align_addr(start_addr, align);
|
||||
if (aligned_start_addr != start_addr) {
|
||||
*start = (void*)aligned_start_addr;
|
||||
} else {
|
||||
if (start_addr <= ((addr_t)~0 - 2*(1 << align) + 1)) {
|
||||
start_addr += (1 << align);
|
||||
*start = (void*)start_addr;
|
||||
} else {
|
||||
warning(__func__, ": couldn't attach ds of "
|
||||
"size ", Hex(size), " at ", original_start);
|
||||
return -L4_ERANGE;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
warning(__func__, ": couldn't attach ds of "
|
||||
"size ", Hex(size), " at ", original_start);
|
||||
return -L4_ERANGE;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int l4re_rm_detach(void *addr)
|
||||
{
|
||||
Genode::addr_t start = (Genode::addr_t) addr;
|
||||
Genode::size_t size = 0;
|
||||
|
||||
L4lx::Region *r = L4lx::Env::env()->rm()->find_region(&start, &size);
|
||||
if (!r) {
|
||||
Genode::warning(__func__, ": nothing found at ", addr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
Genode::env()->rm_session()->detach(addr);
|
||||
L4lx::Env::env()->rm()->free((void*)start);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int l4re_rm_reserve_area(l4_addr_t *start, unsigned long size,
|
||||
unsigned flags, unsigned char align)
|
||||
{
|
||||
L4lx::Region *r = L4lx::Env::env()->rm()->reserve_range(size, align, *start);
|
||||
if (r) {
|
||||
*start = (l4_addr_t) r->addr();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Genode::warning(__func__, ": could not reserve area!");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int l4re_rm_free_area(l4_addr_t addr)
|
||||
{
|
||||
L4lx::Region* md = L4lx::Env::env()->rm()->metadata((void*)addr);
|
||||
|
||||
if (!md) {
|
||||
Genode::warning(__func__, ": no region found at ", Genode::Hex(addr));
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* gets freed only if there is no dataspace attached */
|
||||
if (!md->ds()->cap().valid())
|
||||
L4lx::Env::env()->rm()->free((void*)addr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void l4re_rm_show_lists(void)
|
||||
{
|
||||
L4lx::Env::env()->rm()->dump();
|
||||
}
|
||||
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* \brief L4Re functions needed by L4Linux.
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-04-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/log.h>
|
||||
#include <foc/capability_space.h>
|
||||
|
||||
namespace Fiasco {
|
||||
#include <l4/re/c/util/cap.h>
|
||||
#include <l4/re/c/util/cap_alloc.h>
|
||||
}
|
||||
|
||||
using namespace Fiasco;
|
||||
|
||||
extern "C" {
|
||||
|
||||
l4_cap_idx_t l4re_util_cap_alloc(void)
|
||||
{
|
||||
l4_cap_idx_t ret = Genode::Capability_space::alloc_kcap();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void l4re_util_cap_free(l4_cap_idx_t cap)
|
||||
{
|
||||
Genode::warning(__func__, " not implemented");
|
||||
}
|
||||
|
||||
|
||||
l4_msgtag_t l4re_util_cap_release(l4_cap_idx_t cap)
|
||||
{
|
||||
l4_msgtag_t ret = l4_msgtag(0, 0, 0, 0);
|
||||
Genode::warning(__func__, " not implemented");
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
/*
|
||||
* \brief L4Re functions needed by L4Linux.
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-04-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/log.h>
|
||||
#include <rom_session/connection.h>
|
||||
#include <dataspace/client.h>
|
||||
|
||||
#include <env.h>
|
||||
|
||||
namespace Fiasco {
|
||||
#include <l4/re/env.h>
|
||||
#include <l4/sys/kdebug.h>
|
||||
}
|
||||
|
||||
using namespace Fiasco;
|
||||
|
||||
static l4re_env_t __l4re_env;
|
||||
|
||||
extern void* l4lx_kinfo;
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
l4re_env_cap_entry_t const * l4re_env_get_cap_l(char const *name,
|
||||
unsigned l,
|
||||
l4re_env_t const *e)
|
||||
{
|
||||
using namespace L4lx;
|
||||
|
||||
try {
|
||||
Genode::Rom_connection rom(name);
|
||||
Genode::size_t size = Genode::Dataspace_client(rom.dataspace()).size();
|
||||
Genode::Dataspace_capability cap = Genode::env()->ram_session()->alloc(size);
|
||||
|
||||
void *dst = Genode::env()->rm_session()->attach(cap);
|
||||
void *src = Genode::env()->rm_session()->attach(rom.dataspace());
|
||||
|
||||
Genode::memcpy(dst, src, size);
|
||||
Genode::env()->rm_session()->detach(src);
|
||||
Genode::env()->rm_session()->detach(dst);
|
||||
|
||||
l4re_env_cap_entry_t *entry = new (Genode::env()->heap())
|
||||
l4re_env_cap_entry_t();
|
||||
Dataspace *ds = new (Genode::env()->heap())
|
||||
Single_dataspace("initrd", size, cap);
|
||||
Env::env()->dataspaces()->insert(ds);
|
||||
entry->cap = ds->ref();
|
||||
return entry;
|
||||
} catch(Genode::Rom_connection::Rom_connection_failed) {
|
||||
Genode::warning(__func__, ": file ", name, " is missing");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
l4_kernel_info_t *l4re_kip(void)
|
||||
{
|
||||
return (l4_kernel_info_t*) l4lx_kinfo;
|
||||
}
|
||||
|
||||
|
||||
l4re_env_t *l4re_env(void)
|
||||
{
|
||||
return &__l4re_env;
|
||||
}
|
||||
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
/*
|
||||
* \brief L4Re functions needed by L4Linux.
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2012-08-31
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2012-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#include <cpu/atomic.h>
|
||||
|
||||
namespace Fiasco {
|
||||
#include <l4/util/atomic.h>
|
||||
}
|
||||
|
||||
using namespace Fiasco;
|
||||
|
||||
extern "C" {
|
||||
|
||||
int l4util_cmpxchg(volatile l4_umword_t * dest,
|
||||
l4_umword_t cmp_val, l4_umword_t new_val)
|
||||
{
|
||||
return Genode::cmpxchg((volatile int*)dest, cmp_val, new_val);
|
||||
}
|
||||
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
/*
|
||||
* \brief L4Re functions needed by L4Linux.
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-04-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#include <base/printf.h>
|
||||
|
||||
namespace Fiasco {
|
||||
#include <l4/util/cpu.h>
|
||||
}
|
||||
|
||||
using namespace Fiasco;
|
||||
|
||||
extern "C" {
|
||||
|
||||
unsigned int l4util_cpu_capabilities(void)
|
||||
{
|
||||
PWRN("%s: Not implemented yet!",__func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
/*
|
||||
* \brief L4Re functions needed by L4Linux.
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-04-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#include <base/printf.h>
|
||||
#include <util/string.h>
|
||||
|
||||
namespace Fiasco {
|
||||
#include <l4/util/kip.h>
|
||||
}
|
||||
|
||||
#include <linux.h>
|
||||
|
||||
using namespace Fiasco;
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
FASTCALL unsigned long int simple_strtoul(const char *nptr, char **endptr,
|
||||
int base);
|
||||
|
||||
|
||||
int l4util_kip_kernel_has_feature(l4_kernel_info_t *k, const char *str)
|
||||
{
|
||||
const char *s = l4_kip_version_string(k);
|
||||
if (!s) {
|
||||
PWRN("Kip parsing failed!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (s += Genode::strlen(s) + 1; *s; s += Genode::strlen(s) + 1)
|
||||
if (Genode::strcmp(s, str) == 0)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
unsigned long l4util_kip_kernel_abi_version(l4_kernel_info_t *k)
|
||||
{
|
||||
const char *s = l4_kip_version_string(k);
|
||||
if (!s)
|
||||
return 0;
|
||||
|
||||
for (s += Genode::strlen(s) + 1; *s; s += Genode::strlen(s) + 1)
|
||||
if (Genode::strcmp(s, "abiver:", 7) == 0)
|
||||
return simple_strtoul(s + 7, NULL, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
/*
|
||||
* \brief L4Re functions needed by L4Linux.
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-04-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#include <base/printf.h>
|
||||
#include <vcpu.h>
|
||||
|
||||
namespace Fiasco {
|
||||
#include <l4/util/util.h>
|
||||
}
|
||||
|
||||
using namespace Fiasco;
|
||||
|
||||
extern "C" {
|
||||
|
||||
void l4_sleep(int ms)
|
||||
{
|
||||
L4lx::Vcpu *vcpu = static_cast<L4lx::Vcpu*>(Genode::Thread::myself());
|
||||
if (vcpu)
|
||||
vcpu->timer()->msleep(ms);
|
||||
else {
|
||||
static Timer::Connection timer;
|
||||
timer.msleep(ms);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void l4_sleep_forever(void)
|
||||
{
|
||||
for (;;)
|
||||
l4_ipc_sleep(L4_IPC_NEVER);
|
||||
}
|
||||
|
||||
}
|
@ -1,256 +0,0 @@
|
||||
/*
|
||||
* \brief L4lxapi library IRQ functions.
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-04-11
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/log.h>
|
||||
#include <base/snprintf.h>
|
||||
|
||||
#include <env.h>
|
||||
#include <l4lx_irq.h>
|
||||
#include <l4lx_thread.h>
|
||||
#include <vcpu.h>
|
||||
|
||||
namespace Fiasco {
|
||||
#include <l4/sys/types.h>
|
||||
#include <l4/sys/kdebug.h>
|
||||
#include <l4/sys/kip.h>
|
||||
#include <l4/sys/vcpu.h>
|
||||
#include <l4/sys/irq.h>
|
||||
}
|
||||
|
||||
using namespace Fiasco;
|
||||
|
||||
enum { TIMER_IRQ = 0 };
|
||||
|
||||
unsigned int l4lx_irq_max = l4x_nr_irqs();
|
||||
|
||||
extern l4_kernel_info_t *l4lx_kinfo;
|
||||
|
||||
extern "C" {
|
||||
|
||||
FASTCALL l4_cap_idx_t l4x_have_irqcap(int irqnum);
|
||||
|
||||
|
||||
void l4lx_irq_init(void) { }
|
||||
|
||||
|
||||
int l4lx_irq_prio_get(unsigned int irq)
|
||||
{
|
||||
NOT_IMPLEMENTED;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
unsigned int l4lx_irq_dev_startup(struct irq_data *data)
|
||||
{
|
||||
unsigned irq = data->irq;
|
||||
struct l4x_irq_desc_private *p =
|
||||
(struct l4x_irq_desc_private*) irq_get_chip_data(irq);
|
||||
|
||||
/* First test whether a capability has been registered with
|
||||
* this IRQ number */
|
||||
p->irq_cap = l4x_have_irqcap(irq);
|
||||
p->cpu = l4x_smp_processor_id();
|
||||
if (l4_is_invalid_cap(p->irq_cap)) {
|
||||
Genode::error("invalid irq cap!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
l4lx_irq_dev_enable(data);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void l4lx_irq_dev_shutdown(struct irq_data *data)
|
||||
{
|
||||
|
||||
if (data->irq == TIMER_IRQ) {
|
||||
Genode::warning("timer shutdown not implemented yet");
|
||||
return;
|
||||
}
|
||||
|
||||
l4lx_irq_dev_disable(data);
|
||||
}
|
||||
|
||||
|
||||
int l4lx_irq_set_type(struct irq_data *data, unsigned int type)
|
||||
{
|
||||
NOT_IMPLEMENTED;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void l4lx_irq_dev_enable(struct irq_data *data)
|
||||
{
|
||||
struct l4x_irq_desc_private *p =
|
||||
(struct l4x_irq_desc_private*) irq_get_chip_data(data->irq);;
|
||||
unsigned long flags = 0;
|
||||
p->enabled = 1;
|
||||
|
||||
l4x_irq_save(&flags);
|
||||
l4_msgtag_t ret = l4_irq_attach(p->irq_cap, data->irq << 2,
|
||||
l4x_cpu_thread_get_cap(p->cpu));
|
||||
if (l4_error(ret))
|
||||
Genode::warning("attach to irq ", Genode::Hex(p->irq_cap), " "
|
||||
"failed, error=", l4_error(ret));
|
||||
l4x_irq_restore(flags);
|
||||
|
||||
l4lx_irq_dev_eoi(data);
|
||||
}
|
||||
|
||||
|
||||
void l4lx_irq_dev_disable(struct irq_data *data)
|
||||
{
|
||||
struct l4x_irq_desc_private *p =
|
||||
(struct l4x_irq_desc_private*) irq_get_chip_data(data->irq);;
|
||||
p->enabled = 0;
|
||||
|
||||
Linux::Irq_guard guard;
|
||||
if (l4_error(l4_irq_detach(p->irq_cap)))
|
||||
Genode::warning("unable to detach from IRQ ", data->irq);
|
||||
}
|
||||
|
||||
|
||||
void l4lx_irq_dev_ack(struct irq_data *data) { }
|
||||
|
||||
|
||||
void l4lx_irq_dev_mask(struct irq_data *data)
|
||||
{
|
||||
NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
void l4lx_irq_dev_mask_ack(struct irq_data *data)
|
||||
{
|
||||
// NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
void l4lx_irq_dev_unmask(struct irq_data *data)
|
||||
{
|
||||
// NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
int l4lx_irq_dev_set_affinity(struct irq_data *data,
|
||||
const struct cpumask *dest, bool force)
|
||||
{
|
||||
struct l4x_irq_desc_private *p =
|
||||
(struct l4x_irq_desc_private*) irq_get_chip_data(data->irq);;
|
||||
|
||||
if (!p->irq_cap)
|
||||
return 0;
|
||||
|
||||
unsigned target_cpu = l4x_target_cpu(dest);
|
||||
|
||||
if ((int)target_cpu == -1)
|
||||
return 1;
|
||||
if (target_cpu == p->cpu)
|
||||
return 0;
|
||||
|
||||
unsigned long flags = 0;
|
||||
l4x_migrate_lock(&flags);
|
||||
if (l4_error(l4_irq_detach(p->irq_cap)))
|
||||
Genode::warning("unable to detach from IRQ ", data->irq);
|
||||
|
||||
l4x_cpumask_copy(data, dest);
|
||||
p->cpu = target_cpu;
|
||||
|
||||
Genode::log("switched irq ", data->irq, " to cpu ", target_cpu);
|
||||
|
||||
l4_msgtag_t ret = l4_irq_attach(p->irq_cap, data->irq << 2,
|
||||
l4x_cpu_thread_get_cap(p->cpu));
|
||||
if (l4_error(ret))
|
||||
Genode::warning("attach to irq ", p->irq_cap, " failed, error=", l4_error(ret));
|
||||
|
||||
if (p->enabled)
|
||||
l4_irq_unmask(p->irq_cap);
|
||||
|
||||
l4x_migrate_unlock(flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void l4lx_irq_dev_eoi(struct irq_data *data)
|
||||
{
|
||||
struct l4x_irq_desc_private *p =
|
||||
(struct l4x_irq_desc_private*) irq_get_chip_data(data->irq);;
|
||||
|
||||
Linux::Irq_guard guard;
|
||||
l4_irq_unmask(p->irq_cap);
|
||||
}
|
||||
|
||||
|
||||
unsigned int l4lx_irq_timer_startup(struct irq_data *data)
|
||||
{
|
||||
NOT_IMPLEMENTED;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void l4lx_irq_timer_shutdown(struct irq_data *data)
|
||||
{
|
||||
NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
void l4lx_irq_timer_enable(struct irq_data *data)
|
||||
{
|
||||
NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
void l4lx_irq_timer_disable(struct irq_data *data)
|
||||
{
|
||||
NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
void l4lx_irq_timer_ack(struct irq_data *data)
|
||||
{
|
||||
NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
void l4lx_irq_timer_mask(struct irq_data *data)
|
||||
{
|
||||
NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
void l4lx_irq_timer_unmask(struct irq_data *data)
|
||||
{
|
||||
NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
int l4lx_irq_timer_set_affinity(struct irq_data *data, const struct cpumask *dest)
|
||||
{
|
||||
NOT_IMPLEMENTED;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int l4x_alloc_irq_desc_data(int irq)
|
||||
{
|
||||
struct l4x_irq_desc_private *p;
|
||||
Genode::env()->heap()->alloc(sizeof(struct l4x_irq_desc_private), (void**)&p);
|
||||
if (!p) {
|
||||
Genode::warning("could not allocate irq descriptor memory!");
|
||||
return -12; //ENOMEM;
|
||||
}
|
||||
|
||||
return irq_set_chip_data(irq, p);
|
||||
}
|
||||
|
||||
}
|
@ -1,86 +0,0 @@
|
||||
/*
|
||||
* \brief L4lxapi library memory functions.
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-04-11
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/printf.h>
|
||||
|
||||
#include <l4lx_memory.h>
|
||||
#include <env.h>
|
||||
|
||||
namespace Fiasco {
|
||||
#include <l4/sys/consts.h>
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
||||
void l4lx_memory_map_physical_page(unsigned long page)
|
||||
{
|
||||
void* phys = (void*)Fiasco::l4_trunc_page(page);
|
||||
L4lx::Env::env()->rm()->map(phys);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Map a page into the virtual address space.
|
||||
* \ingroup memory
|
||||
*
|
||||
* \param address Virtual address.
|
||||
* \param page Physical address.
|
||||
* \param map_rw True if map should be mapped rw.
|
||||
*
|
||||
* \return 0 on success, != 0 on error
|
||||
*/
|
||||
int l4lx_memory_map_virtual_page(unsigned long address, unsigned long page,
|
||||
int map_rw)
|
||||
{
|
||||
Linux::Irq_guard guard;
|
||||
|
||||
void* phys = (void*)Fiasco::l4_trunc_page(page);
|
||||
void* virt = (void*)Fiasco::l4_trunc_page(address);
|
||||
L4lx::Env::env()->rm()->add_mapping(phys, virt, map_rw);
|
||||
L4lx::Env::env()->rm()->map(phys);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Unmap a page from the virtual address space.
|
||||
* \ingroup memory
|
||||
*
|
||||
* \param address Virtual adress.
|
||||
*
|
||||
* \return 0 on success, != 0 on error
|
||||
*/
|
||||
int l4lx_memory_unmap_virtual_page(unsigned long address)
|
||||
{
|
||||
Linux::Irq_guard guard;
|
||||
|
||||
L4lx::Env::env()->rm()->remove_mapping((void*)Fiasco::l4_trunc_page(address));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Return if something is mapped at given address
|
||||
* \ingroup memory
|
||||
*
|
||||
* \param address Address to query
|
||||
*
|
||||
* \return 1 if a page is mapped, 0 if not
|
||||
*/
|
||||
int l4lx_memory_page_mapped(unsigned long address)
|
||||
{
|
||||
Linux::Irq_guard guard;
|
||||
|
||||
return (L4lx::Env::env()->rm()->phys((void*)Fiasco::l4_trunc_page(address))) ? 1 : 0;
|
||||
}
|
||||
|
||||
}
|
@ -1,173 +0,0 @@
|
||||
/*
|
||||
* \brief L4lxapi library task functions.
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-04-11
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/printf.h>
|
||||
#include <foc/capability_space.h>
|
||||
|
||||
#include <env.h>
|
||||
#include <l4lx_task.h>
|
||||
|
||||
using namespace Fiasco;
|
||||
|
||||
enum {
|
||||
L4LX_TASK_DELETE_SPACE = 1,
|
||||
L4LX_TASK_DELETE_THREAD = 2,
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
|
||||
/**
|
||||
* \brief Initialize task management.
|
||||
* \ingroup task.
|
||||
*
|
||||
*
|
||||
* General information about tasks:
|
||||
* - The entity called task is meant for user space tasks in L4Linux,
|
||||
* i.e. threads running in another address space then the L4Linux
|
||||
* server
|
||||
* - The term "task" has no connection with L4 tasks.
|
||||
* - The task in L4Linux is represented by an (unsigned) integer
|
||||
* which is non-ambiguous in the L4Linux server (the same number can
|
||||
* exist in several L4Linux servers running in parallel though)
|
||||
*/
|
||||
void l4lx_task_init(void) { }
|
||||
|
||||
/**
|
||||
* \brief Allocate a task from the task management system for later use.
|
||||
* \ingroup task
|
||||
*
|
||||
* \return A valid task, or L4_NIL_ID if no task could be allocated.
|
||||
*/
|
||||
l4_cap_idx_t l4lx_task_number_allocate(void)
|
||||
{
|
||||
NOT_IMPLEMENTED;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Free task number after the task has been deleted.
|
||||
* \ingroup task
|
||||
*
|
||||
* \param task The task to delete.
|
||||
*
|
||||
* \return 0 on succes, -1 if task number invalid or already free
|
||||
*/
|
||||
int l4lx_task_number_free(l4_cap_idx_t task)
|
||||
{
|
||||
Linux::Irq_guard guard;
|
||||
|
||||
Genode::Capability_space::free_kcap(task);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Allocate a new task number and return threadid for user task.
|
||||
* \ingroup task
|
||||
*
|
||||
* \param parent_id If not NIL_ID, a new thread within
|
||||
* parent_id's address space will be
|
||||
* allocated, for CLONE_VM tasks.
|
||||
*
|
||||
* \retval id Thread ID of the user thread.
|
||||
*
|
||||
* \return 0 on success, != 0 on error
|
||||
*/
|
||||
int l4lx_task_get_new_task(l4_cap_idx_t parent_id,
|
||||
l4_cap_idx_t *id)
|
||||
{
|
||||
Linux::Irq_guard guard;
|
||||
|
||||
*id = Genode::Capability_space::alloc_kcap();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Create a (user) task. The pager is the Linux server.
|
||||
* \ingroup task
|
||||
*
|
||||
* \param task_no Task number of the task to be created
|
||||
* (task number is from l4lx_task_allocate()).
|
||||
* \return 0 on success, error code otherwise
|
||||
*
|
||||
* This function additionally sets the priority of the thread 0 to
|
||||
* CONFIG_L4_PRIO_USER_PROCESS.
|
||||
*
|
||||
*/
|
||||
int l4lx_task_create(l4_cap_idx_t task_no)
|
||||
{
|
||||
using namespace L4lx;
|
||||
|
||||
Linux::Irq_guard guard;
|
||||
|
||||
Env::env()->tasks()->insert(new (Genode::env()->heap()) Task(task_no));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int l4lx_task_create_thread_in_task(l4_cap_idx_t thread, l4_cap_idx_t task,
|
||||
l4_cap_idx_t pager, unsigned cpu)
|
||||
{
|
||||
NOT_IMPLEMENTED;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Create a (user) task.
|
||||
* \ingroup task
|
||||
*
|
||||
* \param task_no See l4lx_task_create
|
||||
* \param pager The pager for this task.
|
||||
*
|
||||
* \return See l4lx_task_create
|
||||
*/
|
||||
int l4lx_task_create_pager(l4_cap_idx_t task_no, l4_cap_idx_t pager)
|
||||
{
|
||||
NOT_IMPLEMENTED;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Terminate a task (and all its threads).
|
||||
* \ingroup task
|
||||
*
|
||||
* \param task Id of the task to delete.
|
||||
* \param option Delete options (currently only supported is
|
||||
* option=1: send exit signal to the events
|
||||
* server, option=0: send no exit signal to
|
||||
* events server)
|
||||
*
|
||||
* \return 0 on error (task delete failed, threads are not deleted)
|
||||
* != 0 on sucess:
|
||||
* 1 if the whole address space was deleted
|
||||
* 2 if just a thread was "deleted"
|
||||
*/
|
||||
int l4lx_task_delete_thread(l4_cap_idx_t thread)
|
||||
{
|
||||
NOT_IMPLEMENTED;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int l4lx_task_delete_task(l4_cap_idx_t task, unsigned option)
|
||||
{
|
||||
using namespace L4lx;
|
||||
|
||||
Linux::Irq_guard guard;
|
||||
|
||||
Task *entry = Env::env()->tasks()->find_by_ref(task);
|
||||
Env::env()->tasks()->remove(entry);
|
||||
destroy(Genode::env()->heap(), entry);
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user