pr.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:5k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /******************************************************************************
  2.  *
  3.  * Module Name: processor.h
  4.  *              $Revision: 13 $
  5.  *
  6.  *****************************************************************************/
  7. /*
  8.  *  Copyright (C) 2000, 2001 Andrew Grover
  9.  *
  10.  *  This program is free software; you can redistribute it and/or modify
  11.  *  it under the terms of the GNU General Public License as published by
  12.  *  the Free Software Foundation; either version 2 of the License, or
  13.  *  (at your option) any later version.
  14.  *
  15.  *  This program is distributed in the hope that it will be useful,
  16.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18.  *  GNU General Public License for more details.
  19.  *
  20.  *  You should have received a copy of the GNU General Public License
  21.  *  along with this program; if not, write to the Free Software
  22.  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  23.  */
  24. #ifndef __PR_H__
  25. #define __PR_H__
  26. #include <bm.h>
  27. /*****************************************************************************
  28.  *                             Types & Other Defines
  29.  *****************************************************************************/
  30. #define PR_MAX_POWER_STATES 4
  31. #define PR_MAX_THROTTLE_STATES  8
  32. #define PR_MAX_PERF_STATES 32
  33. #define PR_MAX_C2_LATENCY 100
  34. #define PR_MAX_C3_LATENCY 1000
  35. /*
  36.  * Commands:
  37.  * ---------
  38.  */
  39. #define PR_COMMAND_GET_POWER_INFO ((BM_COMMAND) 0x80)
  40. #define PR_COMMAND_SET_POWER_INFO ((BM_COMMAND) 0x81)
  41. #define PR_COMMAND_GET_PERF_INFO ((BM_COMMAND) 0x82)
  42. #define PR_COMMAND_GET_PERF_STATE ((BM_COMMAND) 0x83)
  43. #define PR_COMMAND_SET_PERF_LIMIT ((BM_COMMAND) 0x84)
  44. /*
  45.  * Notifications:
  46.  * --------------
  47.  */
  48. #define PR_NOTIFY_PERF_STATES ((BM_NOTIFY) 0x80)
  49. #define PR_NOTIFY_POWER_STATES ((BM_NOTIFY) 0x81)
  50. /*
  51.  * Performance Control:
  52.  * --------------------
  53.  */
  54. #define PR_PERF_DEC 0x00
  55. #define PR_PERF_INC 0x01
  56. #define PR_PERF_MAX 0xFF
  57. /*
  58.  * Power States:
  59.  * -------------
  60.  */
  61. #define PR_C0 0x00
  62. #define PR_C1 0x01
  63. #define PR_C2 0x02
  64. #define PR_C3 0x03
  65. #define PR_C1_FLAG 0x01;
  66. #define PR_C2_FLAG 0x02;
  67. #define PR_C3_FLAG 0x04;
  68. /*
  69.  * PR_CX_POLICY_VALUES:
  70.  * --------------------
  71.  */
  72. typedef struct
  73. {
  74. u32 time_threshold;
  75. u32 count_threshold;
  76. u32                     bm_threshold;
  77. u32          target_state;
  78. u32 count;
  79. } PR_CX_POLICY_VALUES;
  80. /*
  81.  * PR_CX:
  82.  * ------
  83.  */
  84. typedef struct
  85. {
  86. u32                     latency;
  87. u32                     utilization;
  88. u8                      is_valid;
  89. PR_CX_POLICY_VALUES     promotion;
  90. PR_CX_POLICY_VALUES     demotion;
  91. } PR_CX;
  92. /*
  93.  * PR_POWER:
  94.  * ---------
  95.  */
  96. typedef struct
  97. {
  98. ACPI_PHYSICAL_ADDRESS   p_lvl2;
  99. ACPI_PHYSICAL_ADDRESS   p_lvl3;
  100. u32                     bm_activity;
  101. u32                     active_state;
  102. u32 default_state;
  103. u32 busy_metric;
  104. u32                     state_count;
  105. PR_CX                   state[PR_MAX_POWER_STATES];
  106. } PR_POWER;
  107. /*
  108.  * PR_PERFORMANCE_STATE:
  109.  * ---------------------
  110.  */
  111. typedef struct
  112. {
  113. u32                     performance;
  114. u32                     power;
  115. } PR_PERFORMANCE_STATE;
  116. /*
  117.  * PR_PERFORMANCE:
  118.  * ---------------
  119.  */
  120. typedef struct
  121. {
  122. u32                     active_state;
  123. u32 thermal_limit;
  124. u32 power_limit;
  125. u32                     state_count;
  126. PR_PERFORMANCE_STATE    state[PR_MAX_PERF_STATES];
  127. } PR_PERFORMANCE;
  128. /*
  129.  * PR_PBLOCK:
  130.  * ----------
  131.  */
  132. typedef struct
  133. {
  134. u32                     length;
  135. ACPI_PHYSICAL_ADDRESS   address;
  136. } PR_PBLOCK;
  137. /*
  138.  * PR_CONTEXT:
  139.  * -----------
  140.  */
  141. typedef struct
  142. {
  143. BM_HANDLE               device_handle;
  144. acpi_handle             acpi_handle;
  145. u32                     uid;
  146. PR_PBLOCK               pblk;
  147. PR_POWER power;
  148. PR_PERFORMANCE performance;
  149. } PR_CONTEXT;
  150. /******************************************************************************
  151.  *                             Function Prototypes
  152.  *****************************************************************************/
  153. /* processor.c */
  154. acpi_status
  155. pr_initialize(void);
  156. acpi_status
  157. pr_terminate(void);
  158. acpi_status
  159. pr_notify (
  160. BM_NOTIFY               notify_type,
  161. BM_HANDLE               device_handle,
  162. void                    **context);
  163. acpi_status
  164. pr_request(
  165. BM_REQUEST *request,
  166. void                    *context);
  167. /* prpower.c */
  168. void
  169. pr_power_idle (void);
  170. acpi_status
  171. pr_power_add_device (
  172. PR_CONTEXT              *processor);
  173. acpi_status
  174. pr_power_remove_device (
  175. PR_CONTEXT              *processor);
  176. acpi_status
  177. pr_power_initialize (void);
  178. acpi_status
  179. pr_power_terminate (void);
  180. /* prperf.c */
  181. acpi_status
  182. pr_perf_get_state (
  183. PR_CONTEXT              *processor,
  184. u32                     *state);
  185. acpi_status
  186. pr_perf_set_state (
  187. PR_CONTEXT              *processor,
  188. u32                     state);
  189. acpi_status
  190. pr_perf_set_limit (
  191. PR_CONTEXT              *processor,
  192. u32                     limit);
  193. acpi_status
  194. pr_perf_add_device (
  195. PR_CONTEXT              *processor);
  196. acpi_status
  197. pr_perf_remove_device (
  198. PR_CONTEXT              *processor);
  199. /* Processor Driver OSL */
  200. acpi_status
  201. pr_osl_add_device (
  202. PR_CONTEXT *processor);
  203. acpi_status
  204. pr_osl_remove_device (
  205. PR_CONTEXT *processor);
  206. acpi_status
  207. pr_osl_generate_event (
  208. u32 event,
  209. PR_CONTEXT *processor);
  210. #endif  /* __PR_H__ */