[MPlayer-dev-eng] [PATCH] svgalib_helper in libdha

Matan Ziv-Av matan at svgalib.org
Sat Dec 21 14:57:26 CET 2002


This patch (against today's CVS): 
- adds svgalib_helper.h to the source, so there is no need to look for
  it.
- fixes compilation on PPC.
- adds infrastructure for OS pci code to override processor pci code. 
- using this, now can work if svga helper support compiled in, but 
  kernel module not loaded.

I think it is reasonable to replace dhahelper with svgahelper, since
svgahelper has all the functionality of dhahelper, and more (devfs
support, per card device nodes, pci config access).
Would you accept a patch that does this?

-- 
Matan Ziv-Av.                         matan at svgalib.org

-------------- next part --------------
diff -x CVS -NurbB orig/main/libdha/Makefile MPlayer-20021206/libdha/Makefile
--- orig/main/libdha/Makefile	Fri Dec 20 23:07:11 2002
+++ MPlayer-20021206/libdha/Makefile	Sat Dec 21 14:11:37 2002
@@ -28,10 +28,9 @@
 endif
 endif
 
-# If you want libdha to use svgalib_helper for hardware access,
-# uncomment this statement, and change the -I to the correct directory
-# that includes svgalib_helper.o:
-#CFLAGS += -DDEV_SVGA=\"/dev/svga\" -DCONFIG_SVGAHELPER -Isvgalib_helper/
+# If you want libdha to use svgalib_helper module for hardware access,
+# uncomment this statement.
+CFLAGS += -DDEV_SVGA=\"/dev/svga\" -DCONFIG_SVGAHELPER
 
 .SUFFIXES: .c .o
 
diff -x CVS -NurbB orig/main/libdha/config.h MPlayer-20021206/libdha/config.h
--- orig/main/libdha/config.h	Fri Dec 20 23:07:11 2002
+++ MPlayer-20021206/libdha/config.h	Sat Dec 21 13:45:50 2002
@@ -9,8 +9,4 @@
 #endif
 #endif
 
-#if defined(__powerpc__) && defined(CONFIG_SVGAHELPER)
-#undef CONFIG_SVGAHELPER
-#endif
-
 #endif /* LIBDHA_CONFIG_H */
diff -x CVS -NurbB orig/main/libdha/pci.c MPlayer-20021206/libdha/pci.c
--- orig/main/libdha/pci.c	Fri Dec 20 23:07:11 2002
+++ MPlayer-20021206/libdha/pci.c	Sat Dec 21 13:52:11 2002
@@ -478,7 +478,6 @@
 #endif
 
 /* cpu depended stuff */
-#ifndef CONFIG_SVGAHELPER
 #if defined(__alpha__)
 #include "sysdep/pci_alpha.c"
 #elif defined(__ia64__)
@@ -491,7 +490,6 @@
 #include "sysdep/pci_powerpc.c"
 #else
 #include "sysdep/pci_x86.c"
-#endif
 #endif
  
 static int pcicards=0 ;
diff -x CVS -NurbB orig/main/libdha/svgalib_helper.h MPlayer-20021206/libdha/svgalib_helper.h
--- orig/main/libdha/svgalib_helper.h	Thu Jan  1 02:00:00 1970
+++ MPlayer-20021206/libdha/svgalib_helper.h	Sat Dec 21 11:48:28 2002
@@ -0,0 +1,84 @@
+#ifndef SVGALIB_HELPER_H
+#define SVGALIB_HELPER_H
+
+#ifdef __KERNEL__
+
+#define MAX_NR_DEVICES 15
+
+#define address_t unsigned long
+
+struct sh_pci_device {
+   unsigned short vendor;
+   unsigned short id;
+   unsigned char revision;
+   struct pci_dev *dev;
+   address_t mem[6];
+   address_t len[6];
+   address_t mask[6];
+   int flags[6];
+   unsigned long iobase;
+   int (*test_vsync)(struct sh_pci_device *);
+   void (*ack_vsync)(struct sh_pci_device *);
+   void (*enable_vsync)(struct sh_pci_device *);
+};
+
+#endif
+
+typedef struct {
+  int port;
+  int length;
+  unsigned char* string;
+} io_string_t;
+
+typedef struct {
+   int port;
+   unsigned int val;
+} io_t;
+
+typedef struct {
+   int pcipos;
+   unsigned int address;
+   unsigned long val;
+} pcic_t;
+
+typedef struct {
+   void *win;
+   void *lfb;
+} windowing_t;
+
+#define SVGALIB_HELPER_IOC_MAGIC 0xB3
+
+#define SVGALIB_HELPER_IOCSOUTB		_IOR(SVGALIB_HELPER_IOC_MAGIC,1,io_t)
+#define SVGALIB_HELPER_IOCSOUTW		_IOR(SVGALIB_HELPER_IOC_MAGIC,2,io_t)
+#define SVGALIB_HELPER_IOCSOUTL		_IOR(SVGALIB_HELPER_IOC_MAGIC,3,io_t)
+#define SVGALIB_HELPER_IOCGINB		_IOW(SVGALIB_HELPER_IOC_MAGIC,4,io_t)
+#define SVGALIB_HELPER_IOCGINW		_IOW(SVGALIB_HELPER_IOC_MAGIC,5,io_t)
+#define SVGALIB_HELPER_IOCGINL		_IOW(SVGALIB_HELPER_IOC_MAGIC,6,io_t)
+
+#define SVGALIB_HELPER_IOCSPCIOUTB	_IOR(SVGALIB_HELPER_IOC_MAGIC,11,pcic_t)
+#define SVGALIB_HELPER_IOCSPCIOUTW	_IOR(SVGALIB_HELPER_IOC_MAGIC,12,pcic_t)
+#define SVGALIB_HELPER_IOCSPCIOUTL	_IOR(SVGALIB_HELPER_IOC_MAGIC,13,pcic_t)
+#define SVGALIB_HELPER_IOCGPCIINB	_IOW(SVGALIB_HELPER_IOC_MAGIC,14,pcic_t)
+#define SVGALIB_HELPER_IOCGPCIINW	_IOW(SVGALIB_HELPER_IOC_MAGIC,15,pcic_t)
+#define SVGALIB_HELPER_IOCGPCIINL	_IOW(SVGALIB_HELPER_IOC_MAGIC,16,pcic_t)
+#define SVGALIB_HELPER_IOCGPCIAPLEN	_IOW(SVGALIB_HELPER_IOC_MAGIC,17,pcic_t)
+
+#define SVGALIB_HELPER_IOCDVMA		_IO(SVGALIB_HELPER_IOC_MAGIC,7)
+#define SVGALIB_HELPER_IOCSWIND		_IOR(SVGALIB_HELPER_IOC_MAGIC,8,windowing_t)
+
+#define SVGALIB_HELPER_IOCIOPERM	_IO(SVGALIB_HELPER_IOC_MAGIC,9)
+#define SVGALIB_HELPER_IOCSREPOUTB	_IOR(SVGALIB_HELPER_IOC_MAGIC,10,io_t)
+
+#define SVGALIB_HELPER_IOCGI810GTT	_IOW(SVGALIB_HELPER_IOC_MAGIC,128,unsigned int *)
+#define SVGALIB_HELPER_IOCGI810GTTE	_IOW(SVGALIB_HELPER_IOC_MAGIC,129,unsigned int *)
+
+#define SVGALIB_HELPER_IOCSWRITEB	_IOR(SVGALIB_HELPER_IOC_MAGIC,21,io_t)
+#define SVGALIB_HELPER_IOCSWRITEW	_IOR(SVGALIB_HELPER_IOC_MAGIC,22,io_t)
+#define SVGALIB_HELPER_IOCSWRITEL	_IOR(SVGALIB_HELPER_IOC_MAGIC,23,io_t)
+#define SVGALIB_HELPER_IOCGREADB	_IOW(SVGALIB_HELPER_IOC_MAGIC,24,io_t)
+#define SVGALIB_HELPER_IOCGREADW	_IOW(SVGALIB_HELPER_IOC_MAGIC,25,io_t)
+#define SVGALIB_HELPER_IOCGREADL	_IOW(SVGALIB_HELPER_IOC_MAGIC,26,io_t)
+
+#define SVGALIB_HELPER_IOCWAITRETRACE	_IO(SVGALIB_HELPER_IOC_MAGIC,31)
+
+#endif /* SVGALIB_HELPER_H */
diff -x CVS -NurbB orig/main/libdha/sysdep/pci_386bsd.c MPlayer-20021206/libdha/sysdep/pci_386bsd.c
--- orig/main/libdha/sysdep/pci_386bsd.c	Tue Jan 15 17:59:53 2002
+++ MPlayer-20021206/libdha/sysdep/pci_386bsd.c	Sat Dec 21 11:05:23 2002
@@ -6,6 +6,7 @@
 #include <errno.h>
 #include <sys/file.h>
 #include <machine/console.h>
+#include "pci_generic.h"
 #ifndef GCCUSESGAS
 #define GCCUSESGAS
 #endif
diff -x CVS -NurbB orig/main/libdha/sysdep/pci_alpha.c MPlayer-20021206/libdha/sysdep/pci_alpha.c
--- orig/main/libdha/sysdep/pci_alpha.c	Fri Apr 19 19:34:04 2002
+++ MPlayer-20021206/libdha/sysdep/pci_alpha.c	Sat Dec 21 10:58:35 2002
@@ -4,9 +4,9 @@
    Modified for readability by Nick Kurshev
 */
 
-static int pci_config_type( void ) { return 1; }
+static int processor_pci_config_type( void ) { return 1; }
 
-static int pci_get_vendor(
+static int processor_pci_get_vendor(
           unsigned char bus,
           unsigned char dev,
           int func)
@@ -16,7 +16,7 @@
     return retval;
 }
 
-static long pci_config_read_long(
+static long processor_pci_config_read_long(
           unsigned char bus,
           unsigned char dev,
           int func, 
diff -x CVS -NurbB orig/main/libdha/sysdep/pci_arm32.c MPlayer-20021206/libdha/sysdep/pci_arm32.c
--- orig/main/libdha/sysdep/pci_arm32.c	Tue Jan 15 10:31:53 2002
+++ MPlayer-20021206/libdha/sysdep/pci_arm32.c	Sat Dec 21 10:59:14 2002
@@ -4,7 +4,7 @@
    Modified for readability by Nick Kurshev
 */
 
-static int pci_config_type( void )
+static int processor_pci_config_type( void )
 {
   unsigned long tmplong1, tmplong2;
   unsigned char tmp1, tmp2;
@@ -36,7 +36,7 @@
   return retval;
 }
 
-static int pci_get_vendor(
+static int processor_pci_get_vendor(
           unsigned char bus,
           unsigned char dev,
           int func)
@@ -47,7 +47,7 @@
     return inl(PCI_MODE1_DATA_REG);
 }
 
-static long pci_config_read_long(
+static long processor_pci_config_read_long(
           unsigned char bus,
           unsigned char dev,
           int func, 
diff -x CVS -NurbB orig/main/libdha/sysdep/pci_bsdi.c MPlayer-20021206/libdha/sysdep/pci_bsdi.c
--- orig/main/libdha/sysdep/pci_bsdi.c	Tue Jan 15 17:59:53 2002
+++ MPlayer-20021206/libdha/sysdep/pci_bsdi.c	Sat Dec 21 11:06:23 2002
@@ -7,6 +7,7 @@
 #include <sys/file.h>
 #include <sys/ioctl.h>
 #include <i386/isa/pcconsioctl.h>
+#include "pci_generic.h"
 #ifndef GCCUSESGAS
 #define GCCUSESGAS
 #endif
diff -x CVS -NurbB orig/main/libdha/sysdep/pci_freebsd.c MPlayer-20021206/libdha/sysdep/pci_freebsd.c
--- orig/main/libdha/sysdep/pci_freebsd.c	Fri May  3 15:56:29 2002
+++ MPlayer-20021206/libdha/sysdep/pci_freebsd.c	Sat Dec 21 11:06:45 2002
@@ -9,6 +9,7 @@
  * however pcvt_ioctl.h seems to exist for very long time   */
 /* #include <machine/console.h>*/
 #include <machine/pcvt_ioctl.h>
+#include "pci_generic.h"
 #ifndef GCCUSESGAS
 #define GCCUSESGAS
 #endif
diff -x CVS -NurbB orig/main/libdha/sysdep/pci_generic.h MPlayer-20021206/libdha/sysdep/pci_generic.h
--- orig/main/libdha/sysdep/pci_generic.h	Thu Jan  1 02:00:00 1970
+++ MPlayer-20021206/libdha/sysdep/pci_generic.h	Sat Dec 21 11:13:54 2002
@@ -0,0 +1,25 @@
+/*
+ * Call the processor specific pci functions.
+*/
+static int processor_pci_config_type();
+static int processor_pci_get_vendor(unsigned char, unsigned char, int);
+static long processor_pci_config_read_long(unsigned char, unsigned char, int, unsigned);
+
+static int pci_config_type( void ) { return processor_pci_config_type(); }
+
+static int pci_get_vendor(
+          unsigned char bus,
+          unsigned char dev,
+          int func)
+{
+    return processor_pci_get_vendor(bus, dev, func);
+}
+
+static long pci_config_read_long(
+          unsigned char bus,
+          unsigned char dev,
+          int func, 
+          unsigned cmd)
+{
+    return processor_pci_config_read_long(bus, dev, func, cmd);
+}
diff -x CVS -NurbB orig/main/libdha/sysdep/pci_ia64.c MPlayer-20021206/libdha/sysdep/pci_ia64.c
--- orig/main/libdha/sysdep/pci_ia64.c	Tue Jan 15 10:31:53 2002
+++ MPlayer-20021206/libdha/sysdep/pci_ia64.c	Sat Dec 21 10:59:36 2002
@@ -4,7 +4,7 @@
    Modified for readability by Nick Kurshev
 */
 
-static int pci_config_type( void )
+static int processor_pci_config_type( void )
 {
   unsigned long tmplong1, tmplong2;
   unsigned char tmp1, tmp2;
@@ -36,7 +36,7 @@
   return retval;
 }
 
-static int pci_get_vendor(
+static int processor_pci_get_vendor(
           unsigned char bus,
           unsigned char dev,
           int func)
@@ -47,7 +47,7 @@
     return inl(PCI_MODE1_DATA_REG);
 }
 
-static long pci_config_read_long(
+static long processor_pci_config_read_long(
           unsigned char bus,
           unsigned char dev,
           int func, 
diff -x CVS -NurbB orig/main/libdha/sysdep/pci_isc.c MPlayer-20021206/libdha/sysdep/pci_isc.c
--- orig/main/libdha/sysdep/pci_isc.c	Tue Jan 15 17:59:53 2002
+++ MPlayer-20021206/libdha/sysdep/pci_isc.c	Sat Dec 21 11:07:06 2002
@@ -10,6 +10,7 @@
 #include <sys/tss.h>
 #include <sys/sysi86.h>
 #include <sys/v86.h>
+#include "pci_generic.h"
 
 static __inline__ int enable_os_io(void)
 {
diff -x CVS -NurbB orig/main/libdha/sysdep/pci_linux.c MPlayer-20021206/libdha/sysdep/pci_linux.c
--- orig/main/libdha/sysdep/pci_linux.c	Fri Dec 20 23:07:27 2002
+++ MPlayer-20021206/libdha/sysdep/pci_linux.c	Sat Dec 21 15:15:19 2002
@@ -6,73 +6,31 @@
 #include <errno.h>
 #ifdef __i386__
 #include <sys/perm.h>
-#else
-#if !defined(__sparc__) && !defined(__powerpc__)
+#elif !defined(__sparc__) && !defined(__powerpc__)
 #include <sys/io.h>
 #endif
-#endif
 
 #include "config.h"
 
-#ifdef CONFIG_DHAHELPER
-#include <fcntl.h>
-int dhahelper_initialized = 0;
-int dhahelper_fd = 0;
+#if (defined(__powerpc__) || defined(__sparc__) || defined(__sparc64__)) \
+    && defined(__linux__) && !defined(CONFIG_SVGAHELPER)
+#define CONFIG_PCI_LINUX_PROC
 #endif
 
 #ifdef CONFIG_SVGAHELPER
-#include <svgalib_helper.h>
-#ifdef __linux__
-#include <linux/ioctl.h>
-#endif
 #include <fcntl.h>
-int svgahelper_initialized = 0;
 int svgahelper_fd = 0;
+int svgahelper_initialized = 0;
+#endif
 
-static int pci_config_type(void)
-{
-    return 1;
-}
-
-static long pci_config_read_long(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd)
-{
-    unsigned long config_cmd;
-    pcic_t p;
-    
-    p.address = cmd;
-    p.pcipos = (bus << 8) | dev | (func << 5);
-    
-    if (ioctl(svgahelper_fd, SVGALIB_HELPER_IOCGPCIINL, &p))
-	return -1;
-
-    return p.val;
-}
-
-static int pci_get_vendor(
-          unsigned char bus,
-          unsigned char dev,
-          int func)
-{
-    return pci_config_read_long(bus, dev, func, 0);
-}
+#ifdef CONFIG_DHAHELPER
+#include <fcntl.h>
+int dhahelper_initialized = 0;
+int dhahelper_fd = 0;
 #endif
 
 static __inline__ int enable_os_io(void)
 {
-#ifdef CONFIG_SVGAHELPER
-    svgahelper_fd = open(DEV_SVGA, O_RDWR);
-    if (svgahelper_fd > 0)
-    {
-	svgahelper_initialized = 1;
-	return(0);
-    }
-    svgahelper_initialized = -1;
-#endif
-
 #ifdef CONFIG_DHAHELPER
     dhahelper_fd = open("/dev/dhahelper", O_RDWR);
     if (dhahelper_fd > 0)
@@ -82,8 +40,16 @@
     }
     dhahelper_initialized = -1;
 #endif
-
-#if defined(__powerpc__) && defined(__linux__)
+#ifdef CONFIG_SVGAHELPER
+	svgahelper_fd = open(DEV_SVGA, O_RDWR);
+	if (svgahelper_fd > 0)
+	{
+		svgahelper_initialized = 1;
+		return(0);
+	}
+	svgahelper_initialized = -1;
+#endif
+#ifdef CONFIG_PCI_LINUX_PROC
 /* should be fixed? */
 #else    
     if (iopl(3) != 0)
@@ -94,17 +60,21 @@
 
 static __inline__ int disable_os_io(void)
 {
-#ifdef CONFIG_SVGAHELPER
-    if (svgahelper_initialized == 1)
-	close(svgahelper_fd);
-    else
-#endif
 #ifdef CONFIG_DHAHELPER
-    if (dhahelper_initialized == 1)
+    if (dhahelper_initialized == 1) {
 	close(dhahelper_fd);
+		dhahelper_initialized=0;
+	}
     else
 #endif
-#if defined(__powerpc__) && defined(__linux__)
+#ifdef CONFIG_SVGAHELPER
+    if (svgahelper_initialized == 1) {
+		close(svgahelper_fd);
+		svgahelper_initialized=0;
+	}
+    else
+#endif
+#ifdef CONFIG_PCI_LINUX_PROC
 /* should be fixed? */
 #else    
     if (iopl(0) != 0)
@@ -113,10 +83,51 @@
     return(0);
 }
 
-#if (defined(__powerpc__) || defined(__sparc__) || defined(__sparc64__)) \
-    && defined(__linux__) && !defined(CONFIG_SVGAHELPER)
-#define CONFIG_PCI_LINUX_PROC
-#endif
+/* Now for the pci config access:
+ * if using svga helper, use it for pci.
+ * else if using linux and ppc or sparc, use /proc/bus/pci.
+ * otherwise, use processor specific functions.
+ */
+
+#ifdef CONFIG_SVGAHELPER
+#include <sys/ioctl.h>
+#include "svgalib_helper.h"
+static int processor_pci_config_type();
+static long processor_pci_config_read_long(unsigned char, unsigned char, int, unsigned);
+
+static int pci_config_type( void )
+{	
+	if(svgahelper_initialized<=0) return processor_pci_config_type();
+	return 1;
+}
+
+static long pci_config_read_long(
+	unsigned char bus,
+	unsigned char dev,
+	int func,
+	unsigned cmd)
+{
+	unsigned long config_cmd;
+	pcic_t p;
+
+	if(svgahelper_initialized<=0) return processor_pci_config_read_long(bus, dev, func, cmd);
+	p.address = cmd;
+	p.pcipos = (bus<<8) | dev | (func<<5);
+
+	if(ioctl( svgahelper_fd, SVGALIB_HELPER_IOCGPCIINL, &p)) return -1;
+
+	return p.val;
+}
+
+static int pci_get_vendor(
+	unsigned char bus,
+	unsigned char dev,
+	int func)
+{
+	return pci_config_read_long(bus,dev,func,0);
+}
+#else /* SVGAHELPER */
+
 
 #if defined(CONFIG_PCI_LINUX_PROC)
 static int pci_config_type( void ) { return 1; }
@@ -182,4 +193,7 @@
     }
     return retval;
 }
+#else /* if no SVGAHELPER and no PCI_LINUX_PROC, use generic processor pci functions */
+#include "pci_generic.h"
+#endif
 #endif
diff -x CVS -NurbB orig/main/libdha/sysdep/pci_lynx.c MPlayer-20021206/libdha/sysdep/pci_lynx.c
--- orig/main/libdha/sysdep/pci_lynx.c	Tue Jan 15 10:31:53 2002
+++ MPlayer-20021206/libdha/sysdep/pci_lynx.c	Sat Dec 21 11:08:33 2002
@@ -5,6 +5,7 @@
 */
 
 #if defined(Lynx_22)
+#include "pci_generic.h"
 #ifndef GCCUSESGAS
 #define GCCUSESGAS
 #endif
diff -x CVS -NurbB orig/main/libdha/sysdep/pci_mach386.c MPlayer-20021206/libdha/sysdep/pci_mach386.c
--- orig/main/libdha/sysdep/pci_mach386.c	Tue Jan 15 17:59:53 2002
+++ MPlayer-20021206/libdha/sysdep/pci_mach386.c	Sat Dec 21 11:08:58 2002
@@ -5,6 +5,7 @@
 */
 
 #include <errno.h>
+#include "pci_generic.h"
 
 static int io_fd;
 
diff -x CVS -NurbB orig/main/libdha/sysdep/pci_netbsd.c MPlayer-20021206/libdha/sysdep/pci_netbsd.c
--- orig/main/libdha/sysdep/pci_netbsd.c	Tue Jan 15 17:59:53 2002
+++ MPlayer-20021206/libdha/sysdep/pci_netbsd.c	Sat Dec 21 11:09:14 2002
@@ -7,6 +7,7 @@
 #include <sys/param.h>
 #include <sys/file.h>
 #include <machine/sysarch.h>
+#include "pci_generic.h"
 #ifndef GCCUSESGAS
 #define GCCUSESGAS
 #endif
diff -x CVS -NurbB orig/main/libdha/sysdep/pci_openbsd.c MPlayer-20021206/libdha/sysdep/pci_openbsd.c
--- orig/main/libdha/sysdep/pci_openbsd.c	Thu Jul  4 00:20:19 2002
+++ MPlayer-20021206/libdha/sysdep/pci_openbsd.c	Sat Dec 21 11:09:26 2002
@@ -9,6 +9,7 @@
 #include <errno.h>
 #include <sys/types.h>
 #include <machine/sysarch.h>
+#include "pci_generic.h"
 
 static __inline__ int enable_os_io(void)
 {
diff -x CVS -NurbB orig/main/libdha/sysdep/pci_os2.c MPlayer-20021206/libdha/sysdep/pci_os2.c
--- orig/main/libdha/sysdep/pci_os2.c	Tue Jan 15 17:59:53 2002
+++ MPlayer-20021206/libdha/sysdep/pci_os2.c	Sat Dec 21 11:09:42 2002
@@ -5,6 +5,7 @@
 */
 #define INCL_DOSFILEMGR
 #include <os2.h>
+#include "pci_generic.h"
 
 static USHORT callgate[3] = {0,0,0};
 
diff -x CVS -NurbB orig/main/libdha/sysdep/pci_powerpc.c MPlayer-20021206/libdha/sysdep/pci_powerpc.c
--- orig/main/libdha/sysdep/pci_powerpc.c	Fri Dec 20 23:07:27 2002
+++ MPlayer-20021206/libdha/sysdep/pci_powerpc.c	Sat Dec 21 15:09:52 2002
@@ -5,9 +5,9 @@
 */
 
 #if defined(Lynx) || defined(__OpenBSD__)
-static int pci_config_type( void ) { return 1; }
+static int processor_pci_config_type( void ) { return 1; }
 
-static int pci_get_vendor(
+static int processor_pci_get_vendor(
           unsigned char bus,
           unsigned char dev,
           int func)
@@ -17,7 +17,7 @@
     return retval;
 }
 
-static long pci_config_read_long(
+static long processor_pci_config_read_long(
           unsigned char bus,
           unsigned char dev,
           int func, 
@@ -26,5 +26,24 @@
     long retval;
     pciconfig_read(bus, dev<<3, cmd, 4, &retval);
     return retval;
+}
+#else
+static int processor_pci_config_type( void ) { return 1; }
+
+static int processor_pci_get_vendor(
+          unsigned char bus,
+          unsigned char dev,
+          int func)
+{
+    return -1;
+}
+
+static long processor_pci_config_read_long(
+          unsigned char bus,
+          unsigned char dev,
+          int func, 
+          unsigned cmd)
+{
+    return -1;
 }
 #endif /*Lynx/OpenBSD*/
diff -x CVS -NurbB orig/main/libdha/sysdep/pci_sco.c MPlayer-20021206/libdha/sysdep/pci_sco.c
--- orig/main/libdha/sysdep/pci_sco.c	Tue Jan 15 17:59:53 2002
+++ MPlayer-20021206/libdha/sysdep/pci_sco.c	Sat Dec 21 11:09:53 2002
@@ -11,6 +11,7 @@
 #include <sys/tss.h>
 #include <sys/sysi86.h>
 #include <sys/v86.h>
+#include "pci_generic.h"
 
 static __inline__ int enable_os_io(void)
 {
diff -x CVS -NurbB orig/main/libdha/sysdep/pci_sparc.c MPlayer-20021206/libdha/sysdep/pci_sparc.c
--- orig/main/libdha/sysdep/pci_sparc.c	Tue Jan 15 10:31:53 2002
+++ MPlayer-20021206/libdha/sysdep/pci_sparc.c	Sat Dec 21 11:01:06 2002
@@ -4,7 +4,7 @@
    Modified for readability by Nick Kurshev
 */
 
-static int pci_config_type( void )
+static int processor_pci_config_type( void )
 {
   unsigned long tmplong1, tmplong2;
   unsigned char tmp1, tmp2;
@@ -36,7 +36,7 @@
   return retval;
 }
 
-static int pci_get_vendor(
+static int processor_pci_get_vendor(
           unsigned char bus,
           unsigned char dev,
           int func)
@@ -47,7 +47,7 @@
     return inl(PCI_MODE1_DATA_REG);
 }
 
-static long pci_config_read_long(
+static long processor_pci_config_read_long(
           unsigned char bus,
           unsigned char dev,
           int func, 
diff -x CVS -NurbB orig/main/libdha/sysdep/pci_svr4.c MPlayer-20021206/libdha/sysdep/pci_svr4.c
--- orig/main/libdha/sysdep/pci_svr4.c	Tue Jan 15 20:46:31 2002
+++ MPlayer-20021206/libdha/sysdep/pci_svr4.c	Sat Dec 21 11:10:13 2002
@@ -20,6 +20,7 @@
 # endif
 # include <sys/psw.h>
 #endif
+#include "pci_generic.h"
 
 static __inline__ int enable_os_io(void)
 {
diff -x CVS -NurbB orig/main/libdha/sysdep/pci_win32.c MPlayer-20021206/libdha/sysdep/pci_win32.c
--- orig/main/libdha/sysdep/pci_win32.c	Tue Jan 15 17:59:53 2002
+++ MPlayer-20021206/libdha/sysdep/pci_win32.c	Sat Dec 21 11:10:26 2002
@@ -4,6 +4,7 @@
    Modified for readability by Nick Kurshev
 */
 #include <windows.h>
+#include "pci_generic.h"
 
 /* Nothing to do for Win9x. For WinNT I have no solution */
 
diff -x CVS -NurbB orig/main/libdha/sysdep/pci_x86.c MPlayer-20021206/libdha/sysdep/pci_x86.c
--- orig/main/libdha/sysdep/pci_x86.c	Tue Jan 15 10:31:53 2002
+++ MPlayer-20021206/libdha/sysdep/pci_x86.c	Sat Dec 21 11:01:27 2002
@@ -4,7 +4,7 @@
    Modified for readability by Nick Kurshev
 */
 
-static int pci_config_type( void )
+static int processor_pci_config_type( void )
 {
   unsigned long tmplong1, tmplong2;
   unsigned char tmp1, tmp2;
@@ -36,7 +36,7 @@
   return retval;
 }
 
-static int pci_get_vendor(
+static int processor_pci_get_vendor(
           unsigned char bus,
           unsigned char dev,
           int func)
@@ -47,7 +47,7 @@
     return inl(PCI_MODE1_DATA_REG);
 }
 
-static long pci_config_read_long(
+static long processor_pci_config_read_long(
           unsigned char bus,
           unsigned char dev,
           int func, 


More information about the MPlayer-dev-eng mailing list