Module Name:    src
Committed By:   jmcneill
Date:           Sun Jun 30 17:54:08 UTC 2024

Modified Files:
        src/sys/dev/acpi: acpi_srat.c

Log Message:
acpi: Parse GICC SRAT entries.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/acpi/acpi_srat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpi_srat.c
diff -u src/sys/dev/acpi/acpi_srat.c:1.8 src/sys/dev/acpi/acpi_srat.c:1.9
--- src/sys/dev/acpi/acpi_srat.c:1.8	Fri Dec 27 12:51:57 2019
+++ src/sys/dev/acpi/acpi_srat.c	Sun Jun 30 17:54:08 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_srat.c,v 1.8 2019/12/27 12:51:57 ad Exp $ */
+/* $NetBSD: acpi_srat.c,v 1.9 2024/06/30 17:54:08 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_srat.c,v 1.8 2019/12/27 12:51:57 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_srat.c,v 1.9 2024/06/30 17:54:08 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/kmem.h>
@@ -148,6 +148,7 @@ acpisrat_parse(void)
 	ACPI_SRAT_CPU_AFFINITY *srat_cpu;
 	ACPI_SRAT_MEM_AFFINITY *srat_mem;
 	ACPI_SRAT_X2APIC_CPU_AFFINITY *srat_x2apic;
+	ACPI_SRAT_GICC_AFFINITY *srat_gicc;
 
 	acpisrat_nodeid_t nodeid;
 	struct cpulist *cpuentry = NULL;
@@ -236,6 +237,36 @@ acpisrat_parse(void)
 			cpuentry->cpu.flags = srat_x2apic->Flags;
 			break;
 
+		case ACPI_SRAT_TYPE_GICC_AFFINITY:
+			srat_gicc = (ACPI_SRAT_GICC_AFFINITY *)subtable;
+			if ((srat_gicc->Flags & ACPI_SRAT_GICC_ENABLED) == 0)
+				break;
+			nodeid = srat_gicc->ProximityDomain;
+
+			/*
+			 * This table entry overrides
+			 * ACPI_SRAT_TYPE_CPU_AFFINITY.
+			 */
+			if (!ignore_cpu_affinity) {
+				struct cpulist *citer;
+				while ((citer = CPU_FIRST()) != NULL) {
+					CPU_REM(citer);
+					cpu_free(citer);
+				}
+				ignore_cpu_affinity = true;
+			}
+
+			cpuentry = cpu_alloc();
+			if (cpuentry == NULL)
+				return ENOMEM;
+			CPU_ADD(cpuentry);
+
+			cpuentry->cpu.nodeid = nodeid;
+			cpuentry->cpu.apicid = srat_gicc->AcpiProcessorUid;
+			cpuentry->cpu.clockdomain = srat_gicc->ClockDomain;
+			cpuentry->cpu.flags = srat_gicc->Flags;
+			break;
+
 		case ACPI_SRAT_TYPE_RESERVED:
 			printf("ACPI SRAT subtable reserved, length: 0x%x\n",
 				subtable->Length);

Reply via email to