2 * (c) 2010 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
3 * Alexander Warg <warg@os.inf.tu-dresden.de>
4 * economic rights: Technische Universität Dresden (Germany)
6 * This file is part of TUD:OS and distributed under the terms of the
7 * GNU General Public License 2.
8 * Please see the COPYING-GPL-2 file for details.
11 #include <l4/sys/vhw.h>
12 #include <l4/re/env.h>
16 #include "hw_device.h"
20 void ux_setup(Hw::Device *bus)
23 struct l4_vhw_descriptor *vhw;
24 struct l4_vhw_entry *vhwe;
26 if (!(vhw = l4_vhw_get(l4re_kip())))
28 d_printf(DBG_WARN, "%s: No VHWs found.\n", __func__);
32 if ((vhwe = l4_vhw_get_entry_type(vhw, L4_TYPE_VHW_INPUT))
35 Hw::Device *input = new Hw::Device();
38 d_printf(DBG_ERR, "Failed to allocate device for 'L4UXinput'\n");
41 input->set_hid("L4UXinput");
43 (new Resource(Resource::Mmio_res,
45 vhwe->mem_start + vhwe->mem_size - 1));
47 (new Resource(Resource::Irq_res,
48 vhwe->irq_no, vhwe->irq_no));
49 bus->add_child(input);
53 if ((vhwe = l4_vhw_get_entry_type(vhw, L4_TYPE_VHW_FRAMEBUFFER)))
55 Hw::Device *fb = new Hw::Device();
58 d_printf(DBG_ERR, "Failed to allocate device for 'L4UXfb'\n");
61 fb->set_hid("L4UXfb");
63 (new Resource(Resource::Mmio_res,
65 vhwe->mem_start + vhwe->mem_size - 1));
70 if ((vhwe = l4_vhw_get_entry_type(vhw, L4_TYPE_VHW_NET)))
72 Hw::Device *net = new Hw::Device();
75 d_printf(DBG_ERR, "Failed to allocate device for 'L4UXnet'\n");
78 net->set_hid("L4UXnet");
80 (new Resource(Resource::Irq_res,
81 vhwe->irq_no, vhwe->irq_no));
83 (new Resource(Resource::Io_res,
84 vhwe->fd, vhwe->provider_pid));