pminfo.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /*++
  2. Copyright (c) 2015 Minoca Corp. All Rights Reserved
  3. Module Name:
  4. pminfo.c
  5. Abstract:
  6. This module implements support for getting and setting power management
  7. information.
  8. Author:
  9. Evan Green 9-Sep-2015
  10. Environment:
  11. Kernel
  12. --*/
  13. //
  14. // ------------------------------------------------------------------- Includes
  15. //
  16. #include <minoca/kernel/kernel.h>
  17. #include "pmp.h"
  18. //
  19. // ---------------------------------------------------------------- Definitions
  20. //
  21. //
  22. // ------------------------------------------------------ Data Type Definitions
  23. //
  24. //
  25. // ----------------------------------------------- Internal Function Prototypes
  26. //
  27. //
  28. // -------------------------------------------------------------------- Globals
  29. //
  30. //
  31. // ------------------------------------------------------------------ Functions
  32. //
  33. KSTATUS
  34. PmGetSetSystemInformation (
  35. BOOL FromKernelMode,
  36. PM_INFORMATION_TYPE InformationType,
  37. PVOID Data,
  38. PUINTN DataSize,
  39. BOOL Set
  40. )
  41. /*++
  42. Routine Description:
  43. This routine gets or sets system information.
  44. Arguments:
  45. FromKernelMode - Supplies a boolean indicating whether or not this request
  46. (and the buffer associated with it) originates from user mode (FALSE)
  47. or kernel mode (TRUE).
  48. InformationType - Supplies the information type.
  49. Data - Supplies a pointer to the data buffer where the data is either
  50. returned for a get operation or given for a set operation.
  51. DataSize - Supplies a pointer that on input contains the size of the
  52. data buffer. On output, contains the required size of the data buffer.
  53. Set - Supplies a boolean indicating if this is a get operation (FALSE) or
  54. a set operation (TRUE).
  55. Return Value:
  56. Status code.
  57. --*/
  58. {
  59. KSTATUS Status;
  60. switch (InformationType) {
  61. case PmInformationPerformanceStateHandlers:
  62. Status = PmpGetSetPerformanceStateHandlers(FromKernelMode,
  63. Data,
  64. DataSize,
  65. Set);
  66. break;
  67. case PmInformationIdleStateHandlers:
  68. Status = PmpGetSetIdleStateHandlers(FromKernelMode,
  69. Data,
  70. DataSize,
  71. Set);
  72. break;
  73. default:
  74. Status = STATUS_INVALID_PARAMETER;
  75. *DataSize = 0;
  76. break;
  77. }
  78. return Status;
  79. }
  80. //
  81. // --------------------------------------------------------- Internal Functions
  82. //