-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yaml --- r: 360171 b: refs/heads/master c: cbe056f h: refs/heads/master i: 360169: 5e457e9 360167: e6ba6d8 v: v3
- Loading branch information
Vineet Gupta
committed
Feb 15, 2013
1 parent
87b528b
commit 17fcaf8
Showing
4 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: 8b5850f8ac8d9b809db4588b80b568faca5aaaaf | ||
refs/heads/master: cbe056f76a386708f3807b274322f78269aee0f6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* arc_hostlink.c: Pseudo-driver for Metaware provided "hostlink" facility | ||
* | ||
* Allows Linux userland access to host in absence of any peripherals. | ||
* | ||
* Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2 as | ||
* published by the Free Software Foundation. | ||
*/ | ||
|
||
#include <linux/fs.h> /* file_operations */ | ||
#include <linux/miscdevice.h> | ||
#include <linux/mm.h> /* VM_IO */ | ||
#include <linux/module.h> | ||
#include <linux/uaccess.h> | ||
|
||
static unsigned char __HOSTLINK__[4 * PAGE_SIZE] __aligned(PAGE_SIZE); | ||
|
||
static int arc_hl_mmap(struct file *fp, struct vm_area_struct *vma) | ||
{ | ||
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | ||
|
||
if (io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, | ||
vma->vm_end - vma->vm_start, | ||
vma->vm_page_prot)) { | ||
pr_warn("Hostlink buffer mmap ERROR\n"); | ||
return -EAGAIN; | ||
} | ||
return 0; | ||
} | ||
|
||
static long arc_hl_ioctl(struct file *file, unsigned int cmd, | ||
unsigned long arg) | ||
{ | ||
/* we only support, returning the physical addr to mmap in user space */ | ||
put_user((unsigned int)__HOSTLINK__, (int __user *)arg); | ||
return 0; | ||
} | ||
|
||
static const struct file_operations arc_hl_fops = { | ||
.unlocked_ioctl = arc_hl_ioctl, | ||
.mmap = arc_hl_mmap, | ||
}; | ||
|
||
static struct miscdevice arc_hl_dev = { | ||
.minor = MISC_DYNAMIC_MINOR, | ||
.name = "hostlink", | ||
.fops = &arc_hl_fops | ||
}; | ||
|
||
static int __init arc_hl_init(void) | ||
{ | ||
pr_info("ARC Hostlink driver mmap at 0x%p\n", __HOSTLINK__); | ||
return misc_register(&arc_hl_dev); | ||
} | ||
module_init(arc_hl_init); |