Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/macppc/stand/ofwboot Fix order of hi / lo halves in...



details:   https://anonhg.NetBSD.org/src/rev/004c905f245e
branches:  trunk
changeset: 368420:004c905f245e
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Jul 10 14:18:27 2022 +0000

description:
Fix order of hi / lo halves in the ofw_address_cells == 2 case.

diffstat:

 sys/arch/macppc/stand/ofwboot/loadfile_machdep.c |  20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)

diffs (67 lines):

diff -r ed0b175544e6 -r 004c905f245e sys/arch/macppc/stand/ofwboot/loadfile_machdep.c
--- a/sys/arch/macppc/stand/ofwboot/loadfile_machdep.c  Sun Jul 10 14:07:55 2022 +0000
+++ b/sys/arch/macppc/stand/ofwboot/loadfile_machdep.c  Sun Jul 10 14:18:27 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: loadfile_machdep.c,v 1.1 2021/02/28 20:27:40 thorpej Exp $     */
+/*     $NetBSD: loadfile_machdep.c,v 1.2 2022/07/10 14:18:27 thorpej Exp $     */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -56,14 +56,13 @@
        paddr_t result;
 
        if (ofw_address_cells == 2) {
-               /* order of cells is phys.lo ... phys.hi */
+               *p++ = ((uint64_t)pa) >> 32;
                *p++ = (uint32_t)pa;
-               *p++ = ((uint64_t)pa) >> 32;
        } else {
                *p++ = (uint32_t)pa;
        }
 
-#if 0  /* No known Mac systems with 2, and spec is ambiguous about order. */
+#if 0  /* No known Mac systems with 2. */
        if (ofw_size_cells == 2) {
                *p++ = ((uint64_t)size) >> 32;
                *p++ = (uint32_t)size;
@@ -80,10 +79,9 @@
        }
 
        if (ofw_address_cells == 2) {
-               /* order of cells is base.lo ... base.hi */
                uint64_t v;
-               v = *p++;
-               v |= (uint64_t)(*p++) << 32;
+               v = (uint64_t)(*p++) << 32;
+               v |= *p++;
                result = (paddr_t)v;
        } else {
                result = *p++;
@@ -106,14 +104,13 @@
        uint32_t *p = cells;
 
        if (ofw_address_cells == 2) {
-               /* order of cells is phys.lo ... phys.hi */
+               *p++ = ((uint64_t)pa) >> 32;
                *p++ = (uint32_t)pa;
-               *p++ = ((uint64_t)pa) >> 32;
        } else {
                *p++ = (uint32_t)pa;
        }
 
-#if 0  /* No known Mac systems with 2, and spec is ambiguous about order. */
+#if 0  /* No known Mac systems with 2. */
        if (ofw_size_cells == 2) {
                *p++ = ((uint64_t)size) >> 32;
                *p++ = (uint32_t)size;
@@ -184,9 +181,8 @@
        uint32_t *p = cells;
 
        if (ofw_address_cells == 2) {
-               /* order of cells is phys.lo ... phys.hi */
+               *p++ = ((uint64_t)pa) >> 32;
                *p++ = (uint32_t)pa;
-               *p++ = ((uint64_t)pa) >> 32;
        } else {
                *p++ = (uint32_t)pa;
        }



Home | Main Index | Thread Index | Old Index