xref: /freebsd/sys/xen/features.c (revision 8ddb146abcdf061be9f2c0db7e391697dafad85c)
1 #include <sys/cdefs.h>
2 __FBSDID("$FreeBSD$");
3 
4 #include <sys/param.h>
5 #include <sys/systm.h>
6 
7 #include <xen/xen-os.h>
8 #include <xen/hypervisor.h>
9 #include <xen/features.h>
10 
11 uint8_t xen_features[XENFEAT_NR_SUBMAPS * 32] /* __read_mostly */;
12 
13 void
14 setup_xen_features(void)
15 {
16         xen_feature_info_t fi;
17         int i, j;
18 
19         for (i = 0; i < XENFEAT_NR_SUBMAPS; i++) {
20                 fi.submap_idx = i;
21                 if (HYPERVISOR_xen_version(XENVER_get_features, &fi) < 0)
22                         break;
23                 for (j = 0; j < 32; j++)
24                         xen_features[i*32 + j] = !!(fi.submap & 1<<j);
25         }
26 }
27