Module Name:    src
Committed By:   riastradh
Date:           Fri Mar 22 20:47:31 UTC 2024

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

Log Message:
apei(4): Fix register chunk counting.

Now it will actually read and write the registers!

Have been updating and reloading the wrong module to test this, oops.

PR kern/58046


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/acpi/apei_mapreg.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/apei_mapreg.c
diff -u src/sys/dev/acpi/apei_mapreg.c:1.2 src/sys/dev/acpi/apei_mapreg.c:1.3
--- src/sys/dev/acpi/apei_mapreg.c:1.2	Fri Mar 22 18:19:14 2024
+++ src/sys/dev/acpi/apei_mapreg.c	Fri Mar 22 20:47:31 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: apei_mapreg.c,v 1.2 2024/03/22 18:19:14 riastradh Exp $	*/
+/*	$NetBSD: apei_mapreg.c,v 1.3 2024/03/22 20:47:31 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2024 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: apei_mapreg.c,v 1.2 2024/03/22 18:19:14 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: apei_mapreg.c,v 1.3 2024/03/22 20:47:31 riastradh Exp $");
 
 #include <sys/types.h>
 
@@ -136,7 +136,7 @@ apei_mapreg_read(const ACPI_GENERIC_ADDR
     const struct apei_mapreg *map)
 {
 	unsigned chunkbits = NBBY*(1 << (reg->AccessWidth - 1));
-	unsigned i, n = reg->BitWidth % chunkbits;
+	unsigned i, n = reg->BitWidth / chunkbits;
 	uint64_t v = 0;
 
 	for (i = 0; i < n; i++) {
@@ -175,7 +175,7 @@ apei_mapreg_write(const ACPI_GENERIC_ADD
     uint64_t v)
 {
 	unsigned chunkbits = NBBY*(1 << (reg->AccessWidth - 1));
-	unsigned i, n = reg->BitWidth % chunkbits;
+	unsigned i, n = reg->BitWidth / chunkbits;
 
 	membar_release();	/* XXX probably not right for MMIO */
 	for (i = 0; i < n; i++) {

Reply via email to