xref: /openbmc/linux/arch/sparc/include/asm/adi_64.h (revision 3cf3cdea)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* adi_64.h: ADI related data structures
3  *
4  * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
5  * Author: Khalid Aziz (khalid.aziz@oracle.com)
6  */
7 #ifndef __ASM_SPARC64_ADI_H
8 #define __ASM_SPARC64_ADI_H
9 
10 #include <linux/types.h>
11 
12 #ifndef __ASSEMBLY__
13 
14 struct adi_caps {
15 	__u64 blksz;
16 	__u64 nbits;
17 	__u64 ue_on_adi;
18 };
19 
20 struct adi_config {
21 	bool enabled;
22 	struct adi_caps caps;
23 };
24 
25 extern struct adi_config adi_state;
26 
27 extern void mdesc_adi_init(void);
28 
29 static inline bool adi_capable(void)
30 {
31 	return adi_state.enabled;
32 }
33 
34 static inline unsigned long adi_blksize(void)
35 {
36 	return adi_state.caps.blksz;
37 }
38 
39 static inline unsigned long adi_nbits(void)
40 {
41 	return adi_state.caps.nbits;
42 }
43 
44 #endif	/* __ASSEMBLY__ */
45 
46 #endif	/* !(__ASM_SPARC64_ADI_H) */
47