static int comprobe1(int iobase) { if (badbaddr((void *)pio(iobase, com_lcr))) return 0; /* force access to id reg */ outb(pio(iobase , com_lcr), 0); outb(pio(iobase , com_iir), 0); if (inb(pio(iobase , com_iir)) & 0x38) return 0; return 1; }
static int slhci_intio_match(device_t parent, cfdata_t cf, void *aux) { struct intio_attach_args *ia = aux; bus_space_tag_t iot = ia->ia_bst; bus_space_handle_t ioh; bus_space_handle_t nch; int nc_addr; int nc_size; if (ia->ia_addr == INTIOCF_ADDR_DEFAULT) ia->ia_addr = SLHCI_INTIO_ADDR1; if (ia->ia_intr == INTIOCF_INTR_DEFAULT) ia->ia_intr = SLHCI_INTIO_INTR1; /* fixed parameters */ if ( !(ia->ia_addr == SLHCI_INTIO_ADDR1 && ia->ia_intr == SLHCI_INTIO_INTR1 ) && !(ia->ia_addr == SLHCI_INTIO_ADDR2 && ia->ia_intr == SLHCI_INTIO_INTR2 ) ) return 0; /* Whether the SL811 port is accessible or not */ if (badaddr((void *)IIOV(ia->ia_addr))) return 0; /* Whether the control port is accessible or not */ nc_addr = ia->ia_addr + NEREID_ADDR_OFFSET; nc_size = 0x02; if (badbaddr((void *)IIOV(nc_addr))) return 0; /* Map two I/O spaces */ ia->ia_size = SL11_PORTSIZE * 2; if (bus_space_map(iot, ia->ia_addr, ia->ia_size, BUS_SPACE_MAP_SHIFTED, &ioh)) return 0; if (bus_space_map(iot, nc_addr, nc_size, BUS_SPACE_MAP_SHIFTED, &nch)) return 0; bus_space_unmap(iot, ioh, ia->ia_size); bus_space_unmap(iot, nch, nc_size); return 1; }
/* from boot_ufs/bootmain.c */ static int get_scsi_host_adapter(void) { char *bootrom; int ha; bootrom = (char *) (IOCS_BOOTINF() & 0x00ffffe0); /* * bootrom+0x24 "SCSIIN" ... Internal SCSI (spc@0) * "SCSIEX" ... External SCSI (spc@1 or mha@0) */ if (*(u_short *)(bootrom + 0x24 + 4) == 0x494e) { /* "IN" */ ha = (X68K_BOOT_SCSIIF_SPC << 4) | 0; } else if (badbaddr(EXSCSI_BDID)) { ha = (X68K_BOOT_SCSIIF_MHA << 4) | 0; } else { ha = (X68K_BOOT_SCSIIF_SPC << 4) | 1; } return ha; }
void dmainit() { register struct dmareg *dma = (struct dmareg *)DMA_BASE; register struct dma_softc *dc; register int i; char rev; /* * Determine the DMA type. * Don't know how to easily differentiate the A and B cards, * so we just hope nobody has an A card (A cards will work if * DMAINTLVL is set to 3). */ if (!badbaddr((char *)&dma->dma_id[2])) rev = dma->dma_id[2]; else { rev = 'B'; #if !defined(HP320) panic("dmainit: DMA card requires hp320 support"); #endif } dc = &dma_softc[0]; for (i = 0; i < NDMA; i++) { dc->sc_hwaddr = (i & 1) ? &dma->dma_chan1 : &dma->dma_chan0; dc->sc_Bhwaddr = (i & 1) ? &dma->dma_Bchan1 : &dma->dma_Bchan0; dc->sc_type = rev == 'B' ? DMA_B : DMA_C; dc++; dmachan[i].dq_forw = dmachan[i].dq_back = &dmachan[i]; } dmachan[i].dq_forw = dmachan[i].dq_back = &dmachan[i]; #ifdef DEBUG /* make sure timeout is really not needed */ timeout(dmatimeout, 0, 30 * hz); #endif printf("dma: 98620%c with 2 channels, %d bit DMA\n", rev, rev == 'B' ? 16 : 32); }
/* * Check the type of SCSI interface */ static int get_scsi_host_adapter(char *devstr) { uint8_t *bootrom; int ha; #ifdef XXBOOT_DEBUG *(uint32_t *)(devstr + 0) = '/' << 24 | 's' << 16 | 'p' << 8 | 'c'; #if defined(CDBOOT) *(uint32_t *)(devstr + 4) = '@' << 24 | '0' << 16 | '/' << 8 | 'c'; #else *(uint32_t *)(devstr + 4) = '@' << 24 | '0' << 16 | '/' << 8 | 's'; #endif *(uint32_t *)(devstr + 8) = 'd' << 24 | '@' << 16 | '0' << 8 | ','; *(uint32_t *)(devstr + 12) = '0' << 24 | ':' << 16 | 'a' << 8 | '\0'; #endif bootrom = (uint8_t *)(BOOT_INFO & 0x00ffffe0); /* * bootrom+0x24 "SCSIIN" ... Internal SCSI (spc@0) * "SCSIEX" ... External SCSI (spc@1 or mha@0) */ if (*(uint16_t *)(bootrom + 0x24 + 4) == 0x494e) { /* "IN" */ ha = (X68K_BOOT_SCSIIF_SPC << 4) | 0; } else if (badbaddr(EXSCSI_BDID)) { ha = (X68K_BOOT_SCSIIF_MHA << 4) | 0; #ifdef XXBOOT_DEBUG *(uint32_t *)devstr = '/' << 24 | 'm' << 16 | 'h' << 8 | 'a'; #endif } else { ha = (X68K_BOOT_SCSIIF_SPC << 4) | 1; #ifdef XXBOOT_DEBUG devstr[5] = '1'; #endif } return ha; }