sys_sx164.c
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:4k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  1. /*
  2.  * linux/arch/alpha/kernel/sys_sx164.c
  3.  *
  4.  * Copyright (C) 1995 David A Rusling
  5.  * Copyright (C) 1996 Jay A Estabrook
  6.  * Copyright (C) 1998, 1999, 2000 Richard Henderson
  7.  *
  8.  * Code supporting the SX164 (PCA56+PYXIS).
  9.  */
  10. #include <linux/kernel.h>
  11. #include <linux/types.h>
  12. #include <linux/mm.h>
  13. #include <linux/sched.h>
  14. #include <linux/pci.h>
  15. #include <linux/init.h>
  16. #include <asm/ptrace.h>
  17. #include <asm/system.h>
  18. #include <asm/dma.h>
  19. #include <asm/irq.h>
  20. #include <asm/bitops.h>
  21. #include <asm/mmu_context.h>
  22. #include <asm/io.h>
  23. #include <asm/pgtable.h>
  24. #include <asm/core_cia.h>
  25. #include <asm/hwrpb.h>
  26. #include "proto.h"
  27. #include "irq_impl.h"
  28. #include "pci_impl.h"
  29. #include "machvec_impl.h"
  30. static void __init
  31. sx164_init_irq(void)
  32. {
  33. outb(0, DMA1_RESET_REG);
  34. outb(0, DMA2_RESET_REG);
  35. outb(DMA_MODE_CASCADE, DMA2_MODE_REG);
  36. outb(0, DMA2_MASK_REG);
  37. if (alpha_using_srm)
  38. alpha_mv.device_interrupt = srm_device_interrupt;
  39. init_i8259a_irqs();
  40. /* Not interested in the bogus interrupts (0,3,4,5,40-47),
  41.    NMI (1), or HALT (2).  */
  42. if (alpha_using_srm)
  43. init_srm_irqs(40, 0x3f0000);
  44. else
  45. init_pyxis_irqs(0xff00003f0000);
  46. setup_irq(16+6, &timer_cascade_irqaction);
  47. }
  48. /*
  49.  * PCI Fixup configuration.
  50.  *
  51.  * Summary @ PYXIS_INT_REQ:
  52.  * Bit      Meaning
  53.  * 0        RSVD
  54.  * 1        NMI
  55.  * 2        Halt/Reset switch
  56.  * 3        MBZ
  57.  * 4        RAZ
  58.  * 5        RAZ
  59.  * 6        Interval timer (RTC)
  60.  * 7        PCI-ISA Bridge
  61.  * 8        Interrupt Line A from slot 3
  62.  * 9        Interrupt Line A from slot 2
  63.  *10        Interrupt Line A from slot 1
  64.  *11        Interrupt Line A from slot 0
  65.  *12        Interrupt Line B from slot 3
  66.  *13        Interrupt Line B from slot 2
  67.  *14        Interrupt Line B from slot 1
  68.  *15        Interrupt line B from slot 0
  69.  *16        Interrupt Line C from slot 3
  70.  *17        Interrupt Line C from slot 2
  71.  *18        Interrupt Line C from slot 1
  72.  *19        Interrupt Line C from slot 0
  73.  *20        Interrupt Line D from slot 3
  74.  *21        Interrupt Line D from slot 2
  75.  *22        Interrupt Line D from slot 1
  76.  *23        Interrupt Line D from slot 0
  77.  *
  78.  * IdSel       
  79.  *   5  32 bit PCI option slot 2
  80.  *   6  64 bit PCI option slot 0
  81.  *   7  64 bit PCI option slot 1
  82.  *   8  Cypress I/O
  83.  *   9  32 bit PCI option slot 3
  84.  */
  85. static int __init
  86. sx164_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
  87. {
  88. static char irq_tab[5][5] __initdata = {
  89. /*INT    INTA   INTB   INTC   INTD */
  90. { 16+ 9, 16+ 9, 16+13, 16+17, 16+21}, /* IdSel 5 slot 2 J17 */
  91. { 16+11, 16+11, 16+15, 16+19, 16+23}, /* IdSel 6 slot 0 J19 */
  92. { 16+10, 16+10, 16+14, 16+18, 16+22}, /* IdSel 7 slot 1 J18 */
  93. {    -1,    -1,    -1,   -1,    -1}, /* IdSel 8 SIO        */
  94. { 16+ 8, 16+ 8, 16+12, 16+16, 16+20}  /* IdSel 9 slot 3 J15 */
  95. };
  96. const long min_idsel = 5, max_idsel = 9, irqs_per_slot = 5;
  97. return COMMON_TABLE_LOOKUP;
  98. }
  99. static void __init
  100. sx164_init_pci(void)
  101. {
  102. cia_init_pci();
  103. SMC669_Init(0);
  104. }
  105. static void __init
  106. sx164_init_arch(void)
  107. {
  108. /*
  109.  * OSF palcode v1.23 forgets to enable PCA56 Motion Video
  110.  * Instructions. Let's enable it.
  111.  * We have to check palcode revision because CSERVE interface
  112.  * is subject to change without notice. For example, it
  113.  * has been changed completely since v1.16 (found in MILO
  114.  * distribution). -ink
  115.  */
  116. struct percpu_struct *cpu = (struct percpu_struct*)
  117. ((char*)hwrpb + hwrpb->processor_offset);
  118. if (amask(AMASK_MAX) != 0
  119.     && alpha_using_srm
  120.     && (cpu->pal_revision & 0xffff) == 0x117) {
  121. __asm__ __volatile__(
  122. "lda $16,8($31)n"
  123. "call_pal 9n" /* Allow PALRES insns in kernel mode */
  124. ".long  0x64000118nn" /* hw_mfpr $0,icsr */
  125. "ldah $16,(1<<(19-16))($31)n"
  126. "or $0,$16,$0n" /* set MVE bit */
  127. ".long  0x74000118n" /* hw_mtpr $0,icsr */
  128. "lda $16,9($31)n"
  129. "call_pal 9" /* Disable PALRES insns */
  130. : : : "$0", "$16");
  131. printk("PCA56 MVI set enabledn");
  132. }
  133. pyxis_init_arch();
  134. }
  135. /*
  136.  * The System Vector
  137.  */
  138. struct alpha_machine_vector sx164_mv __initmv = {
  139. vector_name: "SX164",
  140. DO_EV5_MMU,
  141. DO_DEFAULT_RTC,
  142. DO_PYXIS_IO,
  143. DO_CIA_BUS,
  144. machine_check: cia_machine_check,
  145. max_dma_address: ALPHA_MAX_DMA_ADDRESS,
  146. min_io_address: DEFAULT_IO_BASE,
  147. min_mem_address: DEFAULT_MEM_BASE,
  148. pci_dac_offset: PYXIS_DAC_OFFSET,
  149. nr_irqs: 48,
  150. device_interrupt: pyxis_device_interrupt,
  151. init_arch: sx164_init_arch,
  152. init_irq: sx164_init_irq,
  153. init_rtc: common_init_rtc,
  154. init_pci: sx164_init_pci,
  155. kill_arch: NULL,
  156. pci_map_irq: sx164_map_irq,
  157. pci_swizzle: common_swizzle,
  158. };
  159. ALIAS_MV(sx164)