setup.c 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. /*
  2. * Setup pointers to hardware-dependent routines.
  3. *
  4. * This file is subject to the terms and conditions of the GNU General Public
  5. * License. See the file "COPYING" in the main directory of this archive
  6. * for more details.
  7. *
  8. * Copyright (C) 1996, 97, 98, 2000, 03, 04 Ralf Baechle (ralf@linux-mips.org)
  9. */
  10. #include <linux/config.h>
  11. #include <linux/eisa.h>
  12. #include <linux/hdreg.h>
  13. #include <linux/ioport.h>
  14. #include <linux/sched.h>
  15. #include <linux/init.h>
  16. #include <linux/interrupt.h>
  17. #include <linux/mc146818rtc.h>
  18. #include <linux/pci.h>
  19. #include <linux/console.h>
  20. #include <linux/fb.h>
  21. #include <linux/tty.h>
  22. #include <asm/arc/types.h>
  23. #include <asm/sgialib.h>
  24. #include <asm/bcache.h>
  25. #include <asm/bootinfo.h>
  26. #include <asm/io.h>
  27. #include <asm/irq.h>
  28. #include <asm/mc146818-time.h>
  29. #include <asm/processor.h>
  30. #include <asm/ptrace.h>
  31. #include <asm/reboot.h>
  32. #include <asm/sni.h>
  33. #include <asm/time.h>
  34. #include <asm/traps.h>
  35. extern void sni_machine_restart(char *command);
  36. extern void sni_machine_halt(void);
  37. extern void sni_machine_power_off(void);
  38. static void __init sni_rm200_pci_timer_setup(struct irqaction *irq)
  39. {
  40. /* set the clock to 100 Hz */
  41. outb_p(0x34,0x43); /* binary, mode 2, LSB/MSB, ch 0 */
  42. outb_p(LATCH & 0xff , 0x40); /* LSB */
  43. outb(LATCH >> 8 , 0x40); /* MSB */
  44. setup_irq(0, irq);
  45. }
  46. /*
  47. * A bit more gossip about the iron we're running on ...
  48. */
  49. static inline void sni_pcimt_detect(void)
  50. {
  51. char boardtype[80];
  52. unsigned char csmsr;
  53. char *p = boardtype;
  54. unsigned int asic;
  55. csmsr = *(volatile unsigned char *)PCIMT_CSMSR;
  56. p += sprintf(p, "%s PCI", (csmsr & 0x80) ? "RM200" : "RM300");
  57. if ((csmsr & 0x80) == 0)
  58. p += sprintf(p, ", board revision %s",
  59. (csmsr & 0x20) ? "D" : "C");
  60. asic = csmsr & 0x80;
  61. asic = (csmsr & 0x08) ? asic : !asic;
  62. p += sprintf(p, ", ASIC PCI Rev %s", asic ? "1.0" : "1.1");
  63. printk("%s.\n", boardtype);
  64. }
  65. static void __init sni_display_setup(void)
  66. {
  67. #ifdef CONFIG_VT
  68. #if defined(CONFIG_VGA_CONSOLE)
  69. struct screen_info *si = &screen_info;
  70. DISPLAY_STATUS *di;
  71. di = ArcGetDisplayStatus(1);
  72. if (di) {
  73. si->orig_x = di->CursorXPosition;
  74. si->orig_y = di->CursorYPosition;
  75. si->orig_video_cols = di->CursorMaxXPosition;
  76. si->orig_video_lines = di->CursorMaxYPosition;
  77. si->orig_video_isVGA = VIDEO_TYPE_VGAC;
  78. si->orig_video_points = 16;
  79. }
  80. #endif
  81. #endif
  82. }
  83. static struct resource sni_io_resource = {
  84. "PCIMT IO MEM", 0x00001000UL, 0x03bfffffUL, IORESOURCE_IO,
  85. };
  86. static struct resource pcimt_io_resources[] = {
  87. { "dma1", 0x00, 0x1f, IORESOURCE_BUSY },
  88. { "timer", 0x40, 0x5f, IORESOURCE_BUSY },
  89. { "keyboard", 0x60, 0x6f, IORESOURCE_BUSY },
  90. { "dma page reg", 0x80, 0x8f, IORESOURCE_BUSY },
  91. { "dma2", 0xc0, 0xdf, IORESOURCE_BUSY },
  92. { "PCI config data", 0xcfc, 0xcff, IORESOURCE_BUSY }
  93. };
  94. static struct resource sni_mem_resource = {
  95. "PCIMT PCI MEM", 0x10000000UL, 0xffffffffUL, IORESOURCE_MEM
  96. };
  97. /*
  98. * The RM200/RM300 has a few holes in it's PCI/EISA memory address space used
  99. * for other purposes. Be paranoid and allocate all of the before the PCI
  100. * code gets a chance to to map anything else there ...
  101. *
  102. * This leaves the following areas available:
  103. *
  104. * 0x10000000 - 0x1009ffff (640kB) PCI/EISA/ISA Bus Memory
  105. * 0x10100000 - 0x13ffffff ( 15MB) PCI/EISA/ISA Bus Memory
  106. * 0x18000000 - 0x1fbfffff (124MB) PCI/EISA Bus Memory
  107. * 0x1ff08000 - 0x1ffeffff (816kB) PCI/EISA Bus Memory
  108. * 0xa0000000 - 0xffffffff (1.5GB) PCI/EISA Bus Memory
  109. */
  110. static struct resource pcimt_mem_resources[] = {
  111. { "Video RAM area", 0x100a0000, 0x100bffff, IORESOURCE_BUSY },
  112. { "ISA Reserved", 0x100c0000, 0x100fffff, IORESOURCE_BUSY },
  113. { "PCI IO", 0x14000000, 0x17bfffff, IORESOURCE_BUSY },
  114. { "Cache Replacement Area", 0x17c00000, 0x17ffffff, IORESOURCE_BUSY},
  115. { "PCI INT Acknowledge", 0x1a000000, 0x1a000003, IORESOURCE_BUSY },
  116. { "Boot PROM", 0x1fc00000, 0x1fc7ffff, IORESOURCE_BUSY},
  117. { "Diag PROM", 0x1fc80000, 0x1fcfffff, IORESOURCE_BUSY},
  118. { "X-Bus", 0x1fd00000, 0x1fdfffff, IORESOURCE_BUSY},
  119. { "BIOS map", 0x1fe00000, 0x1fefffff, IORESOURCE_BUSY},
  120. { "NVRAM / EEPROM", 0x1ff00000, 0x1ff7ffff, IORESOURCE_BUSY},
  121. { "ASIC PCI", 0x1fff0000, 0x1fffefff, IORESOURCE_BUSY},
  122. { "MP Agent", 0x1ffff000, 0x1fffffff, IORESOURCE_BUSY},
  123. { "Main Memory", 0x20000000, 0x9fffffff, IORESOURCE_BUSY}
  124. };
  125. static void __init sni_resource_init(void)
  126. {
  127. int i;
  128. /* request I/O space for devices used on all i[345]86 PCs */
  129. for (i = 0; i < ARRAY_SIZE(pcimt_io_resources); i++)
  130. request_resource(&ioport_resource, pcimt_io_resources + i);
  131. /* request mem space for pcimt-specific devices */
  132. for (i = 0; i < ARRAY_SIZE(pcimt_mem_resources); i++)
  133. request_resource(&sni_mem_resource, pcimt_mem_resources + i);
  134. ioport_resource.end = sni_io_resource.end;
  135. }
  136. extern struct pci_ops sni_pci_ops;
  137. static struct pci_controller sni_controller = {
  138. .pci_ops = &sni_pci_ops,
  139. .mem_resource = &sni_mem_resource,
  140. .mem_offset = 0x10000000UL,
  141. .io_resource = &sni_io_resource,
  142. .io_offset = 0x00000000UL
  143. };
  144. static inline void sni_pcimt_time_init(void)
  145. {
  146. rtc_get_time = mc146818_get_cmos_time;
  147. rtc_set_time = mc146818_set_rtc_mmss;
  148. }
  149. static int __init sni_rm200_pci_setup(void)
  150. {
  151. sni_pcimt_detect();
  152. sni_pcimt_sc_init();
  153. sni_pcimt_time_init();
  154. set_io_port_base(SNI_PORT_BASE);
  155. ioport_resource.end = sni_io_resource.end;
  156. /*
  157. * Setup (E)ISA I/O memory access stuff
  158. */
  159. isa_slot_offset = 0xb0000000;
  160. #ifdef CONFIG_EISA
  161. EISA_bus = 1;
  162. #endif
  163. sni_resource_init();
  164. board_timer_setup = sni_rm200_pci_timer_setup;
  165. _machine_restart = sni_machine_restart;
  166. _machine_halt = sni_machine_halt;
  167. _machine_power_off = sni_machine_power_off;
  168. sni_display_setup();
  169. #ifdef CONFIG_PCI
  170. register_pci_controller(&sni_controller);
  171. #endif
  172. return 0;
  173. }
  174. early_initcall(sni_rm200_pci_setup);