aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2005-12-10 03:55:03 +0800
committerume <ume@FreeBSD.org>2005-12-10 03:55:03 +0800
commitdabf557fe4fc629549f49f68af1f171b51f3c752 (patch)
treefe59b0c4369e04d7ec9ae1e34a116c429db5f845 /sysutils
parent69405908f4b765cfc1058814d67e0fe14c5ef6bc (diff)
downloadfreebsd-ports-gnome-dabf557fe4fc629549f49f68af1f171b51f3c752.tar.gz
freebsd-ports-gnome-dabf557fe4fc629549f49f68af1f171b51f3c752.tar.zst
freebsd-ports-gnome-dabf557fe4fc629549f49f68af1f171b51f3c752.zip
New port -- ATI Radeon video card contoroling tool useful for laptops.
Submitted by: takawata
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/Makefile1
-rw-r--r--sysutils/radeontool/Makefile17
-rw-r--r--sysutils/radeontool/distinfo2
-rw-r--r--sysutils/radeontool/files/patch-Makefile14
-rw-r--r--sysutils/radeontool/files/patch-radeontool.c139
-rw-r--r--sysutils/radeontool/pkg-descr1
-rw-r--r--sysutils/radeontool/pkg-plist1
7 files changed, 175 insertions, 0 deletions
diff --git a/sysutils/Makefile b/sysutils/Makefile
index cf5e0dbea66b..78f93f0deb01 100644
--- a/sysutils/Makefile
+++ b/sysutils/Makefile
@@ -437,6 +437,7 @@
SUBDIR += pyfind
SUBDIR += qlogtools
SUBDIR += qtpkg
+ SUBDIR += radeontool
SUBDIR += radmind
SUBDIR += raincoat
SUBDIR += rc_subr
diff --git a/sysutils/radeontool/Makefile b/sysutils/radeontool/Makefile
new file mode 100644
index 000000000000..b70d227abff7
--- /dev/null
+++ b/sysutils/radeontool/Makefile
@@ -0,0 +1,17 @@
+# New ports collection makefile for: monitord
+# Date created: 10 Dec 2005
+# Whom: takawata@jp.FreeBSD.org
+#
+# $FreeBSD$
+#
+
+PORTNAME= radeontool
+PORTVERSION= 1.5
+CATEGORIES= sysutils
+MASTER_SITES= http://fdd.com/software/radeon/
+
+MAINTAINER= takawata@jp.freebsd.org
+COMMENT= ATI Radeon video card contoroling tool useful for laptops
+
+
+.include <bsd.port.mk>
diff --git a/sysutils/radeontool/distinfo b/sysutils/radeontool/distinfo
new file mode 100644
index 000000000000..2f2bf8e935fd
--- /dev/null
+++ b/sysutils/radeontool/distinfo
@@ -0,0 +1,2 @@
+MD5 (radeontool-1.5.tar.gz) = 8065eebe5a2b163e43b40461bfe49a56
+SIZE (radeontool-1.5.tar.gz) = 20869
diff --git a/sysutils/radeontool/files/patch-Makefile b/sysutils/radeontool/files/patch-Makefile
new file mode 100644
index 000000000000..3dc9adc11da0
--- /dev/null
+++ b/sysutils/radeontool/files/patch-Makefile
@@ -0,0 +1,14 @@
+--- Makefile.orig Sun Jun 23 14:28:15 2002
++++ Makefile Fri Aug 19 00:34:31 2005
+@@ -1,8 +1,9 @@
+-
++all:radeontool
+
+ radeontool: radeontool.c
+ gcc -Wall -O2 radeontool.c -o radeontool
+-
++install:
++ install -C -s radeontool ${PREFIX}/bin/
+
+
+
diff --git a/sysutils/radeontool/files/patch-radeontool.c b/sysutils/radeontool/files/patch-radeontool.c
new file mode 100644
index 000000000000..3c63e0879296
--- /dev/null
+++ b/sysutils/radeontool/files/patch-radeontool.c
@@ -0,0 +1,139 @@
+--- ../radeontool-1.5/radeontool.c Wed Feb 11 12:50:27 2004
++++ radeontool.c Thu Aug 18 23:53:15 2005
+@@ -21,7 +21,13 @@
+ #include <sys/stat.h>
+ #include <fcntl.h>
+ #include <sys/mman.h>
++#include <getopt.h>
++#ifdef __LINUX__
+ #include <asm/page.h>
++#elif __FreeBSD__
++#include <machine/param.h>
++#include <sys/pciio.h>
++#endif
+
+ #include "radeon_reg.h"
+
+@@ -233,6 +239,7 @@
+ }
+
+
++#ifdef __LINUX__
+ /* Here we fork() and exec() the lspci command to look for the Radeon hardware address. */
+ static void map_radeon_cntl_mem(void)
+ {
+@@ -318,13 +325,76 @@
+ printf("Radeon found. Base control address is %x.\n",base);
+ radeon_cntl_mem = map_devince_memory(base,0x2000);
+ }
++#endif
+
+-int main(int argc,char *argv[])
++#ifdef __FreeBSD__
++#define MAX_RADEON_CARDS 10
++static void map_radeon_cntl_mem(void)
+ {
+- if(argc == 1) {
+- map_radeon_cntl_mem();
+- usage();
++ int fd ;
++ struct pci_conf_io pci;
++ struct pci_match_conf pmc;
++ struct pci_conf pc[MAX_RADEON_CARDS];
++ struct pci_io pi;
++
++ pmc.pc_vendor = 0x1002;/*ATI*/
++ pmc.pc_class = 0x3; /*Display*/
++ pci.offset =0;
++ pmc.flags = PCI_GETCONF_MATCH_VENDOR|PCI_GETCONF_MATCH_CLASS;
++ pci.pat_buf_len = sizeof(pmc);
++ pci.num_patterns = 1;
++ pci.patterns =&pmc;
++ pci.match_buf_len = sizeof(pc);
++ pci.num_matches=0;
++ pci.matches = pc;
++
++ if(skip >= MAX_RADEON_CARDS ){
++ fprintf(stderr,"I cannot handle cards so much\n");
++ exit(-1);
++ }
++
++ fd = open("/dev/pci", O_RDWR);
++ if(fd == -1){
++ perror("open");
++ exit(-1);
++ }
++
++ if(ioctl(fd, PCIOCGETCONF, &pci) == -1){
++ perror("PCIOCGETCONF");
++ exit(-1);
++ }
++
++ if(pci.num_matches == 0){
++ fprintf(stderr, "Cannot found devices\n");
++ exit(-1);
++ }
++
++ if(pci.num_matches < skip ){
++ fprintf(stderr, "There are not so much ATI cards\n");
++ exit(-1);
++ }
++
++ pi.pi_sel = pc[skip].pc_sel;
++ pi.pi_reg = 0x18;
++ pi.pi_width = 4;
++ if(ioctl(fd, PCIOCREAD, &pi) == -1){
++ perror("PCIOCREAD");
++ exit(-1);
+ }
++
++ if(pi.pi_data &1){
++ fprintf(stderr, "Not memory mapped\n");
++ exit(-1);
++ }
++
++ radeon_cntl_mem = map_devince_memory(pi.pi_data&0xfffffff0,0x2000);
++}
++
++#endif
++
++int main(int argc,char *argv[])
++{
++#if 0
+ if(strcmp(argv[1],"--debug") == 0) {
+ debug=1;
+ argv++; argc--;
+@@ -333,6 +403,33 @@
+ skip=atoi(argv[1]+7);
+ argv++; argc--;
+ };
++#else
++ int ch;
++ static struct option longopts [] = {
++ {"debug", no_argument, NULL, 'd'},
++ {"skip", required_argument, NULL, 's'},
++ {NULL, 0, NULL, 0}
++ };
++ while((ch = getopt_long(argc, argv, "ds:", longopts, NULL)) != -1){
++ switch(ch){
++ case 'd':
++ debug = 1;
++ break;
++ case 's':
++ skip=atoi(optarg);
++ break;
++ default:
++ usage();
++ }
++ }
++ optind --;
++ argc -= optind;
++ argv += optind;
++#endif
++ if(argc == 1) {
++ map_radeon_cntl_mem();
++ usage();
++ }
+ map_radeon_cntl_mem();
+ if(argc == 2) {
+ if(strcmp(argv[1],"regs") == 0) {
diff --git a/sysutils/radeontool/pkg-descr b/sysutils/radeontool/pkg-descr
new file mode 100644
index 000000000000..d3d5f54f767e
--- /dev/null
+++ b/sysutils/radeontool/pkg-descr
@@ -0,0 +1 @@
+ATI Radeon video card contoroling tool useful for laptops.
diff --git a/sysutils/radeontool/pkg-plist b/sysutils/radeontool/pkg-plist
new file mode 100644
index 000000000000..57f8a9fe81ce
--- /dev/null
+++ b/sysutils/radeontool/pkg-plist
@@ -0,0 +1 @@
+bin/radeontool \ No newline at end of file