aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_pci.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-10-14 03:39:08 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-14 03:39:08 -0400
commit2d65a9f48fcdf7866aab6457bc707ca233e0c791 (patch)
treef93e5838d6ac2e59434367f4ff905f7d9c45fc2b /drivers/gpu/drm/drm_pci.c
parentda92da3638a04894afdca8b99e973ddd20268471 (diff)
parentdfda0df3426483cf5fc7441f23f318edbabecb03 (diff)
Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux
Pull drm updates from Dave Airlie: "This is the main git pull for the drm, I pretty much froze major pulls at -rc5/6 time, and haven't had much fallout, so will probably continue doing that. Lots of changes all over, big internal header cleanup to make it clear drm features are legacy things and what are things that modern KMS drivers should be using. Also big move to use the new generic fences in all the TTM drivers. core: atomic prep work, vblank rework changes, allows immediate vblank disables major header reworking and cleanups to better delinate legacy interfaces from what KMS drivers should be using. cursor planes locking fixes ttm: move to generic fences (affects all TTM drivers) ppc64 caching fixes radeon: userptr support, uvd for old asics, reset rework for fence changes better buffer placement changes, dpm feature enablement hdmi audio support fixes intel: Cherryview work, 180 degree rotation, skylake prep work, execlist command submission full ppgtt prep work cursor improvements edid caching, vdd handling improvements nouveau: fence reworking kepler memory clock work gt21x clock work fan control improvements hdmi infoframe fixes DP audio ast: ppc64 fixes caching fix rcar: rcar-du DT support ipuv3: prep work for capture support msm: LVDS support for mdp4, new panel, gpu refactoring exynos: exynos3250 SoC support, drop bad mmap interface, mipi dsi changes, and component match support" * 'drm-next' of git://people.freedesktop.org/~airlied/linux: (640 commits) drm/mst: rework payload table allocation to conform better. drm/ast: Fix HW cursor image drm/radeon/kv: add uvd/vce info to dpm debugfs output drm/radeon/ci: add uvd/vce info to dpm debugfs output drm/radeon: export reservation_object from dmabuf to ttm drm/radeon: cope with foreign fences inside the reservation object drm/radeon: cope with foreign fences inside display drm/core: use helper to check driver features drm/radeon/cik: write gfx ucode version to ucode addr reg drm/radeon/si: print full CS when we hit a packet 0 drm/radeon: remove unecessary includes drm/radeon/combios: declare legacy_connector_convert as static drm/radeon/atombios: declare connector convert tables as static drm/radeon: drop btc_get_max_clock_from_voltage_dependency_table drm/radeon/dpm: drop clk/voltage dependency filters for BTC drm/radeon/dpm: drop clk/voltage dependency filters for CI drm/radeon/dpm: drop clk/voltage dependency filters for SI drm/radeon/dpm: drop clk/voltage dependency filters for NI drm/radeon: disable audio when we disable hdmi (v2) drm/radeon: split audio enable between eg and r600 (v2) ...
Diffstat (limited to 'drivers/gpu/drm/drm_pci.c')
-rw-r--r--drivers/gpu/drm/drm_pci.c46
1 files changed, 13 insertions, 33 deletions
diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index 020cfd934854..fd29f03645b8 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -27,6 +27,7 @@
27#include <linux/dma-mapping.h> 27#include <linux/dma-mapping.h>
28#include <linux/export.h> 28#include <linux/export.h>
29#include <drm/drmP.h> 29#include <drm/drmP.h>
30#include "drm_legacy.h"
30 31
31/** 32/**
32 * drm_pci_alloc - Allocate a PCI consistent memory block, for DMA. 33 * drm_pci_alloc - Allocate a PCI consistent memory block, for DMA.
@@ -81,7 +82,7 @@ EXPORT_SYMBOL(drm_pci_alloc);
81 * 82 *
82 * This function is for internal use in the Linux-specific DRM core code. 83 * This function is for internal use in the Linux-specific DRM core code.
83 */ 84 */
84void __drm_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah) 85void __drm_legacy_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah)
85{ 86{
86 unsigned long addr; 87 unsigned long addr;
87 size_t sz; 88 size_t sz;
@@ -105,7 +106,7 @@ void __drm_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah)
105 */ 106 */
106void drm_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah) 107void drm_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah)
107{ 108{
108 __drm_pci_free(dev, dmah); 109 __drm_legacy_pci_free(dev, dmah);
109 kfree(dmah); 110 kfree(dmah);
110} 111}
111 112
@@ -127,34 +128,20 @@ static int drm_get_pci_domain(struct drm_device *dev)
127 return pci_domain_nr(dev->pdev->bus); 128 return pci_domain_nr(dev->pdev->bus);
128} 129}
129 130
130static int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master) 131int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master)
131{ 132{
132 int len, ret; 133 master->unique = kasprintf(GFP_KERNEL, "pci:%04x:%02x:%02x.%d",
133 master->unique_len = 40; 134 drm_get_pci_domain(dev),
134 master->unique_size = master->unique_len; 135 dev->pdev->bus->number,
135 master->unique = kmalloc(master->unique_size, GFP_KERNEL); 136 PCI_SLOT(dev->pdev->devfn),
136 if (master->unique == NULL) 137 PCI_FUNC(dev->pdev->devfn));
138 if (!master->unique)
137 return -ENOMEM; 139 return -ENOMEM;
138 140
139 141 master->unique_len = strlen(master->unique);
140 len = snprintf(master->unique, master->unique_len,
141 "pci:%04x:%02x:%02x.%d",
142 drm_get_pci_domain(dev),
143 dev->pdev->bus->number,
144 PCI_SLOT(dev->pdev->devfn),
145 PCI_FUNC(dev->pdev->devfn));
146
147 if (len >= master->unique_len) {
148 DRM_ERROR("buffer overflow");
149 ret = -EINVAL;
150 goto err;
151 } else
152 master->unique_len = len;
153
154 return 0; 142 return 0;
155err:
156 return ret;
157} 143}
144EXPORT_SYMBOL(drm_pci_set_busid);
158 145
159int drm_pci_set_unique(struct drm_device *dev, 146int drm_pci_set_unique(struct drm_device *dev,
160 struct drm_master *master, 147 struct drm_master *master,
@@ -163,8 +150,7 @@ int drm_pci_set_unique(struct drm_device *dev,
163 int domain, bus, slot, func, ret; 150 int domain, bus, slot, func, ret;
164 151
165 master->unique_len = u->unique_len; 152 master->unique_len = u->unique_len;
166 master->unique_size = u->unique_len + 1; 153 master->unique = kmalloc(master->unique_len + 1, GFP_KERNEL);
167 master->unique = kmalloc(master->unique_size, GFP_KERNEL);
168 if (!master->unique) { 154 if (!master->unique) {
169 ret = -ENOMEM; 155 ret = -ENOMEM;
170 goto err; 156 goto err;
@@ -269,10 +255,6 @@ void drm_pci_agp_destroy(struct drm_device *dev)
269 } 255 }
270} 256}
271 257
272static struct drm_bus drm_pci_bus = {
273 .set_busid = drm_pci_set_busid,
274};
275
276/** 258/**
277 * drm_get_pci_dev - Register a PCI device with the DRM subsystem 259 * drm_get_pci_dev - Register a PCI device with the DRM subsystem
278 * @pdev: PCI device 260 * @pdev: PCI device
@@ -353,8 +335,6 @@ int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver)
353 335
354 DRM_DEBUG("\n"); 336 DRM_DEBUG("\n");
355 337
356 driver->bus = &drm_pci_bus;
357
358 if (driver->driver_features & DRIVER_MODESET) 338 if (driver->driver_features & DRIVER_MODESET)
359 return pci_register_driver(pdriver); 339 return pci_register_driver(pdriver);
360 340