2023-04-25 15:13:09 +00:00
|
|
|
// This file is part of noxos and licensed under the MIT open source license
|
2023-04-22 01:28:42 +00:00
|
|
|
|
2023-04-22 09:10:58 +00:00
|
|
|
#ifndef NOXOS_PCI_H
|
|
|
|
#define NOXOS_PCI_H
|
2023-04-22 01:28:42 +00:00
|
|
|
|
2023-04-25 15:13:09 +00:00
|
|
|
#include "utils/stdtypes.h"
|
|
|
|
#include "utils/string.h"
|
2023-04-22 01:28:42 +00:00
|
|
|
|
2023-04-25 15:13:09 +00:00
|
|
|
typedef struct {
|
|
|
|
uint16_t vendor_id;
|
|
|
|
uint16_t device_id;
|
|
|
|
uint16_t command_reg;
|
|
|
|
uint16_t status_reg;
|
|
|
|
uint8_t revision_id;
|
|
|
|
uint8_t progif; // Programming Interface Byte
|
|
|
|
uint8_t subclass;
|
|
|
|
uint8_t main_class;
|
|
|
|
uint8_t cache_line_size;
|
|
|
|
uint8_t latency_timer;
|
|
|
|
uint8_t header_type;
|
|
|
|
uint8_t bist; // Built-in Self-Test
|
|
|
|
} __attribute__((packed)) pci_device_header_T;
|
2023-04-22 01:28:42 +00:00
|
|
|
|
2023-04-25 15:13:09 +00:00
|
|
|
typedef struct {
|
|
|
|
pci_device_header_T header;
|
|
|
|
uint32_t bar0;
|
|
|
|
uint32_t bar1;
|
|
|
|
uint32_t bar2;
|
|
|
|
uint32_t bar3;
|
|
|
|
uint32_t bar4;
|
|
|
|
uint32_t bar5;
|
|
|
|
uint32_t cardbus_cis_pointer;
|
|
|
|
uint16_t subsystem_vendor_id;
|
|
|
|
uint16_t subsystem_id;
|
|
|
|
uint32_t expansion_rom_base_address;
|
|
|
|
uint8_t capabilities;
|
|
|
|
uint8_t reserved[7];
|
|
|
|
uint8_t interrupt_line;
|
|
|
|
uint8_t interrupt_pin;
|
|
|
|
uint8_t min_grant;
|
|
|
|
uint8_t max_latency;
|
|
|
|
} __attribute__((packed)) pci_header_0_T;
|
|
|
|
|
|
|
|
void pci_init ();
|
|
|
|
string_t pci_get_vendor_string (uint16_t vendor_id);
|
|
|
|
string_t pci_get_device_string (uint16_t device_id);
|
|
|
|
|
|
|
|
#endif // NOXOS_PCI_H
|