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
46
typedef
struct
{
47
uint8_t
bus
;
48
uint8_t
dev
;
49
uint8_t
fn
;
50
uint16_t
vendor_id
;
51
uint16_t
device_id
;
52
uint8_t
class_code
;
53
uint8_t
subclass
;
54
uint8_t
prog_if
;
55
uint8_t
revision_id
;
56
uint16_t
subsys_vendor
;
57
uint16_t
subsys_device
;
58
uint8_t
irq_line
;
59
uint8_t
irq_pin
;
60
uint32_t
bar
[6];
61
uint8_t
header_type
;
62
}
pci_device_t
;
63
65
extern
pci_device_t
pci_devices
[
PCI_MAX_DEVICES
];
66
68
extern
int
pci_device_count
;
69
81
void
pci_init
(
void
);
82
92
uint32_t
pci_config_read32
(
uint8_t
bus,
uint8_t
dev,
uint8_t
fn,
uint8_t
off);
93
102
void
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_ */
pci_init
void pci_init(void)
Definition
pci.c:218
PCI_MAX_DEVICES
#define PCI_MAX_DEVICES
Definition
pci.h:39
pci_devices
pci_device_t pci_devices[PCI_MAX_DEVICES]
Definition
pci.c:42
pci_config_write32
void pci_config_write32(uint8_t bus, uint8_t dev, uint8_t fn, uint8_t off, uint32_t val)
Definition
pci.c:58
pci_config_read32
uint32_t pci_config_read32(uint8_t bus, uint8_t dev, uint8_t fn, uint8_t off)
Definition
pci.c:47
pci_device_count
int pci_device_count
Definition
pci.c:43
pci_device_t
Definition
pci.h:46
pci_device_t::irq_pin
uint8_t irq_pin
Definition
pci.h:59
pci_device_t::subsys_device
uint16_t subsys_device
Definition
pci.h:57
pci_device_t::fn
uint8_t fn
Definition
pci.h:49
pci_device_t::bar
uint32_t bar[6]
Definition
pci.h:60
pci_device_t::vendor_id
uint16_t vendor_id
Definition
pci.h:50
pci_device_t::irq_line
uint8_t irq_line
Definition
pci.h:58
pci_device_t::header_type
uint8_t header_type
Definition
pci.h:61
pci_device_t::subsys_vendor
uint16_t subsys_vendor
Definition
pci.h:56
pci_device_t::device_id
uint16_t device_id
Definition
pci.h:51
pci_device_t::class_code
uint8_t class_code
Definition
pci.h:52
pci_device_t::prog_if
uint8_t prog_if
Definition
pci.h:54
pci_device_t::subclass
uint8_t subclass
Definition
pci.h:53
pci_device_t::bus
uint8_t bus
Definition
pci.h:47
pci_device_t::dev
uint8_t dev
Definition
pci.h:48
pci_device_t::revision_id
uint8_t revision_id
Definition
pci.h:55
types.h
uint16_t
unsigned short uint16_t
Definition
types.h:31
uint32_t
unsigned int uint32_t
Definition
types.h:34
uint8_t
unsigned char uint8_t
Definition
types.h:28
include
miniOS
drivers
pci.h
Generated by
1.16.1