miniOS
x86_64 hobby kernel with SMP, VFS, and POSIX process model
Loading...
Searching...
No Matches
pci.h
Go to the documentation of this file.
1// MIT License
2//
3// Copyright (c) 2026 Christian Spoo
4//
5// Permission is hereby granted, free of charge, to any person obtaining a copy
6// of this software and associated documentation files (the "Software"), to deal
7// in the Software without restriction, including without limitation the rights
8// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9// copies of the Software, and to permit persons to whom the Software is
10// furnished to do so, subject to the following conditions:
11//
12// The above copyright notice and this permission notice shall be included in all
13// copies or substantial portions of the Software.
14//
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21// SOFTWARE.
22
23#ifndef _MINIOS_DRIVERS_PCI_H_
24#define _MINIOS_DRIVERS_PCI_H_
25
35
36#include <miniOS/types.h>
37
39#define PCI_MAX_DEVICES 64
40
63
66
68extern int pci_device_count;
69
81void pci_init(void);
82
93
102void pci_config_write32(uint8_t bus, uint8_t dev, uint8_t fn, uint8_t off, uint32_t val);
103
104#endif /* _MINIOS_DRIVERS_PCI_H_ */
void pci_init(void)
Definition pci.c:218
#define PCI_MAX_DEVICES
Definition pci.h:39
pci_device_t pci_devices[PCI_MAX_DEVICES]
Definition pci.c:42
void pci_config_write32(uint8_t bus, uint8_t dev, uint8_t fn, uint8_t off, uint32_t val)
Definition pci.c:58
uint32_t pci_config_read32(uint8_t bus, uint8_t dev, uint8_t fn, uint8_t off)
Definition pci.c:47
int pci_device_count
Definition pci.c:43
Definition pci.h:46
uint8_t irq_pin
Definition pci.h:59
uint16_t subsys_device
Definition pci.h:57
uint8_t fn
Definition pci.h:49
uint32_t bar[6]
Definition pci.h:60
uint16_t vendor_id
Definition pci.h:50
uint8_t irq_line
Definition pci.h:58
uint8_t header_type
Definition pci.h:61
uint16_t subsys_vendor
Definition pci.h:56
uint16_t device_id
Definition pci.h:51
uint8_t class_code
Definition pci.h:52
uint8_t prog_if
Definition pci.h:54
uint8_t subclass
Definition pci.h:53
uint8_t bus
Definition pci.h:47
uint8_t dev
Definition pci.h:48
uint8_t revision_id
Definition pci.h:55
unsigned short uint16_t
Definition types.h:31
unsigned int uint32_t
Definition types.h:34
unsigned char uint8_t
Definition types.h:28