mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-25 23:10:32 +00:00
Fix issue preventing network adapter detection with multiple adapters
This commit is contained in:
parent
b14b485716
commit
025cc946d4
2 changed files with 17 additions and 24 deletions
|
@ -24,32 +24,23 @@ U0 NetDriverInit()
|
||||||
CPCIDev *net_driver_pci = PCIDevFind(PCIC_NETWORK);
|
CPCIDev *net_driver_pci = PCIDevFind(PCIC_NETWORK);
|
||||||
Bool found = FALSE;
|
Bool found = FALSE;
|
||||||
|
|
||||||
switch (net_driver_pci->vendor_id)
|
if (net_driver_pci)
|
||||||
{
|
{
|
||||||
case PCIV_PCNET:
|
if (net_driver_pci=PCIDevFind(, , PCIV_PCNET, PCID_PCNET))
|
||||||
switch (net_driver_pci->device_id)
|
{
|
||||||
{
|
NetDriverInclude("PCNet");
|
||||||
case PCID_PCNET:
|
found = TRUE;
|
||||||
NetDriverInclude("PCNet");
|
}
|
||||||
found = TRUE;
|
else if (net_driver_pci=PCIDevFind(, , PCIV_E1000, PCID_82545EM))
|
||||||
break;
|
{
|
||||||
}
|
NetDriverInclude("E1000");
|
||||||
break;
|
found = TRUE;
|
||||||
|
}
|
||||||
case PCIV_E1000:
|
else if (net_driver_pci=PCIDevFind(PCIC_NETWORK, , PCIV_VIRTIO, ))
|
||||||
switch (net_driver_pci->device_id)
|
{
|
||||||
{
|
|
||||||
case PCID_82545EM:
|
|
||||||
NetDriverInclude("E1000");
|
|
||||||
found = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PCIV_VIRTIO:
|
|
||||||
NetDriverInclude("VirtIONet");
|
NetDriverInclude("VirtIONet");
|
||||||
found = TRUE;
|
found = TRUE;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
|
|
|
@ -55,7 +55,7 @@ lud_done:
|
||||||
public CPCIDev *PCIDevFind(U16 class_code=NULL, U16 sub_code=NULL,
|
public CPCIDev *PCIDevFind(U16 class_code=NULL, U16 sub_code=NULL,
|
||||||
U16 vendor_id=NULL, U16 device_id=NULL,
|
U16 vendor_id=NULL, U16 device_id=NULL,
|
||||||
U8 _bus=0xFF, U8 _dev=0xFF, U8 _fun=0xFF)
|
U8 _bus=0xFF, U8 _dev=0xFF, U8 _fun=0xFF)
|
||||||
{//return first device with matching class & subcode, vendor & device id, or a specific device.
|
{//return first device with matching class & subcode, vendor & device id, class & device id, class & vendor id or a specific device.
|
||||||
PCILookUpDevs;
|
PCILookUpDevs;
|
||||||
CPCIDev *p = dev.pci_head.next;
|
CPCIDev *p = dev.pci_head.next;
|
||||||
|
|
||||||
|
@ -63,6 +63,8 @@ public CPCIDev *PCIDevFind(U16 class_code=NULL, U16 sub_code=NULL,
|
||||||
{
|
{
|
||||||
if (p->vendor_id == vendor_id && p->device_id == device_id ||
|
if (p->vendor_id == vendor_id && p->device_id == device_id ||
|
||||||
p->class_code == class_code && p->sub_code == sub_code ||
|
p->class_code == class_code && p->sub_code == sub_code ||
|
||||||
|
p->class_code == class_code && p->device_id == device_id && vendor_id == NULL ||
|
||||||
|
p->class_code == class_code && p->vendor_id == vendor_id && device_id == NULL ||
|
||||||
p->bus == _bus && p->dev == _dev && p->fun == _fun)
|
p->bus == _bus && p->dev == _dev && p->fun == _fun)
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
|
|
Loading…
Reference in a new issue