Nuke old patches
This commit is contained in:
parent
241c3f05b1
commit
4ca99f687b
@ -1,143 +0,0 @@
|
|||||||
diff -up libpciaccess-0.10.9/src/linux_sysfs.c.da libpciaccess-0.10.9/src/linux_sysfs.c
|
|
||||||
--- libpciaccess-0.10.9/src/linux_sysfs.c.da 2009-09-24 10:06:55.000000000 +1000
|
|
||||||
+++ libpciaccess-0.10.9/src/linux_sysfs.c 2009-09-25 11:51:21.000000000 +1000
|
|
||||||
@@ -57,6 +57,8 @@
|
|
||||||
|
|
||||||
static void pci_device_linux_sysfs_enable(struct pci_device *dev);
|
|
||||||
|
|
||||||
+static void pci_device_linux_sysfs_destroy( void );
|
|
||||||
+
|
|
||||||
static int pci_device_linux_sysfs_read_rom( struct pci_device * dev,
|
|
||||||
void * buffer );
|
|
||||||
|
|
||||||
@@ -79,7 +81,7 @@ static int pci_device_linux_sysfs_boot_v
|
|
||||||
static int pci_device_linux_sysfs_has_kernel_driver(struct pci_device *dev);
|
|
||||||
|
|
||||||
static const struct pci_system_methods linux_sysfs_methods = {
|
|
||||||
- .destroy = NULL,
|
|
||||||
+ .destroy = pci_device_linux_sysfs_destroy,
|
|
||||||
.destroy_device = NULL,
|
|
||||||
.read_rom = pci_device_linux_sysfs_read_rom,
|
|
||||||
.probe = pci_device_linux_sysfs_probe,
|
|
||||||
@@ -382,6 +384,53 @@ pci_device_linux_sysfs_read_rom( struct
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
+static struct pci_device *last_config_dev = NULL;
|
|
||||||
+static int config_fd = -1;
|
|
||||||
+
|
|
||||||
+static void
|
|
||||||
+pci_device_linux_sysfs_destroy( void )
|
|
||||||
+{
|
|
||||||
+ if (config_fd != -1)
|
|
||||||
+ close( config_fd );
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int
|
|
||||||
+open_config_fd( struct pci_device * dev, int flags )
|
|
||||||
+{
|
|
||||||
+ int fd;
|
|
||||||
+ char name[256];
|
|
||||||
+
|
|
||||||
+ /* Each device has a directory under sysfs. Within that directory there
|
|
||||||
+ * is a file named "config". This file used to access the PCI config
|
|
||||||
+ * space. It is used here to obtain most of the information about the
|
|
||||||
+ * device.
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+ if ( last_config_dev != dev ) {
|
|
||||||
+ if ( config_fd != -1 ) {
|
|
||||||
+ close( config_fd );
|
|
||||||
+ last_config_dev = NULL;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ snprintf( name, 255, "%s/%04x:%02x:%02x.%1u/config",
|
|
||||||
+ SYS_BUS_PCI,
|
|
||||||
+ dev->domain,
|
|
||||||
+ dev->bus,
|
|
||||||
+ dev->dev,
|
|
||||||
+ dev->func );
|
|
||||||
+
|
|
||||||
+ fd = open( name, flags );
|
|
||||||
+ if ( fd == -1 ) {
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+ config_fd = fd;
|
|
||||||
+ last_config_dev = dev;
|
|
||||||
+ } else {
|
|
||||||
+ fd = config_fd;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return fd;
|
|
||||||
+}
|
|
||||||
|
|
||||||
static int
|
|
||||||
pci_device_linux_sysfs_read( struct pci_device * dev, void * data,
|
|
||||||
@@ -398,23 +447,9 @@ pci_device_linux_sysfs_read( struct pci_
|
|
||||||
*bytes_read = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
- /* Each device has a directory under sysfs. Within that directory there
|
|
||||||
- * is a file named "config". This file used to access the PCI config
|
|
||||||
- * space. It is used here to obtain most of the information about the
|
|
||||||
- * device.
|
|
||||||
- */
|
|
||||||
- snprintf( name, 255, "%s/%04x:%02x:%02x.%1u/config",
|
|
||||||
- SYS_BUS_PCI,
|
|
||||||
- dev->domain,
|
|
||||||
- dev->bus,
|
|
||||||
- dev->dev,
|
|
||||||
- dev->func );
|
|
||||||
-
|
|
||||||
- fd = open( name, O_RDONLY );
|
|
||||||
- if ( fd == -1 ) {
|
|
||||||
+ fd = open_config_fd( dev, O_RDWR );
|
|
||||||
+ if ( fd == -1 )
|
|
||||||
return errno;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
|
|
||||||
while ( temp_size > 0 ) {
|
|
||||||
const ssize_t bytes = pread64( fd, data_bytes, temp_size, offset );
|
|
||||||
@@ -436,7 +471,6 @@ pci_device_linux_sysfs_read( struct pci_
|
|
||||||
*bytes_read = size - temp_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
- close( fd );
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -456,23 +490,9 @@ pci_device_linux_sysfs_write( struct pci
|
|
||||||
*bytes_written = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
- /* Each device has a directory under sysfs. Within that directory there
|
|
||||||
- * is a file named "config". This file used to access the PCI config
|
|
||||||
- * space. It is used here to obtain most of the information about the
|
|
||||||
- * device.
|
|
||||||
- */
|
|
||||||
- snprintf( name, 255, "%s/%04x:%02x:%02x.%1u/config",
|
|
||||||
- SYS_BUS_PCI,
|
|
||||||
- dev->domain,
|
|
||||||
- dev->bus,
|
|
||||||
- dev->dev,
|
|
||||||
- dev->func );
|
|
||||||
-
|
|
||||||
- fd = open( name, O_WRONLY );
|
|
||||||
- if ( fd == -1 ) {
|
|
||||||
+ fd = open_config_fd( dev, O_RDWR );
|
|
||||||
+ if ( fd == -1 )
|
|
||||||
return errno;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
|
|
||||||
while ( temp_size > 0 ) {
|
|
||||||
const ssize_t bytes = pwrite64( fd, data_bytes, temp_size, offset );
|
|
||||||
@@ -494,7 +514,6 @@ pci_device_linux_sysfs_write( struct pci
|
|
||||||
*bytes_written = size - temp_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
- close( fd );
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
|||||||
From a798395a1bfd9d06d40e2d8d14377a156c94429a Mon Sep 17 00:00:00 2001
|
|
||||||
From: Daniel Drake <dsd@laptop.org>
|
|
||||||
Date: Fri, 25 Nov 2011 12:28:48 -0600
|
|
||||||
Subject: [PATCH] delete_io_handle: fix deletion of last handle
|
|
||||||
|
|
||||||
When num_ios goes from 1 to 0, a realloc(ios, 0); call is made.
|
|
||||||
This is equivalent to free(ios) and NULL is returned.
|
|
||||||
|
|
||||||
However, the previous logic in the code incorrectly discards this NULL
|
|
||||||
return value. When we next call new_io_handle(), realloc(ios, X) is
|
|
||||||
called with "ios" pointing to freed memory. This causes glibc to abort.
|
|
||||||
|
|
||||||
Correct this logic to detect the 1-to-0 case and handle it correctly.
|
|
||||||
Other cases are unchanged; there is still value in checking the
|
|
||||||
return value from realloc() as it also returns NULL on error.
|
|
||||||
|
|
||||||
Signed-off-by: Daniel Drake <dsd@laptop.org>
|
|
||||||
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
||||||
---
|
|
||||||
src/common_io.c | 11 ++++++++---
|
|
||||||
1 files changed, 8 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/common_io.c b/src/common_io.c
|
|
||||||
index f1319f8..5b35e07 100644
|
|
||||||
--- a/src/common_io.c
|
|
||||||
+++ b/src/common_io.c
|
|
||||||
@@ -64,10 +64,15 @@ delete_io_handle(struct pci_io_handle *handle)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- new = realloc(ios, sizeof(struct pci_io_handle) * (num_ios - 1));
|
|
||||||
- if (new)
|
|
||||||
- ios = new;
|
|
||||||
num_ios--;
|
|
||||||
+ if (num_ios) {
|
|
||||||
+ new = realloc(ios, sizeof(struct pci_io_handle) * num_ios);
|
|
||||||
+ if (new)
|
|
||||||
+ ios = new;
|
|
||||||
+ } else {
|
|
||||||
+ free(ios);
|
|
||||||
+ ios = NULL;
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
_pci_hidden void
|
|
||||||
--
|
|
||||||
1.7.7.3
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
|||||||
From b30d458202bc0304c705eb081b12ead860584bea Mon Sep 17 00:00:00 2001
|
|
||||||
From: Keith Packard <keithp@keithp.com>
|
|
||||||
Date: Wed, 16 Apr 2008 19:10:52 +0000
|
|
||||||
Subject: Kludge around linux bug and turn off write-through and cache-disable bits
|
|
||||||
|
|
||||||
When mmaping the PCI device, the kernel turns on the write-through and
|
|
||||||
cache-disable bits in the allocated PTEs. This disables write-combining mode
|
|
||||||
and dramatically reduces write bandwidth to the frame buffer. While that
|
|
||||||
should be fixed in the kernel, we'll kludge around it here by using mprotect
|
|
||||||
to rewrite the PTEs and get those bits turned off.
|
|
||||||
---
|
|
||||||
diff --git a/src/linux_sysfs.c b/src/linux_sysfs.c
|
|
||||||
index 873dc02..78584d6 100644
|
|
||||||
--- a/src/linux_sysfs.c
|
|
||||||
+++ b/src/linux_sysfs.c
|
|
||||||
@@ -558,6 +558,9 @@ pci_device_linux_sysfs_map_range(struct pci_device *dev,
|
|
||||||
strerror(errno), errno);
|
|
||||||
/* err = errno;*/
|
|
||||||
}
|
|
||||||
+ /* KLUDGE ALERT -- rewrite the PTEs to turn off the CD and WT bits */
|
|
||||||
+ mprotect (map->memory, map->size, PROT_NONE);
|
|
||||||
+ mprotect (map->memory, map->size, PROT_READ|PROT_WRITE);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
--
|
|
||||||
cgit v0.7.2-37-g538c
|
|
||||||
|
|
@ -1,143 +0,0 @@
|
|||||||
diff -up libpciaccess-0.12.902/src/linux_sysfs.c.jx libpciaccess-0.12.902/src/linux_sysfs.c
|
|
||||||
--- libpciaccess-0.12.902/src/linux_sysfs.c.jx 2012-02-07 11:48:09.699318237 -0500
|
|
||||||
+++ libpciaccess-0.12.902/src/linux_sysfs.c 2012-02-08 13:37:19.341169509 -0500
|
|
||||||
@@ -1,6 +1,7 @@
|
|
||||||
/*
|
|
||||||
* (C) Copyright IBM Corporation 2006
|
|
||||||
* All Rights Reserved.
|
|
||||||
+ * Copyright 2012 Red Hat, Inc.
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
@@ -44,6 +45,18 @@
|
|
||||||
#include <dirent.h>
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
+#if defined(__i386__) || defined(__x86_64__) || defined(__arm__)
|
|
||||||
+#include <sys/io.h>
|
|
||||||
+#else
|
|
||||||
+#define inb(x) -1
|
|
||||||
+#define inw(x) -1
|
|
||||||
+#define inl(x) -1
|
|
||||||
+#define outb(x,y) do {} while (0)
|
|
||||||
+#define outw(x,y) do {} while (0)
|
|
||||||
+#define outl(x,y) do {} while (0)
|
|
||||||
+#define iopl(x) -1
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#ifdef HAVE_MTRR
|
|
||||||
@@ -775,19 +788,24 @@ pci_device_linux_sysfs_open_legacy_io(st
|
|
||||||
snprintf(name, PATH_MAX, "/sys/class/pci_bus/%04x:%02x/legacy_io",
|
|
||||||
dev->domain, dev->bus);
|
|
||||||
|
|
||||||
- ret->fd = open(name, O_RDWR);
|
|
||||||
+ ret->fd = open(name, O_RDWR | O_CLOEXEC);
|
|
||||||
if (ret->fd >= 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
dev = pci_device_get_parent_bridge(dev);
|
|
||||||
}
|
|
||||||
|
|
||||||
- /* If not, /dev/port is the best we can do */
|
|
||||||
- if (!dev)
|
|
||||||
- ret->fd = open("/dev/port", O_RDWR);
|
|
||||||
+ /*
|
|
||||||
+ * You would think you'd want to use /dev/port here. Don't make that
|
|
||||||
+ * mistake, /dev/port only does byte-wide i/o cycles which means it
|
|
||||||
+ * doesn't work. If you think this is stupid, well, you're right.
|
|
||||||
+ */
|
|
||||||
|
|
||||||
- if (ret->fd < 0)
|
|
||||||
- return NULL;
|
|
||||||
+ /* If we've no other choice, iopl */
|
|
||||||
+ if (ret->fd < 0) {
|
|
||||||
+ if (iopl(3))
|
|
||||||
+ return NULL;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
ret->base = base;
|
|
||||||
ret->size = size;
|
|
||||||
@@ -799,7 +817,8 @@ static void
|
|
||||||
pci_device_linux_sysfs_close_io(struct pci_device *dev,
|
|
||||||
struct pci_io_handle *handle)
|
|
||||||
{
|
|
||||||
- close(handle->fd);
|
|
||||||
+ if (handle->fd > -1)
|
|
||||||
+ close(handle->fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
static uint32_t
|
|
||||||
@@ -807,8 +826,11 @@ pci_device_linux_sysfs_read32(struct pci
|
|
||||||
{
|
|
||||||
uint32_t ret;
|
|
||||||
|
|
||||||
- pread(handle->fd, &ret, 4, port + handle->base);
|
|
||||||
-
|
|
||||||
+ if (handle->fd > -1)
|
|
||||||
+ pread(handle->fd, &ret, 4, port + handle->base);
|
|
||||||
+ else
|
|
||||||
+ ret = inl(port + handle->base);
|
|
||||||
+
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -817,7 +839,10 @@ pci_device_linux_sysfs_read16(struct pci
|
|
||||||
{
|
|
||||||
uint16_t ret;
|
|
||||||
|
|
||||||
- pread(handle->fd, &ret, 2, port + handle->base);
|
|
||||||
+ if (handle->fd > -1)
|
|
||||||
+ pread(handle->fd, &ret, 2, port + handle->base);
|
|
||||||
+ else
|
|
||||||
+ ret = inw(port + handle->base);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
@@ -827,7 +852,10 @@ pci_device_linux_sysfs_read8(struct pci_
|
|
||||||
{
|
|
||||||
uint8_t ret;
|
|
||||||
|
|
||||||
- pread(handle->fd, &ret, 1, port + handle->base);
|
|
||||||
+ if (handle->fd > -1)
|
|
||||||
+ pread(handle->fd, &ret, 1, port + handle->base);
|
|
||||||
+ else
|
|
||||||
+ ret = inb(port + handle->base);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
@@ -836,21 +864,30 @@ static void
|
|
||||||
pci_device_linux_sysfs_write32(struct pci_io_handle *handle, uint32_t port,
|
|
||||||
uint32_t data)
|
|
||||||
{
|
|
||||||
- pwrite(handle->fd, &data, 4, port + handle->base);
|
|
||||||
+ if (handle->fd > -1)
|
|
||||||
+ pwrite(handle->fd, &data, 4, port + handle->base);
|
|
||||||
+ else
|
|
||||||
+ outl(data, port + handle->base);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
pci_device_linux_sysfs_write16(struct pci_io_handle *handle, uint32_t port,
|
|
||||||
uint16_t data)
|
|
||||||
{
|
|
||||||
- pwrite(handle->fd, &data, 2, port + handle->base);
|
|
||||||
+ if (handle->fd > -1)
|
|
||||||
+ pwrite(handle->fd, &data, 2, port + handle->base);
|
|
||||||
+ else
|
|
||||||
+ outw(data, port + handle->base);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
pci_device_linux_sysfs_write8(struct pci_io_handle *handle, uint32_t port,
|
|
||||||
uint8_t data)
|
|
||||||
{
|
|
||||||
- pwrite(handle->fd, &data, 1, port + handle->base);
|
|
||||||
+ if (handle->fd > -1)
|
|
||||||
+ pwrite(handle->fd, &data, 1, port + handle->base);
|
|
||||||
+ else
|
|
||||||
+ outb(data, port + handle->base);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
@ -1,16 +0,0 @@
|
|||||||
diff -up libpciaccess-0.13/src/linux_sysfs.c.jx libpciaccess-0.13/src/linux_sysfs.c
|
|
||||||
--- libpciaccess-0.13/src/linux_sysfs.c.jx 2012-03-28 17:23:45.000000000 -0400
|
|
||||||
+++ libpciaccess-0.13/src/linux_sysfs.c 2012-03-28 17:33:39.064766960 -0400
|
|
||||||
@@ -51,9 +51,9 @@
|
|
||||||
#define inb(x) -1
|
|
||||||
#define inw(x) -1
|
|
||||||
#define inl(x) -1
|
|
||||||
-#define outb(x) do {} while (0)
|
|
||||||
-#define outw(x) do {} while (0)
|
|
||||||
-#define outl(x) do {} while (0)
|
|
||||||
+#define outb(x,y) do {} while (0)
|
|
||||||
+#define outw(x,y) do {} while (0)
|
|
||||||
+#define outl(x,y) do {} while (0)
|
|
||||||
#define iopl(x) -1
|
|
||||||
#endif
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user