summaryrefslogtreecommitdiffstats
path: root/libdha
diff options
context:
space:
mode:
authoralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-10-22 12:22:40 +0000
committeralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-10-22 12:22:40 +0000
commit6c8416503d036be2d5eae08c50cd1a9ab7fd0a18 (patch)
tree35296e0c5de9bfb63b8c78e3226fe3faa58df928 /libdha
parent8c28841ed170adade5b4cab1069b98e16ab0e7dd (diff)
downloadmpv-6c8416503d036be2d5eae08c50cd1a9ab7fd0a18.tar.bz2
mpv-6c8416503d036be2d5eae08c50cd1a9ab7fd0a18.tar.xz
libdha on linux powerpc support by Colin Leroy <colin@colino.net>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7838 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libdha')
-rw-r--r--libdha/sysdep/AsmMacros_powerpc.h2
-rw-r--r--libdha/sysdep/pci_linux.c8
-rw-r--r--libdha/sysdep/pci_powerpc.c66
3 files changed, 74 insertions, 2 deletions
diff --git a/libdha/sysdep/AsmMacros_powerpc.h b/libdha/sysdep/AsmMacros_powerpc.h
index 548a7c9414..2e1edee2ae 100644
--- a/libdha/sysdep/AsmMacros_powerpc.h
+++ b/libdha/sysdep/AsmMacros_powerpc.h
@@ -55,8 +55,6 @@ static __inline__ unsigned long inl(short port)
#define intr_disable()
#define intr_enable()
-#else
-#error This stuff is not ported on your system
#endif
#endif
diff --git a/libdha/sysdep/pci_linux.c b/libdha/sysdep/pci_linux.c
index 6c0d6b42a3..ab13001198 100644
--- a/libdha/sysdep/pci_linux.c
+++ b/libdha/sysdep/pci_linux.c
@@ -32,8 +32,12 @@ static __inline__ int enable_os_io(void)
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 @@ static __inline__ int disable_os_io(void)
close(dhahelper_fd);
else
#endif
+#if defined(__powerpc__) && defined(__linux__)
+/* should be fixed? */
+#else
if (iopl(0) != 0)
return(errno);
+#endif
return(0);
}
diff --git a/libdha/sysdep/pci_powerpc.c b/libdha/sysdep/pci_powerpc.c
index 9239521ec3..52a62401de 100644
--- a/libdha/sysdep/pci_powerpc.c
+++ b/libdha/sysdep/pci_powerpc.c
@@ -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@mplayerhq.hu, colin@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 @@ static long pci_config_read_long(
pciconfig_read(bus, dev<<3, cmd, 4, &retval);
return retval;
}
+#endif /*Lynx/OpenBSD*/