2 * (c) 2009 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.
10 #include <l4/vbus/vbus_pci.h>
11 #include <l4/vbus/vbus_generic>
12 #include <l4/cxx/ipc_stream>
15 l4vbus_pci_cfg_read(l4_cap_idx_t vbus, l4vbus_device_handle_t handle,
16 l4_uint32_t bus, l4_uint32_t devfn,
17 l4_uint32_t reg, l4_uint32_t *value, l4_uint32_t width)
19 L4::Ipc_iostream s(l4_utcb());
20 l4vbus_device_msg(handle, 0, s);
21 s << bus << devfn << reg << width;
22 int err = l4_error(s.call(vbus));
30 l4vbus_pci_cfg_write(l4_cap_idx_t vbus, l4vbus_device_handle_t handle,
31 l4_uint32_t bus, l4_uint32_t devfn,
32 l4_uint32_t reg, l4_uint32_t value, l4_uint32_t width)
34 L4::Ipc_iostream s(l4_utcb());
35 l4vbus_device_msg(handle, 1, s);
36 s << bus << devfn << reg << value << width;
37 return l4_error(s.call(vbus));
41 l4vbus_pci_irq_enable(l4_cap_idx_t vbus, l4vbus_device_handle_t handle,
42 l4_uint32_t bus, l4_uint32_t devfn,
43 int pin, unsigned char *trigger, unsigned char *polarity)
46 L4::Ipc_iostream s(l4_utcb());
47 l4vbus_device_msg(handle, 2, s);
48 s << bus << devfn << pin;
49 int err = l4_error(s.call(vbus));
53 s >> irq >> *trigger >> *polarity;