summaryrefslogtreecommitdiff
path: root/sys/dev/microcode/tigon/build.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2009-07-28 07:20:29 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2009-07-28 07:20:29 +0000
commit6367e65c8eba42345584f505a9a9c42e785110fc (patch)
treec29bb069087c9ded0a36d49a3d0139d89d528446 /sys/dev/microcode/tigon/build.c
parent91b609484f4b8d3135cdb26cb6db6f7c4cdc97fc (diff)
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.
Diffstat (limited to 'sys/dev/microcode/tigon/build.c')
-rw-r--r--sys/dev/microcode/tigon/build.c14
1 files changed, 10 insertions, 4 deletions
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 <deraadt@openbsd.org>
@@ -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);