Windows NT 4.0 source code leak
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.

224 lines
4.4 KiB

4 years ago
  1. /*++
  2. Copyright (c) 1990 Microsoft Corporation
  3. Module Name:
  4. selftest.c
  5. Abstract:
  6. This module contains definitions for selftest.c
  7. Author:
  8. Lluis Abello (lluis) 03-Jan-1991
  9. Environment:
  10. Revision History:
  11. --*/
  12. //
  13. // Video Memory Test
  14. //
  15. #define VIDEO_MEMORY_SIZE 0x200000 // 2 MB
  16. #define DISPLAY_MEMORY_SIZE 0x100000 // 1 MB
  17. //
  18. // Memory test stuff
  19. //
  20. #define TESTED_KB (FW_TOP_ADDRESS>>10)
  21. #define KB_OF_MEMORY (MEMORY_SIZE>>10) //
  22. #define KB_PER_TEST 0x400 // 1024K at a time
  23. #define NVRAM_TEST_END 0x800
  24. typedef ULONG (* TestRoutine)(VOID);
  25. typedef VOID (* LED_ROUTINE)(ULONG);
  26. #ifndef DUO
  27. #define PROM_BASE (KSEG1_BASE | 0x1fc00000)
  28. #else
  29. #define PROM_BASE (EEPROM_VIRTUAL_BASE)
  30. #endif
  31. #define PROM_ENTRY(x) (PROM_BASE + ((x) * 8))
  32. #define PutLedDisplay ((LED_ROUTINE) PROM_ENTRY(14))
  33. //
  34. // Declare static variables
  35. //
  36. extern PUCHAR TranslationTable;
  37. extern UCHAR StationAddress[6];
  38. extern BOOLEAN LanAddress; // True if station address is OK False Otherwise
  39. extern BOOLEAN ConfigurationBit; // read value from diagnostic register
  40. extern BOOLEAN LoopOnError; // read value from diagnostic register
  41. extern BOOLEAN IgnoreErrors; // read value from diagnostic register
  42. extern BOOLEAN VideoReady; // True if display on video monitor
  43. extern volatile LONG TimerTicks; // Counter for timeouts
  44. //
  45. // Routine declaration.
  46. //
  47. BOOLEAN ExecuteTest(TestRoutine,ULONG);
  48. VOID RomPutLine(CHAR *);
  49. ULONG RomVideoMemory();
  50. ULONG RomReadMergeWrite();
  51. ULONG RomIOCacheTest();
  52. ULONG RomSonicResetTest();
  53. ULONG RomSonicLoopBackTest();
  54. ULONG RomFloppyResetTest();
  55. ULONG RomScsiResetTest();
  56. ULONG RomSerialResetTest();
  57. ULONG RomSerial1RegistersTest();
  58. ULONG RomSerial2RegistersTest();
  59. ULONG RomSerial1LoopBackTest();
  60. ULONG RomSerial2LoopBackTest();
  61. ULONG RomParallelRegistersTest();
  62. ULONG RomScsiRegistersTest();
  63. ULONG RomFloppyRegistersTest();
  64. ULONG RomSonicRegistersTest();
  65. ULONG InterruptControllerTest();
  66. ULONG ConnectInterrupts();
  67. ULONG DisableInterrupts();
  68. ULONG RomRTCTest();
  69. ULONG InitMouse();
  70. ULONG InitKeyboard();
  71. ULONG InitKeyboardController();
  72. ULONG RomNvramTest();
  73. VOID RomBeep();
  74. ULONG RomInitISP (VOID);
  75. #define CHECK_ULONG(Address,Value) if (READ_REGISTER_ULONG(Address) != Value) {\
  76. Errors++;\
  77. }
  78. #define CHECK_USHORT(Address,Value) if ((Tmp=READ_REGISTER_USHORT(Address)) != Value) { \
  79. FwPrint("Expected %lx received %lx\r\n",Value,Tmp);\
  80. Errors++;\
  81. }
  82. #define CHECK_UCHAR(Address,Value) if (READ_REGISTER_UCHAR(Address) != Value) { \
  83. Errors++;\
  84. }
  85. #ifdef DUO
  86. typedef
  87. ULONG
  88. (*PPROCESSOR_TASK_ROUTINE) (
  89. IN PVOID Data
  90. );
  91. BOOLEAN
  92. WaitForIpInterrupt();
  93. VOID
  94. WaitForAsIpInterrupt();
  95. BOOLEAN
  96. WaitForBsIpInterrupt(
  97. IN ULONG Timeout
  98. );
  99. VOID
  100. ProcessorBMain(
  101. );
  102. BOOLEAN
  103. ProcessorBSelftest(
  104. IN VOID
  105. );
  106. VOID
  107. WriteMemoryAddressTest(
  108. ULONG StartAddress,
  109. ULONG Size,
  110. ULONG Xorpattern
  111. );
  112. PULONG
  113. CheckMemoryAddressTest(
  114. ULONG StartAddress,
  115. ULONG Size,
  116. ULONG Xorpattern,
  117. ULONG LedDisplayValue
  118. );
  119. VOID
  120. WriteVideoMemoryAddressTest(
  121. ULONG StartAddress,
  122. ULONG Size
  123. );
  124. ULONG
  125. CheckVideoMemoryAddressTest(
  126. ULONG StartAddress,
  127. ULONG Size
  128. );
  129. typedef struct _PROCESSOR_B_TASK_VECTOR {
  130. PPROCESSOR_TASK_ROUTINE Routine;
  131. PVOID Data;
  132. ULONG ReturnValue;
  133. } PROCESSOR_B_TASK_VECTOR, *PPROCESSOR_B_TASK_VECTOR;
  134. extern volatile PROCESSOR_B_TASK_VECTOR ProcessorBTask;
  135. typedef struct _PROCESSOR_B_TEST {
  136. PPROCESSOR_TASK_ROUTINE Routine;
  137. PVOID Data;
  138. } PROCESSOR_B_TEST, *PPROCESSOR_B_TEST;
  139. //
  140. // Define data structures for each of processor B's tests.
  141. //
  142. typedef struct _MEMORY_TEST_DATA {
  143. ULONG StartAddress;
  144. ULONG Size;
  145. ULONG XorPattern;
  146. ULONG LedDisplayValue;
  147. } MEMORY_TEST_DATA, *PMEMORY_TEST_DATA;
  148. ULONG
  149. ProcessorBMemoryTest(
  150. IN PMEMORY_TEST_DATA MemoryData
  151. );
  152. ULONG
  153. ProcessorBVideoMemoryTest(
  154. IN PMEMORY_TEST_DATA MemoryData
  155. );
  156. VOID
  157. ProcessorBSystemBoot(
  158. IN VOID
  159. );
  160. ULONG
  161. RomScsiResetTest(
  162. IN VOID
  163. );
  164. ULONG
  165. CoherencyTest(
  166. IN PVOID CoherentPage
  167. );
  168. BOOLEAN
  169. IsIpInterruptSet(
  170. IN VOID
  171. );
  172. VOID
  173. RestartProcessor(
  174. IN PRESTART_BLOCK RestartBlock
  175. );
  176. #endif