perf tools: Improve 'libbabel' feature check failure message
[linux/fpc-iii.git] / arch / arc / kernel / arc_hostlink.c
blob47b2a17cc52a6f9f46efe7340e89f504cc80af1e
1 /*
2 * arc_hostlink.c: Pseudo-driver for Metaware provided "hostlink" facility
4 * Allows Linux userland access to host in absence of any peripherals.
6 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #include <linux/fs.h> /* file_operations */
14 #include <linux/miscdevice.h>
15 #include <linux/mm.h> /* VM_IO */
16 #include <linux/module.h>
17 #include <linux/uaccess.h>
19 static unsigned char __HOSTLINK__[4 * PAGE_SIZE] __aligned(PAGE_SIZE);
21 static int arc_hl_mmap(struct file *fp, struct vm_area_struct *vma)
23 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
25 if (io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
26 vma->vm_end - vma->vm_start,
27 vma->vm_page_prot)) {
28 pr_warn("Hostlink buffer mmap ERROR\n");
29 return -EAGAIN;
31 return 0;
34 static long arc_hl_ioctl(struct file *file, unsigned int cmd,
35 unsigned long arg)
37 /* we only support, returning the physical addr to mmap in user space */
38 put_user((unsigned int)__HOSTLINK__, (int __user *)arg);
39 return 0;
42 static const struct file_operations arc_hl_fops = {
43 .unlocked_ioctl = arc_hl_ioctl,
44 .mmap = arc_hl_mmap,
47 static struct miscdevice arc_hl_dev = {
48 .minor = MISC_DYNAMIC_MINOR,
49 .name = "hostlink",
50 .fops = &arc_hl_fops
53 static int __init arc_hl_init(void)
55 pr_info("ARC Hostlink driver mmap at 0x%p\n", __HOSTLINK__);
56 return misc_register(&arc_hl_dev);
58 module_init(arc_hl_init);