Ejemplo n.º 1
0
void
consinit(void)
{
	static int consinit_called = 0;
	uint32_t ckenreg = ioreg_read(VIPER_CLKMAN_VBASE+CLKMAN_CKEN);
#if 0
	char *console = CONSDEVNAME;
#endif

	if (consinit_called != 0)
		return;
	consinit_called = 1;

#if NCOM > 0

#ifdef FFUARTCONSOLE
#ifdef KGDB
	if (0 == strcmp(kgdb_devname, "ffuart")) {
		/* port is reserved for kgdb */
	} else
#endif
	if (0 == comcnattach(&pxa2x0_a4x_bs_tag, PXA2X0_FFUART_BASE, 
		     comcnspeed, PXA2X0_COM_FREQ, COM_TYPE_PXA2x0, comcnmode)) {

#if 0
		/* XXX: can't call pxa2x0_clkman_config yet */
		pxa2x0_clkman_config(CKEN_FFUART, 1);
#else
		ioreg_write(VIPER_CLKMAN_VBASE+CLKMAN_CKEN,
		    ckenreg|CKEN_FFUART);
#endif

		return;
	}

#endif /* FFUARTCONSOLE */

#ifdef BTUARTCONSOLE
#ifdef KGDB
	if (0 == strcmp(kgdb_devname, "btuart")) {
		/* port is reserved for kgdb */
	} else
#endif
	if (0 == comcnattach(&pxa2x0_a4x_bs_tag, PXA2X0_BTUART_BASE,
		comcnspeed, PXA2X0_COM_FREQ, COM_TYPE_PXA2x0, comcnmode)) {
		ioreg_write(VIPER_CLKMAN_VBASE+CLKMAN_CKEN,
		    ckenreg|CKEN_BTUART);
		return;
	}
#endif /* BTUARTCONSOLE */

	/* no console, guess we're flying blind */

#endif /* NCOM */

}
static void
consinit_com(const char *consdev)
{
	static const bus_addr_t comcnaddrs[] = {
		IYONIX_UART1,		/* com0 */
	};
	/*
	 * Console devices are mapped VA==PA.  Our devmap reflects
	 * this, so register it now so drivers can map the console
	 * device.
	 */
	pmap_devmap_register(iyonix_devmap);

	/* When we support more than the first serial port as console,
	 * we should check consdev for a number.
	 */
#if NCOM > 0
	if (comcnattach(&obio_bs_tag, comcnaddrs[comcnunit], comcnspeed,
	    COM_FREQ, COM_TYPE_NORMAL, comcnmode))
	{
		panic("can't init serial console @%lx", comcnaddrs[comcnunit]);
	}
#else
	panic("serial console @%lx not configured", comcnaddrs[comcnunit]);
#endif

#if KGDB
#if NCOM > 0
	if (strcmp(kgdb_devname, "com") == 0) {
		com_kgdb_attach(&obio_bs_tag, kgdb_devaddr, kgdb_devrate,
		    COM_FREQ, COM_TYPE_NORMAL, kgdb_devmode);
	}
#endif	/* NCOM > 0 */
#endif	/* KGDB */
}
void
consinit(void)
{
	static const bus_addr_t comcnaddrs[] = {
		IQ80310_UART2,		/* com0 (J9) */
		IQ80310_UART1,		/* com1 (J10) */
	};
	static int consinit_called;

	if (consinit_called != 0)
		return;

	consinit_called = 1;

	/*
	 * Console devices are mapped VA==PA.  Our devmap reflects
	 * this, so register it now so drivers can map the console
	 * device.
	 */
	pmap_devmap_register(iq80310_devmap);

#if NCOM > 0
	if (comcnattach(&obio_bs_tag, comcnaddrs[comcnunit], comcnspeed,
	    COM_FREQ, COM_TYPE_NORMAL, comcnmode))
		panic("can't init serial console @%lx", comcnaddrs[comcnunit]);
#else
	panic("serial console @%lx not configured", comcnaddrs[comcnunit]);
#endif
}
Ejemplo n.º 4
0
void
com_macebus_attach(struct device *parent, struct device *self, void *aux)
{
	struct com_softc *sc = (void *)self;
	struct macebus_attach_args *maa = aux;

	sc->sc_iot = maa->maa_iot;
	sc->sc_hwflags = 0;
	sc->sc_swflags = 0;
	sc->sc_iobase = maa->maa_baseaddr;
	sc->sc_frequency = 1843200;

	/* If it's in use as the console, then it's there. */
	if (maa->maa_baseaddr == comconsaddr && !comconsattached) {
		if (comcnattach(sc->sc_iot, sc->sc_iobase, comconsrate,
		    sc->sc_frequency, (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8))
			panic("failed to setup serial console!");
		sc->sc_ioh = comconsioh;
	} else {
		if (bus_space_map(sc->sc_iot, maa->maa_baseaddr, COM_NPORTS, 0,
		    &sc->sc_ioh)) {
			printf(": can't map i/o space\n");
			return;
		}
	}

	com_attach_subr(sc);

	macebus_intr_establish(maa->maa_intr, maa->maa_mace_intr,
	    IST_EDGE, IPL_TTY, comintr, (void *)sc, sc->sc_dev.dv_xname);
}
Ejemplo n.º 5
0
void
dec_kn300_cons_init()
{
	struct ctb *ctb;
	struct mcpcia_config *ccp;
	extern struct mcpcia_config mcpcia_console_configuration;

	ccp = &mcpcia_console_configuration;
	/* It's already initialized. */

	ctb = (struct ctb *)(((char *)hwrpb) + hwrpb->rpb_ctb_off);

	switch (ctb->ctb_term_type) {
	case CTB_PRINTERPORT: 
		/* serial console ... */
		/*
		 * Delay to allow PROM putchars to complete.
		 * FIFO depth * character time,
		 * character time = (1000000 / (defaultrate / 10))
		 */
		DELAY(160000000 / comcnrate);
		if (comcnattach(&ccp->cc_iot, 0x3f8, comcnrate,
		    COM_FREQ, COM_TYPE_NORMAL,
		    (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8)) {
			panic("can't init serial console");

		}
		break;

	case CTB_GRAPHICS:
#if NPCKBD > 0
		/* display console ... */
		/* XXX */
		(void) pckbc_cnattach(&ccp->cc_iot, IO_KBD, KBCMDP,
		    PCKBC_KBD_SLOT);

		if (CTB_TURBOSLOT_TYPE(ctb->ctb_turboslot) ==
		    CTB_TURBOSLOT_TYPE_ISA)
			isa_display_console(&ccp->cc_iot, &ccp->cc_memt);
		else
			pci_display_console(&ccp->cc_iot, &ccp->cc_memt,
			    &ccp->cc_pc, CTB_TURBOSLOT_BUS(ctb->ctb_turboslot),
			    CTB_TURBOSLOT_SLOT(ctb->ctb_turboslot), 0);
#else
		panic("not configured to use display && keyboard console");
#endif
		break;

	default:
		printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type);
		printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot);

		panic("consinit: unknown console type %ld",
		    ctb->ctb_term_type);
	}
#ifdef KGDB
	/* Attach the KGDB device. */
	alpha_kgdb_init(kgdb_devlist, &ccp->cc_iot);
#endif /* KGDB */
}
Ejemplo n.º 6
0
static int
mace_serial_init(const char *consdev)
{
#if (NCOM > 0)
	const char     *dbaud;
	int       speed;
	u_int32_t base;

	if ((strlen(consdev) == 9) && (!strncmp(consdev, "serial", 6)) &&
	    (consdev[7] == '0' || consdev[7] == '1')) {
		/* Get comm speed from ARCS */
		dbaud = ARCBIOS->GetEnvironmentVariable("dbaud");
		speed = strtoul(dbaud, NULL, 10);
		base = (consdev[7] == '0') ? MACE_ISA_SER1_BASE :
		    MACE_ISA_SER2_BASE;

		delay(10000);

		/* XXX: hardcoded MACE iotag */
		if (comcnattach(3, MIPS_PHYS_TO_KSEG1(MACE_BASE + base),
		    speed, COM_FREQ, COM_TYPE_NORMAL, comcnmode) == 0)
			return (1);
	}
#endif

	return (0);
}
Ejemplo n.º 7
0
void
consinit(void)
{
	static const bus_addr_t comcnaddrs[] = {
		IQ80321_UART1          /* com0 */
	};
	static int consinit_called;

	if (consinit_called != 0)
		return;

	consinit_called = 1;

	/*
	 * Console devices are mapped VA==PA.  Our devmap reflects
	 * this, so register it now so drivers can map the console
	 * device.
	 */
	pmap_devmap_register(iq80321_devmap);

#if NCOM > 0
	if (comcnattach(&obio_bs_tag, comcnaddrs[0], comcnspeed,
	    COM_FREQ, comcnmode))
		panic("can't init serial console @%lx", comcnaddrs[0]);
	comdefaultrate = comcnspeed;
#else
	panic("serial console @%lx not configured", comcnaddrs[0]);
#endif
}
Ejemplo n.º 8
0
void
consinit(void)
{
	static const bus_addr_t comcnaddrs[] = {
		BRH_UART1_BASE,		/* com0 */
		BRH_UART2_BASE,		/* com1 */
	};
	static int consinit_called;

	if (consinit_called != 0)
		return;

	consinit_called = 1;

	/*
	 * brh_start() has mapped the console devices for us per
	 * the devmap, so register it now so drivers can map the
	 * console device.
	 */
	pmap_devmap_register(brh_devmap);

#if NCOM > 0
	if (comcnattach(&obio_bs_tag, comcnaddrs[comcnunit], comcnspeed,
	    BECC_PERIPH_CLOCK, COM_TYPE_NORMAL, comcnmode))
		panic("can't init serial console @%lx", comcnaddrs[comcnunit]);
#else
	panic("serial console @%lx not configured", comcnaddrs[comcnunit]);
#endif
}
Ejemplo n.º 9
0
/*
 * console initialization
 */
