summaryrefslogtreecommitdiffstats
path: root/sys/dev/microcode
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2009-07-28 07:20:28 +0000
committerclaudio <claudio@openbsd.org>2009-07-28 07:20:28 +0000
commitbd7b3fff897b3cc30de3300bf2c39d23dc809a74 (patch)
treeb76a3c566d59e9898d1d728ca6a25965c1f229d8 /sys/dev/microcode
parentNext step towards customisable mode keys: build each default table of keys into (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')
-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);