Release 4.7 drivers/tty/hvc/hvc_dcc.c
  
  
/* Copyright (c) 2010, 2014 The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */
#include <linux/init.h>
#include <asm/dcc.h>
#include <asm/processor.h>
#include "hvc_console.h"
/* DCC Status Bits */
#define DCC_STATUS_RX		(1 << 30)
#define DCC_STATUS_TX		(1 << 29)
static int hvc_dcc_put_chars(uint32_t vt, const char *buf, int count)
{
	int i;
	for (i = 0; i < count; i++) {
		while (__dcc_getstatus() & DCC_STATUS_TX)
			cpu_relax();
		__dcc_putchar(buf[i]);
	}
	return count;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| daniel walker | daniel walker | 56 | 100.00% | 1 | 100.00% | 
 | Total | 56 | 100.00% | 1 | 100.00% | 
static int hvc_dcc_get_chars(uint32_t vt, char *buf, int count)
{
	int i;
	for (i = 0; i < count; ++i)
		if (__dcc_getstatus() & DCC_STATUS_RX)
			buf[i] = __dcc_getchar();
		else
			break;
	return i;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| daniel walker | daniel walker | 48 | 92.31% | 1 | 50.00% | 
| stephen boyd | stephen boyd | 4 | 7.69% | 1 | 50.00% | 
 | Total | 52 | 100.00% | 2 | 100.00% | 
static bool hvc_dcc_check(void)
{
	unsigned long time = jiffies + (HZ / 10);
	/* Write a test character to check if it is handled */
	__dcc_putchar('\n');
	while (time_is_after_jiffies(time)) {
		if (!(__dcc_getstatus() & DCC_STATUS_TX))
			return true;
	}
	return false;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| rob herring | rob herring | 51 | 100.00% | 1 | 100.00% | 
 | Total | 51 | 100.00% | 1 | 100.00% | 
static const struct hv_ops hvc_dcc_get_put_ops = {
	.get_chars = hvc_dcc_get_chars,
	.put_chars = hvc_dcc_put_chars,
};
static int __init hvc_dcc_console_init(void)
{
	int ret;
	if (!hvc_dcc_check())
		return -ENODEV;
	/* Returns -1 if error */
	ret = hvc_instantiate(0, 0, &hvc_dcc_get_put_ops);
	return ret < 0 ? -ENODEV : 0;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| daniel walker | daniel walker | 22 | 48.89% | 1 | 33.33% | 
| timur tabi | timur tabi | 13 | 28.89% | 1 | 33.33% | 
| rob herring | rob herring | 10 | 22.22% | 1 | 33.33% | 
 | Total | 45 | 100.00% | 3 | 100.00% | 
console_initcall(hvc_dcc_console_init);
static int __init hvc_dcc_init(void)
{
	struct hvc_struct *p;
	if (!hvc_dcc_check())
		return -ENODEV;
	p = hvc_alloc(0, 0, &hvc_dcc_get_put_ops, 128);
	return PTR_ERR_OR_ZERO(p);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| daniel walker | daniel walker | 23 | 52.27% | 1 | 33.33% | 
| timur tabi | timur tabi | 11 | 25.00% | 1 | 33.33% | 
| rob herring | rob herring | 10 | 22.73% | 1 | 33.33% | 
 | Total | 44 | 100.00% | 3 | 100.00% | 
device_initcall(hvc_dcc_init);
Overall Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| daniel walker | daniel walker | 197 | 66.11% | 1 | 20.00% | 
| rob herring | rob herring | 71 | 23.83% | 1 | 20.00% | 
| timur tabi | timur tabi | 24 | 8.05% | 1 | 20.00% | 
| stephen boyd | stephen boyd | 4 | 1.34% | 1 | 20.00% | 
| christopher covington | christopher covington | 2 | 0.67% | 1 | 20.00% | 
 | Total | 298 | 100.00% | 5 | 100.00% | 
  
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.