void
c_isa_cons_init(void)
{

	if (!com_console) {
#if NVGA_ISA > 0
		if (vga_isa_cnattach(&arc_bus_io, &arc_bus_mem) == 0) {
#if NPCKBC > 0
			pckbc_cnattach(&arc_bus_io, IO_KBD, KBCMDP,
			    PCKBC_KBD_SLOT, 0);
			return;
#endif
		}
#endif
#if NPC_ISA > 0
		if (pccons_isa_cnattach(&arc_bus_io, &arc_bus_mem) == 0)
			return;
#endif
	}

#if NCOM > 0
	if (com_console_address == 0)
		com_console_address = IO_COM1;
	comcnattach(&arc_bus_io, com_console_address,
	    com_console_speed, com_freq, COM_TYPE_NORMAL, com_console_mode);
#endif
}
Ejemplo n.º 10
0
/*
 * consinit:
 * initialize the system console.
 * XXX - shouldn't deal with this initted thing, but then,
 * it shouldn't be called from initppc either.
 */
void
consinit(void)
{
	static int initted = 0;
#if (NCOM > 0)
	bus_space_tag_t tag;
#endif

	if (initted)
		return;
	initted = 1;

#if (NCOM > 0)
	/* We *know* the com-console attaches to opb */
	tag = opb_get_bus_space_tag();

	if (comcnattach(tag, CONADDR, CONSPEED, COM_FREQ * 6,
	    COM_TYPE_NORMAL, comcnmode))
		panic("can't init serial console @%x", CONADDR);
	else
		return;
#endif
	panic("console device missing -- serial console not in kernel");
	/* Of course, this is moot if there is no console... */
}
Ejemplo n.º 11
0
void
consinit(void)
{
	static int consinit_called = 0;

	if (consinit_called != 0)
		return;

	consinit_called = 1;

	bus_space_handle_t bh;
	if (bus_space_map(&omap_a4x_bs_tag, consaddr, OMAP_COM_SIZE, 0, &bh))
		panic("Serial console can not be mapped.");

	/*
	 * The TRM says the mode should be disabled while dll and dlh are
	 * being changed so we disable before attaching, then enable.
	 */
	bus_space_write_1(&omap_a4x_bs_tag, bh,
			  OMAP_COM_MDR1, OMAP_COM_MDR1_MODE_DISABLE);

	if (comcnattach(&omap_a4x_bs_tag, consaddr, conspeed,
			OMAP_COM_FREQ, COM_TYPE_NORMAL, conmode))
		panic("Serial console can not be initialized.");

	bus_space_write_1(&omap_a4x_bs_tag, bh,
			  OMAP_COM_MDR1, OMAP_COM_MDR1_MODE_UART_16X);

	bus_space_unmap(&omap_a4x_bs_tag, bh, OMAP_COM_SIZE);
}
Ejemplo n.º 12
0
void
com_mainbus_cninit(struct consdev *cn)
{

	comcnattach(0, COM_BASE, 115200, COM_MAINBUS_FREQ, COM_TYPE_NORMAL,
	    CONMODE);
}
Ejemplo n.º 13
0
void
consinit(void)
{
	static const bus_addr_t comcnaddrs[] = {
		HDLG_UART1,		/* com0 */
	};
	static int consinit_called;

	if (consinit_called)
		return;
	consinit_called = 1;

	/*
	 * Console devices are mapped VA==PA.  Our devmap reflects
	 * this, so register it now so drivers can map the console
	 * device.
	 */
	pmap_devmap_register(hdlg_devmap);

#if NCOM > 0
	if (comcnattach(&obio_bs_tag, comcnaddrs[comcnunit], comcnspeed,
	    COM_FREQ, COM_TYPE_NORMAL, comcnmode))
		panic("can't init serial console @%lx", comcnaddrs[comcnunit]);
#else
	panic("serial console @%lx not configured", comcnaddrs[comcnunit]);
#endif
#if KGDB
#if NCOM > 0
	if (strcmp(kgdb_devname, "com") == 0) {
		com_kgdb_attach(&obio_bs_tag, kgdb_devaddr, kgdb_devrate,
				COM_FREQ, COM_TYPE_NORMAL, kgdb_devmode);
	}
#endif	/* NCOM > 0 */
#endif	/* KGDB */
}
Ejemplo n.º 14
0
void
consinit(void)
{
	bus_space_tag_t bst = &awin_a4x_bs_tag;
#if NCOM > 0
	bus_space_handle_t bh;
#endif
	static int consinit_called = 0;

	if (consinit_called != 0)
		return;

	consinit_called = 1;

#if NCOM > 0
	if (bus_space_map(bst, conaddr, AWIN_UART_SIZE, 0, &bh))
		panic("Serial console can not be mapped.");

	if (comcnattach(bst, conaddr, conspeed, AWIN_UART_FREQ,
		    COM_TYPE_NORMAL, conmode))
		panic("Serial console can not be initialized.");

	bus_space_unmap(bst, bh, AWIN_UART_SIZE);
#else
#error only COM console is supported

#if NUKBD > 0
	ukbd_cnattach();	/* allow USB keyboard to become console */
#endif
#endif
}
Ejemplo n.º 15
0
static void
dec_2100_a50_cons_init()
{
	struct ctb *ctb;
	struct apecs_config *acp;
	extern struct apecs_config apecs_configuration;

	acp = &apecs_configuration;
	apecs_init(acp, 0);

	ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off);

	switch (ctb->ctb_term_type) {
	case CTB_PRINTERPORT: 
		/* serial console ... */
		/* XXX */
		{
			/*
			 * Delay to allow PROM putchars to complete.
			 * FIFO depth * character time,
			 * character time = (1000000 / (defaultrate / 10))
			 */
			DELAY(160000000 / comcnrate);

			if(comcnattach(&acp->ac_iot, 0x3f8, comcnrate,
			    COM_FREQ,
			    (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8))
				panic("can't init serial console");

			break;
		}

	case CTB_GRAPHICS:
#if NPCKBD > 0
		/* display console ... */
		/* XXX */
		(void) pckbc_cnattach(&acp->ac_iot, IO_KBD, KBCMDP,
		    PCKBC_KBD_SLOT);

		if (CTB_TURBOSLOT_TYPE(ctb->ctb_turboslot) ==
		    CTB_TURBOSLOT_TYPE_ISA)
			isa_display_console(&acp->ac_iot, &acp->ac_memt);
		else
			pci_display_console(&acp->ac_iot, &acp->ac_memt,
			    &acp->ac_pc, CTB_TURBOSLOT_BUS(ctb->ctb_turboslot),
			    CTB_TURBOSLOT_SLOT(ctb->ctb_turboslot), 0);
#else
		panic("not configured to use display && keyboard console");
#endif
		break;

	default:
		printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type);
		printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot);

		panic("consinit: unknown console type %ld",
		    ctb->ctb_term_type);
	}
}
Ejemplo n.º 16
0
void
consinit()
{
	/* XXX Check NVRAM to see if we should enable the console at all. */

	comcnattach(0, 0x1c800000, 115200, COM_FREQ * 10, CONMODE);

	return;
}
Ejemplo n.º 17
0
void
comcninit(struct consdev *cn)
{
	if (puccnbase == 0) {
		return;
	}
	comcnattach(puctag, puccnbase, CONSPEED, COM_FREQ, COM_TYPE_NORMAL,
	    CONMODE);
}
Ejemplo n.º 18
0
/*
 * consinit:
 * initialize the system console.
 */
