PageRenderTime 71ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/release/src/linux/linux/arch/parisc/kernel/setup.c

https://gitlab.com/envieidoc/advancedtomato2
C | 333 lines | 229 code | 44 blank | 60 comment | 16 complexity | 2e8197dd5a8012b1d13027fb51fd84d3 MD5 | raw file
  1. /* $Id: setup.c,v 1.8 2000/02/02 04:42:38 prumpf Exp $
  2. *
  3. * Initial setup-routines for HP 9000 based hardware.
  4. *
  5. * Copyright (C) 1991, 1992, 1995 Linus Torvalds
  6. * Modifications for PA-RISC (C) 1999 Helge Deller <deller@gmx.de>
  7. * Modifications copyright 1999 SuSE GmbH (Philipp Rumpf)
  8. * Modifications copyright 2000 Martin K. Petersen <mkp@mkp.net>
  9. * Modifications copyright 2000 Philipp Rumpf <prumpf@tux.org>
  10. * Modifications copyright 2001 Ryan Bradetich <rbradetich@uswest.net>
  11. *
  12. * Initial PA-RISC Version: 04-23-1999 by Helge Deller
  13. *
  14. * This program is free software; you can redistribute it and/or modify
  15. * it under the terms of the GNU General Public License as published by
  16. * the Free Software Foundation; either version 2, or (at your option)
  17. * any later version.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License
  25. * along with this program; if not, write to the Free Software
  26. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  27. *
  28. */
  29. #include <linux/config.h>
  30. #include <linux/kernel.h>
  31. #include <linux/blk.h> /* for initrd_start and initrd_end */
  32. #include <linux/init.h>
  33. #include <linux/console.h>
  34. #include <linux/seq_file.h>
  35. #define PCI_DEBUG
  36. #include <linux/pci.h>
  37. #undef PCI_DEBUG
  38. #include <linux/proc_fs.h>
  39. #include <asm/processor.h>
  40. #include <asm/pdc.h>
  41. #include <asm/led.h>
  42. #include <asm/pdc_chassis.h>
  43. #include <asm/machdep.h> /* for pa7300lc_init() proto */
  44. #define COMMAND_LINE_SIZE 1024
  45. char saved_command_line[COMMAND_LINE_SIZE];
  46. char command_line[COMMAND_LINE_SIZE];
  47. /* Intended for ccio/sba/cpu statistics under /proc/bus/{runway|gsc} */
  48. struct proc_dir_entry * proc_runway_root = NULL;
  49. struct proc_dir_entry * proc_gsc_root = NULL;
  50. #ifdef CONFIG_EISA
  51. int EISA_bus; /* This has to go somewhere in architecture specific code. */
  52. #endif
  53. void __init setup_cmdline(char **cmdline_p)
  54. {
  55. extern unsigned int boot_args[];
  56. /* Collect stuff passed in from the boot loader */
  57. /* boot_args[0] is free-mem start, boot_args[1] is ptr to command line */
  58. if (boot_args[0] < 64) {
  59. /* called from hpux boot loader */
  60. saved_command_line[0] = '\0';
  61. } else {
  62. strcpy(saved_command_line, (char *)__va(boot_args[1]));
  63. #ifdef CONFIG_BLK_DEV_INITRD
  64. if (boot_args[2] != 0) /* did palo pass us a ramdisk? */
  65. {
  66. initrd_start = (unsigned long)__va(boot_args[2]);
  67. initrd_end = (unsigned long)__va(boot_args[3]);
  68. }
  69. #endif
  70. }
  71. strcpy(command_line, saved_command_line);
  72. *cmdline_p = command_line;
  73. }
  74. #ifdef CONFIG_PA11
  75. void __init dma_ops_init(void)
  76. {
  77. switch (boot_cpu_data.cpu_type) {
  78. case pcx:
  79. /*
  80. * We've got way too many dependencies on 1.1 semantics
  81. * to support 1.0 boxes at this point.
  82. */
  83. panic( "PA-RISC Linux currently only supports machines that conform to\n"
  84. "the PA-RISC 1.1 or 2.0 architecture specification.\n");
  85. case pcxs:
  86. case pcxt:
  87. hppa_dma_ops = &pcx_dma_ops;
  88. break;
  89. case pcxl2:
  90. pa7300lc_init();
  91. case pcxl: /* falls through */
  92. hppa_dma_ops = &pcxl_dma_ops;
  93. break;
  94. default:
  95. break;
  96. }
  97. }
  98. #endif
  99. extern int init_per_cpu(int cpuid);
  100. extern void collect_boot_cpu_data(void);
  101. void __init setup_arch(char **cmdline_p)
  102. {
  103. init_per_cpu(smp_processor_id()); /* Set Modes & Enable FP */
  104. #ifdef __LP64__
  105. printk(KERN_INFO "The 64-bit Kernel has started...\n");
  106. #else
  107. printk(KERN_INFO "The 32-bit Kernel has started...\n");
  108. #endif
  109. pdc_console_init();
  110. #ifdef CONFIG_PDC_NARROW
  111. printk(KERN_INFO "Kernel is using PDC in 32-bit mode.\n");
  112. #endif
  113. setup_pdc();
  114. setup_cmdline(cmdline_p);
  115. collect_boot_cpu_data();
  116. do_memory_inventory(); /* probe for physical memory */
  117. cache_init();
  118. paging_init();
  119. #ifdef CONFIG_CHASSIS_LCD_LED
  120. /* initialize the LCD/LED after boot_cpu_data is available ! */
  121. led_init(); /* LCD/LED initialization */
  122. #endif
  123. #ifdef CONFIG_PA11
  124. dma_ops_init();
  125. #endif
  126. #ifdef CONFIG_VT
  127. # if defined(CONFIG_STI_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
  128. conswitchp = &dummy_con; /* we use take_over_console() later ! */
  129. # endif
  130. #endif
  131. }
  132. /*
  133. * Display cpu info for all cpu's.
  134. * for parisc this is in processor.c
  135. */
  136. extern int show_cpuinfo (struct seq_file *m, void *v);
  137. static void *
  138. c_start (struct seq_file *m, loff_t *pos)
  139. {
  140. /* Looks like the caller will call repeatedly until we return
  141. * 0, signaling EOF perhaps. This could be used to sequence
  142. * through CPUs for example. Since we print all cpu info in our
  143. * show_cpuinfo() disregarding 'pos' (which I assume is 'v' above)
  144. * we only allow for one "position". */
  145. return ((long)*pos < 1) ? (void *)1 : NULL;
  146. }
  147. static void *
  148. c_next (struct seq_file *m, void *v, loff_t *pos)
  149. {
  150. ++*pos;
  151. return c_start(m, pos);
  152. }
  153. static void
  154. c_stop (struct seq_file *m, void *v)
  155. {
  156. }
  157. struct seq_operations cpuinfo_op = {
  158. start: c_start,
  159. next: c_next,
  160. stop: c_stop,
  161. show: show_cpuinfo
  162. };
  163. static void parisc_proc_mkdir(void)
  164. {
  165. /*
  166. ** Can't call proc_mkdir() until after proc_root_init() has been
  167. ** called by start_kernel(). In other words, this code can't
  168. ** live in arch/.../setup.c because start_parisc() calls
  169. ** start_kernel().
  170. */
  171. switch (boot_cpu_data.cpu_type) {
  172. case pcxl:
  173. case pcxl2:
  174. if (NULL == proc_gsc_root)
  175. {
  176. proc_gsc_root = proc_mkdir("bus/gsc", 0);
  177. }
  178. break;
  179. case pcxt_:
  180. case pcxu:
  181. case pcxu_:
  182. case pcxw:
  183. case pcxw_:
  184. case pcxw2:
  185. if (NULL == proc_runway_root)
  186. {
  187. proc_runway_root = proc_mkdir("bus/runway", 0);
  188. }
  189. break;
  190. }
  191. }
  192. static struct resource central_bus = {
  193. name: "Central Bus",
  194. start: (unsigned long)0xfffffffffff80000,
  195. end: (unsigned long)0xfffffffffffaffff,
  196. flags: IORESOURCE_MEM,
  197. };
  198. static struct resource local_broadcast = {
  199. name: "Local Broadcast",
  200. start: (unsigned long)0xfffffffffffb0000,
  201. end: (unsigned long)0xfffffffffffdffff,
  202. flags: IORESOURCE_MEM,
  203. };
  204. static struct resource global_broadcast = {
  205. name: "Global Broadcast",
  206. start: (unsigned long)0xfffffffffffe0000,
  207. end: (unsigned long)0xffffffffffffffff,
  208. flags: IORESOURCE_MEM,
  209. };
  210. int __init parisc_init_resources(void)
  211. {
  212. int result;
  213. result = request_resource(&iomem_resource, &central_bus);
  214. if (result < 0) {
  215. printk(KERN_ERR
  216. "%s: failed to claim %s address space!\n",
  217. __FILE__, central_bus.name);
  218. return result;
  219. }
  220. result = request_resource(&iomem_resource, &local_broadcast);
  221. if (result < 0) {
  222. printk(KERN_ERR
  223. "%s: failed to claim %saddress space!\n",
  224. __FILE__, local_broadcast.name);
  225. return result;
  226. }
  227. result = request_resource(&iomem_resource, &global_broadcast);
  228. if (result < 0) {
  229. printk(KERN_ERR
  230. "%s: failed to claim %s address space!\n",
  231. __FILE__, global_broadcast.name);
  232. return result;
  233. }
  234. return 0;
  235. }
  236. extern void gsc_init(void);
  237. extern void processor_init(void);
  238. extern void ccio_init(void);
  239. extern void dino_init(void);
  240. extern void iosapic_init(void);
  241. extern void lba_init(void);
  242. extern void sba_init(void);
  243. extern void eisa_init(void);
  244. void __init parisc_init(void)
  245. {
  246. parisc_proc_mkdir();
  247. parisc_init_resources();
  248. do_device_inventory(); /* probe for hardware */
  249. parisc_pdc_chassis_init();
  250. /* set up a new led state on systems shipped LED State panel */
  251. pdc_chassis_send_status(PDC_CHASSIS_DIRECT_BSTART);
  252. processor_init();
  253. printk(KERN_INFO "CPU(s): %d x %s at %d.%06d MHz\n",
  254. boot_cpu_data.cpu_count,
  255. boot_cpu_data.cpu_name,
  256. boot_cpu_data.cpu_hz / 1000000,
  257. boot_cpu_data.cpu_hz % 1000000 );
  258. /* These are in a non-obvious order, will fix when we have an iotree */
  259. #if defined(CONFIG_IOSAPIC)
  260. iosapic_init();
  261. #endif
  262. #if defined(CONFIG_IOMMU_SBA)
  263. sba_init();
  264. #endif
  265. #if defined(CONFIG_PCI_LBA)
  266. lba_init();
  267. #endif
  268. /* CCIO before any potential subdevices */
  269. #if defined(CONFIG_IOMMU_CCIO)
  270. ccio_init();
  271. #endif
  272. /*
  273. * Need to register Asp & Wax before the EISA adapters for the IRQ
  274. * regions. EISA must come before PCI to be sure it gets IRQ region
  275. * 0.
  276. */
  277. #if defined(CONFIG_GSC_LASI) || defined(CONFIG_GSC_WAX)
  278. gsc_init();
  279. #endif
  280. #ifdef CONFIG_EISA
  281. eisa_init();
  282. #endif
  283. #if defined(CONFIG_GSC_DINO)
  284. dino_init();
  285. #endif
  286. #ifdef CONFIG_CHASSIS_LCD_LED
  287. register_led_regions(); /* register LED port info in procfs */
  288. #endif
  289. }