/* * Set various globals based on contents of boot_args * * Note that this routine must NOT trash boot_args, as * it is scanned by later routines. */ static void process_kernel_args(void) { #ifdef RB_QUIET int value; #endif #if defined(RB_QUIET) && defined(BOOT_QUIETLY) boothowto |= RB_QUIET; #endif /* Process all the generic ARM boot options */ parse_mi_bootargs(boot_args); #ifdef RB_QUIET if (get_bootconf_option(args, "noquiet", BOOTOPT_TYPE_BOOLEAN, &value)) { if (!value) boothowto |= RB_QUIET; else boothowto &= ~RB_QUIET; } if (get_bootconf_option(args, "quiet", BOOTOPT_TYPE_BOOLEAN, &value)) { if (value) boothowto |= RB_QUIET; else boothowto &= ~RB_QUIET; } #endif /* Check for ofwgencfg-specific args here. */ }
static void set_root_device(void) { char *ptr; if (boot_args && get_bootconf_option(boot_args, "root", BOOTOPT_TYPE_STRING, &ptr)) get_device(ptr); }
static void parse_iyonix_bootargs(char *args) { char *ptr; if (get_bootconf_option(args, "consdev", BOOTOPT_TYPE_STRING, &ptr)) { /* ptr may have trailing clutter */ strlcpy(boot_consdev, ptr, sizeof(boot_consdev)); if ( (ptr = strchr(boot_consdev, ' ')) ) *ptr = 0; } }
void hcsc_attach(device_t parent, device_t self, void *aux) { struct hcsc_softc *sc = device_private(self); struct ncr5380_softc *ncr_sc = &sc->sc_ncr5380; struct podulebus_attach_args *pa = aux; #ifndef NCR5380_USE_BUS_SPACE uint8_t *iobase; #endif char hi_option[sizeof(self->dv_xname) + 8]; ncr_sc->sc_dev = self; ncr_sc->sc_min_dma_len = 0; ncr_sc->sc_no_disconnect = 0; ncr_sc->sc_parity_disable = 0; ncr_sc->sc_dma_alloc = NULL; ncr_sc->sc_dma_free = NULL; ncr_sc->sc_dma_poll = NULL; ncr_sc->sc_dma_setup = NULL; ncr_sc->sc_dma_start = NULL; ncr_sc->sc_dma_eop = NULL; ncr_sc->sc_dma_stop = NULL; ncr_sc->sc_intr_on = NULL; ncr_sc->sc_intr_off = NULL; #ifdef NCR5380_USE_BUS_SPACE ncr_sc->sc_regt = pa->pa_fast_t; bus_space_map(ncr_sc->sc_regt, pa->pa_fast_base + HCSC_DP8490_OFFSET, 8, 0, &ncr_sc->sc_regh); ncr_sc->sci_r0 = 0; ncr_sc->sci_r1 = 1; ncr_sc->sci_r2 = 2; ncr_sc->sci_r3 = 3; ncr_sc->sci_r4 = 4; ncr_sc->sci_r5 = 5; ncr_sc->sci_r6 = 6; ncr_sc->sci_r7 = 7; #else iobase = (u_char *)pa->pa_fast_base + HCSC_DP8490_OFFSET; ncr_sc->sci_r0 = iobase + 0; ncr_sc->sci_r1 = iobase + 4; ncr_sc->sci_r2 = iobase + 8; ncr_sc->sci_r3 = iobase + 12; ncr_sc->sci_r4 = iobase + 16; ncr_sc->sci_r5 = iobase + 20; ncr_sc->sci_r6 = iobase + 24; ncr_sc->sci_r7 = iobase + 28; #endif sc->sc_pdmat = pa->pa_mod_t; bus_space_map(sc->sc_pdmat, pa->pa_mod_base + HCSC_PDMA_OFFSET, 1, 0, &sc->sc_pdmah); ncr_sc->sc_rev = NCR_VARIANT_DP8490; ncr_sc->sc_pio_in = hcsc_pdma_in; ncr_sc->sc_pio_out = hcsc_pdma_out; /* Provide an override for the host id */ ncr_sc->sc_channel.chan_id = 7; snprintf(hi_option, sizeof(hi_option), "%s.hostid", device_xname(self)); (void)get_bootconf_option(boot_args, hi_option, BOOTOPT_TYPE_INT, &ncr_sc->sc_channel.chan_id); ncr_sc->sc_adapter.adapt_minphys = minphys; aprint_normal(": host ID %d\n", ncr_sc->sc_channel.chan_id); evcnt_attach_dynamic(&sc->sc_intrcnt, EVCNT_TYPE_INTR, NULL, device_xname(self), "intr"); sc->sc_ih = podulebus_irq_establish(pa->pa_ih, IPL_BIO, ncr5380_intr, sc, &sc->sc_intrcnt); ncr5380_attach(ncr_sc); }
void cscattach(device_t parent, device_t self, void *aux) { struct csc_softc *sc = device_private(self); struct podule_attach_args *pa; csc_regmap_p rp = &sc->sc_regmap; vu_char *fas; int loop; pa = aux; if (pa->pa_podule_number == -1) panic("Podule has disappeared !"); sc->sc_specific.sc_podule_number = pa->pa_podule_number; sc->sc_specific.sc_podule = pa->pa_podule; sc->sc_specific.sc_iobase = (vu_char *)sc->sc_specific.sc_podule->mod_base; rp->status0 = &sc->sc_specific.sc_iobase[CSC_STATUS0]; rp->alatch = &sc->sc_specific.sc_iobase[CSC_ALATCH]; rp->dack = (vu_short *)&sc->sc_specific.sc_iobase[CSC_DACK]; fas = &sc->sc_specific.sc_iobase[CSC_FAS_OFFSET_BASE]; rp->FAS216.sfas_tc_low = &fas[CSC_FAS_OFFSET_TCL]; rp->FAS216.sfas_tc_mid = &fas[CSC_FAS_OFFSET_TCM]; rp->FAS216.sfas_fifo = &fas[CSC_FAS_OFFSET_FIFO]; rp->FAS216.sfas_command = &fas[CSC_FAS_OFFSET_COMMAND]; rp->FAS216.sfas_dest_id = &fas[CSC_FAS_OFFSET_DESTID]; rp->FAS216.sfas_timeout = &fas[CSC_FAS_OFFSET_TIMEOUT]; rp->FAS216.sfas_syncper = &fas[CSC_FAS_OFFSET_PERIOD]; rp->FAS216.sfas_syncoff = &fas[CSC_FAS_OFFSET_OFFSET]; rp->FAS216.sfas_config1 = &fas[CSC_FAS_OFFSET_CONFIG1]; rp->FAS216.sfas_clkconv = &fas[CSC_FAS_OFFSET_CLKCONV]; rp->FAS216.sfas_test = &fas[CSC_FAS_OFFSET_TEST]; rp->FAS216.sfas_config2 = &fas[CSC_FAS_OFFSET_CONFIG2]; rp->FAS216.sfas_config3 = &fas[CSC_FAS_OFFSET_CONFIG3]; rp->FAS216.sfas_tc_high = &fas[CSC_FAS_OFFSET_TCH]; rp->FAS216.sfas_fifo_bot = &fas[CSC_FAS_OFFSET_FIFOBOT]; sc->sc_softc.sc_dev = self; sc->sc_softc.sc_fas = (sfas_regmap_p)rp; sc->sc_softc.sc_spec = &sc->sc_specific; sc->sc_softc.sc_led = csc_led; sc->sc_softc.sc_setup_dma = csc_setup_dma; sc->sc_softc.sc_build_dma_chain = csc_build_dma_chain; sc->sc_softc.sc_need_bump = csc_need_bump; sc->sc_softc.sc_clock_freq = 8; /* Cumana runs at 8MHz */ sc->sc_softc.sc_timeout = 250; /* Set default timeout to 250ms */ sc->sc_softc.sc_config_flags = SFAS_NO_DMA /*| SFAS_NF_DEBUG*/; sc->sc_softc.sc_host_id = 7; /* Should check the jumpers */ sc->sc_softc.sc_bump_sz = PAGE_SIZE; sc->sc_softc.sc_bump_pa = 0x0; sfasinitialize((struct sfas_softc *)sc); sc->sc_softc.sc_adapter.adapt_dev = self; sc->sc_softc.sc_adapter.adapt_nchannels = 1; sc->sc_softc.sc_adapter.adapt_openings = 7; sc->sc_softc.sc_adapter.adapt_max_periph = 1; sc->sc_softc.sc_adapter.adapt_ioctl = NULL; sc->sc_softc.sc_adapter.adapt_minphys = sfas_minphys; sc->sc_softc.sc_adapter.adapt_request = sfas_scsi_request; sc->sc_softc.sc_channel.chan_adapter = &sc->sc_softc.sc_adapter; sc->sc_softc.sc_channel.chan_bustype = &scsi_bustype; sc->sc_softc.sc_channel.chan_channel = 0; sc->sc_softc.sc_channel.chan_ntargets = 8; sc->sc_softc.sc_channel.chan_nluns = 8; sc->sc_softc.sc_channel.chan_id = sc->sc_softc.sc_host_id; /* Provide an override for the host id */ (void)get_bootconf_option(boot_args, "csc.hostid", BOOTOPT_TYPE_INT, &sc->sc_softc.sc_channel.chan_id); printf(": host=%d", sc->sc_softc.sc_channel.chan_id); /* initialise the alatch */ sc->sc_specific.sc_alatch_defs = (CSC_POLL?0:CSC_ALATCH_DEFS_INTEN); for (loop = 0; loop < 8; loop ++) { if(loop != 3) *rp->alatch = (loop << 1) | ((sc->sc_specific.sc_alatch_defs & (1 << loop))?1:0); } #if CSC_POLL == 0 evcnt_attach_dynamic(&sc->sc_softc.sc_intrcnt, EVCNT_TYPE_INTR, NULL, device_xname(self), "intr"); sc->sc_softc.sc_ih = podulebus_irq_establish(pa->pa_ih, IPL_BIO, csc_intr, &sc->sc_softc, &sc->sc_softc.sc_intrcnt); if (sc->sc_softc.sc_ih == NULL) panic("%s: Cannot install IRQ handler", device_xname(self)); #else printf(" polling"); sc->sc_softc.sc_adapter.adapt_flags |= SCSIPI_ADAPT_POLL_ONLY; #endif printf("\n"); /* attach all scsi units on us */ config_found(self, &sc->sc_softc.sc_channel, scsiprint); }
/* * 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 = %#x, %#x, %#x, %#x\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 (cubie) 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) 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 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 /* 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; KASSERT(ram_size <= KERNEL_VM_BASE - KERNEL_BASE); #else const bool mapallmem_p = false; #endif KASSERT((armreg_pfr1_read() & ARM_PFR1_SEC_MASK) != 0); arm32_bootmem_init(bootconfig.dram[0].address, ram_size, KERNEL_BASE_PHYS); arm32_kernel_vm_init(KERNEL_VM_BASE, ARM_VECTORS_LOW, 0, devmap, mapallmem_p); if (mapallmem_p) { /* * "bootargs" env variable is passed as 4th argument * to kernel but it's using the physical address and * we to convert that to a virtual address. */ if (uboot_args[3] - AWIN_SDRAM_PBASE < ram_size) { const char * const args = (const char *) (uboot_args[3] + KERNEL_PHYS_VOFFSET); strlcpy(bootargs, args, sizeof(bootargs)); } } boot_args = bootargs; parse_mi_bootargs(boot_args); /* we've a specific device_register routine */ evbarm_device_register = cubie_device_register; #if NAWIN_FB > 0 char *ptr; if (get_bootconf_option(boot_args, "console", BOOTOPT_TYPE_STRING, &ptr) && strncmp(ptr, "fb", 2) == 0) { use_fb_console = true; } #endif return initarm_common(KERNEL_VM_BASE, KERNEL_VM_SIZE, NULL, 0); }
void csa_attach(device_t parent, device_t self, void *aux) { struct csa_softc *sc = device_private(self); struct ncr5380_softc *ncr_sc = &sc->sc_ncr5380; struct podule_attach_args *pa = aux; uint8_t *iobase; char hi_option[sizeof(self->dv_xname) + 8]; ncr_sc->sc_dev = self; /* Note the podule number and validate */ if (pa->pa_podule_number == -1) panic("Podule has disappeared !"); sc->sc_podule_number = pa->pa_podule_number; sc->sc_podule = pa->pa_podule; podules[sc->sc_podule_number].attached = 1; ncr_sc->sc_flags |= NCR5380_FORCE_POLLING; ncr_sc->sc_min_dma_len = 0; ncr_sc->sc_no_disconnect = 0x00; ncr_sc->sc_parity_disable = 0x00; ncr_sc->sc_dma_alloc = NULL; ncr_sc->sc_dma_free = NULL; ncr_sc->sc_dma_poll = NULL; ncr_sc->sc_dma_setup = NULL; ncr_sc->sc_dma_start = NULL; ncr_sc->sc_dma_eop = NULL; ncr_sc->sc_dma_stop = NULL; ncr_sc->sc_intr_on = NULL; ncr_sc->sc_intr_off = NULL; iobase = (uint8_t *)pa->pa_podule->slow_base + CSA_NCR5380_OFFSET; ncr_sc->sci_r0 = iobase + 0; ncr_sc->sci_r1 = iobase + 4; ncr_sc->sci_r2 = iobase + 8; ncr_sc->sci_r3 = iobase + 12; ncr_sc->sci_r4 = iobase + 16; ncr_sc->sci_r5 = iobase + 20; ncr_sc->sci_r6 = iobase + 24; ncr_sc->sci_r7 = iobase + 28; ncr_sc->sc_rev = NCR_VARIANT_NCR5380; sc->sc_ctrl = (uint8_t *)pa->pa_podule->slow_base + CSA_CTRL_OFFSET; sc->sc_status = (uint8_t *)pa->pa_podule->slow_base + CSA_STAT_OFFSET; sc->sc_data = (uint8_t *)pa->pa_podule->slow_base + CSA_DATA_OFFSET; ncr_sc->sc_pio_in = ncr5380_pio_in; ncr_sc->sc_pio_out = ncr5380_pio_out; /* Provide an override for the host id */ ncr_sc->sc_channel.chan_id = 7; sprintf(hi_option, "%s.hostid", device_xname(self)); (void)get_bootconf_option(boot_args, hi_option, BOOTOPT_TYPE_INT, &ncr_sc->sc_channel.chan_id); ncr_sc->sc_adapter.adapt_minphys = minphys; aprint_normal(": host=%d, using 8 bit PIO", ncr_sc->sc_channel.chan_id); sc->sc_irqstatus = (uint8_t *)pa->pa_podule->slow_base + CSA_INTR_OFFSET; sc->sc_irqmask = CSA_INTR_MASK; evcnt_attach_dynamic(&sc->sc_intrcnt, EVCNT_TYPE_INTR, NULL, device_xname(self), "intr"); sc->sc_ih = podulebus_irq_establish(pa->pa_ih, IPL_BIO, csa_intr, sc, &sc->sc_intrcnt); if (sc->sc_ih == NULL) ncr_sc->sc_flags |= NCR5380_FORCE_POLLING; if (ncr_sc->sc_flags & NCR5380_FORCE_POLLING) aprint_normal(", polling"); aprint_normal("\n"); *sc->sc_ctrl = 0; ncr5380_attach(ncr_sc); }
void ascattach(device_t parent, device_t self, void *aux) { /* volatile struct sdmac *rp;*/ struct asc_softc *sc; struct sbic_softc *sbic; struct podule_attach_args *pa; sc = device_private(self); pa = aux; if (pa->pa_podule_number == -1) panic("Podule has disappeared !"); sc->sc_podule_number = pa->pa_podule_number; sc->sc_podule = pa->pa_podule; podules[sc->sc_podule_number].attached = 1; sbic = &sc->sc_softc; sbic->sc_dev = self; sbic->sc_enintr = asc_enintr; sbic->sc_dmaok = asc_dmaok; sbic->sc_dmasetup = asc_dmasetup; sbic->sc_dmanext = asc_dmanext; sbic->sc_dmastop = asc_dmastop; sbic->sc_dmafinish = asc_dmafinish; /* Map sbic */ sbic->sc_sbicp.sc_sbiciot = pa->pa_iot; if (bus_space_map (sbic->sc_sbicp.sc_sbiciot, sc->sc_podule->mod_base + ASC_SBIC, ASC_SBIC_SPACE, 0, &sbic->sc_sbicp.sc_sbicioh)) panic("%s: Cannot map SBIC", device_xname(self)); sbic->sc_clkfreq = sbic_clock_override ? sbic_clock_override : 143; sbic->sc_adapter.adapt_dev = self; sbic->sc_adapter.adapt_nchannels = 1; sbic->sc_adapter.adapt_openings = 7; sbic->sc_adapter.adapt_max_periph = 1; sbic->sc_adapter.adapt_ioctl = NULL; sbic->sc_adapter.adapt_minphys = asc_minphys; sbic->sc_adapter.adapt_request = sbic_scsi_request; sbic->sc_channel.chan_adapter = &sbic->sc_adapter; sbic->sc_channel.chan_bustype = &scsi_bustype; sbic->sc_channel.chan_channel = 0; sbic->sc_channel.chan_ntargets = 8; sbic->sc_channel.chan_nluns = 8; sbic->sc_channel.chan_id = 7; /* Provide an override for the host id */ (void)get_bootconf_option(boot_args, "asc.hostid", BOOTOPT_TYPE_INT, &sbic->sc_channel.chan_id); printf(": hostid=%d", sbic->sc_channel.chan_id); #if ASC_POLL > 0 if (boot_args) get_bootconf_option(boot_args, "ascpoll", BOOTOPT_TYPE_BOOLEAN, &asc_poll); if (asc_poll) { sbic->sc_adapter.adapt_flags |= SCSIPI_ADAPT_POLL_ONLY; printf(" polling"); } #endif printf("\n"); sc->sc_pagereg = sc->sc_podule->fast_base + ASC_PAGEREG; sc->sc_intstat = sc->sc_podule->fast_base + ASC_INTSTATUS; /* Reset the card */ WriteByte(sc->sc_pagereg, 0x80); DELAY(500000); WriteByte(sc->sc_pagereg, 0x00); DELAY(250000); sbicinit(sbic); /* If we are polling only, we don't need a interrupt handler. */ #ifdef ASC_POLL if (!asc_poll) #endif { evcnt_attach_dynamic(&sc->sc_intrcnt, EVCNT_TYPE_INTR, NULL, device_xname(self), "intr"); sc->sc_ih = podulebus_irq_establish(pa->pa_ih, IPL_BIO, asc_intr, sc, &sc->sc_intrcnt); if (sc->sc_ih == NULL) panic("%s: Cannot claim podule IRQ", device_xname(self)); } /* * attach all scsi units on us */ config_found(self, &sbic->sc_channel, scsiprint); }
void oak_attach(struct device *parent, struct device *self, void *aux) { struct oak_softc *sc = (struct oak_softc *)self; struct podulebus_attach_args *pa = aux; #ifndef NCR5380_USE_BUS_SPACE u_char *iobase; #endif char hi_option[sizeof(sc->sc_ncr5380.sc_dev.dv_xname) + 8]; sc->sc_ncr5380.sc_flags |= NCR5380_FORCE_POLLING; sc->sc_ncr5380.sc_min_dma_len = 0; sc->sc_ncr5380.sc_no_disconnect = 0xff; sc->sc_ncr5380.sc_parity_disable = 0; sc->sc_ncr5380.sc_dma_alloc = NULL; sc->sc_ncr5380.sc_dma_free = NULL; sc->sc_ncr5380.sc_dma_poll = NULL; sc->sc_ncr5380.sc_dma_setup = NULL; sc->sc_ncr5380.sc_dma_start = NULL; sc->sc_ncr5380.sc_dma_eop = NULL; sc->sc_ncr5380.sc_dma_stop = NULL; sc->sc_ncr5380.sc_intr_on = NULL; sc->sc_ncr5380.sc_intr_off = NULL; #ifdef NCR5380_USE_BUS_SPACE sc->sc_ncr5380.sc_regt = pa->pa_mod_t; bus_space_map(sc->sc_ncr5380.sc_regt, pa->pa_mod_base, 8, 0, &sc->sc_ncr5380.sc_regh); sc->sc_ncr5380.sci_r0 = 0; sc->sc_ncr5380.sci_r1 = 1; sc->sc_ncr5380.sci_r2 = 2; sc->sc_ncr5380.sci_r3 = 3; sc->sc_ncr5380.sci_r4 = 4; sc->sc_ncr5380.sci_r5 = 5; sc->sc_ncr5380.sci_r6 = 6; sc->sc_ncr5380.sci_r7 = 7; #else iobase = (u_char *)pa->pa_mod_base; sc->sc_ncr5380.sci_r0 = iobase + 0; sc->sc_ncr5380.sci_r1 = iobase + 4; sc->sc_ncr5380.sci_r2 = iobase + 8; sc->sc_ncr5380.sci_r3 = iobase + 12; sc->sc_ncr5380.sci_r4 = iobase + 16; sc->sc_ncr5380.sci_r5 = iobase + 20; sc->sc_ncr5380.sci_r6 = iobase + 24; sc->sc_ncr5380.sci_r7 = iobase + 28; #endif sc->sc_pdmat = pa->pa_mod_t; bus_space_map(sc->sc_pdmat, pa->pa_mod_base + OAK_PDMA_OFFSET, 0x20, 0, &sc->sc_pdmah); sc->sc_ncr5380.sc_rev = NCR_VARIANT_NCR5380; sc->sc_ncr5380.sc_pio_in = ncr5380_pio_in; sc->sc_ncr5380.sc_pio_out = ncr5380_pio_out; /* Provide an override for the host id */ sc->sc_ncr5380.sc_channel.chan_id = 7; sprintf(hi_option, "%s.hostid", sc->sc_ncr5380.sc_dev.dv_xname); (void)get_bootconf_option(boot_args, hi_option, BOOTOPT_TYPE_INT, &sc->sc_ncr5380.sc_channel.chan_id); sc->sc_ncr5380.sc_adapter.adapt_minphys = minphys; printf(": host=%d, using 8 bit PIO\n", sc->sc_ncr5380.sc_channel.chan_id); ncr5380_attach(&sc->sc_ncr5380); }