removed clang-format and clang_complete files from the repo
[dosdemo] / src / dos / pci.h
1 /*
2 S3 Virge driver hack
3 Copyright (C) 2021 John Tsiombikas <nuclear@member.fsf.org>
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program.  If not, see <https://www.gnu.org/licenses/>.
17 */
18 #ifndef PCI_H_
19 #define PCI_H_
20
21 #include "inttypes.h"
22 #include "util.h"
23
24 #pragma pack (push, 1)
25 struct pci_config_data {
26         uint16_t vendor, device;
27         uint16_t cmd, status;
28         uint8_t rev, iface, subclass, class;
29         uint8_t cacheline_size;
30         uint8_t latency_timer;
31         uint8_t hdr_type;
32         uint8_t bist;
33         uint32_t base_addr[6];
34         uint32_t cardbus_cis;
35         uint16_t subsys_vendor;
36         uint16_t subsys;
37         uint32_t rom_addr;
38         uint32_t reserved1, reserved2;
39         uint8_t intr_line, intr_pin;
40         uint8_t min_grant, max_latency;
41 } PACKED;
42 #pragma pop (push)
43
44 struct pci_device {
45         int bus, dev, func;
46         struct pci_config_data cfg;
47 };
48
49 int init_pci(void);
50
51 struct pci_device *find_pci_dev(uint16_t vendorid, uint16_t devid);
52
53 #endif  /* PCI_H_ */