Add a port of `sysutils/rovclock', an overclocking utility for ATI Radeon

video cards.  Manual page and port description were obtained from identic
Debian package.

WWW: http://www.hasw.net/linux/
This commit is contained in:
Alexey Dokuchaev 2017-03-28 17:23:28 +00:00
parent ec2d902401
commit 3cf6bb2668
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=437142
6 changed files with 231 additions and 0 deletions

View file

@ -944,6 +944,7 @@
SUBDIR += rinse
SUBDIR += rmonitor
SUBDIR += roottail
SUBDIR += rovclock
SUBDIR += rsnapshot
SUBDIR += rsyncbackup
SUBDIR += rsyncrypto

View file

@ -0,0 +1,33 @@
# Created by: Alexey Dokuchaev <danfe@FreeBSD.org>
# $FreeBSD$
PORTNAME= rovclock
PORTVERSION= 0.6e
CATEGORIES= sysutils
MASTER_SITES= http://www.hasw.net/linux/
MAINTAINER= danfe@FreeBSD.org
COMMENT= Overclocking utility for ATI Radeon video cards
LICENSE= GPLv2
USES= tar:bzip2
PLIST_FILES= man/man8/${PORTNAME}.8.gz sbin/${PORTNAME}
PORTDOCS= ChangeLog README
OPTIONS_DEFINE= DOCS
do-build:
cd ${WRKSRC} && ${CC} ${CFLAGS} -Wall -o ${PORTNAME} ${PORTNAME}.c
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/sbin
${INSTALL_MAN} ${FILESDIR}/${PORTNAME}.8 \
${STAGEDIR}${MANPREFIX}/man/man8
post-install-DOCS-on:
@${MKDIR} ${STAGEDIR}${DOCSDIR}
${INSTALL_DATA} ${PORTDOCS:S|^|${WRKSRC}/|} ${STAGEDIR}${DOCSDIR}
.include <bsd.port.mk>

View file

@ -0,0 +1,3 @@
TIMESTAMP = 1433765826
SHA256 (rovclock-0.6e.tar.bz2) = f2601b3a823752d51cf27b25c8b57efb66e1295848877c962f0c680430e200f7
SIZE (rovclock-0.6e.tar.bz2) = 29648

View file

@ -0,0 +1,122 @@
--- rovclock.c.orig 2006-01-04 21:23:32 UTC
+++ rovclock.c
@@ -20,11 +20,13 @@
*/
/*****************************************************************************/
+#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <getopt.h>
-#include <sys/io.h>
+#include <sys/types.h>
+#include <machine/cpufunc.h>
#include <sys/mman.h>
#include "pci.h"
@@ -122,18 +124,18 @@ struct rovclock_data {
/* PCI read/write functions */
unsigned int pci_read(u8 bus, u8 device, u8 func, u8 addr)
{
- outl(0x80000000 | (bus << 16) |
+ outl(0xcf8, 0x80000000 | (bus << 16) |
(PCI_DEVFN(device, func) << 8) |
- (addr & ~3), 0xcf8);
+ (addr & ~3));
return inl(0xcfc);
}
void pci_write(u8 bus, u8 device, u8 func, u8 addr, u32 data)
{
- outl(0x80000000 | (bus << 16) |
+ outl(0xcf8, 0x80000000 | (bus << 16) |
(PCI_DEVFN(device, func) << 8) |
- (addr & ~3), 0xcf8);
- outl(data, 0xcfc);
+ (addr & ~3));
+ outl(0xcfc, data);
}
/* Register read/write functions */
@@ -144,38 +146,38 @@ u32 reg_read(struct rovclock_data *rovcl
void reg_write(struct rovclock_data *rovclock, u32 addr, u32 data)
{
- outl(data, rovclock->iobase + addr);
+ outl(rovclock->iobase + addr, data);
}
/* PLL read/write functions */
u32 pll_read(struct rovclock_data *rovclock, u32 addr)
{
- outb(addr & 0x0000003f, rovclock->iobase + CLOCK_CNTL_INDEX);
+ outb(rovclock->iobase + CLOCK_CNTL_INDEX, addr & 0x0000003f);
return inl(rovclock->iobase + CLOCK_CNTL_DATA);
}
void pll_write(struct rovclock_data *rovclock, u32 addr, u32 data)
{
- outb((addr & 0x3f) | PLL_WR_EN, rovclock->iobase + CLOCK_CNTL_INDEX);
- outl(data, rovclock->iobase + CLOCK_CNTL_DATA);
+ outb(rovclock->iobase + CLOCK_CNTL_INDEX, (addr & 0x3f) | PLL_WR_EN);
+ outl(rovclock->iobase + CLOCK_CNTL_DATA, data);
}
/* MM read/write functions */
u32 mm_read(struct rovclock_data *rovclock, u32 addr)
{
- outl(addr, rovclock->iobase + MM_INDEX);
+ outl(rovclock->iobase + MM_INDEX, addr);
return inl(rovclock->iobase + MM_DATA);
}
void mm_write(struct rovclock_data *rovclock, u32 addr, u32 data)
{
- outl(addr, rovclock->iobase + MM_INDEX);
- outl(data, rovclock->iobase + MM_DATA);
+ outl(rovclock->iobase + MM_INDEX, addr);
+ outl(rovclock->iobase + MM_DATA, data);
}
int round_div(int num, int den)
{
- return (num + (den / 2)) / den;
+ return den ? (num + (den / 2)) / den : 0;
}
/* Print usage */
@@ -281,10 +283,11 @@ void pll_set_freq(struct rovclock_data *
/* Search for ATI card on PCI bus */
int find_card(struct rovclock_data *rovclock)
{
+ u32 id;
+#if 0
FILE *proc;
char temp;
- u32 id;
-
+
/* Check /proc/bus/pci/devices first */
if ((proc = fopen("/proc/bus/pci/devices", "r")) != NULL) {
while (fscanf(proc, "%x\t%x", &rovclock->pci_bus, &id) == 2) {
@@ -305,8 +308,9 @@ int find_card(struct rovclock_data *rovc
break;
}
}
+#endif
if ((rovclock->pci_id & 0xffff) != PCI_VENDOR_ID_ATI) {
- fprintf(stderr, "Search in /proc/bus/pci/devices failed, scanning the PCI bus.\n");
+ fprintf(stderr, "Scanning the PCI bus.\n");
/* Find card by scanning the PCI devices, check from bus 1 to 9 for ATI device */
rovclock->pci_dev = 0;
@@ -423,7 +427,7 @@ int main(int argc, char **argv)
}
/* Get I/O permission */
- if (iopl(3) != 0) {
+ if (open("/dev/io", O_RDONLY) < 0) {
fprintf(stderr, "Error getting I/O permissions (root?).\n");
return 1;
}

View file

@ -0,0 +1,66 @@
.\" Hey, EMACS: -*- nroff -*-
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH ROVCLOCK 8 "2006-03-05"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
.\" .nh disable hyphenation
.\" .hy enable hyphenation
.\" .ad l left justify
.\" .ad b justify to both left and right margins
.\" .nf disable filling
.\" .fi enable filling
.\" .br insert line break
.\" .sp <n> insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
.SH NAME
rovclock \- utility to control frequency rates of your Radeon card
.SH SYNOPSIS
.B rovclock
.RI [ options ]
.\".RI [ -x <KHz> ] -i | -c <MHz> | -m <MHz> | -t <name:val>
.SH DESCRIPTION
This manual page documents briefly the
.B rovclock
command.
.PP
This manual page was written for the
.B Debian
distribution because the original program does not have a manual page.
.PP
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
.\" respectively.
\fBrovclock\fP is a program that allow you to control frequency rates of your Radeon card.
.SH OPTIONS
A summary of options is included below.
.TP
.B \-i
Show info of your Radeon card.
.TP
.B \-x N
Manually define xtal frequency to N KHz.
.br
It tries to detect the reference clock (xtal) from the video BIOS, if this doesn't work you can specify it manually with -t. Try 1432 or 2950 if the default value of 2700 does not work.
.TP
.B \-c N
Set core clock to N MHz.
.TP
.B \-m N
Set memory clock to N MHz.
.TP
.B \-t name:val
Set memory timings.
.SH SEE ALSO
.BR /usr/share/doc/rovclock/README,
.BR radeontool (1).
.br
This is quick and stupid manpage which merges some information from README and rovclock itself.
.SH AUTHOR
rovclock was written by Hasw (hasw@hasw.net).
.PP
This manual page was written by Alexander Gerasiov <gq@cs.msu.su>,
for the Debian project (but may be used by others).

View file

@ -0,0 +1,6 @@
Utility to control frequency rates of one's ATI Radeon video card. It is
very helpful for underclocking the Radeon chip in order to save power when
running on batteries. Also, by underclocking it is possible to prevent the
fan from running. It can also be used to gain performance by overclocking.
WWW: http://www.hasw.net/linux/