コード例 #1
0
ファイル: consinit.c プロジェクト: MarginC/kame
/*
 * consinit:
 * initialize the system console.
 * XXX - shouldn't deal with this initted thing, but then,
 * it shouldn't be called from init_x86_64 either.
 */
void
consinit()
{
    const struct btinfo_console *consinfo;
    static int initted;

    if (initted)
        return;
    initted = 1;

#ifndef CONS_OVERRIDE
    consinfo = lookup_bootinfo(BTINFO_CONSOLE);
    if (!consinfo)
#endif
        consinfo = &default_consinfo;

#if (NPC > 0) || (NVGA > 0) || (NEGA > 0) || (NPCDISPLAY > 0)
    if (!strcmp(consinfo->devname, "pc")) {
#if (NVGA > 0)
        if (!vga_cnattach(X86_64_BUS_SPACE_IO, X86_64_BUS_SPACE_MEM,
                          -1, 1))
            goto dokbd;
#endif
#if (NEGA > 0)
        if (!ega_cnattach(X86_64_BUS_SPACE_IO, X86_64_BUS_SPACE_MEM))
            goto dokbd;
#endif
#if (NPCDISPLAY > 0)
        if (!pcdisplay_cnattach(X86_64_BUS_SPACE_IO, X86_64_BUS_SPACE_MEM))
            goto dokbd;
#endif
#if (NPC > 0)
        pccnattach();
#endif
        if (0) goto dokbd; /* XXX stupid gcc */
dokbd:
#if (NPCKBC > 0)
        pckbc_cnattach(X86_64_BUS_SPACE_IO, IO_KBD, KBCMDP,
                       PCKBC_KBD_SLOT);
#endif
        return;
    }
#endif /* PC | VT | VGA | PCDISPLAY */
#if (NCOM > 0)
    if (!strcmp(consinfo->devname, "com")) {
        bus_space_tag_t tag = X86_64_BUS_SPACE_IO;

        if (comcnattach(tag, consinfo->addr, consinfo->speed,
                        COM_FREQ, comcnmode))
            panic("can't init serial console @%x", consinfo->addr);

        return;
    }
#endif
    panic("invalid console device %s", consinfo->devname);
}
コード例 #2
0
ファイル: wscons_machdep.c プロジェクト: SylvestreG/bitrig
/*
 * Configure the display part of the console.
 */
void
wscn_video_init()
{
#if (NVGA > 0)
	if (vga_cnattach(X86_BUS_SPACE_IO, X86_BUS_SPACE_MEM, -1, 1) == 0)
		return;
#endif
#if (NPCDISPLAY > 0)
	if (pcdisplay_cnattach(X86_BUS_SPACE_IO, X86_BUS_SPACE_MEM) == 0)
		return;
#endif
}
コード例 #3
0
/*
 * consinit:
 * initialize the system console.
 * XXX - shouldn't deal with this initted thing, but then,
 * it shouldn't be called from init386 either.
 */
void
consinit(void)
{
	const struct btinfo_console *consinfo;
#if (NGENFB > 0)
	const struct btinfo_framebuffer *fbinfo;
#endif
	static int initted;
#if (NCOM > 0)
	int rv;
#endif

	if (initted)
		return;
	initted = 1;

#ifndef CONS_OVERRIDE
	consinfo = lookup_bootinfo(BTINFO_CONSOLE);
	if (!consinfo)
#endif
		consinfo = &default_consinfo;

#if (NGENFB > 0)
	fbinfo = lookup_bootinfo(BTINFO_FRAMEBUFFER);
#endif

	if (!strcmp(consinfo->devname, "pc")) {
		int error;
#if (NGENFB > 0)
		if (fbinfo && fbinfo->physaddr > 0) {
			if (x86_genfb_cnattach() == -1) {
				initted = 0;	/* defer */
				return;
			}
			genfb_cnattach();
			goto dokbd;
		}
		genfb_disable();
#endif
#if (NVGA > 0)
		if (!vga_cnattach(x86_bus_space_io, x86_bus_space_mem,
				  -1, 1))
			goto dokbd;
#endif
#if (NEGA > 0)
		if (!ega_cnattach(x86_bus_space_io, x86_bus_space_mem))
			goto dokbd;
#endif
#if (NPCDISPLAY > 0)
		if (!pcdisplay_cnattach(x86_bus_space_io, x86_bus_space_mem))
			goto dokbd;
#endif
		if (0) goto dokbd; /* XXX stupid gcc */
dokbd:
		error = ENODEV;
#if (NPCKBC > 0)
		error = pckbc_cnattach(x86_bus_space_io, IO_KBD, KBCMDP,
		    PCKBC_KBD_SLOT, 0);
#endif
#if (NUKBD > 0)
		if (error)
			error = ukbd_cnattach();
#endif
		if (error)
			printf("WARNING: no console keyboard, error=%d\n",
			       error);
		return;
	}
#if (NCOM > 0)
	if (!strcmp(consinfo->devname, "com")) {
		int addr = consinfo->addr;
		int speed = consinfo->speed;

#if (NCOM_PUC > 0) && defined(PUC_CNAUTO)
		puc_cnprobe(NULL);
		rv = puc_cninit(NULL);
		if (rv == 0)
			return;
#endif

		if (addr == 0)
			addr = CONADDR;
		if (speed == 0)
			speed = CONSPEED;

		rv = comcnattach(x86_bus_space_io, addr, speed,
				 COM_FREQ, COM_TYPE_NORMAL, comcnmode);
		if (rv != 0)
			panic("can't init serial console @%x", consinfo->addr);
		return;
	}
#endif
	panic("invalid console device %s", consinfo->devname);
}