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