static inline const struct db_tlbinfo * tlb_lookup_tlbinfo(void) { #if defined(CPU_CORTEXA5) && defined(CPU_CORTEXA7) const bool cortex_a5_p = CPU_ID_CORTEX_A5_P(curcpu()->ci_arm_cpuid); const bool cortex_a7_p = CPU_ID_CORTEX_A7_P(curcpu()->ci_arm_cpuid); #elif defined(CPU_CORTEXA5) const bool cortex_a5_p = true; #else const bool cortex_a7_p = true; #endif #ifdef CPU_CORTEXA5 if (cortex_a5_p) { return &tlb_cortex_a5_info; } #endif #ifdef CPU_CORTEXA7 if (cortex_a7_p) { return &tlb_cortex_a7_info; } #endif return NULL; }
static void awinio_attach(device_t parent, device_t self, void *aux) { struct awinio_softc * const sc = &awinio_sc; const bool a10_p = CPU_ID_CORTEX_A8_P(curcpu()->ci_arm_cpuid); const bool a20_p = CPU_ID_CORTEX_A7_P(curcpu()->ci_arm_cpuid); prop_dictionary_t dict = device_properties(self); sc->sc_dev = self; sc->sc_bst = &awin_bs_tag; sc->sc_a4x_bst = &awin_a4x_bs_tag; sc->sc_bsh = awin_core_bsh; sc->sc_dmat = &awin_dma_tag; bus_space_subregion(sc->sc_bst, sc->sc_bsh, AWIN_CCM_OFFSET, 0x1000, &sc->sc_ccm_bsh); aprint_naive("\n"); aprint_normal("\n"); const struct awin_locators * const eloc = awin_locators + __arraycount(awin_locators); for (const struct awin_locators *loc = awin_locators; loc < eloc; loc++) { char prop_name[31]; bool skip; if (loc->loc_port == AWINIOCF_PORT_DEFAULT) { snprintf(prop_name, sizeof(prop_name), "no-%s", loc->loc_name); } else { snprintf(prop_name, sizeof(prop_name), "no-%s-%d", loc->loc_name, loc->loc_port); } if (prop_dictionary_get_bool(dict, prop_name, &skip) && skip) continue; if (loc->loc_flags & AWINIO_ONLY) { if (a10_p && !(loc->loc_flags & AWINIO_ONLY_A10)) continue; if (a20_p && !(loc->loc_flags & AWINIO_ONLY_A20)) continue; } struct awinio_attach_args aio = { .aio_loc = *loc, .aio_core_bst = sc->sc_bst, .aio_core_a4x_bst = sc->sc_a4x_bst, .aio_core_bsh = sc->sc_bsh, .aio_ccm_bsh = sc->sc_ccm_bsh, .aio_dmat = sc->sc_dmat, }; cfdata_t cf = config_search_ia(awinio_find, sc->sc_dev, "awinio", &aio); if (cf == NULL) { if (loc->loc_flags & AWINIO_REQUIRED) panic("%s: failed to find %s!", __func__, loc->loc_name); continue; } config_attach(sc->sc_dev, cf, &aio, awinio_print); } }