1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef TARGET_S390X_CPU_FEATURES_H
15#define TARGET_S390X_CPU_FEATURES_H
16
17#include "qemu/bitmap.h"
18#include "cpu_features_def.h"
19#include "target/s390x/gen-features.h"
20
21
22typedef enum {
23 S390_FEAT_TYPE_STFL,
24 S390_FEAT_TYPE_SCLP_CONF_CHAR,
25 S390_FEAT_TYPE_SCLP_CONF_CHAR_EXT,
26 S390_FEAT_TYPE_SCLP_FAC134,
27 S390_FEAT_TYPE_SCLP_CPU,
28 S390_FEAT_TYPE_MISC,
29 S390_FEAT_TYPE_PLO,
30 S390_FEAT_TYPE_PTFF,
31 S390_FEAT_TYPE_KMAC,
32 S390_FEAT_TYPE_KMC,
33 S390_FEAT_TYPE_KM,
34 S390_FEAT_TYPE_KIMD,
35 S390_FEAT_TYPE_KLMD,
36 S390_FEAT_TYPE_PCKMO,
37 S390_FEAT_TYPE_KMCTR,
38 S390_FEAT_TYPE_KMF,
39 S390_FEAT_TYPE_KMO,
40 S390_FEAT_TYPE_PCC,
41 S390_FEAT_TYPE_PPNO,
42 S390_FEAT_TYPE_KMA,
43 S390_FEAT_TYPE_KDSA,
44 S390_FEAT_TYPE_SORTL,
45 S390_FEAT_TYPE_DFLTCC,
46} S390FeatType;
47
48
49typedef struct {
50 const char *name;
51 const char *desc;
52 S390FeatType type;
53 int bit;
54} S390FeatDef;
55
56
57typedef unsigned long S390FeatBitmap[BITS_TO_LONGS(S390_FEAT_MAX)];
58
59
60typedef uint64_t S390FeatInit[S390_FEAT_MAX / 64 + 1];
61
62const S390FeatDef *s390_feat_def(S390Feat feat);
63S390Feat s390_feat_by_type_and_bit(S390FeatType type, int bit);
64void s390_init_feat_bitmap(const S390FeatInit init, S390FeatBitmap bitmap);
65void s390_fill_feat_block(const S390FeatBitmap features, S390FeatType type,
66 uint8_t *data);
67void s390_add_from_feat_block(S390FeatBitmap features, S390FeatType type,
68 uint8_t *data);
69void s390_feat_bitmap_to_ascii(const S390FeatBitmap features, void *opaque,
70 void (*fn)(const char *name, void *opaque));
71
72
73typedef struct {
74 const char *name;
75 const char *desc;
76 S390FeatBitmap feat;
77 S390FeatInit init;
78} S390FeatGroupDef;
79
80const S390FeatGroupDef *s390_feat_group_def(S390FeatGroup group);
81
82#define BE_BIT_NR(BIT) (BIT ^ (BITS_PER_LONG - 1))
83
84static inline void clear_be_bit(unsigned int bit_nr, uint8_t *array)
85{
86 array[bit_nr / 8] &= ~(0x80 >> (bit_nr % 8));
87}
88static inline void set_be_bit(unsigned int bit_nr, uint8_t *array)
89{
90 array[bit_nr / 8] |= 0x80 >> (bit_nr % 8);
91}
92static inline bool test_be_bit(unsigned int bit_nr, const uint8_t *array)
93{
94 return array[bit_nr / 8] & (0x80 >> (bit_nr % 8));
95}
96#endif
97