Ejemplo n.º 1
0
static void
dcons_cninit(struct consdev *cp)
{
	dcons_drv_init(0);
#if CONS_NODEV
	cp->cn_arg
#else
	cp->cn_dev->si_drv1
#endif
		= (void *)&sc[DCONS_CON]; /* share port0 with unit0 */
}
Ejemplo n.º 2
0
/* cnXXX works only for FreeBSD-5 */
static int
dcons_modevent(module_t mode, int type, void *data)
{
	int err = 0, ret;

	switch (type) {
	case MOD_LOAD:
		ret = dcons_drv_init(1);
		dcons_attach();
#if __FreeBSD_version >= 500000
		if (ret == 0) {
			dcons_cnprobe(&dcons_consdev);
			dcons_cninit(&dcons_consdev);
			cnadd(&dcons_consdev);
		}
#endif
		break;
	case MOD_UNLOAD:
		printf("dcons: unload\n");
		callout_stop(&dcons_callout);
#if DDB && DCONS_FORCE_GDB
#if CONS_NODEV
		gdb_arg = NULL;
#else
		gdbdev = NODEV;
#endif
#endif
#if __FreeBSD_version >= 500000
		cnremove(&dcons_consdev);
#endif
		dcons_detach(DCONS_CON);
		dcons_detach(DCONS_GDB);
		dcons_buf->magic = 0;

		contigfree(dcons_buf, DCONS_BUF_SIZE, M_DEVBUF);

		break;
	case MOD_SHUTDOWN:
		break;
	}
	return(err);
}
Ejemplo n.º 3
0
static int
dcons_modevent(module_t mode, int type, void *data)
{
	int err = 0, ret;

	switch (type) {
	case MOD_LOAD:
		ret = dcons_drv_init(1);
		if (ret != -1)
			dcons_attach();
		if (ret == 0) {
			dcons_cnprobe(&dcons_consdev);
			dcons_cninit(&dcons_consdev);
			cnadd(&dcons_consdev);
		}
		break;
	case MOD_UNLOAD:
		printf("dcons: unload\n");
		if (drv_init == 1) {
			callout_stop(&dcons_callout);
			cnremove(&dcons_consdev);
			dcons_detach(DCONS_CON);
			dcons_detach(DCONS_GDB);
			dg.buf->magic = 0;

			contigfree(dg.buf, DCONS_BUF_SIZE, M_DEVBUF);
		}

		break;
	case MOD_SHUTDOWN:
#if 0		/* Keep connection after halt */
		dg.buf->magic = 0;
#endif
		break;
	default:
		err = EOPNOTSUPP;
		break;
	}
	return(err);
}
Ejemplo n.º 4
0
static void
dcons_cninit(struct consdev *cp)
{
	dcons_drv_init(0);
	cp->cn_arg = (void *)&sc[DCONS_CON]; /* share port0 with unit0 */
}