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