]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/io/server/src/vpci_pci_bridge.h
update
[l4.git] / l4 / pkg / io / server / src / vpci_pci_bridge.h
1 /*
2  * (c) 2010 Alexander Warg <warg@os.inf.tu-dresden.de>
3  *     economic rights: Technische Universität Dresden (Germany)
4  *
5  * This file is part of TUD:OS and distributed under the terms of the
6  * GNU General Public License 2.
7  * Please see the COPYING-GPL-2 file for details.
8  */
9
10 #pragma once
11
12 #include "vpci.h"
13
14 namespace Vi {
15
16 // -----------------------------------------------------------------------
17 // Virtual PCI to PCI bridge
18 // -----------------------------------------------------------------------
19
20 class Pci_to_pci_bridge : public Pci_bridge, public Pci_virtual_dev
21 {
22 private:
23   unsigned char _cfg_space[16*4];
24
25 public:
26   struct Bridge_cfg
27   {
28     l4_uint8_t io_base;
29     l4_uint8_t io_limit;
30     l4_uint16_t sec_status;
31     l4_uint16_t mem_base;
32     l4_uint16_t mem_limit;
33     l4_uint16_t pref_base;
34     l4_uint16_t pref_limit;
35     l4_uint32_t pref_base_upper;
36     l4_uint32_t pref_limit_upper;
37     l4_uint16_t io_base_upper;
38     l4_uint16_t io_limit_upper;
39   } __attribute__((packed));
40
41   Pci_to_pci_bridge();
42   int cfg_read(int reg, l4_uint32_t *v, Cfg_width o);
43   int cfg_write(int reg, l4_uint32_t v, Cfg_width o);
44
45   int irq_enable(Irq_info *irq)
46   {
47     irq->irq = -1;
48     return -1;
49   }
50
51   Bridge_cfg *bridge_cfg() const
52   { return reinterpret_cast<Bridge_cfg*>(_h + 7 * 4); }
53
54   bool is_vpci_bridge() const { return true; }
55
56   bool match_hw_feature(const Hw::Dev_feature*) const { return false; }
57   int dispatch(l4_umword_t, l4_uint32_t, L4::Ipc_iostream&)
58   { return -L4_ENOSYS; }
59
60
61 };
62
63 }