|
@@ -1,19 +1,124 @@
|
|
|
---- libpciaccess-0.13.1.orig/src/linux_sysfs.c 2012-04-09 19:02:57.000000000 +0200
|
|
|
-+++ libpciaccess-0.13.1/src/linux_sysfs.c 2013-12-01 18:26:04.000000000 +0100
|
|
|
-@@ -34,6 +34,7 @@
|
|
|
-
|
|
|
- #define _GNU_SOURCE
|
|
|
-
|
|
|
-+#include <limits.h>
|
|
|
- #include <stdlib.h>
|
|
|
- #include <string.h>
|
|
|
- #include <stdio.h>
|
|
|
-@@ -45,7 +46,7 @@
|
|
|
- #include <dirent.h>
|
|
|
- #include <errno.h>
|
|
|
-
|
|
|
--#if defined(__i386__) || defined(__x86_64__) || defined(__arm__)
|
|
|
-+#if defined(__i386__) || defined(__x86_64__)
|
|
|
- #include <sys/io.h>
|
|
|
- #else
|
|
|
- #define inb(x) -1
|
|
|
+--- libpciaccess-0.13.2.orig/src/linux_sysfs.c 2013-07-21 00:54:34.000000000 +0200
|
|
|
++++ libpciaccess-0.13.2/src/linux_sysfs.c 2014-03-24 13:26:10.484152334 +0100
|
|
|
+@@ -759,6 +759,7 @@ pci_device_linux_sysfs_open_device_io(st
|
|
|
+
|
|
|
+ ret->base = base;
|
|
|
+ ret->size = size;
|
|
|
++ ret->is_legacy = 0;
|
|
|
+
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+@@ -796,6 +797,7 @@ pci_device_linux_sysfs_open_legacy_io(st
|
|
|
+
|
|
|
+ ret->base = base;
|
|
|
+ ret->size = size;
|
|
|
++ ret->is_legacy = 1;
|
|
|
+
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+@@ -813,10 +815,14 @@ pci_device_linux_sysfs_read32(struct pci
|
|
|
+ {
|
|
|
+ uint32_t ret;
|
|
|
+
|
|
|
+- if (handle->fd > -1)
|
|
|
+- pread(handle->fd, &ret, 4, port + handle->base);
|
|
|
+- else
|
|
|
++ if (handle->fd > -1) {
|
|
|
++ if (handle->is_legacy)
|
|
|
++ pread(handle->fd, &ret, 4, port + handle->base);
|
|
|
++ else
|
|
|
++ pread(handle->fd, &ret, 4, port);
|
|
|
++ } else {
|
|
|
+ ret = inl(port + handle->base);
|
|
|
++ }
|
|
|
+
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+@@ -826,10 +832,14 @@ pci_device_linux_sysfs_read16(struct pci
|
|
|
+ {
|
|
|
+ uint16_t ret;
|
|
|
+
|
|
|
+- if (handle->fd > -1)
|
|
|
+- pread(handle->fd, &ret, 2, port + handle->base);
|
|
|
+- else
|
|
|
++ if (handle->fd > -1) {
|
|
|
++ if (handle->is_legacy)
|
|
|
++ pread(handle->fd, &ret, 2, port + handle->base);
|
|
|
++ else
|
|
|
++ pread(handle->fd, &ret, 2, port);
|
|
|
++ } else {
|
|
|
+ ret = inw(port + handle->base);
|
|
|
++ }
|
|
|
+
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+@@ -839,10 +849,14 @@ pci_device_linux_sysfs_read8(struct pci_
|
|
|
+ {
|
|
|
+ uint8_t ret;
|
|
|
+
|
|
|
+- if (handle->fd > -1)
|
|
|
+- pread(handle->fd, &ret, 1, port + handle->base);
|
|
|
+- else
|
|
|
++ if (handle->fd > -1) {
|
|
|
++ if (handle->is_legacy)
|
|
|
++ pread(handle->fd, &ret, 1, port + handle->base);
|
|
|
++ else
|
|
|
++ pread(handle->fd, &ret, 1, port);
|
|
|
++ } else {
|
|
|
+ ret = inb(port + handle->base);
|
|
|
++ }
|
|
|
+
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+@@ -851,30 +865,42 @@ static void
|
|
|
+ pci_device_linux_sysfs_write32(struct pci_io_handle *handle, uint32_t port,
|
|
|
+ uint32_t data)
|
|
|
+ {
|
|
|
+- if (handle->fd > -1)
|
|
|
+- pwrite(handle->fd, &data, 4, port + handle->base);
|
|
|
+- else
|
|
|
++ if (handle->fd > -1) {
|
|
|
++ if (handle->is_legacy)
|
|
|
++ pwrite(handle->fd, &data, 4, port + handle->base);
|
|
|
++ else
|
|
|
++ pwrite(handle->fd, &data, 4, port);
|
|
|
++ } else {
|
|
|
+ outl(data, port + handle->base);
|
|
|
++ }
|
|
|
+ }
|
|
|
+
|
|
|
+ static void
|
|
|
+ pci_device_linux_sysfs_write16(struct pci_io_handle *handle, uint32_t port,
|
|
|
+ uint16_t data)
|
|
|
+ {
|
|
|
+- if (handle->fd > -1)
|
|
|
+- pwrite(handle->fd, &data, 2, port + handle->base);
|
|
|
+- else
|
|
|
++ if (handle->fd > -1) {
|
|
|
++ if (handle->is_legacy)
|
|
|
++ pwrite(handle->fd, &data, 2, port + handle->base);
|
|
|
++ else
|
|
|
++ pwrite(handle->fd, &data, 2, port);
|
|
|
++ } else {
|
|
|
+ outw(data, port + handle->base);
|
|
|
++ }
|
|
|
+ }
|
|
|
+
|
|
|
+ static void
|
|
|
+ pci_device_linux_sysfs_write8(struct pci_io_handle *handle, uint32_t port,
|
|
|
+ uint8_t data)
|
|
|
+ {
|
|
|
+- if (handle->fd > -1)
|
|
|
+- pwrite(handle->fd, &data, 1, port + handle->base);
|
|
|
+- else
|
|
|
++ if (handle->fd > -1) {
|
|
|
++ if (handle->is_legacy)
|
|
|
++ pwrite(handle->fd, &data, 1, port + handle->base);
|
|
|
++ else
|
|
|
++ pwrite(handle->fd, &data, 1, port);
|
|
|
++ } else {
|
|
|
+ outb(data, port + handle->base);
|
|
|
++ }
|
|
|
+ }
|
|
|
+
|
|
|
+ static int
|