kaluga: waiting for all spawnds to be up before starting drivers/apps
authorRoni Häcki <roni.haecki@inf.ethz.ch>
Fri, 1 Sep 2017 11:34:21 +0000 (13:34 +0200)
committerRoni Häcki <roni.haecki@inf.ethz.ch>
Fri, 1 Sep 2017 11:34:21 +0000 (13:34 +0200)
Signed-off-by: Roni Häcki <roni.haecki@inf.ethz.ch>

usr/kaluga/start_cpu.c
usr/kaluga/x86.c

index 5632ed3..9486024 100644 (file)
@@ -262,9 +262,9 @@ errval_t wait_for_all_spawnds(void)
     // still assumes a fixed set of cores and will deadlock
     // otherwise. Therefore we need to fix those parts first.
     errval_t err;
+    char* record = NULL;
 #if !defined(__ARM_ARCH_7A__)
     KALUGA_DEBUG("Waiting for acpi");
-    char* record = NULL;
     err = oct_wait_for(&record, "acpi { iref: _ }");
     if (err_is_fail(err)) {
         return err_push(err, KALUGA_ERR_WAITING_FOR_ACPI);
@@ -288,5 +288,10 @@ errval_t wait_for_all_spawnds(void)
 
     static char* spawnds = "r'spawn.[0-9]+' { iref: _ }";
     octopus_trigger_id_t tid;
-    return oct_trigger_existing_and_watch(spawnds, spawnd_change_event, (void*)count, &tid);
+    err = oct_trigger_existing_and_watch(spawnds, spawnd_change_event, (void*)count, &tid);
+    if (err_is_fail(err)) {
+        return err_push(err, KALUGA_ERR_QUERY_LOCAL_APIC);
+    }
+
+    return oct_wait_for(&record, "all_spawnds_up { iref: 0 }");
 }
index 48b7587..89321a8 100644 (file)
@@ -173,13 +173,6 @@ errval_t arch_startup(char * add_device_db_file)
         USER_PANIC_ERR(err, "Watching PCI root bridges.");
     }
 
-    KALUGA_DEBUG("Kaluga: pci_devices\n");
-
-    err = watch_for_pci_devices();
-    if (err_is_fail(err)) {
-        USER_PANIC_ERR(err, "Watching PCI devices.");
-    }
-
     KALUGA_DEBUG("Kaluga: int_controller_devices\n");
 
     err = watch_for_int_controller();
@@ -194,6 +187,13 @@ errval_t arch_startup(char * add_device_db_file)
         USER_PANIC_ERR(err, "Unable to wait for spawnds failed.");
     }
 
+    KALUGA_DEBUG("Kaluga: pci_devices\n");
+
+    err = watch_for_pci_devices();
+    if (err_is_fail(err)) {
+        USER_PANIC_ERR(err, "Watching PCI devices.");
+    }
+
     KALUGA_DEBUG("Kaluga: Starting serial...\n");
     err = start_serial();
     if (err_is_fail(err) && err != KALUGA_ERR_MODULE_NOT_FOUND) {