setup.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. *
  3. * arch/xtensa/platform-iss/setup.c
  4. *
  5. * Platform specific initialization.
  6. *
  7. * Authors: Chris Zankel <chris@zankel.net>
  8. * Joe Taylor <joe@tensilica.com>
  9. *
  10. * Copyright 2001 - 2005 Tensilica Inc.
  11. *
  12. * This program is free software; you can redistribute it and/or modify it
  13. * under the terms of the GNU General Public License as published by the
  14. * Free Software Foundation; either version 2 of the License, or (at your
  15. * option) any later version.
  16. *
  17. */
  18. #include <linux/stddef.h>
  19. #include <linux/kernel.h>
  20. #include <linux/init.h>
  21. #include <linux/errno.h>
  22. #include <linux/reboot.h>
  23. #include <linux/kdev_t.h>
  24. #include <linux/types.h>
  25. #include <linux/major.h>
  26. #include <linux/blkdev.h>
  27. #include <linux/console.h>
  28. #include <linux/delay.h>
  29. #include <linux/stringify.h>
  30. #include <linux/notifier.h>
  31. #include <asm/platform.h>
  32. #include <asm/bootparam.h>
  33. void __init platform_init(bp_tag_t* bootparam)
  34. {
  35. }
  36. #ifdef CONFIG_PCI
  37. void platform_pcibios_init(void)
  38. {
  39. }
  40. #endif
  41. void platform_halt(void)
  42. {
  43. pr_info(" ** Called platform_halt() **\n");
  44. __asm__ __volatile__("movi a2, 1\nsimcall\n");
  45. }
  46. void platform_power_off(void)
  47. {
  48. pr_info(" ** Called platform_power_off() **\n");
  49. __asm__ __volatile__("movi a2, 1\nsimcall\n");
  50. }
  51. void platform_restart(void)
  52. {
  53. /* Flush and reset the mmu, simulate a processor reset, and
  54. * jump to the reset vector. */
  55. __asm__ __volatile__("movi a2, 15\n\t"
  56. "wsr a2, icountlevel\n\t"
  57. "movi a2, 0\n\t"
  58. "wsr a2, icount\n\t"
  59. "wsr a2, ibreakenable\n\t"
  60. "wsr a2, lcount\n\t"
  61. "movi a2, 0x1f\n\t"
  62. "wsr a2, ps\n\t"
  63. "isync\n\t"
  64. "jx %0\n\t"
  65. :
  66. : "a" (XCHAL_RESET_VECTOR_VADDR)
  67. : "a2");
  68. /* control never gets here */
  69. }
  70. extern void iss_net_poll(void);
  71. const char twirl[]="|/-\\|/-\\";
  72. void platform_heartbeat(void)
  73. {
  74. #if 0
  75. static int i = 0, j = 0;
  76. if (--i < 0) {
  77. i = 99;
  78. printk("\r%c\r", twirl[j++]);
  79. if (j == 8)
  80. j = 0;
  81. }
  82. #endif
  83. }
  84. static int
  85. iss_panic_event(struct notifier_block *this, unsigned long event, void *ptr)
  86. {
  87. __asm__ __volatile__("movi a2, -1; simcall\n");
  88. return NOTIFY_DONE;
  89. }
  90. static struct notifier_block iss_panic_block = {
  91. iss_panic_event,
  92. NULL,
  93. 0
  94. };
  95. void __init platform_setup(char **p_cmdline)
  96. {
  97. atomic_notifier_chain_register(&panic_notifier_list, &iss_panic_block);
  98. }