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); } }
/* * u_int initarm(...) * * Initial entry point on startup. This gets called before main() is * entered. * It should be responsible for setting up everything that must be * in place when main is called. * This includes * Taking a copy of the boot configuration structure. * Initialising the physical console so characters can be printed. * Setting up page tables for the kernel * Relocating the kernel to the bottom of physical memory */ u_int initarm(void *arg) { pmap_devmap_register(devmap); awin_bootstrap(AWIN_CORE_VBASE, CONADDR_VA); /* Heads up ... Setup the CPU / MMU / TLB functions. */ if (set_cpufuncs()) panic("cpu not recognized!"); /* The console is going to try to map things. Give pmap a devmap. */ consinit(); #ifdef VERBOSE_INIT_ARM printf("\nuboot arg = %#"PRIxPTR", %#"PRIxPTR", %#"PRIxPTR", %#"PRIxPTR"\n", uboot_args[0], uboot_args[1], uboot_args[2], uboot_args[3]); #endif #ifdef KGDB kgdb_port_init(); #endif cpu_reset_address = awin_wdog_reset; #ifdef VERBOSE_INIT_ARM /* Talk to the user */ printf("\nNetBSD/evbarm (" BOARDTYPE ") booting ...\n"); #endif #ifdef BOOT_ARGS char mi_bootargs[] = BOOT_ARGS; parse_mi_bootargs(mi_bootargs); #endif #ifdef VERBOSE_INIT_ARM printf("initarm: Configuring system ...\n"); #if defined(CPU_CORTEXA7) || defined(CPU_CORTEXA9) || defined(CPU_CORTEXA15) if (!CPU_ID_CORTEX_A8_P(curcpu()->ci_arm_cpuid)) { printf("initarm: cbar=%#x\n", armreg_cbar_read()); } #endif #endif /* * Set up the variables that define the availability of physical * memory. */ psize_t ram_size = awin_memprobe(); #if AWIN_board == AWIN_cubieboard /* the cubietruck has 2GB whereas the cubieboards only has 1GB */ cubietruck_p = (ram_size == 0x80000000); #endif /* * If MEMSIZE specified less than what we really have, limit ourselves * to that. */ #ifdef MEMSIZE if (ram_size == 0 || ram_size > (unsigned)MEMSIZE * 1024 * 1024) ram_size = (unsigned)MEMSIZE * 1024 * 1024; #else KASSERTMSG(ram_size > 0, "RAM size unknown and MEMSIZE undefined"); #endif /* * Configure DMA tags */ awin_dma_bootstrap(ram_size); /* Fake bootconfig structure for the benefit of pmap.c. */ bootconfig.dramblocks = 1; bootconfig.dram[0].address = AWIN_SDRAM_PBASE; bootconfig.dram[0].pages = ram_size / PAGE_SIZE; #ifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS const bool mapallmem_p = true; #ifndef PMAP_NEED_ALLOC_POOLPAGE if (ram_size > KERNEL_VM_BASE - KERNEL_BASE) { printf("%s: dropping RAM size from %luMB to %uMB\n", __func__, (unsigned long) (ram_size >> 20), (KERNEL_VM_BASE - KERNEL_BASE) >> 20); ram_size = KERNEL_VM_BASE - KERNEL_BASE; }