kernel: Rework cpuidle module
* Create new interface for cpuidle modules (similar to the cpufreq interface) * Generic cpuidle module is no longer needed * Fix and update Intel C-State module
This commit is contained in:
@@ -8,50 +8,18 @@
|
||||
|
||||
#include <module.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define CPUIDLE_CSTATE_MAX 8
|
||||
#define CSTATE_NAME_LENGTH 32
|
||||
#define B_CPUIDLE_MODULE_NAME "generic/cpuidle/v1"
|
||||
#define CPUIDLE_MODULES_PREFIX "power/cpuidle"
|
||||
|
||||
|
||||
struct CpuidleStat {
|
||||
uint64 usageCount;
|
||||
bigtime_t usageTime;
|
||||
};
|
||||
typedef struct cpuidle_module_info {
|
||||
module_info info;
|
||||
|
||||
float rank;
|
||||
|
||||
struct CpuidleInfo {
|
||||
int32 cstateSleep;
|
||||
CpuidleStat stats[CPUIDLE_CSTATE_MAX];
|
||||
};
|
||||
void (*idle)(void);
|
||||
void (*wait)(int32* variable, int32 test);
|
||||
} cpuidle_module_info;
|
||||
|
||||
struct CpuidleDevice;
|
||||
|
||||
struct CpuidleCstate {
|
||||
char name[CSTATE_NAME_LENGTH];
|
||||
int32 latency;
|
||||
int32 (*EnterIdle)(int32 state, CpuidleDevice *device);
|
||||
void *pData;
|
||||
};
|
||||
|
||||
|
||||
struct CpuidleDevice {
|
||||
CpuidleCstate cStates[CPUIDLE_CSTATE_MAX];
|
||||
int32 cStateCount;
|
||||
};
|
||||
|
||||
|
||||
struct CpuidleModuleInfo {
|
||||
module_info info;
|
||||
status_t (*AddDevice)(CpuidleDevice *device);
|
||||
};
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _CPUIDLE_MODULE_H
|
||||
|
||||
Reference in New Issue
Block a user