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.

197 lines
3.2 KiB

  1. //
  2. // No Check-in Source Code.
  3. //
  4. // Do not make this code available to non-Microsoft personnel
  5. // without Intel's express permission
  6. //
  7. /**
  8. *** Copyright (C) 1996-97 Intel Corporation. All rights reserved.
  9. ***
  10. *** The information and source code contained herein is the exclusive
  11. *** property of Intel Corporation and may not be disclosed, examined
  12. *** or reproduced in whole or in part without explicit written authorization
  13. *** from the company.
  14. **/
  15. /*++
  16. Copyright (c) 1995 Intel Corporation
  17. Module Name:
  18. simio.c
  19. Abstract:
  20. This module implements the I/O port access routines.
  21. Author:
  22. 14-Apr-1995
  23. Environment:
  24. Kernel mode
  25. Revision History:
  26. --*/
  27. #include "halp.h"
  28. UCHAR
  29. READ_PORT_UCHAR (
  30. PUCHAR Port
  31. )
  32. {
  33. return (*(volatile UCHAR * const)(Port));
  34. }
  35. USHORT
  36. READ_PORT_USHORT (
  37. PUSHORT Port
  38. )
  39. {
  40. return (*(volatile USHORT * const)(Port));
  41. }
  42. ULONG
  43. READ_PORT_ULONG (
  44. PULONG Port
  45. )
  46. {
  47. return (*(volatile ULONG * const)(Port));
  48. }
  49. VOID
  50. WRITE_PORT_UCHAR (
  51. PUCHAR Port,
  52. UCHAR Value
  53. )
  54. {
  55. *(volatile UCHAR * const)(Port) = Value;
  56. KeFlushWriteBuffer();
  57. }
  58. VOID
  59. WRITE_PORT_USHORT (
  60. PUSHORT Port,
  61. USHORT Value
  62. )
  63. {
  64. *(volatile USHORT * const)(Port) = Value;
  65. KeFlushWriteBuffer();
  66. }
  67. VOID
  68. WRITE_PORT_ULONG (
  69. PULONG Port,
  70. ULONG Value
  71. )
  72. {
  73. *(volatile ULONG * const)(Port) = Value;
  74. KeFlushWriteBuffer();
  75. }
  76. VOID
  77. READ_PORT_BUFFER_UCHAR (
  78. PUCHAR Port,
  79. PUCHAR Buffer,
  80. ULONG Count
  81. )
  82. {
  83. PUCHAR ReadBuffer = Buffer;
  84. ULONG ReadCount;
  85. for (ReadCount = 0; ReadCount < Count; ReadCount++, ReadBuffer++) {
  86. *ReadBuffer = *(volatile UCHAR * const)(Port);
  87. }
  88. }
  89. VOID
  90. READ_PORT_BUFFER_USHORT (
  91. PUSHORT Port,
  92. PUSHORT Buffer,
  93. ULONG Count
  94. )
  95. {
  96. PUSHORT ReadBuffer = Buffer;
  97. ULONG ReadCount;
  98. for (ReadCount = 0; ReadCount < Count; ReadCount++, ReadBuffer++) {
  99. *ReadBuffer = *(volatile USHORT * const)(Port);
  100. }
  101. }
  102. VOID
  103. READ_PORT_BUFFER_ULONG (
  104. PULONG Port,
  105. PULONG Buffer,
  106. ULONG Count
  107. )
  108. {
  109. PULONG ReadBuffer = Buffer;
  110. ULONG ReadCount;
  111. for (ReadCount = 0; ReadCount < Count; ReadCount++, ReadBuffer++) {
  112. *ReadBuffer = *(volatile ULONG * const)(Port);
  113. }
  114. }
  115. VOID
  116. WRITE_PORT_BUFFER_UCHAR (
  117. PUCHAR Port,
  118. PUCHAR Buffer,
  119. ULONG Count
  120. )
  121. {
  122. PUCHAR WriteBuffer = Buffer;
  123. ULONG WriteCount;
  124. for (WriteCount = 0; WriteCount < Count; WriteCount++, WriteBuffer++) {
  125. *(volatile UCHAR * const)(Port) = *WriteBuffer;
  126. KeFlushWriteBuffer();
  127. }
  128. }
  129. VOID
  130. WRITE_PORT_BUFFER_USHORT (
  131. PUSHORT Port,
  132. PUSHORT Buffer,
  133. ULONG Count
  134. )
  135. {
  136. PUSHORT WriteBuffer = Buffer;
  137. ULONG WriteCount;
  138. for (WriteCount = 0; WriteCount < Count; WriteCount++, WriteBuffer++) {
  139. *(volatile USHORT * const)(Port) = *WriteBuffer;
  140. KeFlushWriteBuffer();
  141. }
  142. }
  143. VOID
  144. WRITE_PORT_BUFFER_ULONG (
  145. PULONG Port,
  146. PULONG Buffer,
  147. ULONG Count
  148. )
  149. {
  150. PULONG WriteBuffer = Buffer;
  151. ULONG WriteCount;
  152. for (WriteCount = 0; WriteCount < Count; WriteCount++, WriteBuffer++) {
  153. *(volatile ULONG * const)(Port) = *WriteBuffer;
  154. KeFlushWriteBuffer();
  155. }
  156. }
  157. VOID
  158. HalHandleNMI(
  159. IN OUT PVOID NmiInfo
  160. )
  161. {
  162. }