Ejemplo n.º 1
0
/*
 * tty3215_open
 *
 * This routine is called whenever a 3215 tty is opened.
 */
static int
tty3215_open(struct tty_struct *tty, struct file * filp)
{
	struct raw3215_info *raw;
	int retval, line;

	line = tty->index;
	if ((line < 0) || (line >= NR_3215))
		return -ENODEV;

	raw = raw3215[line];
	if (raw == NULL)
		return -ENODEV;

	tty->driver_data = raw;
	raw->tty = tty;

	tty->low_latency = 0;  /* don't use bottom half for pushing chars */
	/*
	 * Start up 3215 device
	 */
	retval = raw3215_startup(raw);
	if (retval)
		return retval;

	return 0;
}
Ejemplo n.º 2
0
/*
 * 3215 console initialization code called from console_init().
 * NOTE: This is called before kmalloc is available.
 */
static int __init
con3215_init(void)
{
	struct ccw_device *cdev;
	struct raw3215_info *raw;
	struct raw3215_req *req;
	int i;

	/* Check if 3215 is to be the console */
	if (!CONSOLE_IS_3215)
		return -ENODEV;

	/* Set the console mode for VM */
	if (MACHINE_IS_VM) {
		cpcmd("TERM CONMODE 3215", NULL, 0);
		cpcmd("TERM AUTOCR OFF", NULL, 0);
	}

	/* allocate 3215 request structures */
	raw3215_freelist = NULL;
	spin_lock_init(&raw3215_freelist_lock);
	for (i = 0; i < NR_3215_REQ; i++) {
		req = (struct raw3215_req *) alloc_bootmem_low(sizeof(struct raw3215_req));
		req->next = raw3215_freelist;
		raw3215_freelist = req;
	}

	cdev = ccw_device_probe_console();
	if (!cdev)
		return -ENODEV;

	raw3215[0] = raw = (struct raw3215_info *)
		alloc_bootmem_low(sizeof(struct raw3215_info));
	memset(raw, 0, sizeof(struct raw3215_info));
	raw->buffer = (char *) alloc_bootmem_low(RAW3215_BUFFER_SIZE);
	raw->inbuf = (char *) alloc_bootmem_low(RAW3215_INBUF_SIZE);
	raw->cdev = cdev;
	raw->lock = get_ccwdev_lock(cdev);
	cdev->dev.driver_data = raw;
	cdev->handler = raw3215_irq;

	raw->flags |= RAW3215_FIXED;
	tasklet_init(&raw->tasklet,
		     (void (*)(unsigned long)) raw3215_tasklet,
		     (unsigned long) raw);
	init_waitqueue_head(&raw->empty_wait);

	/* Request the console irq */
	if (raw3215_startup(raw) != 0) {
		free_bootmem((unsigned long) raw->inbuf, RAW3215_INBUF_SIZE);
		free_bootmem((unsigned long) raw->buffer, RAW3215_BUFFER_SIZE);
		free_bootmem((unsigned long) raw, sizeof(struct raw3215_info));
		raw3215[0] = NULL;
		printk("Couldn't find a 3215 console device\n");
		return -ENODEV;
	}
	register_console(&con3215);
	return 0;
}
Ejemplo n.º 3
0
/*
 * 3215 console initialization code called from console_init().
 * NOTE: This is called before kmalloc is available.
 */
