did for usb and pci buses
[quarnos.git] / resources / pci.h
blobe058389b756b72862d1cc8ced073cdd6189e1c26
1 /* Quarn OS
3 * PCI bus
5 * Copyright (C) 2008-2009 Pawel Dziepak
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #include "bus.h"
24 #include "arch/low/pci.h"
25 #include "did.h"
27 namespace resources {
28 class pci : public bus {
29 private:
30 int dev_count;
32 static const struct vendors_name {
33 u16 id;
34 const char *name;
35 } vendors[];
37 protected:
38 u32 get_pci_name(arch::pci_address);
40 int scan_bus();
42 public:
43 bool initialize();
44 bool type_added(manes::type_name);
46 int get_count();
48 string get_name(arch::pci_address);
50 static void register_type();
53 class pci_did : public did {
54 public:
55 int irq;
56 int ioport;
57 int dma_channel;
58 void *memory_base;
59 int bus, device, function;
61 pci_did(bus *b) : did(b) {}
62 pci_did() {}
63 virtual ~pci_did() {}