bpa_setup.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /*
  2. * linux/arch/ppc/kernel/bpa_setup.c
  3. *
  4. * Copyright (C) 1995 Linus Torvalds
  5. * Adapted from 'alpha' version by Gary Thomas
  6. * Modified by Cort Dougan (cort@cs.nmt.edu)
  7. * Modified by PPC64 Team, IBM Corp
  8. * Modified by BPA Team, IBM Deutschland Entwicklung GmbH
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License
  12. * as published by the Free Software Foundation; either version
  13. * 2 of the License, or (at your option) any later version.
  14. */
  15. #undef DEBUG
  16. #include <linux/config.h>
  17. #include <linux/sched.h>
  18. #include <linux/kernel.h>
  19. #include <linux/mm.h>
  20. #include <linux/stddef.h>
  21. #include <linux/unistd.h>
  22. #include <linux/slab.h>
  23. #include <linux/user.h>
  24. #include <linux/reboot.h>
  25. #include <linux/init.h>
  26. #include <linux/delay.h>
  27. #include <linux/irq.h>
  28. #include <linux/seq_file.h>
  29. #include <linux/root_dev.h>
  30. #include <linux/console.h>
  31. #include <asm/mmu.h>
  32. #include <asm/processor.h>
  33. #include <asm/io.h>
  34. #include <asm/pgtable.h>
  35. #include <asm/prom.h>
  36. #include <asm/rtas.h>
  37. #include <asm/pci-bridge.h>
  38. #include <asm/iommu.h>
  39. #include <asm/dma.h>
  40. #include <asm/machdep.h>
  41. #include <asm/time.h>
  42. #include <asm/nvram.h>
  43. #include <asm/cputable.h>
  44. #include "pci.h"
  45. #include "bpa_iic.h"
  46. #include "bpa_iommu.h"
  47. #ifdef DEBUG
  48. #define DBG(fmt...) udbg_printf(fmt)
  49. #else
  50. #define DBG(fmt...)
  51. #endif
  52. void bpa_get_cpuinfo(struct seq_file *m)
  53. {
  54. struct device_node *root;
  55. const char *model = "";
  56. root = of_find_node_by_path("/");
  57. if (root)
  58. model = get_property(root, "model", NULL);
  59. seq_printf(m, "machine\t\t: BPA %s\n", model);
  60. of_node_put(root);
  61. }
  62. static void bpa_progress(char *s, unsigned short hex)
  63. {
  64. printk("*** %04x : %s\n", hex, s ? s : "");
  65. }
  66. static void __init bpa_setup_arch(void)
  67. {
  68. ppc_md.init_IRQ = iic_init_IRQ;
  69. ppc_md.get_irq = iic_get_irq;
  70. #ifdef CONFIG_SMP
  71. smp_init_pSeries();
  72. #endif
  73. /* init to some ~sane value until calibrate_delay() runs */
  74. loops_per_jiffy = 50000000;
  75. if (ROOT_DEV == 0) {
  76. printk("No ramdisk, default root is /dev/hda2\n");
  77. ROOT_DEV = Root_HDA2;
  78. }
  79. /* Find and initialize PCI host bridges */
  80. init_pci_config_tokens();
  81. find_and_init_phbs();
  82. spider_init_IRQ();
  83. #ifdef CONFIG_DUMMY_CONSOLE
  84. conswitchp = &dummy_con;
  85. #endif
  86. bpa_nvram_init();
  87. }
  88. /*
  89. * Early initialization. Relocation is on but do not reference unbolted pages
  90. */
  91. static void __init bpa_init_early(void)
  92. {
  93. DBG(" -> bpa_init_early()\n");
  94. hpte_init_native();
  95. bpa_init_iommu();
  96. ppc64_interrupt_controller = IC_BPA_IIC;
  97. DBG(" <- bpa_init_early()\n");
  98. }
  99. static int __init bpa_probe(int platform)
  100. {
  101. if (platform != PLATFORM_BPA)
  102. return 0;
  103. return 1;
  104. }
  105. struct machdep_calls __initdata bpa_md = {
  106. .probe = bpa_probe,
  107. .setup_arch = bpa_setup_arch,
  108. .init_early = bpa_init_early,
  109. .get_cpuinfo = bpa_get_cpuinfo,
  110. .restart = rtas_restart,
  111. .power_off = rtas_power_off,
  112. .halt = rtas_halt,
  113. .get_boot_time = rtas_get_boot_time,
  114. .get_rtc_time = rtas_get_rtc_time,
  115. .set_rtc_time = rtas_set_rtc_time,
  116. .calibrate_decr = generic_calibrate_decr,
  117. .progress = bpa_progress,
  118. };