void __init con3215_init(void)
{
	raw3215_info *raw;
	raw3215_req *req;
	int irq;
	int i;

	/* Check if 3215 is to be the console */
	if (!CONSOLE_IS_3215)
		return;
	irq = raw3215_find_dev(0);

	/* Set the console mode for VM */
	if (MACHINE_IS_VM) {
		cpcmd("TERM CONMODE 3215", NULL, 0);
		cpcmd("TERM AUTOCR OFF", NULL, 0);
	}

	/* allocate 3215 request structures */
	raw3215_freelist = NULL;
	spin_lock_init(&raw3215_freelist_lock);
	for (i = 0; i < NR_3215_REQ; i++) {
                req = (raw3215_req *) alloc_bootmem_low(sizeof(raw3215_req));
		req->next = raw3215_freelist;
		raw3215_freelist = req;
	}

	ctrlchar_init();

#ifdef CONFIG_TN3215_CONSOLE
        raw3215[0] = raw = (raw3215_info *)
                alloc_bootmem_low(sizeof(raw3215_info));
	memset(raw, 0, sizeof(raw3215_info));
        raw->buffer = (char *) alloc_bootmem_low(RAW3215_BUFFER_SIZE);
        raw->inbuf = (char *) alloc_bootmem_low(RAW3215_INBUF_SIZE);

	/* Find the first console */
	raw->irq = raw3215_find_dev(0);
	raw->flags |= RAW3215_FIXED;
	raw->tqueue.routine = raw3215_softint;
	raw->tqueue.data = raw;
        init_waitqueue_head(&raw->empty_wait);

	/* Request the console irq */
	if ( raw3215_startup(raw) != 0 )
		raw->irq = -1;

	if (raw->irq != -1) {
		register_console(&con3215);
	} else {
                free_bootmem((unsigned long) raw->inbuf, RAW3215_INBUF_SIZE);
                free_bootmem((unsigned long) raw->buffer, RAW3215_BUFFER_SIZE);
                free_bootmem((unsigned long) raw, sizeof(raw3215_info));
		raw3215[0] = NULL;
		printk("Couldn't find a 3215 console device\n");
	}
#endif
}
Ejemplo n.º 4
0
/*
 * 3215 console initialization code called from console_init().
 */
static int __init con3215_init(void)
{
	struct ccw_device *cdev;
	struct raw3215_info *raw;
	struct raw3215_req *req;
	int i;

	/* Check if 3215 is to be the console */
	if (!CONSOLE_IS_3215)
		return -ENODEV;

	/* Set the console mode for VM */
	if (MACHINE_IS_VM) {
		cpcmd("TERM CONMODE 3215", NULL, 0, NULL);
		cpcmd("TERM AUTOCR OFF", NULL, 0, NULL);
	}

	/* allocate 3215 request structures */
	raw3215_freelist = NULL;
	spin_lock_init(&raw3215_freelist_lock);
	for (i = 0; i < NR_3215_REQ; i++) {
		req = kzalloc(sizeof(struct raw3215_req), GFP_KERNEL | GFP_DMA);
		if (!req)
			return -ENOMEM;
		req->next = raw3215_freelist;
		raw3215_freelist = req;
	}

	cdev = ccw_device_create_console(&raw3215_ccw_driver);
	if (IS_ERR(cdev))
		return -ENODEV;

	raw3215[0] = raw = raw3215_alloc_info();
	raw->cdev = cdev;
	dev_set_drvdata(&cdev->dev, raw);
	cdev->handler = raw3215_irq;

	raw->flags |= RAW3215_FIXED;
	if (ccw_device_enable_console(cdev)) {
		ccw_device_destroy_console(cdev);
		raw3215_free_info(raw);
		raw3215[0] = NULL;
		return -ENODEV;
	}

	/* Request the console irq */
	if (raw3215_startup(raw) != 0) {
		raw3215_free_info(raw);
		raw3215[0] = NULL;
		return -ENODEV;
	}
	atomic_notifier_chain_register(&panic_notifier_list, &on_panic_nb);
	register_reboot_notifier(&on_reboot_nb);
	register_console(&con3215);
	return 0;
}
Ejemplo n.º 5
0
static int raw3215_set_online (struct ccw_device *cdev)
{
	struct raw3215_info *raw;

	raw = dev_get_drvdata(&cdev->dev);
	if (!raw)
		return -ENODEV;

	return raw3215_startup(raw);
}
Ejemplo n.º 6
0
/*
 * 3215 console initialization code called from console_init().
 * NOTE: This is called before kmalloc is available.
 */
