FrostWing
A lightweight raw-control operating system.
Loading...
Searching...
No Matches
pci.h
Go to the documentation of this file.
1
11
12#ifndef PCI_H
13#define PCI_H
14
15#include <basics.h>
16#include <hal.h>
17#include <graphics.h>
18#include <drivers/rtl8139.h>
19#include <debugger.h>
20#include <ahci.h>
21#include <nvme.h>
22#include <hal.h>
23#include <isr.h>
24#include <pci_id.h>
25
26extern cstring display_adapter_name;
27extern cstring GPUName[2]; //Max 2 GPUs allowed
28extern cstring using_graphics_card;
29extern uint64* graphics_base_Address;
30extern int total_devices;
31
32// Define the base address for the PCI configuration space
33#define PCI_CONFIG_ADDRESS 0xCF8
34#define PCI_CONFIG_DATA 0xCFC
35
36typedef void (*pci_probe_fn)(uint8_t bus, uint8_t slot, uint8_t function);
37
38typedef struct {
39 uint16 bus;
40 uint16 slot;
41 uint16 func;
43
56uint16 pci_read_word(uint16 bus, uint16 slot, uint16 func, uint16 offset);
57
66uint16 getVendorID(uint16 bus, uint16 device, uint16 function);
67
76uint16 getDeviceID(uint16 bus, uint16 device, uint16 function);
77
86uint16 getClassId(uint16 bus, uint16 device, uint16 function);
87
96uint16 getSubClassId(uint16 bus, uint16 device, uint16 function);
97uint8 getRevision(uint16 bus, uint16 slot, uint16 func);
98uint8 getProgIF(uint16 bus, uint16 device, uint16 function);
99
104void probe_pci(void);
105void print_lspci(void);
106
116uint32 pci_config_read_dword(uint8 bus, uint8 slot, uint8 func, uint8 offset);
117void pci_config_write_dword(uint8 bus, uint8 slot, uint8 func, uint8 offset, uint32_t value);
118
128uint32 get_ahci_bar_address(uint8 bus, int slot, int func, int bar_num);
129
136
137#endif
Header definitions and structures for the AHCI Driver.
This is a basic header files with FrostWing specific short forms and basically a good for life header...
The headers files for E9 hack.
Contains all the print functions.
Header file for Hardware Abstraction Layer -> Source from GoGX OS.
Interrupts handler header.
uint32 get_ahci_bar_address(uint8 bus, int slot, int func, int bar_num)
Gets the AHCI bar address.
uint16 getDeviceID(uint16 bus, uint16 device, uint16 function)
Gets the Device ID from PCI.
uint16 getVendorID(uint16 bus, uint16 device, uint16 function)
Gets the Vendor ID from PCI.
uint16 getClassId(uint16 bus, uint16 device, uint16 function)
Gets the Class ID from PCI.
uint16 getSubClassId(uint16 bus, uint16 device, uint16 function)
Gets the Sub-class ID from PCI.
int proc_pci_register()
Registers the PCI devices into the procfs.
uint16 pci_read_word(uint16 bus, uint16 slot, uint16 func, uint16 offset)
Read a 16-bit value from a PCI configuration register.
uint32 pci_config_read_dword(uint8 bus, uint8 slot, uint8 func, uint8 offset)
Function to read a 32-bit value from the PCI configuration space.
void probe_pci(void)
Scans (Probes) PCI Devices.
The list of all officially recognized devices.