Merge branch 'pci' into disk
This commit is contained in:
commit
a6ecb101b6
|
@ -27,6 +27,7 @@
|
||||||
#include <mm/paging.h>
|
#include <mm/paging.h>
|
||||||
|
|
||||||
static void *pciConfigBaseAddress = NULL;
|
static void *pciConfigBaseAddress = NULL;
|
||||||
|
static MCFG_t *MCFG_table = NULL;
|
||||||
|
|
||||||
// -------------------------------------------------------------------------- //
|
// -------------------------------------------------------------------------- //
|
||||||
|
|
||||||
|
@ -114,6 +115,7 @@ void IoPciEnumerate()
|
||||||
for(uchar device = 0; device < 32; device++) {
|
for(uchar device = 0; device < 32; device++) {
|
||||||
for(uchar function = 0; function < 8; function++) {
|
for(uchar function = 0; function < 8; function++) {
|
||||||
ushort vendor = pciReadConfigWord((uchar)bus, device, function, PCI_REG_VENDOR);
|
ushort vendor = pciReadConfigWord((uchar)bus, device, function, PCI_REG_VENDOR);
|
||||||
|
if(bus * device * function > MCFG_table->length) break;
|
||||||
if(vendor == 0xffff) continue;
|
if(vendor == 0xffff) continue;
|
||||||
DebugLog("PCI device class: %x, subclass: %x, vendor: %x, device: %x\n",
|
DebugLog("PCI device class: %x, subclass: %x, vendor: %x, device: %x\n",
|
||||||
pciReadConfigByte((uchar)bus, device, function, PCI_REG_CLASS),
|
pciReadConfigByte((uchar)bus, device, function, PCI_REG_CLASS),
|
||||||
|
@ -138,6 +140,7 @@ PciDev_t *IoPciGetDevice(ushort vendorID, ushort deviceID)
|
||||||
for(uchar function = 0; function < 8; function++) {
|
for(uchar function = 0; function < 8; function++) {
|
||||||
if(vendorID == pciReadConfigWord((uchar)bus, device, function, PCI_REG_VENDOR)
|
if(vendorID == pciReadConfigWord((uchar)bus, device, function, PCI_REG_VENDOR)
|
||||||
&& deviceID == pciReadConfigWord((uchar)bus, device, function, PCI_REG_DEVICE)) {
|
&& deviceID == pciReadConfigWord((uchar)bus, device, function, PCI_REG_DEVICE)) {
|
||||||
|
if(bus * device * function > MCFG_table->length) break;
|
||||||
PciDev_t *pciDevicePtr = (PciDev_t *)malloc(sizeof(PciDev_t));
|
PciDev_t *pciDevicePtr = (PciDev_t *)malloc(sizeof(PciDev_t));
|
||||||
pciDevicePtr->vendorID = vendorID;
|
pciDevicePtr->vendorID = vendorID;
|
||||||
pciDevicePtr->deviceID = deviceID;
|
pciDevicePtr->deviceID = deviceID;
|
||||||
|
@ -180,7 +183,7 @@ PciDev_t *IoPciGetDeviceByClass(uchar classID, uchar subclassID)
|
||||||
|
|
||||||
void IoInitPCI()
|
void IoInitPCI()
|
||||||
{
|
{
|
||||||
MCFG_t *MCFG_table = (MCFG_t*)IoGetAcpiTable(SDT_MCFG);
|
MCFG_table = (MCFG_t*)IoGetAcpiTable(SDT_MCFG);
|
||||||
if(MCFG_table == NULL) {
|
if(MCFG_table == NULL) {
|
||||||
KeStartPanic("Unable to access PCI configuration : MCFG table not reachable\n");
|
KeStartPanic("Unable to access PCI configuration : MCFG table not reachable\n");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue