~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/powerpc/kernel/proc_powerpc.c

Version: ~ [ linux-5.8-rc4 ] ~ [ linux-5.7.7 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.50 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.131 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.187 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.229 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.229 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen IBM Corporation
  3  *
  4  * This program is free software; you can redistribute it and/or modify
  5  * it under the terms of the GNU General Public License as published by
  6  * the Free Software Foundation; either version 2 of the License, or
  7  * (at your option) any later version.
  8  *
  9  * This program is distributed in the hope that it will be useful,
 10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 12  * GNU General Public License for more details.
 13  *
 14  * You should have received a copy of the GNU General Public License
 15  * along with this program; if not, write to the Free Software
 16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 17  */
 18 
 19 #include <linux/init.h>
 20 #include <linux/mm.h>
 21 #include <linux/proc_fs.h>
 22 #include <linux/kernel.h>
 23 
 24 #include <asm/machdep.h>
 25 #include <asm/vdso_datapage.h>
 26 #include <asm/rtas.h>
 27 #include <asm/uaccess.h>
 28 #include <asm/prom.h>
 29 
 30 #ifdef CONFIG_PPC64
 31 
 32 static loff_t page_map_seek(struct file *file, loff_t off, int whence)
 33 {
 34         return fixed_size_llseek(file, off, whence, PAGE_SIZE);
 35 }
 36 
 37 static ssize_t page_map_read( struct file *file, char __user *buf, size_t nbytes,
 38                               loff_t *ppos)
 39 {
 40         return simple_read_from_buffer(buf, nbytes, ppos,
 41                         PDE_DATA(file_inode(file)), PAGE_SIZE);
 42 }
 43 
 44 static int page_map_mmap( struct file *file, struct vm_area_struct *vma )
 45 {
 46         if ((vma->vm_end - vma->vm_start) > PAGE_SIZE)
 47                 return -EINVAL;
 48 
 49         remap_pfn_range(vma, vma->vm_start,
 50                         __pa(PDE_DATA(file_inode(file))) >> PAGE_SHIFT,
 51                         PAGE_SIZE, vma->vm_page_prot);
 52         return 0;
 53 }
 54 
 55 static const struct file_operations page_map_fops = {
 56         .llseek = page_map_seek,
 57         .read   = page_map_read,
 58         .mmap   = page_map_mmap
 59 };
 60 
 61 
 62 static int __init proc_ppc64_init(void)
 63 {
 64         struct proc_dir_entry *pde;
 65 
 66         pde = proc_create_data("powerpc/systemcfg", S_IFREG|S_IRUGO, NULL,
 67                                &page_map_fops, vdso_data);
 68         if (!pde)
 69                 return 1;
 70         proc_set_size(pde, PAGE_SIZE);
 71 
 72         return 0;
 73 }
 74 __initcall(proc_ppc64_init);
 75 
 76 #endif /* CONFIG_PPC64 */
 77 
 78 /*
 79  * Create the ppc64 and ppc64/rtas directories early. This allows us to
 80  * assume that they have been previously created in drivers.
 81  */
 82 static int __init proc_ppc64_create(void)
 83 {
 84         struct proc_dir_entry *root;
 85 
 86         root = proc_mkdir("powerpc", NULL);
 87         if (!root)
 88                 return 1;
 89 
 90 #ifdef CONFIG_PPC64
 91         if (!proc_symlink("ppc64", NULL, "powerpc"))
 92                 pr_err("Failed to create link /proc/ppc64 -> /proc/powerpc\n");
 93 #endif
 94 
 95         if (!of_find_node_by_path("/rtas"))
 96                 return 0;
 97 
 98         if (!proc_mkdir("rtas", root))
 99                 return 1;
100 
101         if (!proc_symlink("rtas", NULL, "powerpc/rtas"))
102                 return 1;
103 
104         return 0;
105 }
106 core_initcall(proc_ppc64_create);
107 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp