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 printf("%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 printf("Failed to allocate device for 'L4UXinput'\n");
41 input->set_hid("L4UXinput");
43 (new Adr_resource(Adr_resource::Mmio_res
44 | Resource::F_fixed_size | Resource::F_fixed_addr,
46 vhwe->mem_start + vhwe->mem_size - 1));
48 (new Adr_resource(Adr_resource::Irq_res,
49 vhwe->irq_no, vhwe->irq_no));
50 bus->add_child(input);
54 if ((vhwe = l4_vhw_get_entry_type(vhw, L4_TYPE_VHW_FRAMEBUFFER)))
56 Hw::Device *fb = new Hw::Device();
59 printf("Failed to allocate device for 'L4UXfb'\n");
62 fb->set_hid("L4UXfb");
64 (new Adr_resource(Adr_resource::Mmio_res
65 | Resource::F_fixed_size | Resource::F_fixed_addr,
67 vhwe->mem_start + vhwe->mem_size - 1));
72 if ((vhwe = l4_vhw_get_entry_type(vhw, L4_TYPE_VHW_NET)))
74 Hw::Device *net = new Hw::Device();
77 printf("Failed to allocate device for 'L4UXnet'\n");
80 net->set_hid("L4UXnet");
82 (new Adr_resource(Adr_resource::Irq_res,
83 vhwe->irq_no, vhwe->irq_no));
85 (new Adr_resource(Adr_resource::Io_res,
86 vhwe->fd, vhwe->provider_pid));