summaryrefslogtreecommitdiff
path: root/sys/dev/microcode/kue
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2004-11-22 18:49:06 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2004-11-22 18:49:06 +0000
commitef151676286d120c8c8783a4afe273722ef16590 (patch)
tree6881bd8934cf5537e12ebfc67aa15ce94c49caa6 /sys/dev/microcode/kue
parente7ad7c2065e591b266d4b0613c8fcbe9be00eaae (diff)
firmware loading for kue(4), tested for me by dhartmei
Diffstat (limited to 'sys/dev/microcode/kue')
-rw-r--r--sys/dev/microcode/kue/Makefile27
-rw-r--r--sys/dev/microcode/kue/build.c58
-rw-r--r--sys/dev/microcode/kue/kue-license31
-rw-r--r--sys/dev/microcode/kue/kue_fw.h14
4 files changed, 126 insertions, 4 deletions
diff --git a/sys/dev/microcode/kue/Makefile b/sys/dev/microcode/kue/Makefile
new file mode 100644
index 00000000000..8c6172f78e1
--- /dev/null
+++ b/sys/dev/microcode/kue/Makefile
@@ -0,0 +1,27 @@
+# $OpenBSD: Makefile,v 1.1 2004/11/22 18:49:05 deraadt Exp $
+
+NOPROG=
+NOMAN=
+
+# USB capable systems only
+.if (${MACHINE} == "i386") || (${MACHINE} == "amd64") || \
+ (${MACHINE} == "alpha") || (${MACHINE} == "sparc64") || \
+ (${MACHINE_ARCH} == "powerpc") || (${MACHINE} == "cats") || \
+ (${MACHINE} == "hppa") || (${MACHINE} == "sgi")
+
+FIRM= kue
+
+CLEANFILES+= ${FIRM} build
+
+all: build
+ ${.OBJDIR}/build
+
+afterinstall:
+ ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 \
+ ${FIRM} ${DESTDIR}/etc/firmware
+ ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 \
+ ${.CURDIR}/kue-license ${DESTDIR}/etc/firmware
+.endif
+
+.include <bsd.prog.mk>
+
diff --git a/sys/dev/microcode/kue/build.c b/sys/dev/microcode/kue/build.c
new file mode 100644
index 00000000000..d25a925d29c
--- /dev/null
+++ b/sys/dev/microcode/kue/build.c
@@ -0,0 +1,58 @@
+/* $OpenBSD: build.c,v 1.1 2004/11/22 18:49:05 deraadt Exp $ */
+
+/*
+ * Copyright (c) 2004 Theo de Raadt <deraadt@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+#include <sys/types.h>
+#include <dev/usb/if_kuevar.h>
+#include <fcntl.h>
+
+#include "kue_fw.h"
+
+#define FILENAME "kue"
+
+int
+main(int argc, char *argv[])
+{
+ struct kue_firmware kfproto, *kf;
+ int len, fd, i;
+
+ len = sizeof(*kf) - sizeof(kfproto.data) +
+ sizeof(kue_code_seg) + sizeof(kue_fix_seg) +
+ sizeof(kue_trig_seg);
+
+ kf = (struct kue_firmware *)malloc(len);
+ bzero(kf, len);
+
+ kf->codeseglen = sizeof(kue_code_seg);
+ kf->fixseglen = sizeof(kue_fix_seg);
+ kf->trigseglen = sizeof(kue_trig_seg);
+
+ bcopy(kue_code_seg, &kf->data[0], kf->codeseglen);
+ bcopy(kue_fix_seg, &kf->data[kf->codeseglen], kf->fixseglen);
+ bcopy(kue_trig_seg, &kf->data[kf->codeseglen + kf->fixseglen],
+ kf->trigseglen);
+
+ printf("creating %s length %d [%d+%d+%d]\n",
+ FILENAME, len, kf->codeseglen, kf->fixseglen, kf->trigseglen);
+ fd = open(FILENAME, O_WRONLY|O_CREAT|O_TRUNC, 0644);
+ if (fd == -1)
+ err(1, FILENAME);
+
+ write(fd, kf, len);
+ free(kf);
+ close(fd);
+ return 0;
+}
diff --git a/sys/dev/microcode/kue/kue-license b/sys/dev/microcode/kue/kue-license
new file mode 100644
index 00000000000..bddbb5486b2
--- /dev/null
+++ b/sys/dev/microcode/kue/kue-license
@@ -0,0 +1,31 @@
+ * Copyright (c) 1997, 1998, 1999, 2000
+ * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Bill Paul.
+ * 4. Neither the name of the author nor the names of any co-contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+
+This license applies to the kue firmware.
diff --git a/sys/dev/microcode/kue/kue_fw.h b/sys/dev/microcode/kue/kue_fw.h
index 80189aa260c..2eacb752584 100644
--- a/sys/dev/microcode/kue/kue_fw.h
+++ b/sys/dev/microcode/kue/kue_fw.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: kue_fw.h,v 1.1 2001/12/17 01:39:08 deraadt Exp $ */
+/* $OpenBSD: kue_fw.h,v 1.2 2004/11/22 18:49:05 deraadt Exp $ */
/* $NetBSD: kue_fw.h,v 1.3 2001/01/19 08:54:21 jdolecek Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@@ -55,6 +55,9 @@
* work in the driver.
*/
+#if 0
+
+
/* QT controller data block types. */
/* Write data into specific memory location. */
#define KUE_QTBTYPE_WRITE_DATA 0x00
@@ -86,8 +89,11 @@
#define KUE_QTINTR_TRIGGER_CODE 0x3B
#define KUE_QTINTR_LOAD_CODE_HIGH 0x9C
+#endif /* 0 */
+
+
/* Firmware code segment */
-Static const unsigned char kue_code_seg[] =
+const unsigned char kue_code_seg[] =
{
/******************************************/
/* NOTE: B6/C3 is data header signature */
@@ -579,7 +585,7 @@ Static const unsigned char kue_code_seg[] =
};
/* Firmware fixup (data?) segment */
-Static const unsigned char kue_fix_seg[] =
+const unsigned char kue_fix_seg[] =
{
/******************************************/
/* NOTE: B6/C3 is data header signature */
@@ -682,6 +688,6 @@ Static const unsigned char kue_fix_seg[] =
/* Fixup command. */
#define KUE_TRIGCMD_OFFSET 5
-Static const unsigned char kue_trig_seg[] = {
+const unsigned char kue_trig_seg[] = {
0xb6, 0xc3, 0x01, 0x00, 0x06, 0x64, 0x00, 0x00
};