static int __init con3215_init(void)
{
	struct ccw_device *cdev;
	struct raw3215_info *raw;
	struct raw3215_req *req;
	int i;

	/* Check if 3215 is to be the console */
	if (!CONSOLE_IS_3215)
		return -ENODEV;

	/* Set the console mode for VM */
	if (MACHINE_IS_VM) {
		cpcmd("TERM CONMODE 3215", NULL, 0, NULL);
		cpcmd("TERM AUTOCR OFF", NULL, 0, NULL);
	}

	/* allocate 3215 request structures */
	raw3215_freelist = NULL;
	spin_lock_init(&raw3215_freelist_lock);
	for (i = 0; i < NR_3215_REQ; i++) {
		req = kzalloc(sizeof(struct raw3215_req), GFP_KERNEL | GFP_DMA);
		req->next = raw3215_freelist;
		raw3215_freelist = req;
	}

	cdev = ccw_device_probe_console();
	if (IS_ERR(cdev))
		return -ENODEV;

	raw3215[0] = raw = (struct raw3215_info *)
		kzalloc(sizeof(struct raw3215_info), GFP_KERNEL | GFP_DMA);
	raw->buffer = kzalloc(RAW3215_BUFFER_SIZE, GFP_KERNEL | GFP_DMA);
	raw->inbuf = kzalloc(RAW3215_INBUF_SIZE, GFP_KERNEL | GFP_DMA);
	raw->cdev = cdev;
	dev_set_drvdata(&cdev->dev, raw);
	cdev->handler = raw3215_irq;

	raw->flags |= RAW3215_FIXED;
	init_waitqueue_head(&raw->empty_wait);
	tasklet_init(&raw->tlet, raw3215_wakeup, (unsigned long) raw);

	/* Request the console irq */
	if (raw3215_startup(raw) != 0) {
		kfree(raw->inbuf);
		kfree(raw->buffer);
		kfree(raw);
		raw3215[0] = NULL;
		return -ENODEV;
	}
	atomic_notifier_chain_register(&panic_notifier_list, &on_panic_nb);
	register_reboot_notifier(&on_reboot_nb);
	register_console(&con3215);
	return 0;
}
Ejemplo n.º 7
0
static int
raw3215_set_online (struct ccw_device *cdev)
{
	struct raw3215_info *raw;

	raw = cdev->dev.driver_data;
	if (!raw)
		return -ENODEV;

	return raw3215_startup(raw);
}
Ejemplo n.º 8
0
/*
 * tty3215_open
 *
 * This routine is called whenever a 3215 tty is opened.
 */
static int tty3215_open(struct tty_struct *tty, struct file * filp)
{
	raw3215_info *raw;
	int retval, line;

	line = MINOR(tty->device) - tty->driver.minor_start;
	if ((line < 0) || (line >= NR_3215))
		return -ENODEV;

	raw = raw3215[line];
	if (raw == NULL) {
		raw = kmalloc(sizeof(raw3215_info) +
			      RAW3215_INBUF_SIZE, GFP_KERNEL|GFP_DMA);
		if (raw == NULL)
			return -ENOMEM;
		raw->irq = raw3215_find_dev(line);
		if (raw->irq == -1) {
			kfree(raw);
			return -ENODEV;
		}
		raw->inbuf = (char *) raw + sizeof(raw3215_info);
		memset(raw, 0, sizeof(raw3215_info));
		raw->buffer = (char *) kmalloc(RAW3215_BUFFER_SIZE,
					       GFP_KERNEL|GFP_DMA);
		if (raw->buffer == NULL) {
			kfree(raw);
			return -ENOMEM;
		}
		raw->tqueue.routine = raw3215_softint;
		raw->tqueue.data = raw;
                init_waitqueue_head(&raw->empty_wait);
		raw3215[line] = raw;
	}

	tty->driver_data = raw;
	raw->tty = tty;

	tty->low_latency = 0;  /* don't use bottom half for pushing chars */
	/*
	 * Start up 3215 device
	 */
	retval = raw3215_startup(raw);
	if (retval)
		return retval;

	return 0;
}
Ejemplo n.º 9
0
/*
 * tty3215_open
 *
 * This routine is called whenever a 3215 tty is opened.
 */
static int tty3215_open(struct tty_struct *tty, struct file * filp)
{
	struct raw3215_info *raw = tty->driver_data;
	int retval;

	tty_port_tty_set(&raw->port, tty);

	raw->port.low_latency = 0; /* don't use bottom half for pushing chars */
	/*
	 * Start up 3215 device
	 */
	retval = raw3215_startup(raw);
	if (retval)
		return retval;

	return 0;
}