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