コード例 #1
0
ファイル: hvc_xen.c プロジェクト: CSCLOG/beaglebone
static int __init xen_hvc_init(void)
{
	struct hvc_struct *hp;
	struct hv_ops *ops;

	if (!xen_pv_domain())
		return -ENODEV;

	if (xen_initial_domain()) {
		ops = &dom0_hvc_ops;
		xencons_irq = bind_virq_to_irq(VIRQ_CONSOLE, 0);
	} else {
		if (!xen_start_info->console.domU.evtchn)
			return -ENODEV;

		ops = &domU_hvc_ops;
		xencons_irq = bind_evtchn_to_irq(xen_start_info->console.domU.evtchn);
	}
	if (xencons_irq < 0)
		xencons_irq = 0; /* NO_IRQ */
	else
		irq_set_noprobe(xencons_irq);

	hp = hvc_alloc(HVC_COOKIE, xencons_irq, ops, 256);
	if (IS_ERR(hp))
		return PTR_ERR(hp);

	hvc = hp;

	console_pfn = mfn_to_pfn(xen_start_info->console.domU.mfn);

	return 0;
}
コード例 #2
0
static int __devinit hvc_bgq_probe(struct platform_device *pdev)
{
	struct device_node *dn;
	struct hvc_struct *hp;
	unsigned irq;

	dn = pdev->dev.of_node;
	BUG_ON(!dn);

	hvc_instantiate(0, 0, &hvc_bgq_ops);

	irq = irq_of_parse_and_map(dn, 0);
	if (irq == IRQ_TYPE_NONE) {
		pr_warn("%s: continuing with no IRQ\n", __func__);
		irq = 0;
	}

	hp = hvc_alloc(0, irq, &hvc_bgq_ops, 256);
	if (IS_ERR(hp))
		return PTR_ERR(hp);

	pr_info("hvc%u: console mapped to: %s\n", hp->vtermno, dn->full_name);
	add_preferred_console("hvc", 0, NULL);
	dev_set_drvdata(&pdev->dev, hp);

	return 0;
}
コード例 #3
0
static int __init hvc_rtas_init(void)
{
	struct hvc_struct *hp;

	if (rtascons_put_char_token == RTAS_UNKNOWN_SERVICE)
		rtascons_put_char_token = rtas_token("put-term-char");
	if (rtascons_put_char_token == RTAS_UNKNOWN_SERVICE)
		return -EIO;

	if (rtascons_get_char_token == RTAS_UNKNOWN_SERVICE)
		rtascons_get_char_token = rtas_token("get-term-char");
	if (rtascons_get_char_token == RTAS_UNKNOWN_SERVICE)
		return -EIO;

	BUG_ON(hvc_rtas_dev);

	/* Allocate an hvc_struct for the console device we instantiated
	 * earlier.  Save off hp so that we can return it on exit */
	hp = hvc_alloc(hvc_rtas_cookie, 0, &hvc_rtas_get_put_ops, 16);
	if (IS_ERR(hp))
		return PTR_ERR(hp);

	hvc_rtas_dev = hp;

	return 0;
}
コード例 #4
0
ファイル: hvc_dcc.c プロジェクト: mikuhatsune001/linux2.6.32
static int __init hvc_dcc_init(void)
{
	if (!hvc_dcc_check())
		return -ENODEV;

	hvc_alloc(0, 0, &hvc_dcc_get_put_ops, 128);
	return 0;
}
コード例 #5
0
ファイル: hvc_tile.c プロジェクト: mikuhatsune001/linux2.6.32
static int __init hvc_tile_init(void)
{
#ifndef __tilegx__
	struct hvc_struct *hp;
	hp = hvc_alloc(0, 0, &hvc_tile_get_put_ops, 128);
	return PTR_ERR_OR_ZERO(hp);
#else
	platform_device_register(&hvc_tile_pdev);
	return platform_driver_register(&hvc_tile_driver);
#endif
}
コード例 #6
0
static int __init hvc_beat_init(void)
{
	struct hvc_struct *hp;

	if (!firmware_has_feature(FW_FEATURE_BEAT))
		return -ENODEV;

	hp = hvc_alloc(0, 0, &hvc_beat_get_put_ops, 16);
	if (IS_ERR(hp))
		return PTR_ERR(hp);
	hvc_beat_dev = hp;
	return 0;
}
コード例 #7
0
ファイル: hvc_udbg.c プロジェクト: chunyenho/RTS-hw2
static int __init hvc_udbg_init(void)
{
    struct hvc_struct *hp;

    BUG_ON(hvc_udbg_dev);

    hp = hvc_alloc(0, NO_IRQ, &hvc_udbg_ops, 16);
    if (IS_ERR(hp))
        return PTR_ERR(hp);

    hvc_udbg_dev = hp;

    return 0;
}
コード例 #8
0
ファイル: hvc_xen.c プロジェクト: PennPanda/linux-repo
static int __init xen_init(void)
{
	struct hvc_struct *hp;

	if (!is_running_on_xen())
		return 0;

	xencons_irq = bind_evtchn_to_irq(xen_start_info->console.domU.evtchn);
	if (xencons_irq < 0)
		xencons_irq = 0 /* NO_IRQ */;
	hp = hvc_alloc(HVC_COOKIE, xencons_irq, &hvc_ops, 256);
	if (IS_ERR(hp))
		return PTR_ERR(hp);

	hvc = hp;
	return 0;
}
コード例 #9
0
static int __devinit hvc_vio_probe(struct vio_dev *vdev,
				const struct vio_device_id *id)
{
	struct hvc_struct *hp;

	
	if (!vdev || !id)
		return -EPERM;

	hp = hvc_alloc(vdev->unit_address, vdev->irq, &hvc_get_put_ops,
			MAX_VIO_PUT_CHARS);
	if (IS_ERR(hp))
		return PTR_ERR(hp);
	dev_set_drvdata(&vdev->dev, hp);

	return 0;
}
コード例 #10
0
ファイル: hvc_tile.c プロジェクト: mikuhatsune001/linux2.6.32
static int hvc_tile_probe(struct platform_device *pdev)
{
	struct hvc_struct *hp;
	int tile_hvc_irq;

	/* Create our IRQ and register it. */
	tile_hvc_irq = irq_alloc_hwirq(-1);
	if (!tile_hvc_irq)
		return -ENXIO;

	tile_irq_activate(tile_hvc_irq, TILE_IRQ_PERCPU);
	hp = hvc_alloc(0, tile_hvc_irq, &hvc_tile_get_put_ops, 128);
	if (IS_ERR(hp)) {
		irq_free_hwirq(tile_hvc_irq);
		return PTR_ERR(hp);
	}
	dev_set_drvdata(&pdev->dev, hp);

	return 0;
}
コード例 #11
0
ファイル: hvc_xen.c プロジェクト: johnny/CobraDroidBeta
static int __init xen_init(void)
{
	struct hvc_struct *hp;

	if (!xen_pv_domain() ||
	    xen_initial_domain() ||
	    !xen_start_info->console.domU.evtchn)
		return -ENODEV;

	xencons_irq = bind_evtchn_to_irq(xen_start_info->console.domU.evtchn);
	if (xencons_irq < 0)
		xencons_irq = 0; /* NO_IRQ */

	hp = hvc_alloc(HVC_COOKIE, xencons_irq, &hvc_ops, 256);
	if (IS_ERR(hp))
		return PTR_ERR(hp);

	hvc = hp;

	console_pfn = mfn_to_pfn(xen_start_info->console.domU.mfn);

	return 0;
}
コード例 #12
0
static int __init hvc_rtas_init(void)
{
	struct hvc_struct *hp;

	if (rtascons_put_char_token == RTAS_UNKNOWN_SERVICE)
		rtascons_put_char_token = rtas_token("put-term-char");
	if (rtascons_put_char_token == RTAS_UNKNOWN_SERVICE)
		return -EIO;

	if (rtascons_get_char_token == RTAS_UNKNOWN_SERVICE)
		rtascons_get_char_token = rtas_token("get-term-char");
	if (rtascons_get_char_token == RTAS_UNKNOWN_SERVICE)
		return -EIO;

	BUG_ON(hvc_rtas_dev);

	hp = hvc_alloc(hvc_rtas_cookie, 0, &hvc_rtas_get_put_ops, 16);
	if (IS_ERR(hp))
		return PTR_ERR(hp);

	hvc_rtas_dev = hp;

	return 0;
}
コード例 #13
0
static int __devinit hvc_vio_probe(struct vio_dev *vdev,
				   const struct vio_device_id *id)
{
	const struct hv_ops *ops;
	struct hvc_struct *hp;
	struct hvterm_priv *pv;
	hv_protocol_t proto;
	int i, termno = -1;

	/*                                 */
	if (!vdev || !id)
		return -EPERM;

	if (of_device_is_compatible(vdev->dev.of_node, "hvterm1")) {
		proto = HV_PROTOCOL_RAW;
		ops = &hvterm_raw_ops;
	} else if (of_device_is_compatible(vdev->dev.of_node, "hvterm-protocol")) {
		proto = HV_PROTOCOL_HVSI;
		ops = &hvterm_hvsi_ops;
	} else {
		pr_err("hvc_vio: Unkown protocol for %s\n", vdev->dev.of_node->full_name);
		return -ENXIO;
	}

	pr_devel("hvc_vio_probe() device %s, using %s protocol\n",
		 vdev->dev.of_node->full_name,
		 proto == HV_PROTOCOL_RAW ? "raw" : "hvsi");

	/*                      */
	if (hvterm_privs[0] == &hvterm_priv0 &&
	    vdev->unit_address == hvterm_priv0.termno) {
		pv = hvterm_privs[0];
		termno = 0;
		pr_devel("->boot console, using termno 0\n");
	}
	/*                          */
	else {
		for (i = 0; i < MAX_NR_HVC_CONSOLES && termno < 0; i++)
			if (!hvterm_privs[i])
				termno = i;
		pr_devel("->non-boot console, using termno %d\n", termno);
		if (termno < 0)
			return -ENODEV;
		pv = kzalloc(sizeof(struct hvterm_priv), GFP_KERNEL);
		if (!pv)
			return -ENOMEM;
		pv->termno = vdev->unit_address;
		pv->proto = proto;
		spin_lock_init(&pv->buf_lock);
		hvterm_privs[termno] = pv;
		hvsilib_init(&pv->hvsi, hvc_get_chars, hvc_put_chars,
			     pv->termno, 0);
	}

	hp = hvc_alloc(termno, vdev->irq, ops, MAX_VIO_PUT_CHARS);
	if (IS_ERR(hp))
		return PTR_ERR(hp);
	dev_set_drvdata(&vdev->dev, hp);

	return 0;
}
コード例 #14
0
ファイル: hvc_vio.c プロジェクト: Lyude/linux
static int hvc_vio_probe(struct vio_dev *vdev,
				   const struct vio_device_id *id)
{
	const struct hv_ops *ops;
	struct hvc_struct *hp;
	struct hvterm_priv *pv;
	hv_protocol_t proto;
	int i, termno = -1;

	/* probed with invalid parameters. */
	if (!vdev || !id)
		return -EPERM;

	if (of_device_is_compatible(vdev->dev.of_node, "hvterm1")) {
		proto = HV_PROTOCOL_RAW;
		ops = &hvterm_raw_ops;
	} else if (of_device_is_compatible(vdev->dev.of_node, "hvterm-protocol")) {
		proto = HV_PROTOCOL_HVSI;
		ops = &hvterm_hvsi_ops;
	} else {
		pr_err("hvc_vio: Unknown protocol for %pOF\n", vdev->dev.of_node);
		return -ENXIO;
	}

	pr_devel("hvc_vio_probe() device %pOF, using %s protocol\n",
		 vdev->dev.of_node,
		 proto == HV_PROTOCOL_RAW ? "raw" : "hvsi");

	/* Is it our boot one ? */
	if (hvterm_privs[0] == &hvterm_priv0 &&
	    vdev->unit_address == hvterm_priv0.termno) {
		pv = hvterm_privs[0];
		termno = 0;
		pr_devel("->boot console, using termno 0\n");
	}
	/* nope, allocate a new one */
	else {
		for (i = 0; i < MAX_NR_HVC_CONSOLES && termno < 0; i++)
			if (!hvterm_privs[i])
				termno = i;
		pr_devel("->non-boot console, using termno %d\n", termno);
		if (termno < 0)
			return -ENODEV;
		pv = kzalloc(sizeof(struct hvterm_priv), GFP_KERNEL);
		if (!pv)
			return -ENOMEM;
		pv->termno = vdev->unit_address;
		pv->proto = proto;
		spin_lock_init(&pv->buf_lock);
		hvterm_privs[termno] = pv;
		hvsilib_init(&pv->hvsi, hvc_get_chars, hvc_put_chars,
			     pv->termno, 0);
	}

	hp = hvc_alloc(termno, vdev->irq, ops, MAX_VIO_PUT_CHARS);
	if (IS_ERR(hp))
		return PTR_ERR(hp);
	dev_set_drvdata(&vdev->dev, hp);

	/* register udbg if it's not there already for console 0 */
	if (hp->index == 0 && !udbg_putc) {
		udbg_putc = udbg_hvc_putc;
		udbg_getc = udbg_hvc_getc;
		udbg_getc_poll = udbg_hvc_getc_poll;
	}

	return 0;
}
コード例 #15
0
ファイル: hvc_tile.c プロジェクト: nos1609/Chrono_Kernel-1
static int __init hvc_tile_init(void)
{
	struct hvc_struct *s;
	s = hvc_alloc(0, 0, &hvc_tile_get_put_ops, 128);
	return IS_ERR(s) ? PTR_ERR(s) : 0;
}