static void fdt_init_node(void *args) { struct FDTInitNodeArgs *a = args; char *node_path = a->node_path; FDTMachineInfo *fdti = a->fdti; g_free(a); char *all_compats = NULL, *compat, *node_name, *next_compat; int compat_len; #ifdef FDT_GENERIC_UTIL_ERR_DEBUG static int entry_index; int this_entry = entry_index++; #endif DB_PRINT("enter %d %s\n", this_entry, node_path); /* try instance binding first */ node_name = qemu_fdt_get_node_name(fdti->fdt, node_path); if (!node_name) { fprintf(stderr, "FDT: ERROR: nameless node: %s\n", node_path); } if (!fdt_init_inst_bind(node_path, fdti, node_name)) { goto exit; } /* fallback to compatibility binding */ all_compats = qemu_fdt_getprop(fdti->fdt, node_path, "compatible", &compat_len, false, NULL); if (!all_compats) { fprintf(stderr, "FDT: ERROR: no compatibility found for node %s/%s\n", node_path, node_name); DB_PRINT("exit %d\n", this_entry); fdti->routinesPending--; return; } compat = all_compats; try_next_compat: if (compat_len == 0) { goto invalidate; } if (!fdt_init_compat(node_path, fdti, compat)) { goto exit; } if (!fdt_init_qdev(node_path, fdti, compat)) { goto exit; } next_compat = rawmemchr(compat, '\0'); compat_len -= (next_compat + 1 - compat); if (compat_len > 0) { *next_compat = ' '; } compat = next_compat+1; goto try_next_compat; invalidate: fprintf(stderr, "FDT: Unsupported peripheral invalidated %s compatibilities %s\n", node_name, all_compats); qemu_fdt_setprop_string(fdti->fdt, node_path, "compatible", "invalidated"); exit: DB_PRINT("exit %d\n", this_entry); if (!fdt_init_has_opaque(fdti, node_path)) { fdt_init_set_opaque(fdti, node_path, NULL); } g_free(node_path); g_free(all_compats); fdti->routinesPending--; return; }
static void fdt_init_node(void *args) { struct FDTInitNodeArgs *a = args; char *node_path = a->node_path; FDTMachineInfo *fdti = a->fdti; g_free(a); simple_bus_fdt_init(node_path, fdti); char *all_compats = NULL, *compat, *node_name, *next_compat, *device_type; int compat_len; DB_PRINT_NP(1, "enter\n"); /* try instance binding first */ node_name = qemu_devtree_get_node_name(fdti->fdt, node_path); DB_PRINT_NP(1, "node with name: %s\n", node_name ? node_name : "(none)"); if (!node_name) { printf("FDT: ERROR: nameless node: %s\n", node_path); } if (!fdt_init_inst_bind(node_path, fdti, node_name)) { DB_PRINT_NP(0, "instance bind successful\n"); goto exit; } /* fallback to compatibility binding */ all_compats = qemu_fdt_getprop(fdti->fdt, node_path, "compatible", &compat_len, false, NULL); if (!all_compats) { DB_PRINT_NP(0, "no compatibility found\n"); } for (compat = all_compats; compat && compat_len; compat = next_compat+1) { char *compat_prefixed = g_strdup_printf("compatible:%s", compat); if (!fdt_init_compat(node_path, fdti, compat_prefixed)) { goto exit; } g_free(compat_prefixed); if (!fdt_init_qdev(node_path, fdti, compat)) { goto exit; } next_compat = rawmemchr(compat, '\0'); compat_len -= (next_compat + 1 - compat); if (compat_len > 0) { *next_compat = ' '; } } device_type = qemu_fdt_getprop(fdti->fdt, node_path, "device_type", NULL, false, NULL); device_type = g_strdup_printf("device_type:%s", device_type); if (!fdt_init_compat(node_path, fdti, device_type)) { goto exit; } if (!all_compats) { goto exit; } DB_PRINT_NP(0, "FDT: Unsupported peripheral invalidated - " "compatibilities %s\n", all_compats); qemu_fdt_setprop_string(fdti->fdt, node_path, "compatible", "invalidated"); exit: DB_PRINT_NP(1, "exit\n"); if (!fdt_init_has_opaque(fdti, node_path)) { fdt_init_set_opaque(fdti, node_path, NULL); } g_free(node_path); g_free(all_compats); return; }