Lines Matching +full:mem +full:- +full:base
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
95 * This maps the SLIT data into the VM-domain centric view. in slit_parse_table()
97 * remap them to a VM-domain ID and if it doesn't exist, in slit_parse_table()
100 * It should result in a packed 2d array of VM-domain in slit_parse_table()
105 printf("SLIT.Localities: %d\n", (int) s->LocalityCount); in slit_parse_table()
106 for (i = 0; i < s->LocalityCount; i++) { in slit_parse_table()
113 for (j = 0; j < s->LocalityCount; j++) { in slit_parse_table()
117 e = s->Entry[i * s->LocalityCount + j]; in slit_parse_table()
122 vm_locality_table[offset] = -1; in slit_parse_table()
140 return (-1); in parse_slit()
145 return (-1); in parse_slit()
224 id = pc->pc_acpi_id; in cpu_get_info()
226 id = pc->pc_apic_id; in cpu_get_info()
248 if (last_cpu >= max_cpus - 1) in cpu_add()
252 cpup->domain = domain; in cpu_add()
253 cpup->id = cpuid; in cpu_add()
254 cpup->enabled = 1; in cpu_add()
263 ACPI_SRAT_MEM_AFFINITY *mem; in srat_parse_entry() local
266 uint64_t base, length; in srat_parse_entry() local
269 switch (entry->Type) { in srat_parse_entry()
272 domain = cpu->ProximityDomainLo | in srat_parse_entry()
273 cpu->ProximityDomainHi[0] << 8 | in srat_parse_entry()
274 cpu->ProximityDomainHi[1] << 16 | in srat_parse_entry()
275 cpu->ProximityDomainHi[2] << 24; in srat_parse_entry()
278 cpu->ApicId, domain, in srat_parse_entry()
279 (cpu->Flags & ACPI_SRAT_CPU_ENABLED) ? in srat_parse_entry()
281 if (!(cpu->Flags & ACPI_SRAT_CPU_ENABLED)) in srat_parse_entry()
283 cpup = cpu_find(cpu->ApicId); in srat_parse_entry()
286 cpu->ApicId); in srat_parse_entry()
290 cpup = cpu_add(cpu->ApicId, domain); in srat_parse_entry()
293 cpu->ApicId); in srat_parse_entry()
299 x2apic->ApicId, x2apic->ProximityDomain, in srat_parse_entry()
300 (x2apic->Flags & ACPI_SRAT_CPU_ENABLED) ? in srat_parse_entry()
302 if (!(x2apic->Flags & ACPI_SRAT_CPU_ENABLED)) in srat_parse_entry()
304 KASSERT(cpu_find(x2apic->ApicId) == NULL, in srat_parse_entry()
305 ("Duplicate local APIC ID %u", x2apic->ApicId)); in srat_parse_entry()
306 cpup = cpu_add(x2apic->ApicId, x2apic->ProximityDomain); in srat_parse_entry()
309 x2apic->ApicId); in srat_parse_entry()
315 gicc->AcpiProcessorUid, gicc->ProximityDomain, in srat_parse_entry()
316 (gicc->Flags & ACPI_SRAT_GICC_ENABLED) ? in srat_parse_entry()
318 if (!(gicc->Flags & ACPI_SRAT_GICC_ENABLED)) in srat_parse_entry()
320 KASSERT(cpu_find(gicc->AcpiProcessorUid) == NULL, in srat_parse_entry()
321 ("Duplicate CPU UID %u", gicc->AcpiProcessorUid)); in srat_parse_entry()
322 cpup = cpu_add(gicc->AcpiProcessorUid, gicc->ProximityDomain); in srat_parse_entry()
325 gicc->AcpiProcessorUid); in srat_parse_entry()
328 mem = (ACPI_SRAT_MEM_AFFINITY *)entry; in srat_parse_entry()
329 base = mem->BaseAddress; in srat_parse_entry()
330 length = mem->Length; in srat_parse_entry()
331 domain = mem->ProximityDomain; in srat_parse_entry()
336 domain, (uintmax_t)base, (uintmax_t)length, in srat_parse_entry()
337 (mem->Flags & ACPI_SRAT_MEM_ENABLED) ? in srat_parse_entry()
339 if (!(mem->Flags & ACPI_SRAT_MEM_ENABLED)) in srat_parse_entry()
341 if (base >= maxphyaddr || in srat_parse_entry()
342 !overlaps_phys_avail(base, base + length)) { in srat_parse_entry()
344 (uintmax_t)base); in srat_parse_entry()
356 if (base == mem_info[i].end) { in srat_parse_entry()
360 if (base + length == mem_info[i].start) { in srat_parse_entry()
361 mem_info[i].start -= length; in srat_parse_entry()
365 if (mem_info[i].end <= base) in srat_parse_entry()
367 if (mem_info[i].start < base + length) { in srat_parse_entry()
374 for (i = num_mem; i > slot; i--) in srat_parse_entry()
375 mem_info[i] = mem_info[i - 1]; in srat_parse_entry()
376 mem_info[slot].start = base; in srat_parse_entry()
377 mem_info[slot].end = base + length; in srat_parse_entry()
416 printf("SRAT: mem dom %d is empty\n", in check_domains()
462 printf("SRAT: No memory region found for 0x%jx - 0x%jx\n", in check_phys_avail()
468 * Renumber the memory domains to be compact and zero-based if not
495 for (j = ndomain; j > slot; j--) in renumber_domains()
496 domain_pxm[j] = domain_pxm[j - 1]; in renumber_domains()
533 return (-1); in acpi_pxm_init()
536 last_cpu = -1; in acpi_pxm_init()
540 return (-1); in acpi_pxm_init()
551 idx -= 2; in acpi_pxm_init()
554 addr = trunc_page(phys_avail[idx + 1] - size); in acpi_pxm_init()
557 phys_avail[idx + 1] = addr - 1; in acpi_pxm_init()
586 return (-1); in parse_srat()
598 * For now, assume -1 == "no locality information for in init_mem_locality()
602 vm_locality_table[i] = -1; in init_mem_locality()
637 acpi_walk_subtables(srat + 1, (char *)srat + srat->Header.Length, in srat_walk_table()
642 * Set up per-CPU domain IDs from information saved in 'cpus' and tear down data
660 pc->pc_domain = vm_ndomains > 1 ? cpu->domain : 0; in acpi_pxm_set_cpu_locality()
661 CPU_SET(i, &cpuset_domain[pc->pc_domain]); in acpi_pxm_set_cpu_locality()
664 pc->pc_domain); in acpi_pxm_set_cpu_locality()
680 return (cpu->domain); in acpi_pxm_get_cpu_locality()
686 * Returns the domain ID, or -1 if no domain ID was found.
698 return (-1); in acpi_map_pxm_to_vm_domainid()
707 return (-1); in acpi_map_pxm_to_vm_domainid()