From bd7b3fff897b3cc30de3300bf2c39d23dc809a74 Mon Sep 17 00:00:00 2001 From: claudio Date: Tue, 28 Jul 2009 07:20:28 +0000 Subject: The firmware is an array of u_int32_t and differs between architectures. From now on install the tigon firmware in little endian byte order and swap it acordingly in the driver. Correctly calculate the length of the FW in the build tool -- now my fiber cards no longer have issues to establish link on bootup. Please put this in deraadt@ On big endian archs (sparc64, macppc) the firmware file needs to be updated. --- sys/dev/microcode/tigon/build.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'sys/dev/microcode') diff --git a/sys/dev/microcode/tigon/build.c b/sys/dev/microcode/tigon/build.c index 7e9a519dc43..02dd9085a79 100644 --- a/sys/dev/microcode/tigon/build.c +++ b/sys/dev/microcode/tigon/build.c @@ -1,4 +1,4 @@ -/* $OpenBSD: build.c,v 1.3 2005/05/17 18:48:52 jason Exp $ */ +/* $OpenBSD: build.c,v 1.4 2009/07/28 07:20:28 claudio Exp $ */ /* * Copyright (c) 2004 Theo de Raadt @@ -37,11 +37,12 @@ output(const char *name, const u_int32_t *FwData, int sizedata) { struct tigon_firmware tfproto, *tf; - int len, fd, i; + int len, fd, i, cnt; + u_int32_t *b; ssize_t rlen; - len = sizeof tf - sizeof(tfproto.data) + sizetext + sizerodata + - sizedata; + len = sizeof(tfproto) - sizeof(tfproto.data) + sizetext + + sizerodata + sizedata; tf = (struct tigon_firmware *)malloc(len); bzero(tf, len); @@ -73,6 +74,11 @@ output(const char *name, bcopy(FwRodata, &tf->data[tf->FwRodataOffset], FwRodataLen); bcopy(FwData, &tf->data[tf->FwDataOffset], FwDataLen); + b = (u_int32_t *)tf; + cnt = len / sizeof(u_int32_t); + for (i = 0; i < cnt; i++) + b[i] = htole32(b[i]); + printf("creating %s length %d [%d+%d+%d] [%d+%d+%d]\n", name, len, FwTextLen, FwRodataLen, FwDataLen, sizetext, sizerodata, sizedata); -- cgit v1.3-18-gd494