mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-31 08:48:02 +00:00
Added support for multiple vendors on one driver
This commit is contained in:
parent
e166338295
commit
97b2b354e5
@ -84,6 +84,12 @@ namespace Driver
|
|||||||
.SendPacket = nullptr,
|
.SendPacket = nullptr,
|
||||||
.ReceivePacket = nullptr,
|
.ReceivePacket = nullptr,
|
||||||
},
|
},
|
||||||
|
.Disk = {
|
||||||
|
.AHCI = {
|
||||||
|
.ReadSector = nullptr,
|
||||||
|
.WriteSector = nullptr,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -115,7 +121,18 @@ namespace Driver
|
|||||||
debug("Name: \"%s\"; Type: %d; Callback: %#lx", DrvExtHdr->Driver.Name, DrvExtHdr->Driver.Type, DrvExtHdr->Driver.Callback);
|
debug("Name: \"%s\"; Type: %d; Callback: %#lx", DrvExtHdr->Driver.Name, DrvExtHdr->Driver.Type, DrvExtHdr->Driver.Callback);
|
||||||
if (DrvExtHdr->Driver.Bind.Type == DriverBindType::BIND_PCI)
|
if (DrvExtHdr->Driver.Bind.Type == DriverBindType::BIND_PCI)
|
||||||
{
|
{
|
||||||
Vector<PCI::PCIDeviceHeader *> devices = PCIManager->FindPCIDevice(DrvExtHdr->Driver.Bind.PCI.VendorID, DrvExtHdr->Driver.Bind.PCI.DeviceID);
|
for (long unsigned Vidx = 0; Vidx < sizeof(DrvExtHdr->Driver.Bind.PCI.VendorID) / sizeof(DrvExtHdr->Driver.Bind.PCI.VendorID[0]); Vidx++)
|
||||||
|
for (long unsigned Didx = 0; Didx < sizeof(DrvExtHdr->Driver.Bind.PCI.DeviceID) / sizeof(DrvExtHdr->Driver.Bind.PCI.DeviceID[0]); Didx++)
|
||||||
|
{
|
||||||
|
if (Vidx >= sizeof(DrvExtHdr->Driver.Bind.PCI.VendorID) && Didx >= sizeof(DrvExtHdr->Driver.Bind.PCI.DeviceID))
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (DrvExtHdr->Driver.Bind.PCI.VendorID[Vidx] == 0 || DrvExtHdr->Driver.Bind.PCI.DeviceID[Didx] == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
debug("VendorID: %#x; DeviceID: %#x", DrvExtHdr->Driver.Bind.PCI.VendorID[Vidx], DrvExtHdr->Driver.Bind.PCI.DeviceID[Didx]);
|
||||||
|
|
||||||
|
Vector<PCI::PCIDeviceHeader *> devices = PCIManager->FindPCIDevice(DrvExtHdr->Driver.Bind.PCI.VendorID[Vidx], DrvExtHdr->Driver.Bind.PCI.DeviceID[Didx]);
|
||||||
foreach (auto PCIDevice in devices)
|
foreach (auto PCIDevice in devices)
|
||||||
{
|
{
|
||||||
Fex *fex = (Fex *)KernelAllocator.RequestPages(TO_PAGES(Size));
|
Fex *fex = (Fex *)KernelAllocator.RequestPages(TO_PAGES(Size));
|
||||||
@ -206,6 +223,7 @@ namespace Driver
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fixme("Driver bind type: %d", DrvExtHdr->Driver.Bind.Type);
|
fixme("Driver bind type: %d", DrvExtHdr->Driver.Bind.Type);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user