Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

134 lines
2.7 KiB

  1. /*
  2. * TRITON.C - Intel Triton PCI chipset routines.
  3. *
  4. * Notes:
  5. * Algorithms from Intel Triton 82430FX PCISET Data Sheet
  6. * (Intel Secret) 82371FB PCI ISA IDE Xcelerator spec.
  7. *
  8. */
  9. #include "local.h"
  10. /****************************************************************************
  11. *
  12. * TritonSetIRQ - Set a Triton PCI link to a specific IRQ
  13. *
  14. * Exported.
  15. *
  16. * ENTRY: bIRQNumber is the new IRQ to be used.
  17. *
  18. * bLink is the Link to be set.
  19. *
  20. * EXIT: Standard PCIMP return value.
  21. *
  22. ***************************************************************************/
  23. PCIMPRET CDECL
  24. TritonSetIRQ(UCHAR bIRQNumber, UCHAR bLink)
  25. {
  26. //
  27. // Validate link number.
  28. //
  29. if (bLink < 0x40) {
  30. return(PCIMP_INVALID_LINK);
  31. }
  32. //
  33. // Use 0x80 to disable.
  34. //
  35. if (!bIRQNumber)
  36. bIRQNumber=0x80;
  37. //
  38. // Set the Triton IRQ register.
  39. //
  40. WriteConfigUchar(bBusPIC, bDevFuncPIC, bLink, bIRQNumber);
  41. return(PCIMP_SUCCESS);
  42. }
  43. /****************************************************************************
  44. *
  45. * TritonGetIRQ - Get the IRQ of a Triton PCI link
  46. *
  47. * Exported.
  48. *
  49. * ENTRY: pbIRQNumber is the buffer to fill.
  50. *
  51. * bLink is the Link to be read.
  52. *
  53. * EXIT: Standard PCIMP return value.
  54. *
  55. ***************************************************************************/
  56. PCIMPRET CDECL
  57. TritonGetIRQ(PUCHAR pbIRQNumber, UCHAR bLink)
  58. {
  59. //
  60. // Validate link number.
  61. //
  62. if (bLink < 0x40) {
  63. return(PCIMP_INVALID_LINK);
  64. }
  65. //
  66. // Store the IRQ value.
  67. //
  68. *pbIRQNumber=ReadConfigUchar(bBusPIC, bDevFuncPIC, bLink);
  69. //
  70. // Return 0 if disabled.
  71. //
  72. if (*pbIRQNumber & 0x80)
  73. *pbIRQNumber=0;
  74. return(PCIMP_SUCCESS);
  75. }
  76. /****************************************************************************
  77. *
  78. * TritonValidateTable - Validate an IRQ table
  79. *
  80. * Exported.
  81. *
  82. * ENTRY: piihIRQInfoHeader points to an IRQInfoHeader followed
  83. * by an IRQ Routing Table.
  84. *
  85. * ulFlags are PCIMP_VALIDATE flags.
  86. *
  87. * EXIT: Standard PCIMP return value.
  88. *
  89. ***************************************************************************/
  90. PCIMPRET CDECL
  91. TritonValidateTable(PIRQINFOHEADER piihIRQInfoHeader, ULONG ulFlags)
  92. {
  93. if ((ulFlags & PCIMP_VALIDATE_SOURCE_BITS)==PCIMP_VALIDATE_SOURCE_PCIBIOS) {
  94. //
  95. // If all links are above 40, we they are config space.
  96. //
  97. if (GetMinLink(piihIRQInfoHeader)>=0x40)
  98. return(PCIMP_SUCCESS);
  99. //
  100. // If there are links above 4, we are clueless.
  101. //
  102. if (GetMaxLink(piihIRQInfoHeader)>0x04)
  103. return(PCIMP_FAILURE);
  104. //
  105. // Assume 1,2,3,4 are the 60,61,62,63 links.
  106. //
  107. NormalizeLinks(piihIRQInfoHeader, 0x5F);
  108. } else {
  109. //
  110. // Validate that all config space addresses are above 40.
  111. //
  112. if (GetMinLink(piihIRQInfoHeader)<0x40)
  113. return(PCIMP_FAILURE);
  114. }
  115. return(PCIMP_SUCCESS);
  116. }