void rbox_dio_attach(struct device *parent, struct device *self, void *aux) { struct rbox_softc *sc = (struct rbox_softc *)self; struct dio_attach_args *da = aux; struct diofbreg *fbr; sc->sc_scode = da->da_scode; if (sc->sc_scode == conscode) { fbr = (struct diofbreg *)conaddr; /* already mapped */ sc->sc_fb = &diofb_cn; } else { sc->sc_fb = &sc->sc_fb_store; fbr = (struct diofbreg *) iomap(dio_scodetopa(sc->sc_scode), da->da_size); if (fbr == NULL || rbox_reset(sc->sc_fb, sc->sc_scode, fbr) != 0) { printf(": can't map framebuffer\n"); return; } } diofb_end_attach(sc, &rbox_accessops, sc->sc_fb, sc->sc_scode == conscode, NULL); }
static int init_smbios() { unsigned char *biosarea; int ofs, n; struct smbios_eps *s; unsigned char chksum; int pgofs; // Search the bios data area (0xf0000-0xffff0) for a valid SMBIOS structure. biosarea = iomap(0xF0000, 0x10000); if (!biosarea) return -EIO; for (ofs = 0x0000; ofs < 0xFFF0; ofs += 0x10) { s = (struct smbios_eps *) (biosarea + ofs); // Check _SM_ signature if (s->anchor[0] != '_' || s->anchor[1] != 'S' || s->anchor[2] != 'M' || s->anchor[3] != '_') continue; // Check structure checksum if (!s->length) continue; chksum = 0; for (n = 0; n < s->length; n++) chksum += biosarea[ofs + n]; if (chksum != 0) continue; //kprintf("smbios: SMBIOS %d.%d EPS found at 0x%08x\n", s->smbios_major, s->smbios_minor, 0xF0000 + ofs); //kprintf("smbios: table addr=0x%08x len=%d\n", s->structure_table_address, s->structure_table_length); // Make a copy of SMBIOS entry point structure eps = kmalloc(s->length); if (!eps) return -ENOMEM; memcpy(eps, s, s->length); // Map the SMBIOS structure table pgofs = PGOFF(eps->structure_table_address); smbios_table = iomap(eps->structure_table_address - pgofs, eps->structure_table_length + pgofs); if (!smbios_table) return -EIO; smbios_table += pgofs; break; } iounmap(biosarea, 0x10000); return 0; }
static int dio_scode_probe(int scode, int (*func)(bus_space_tag_t, bus_addr_t, int)) { struct bus_space_tag tag; bus_space_tag_t bst; void *pa, *va; bst = &tag; memset(bst, 0, sizeof(struct bus_space_tag)); bst->bustype = HP300_BUS_SPACE_DIO; pa = dio_scodetopa(scode); va = iomap(pa, PAGE_SIZE); if (va == 0) return 1; if (badaddr(va)) { iounmap(va, PAGE_SIZE); return 1; } iounmap(va, PAGE_SIZE); return (*func)(bst, (bus_addr_t)pa, scode); }