summaryrefslogtreecommitdiffstats
path: root/sys/x86
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2015-03-12 07:07:41 +0000
committerscottl <scottl@FreeBSD.org>2015-03-12 07:07:41 +0000
commit565f091b88bfa171b05c99de7fc77e5edd26d204 (patch)
treeb212f7aeccabb2f8986ac58f2f7767bee8777143 /sys/x86
parent27912a446f0239656b80c34869f2251d446d63e2 (diff)
downloadFreeBSD-src-565f091b88bfa171b05c99de7fc77e5edd26d204.zip
FreeBSD-src-565f091b88bfa171b05c99de7fc77e5edd26d204.tar.gz
MFC r271889, 272799, 272800, 274976
This brings in bus_get_domain() and the related reporting via devinfo, dmesg, and sysctl. Obtained from: adrian, jhb Sponsored by: Netflix, Inc.
Diffstat (limited to 'sys/x86')
-rw-r--r--sys/x86/acpica/srat.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/sys/x86/acpica/srat.c b/sys/x86/acpica/srat.c
index 8b5082c..8130d4b 100644
--- a/sys/x86/acpica/srat.c
+++ b/sys/x86/acpica/srat.c
@@ -62,6 +62,8 @@ int num_mem;
static ACPI_TABLE_SRAT *srat;
static vm_paddr_t srat_physaddr;
+static int vm_domains[VM_PHYSSEG_MAX];
+
static void srat_walk_table(acpi_subtable_handler *handler, void *arg);
/*
@@ -247,7 +249,6 @@ check_phys_avail(void)
static int
renumber_domains(void)
{
- int domains[VM_PHYSSEG_MAX];
int i, j, slot;
/* Enumerate all the domains. */
@@ -255,17 +256,17 @@ renumber_domains(void)
for (i = 0; i < num_mem; i++) {
/* See if this domain is already known. */
for (j = 0; j < vm_ndomains; j++) {
- if (domains[j] >= mem_info[i].domain)
+ if (vm_domains[j] >= mem_info[i].domain)
break;
}
- if (j < vm_ndomains && domains[j] == mem_info[i].domain)
+ if (j < vm_ndomains && vm_domains[j] == mem_info[i].domain)
continue;
/* Insert the new domain at slot 'j'. */
slot = j;
for (j = vm_ndomains; j > slot; j--)
- domains[j] = domains[j - 1];
- domains[slot] = mem_info[i].domain;
+ vm_domains[j] = vm_domains[j - 1];
+ vm_domains[slot] = mem_info[i].domain;
vm_ndomains++;
if (vm_ndomains > MAXMEMDOM) {
vm_ndomains = 1;
@@ -280,15 +281,15 @@ renumber_domains(void)
* If the domain is already the right value, no need
* to renumber.
*/
- if (domains[i] == i)
+ if (vm_domains[i] == i)
continue;
/* Walk the cpu[] and mem_info[] arrays to renumber. */
for (j = 0; j < num_mem; j++)
- if (mem_info[j].domain == domains[i])
+ if (mem_info[j].domain == vm_domains[i])
mem_info[j].domain = i;
for (j = 0; j <= MAX_APIC_ID; j++)
- if (cpus[j].enabled && cpus[j].domain == domains[i])
+ if (cpus[j].enabled && cpus[j].domain == vm_domains[i])
cpus[j].domain = i;
}
KASSERT(vm_ndomains > 0,
@@ -368,4 +369,23 @@ srat_set_cpus(void *dummy)
}
}
SYSINIT(srat_set_cpus, SI_SUB_CPU, SI_ORDER_ANY, srat_set_cpus, NULL);
+
+/*
+ * Map a _PXM value to a VM domain ID.
+ *
+ * Returns the domain ID, or -1 if no domain ID was found.
+ */
+int
+acpi_map_pxm_to_vm_domainid(int pxm)
+{
+ int i;
+
+ for (i = 0; i < vm_ndomains; i++) {
+ if (vm_domains[i] == pxm)
+ return (i);
+ }
+
+ return (-1);
+}
+
#endif /* MAXMEMDOM > 1 */
OpenPOWER on IntegriCloud