summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2007-04-19 04:08:52 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2007-04-19 04:08:52 +0000
commitfefb984b6c0031e71c2a79040ecb5dc4842e0c17 (patch)
tree698d3af99bb5a474e3fee5f3d5bccb0736293baa /sys
parentb462aaafb9a97d503c63fe43c8676dcec988d482 (diff)
the tht firmware isnt technically a firmware, its a series of commands
interleaved with data, which is copied directly into the task fifo of a tht controller. the commands and data are all 32bit words, and they all have to be little endian. this byteswaps the host ordered values in microcode.h into little endian values for the controller to eat. you can now build the firmware correctly on big endian archs.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/microcode/tht/build.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/dev/microcode/tht/build.c b/sys/dev/microcode/tht/build.c
index eff9dee362f..fdc45b32a8b 100644
--- a/sys/dev/microcode/tht/build.c
+++ b/sys/dev/microcode/tht/build.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: build.c,v 1.1 2007/04/19 04:04:58 dlg Exp $ */
+/* $OpenBSD: build.c,v 1.2 2007/04/19 04:08:51 dlg Exp $ */
/*
* Copyright (c) 2007 David Gwynne <dlg@openbsd.org>
@@ -32,11 +32,15 @@ main(int argc, char *argv[])
{
ssize_t len;
int fd;
+ int i;
fd = open(THT_FW_NAME, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd == -1)
err(1, "%s", THT_FW_NAME);
+ for (i = 0; i < (sizeof(tht_fw) / sizeof(tht_fw[0])); i++)
+ tht_fw[i] = htole32(tht_fw[i]);
+
len = write(fd, tht_fw, sizeof(tht_fw));
if (len == -1)
err(1, "%s write", THT_FW_NAME);