This source file includes following definitions.
- print_facility_list
- print_facility_lists
- main
1
2
3
4
5
6
7
8
9
10
11 #include <strings.h>
12 #include <string.h>
13 #include <stdlib.h>
14 #include <stdio.h>
15
16 struct facility_def {
17 char *name;
18 int *bits;
19 };
20
21 static struct facility_def facility_defs[] = {
22 {
23
24
25
26
27
28 .name = "FACILITIES_ALS",
29 .bits = (int[]){
30 #ifdef CONFIG_HAVE_MARCH_Z900_FEATURES
31 0,
32 1,
33 #endif
34 #ifdef CONFIG_HAVE_MARCH_Z990_FEATURES
35 18,
36 #endif
37 #ifdef CONFIG_HAVE_MARCH_Z9_109_FEATURES
38 21,
39 25,
40 #endif
41 #ifdef CONFIG_HAVE_MARCH_Z10_FEATURES
42 27,
43 32,
44 33,
45 34,
46 35,
47 #endif
48 #ifdef CONFIG_HAVE_MARCH_Z196_FEATURES
49 45,
50 #endif
51 #ifdef CONFIG_HAVE_MARCH_ZEC12_FEATURES
52 49,
53 52,
54 #endif
55 #ifdef CONFIG_HAVE_MARCH_Z13_FEATURES
56 53,
57 #endif
58 #ifdef CONFIG_HAVE_MARCH_Z14_FEATURES
59 58,
60 #endif
61 #ifdef CONFIG_HAVE_MARCH_Z15_FEATURES
62 61,
63 #endif
64 -1
65 }
66 },
67 {
68
69
70
71
72
73
74
75 .name = "FACILITIES_KVM",
76 .bits = (int[]){
77 0,
78 1,
79 2,
80 3,
81 4,
82 5,
83 6,
84 7,
85 8,
86 9,
87 10,
88 13,
89 14,
90 73,
91 75,
92 76,
93 77,
94 78,
95 130,
96 131,
97 139,
98 146,
99 150,
100 151,
101 155,
102 -1
103 }
104 },
105 {
106
107
108
109
110
111
112
113 .name = "FACILITIES_KVM_CPUMODEL",
114 .bits = (int[]){
115 12,
116 15,
117 156,
118 -1
119 }
120 },
121 };
122
123 static void print_facility_list(struct facility_def *def)
124 {
125 unsigned int high, bit, dword, i;
126 unsigned long long *array;
127
128 array = calloc(1, 8);
129 if (!array)
130 exit(EXIT_FAILURE);
131 high = 0;
132 for (i = 0; def->bits[i] != -1; i++) {
133 bit = 63 - (def->bits[i] & 63);
134 dword = def->bits[i] / 64;
135 if (dword > high) {
136 array = realloc(array, (dword + 1) * 8);
137 if (!array)
138 exit(EXIT_FAILURE);
139 memset(array + high + 1, 0, (dword - high) * 8);
140 high = dword;
141 }
142 array[dword] |= 1ULL << bit;
143 }
144 printf("#define %s ", def->name);
145 for (i = 0; i <= high; i++)
146 printf("_AC(0x%016llx,UL)%c", array[i], i < high ? ',' : '\n');
147 free(array);
148 }
149
150 static void print_facility_lists(void)
151 {
152 unsigned int i;
153
154 for (i = 0; i < sizeof(facility_defs) / sizeof(facility_defs[0]); i++)
155 print_facility_list(&facility_defs[i]);
156 }
157
158 int main(int argc, char **argv)
159 {
160 printf("#ifndef __ASM_S390_FACILITY_DEFS__\n");
161 printf("#define __ASM_S390_FACILITY_DEFS__\n");
162 printf("/*\n");
163 printf(" * DO NOT MODIFY.\n");
164 printf(" *\n");
165 printf(" * This file was generated by %s\n", __FILE__);
166 printf(" */\n\n");
167 printf("#include <linux/const.h>\n\n");
168 print_facility_lists();
169 printf("\n#endif\n");
170 return 0;
171 }