[Mplayer-cvslog] CVS: main/libdha/sysdep AsmMacros_powerpc.h,1.2,1.3 pci_linux.c,1.4,1.5 pci_powerpc.c,1.1,1.2

Alex Beregszaszi alex at mplayerhq.hu
Tue Oct 22 14:22:58 CEST 2002


Update of /cvsroot/mplayer/main/libdha/sysdep
In directory mail:/var/tmp.root/cvs-serv11085

Modified Files:
	AsmMacros_powerpc.h pci_linux.c pci_powerpc.c 
Log Message:
libdha on linux powerpc support by Colin Leroy <colin at colino.net>

Index: AsmMacros_powerpc.h
===================================================================
RCS file: /cvsroot/mplayer/main/libdha/sysdep/AsmMacros_powerpc.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AsmMacros_powerpc.h	4 Jul 2002 01:10:53 -0000	1.2
+++ AsmMacros_powerpc.h	22 Oct 2002 12:22:40 -0000	1.3
@@ -55,8 +55,6 @@
 #define intr_disable()
 #define intr_enable()
 
-#else
-#error This stuff is not ported on your system
 #endif
 
 #endif

Index: pci_linux.c
===================================================================
RCS file: /cvsroot/mplayer/main/libdha/sysdep/pci_linux.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- pci_linux.c	30 Jun 2002 15:17:36 -0000	1.4
+++ pci_linux.c	22 Oct 2002 12:22:40 -0000	1.5
@@ -32,8 +32,12 @@
     dhahelper_initialized = -1;
 #endif
 
+#if defined(__powerpc__) && defined(__linux__)
+/* should be fixed? */
+#else    
     if (iopl(3) != 0)
 	return(errno);
+#endif    
     return(0);
 }
 
@@ -44,7 +48,11 @@
 	close(dhahelper_fd);
     else
 #endif
+#if defined(__powerpc__) && defined(__linux__)
+/* should be fixed? */
+#else    
     if (iopl(0) != 0)
 	return(errno);
+#endif    
     return(0);
 }

Index: pci_powerpc.c
===================================================================
RCS file: /cvsroot/mplayer/main/libdha/sysdep/pci_powerpc.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- pci_powerpc.c	15 Jan 2002 08:31:53 -0000	1.1
+++ pci_powerpc.c	22 Oct 2002 12:22:40 -0000	1.2
@@ -6,6 +6,71 @@
 
 static int pci_config_type( void ) { return 1; }
 
+#if defined(__powerpc__) && defined(__linux__)
+/* pci operations for powerpc Linux 
+   questions, suggestions etc: 
+   mplayer-dev-eng at mplayerhq.hu, colin at colino.net*/
+#include <fcntl.h>
+#include <sys/io.h>
+#include <linux/pci.h>
+#include "../../bswap.h"
+
+static int pci_get_vendor(
+          unsigned char bus,
+          unsigned char dev,
+          int func)
+{
+    int retval;
+    char path[100];
+    int fd;
+    short vendor, device;
+    sprintf(path,"/proc/bus/pci/%02d/%02x.0", bus, dev);
+    fd = open(path,O_RDONLY|O_SYNC);
+    if (fd == -1) {
+	    retval=0xFFFF;
+    }
+    else if (pread(fd, &vendor, 2, PCI_VENDOR_ID) == 2 &&
+             pread(fd, &device, 2, PCI_DEVICE_ID) == 2) {
+	    vendor = bswap_16(vendor);
+	    device = bswap_16(device);
+	    retval = vendor + (device<<16); /*no worries about byte order, 
+	    				      all ppc are bigendian*/
+    } else {
+	    retval = 0xFFFF;
+    }   
+    if (fd > 0) {
+	    close(fd);
+    }
+    return retval;
+}
+
+static long pci_config_read_long(
+          unsigned char bus,
+          unsigned char dev,
+          int func, 
+          unsigned cmd)
+{
+    long retval;
+    char path[100];
+    int fd;
+    sprintf(path,"/proc/bus/pci/%02d/%02x.0", bus, dev);
+    fd = open(path,O_RDONLY|O_SYNC);
+    if (fd == -1) {
+	    retval=0;
+    }
+    else if (pread(fd, &retval, 4, cmd) == 4) {
+	    retval = bswap_32(retval);
+    } else {
+	    retval = 0;
+    }   
+    if (fd > 0) {
+	    close(fd);
+    }
+    return retval;
+}
+
+#else /*Lynx/OpenBSD*/
+
 static int pci_get_vendor(
           unsigned char bus,
           unsigned char dev,
@@ -26,3 +91,4 @@
     pciconfig_read(bus, dev<<3, cmd, 4, &retval);
     return retval;
 }
+#endif /*Lynx/OpenBSD*/




More information about the MPlayer-cvslog mailing list