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

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

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ 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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-or-later
  2 /*
  3  * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen IBM Corporation
  4  */
  5 
  6 #include <linux/init.h>
  7 #include <linux/mm.h>
  8 #include <linux/proc_fs.h>
  9 #include <linux/kernel.h>
 10 #include <linux/of.h>
 11 
 12 #include <asm/machdep.h>
 13 #include <asm/vdso_datapage.h>
 14 #include <asm/rtas.h>
 15 #include <linux/uaccess.h>
 16 
 17 #ifdef CONFIG_PPC64
 18 
 19 static loff_t page_map_seek(struct file *file, loff_t off, int whence)
 20 {
 21         return fixed_size_llseek(file, off, whence, PAGE_SIZE);
 22 }
 23 
 24 static ssize_t page_map_read( struct file *file, char __user *buf, size_t nbytes,
 25                               loff_t *ppos)
 26 {
 27         return simple_read_from_buffer(buf, nbytes, ppos,
 28                         pde_data(file_inode(file)), PAGE_SIZE);
 29 }
 30 
 31 static int page_map_mmap( struct file *file, struct vm_area_struct *vma )
 32 {
 33         if ((vma->vm_end - vma->vm_start) > PAGE_SIZE)
 34                 return -EINVAL;
 35 
 36         remap_pfn_range(vma, vma->vm_start,
 37                         __pa(pde_data(file_inode(file))) >> PAGE_SHIFT,
 38                         PAGE_SIZE, vma->vm_page_prot);
 39         return 0;
 40 }
 41 
 42 static const struct proc_ops page_map_proc_ops = {
 43         .proc_lseek     = page_map_seek,
 44         .proc_read      = page_map_read,
 45         .proc_mmap      = page_map_mmap,
 46 };
 47 
 48 
 49 static int __init proc_ppc64_init(void)
 50 {
 51         struct proc_dir_entry *pde;
 52 
 53         pde = proc_create_data("powerpc/systemcfg", S_IFREG | 0444, NULL,
 54                                &page_map_proc_ops, vdso_data);
 55         if (!pde)
 56                 return 1;
 57         proc_set_size(pde, PAGE_SIZE);
 58 
 59         return 0;
 60 }
 61 __initcall(proc_ppc64_init);
 62 
 63 #endif /* CONFIG_PPC64 */
 64 
 65 /*
 66  * Create the ppc64 and ppc64/rtas directories early. This allows us to
 67  * assume that they have been previously created in drivers.
 68  */
 69 static int __init proc_ppc64_create(void)
 70 {
 71         struct proc_dir_entry *root;
 72 
 73         root = proc_mkdir("powerpc", NULL);
 74         if (!root)
 75                 return 1;
 76 
 77 #ifdef CONFIG_PPC64
 78         if (!proc_symlink("ppc64", NULL, "powerpc"))
 79                 pr_err("Failed to create link /proc/ppc64 -> /proc/powerpc\n");
 80 #endif
 81 
 82         if (!of_find_node_by_path("/rtas"))
 83                 return 0;
 84 
 85         if (!proc_mkdir("rtas", root))
 86                 return 1;
 87 
 88         if (!proc_symlink("rtas", NULL, "powerpc/rtas"))
 89                 return 1;
 90 
 91         return 0;
 92 }
 93 core_initcall(proc_ppc64_create);
 94 

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

kernel.org | git.kernel.org | LWN.net | Project Home | 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.

sflogo.php