void arch_post_mm_init(void) { if (config.cpu_active == 1) { /* Initialize IRQ routing */ irq_init(IRQ_COUNT, IRQ_COUNT); /* hard clock */ i8254_init(); #if (defined(CONFIG_FB) || defined(CONFIG_EGA)) bool bfb = false; #endif #ifdef CONFIG_FB bfb = bfb_init(); #endif #ifdef CONFIG_EGA if (!bfb) { outdev_t *egadev = ega_init(EGA_BASE, EGA_VIDEORAM); if (egadev) stdout_wire(egadev); } #endif /* Merge all memory zones to 1 big zone */ zone_merge_all(); } }
static PSD VGA_open(PSD psd) { #if _MINIX int s; struct mio_ldt86 mldt86; struct segdesc_s { /* segment descriptor for protected mode */ u16_t limit_low; u16_t base_low; u8_t base_middle; u8_t access; /* |P|DL|1|X|E|R|A| */ u8_t granularity; /* |G|X|0|A|LIMT| */ u8_t base_high; } *dp; int fd; unsigned long vidmem = 0xA0000; fd = open("/dev/mem", O_RDONLY); dp = (struct segdesc_s *) mldt86.entry; mldt86.idx = 1; s = ioctl(fd, MIOCGLDT86, &mldt86); dp->limit_low = 0xFFFF; dp->base_low = (vidmem >> 0) & 0xFFFF; dp->base_middle = (vidmem >> 16) & 0xFF; dp->base_high = (vidmem >> 24) & 0xFF; dp->granularity |= 0x80; mldt86.idx = 2; s = ioctl(fd, MIOCSLDT86, &mldt86); close(fd); #endif /* setup operating mode from environment variable*/ if(getenv("EGAMODE")) VGAMODE = FALSE; else VGAMODE = TRUE; #if ELKS /* disallow console switching while in graphics mode*/ if(ioctl(0, DCGET_GRAPH) != 0) return NULL; #endif #if HWINIT /* enter graphics mode*/ ega_hwinit(); #else /* init bios graphics mode*/ int10(VGAMODE? FNGR640x480: FNGR640x350, 0); #endif /* init driver variables depending on ega/vga mode*/ psd->xres = psd->xvirtres = 640; psd->yres = psd->yvirtres = VGAMODE? 480: 350; psd->planes = 4; psd->bpp = 4; psd->ncolors = 16; psd->pixtype = MWPF_PALETTE; #if HAVEBLIT psd->flags = PSF_SCREEN | PSF_HAVEBLIT; #else psd->flags = PSF_SCREEN; #endif /* init planes driver (sets psd->addr and psd->linelen)*/ ega_init(psd); #if ROMFONT /* init pc rom font routines*/ pcrom_init(psd); #endif #if 0 ROM_CHAR_HEIGHT = VGAMODE? 16: 14; #endif /* FIXME: add palette code*/ return psd; }