PCI: refactor root node detection
Change-Id: Icc4ab0c3f7258914d798267e08c47977c0987c97 Reviewed-on: https://review.haiku-os.org/c/haiku/+/5547 Tested-by: Commit checker robot <[email protected]> Reviewed-by: Alex von Gluck IV <[email protected]> Reviewed-by: David Karoly <[email protected]>
This commit is contained in:
@@ -32,35 +32,31 @@ pci_root_supports_device(device_node* parent)
|
||||
return -1.0f;
|
||||
|
||||
#if defined(__riscv)
|
||||
const char* compatible;
|
||||
if (gDeviceManager->get_attr_string(parent, "fdt/compatible", &compatible,
|
||||
false) < B_OK)
|
||||
return -1.0f;
|
||||
if (strcmp(bus, "fdt") == 0) {
|
||||
const char* compatible;
|
||||
if (gDeviceManager->get_attr_string(parent, "fdt/compatible", &compatible, false) < B_OK)
|
||||
return -1.0f;
|
||||
|
||||
if (strcmp(bus, "fdt") != 0)
|
||||
return 0.0f;
|
||||
|
||||
if (strcmp(compatible, "pci-host-ecam-generic") != 0
|
||||
&& strcmp(compatible, "sifive,fu740-pcie") != 0) {
|
||||
return 0.0f;
|
||||
if (strcmp(compatible, "pci-host-ecam-generic") == 0
|
||||
|| strcmp(compatible, "sifive,fu740-pcie") == 0) {
|
||||
return 1.0f;
|
||||
}
|
||||
}
|
||||
#elif defined(__aarch64__)
|
||||
if (strcmp(bus, "acpi") != 0)
|
||||
return -1.0f;
|
||||
if (strcmp(bus, "acpi") == 0) {
|
||||
const char* hid;
|
||||
if (gDeviceManager->get_attr_string(parent, ACPI_DEVICE_HID_ITEM, &hid, false) < B_OK)
|
||||
return -1.0f;
|
||||
|
||||
const char* hid;
|
||||
if (gDeviceManager->get_attr_string(parent, ACPI_DEVICE_HID_ITEM, &hid,
|
||||
false) < B_OK)
|
||||
return -1.0f;
|
||||
|
||||
if (strcmp(hid, "PNP0A03") != 0 && strcmp(hid, "PNP0A08") != 0)
|
||||
return -1.0f;
|
||||
if (strcmp(hid, "PNP0A03") == 0 || strcmp(hid, "PNP0A08") == 0)
|
||||
return 1.0f;
|
||||
}
|
||||
#else
|
||||
if (strcmp(bus, "root") != 0)
|
||||
return 0.0f;
|
||||
if (strcmp(bus, "root") == 0)
|
||||
return 1.0f;
|
||||
#endif
|
||||
|
||||
return 1.0;
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user