void
consinit()
{
	struct consdev *cp;
	static int initted;

	if (initted)
		return;
	initted = 1;
	cp = NULL;

#if (NVGA > 0)
	/* The font built into the VGA ROM is broken: all the characters
	 * above the 127th do not match the standard set expected by the
	 * console.  E.g. boxes drawn using the ACS are incorrect. */
	vga_no_builtinfont = 1;
#endif

	if (!comconsole) {
#if (NVGA > 0) || (NIGSFB_OFBUS > 0)
#if (NIGSFB_OFBUS > 0)
		if (!igsfb_ofbus_cnattach(&isa_io_bs_tag, &isa_mem_bs_tag)) {
#if (NPCKBC > 0)
			pckbc_cnattach(&isa_io_bs_tag, IO_KBD, KBCMDP,
			    PCKBC_KBD_SLOT);
#endif /* NPCKBC */
			return;
		}
#endif /* NIGSFB_OFBUS */
#if (NVGA_OFBUS > 0)
		if (!vga_ofbus_cnattach(&isa_io_bs_tag, &isa_mem_bs_tag)) {
#if (NPCKBC > 0)
			pckbc_cnattach(&isa_io_bs_tag, IO_KBD, KBCMDP,
			    PCKBC_KBD_SLOT);
#endif /* NPCKBC */
			return;
		}
#endif /* NVGA_OFBUS */
#else /* NVGA */
#if (NOFCONS > 0)
		cp = &ofcons;
		ofcons_cnprobe(cp);
		if (cp->cn_pri == CN_INTERNAL) {
			ofcons_cninit(cp);
			cn_tab = cp;
			return;
		}
#endif /* NOFCONS */
#endif /* NVGA */
	}
#if (NCOM > 0)
	if (comcnattach(&isa_io_bs_tag, CONADDR, CONSPEED, COM_FREQ,
	    COM_TYPE_NORMAL, comcnmode))
		panic("can't init serial console");
#endif
}
Ejemplo n.º 19
0
/*
 * 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);
}
Ejemplo n.º 20
0
void
hd64465uartcninit(struct consdev *cp)
{

	hd64465uart_init();

	comcnattach(hd64465uart_chip.io_tag, 0x0, COMCN_SPEED, COM_FREQ,
	    COM_TYPE_NORMAL, CONMODE);	

	hd64465uart_chip.console = 1;
}
Ejemplo n.º 21
0
int
puc_cninit(struct consdev *cn)
{

	if (puccnbase == 0)
		return -1;

	return comcnattach(puctag, puccnbase, CONSPEED,
	    puccnflags & PUC_COM_CLOCKMASK, COM_TYPE_NORMAL,
	    CONMODE);
}
Ejemplo n.º 22
0
void
com_gsc_attach(device_t parent, device_t self, void *aux)
{
	struct com_gsc_softc *gsc = device_private(self);
	struct com_softc *sc = &gsc->sc_com;
	struct gsc_attach_args *ga = aux;
	int pagezero_cookie;
	bus_space_tag_t iot;
	bus_space_handle_t ioh;
	bus_addr_t iobase;

	sc->sc_dev = self;
	sc->sc_hwflags = 0;
	sc->sc_swflags = 0;
	iot = ga->ga_iot;
	iobase = (bus_addr_t)ga->ga_hpa + COMGSC_OFFSET;
	sc->sc_frequency = COMGSC_FREQUENCY;

	/* Test if this is the console.  Compare either HPA or device path. */
	pagezero_cookie = hp700_pagezero_map();
	if ((hppa_hpa_t)PAGE0->mem_cons.pz_hpa == ga->ga_hpa ) {

		/*
		 * This port is the console.  In this case we must call
		 * comcnattach() and later com_is_console() to initialize
		 * everything properly.
		 */

		if (comcnattach(iot, iobase, B9600,
			sc->sc_frequency, COM_TYPE_NORMAL,
			(TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8) != 0) {
			aprint_error(": can't comcnattach\n");
			hp700_pagezero_unmap(pagezero_cookie);
			return;
		}
	}
	hp700_pagezero_unmap(pagezero_cookie);

	/*
	 * Get the already initialized console ioh via com_is_console() if
	 * this is the console or map the I/O space if this isn't the console.
	 */

	if (!com_is_console(iot, iobase, &ioh) &&
	    bus_space_map(iot, iobase, COM_NPORTS, 0, &ioh) != 0) {
		aprint_error(": can't map I/O space\n");
		return;
	}
	COM_INIT_REGS(sc->sc_regs, iot, ioh, iobase);

	com_attach_subr(sc);
	gsc->sc_ih = hp700_intr_establish(sc->sc_dev, IPL_TTY,
	    comintr, sc, ga->ga_int_reg, ga->ga_irq);
}
Ejemplo n.º 23
0
void
com_ioc_attach(struct device *parent, struct device *self, void *aux)
{
	struct com_softc *sc = (void *)self;
	struct ioc_attach_args *iaa = aux;
	bus_space_handle_t ioh;
	int console = 0;

	if (comconsiot != NULL)
		console = iaa->iaa_memh + iaa->iaa_base ==
		    comconsiot->bus_base + comconsaddr;

	sc->sc_hwflags = 0;
	sc->sc_swflags = 0;
	sc->sc_frequency = 22000000 / 3;

	/* if it's in use as console, it's there. */
	if (!(console && !comconsattached)) {
		sc->sc_iot = iaa->iaa_memt;
		sc->sc_iobase = iaa->iaa_base;

		if (bus_space_subregion(iaa->iaa_memt, iaa->iaa_memh,
		    iaa->iaa_base, COM_NPORTS, &ioh) != 0) {
			printf(": can't map registers\n");
			return;
		}
	} else {
		/*
		 * If we are the console, reuse the existing bus_space
		 * information, so that comcnattach() invokes bus_space_map()
		 * with correct parameters.
		 */
		sc->sc_iot = comconsiot;
		sc->sc_iobase = comconsaddr;

		if (comcnattach(sc->sc_iot, sc->sc_iobase, comconsrate,
		    sc->sc_frequency, (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8))
			panic("can't setup serial console");
		ioh = comconsioh;
	}

	sc->sc_ioh = ioh;

	com_attach_subr(sc);

	ioc_intr_establish(parent, iaa->iaa_dev, IPL_TTY, comintr,
	    (void *)sc, sc->sc_dev.dv_xname);
}
Ejemplo n.º 24
0
void
consinit(void)
{
	static int consinit_called;
	bus_space_handle_t ioh;

	if (consinit_called != 0)
		return;

	consinit_called = 1;

	/*
	 * Console devices are already mapped in VA.  Our devmap reflects
	 * this, so register it now so drivers can map the console
	 * device.
	 */
	pmap_devmap_register(tsarm_devmap);
#if 0
	isa_tsarm_init(TS7XXX_IO16_VBASE + TS7XXX_ISAIO,
		TS7XXX_IO16_VBASE + TS7XXX_ISAMEM);	

        if (comcnattach(&isa_io_bs_tag, 0x3e8, comcnspeed,
            COM_FREQ, COM_TYPE_NORMAL, comcnmode))
        {
                panic("can't init serial console");
        }
#endif

#if NEPCOM > 0
	bus_space_map(&ep93xx_bs_tag, EP93XX_APB_HWBASE + EP93XX_APB_UART1, 
		EP93XX_APB_UART_SIZE, 0, &ioh);
        if (epcomcnattach(&ep93xx_bs_tag, EP93XX_APB_HWBASE + EP93XX_APB_UART1, 
		ioh, comcnspeed, comcnmode))
	{
		panic("can't init serial console");
	}
#else
	panic("serial console not configured");
#endif
#if KGDB
#if NEPCOM > 0
	if (strcmp(kgdb_devname, "epcom") == 0) {
		com_kgdb_attach(&ep93xx_bs_tag, kgdb_devaddr, kgdb_devrate,
			kgdb_devmode);
	}
#endif	/* NEPCOM > 0 */
#endif	/* KGDB */
}
Ejemplo n.º 25
0
void
com_ssio_attach(device_t parent, device_t self, void *aux)
{
	struct com_ssio_softc *sc_ssio = device_private(self);
	struct com_softc *sc = &sc_ssio->sc_com;
	struct ssio_attach_args *saa = aux;
	int pagezero_cookie;

	bus_addr_t iobase;
	bus_space_handle_t ioh;
	bus_space_tag_t iot;

	sc->sc_dev = self;
	iobase = saa->saa_iobase;
	iot = saa->saa_iot;
	if (bus_space_map(iot, iobase, COM_NPORTS,
	    0, &ioh)) {
		aprint_error(": can't map I/O space\n");
		return;
	}

        /* Test if this is the console. */
	pagezero_cookie = hp700_pagezero_map();
	if (PAGE0->mem_cons.pz_class == PCL_DUPLEX &&
	    PAGE0->mem_cons.pz_hpa == (struct iomod *)ioh) {
		bus_space_unmap(iot, ioh, COM_NPORTS);
		if (comcnattach(iot, iobase, B9600, COM_SSIO_FREQ,
		    COM_TYPE_NORMAL, 
		    (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8) != 0) {
			aprint_error(": can't comcnattach\n");
			hp700_pagezero_unmap(pagezero_cookie);
			return;
		}
	}
	hp700_pagezero_unmap(pagezero_cookie);

	sc->sc_frequency = COM_SSIO_FREQ;
	COM_INIT_REGS(sc->sc_regs, iot, ioh, iobase);
	com_attach_subr(sc);

	sc_ssio->sc_ih = ssio_intr_establish(IPL_TTY, saa->saa_irq,
	    comintr, sc, device_xname(self));
}
Ejemplo n.º 26
0
/*
 * consinit
 */
void
consinit(void)
{
	static int consinit_called;
	static const bus_addr_t addrs[2] = {
		IXP425_UART0_HWBASE, IXP425_UART1_HWBASE
	};

	if (consinit_called != 0)
		return;

	consinit_called = 1;

	pmap_devmap_register(ixp425_devmap);

	if (comcnattach(&ixp425_a4x_bs_tag, addrs[comcnunit],
	    comcnspeed, IXP425_UART_FREQ, COM_TYPE_PXA2x0, comcnmode))
		panic("can't init serial console (UART%d)", comcnunit);
}
Ejemplo n.º 27
0
static void
com_ebus_attach(device_t parent, device_t self, void *aux)
{
	struct com_ebus_softc *ebsc = device_private(self);
	struct com_softc *sc = &ebsc->ebsc_com;
	struct ebus_attach_args *ea = aux;
	bus_space_tag_t iot;
	bus_space_handle_t ioh;
	bus_addr_t iobase;

	sc->sc_dev = self;
	iot = ea->ea_bustag;
	iobase = EBUS_ADDR_FROM_REG(&ea->ea_reg[0]);
	sc->sc_frequency = COM_FREQ;
	sc->sc_hwflags = COM_HW_NO_TXPRELOAD;

	/*
	 * XXX: It would be nice to be able to split console input and
	 * output to different devices.  For now switch to serial
	 * console if PROM stdin is on serial (so that we can use DDB).
	 */
	if (prom_instance_to_package(prom_stdin()) == ea->ea_node)
		comcnattach(iot, iobase, B9600, sc->sc_frequency,
		    COM_TYPE_NORMAL, (CLOCAL | CREAD | CS8));

	if (!com_is_console(iot, iobase, &ioh)
	    && bus_space_map(iot, iobase, ea->ea_reg[0].size,
			     0, &ioh) != 0)
	{
		aprint_error(": unable to map device registers\n");
		return;
	}

	COM_INIT_REGS(sc->sc_regs, iot, ioh, iobase);

	com_attach_subr(sc);

	if (ea->ea_nintr != 0)
		(void)bus_intr_establish(iot, ea->ea_intr[0], IPL_SERIAL,
					 comintr, sc);
}
Ejemplo n.º 28
0
void
omap_platform_init_cons(void)
{
	paddr_t paddr;

	switch (board_id) {
	case BOARD_ID_OMAP3_BEAGLE:
	case BOARD_ID_OMAP3_OVERO:
		paddr = 0x49020000;
		break;
	case BOARD_ID_AM335X_BEAGLEBONE:
		paddr = 0x44e09000;
		break;
	case BOARD_ID_OMAP4_PANDA:
		paddr = 0x48020000;
		break;
	}

	comcnattach(&armv7_a4x_bs_tag, paddr, comcnspeed, 48000000, comcnmode);
	comdefaultrate = comcnspeed;
}
Ejemplo n.º 29
0
void
cn30xxuart_attach(struct device *parent, struct device *self, void *aux)
{
	struct com_softc *sc = (void *)self;
	struct uartbus_attach_args *uba = aux;
	int console;

	console = 1;

	sc->sc_iot = uba->uba_memt;
	sc->sc_iobase = uba->uba_baseaddr;
	sc->sc_hwflags = 0;
	sc->sc_swflags = 0;
	sc->sc_frequency = curcpu()->ci_hw.clock;
	sc->sc_uarttype = COM_UART_16550;

	/* if it's in use as console, it's there. */
	if (bus_space_map(sc->sc_iot, sc->sc_iobase, COM_NPORTS, 0, &sc->sc_ioh)) {
		printf(": can't map uart registers\n");
		return;
	}

	if (console && !comconsattached) {
		/*
		 * If we are the console, reuse the existing bus_space
		 * information, so that comcnattach() invokes bus_space_map()
		 * with correct parameters.
		 */

		if (comcnattach(sc->sc_iot, sc->sc_iobase, 115200,
		    sc->sc_frequency, (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8))
			panic("can't setup serial console");
	}

	com_attach_subr(sc);

	octeon_intr_establish(uba->uba_intr, IPL_TTY, comintr,
	    (void *)sc, sc->sc_dev.dv_xname);
}
void
com_mainbus_attach(device_t parent, device_t self, void *aux)
{
    struct com_mainbus_softc *msc = device_private(self);
    struct com_softc *sc = &msc->sc_com;
    int serial, interrupt_length;
    int interrupts[8];
    bus_space_tag_t iot;
    bus_space_handle_t ioh;
    bus_addr_t iobase;

    sc->sc_dev = self;

    serial = OF_finddevice("/ht@0/isa@4/serial@0x3f8");
    if (serial != -1) {
        interrupt_length =
            OF_getprop(serial, "interrupts", interrupts, sizeof(interrupts));
    }


    iot = (bus_space_tag_t)0xf4000000;
    iobase = 0x3f8;
    comcnattach(iot, iobase, 9600, 1843200, COM_TYPE_NORMAL, (CREAD | CS8));
    bus_space_map(iot, iobase, COM_NPORTS, 0, &ioh);
    COM_INIT_REGS(sc->sc_regs, iot, ioh, iobase);

    sc->sc_frequency = 1843200;

    com_attach_subr(sc);
#if 1
    msc->sc_ih =
        intr_establish(interrupts[0], IST_LEVEL, IPL_SERIAL, comintr, sc);

    if (msc->sc_ih == NULL)
        panic("failed to establish int handler");
#endif


}