예제 #1
0
static int __init rk_last_log_init(void)
{
	size_t early_log_size;
	char *buf;
	struct proc_dir_entry *entry;

	if (!cpu_is_rockchip())
		return 0;

	buf = (char *)__get_free_pages(GFP_KERNEL, LOG_BUF_PAGE_ORDER);
	if (!buf) {
		pr_err("failed to __get_free_pages(%d)\n", LOG_BUF_PAGE_ORDER);
		return 0;
	}

	log_buf = last_log_vmap(virt_to_phys(buf), 1 << LOG_BUF_PAGE_ORDER);
	if (!log_buf) {
		pr_err("failed to map %d pages at 0x%08x\n", 1 << LOG_BUF_PAGE_ORDER, virt_to_phys(buf));
		return 0;
	}

	last_log_buf = (char *)vmalloc(LOG_BUF_LEN);
	if (!last_log_buf) {
		pr_err("failed to vmalloc(%d)\n", LOG_BUF_LEN);
		return 0;
	}

	memcpy(last_log_buf, buf, LOG_BUF_LEN);
	early_log_size = log_pos > sizeof(early_log_buf) ? sizeof(early_log_buf) : log_pos;
	memcpy(log_buf, early_log_buf, early_log_size);
	memset(log_buf + early_log_size, 0, LOG_BUF_LEN - early_log_size);

	pr_info("0x%08x map to 0x%p and copy to 0x%p, size 0x%x early 0x%x (version 3.0)\n", virt_to_phys(buf), log_buf, last_log_buf, LOG_BUF_LEN, early_log_size);

	entry = proc_create("last_kmsg", S_IRUSR, NULL, &last_log_fops);
	if (!entry) {
		pr_err("failed to create proc entry\n");
		return 0;
	}
	proc_set_size(entry, LOG_BUF_LEN);

	proc_symlink("last_log", NULL, "last_kmsg");

	return 0;
}
예제 #2
0
파일: cpuidle.c 프로젝트: netros/rklinux4.4
static int __init rockchip_ca9_cpuidle_init(void)
{
	struct device_node *np;
	int ret;

	if (!cpu_is_rockchip())
		return -ENODEV;
	if (read_cpuid_part() != ARM_CPU_PART_CORTEX_A9)
		return -ENODEV;
	np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-gic");
	if (!np)
		return -ENODEV;
	gic_cpu_base = of_iomap(np, 1);
	if (!gic_cpu_base) {
		pr_err("%s: failed to map gic cpu registers\n", __func__);
		return -EINVAL;
	}
	rockchip_ca9_cpuidle_driver.states[0].enter = rockchip_ca9_cpuidle_enter;
	ret = cpuidle_register(&rockchip_ca9_cpuidle_driver, NULL);
	if (ret)
		pr_err("%s: failed to register cpuidle driver: %d\n", __func__, ret);

	return ret;
}