xref: /linux/drivers/infiniband/hw/hfi1/aspm.h (revision 0ea5c948cb64bab5bc7a5516774eb8536f05aa0d)
1*3ec648c6SKrzysztof Kozlowski /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2f48ad614SDennis Dalessandro /*
32280740fSVishwanathapura, Niranjana  * Copyright(c) 2015-2017 Intel Corporation.
4f48ad614SDennis Dalessandro  */
5145eba1aSCai Huoqing 
6f48ad614SDennis Dalessandro #ifndef _ASPM_H
7f48ad614SDennis Dalessandro #define _ASPM_H
8f48ad614SDennis Dalessandro 
9f48ad614SDennis Dalessandro #include "hfi.h"
10f48ad614SDennis Dalessandro 
11f48ad614SDennis Dalessandro extern uint aspm_mode;
12f48ad614SDennis Dalessandro 
13f48ad614SDennis Dalessandro enum aspm_mode {
14f48ad614SDennis Dalessandro 	ASPM_MODE_DISABLED = 0,	/* ASPM always disabled, performance mode */
15f48ad614SDennis Dalessandro 	ASPM_MODE_ENABLED = 1,	/* ASPM always enabled, power saving mode */
16f48ad614SDennis Dalessandro 	ASPM_MODE_DYNAMIC = 2,	/* ASPM enabled/disabled dynamically */
17f48ad614SDennis Dalessandro };
18f48ad614SDennis Dalessandro 
19bf3b1e0cSMichael J. Ruhl void aspm_init(struct hfi1_devdata *dd);
20bf3b1e0cSMichael J. Ruhl void aspm_exit(struct hfi1_devdata *dd);
21bf3b1e0cSMichael J. Ruhl void aspm_hw_disable_l1(struct hfi1_devdata *dd);
22bf3b1e0cSMichael J. Ruhl void __aspm_ctx_disable(struct hfi1_ctxtdata *rcd);
23bf3b1e0cSMichael J. Ruhl void aspm_disable_all(struct hfi1_devdata *dd);
24bf3b1e0cSMichael J. Ruhl void aspm_enable_all(struct hfi1_devdata *dd);
25f48ad614SDennis Dalessandro 
aspm_ctx_disable(struct hfi1_ctxtdata * rcd)26f48ad614SDennis Dalessandro static inline void aspm_ctx_disable(struct hfi1_ctxtdata *rcd)
27f48ad614SDennis Dalessandro {
28f48ad614SDennis Dalessandro 	/* Quickest exit for minimum impact */
29bf3b1e0cSMichael J. Ruhl 	if (likely(!rcd->aspm_intr_supported))
30f48ad614SDennis Dalessandro 		return;
31f48ad614SDennis Dalessandro 
32bf3b1e0cSMichael J. Ruhl 	__aspm_ctx_disable(rcd);
33f48ad614SDennis Dalessandro }
34f48ad614SDennis Dalessandro 
35f48ad614SDennis Dalessandro #endif /* _ASPM_H */
36