aboutsummaryrefslogtreecommitdiff
path: root/include/slw.h
blob: 299cbf191dd5153e5a77eb1efb30eca6ae1549c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later

#ifndef __SLW_H
#define __SLW_H

#include <stdint.h>
#include <stdbool.h>

#include <ccan/short_types/short_types.h>

/* Define device-tree fields */
#define MAX_NAME_LEN	16
struct cpu_idle_states {
	char name[MAX_NAME_LEN];
	u32 latency_ns;
	u32 residency_ns;
	/*
	 * Register value/mask used to select different idle states.
	 * PMICR in POWER8 and PSSCR in POWER9
	 */
	u64 pm_ctrl_reg_val;
	u64 pm_ctrl_reg_mask;
	u32 flags;
};

/* Track failure in Wakup engine */
enum wakeup_engine_states {
	WAKEUP_ENGINE_NOT_PRESENT,
	WAKEUP_ENGINE_PRESENT,
	WAKEUP_ENGINE_FAILED
};
extern enum wakeup_engine_states wakeup_engine_state;
extern bool has_deep_states;

/* Patch SPR in SLW image */
extern int64_t opal_slw_set_reg(uint64_t cpu_pir, uint64_t sprn, uint64_t val);

extern void slw_init(void);

/* P8 specific */
struct cpu_thread;
struct proc_chip;
extern int64_t opal_slw_set_reg_p8(struct cpu_thread *c, struct proc_chip *chip,
			    uint64_t sprn, uint64_t val);
extern void slw_p8_init(void);
extern void find_cpu_idle_state_properties_p8(struct cpu_idle_states **states, int *nr_states, bool *can_sleep);

#endif /* __SKIBOOT_H */