Xenomai  3.1
features.h
1 /*
2  * Copyright (C) 2005 Philippe Gerum <rpm@xenomai.org>.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13 
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17  */
18 #ifndef _COBALT_UAPI_ASM_GENERIC_FEATURES_H
19 #define _COBALT_UAPI_ASM_GENERIC_FEATURES_H
20 
21 #include <linux/types.h>
22 
23 #define XNFEAT_STRING_LEN 64
24 
25 struct cobalt_featinfo {
27  __u64 clock_freq;
29  __u32 vdso_offset;
31  __u32 feat_abirev;
33  __u32 feat_all;
35  __u32 feat_man;
37  __u32 feat_req;
39  __u32 feat_mis;
40  char feat_all_s[XNFEAT_STRING_LEN];
41  char feat_man_s[XNFEAT_STRING_LEN];
42  char feat_req_s[XNFEAT_STRING_LEN];
43  char feat_mis_s[XNFEAT_STRING_LEN];
44  /* Architecture-specific features. */
45  struct cobalt_featinfo_archdep feat_arch;
46 };
47 
48 #define __xn_feat_smp 0x80000000
49 #define __xn_feat_nosmp 0x40000000
50 #define __xn_feat_fastsynch 0x20000000
51 #define __xn_feat_nofastsynch 0x10000000
52 #define __xn_feat_control 0x08000000
53 #define __xn_feat_prioceiling 0x04000000
54 
55 #ifdef CONFIG_SMP
56 #define __xn_feat_smp_mask __xn_feat_smp
57 #else
58 #define __xn_feat_smp_mask __xn_feat_nosmp
59 #endif
60 
61 /*
62  * Revisit: all archs currently support fast locking, and there is no
63  * reason for any future port not to provide this. This will be
64  * written in stone at the next ABI update, when fastsynch support is
65  * dropped from the optional feature set.
66  */
67 #define __xn_feat_fastsynch_mask __xn_feat_fastsynch
68 
69 /* List of generic features kernel or userland may support */
70 #define __xn_feat_generic_mask \
71  (__xn_feat_smp_mask | \
72  __xn_feat_fastsynch_mask | \
73  __xn_feat_prioceiling)
74 
75 /*
76  * List of features both sides have to agree on: If userland supports
77  * it, the kernel has to provide it, too. This means backward
78  * compatibility between older userland and newer kernel may be
79  * supported for those features, but forward compatibility between
80  * newer userland and older kernel cannot.
81  */
82 #define __xn_feat_generic_man_mask \
83  (__xn_feat_fastsynch | \
84  __xn_feat_nofastsynch | \
85  __xn_feat_nosmp | \
86  __xn_feat_prioceiling)
87 
88 static inline
89 const char *get_generic_feature_label(unsigned int feature)
90 {
91  switch (feature) {
92  case __xn_feat_smp:
93  return "smp";
94  case __xn_feat_nosmp:
95  return "nosmp";
96  case __xn_feat_fastsynch:
97  return "fastsynch";
98  case __xn_feat_nofastsynch:
99  return "nofastsynch";
100  case __xn_feat_control:
101  return "control";
102  case __xn_feat_prioceiling:
103  return "prioceiling";
104  default:
105  return 0;
106  }
107 }
108 
109 static inline int check_abi_revision(unsigned long abirev)
110 {
111  return abirev == XENOMAI_ABI_REV;
112 }
113 
114 #endif /* !_COBALT_UAPI_ASM_GENERIC_FEATURES_H */