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

TOMOYO Linux Cross Reference
Linux/arch/xtensa/platforms/iss/setup.c

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ 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  *
  4  * arch/xtensa/platform-iss/setup.c
  5  *
  6  * Platform specific initialization.
  7  *
  8  * Authors: Chris Zankel <chris@zankel.net>
  9  *          Joe Taylor <joe@tensilica.com>
 10  *
 11  * Copyright 2001 - 2005 Tensilica Inc.
 12  * Copyright 2017 Cadence Design Systems Inc.
 13  */
 14 #include <linux/init.h>
 15 #include <linux/kernel.h>
 16 #include <linux/notifier.h>
 17 #include <linux/panic_notifier.h>
 18 #include <linux/printk.h>
 19 #include <linux/reboot.h>
 20 #include <linux/string.h>
 21 
 22 #include <asm/platform.h>
 23 #include <asm/setup.h>
 24 
 25 #include <platform/simcall.h>
 26 
 27 
 28 static int iss_power_off(struct sys_off_data *unused)
 29 {
 30         pr_info(" ** Called platform_power_off() **\n");
 31         simc_exit(0);
 32         return NOTIFY_DONE;
 33 }
 34 
 35 static int iss_restart(struct notifier_block *this,
 36                        unsigned long event, void *ptr)
 37 {
 38         /* Flush and reset the mmu, simulate a processor reset, and
 39          * jump to the reset vector. */
 40         cpu_reset();
 41 
 42         return NOTIFY_DONE;
 43 }
 44 
 45 static struct notifier_block iss_restart_block = {
 46         .notifier_call = iss_restart,
 47 };
 48 
 49 static int
 50 iss_panic_event(struct notifier_block *this, unsigned long event, void *ptr)
 51 {
 52         simc_exit(1);
 53         return NOTIFY_DONE;
 54 }
 55 
 56 static struct notifier_block iss_panic_block = {
 57         .notifier_call = iss_panic_event,
 58 };
 59 
 60 void __init platform_setup(char **p_cmdline)
 61 {
 62         static void *argv[COMMAND_LINE_SIZE / sizeof(void *)] __initdata;
 63         static char cmdline[COMMAND_LINE_SIZE] __initdata;
 64         int argc = simc_argc();
 65         int argv_size = simc_argv_size();
 66 
 67         if (argc > 1) {
 68                 if (argv_size > sizeof(argv)) {
 69                         pr_err("%s: command line too long: argv_size = %d\n",
 70                                __func__, argv_size);
 71                 } else {
 72                         int i;
 73 
 74                         cmdline[0] = 0;
 75                         simc_argv((void *)argv);
 76 
 77                         for (i = 1; i < argc; ++i) {
 78                                 if (i > 1)
 79                                         strcat(cmdline, " ");
 80                                 strcat(cmdline, argv[i]);
 81                         }
 82                         *p_cmdline = cmdline;
 83                 }
 84         }
 85 
 86         atomic_notifier_chain_register(&panic_notifier_list, &iss_panic_block);
 87         register_restart_handler(&iss_restart_block);
 88         register_sys_off_handler(SYS_OFF_MODE_POWER_OFF,
 89                                  SYS_OFF_PRIO_PLATFORM,
 90                                  iss_power_off, NULL);
 91 }
 92 

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