fixup-sni.c 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * SNI specific PCI support for RM200/RM300.
  7. *
  8. * Copyright (C) 1997 - 2000, 2003, 04 Ralf Baechle (ralf@linux-mips.org)
  9. */
  10. #include <linux/kernel.h>
  11. #include <linux/init.h>
  12. #include <linux/pci.h>
  13. #include <asm/mipsregs.h>
  14. #include <asm/sni.h>
  15. /*
  16. * Shortcuts ...
  17. */
  18. #define SCSI PCIMT_IRQ_SCSI
  19. #define ETH PCIMT_IRQ_ETHERNET
  20. #define INTA PCIMT_IRQ_INTA
  21. #define INTB PCIMT_IRQ_INTB
  22. #define INTC PCIMT_IRQ_INTC
  23. #define INTD PCIMT_IRQ_INTD
  24. /*
  25. * Device 0: PCI EISA Bridge (directly routed)
  26. * Device 1: NCR53c810 SCSI (directly routed)
  27. * Device 2: PCnet32 Ethernet (directly routed)
  28. * Device 3: VGA (routed to INTB)
  29. * Device 4: Unused
  30. * Device 5: Slot 2
  31. * Device 6: Slot 3
  32. * Device 7: Slot 4
  33. *
  34. * Documentation says the VGA is device 5 and device 3 is unused but that
  35. * seem to be a documentation error. At least on my RM200C the Cirrus
  36. * Logic CL-GD5434 VGA is device 3.
  37. */
  38. static char irq_tab_rm200[8][5] __initdata = {
  39. /* INTA INTB INTC INTD */
  40. { 0, 0, 0, 0, 0 }, /* EISA bridge */
  41. { SCSI, SCSI, SCSI, SCSI, SCSI }, /* SCSI */
  42. { ETH, ETH, ETH, ETH, ETH }, /* Ethernet */
  43. { INTB, INTB, INTB, INTB, INTB }, /* VGA */
  44. { 0, 0, 0, 0, 0 }, /* Unused */
  45. { 0, INTB, INTC, INTD, INTA }, /* Slot 2 */
  46. { 0, INTC, INTD, INTA, INTB }, /* Slot 3 */
  47. { 0, INTD, INTA, INTB, INTC }, /* Slot 4 */
  48. };
  49. /*
  50. * In Revision D of the RM300 Device 2 has become a normal purpose Slot 1
  51. *
  52. * The VGA card is optional for RM300 systems.
  53. */
  54. static char irq_tab_rm300d[8][5] __initdata = {
  55. /* INTA INTB INTC INTD */
  56. { 0, 0, 0, 0, 0 }, /* EISA bridge */
  57. { SCSI, SCSI, SCSI, SCSI, SCSI }, /* SCSI */
  58. { 0, INTC, INTD, INTA, INTB }, /* Slot 1 */
  59. { INTB, INTB, INTB, INTB, INTB }, /* VGA */
  60. { 0, 0, 0, 0, 0 }, /* Unused */
  61. { 0, INTB, INTC, INTD, INTA }, /* Slot 2 */
  62. { 0, INTC, INTD, INTA, INTB }, /* Slot 3 */
  63. { 0, INTD, INTA, INTB, INTC }, /* Slot 4 */
  64. };
  65. static inline int is_rm300_revd(void)
  66. {
  67. unsigned char csmsr = *(volatile unsigned char *)PCIMT_CSMSR;
  68. return (csmsr & 0xa0) == 0x20;
  69. }
  70. int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
  71. {
  72. if (is_rm300_revd())
  73. return irq_tab_rm300d[slot][pin];
  74. return irq_tab_rm200[slot][pin];
  75. }
  76. /* Do platform specific device initialization at pci_enable_device() time */
  77. int pcibios_plat_dev_init(struct pci_dev *dev)
  78. {
  79. return 0;
  80. }