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

TOMOYO Linux Cross Reference
Linux/arch/m68k/emu/natfeat.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 ] ~

Diff markup

Differences between /arch/m68k/emu/natfeat.c (Architecture sparc64) and /arch/m68k/emu/natfeat.c (Architecture m68k)


  1 /*                                                  1 /*
  2  * natfeat.c - ARAnyM hardware support via Nat      2  * natfeat.c - ARAnyM hardware support via Native Features (natfeats)
  3  *                                                  3  *
  4  * Copyright (c) 2005 Petr Stehlik of ARAnyM d      4  * Copyright (c) 2005 Petr Stehlik of ARAnyM dev team
  5  *                                                  5  *
  6  * Reworked for Linux by Roman Zippel <zippel@      6  * Reworked for Linux by Roman Zippel <zippel@linux-m68k.org>
  7  *                                                  7  *
  8  * This software may be used and distributed a      8  * This software may be used and distributed according to the terms of
  9  * the GNU General Public License (GPL), incor      9  * the GNU General Public License (GPL), incorporated herein by reference.
 10  */                                                10  */
 11                                                    11 
 12 #include <linux/init.h>                            12 #include <linux/init.h>
 13 #include <linux/types.h>                           13 #include <linux/types.h>
 14 #include <linux/console.h>                         14 #include <linux/console.h>
 15 #include <linux/string.h>                          15 #include <linux/string.h>
 16 #include <linux/kernel.h>                          16 #include <linux/kernel.h>
 17 #include <linux/module.h>                          17 #include <linux/module.h>
 18 #include <linux/reboot.h>                          18 #include <linux/reboot.h>
 19 #include <linux/io.h>                              19 #include <linux/io.h>
 20 #include <asm/machdep.h>                           20 #include <asm/machdep.h>
 21 #include <asm/natfeat.h>                           21 #include <asm/natfeat.h>
 22                                                    22 
 23 extern long nf_get_id_phys(unsigned long featu     23 extern long nf_get_id_phys(unsigned long feature_name);
 24                                                    24 
 25 asm("\n"                                           25 asm("\n"
 26 "       .global nf_get_id_phys,nf_call\n"          26 "       .global nf_get_id_phys,nf_call\n"
 27 "nf_get_id_phys:\n"                                27 "nf_get_id_phys:\n"
 28 "       .short  0x7300\n"                          28 "       .short  0x7300\n"
 29 "       rts\n"                                     29 "       rts\n"
 30 "nf_call:\n"                                       30 "nf_call:\n"
 31 "       .short  0x7301\n"                          31 "       .short  0x7301\n"
 32 "       rts\n"                                     32 "       rts\n"
 33 "1:     moveq.l #0,%d0\n"                          33 "1:     moveq.l #0,%d0\n"
 34 "       rts\n"                                     34 "       rts\n"
 35 "       .section __ex_table,\"a\"\n"               35 "       .section __ex_table,\"a\"\n"
 36 "       .long   nf_get_id_phys,1b\n"               36 "       .long   nf_get_id_phys,1b\n"
 37 "       .long   nf_call,1b\n"                      37 "       .long   nf_call,1b\n"
 38 "       .previous");                               38 "       .previous");
 39 EXPORT_SYMBOL_GPL(nf_call);                        39 EXPORT_SYMBOL_GPL(nf_call);
 40                                                    40 
 41 long nf_get_id(const char *feature_name)           41 long nf_get_id(const char *feature_name)
 42 {                                                  42 {
 43         /* feature_name may be in vmalloc()ed      43         /* feature_name may be in vmalloc()ed memory, so make a copy */
 44         char name_copy[32];                        44         char name_copy[32];
 45         ssize_t n;                                 45         ssize_t n;
 46                                                    46 
 47         n = strscpy(name_copy, feature_name, s     47         n = strscpy(name_copy, feature_name, sizeof(name_copy));
 48         if (n < 0)                                 48         if (n < 0)
 49                 return 0;                          49                 return 0;
 50                                                    50 
 51         return nf_get_id_phys(virt_to_phys(nam     51         return nf_get_id_phys(virt_to_phys(name_copy));
 52 }                                                  52 }
 53 EXPORT_SYMBOL_GPL(nf_get_id);                      53 EXPORT_SYMBOL_GPL(nf_get_id);
 54                                                    54 
 55 void nfprint(const char *fmt, ...)                 55 void nfprint(const char *fmt, ...)
 56 {                                                  56 {
 57         static char buf[256];                      57         static char buf[256];
 58         va_list ap;                                58         va_list ap;
 59                                                    59 
 60         va_start(ap, fmt);                         60         va_start(ap, fmt);
 61         vsnprintf(buf, 256, fmt, ap);              61         vsnprintf(buf, 256, fmt, ap);
 62         nf_call(nf_get_id("NF_STDERR"), virt_t     62         nf_call(nf_get_id("NF_STDERR"), virt_to_phys(buf));
 63         va_end(ap);                                63         va_end(ap);
 64 }                                                  64 }
 65                                                    65 
 66 static void nf_poweroff(void)                      66 static void nf_poweroff(void)
 67 {                                                  67 {
 68         long id = nf_get_id("NF_SHUTDOWN");        68         long id = nf_get_id("NF_SHUTDOWN");
 69                                                    69 
 70         if (id)                                    70         if (id)
 71                 nf_call(id);                       71                 nf_call(id);
 72 }                                                  72 }
 73                                                    73 
 74 void __init nf_init(void)                          74 void __init nf_init(void)
 75 {                                                  75 {
 76         unsigned long id, version;                 76         unsigned long id, version;
 77         char buf[256];                             77         char buf[256];
 78                                                    78 
 79         id = nf_get_id("NF_VERSION");              79         id = nf_get_id("NF_VERSION");
 80         if (!id)                                   80         if (!id)
 81                 return;                            81                 return;
 82         version = nf_call(id);                     82         version = nf_call(id);
 83                                                    83 
 84         id = nf_get_id("NF_NAME");                 84         id = nf_get_id("NF_NAME");
 85         if (!id)                                   85         if (!id)
 86                 return;                            86                 return;
 87         nf_call(id, virt_to_phys(buf), 256);       87         nf_call(id, virt_to_phys(buf), 256);
 88         buf[255] = 0;                              88         buf[255] = 0;
 89                                                    89 
 90         pr_info("NatFeats found (%s, %lu.%lu)\     90         pr_info("NatFeats found (%s, %lu.%lu)\n", buf, version >> 16,
 91                 version & 0xffff);                 91                 version & 0xffff);
 92                                                    92 
 93         register_platform_power_off(nf_powerof     93         register_platform_power_off(nf_poweroff);
 94 }                                                  94 }
 95                                                    95 

~ [ 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