bus: add probing
[dpdk.git] / lib / librte_eal / common / eal_common_bus.c
index ef10390..4638e78 100644 (file)
@@ -49,6 +49,7 @@ rte_bus_register(struct rte_bus *bus)
        RTE_VERIFY(bus->name && strlen(bus->name));
        /* A bus should mandatorily have the scan implemented */
        RTE_VERIFY(bus->scan);
+       RTE_VERIFY(bus->probe);
 
        TAILQ_INSERT_TAIL(&rte_bus_list, bus, next);
        RTE_LOG(DEBUG, EAL, "Registered [%s] bus.\n", bus->name);
@@ -80,6 +81,25 @@ rte_bus_scan(void)
        return 0;
 }
 
+/* Probe all devices of all buses */
+int
+rte_bus_probe(void)
+{
+       int ret;
+       struct rte_bus *bus;
+
+       TAILQ_FOREACH(bus, &rte_bus_list, next) {
+               ret = bus->probe();
+               if (ret) {
+                       RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n",
+                               bus->name);
+                       return ret;
+               }
+       }
+
+       return 0;
+}
+
 /* Dump information of a single bus */
 static int
 bus_dump_one(FILE *f, struct rte_bus *bus)