diff options
Diffstat (limited to 'devel/picprg/patches/patch-ac')
-rw-r--r-- | devel/picprg/patches/patch-ac | 123 |
1 files changed, 0 insertions, 123 deletions
diff --git a/devel/picprg/patches/patch-ac b/devel/picprg/patches/patch-ac deleted file mode 100644 index a6a53b59ae6..00000000000 --- a/devel/picprg/patches/patch-ac +++ /dev/null @@ -1,123 +0,0 @@ -$NetBSD: patch-ac,v 1.1.1.1 2005/09/24 09:30:54 dsainty Exp $ - -The programmer makes direct I/O bus accesses via the i386 in/out instructions. -Port this to work via the NetBSD i386_set_ioperm() interface. - ---- lowlvl.c 2002-05-29 00:54:00.000000000 +1200 -+++ lowlvl.c 2005-09-12 23:41:56.000000000 +1200 -@@ -42,15 +42,17 @@ - - ------------------------------------------------------------------------ */ - #include "picprg.h" --#include <fcntl.h> --#include <linux/lp.h> -+ - #include <sys/ioctl.h> - #include <sys/time.h> --#include <asm/system.h> -+#include <sys/types.h> -+ -+#include <machine/sysarch.h> -+ -+#include <fcntl.h> -+#include <string.h> - --/* Aisha changed because address will be stored, 3-21-00 */ --uint portaddr; --#define LP_B(x) (portaddr) -+#define LP_B(x) (x) - - extern int debug; /* Deug level */ - extern dev_id_p pic_device; /* PIC device info */ -@@ -122,15 +124,12 @@ - }; - - --extern int ioperm(unsigned long port,unsigned long length,int state); -- - /* ----------------------------------------------------------------------- - Port control routines -- easier than asm/io.h's routines - ----------------------------------------------------------------------- */ - static inline void - outb ( char val, short port) - { -- ioperm(port, 1, 1); - __asm__ volatile ("out%B0 %0,%1" : :"a" (val), "d" (port)); - } - -@@ -138,8 +137,7 @@ - inb (short port) - { - unsigned int ret; -- -- ioperm(port, 1, 1); -+ - __asm__ volatile ("in%B0 %1,%0" : "=a" (ret) : "d" (port)); - - return ret; -@@ -366,53 +364,23 @@ - ----------------------------------------------------------------------- */ - int init_port() - { -- char printer[128]; -- FILE *parport; -- int fd,linux24=0; -- -- sprintf(printer,"/dev/lp%d", pconfig.port ); -+ if (debug) -+ printf( "I/O base address is 0x%x\n", LP_B( pconfig.port ) ); - -- fd=open(printer,O_WRONLY); -- -- /* Aisha changed, 3/21/00 -- ... and BAJ rechanged 5/16/02 to get port address from /proc/parport... */ -- if ( fd<0 ) -- { -- perror(NULL); -- return 0; -- } -- -- /* BAJ Add. If the printer port is cool then set portaddr to the base value -- listed in /proc/parport/<port>/hardware */ -+ { -+ unsigned long iomap[32]; -+ unsigned int portoffset; - -- close(fd); -- sprintf(printer,"/proc/parport/%d/hardware",pconfig.port); -- parport=fopen(printer,"r"); -- if (!parport) { -- // BAJ Add 5/28/02. Check for Linux 2.4 kernel parport parameters -- -- sprintf(printer,"/proc/sys/dev/parport/parport%d/base-addr",pconfig.port); -- parport=fopen(printer,"r"); -- if (!parport) { -- fprintf(stderr,"Cannot open parport info file %s.\n\n",printer); -- return 0; -- } -- else -- linux24=1; -+ memset(iomap, '\0xff', sizeof(iomap)); -+ for (portoffset = 0; portoffset < 3; portoffset++) { -+ unsigned int portnumber = LP_B(pconfig.port) + portoffset; -+ iomap[portnumber / 32] &= ~(unsigned long)(1 << (portnumber % 32)); - } -- -- if ((fscanf(parport,linux24?"%d":"base: %x",&portaddr)) != 1) { -- fprintf(stderr,"Cannot read base address from parport info file %s.\n\n",printer); -+ -+ if (i386_set_ioperm(iomap) == -1) { -+ perror("i386_set_ioperm failed"); - return 0; - } -- if ( debug ) -- printf( "I/O base address for %s is 0x%x\n", printer, LP_B( pconfig.port ) ); -- -- /* Get permission to access the config register */ -- if ( ioperm( LP_B( pconfig.port )+1, 1L, 1) <0 ) -- { -- printf("access to port 0x%x denied\n", LP_B( pconfig.port )+1 ); -- return 0; - } - - /* Get the initial states of data and command lines */ |