Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Make microcode loading work on big endian machines.



details:   https://anonhg.NetBSD.org/src/rev/69b2df31c4f5
branches:  trunk
changeset: 583559:69b2df31c4f5
user:      junyoung <junyoung%NetBSD.org@localhost>
date:      Fri Aug 12 01:07:16 2005 +0000

description:
Make microcode loading work on big endian machines.
Reported and patch supplied by yongari@freebsd a long time ago.

diffstat:

 sys/dev/ic/i82557.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (46 lines):

diff -r 877691fd1316 -r 69b2df31c4f5 sys/dev/ic/i82557.c
--- a/sys/dev/ic/i82557.c       Thu Aug 11 22:25:18 2005 +0000
+++ b/sys/dev/ic/i82557.c       Fri Aug 12 01:07:16 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i82557.c,v 1.91 2005/05/29 22:10:28 christos Exp $     */
+/*     $NetBSD: i82557.c,v 1.92 2005/08/12 01:07:16 junyoung Exp $     */
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2001, 2002 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.91 2005/05/29 22:10:28 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.92 2005/08/12 01:07:16 junyoung Exp $");
 
 #include "bpfilter.h"
 #include "rnd.h"
@@ -2257,7 +2257,7 @@
 static const uint32_t fxp_ucode_d102[] = D102_B_RCVBUNDLE_UCODE;
 static const uint32_t fxp_ucode_d102c[] = D102_C_RCVBUNDLE_UCODE;
 
-#define        UCODE(x)        x, sizeof(x)
+#define        UCODE(x)        x, sizeof(x)/sizeof(uint32_t)
 
 static const struct ucode {
        int32_t         revision;
@@ -2292,7 +2292,7 @@
 {
        const struct ucode *uc;
        struct fxp_cb_ucode *cbp = &sc->sc_control_data->fcd_ucode;
-       int count;
+       int count, i;
 
        if (sc->sc_flags & FXPF_UCODE_LOADED)
                return;
@@ -2318,7 +2318,8 @@
        cbp->cb_status = 0;
        cbp->cb_command = htole16(FXP_CB_COMMAND_UCODE | FXP_CB_COMMAND_EL);
        cbp->link_addr = 0xffffffff;            /* (no) next command */
-       memcpy(cbp->ucode, uc->ucode, uc->length);
+       for (i = 0; i < uc->length; i++)
+               cbp->ucode[i] = htole32(uc->ucode[i]);
 
        if (uc->int_delay_offset)
                *(volatile uint16_t *) &cbp->ucode[uc->int_delay_offset] =



Home | Main Index | Thread Index | Old Index