aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Leidinger <netchild@FreeBSD.org>2003-09-24 13:59:43 +0000
committerAlexander Leidinger <netchild@FreeBSD.org>2003-09-24 13:59:43 +0000
commit1eddd19d0ce12fe9007d39ebd199066206084270 (patch)
tree4c57493d86a6a2f1be3cda1c5c15f009ea74b344
parent8378e5212297feec4be7d56b88e5d69a0e3390eb (diff)
downloadports-1eddd19d0ce12fe9007d39ebd199066206084270.tar.gz
ports-1eddd19d0ce12fe9007d39ebd199066206084270.zip
Notes
-rw-r--r--sysutils/Makefile1
-rw-r--r--sysutils/afbinit/Makefile53
-rw-r--r--sysutils/afbinit/distinfo2
-rw-r--r--sysutils/afbinit/files/patch-afbinit.c93
-rw-r--r--sysutils/afbinit/files/patch-debian::afbinit.init44
-rw-r--r--sysutils/afbinit/pkg-descr6
-rw-r--r--sysutils/afbinit/pkg-message6
-rw-r--r--sysutils/afbinit/pkg-plist4
8 files changed, 209 insertions, 0 deletions
diff --git a/sysutils/Makefile b/sysutils/Makefile
index 3d133a7088e6..03b544853c40 100644
--- a/sysutils/Makefile
+++ b/sysutils/Makefile
@@ -7,6 +7,7 @@
SUBDIR += Tee
SUBDIR += abck
SUBDIR += acidlaunch
+ SUBDIR += afbinit
SUBDIR += afio
SUBDIR += ah-tty
SUBDIR += and
diff --git a/sysutils/afbinit/Makefile b/sysutils/afbinit/Makefile
new file mode 100644
index 000000000000..f5cb189e7d70
--- /dev/null
+++ b/sysutils/afbinit/Makefile
@@ -0,0 +1,53 @@
+# Ports collection makefile for: afbinit
+# Date created: 15 September 2003
+# Whom: marius@alchemy.franken.de
+#
+# $FreeBSD$
+#
+
+PORTNAME= afbinit
+PORTVERSION= 1.0
+CATEGORIES= sysutils graphics
+MASTER_SITES= ${MASTER_SITE_DEBIAN}
+MASTER_SITE_SUBDIR= pool/contrib/a/afbinit
+DISTNAME= ${PORTNAME}_${PORTVERSION}.orig
+
+PATCH_SITES= ${MASTER_SITES}
+PATCH_SITE_SUBDIR= ${MASTER_SITE_SUBDIR}
+PATCHFILES= ${PORTNAME}_${PORTVERSION}-1.diff.gz
+PATCH_DIST_STRIP= -p1
+
+MAINTAINER= marius@alchemy.franken.de
+COMMENT= Sun AFB aka Sun Elite 3D microcode firmware loader
+
+ONLY_FOR_ARCHS= sparc64
+USE_REINPLACE= yes
+WRKSRC= ${WRKDIR}/${DISTNAME:S/_/-/}
+PKGMESSAGE= ${WRKDIR}/pkg-message
+
+MAN8= afbinit.8
+
+post-patch:
+.for i in afbinit.c debian/afbinit.8 debian/afbinit.init
+ @${REINPLACE_CMD} -E -e 's|\/usr\/lib|${DATADIR}|g; \
+ s|(\/dev\/fb\[)[0-3]+(\])|\10-7\2|g; \
+ s|\/etc\/init.d\/afb|${PREFIX}/etc/afbinit.sh|g; \
+ s|\/usr\/sbin|${PREFIX}/sbin|g' ${WRKSRC}/${i}
+.endfor
+ @${SED} 's|%%DATADIR%%|${DATADIR}|g' ${PKGDIR}/pkg-message > \
+ ${WRKDIR}/pkg-message
+
+do-build:
+ @cd ${WRKSRC} && ${CC} ${CFLAGS} -o afbinit afbinit.c
+
+do-install:
+ @${INSTALL_PROGRAM} ${WRKSRC}/afbinit ${PREFIX}/sbin
+ @${INSTALL_MAN} ${WRKSRC}/debian/afbinit.8 ${PREFIX}/man/man8
+ @${INSTALL_SCRIPT} ${WRKSRC}/debian/afbinit.init \
+ ${PREFIX}/etc/rc.d/afbinit.sh
+ @${INSTALL} -d ${DATADIR}
+
+post-install:
+ @${CAT} ${WRKDIR}/pkg-message
+
+.include <bsd.port.mk>
diff --git a/sysutils/afbinit/distinfo b/sysutils/afbinit/distinfo
new file mode 100644
index 000000000000..e46b1c620f66
--- /dev/null
+++ b/sysutils/afbinit/distinfo
@@ -0,0 +1,2 @@
+MD5 (afbinit_1.0.orig.tar.gz) = c126b3ebb72e5028fd5d35fb6128316f
+MD5 (afbinit_1.0-1.diff.gz) = 499e2ad6922e377b8f05d661d332d0de
diff --git a/sysutils/afbinit/files/patch-afbinit.c b/sysutils/afbinit/files/patch-afbinit.c
new file mode 100644
index 000000000000..a26aac113849
--- /dev/null
+++ b/sysutils/afbinit/files/patch-afbinit.c
@@ -0,0 +1,93 @@
+This patch is based on code marked:
+
+/*
+ * Creator, Creator3D and Elite3D framebuffer driver.
+ *
+ * Copyright (C) 2000 Jakub Jelinek (jakub@redhat.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * JAKUB JELINEK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+/* XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c,v 1.11 2002/12/06 02:44:04 tsi Exp */
+
+--- afbinit.c.orig Fri Nov 30 03:04:21 2001
++++ afbinit.c Mon Sep 15 17:33:19 2003
+@@ -184,7 +184,7 @@
+
+ static void usage(char *me)
+ {
+- printf("Usage: %s /dev/fb[0123] [ucode_file]\n", me);
++ printf("Usage: %s /dev/fb[0-7] [ucode_file]\n", me);
+ exit(1);
+ }
+
+@@ -193,13 +193,14 @@
+ struct afb_ucode_header {
+ char ident[8];
+ unsigned int ucode_words;
+- unsigned int __unused[2];
++ unsigned int unused[2];
+ } ucheader;
+ unsigned int *ucode;
+ int afb_fd, ucode_fd, ucode_version;
+ void *uregs, *kregs;
+ char *afb_fname;
+ char *ucode_fname = UCODE_FILE;
++ unsigned int fem;
+
+ if(argc != 2 && argc != 3)
+ usage(argp[0]);
+@@ -222,7 +223,7 @@
+ perror("Read UCODE header");
+ exit(1);
+ }
+- ucode = (unsigned int *)malloc(ucheader.ucode_words << 2);
++ ucode = (unsigned int *)(uintptr_t)malloc(ucheader.ucode_words << 2);
+ if(ucode == NULL) {
+ fprintf(stderr, "Cannot malloc %d bytes for UCODE.\n",
+ ucheader.ucode_words << 2);
+@@ -254,14 +255,26 @@
+ exit(1);
+ }
+
+- /* Say what UCODE version we are loading. */
++ fem = (*((volatile unsigned int *)AFB_UREG_FEM(uregs))) & 0x7f;
++ if (fem == 0x07 || fem == 0x3f) {
++ fprintf(stderr, "%s: Elite3D/M%s microcode already loaded.\n",
++ afb_fname, fem == 0x07 ? "3" : "6");
++ exit(1);
++ }
++ if (fem != 0x01) {
++ fprintf(stderr, "%s: Not an AFB board.\n", afb_fname);
++ exit(1);
++ }
++
++ printf("%s: Loading microcode...\n", afb_fname);
++ afb_ucode_upload((char *)ucode, ucheader.ucode_words / 16, uregs,
++ kregs);
+ ucode_version = *(ucode + (0x404 / sizeof(unsigned int)));
+- printf("Revision-%d.%d.%d ",
++ printf("%s: Elite3D/M%s microcode revision %d.%d.%d loaded.\n",
++ afb_fname, fem == 0x07 ? "3" : "6",
+ (ucode_version >> 16) & 0xff,
+ (ucode_version >> 8) & 0xff,
+ (ucode_version >> 0) & 0xff);
+-
+- afb_ucode_upload((char *)ucode, ucheader.ucode_words / 16, uregs, kregs);
+
+ munmap(kregs, 0x2000);
+ munmap(uregs, 0x2000);
diff --git a/sysutils/afbinit/files/patch-debian::afbinit.init b/sysutils/afbinit/files/patch-debian::afbinit.init
new file mode 100644
index 000000000000..7001bf00d7e1
--- /dev/null
+++ b/sysutils/afbinit/files/patch-debian::afbinit.init
@@ -0,0 +1,44 @@
+--- debian/afbinit.init.orig Mon Sep 15 17:41:40 2003
++++ debian/afbinit.init Mon Sep 15 18:08:15 2003
+@@ -1,35 +1,28 @@
+ #!/bin/sh
+
+-PATH=/sbin:/bin:/usr/sbin:/usr/bin
+-set -e
+-
+ # This only applies to UltraSPARC's
+-[ `uname -m` = "sparc64" ] || exit 0
++[ `/usr/bin/uname -m` = "sparc64" ] || exit 0
+
+ # The microcode loader binary and the microcode itself must exist.
+ if [ ! -x /usr/sbin/afbinit -o ! -f /usr/lib/afb.ucode ]; then
+ exit
+ fi
+
+-# Need a better way to test this
+-[ `dmesg | grep -c "Elite 3D"` -ne 0 ] || exit
+-
+ case "$1" in
+ start)
+ # Make FB device list.
+- afb_devs=`/bin/dmesg | /bin/egrep -i "Elite 3D" | /bin/sed 's/\:.*//'`
++ afb_devs=`/bin/ls /dev/fb[0-7]`
+
+ # Load microcode onto each card.
+ for AFB in ${afb_devs}; do
+- echo -n "${AFB}: Loading Elite3D microcode... "
+- /usr/sbin/afbinit /dev/${AFB} /usr/lib/afb.ucode
+- echo "done."
++ /usr/sbin/afbinit ${AFB} /usr/lib/afb.ucode > /dev/null
+ done
++ echo -n ' afbinit'
+ ;;
+- stop|restart|force-reload) # Nothing
++ stop|restart) # Nothing
+ ;;
+ *)
+- echo "Usage: $0 start" >&2
++ echo "Usage: `basename $0` start" >&2
+ exit 1
+ ;;
+ esac
diff --git a/sysutils/afbinit/pkg-descr b/sysutils/afbinit/pkg-descr
new file mode 100644
index 000000000000..008f5dd92d1e
--- /dev/null
+++ b/sysutils/afbinit/pkg-descr
@@ -0,0 +1,6 @@
+This port provides a program that loads the microcode firmware onto Sun
+Microsystems AFB Graphics Accelerators aka Sun Microsystems Elite 3D
+found in many UltraSPARC systems. The microcode is necessary if you want
+to run XFree86 with acceleration on these cards.
+The microcode in itself has to be obtained from an existing SunOS/Solaris
+installation.
diff --git a/sysutils/afbinit/pkg-message b/sysutils/afbinit/pkg-message
new file mode 100644
index 000000000000..d5656197e4c0
--- /dev/null
+++ b/sysutils/afbinit/pkg-message
@@ -0,0 +1,6 @@
+===========================================================================
+
+In order to use afbinit(8) you have to manually copy /usr/lib/afb.ucode
+from a SunOS/Solaris installation over to %%DATADIR%%.
+
+===========================================================================
diff --git a/sysutils/afbinit/pkg-plist b/sysutils/afbinit/pkg-plist
new file mode 100644
index 000000000000..60cb39356474
--- /dev/null
+++ b/sysutils/afbinit/pkg-plist
@@ -0,0 +1,4 @@
+etc/rc.d/afbinit.sh
+sbin/afbinit
+@exec install -d %D/%%DATADIR%%
+@unexec rmdir %D/%%DATADIR%% 2> /dev/null || echo "If permanently deleting this package, %D/%%DATADIR%% and its contents must be removed manually."