Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * Copyright 2014 IBM Corp.
0004  */
0005 
0006 #ifndef _MISC_CXL_BASE_H
0007 #define _MISC_CXL_BASE_H
0008 
0009 #ifdef CONFIG_CXL_BASE
0010 
0011 #define CXL_IRQ_RANGES 4
0012 
0013 struct cxl_irq_ranges {
0014     irq_hw_number_t offset[CXL_IRQ_RANGES];
0015     irq_hw_number_t range[CXL_IRQ_RANGES];
0016 };
0017 
0018 extern atomic_t cxl_use_count;
0019 
0020 static inline bool cxl_ctx_in_use(void)
0021 {
0022        return (atomic_read(&cxl_use_count) != 0);
0023 }
0024 
0025 static inline void cxl_ctx_get(void)
0026 {
0027        atomic_inc(&cxl_use_count);
0028 }
0029 
0030 static inline void cxl_ctx_put(void)
0031 {
0032        atomic_dec(&cxl_use_count);
0033 }
0034 
0035 struct cxl_afu *cxl_afu_get(struct cxl_afu *afu);
0036 void cxl_afu_put(struct cxl_afu *afu);
0037 void cxl_slbia(struct mm_struct *mm);
0038 
0039 #else /* CONFIG_CXL_BASE */
0040 
0041 static inline bool cxl_ctx_in_use(void) { return false; }
0042 static inline struct cxl_afu *cxl_afu_get(struct cxl_afu *afu) { return NULL; }
0043 static inline void cxl_afu_put(struct cxl_afu *afu) {}
0044 static inline void cxl_slbia(struct mm_struct *mm) {}
0045 
0046 #endif /* CONFIG_CXL_BASE */
0047 
0048 #endif