PCI: Improved syntax of PCI enumeration, Added a PCI information storage class and structs
This commit is contained in:
@ -1,17 +1,35 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
#include "io.h"
|
||||
#include "tty/kterm.h"
|
||||
#include "pci/pciDevice.h"
|
||||
|
||||
// Configuration Space Access Mechanism #1
|
||||
#define CONFIG_ADDRESS 0xCF8 // Configuration adress that is to be accessed
|
||||
#define CONFIG_DATA 0xCFC // Will do the actual configuration operation
|
||||
|
||||
extern const char* ClassCodeTable [0x13];
|
||||
|
||||
|
||||
|
||||
// Note: this could be used to make the api for receiving PCI class codes a bit
|
||||
// nicer.
|
||||
struct ClassCodes {
|
||||
uint8_t ClassCode;
|
||||
uint8_t DeviceClass;
|
||||
}__attribute__((packed));
|
||||
|
||||
uint32_t ConfigReadWord (uint8_t bus, uint8_t device, uint8_t func, uint8_t offset);
|
||||
uint32_t ConfigReadWord ( PCIBusAddress& PCIDeviceAddress , uint8_t offset);
|
||||
|
||||
inline uint64_t GetDevice (int bus, int device, int function ){
|
||||
return ConfigReadWord(bus, device, function,0x0);
|
||||
}
|
||||
|
||||
inline uint16_t getVendorID(uint8_t bus, uint8_t device, uint8_t function ){
|
||||
return ConfigReadWord ( bus , device, function, 0);
|
||||
}
|
||||
uint8_t GetHeaderType( PCIBusAddress& PCIDeviceAddress );
|
||||
|
||||
inline uint16_t getDeviceID(uint8_t bus, uint8_t device, uint8_t function ){
|
||||
return ConfigReadWord(bus, device, function , 16);
|
||||
}
|
||||
uint16_t GetClassCodes( PCIBusAddress& PICDeviceAddress );
|
||||
const char* getVendor( uint64_t VendorID);
|
||||
const char* GetClassCodeName (uint64_t ClassCode );
|
||||
|
||||
void PCI_Enumerate();
|
Reference in New Issue
Block a user