Leaked source code of windows server 2003
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.

337 lines
6.3 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. ixhibrnt.c
  5. Abstract:
  6. This file provides the code that saves and restores
  7. state for traditional motherboard devices when the
  8. system goes into a sleep state that removes power.
  9. Author:
  10. Jake Oshins (jakeo) May 6, 1997
  11. Revision History:
  12. --*/
  13. #include "halp.h"
  14. extern PVOID HalpEisaControlBase;
  15. #ifdef ALLOC_PRAGMA
  16. #pragma alloc_text(PAGE, HaliLocateHiberRanges)
  17. #pragma alloc_text(PAGELK, HalpSaveDmaControllerState)
  18. #pragma alloc_text(PAGELK, HalpSaveTimerState)
  19. #ifdef PIC_SUPPORTED
  20. #pragma alloc_text(PAGELK, HalpSavePicState)
  21. #pragma alloc_text(PAGELK, HalpRestorePicState)
  22. #endif
  23. #pragma alloc_text(PAGELK, HalpRestoreDmaControllerState)
  24. #pragma alloc_text(PAGELK, HalpRestoreTimerState)
  25. #endif
  26. #ifdef notyet
  27. #define EISA_CONTROL (PUCHAR)&((PEISA_CONTROL) HalpEisaControlBase)
  28. #endif // notyet
  29. #ifdef PIC_SUPPORTED
  30. VOID
  31. HalpSavePicState(
  32. VOID
  33. )
  34. {
  35. #ifdef notyet
  36. //
  37. // Commented HalpMotherboardState and EISA_CONTROL********
  38. //
  39. #ifdef notyet
  40. HalpMotherboardState.PicState.MasterMask =
  41. READ_PORT_UCHAR(EISA_CONTROL->Interrupt1ControlPort1);
  42. #endif // notyet
  43. #if defined(NEC_98)
  44. #else
  45. HalpMotherboardState.PicState.MasterEdgeLevelControl =
  46. READ_PORT_UCHAR(EISA_CONTROL->Interrupt1EdgeLevel);
  47. HalpMotherboardState.PicState.SlaveEdgeLevelControl =
  48. READ_PORT_UCHAR(EISA_CONTROL->Interrupt2EdgeLevel);
  49. #endif
  50. #endif // notyet
  51. }
  52. VOID
  53. HalpRestorePicState(
  54. VOID
  55. )
  56. {
  57. #ifdef notyet
  58. ULONG flags;
  59. // _asm {
  60. // pushfd
  61. // pop flags
  62. // cli
  63. // }
  64. _disable();
  65. #ifdef notyet
  66. HalpInitializePICs(FALSE);
  67. //
  68. // HalpMotherboardState,EISA_CONTROL and assembly instruction commented
  69. //
  70. WRITE_PORT_UCHAR(
  71. EISA_CONTROL->Interrupt1ControlPort1,
  72. HalpMotherboardState.PicState.MasterMask
  73. );
  74. WRITE_PORT_UCHAR(
  75. EISA_CONTROL->Interrupt2ControlPort1,
  76. HalpMotherboardState.PicState.SlaveMask
  77. );
  78. #endif // notyet
  79. #if defined(NEC_98)
  80. #else
  81. //
  82. // For halx86, the PCI interrupt vector programming
  83. // is static, so this code can just restore everything.
  84. //
  85. HalpRestorePicEdgeLevelRegister();
  86. #endif
  87. // _asm {
  88. // push flags
  89. // popfd
  90. // }
  91. }
  92. #ifndef NEC_98
  93. VOID
  94. HalpRestorePicEdgeLevelRegister(
  95. VOID
  96. )
  97. {
  98. WRITE_PORT_UCHAR(EISA_CONTROL->Interrupt1EdgeLevel,
  99. HalpMotherboardState.PicState.MasterEdgeLevelControl);
  100. WRITE_PORT_UCHAR(EISA_CONTROL->Interrupt2EdgeLevel,
  101. HalpMotherboardState.PicState.SlaveEdgeLevelControl);
  102. }
  103. #endif
  104. #endif // notyet
  105. }
  106. #endif
  107. VOID
  108. HalpSaveDmaControllerState(
  109. VOID
  110. )
  111. {
  112. #ifdef notyet
  113. #if defined(NEC_98)
  114. #else
  115. HalpMotherboardState.DmaState.Dma1ExtendedModePort =
  116. READ_PORT_UCHAR(
  117. EISA_CONTROL->Dma1ExtendedModePort
  118. );
  119. HalpMotherboardState.DmaState.Dma2ExtendedModePort =
  120. READ_PORT_UCHAR(
  121. EISA_CONTROL->Dma2ExtendedModePort
  122. );
  123. #endif // NEC_98
  124. #ifdef notyet
  125. HalpMotherboardState.DmaState.Dma2ExtendedModePort =
  126. READ_PORT_UCHAR(
  127. EISA_CONTROL->Dma2ExtendedModePort
  128. );
  129. HalpMotherboardState.DmaState.Dma1Control.Mode =
  130. READ_PORT_UCHAR(
  131. EISA_CONTROL->Dma1BasePort.Mode
  132. );
  133. HalpMotherboardState.DmaState.Dma2Control.Mode =
  134. READ_PORT_UCHAR(
  135. EISA_CONTROL->Dma2BasePort.Mode
  136. );
  137. HalpMotherboardState.DmaState.Dma1Control.SingleMask =
  138. READ_PORT_UCHAR(
  139. EISA_CONTROL->Dma1BasePort.SingleMask
  140. );
  141. HalpMotherboardState.DmaState.Dma2Control.SingleMask =
  142. READ_PORT_UCHAR(
  143. EISA_CONTROL->Dma2BasePort.SingleMask
  144. );
  145. #endif // notyet
  146. #endif // notyet
  147. }
  148. VOID
  149. HalpRestoreDmaControllerState(
  150. VOID
  151. )
  152. {
  153. #ifdef notyet
  154. #if defined(NEC_98)
  155. #else
  156. UCHAR i;
  157. WRITE_PORT_UCHAR(
  158. EISA_CONTROL->Dma1ExtendedModePort,
  159. HalpMotherboardState.DmaState.Dma1ExtendedModePort
  160. );
  161. WRITE_PORT_UCHAR(
  162. EISA_CONTROL->Dma2ExtendedModePort,
  163. HalpMotherboardState.DmaState.Dma2ExtendedModePort
  164. );
  165. for (i = 0; i < (EISA_DMA_CHANNELS / 2); i++) {
  166. //
  167. // Check to see if the array has contains a value for this channel.
  168. //
  169. if ((HalpDmaChannelModes[i] & 0x3) == i) {
  170. WRITE_PORT_UCHAR(
  171. EISA_CONTROL->Dma1BasePort.Mode,
  172. HalpDmaChannelModes[i]
  173. );
  174. WRITE_PORT_UCHAR(
  175. EISA_CONTROL->Dma1BasePort.SingleMask,
  176. HalpDmaChannelMasks[i]
  177. );
  178. }
  179. if ((HalpDmaChannelModes[i + (EISA_DMA_CHANNELS / 2)] & 0x3) == i) {
  180. WRITE_PORT_UCHAR(
  181. EISA_CONTROL->Dma2BasePort.Mode,
  182. HalpDmaChannelModes[i + (EISA_DMA_CHANNELS / 2)]
  183. );
  184. WRITE_PORT_UCHAR(
  185. EISA_CONTROL->Dma2BasePort.SingleMask,
  186. HalpDmaChannelMasks[i]
  187. );
  188. }
  189. }
  190. #endif
  191. #endif // notyet
  192. }
  193. VOID
  194. HalpSaveTimerState(
  195. VOID
  196. )
  197. {
  198. }
  199. VOID
  200. HalpRestoreTimerState(
  201. VOID
  202. )
  203. {
  204. HalpInitializeClock();
  205. }
  206. VOID
  207. HaliLocateHiberRanges (
  208. IN PVOID MemoryMap
  209. )
  210. {
  211. ;
  212. //
  213. // Mark the hal's data section as needed to be cloned
  214. //
  215. //
  216. // Commented PO_MEM_CLONE, PO_MEM_PAGE_ADDRESS and PO_MEM_DISCARD
  217. //
  218. #ifdef notyet
  219. // PoSetHiberRange (
  220. // MemoryMap,
  221. // PO_MEM_CLONE,
  222. // (PVOID) &HalpFeatureBits,
  223. // 0,
  224. // 'dlah'
  225. // );
  226. //
  227. // Mark DMA buffer has not needing saved
  228. //
  229. // if (HalpMapBufferSize) {
  230. // PoSetHiberRange (
  231. // MemoryMap,
  232. // PO_MEM_DISCARD | PO_MEM_PAGE_ADDRESS,
  233. // (PVOID) (HalpMapBufferPhysicalAddress.LowPart >> PAGE_SHIFT),
  234. // HalpMapBufferSize >> PAGE_SHIFT,
  235. // 'mlah'
  236. // );
  237. // }
  238. #endif // notyet
  239. }