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.

132 lines
2.7 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. pmstall.c
  5. Abstract:
  6. This module implements the code necessary to implement the
  7. Halp...StallExecution() routines for the ACPI HAL.
  8. Author:
  9. Shie-Lin Tzong (shielint) 12-Jan-1990
  10. Environment:
  11. Kernel mode only.
  12. Revision History:
  13. bryanwi 20-Sep-90
  14. Add KiSetProfileInterval, KiStartProfileInterrupt,
  15. KiStopProfileInterrupt procedures.
  16. KiProfileInterrupt ISR.
  17. KiProfileList, KiProfileLock are delcared here.
  18. shielint 10-Dec-90
  19. Add performance counter support.
  20. Move system clock to irq8, ie we now use RTC to generate system
  21. clock. Performance count and Profile use timer 1 counter 0.
  22. The interval of the irq0 interrupt can be changed by
  23. KiSetProfileInterval. Performance counter does not care about the
  24. interval of the interrupt as long as it knows the rollover count.
  25. Note: Currently I implemented 1 performance counter for the whole
  26. i386 NT.
  27. John Vert (jvert) 11-Jul-1991
  28. Moved from ke\i386 to hal\i386. Removed non-HAL stuff
  29. shie-lin tzong (shielint) 13-March-92
  30. Move System clock back to irq0 and use RTC (irq8) to generate
  31. profile interrupt. Performance counter and system clock use time1
  32. counter 0 of 8254.
  33. Landy Wang (corollary!landy) 04-Dec-92
  34. Created this module by moving routines from ixclock.asm to here.
  35. Forrest Foltz (forrestf) 24-Oct-2000
  36. Ported from pmstall.asm to pmstall.c
  37. --*/
  38. #include "halcmn.h"
  39. ULONG64 HalpStallLoopsPerTick = 3;
  40. LARGE_INTEGER
  41. HalpQueryPerformanceCounter (VOID);
  42. VOID
  43. HalpInitializeStallExecution (
  44. IN CCHAR ProcessorNumber
  45. )
  46. /*++
  47. Routine Description:
  48. This routine is obsolete in this HAL.
  49. Arguments:
  50. ProcessorNumber - Processor Number
  51. Return Value:
  52. None.
  53. --*/
  54. {
  55. return;
  56. }
  57. VOID
  58. KeStallExecutionProcessor (
  59. IN ULONG MicroSeconds
  60. )
  61. /*++
  62. Routine Description:
  63. This function stalls execution for the specified number of microseconds.
  64. KeStallExecutionProcessor
  65. Arguments:
  66. MicroSeconds - Supplies the number of microseconds that execution is to be
  67. stalled.
  68. Return Value:
  69. None.
  70. --*/
  71. {
  72. ULONG stallTicks;
  73. ULONG64 endTime;
  74. PROCESSOR_FENCE;
  75. if (MicroSeconds == 0) {
  76. return;
  77. }
  78. //
  79. // Target is in microseconds, or 1MHz. Convert to PM_TMR_FREQ,
  80. // which is a colorburst crystal (3,579,545 Hz).
  81. //
  82. stallTicks = (ULONG)(((ULONG64)MicroSeconds * PM_TMR_FREQ) / 1000000);
  83. HalpPmTimerSpecialStall(stallTicks);
  84. }