aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/bochs/bochs_hw.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/gpu/drm/bochs/bochs_hw.c b/drivers/gpu/drm/bochs/bochs_hw.c
index e8b1dacc4911..460389702d31 100644
--- a/drivers/gpu/drm/bochs/bochs_hw.c
+++ b/drivers/gpu/drm/bochs/bochs_hw.c
@@ -51,7 +51,7 @@ int bochs_hw_init(struct drm_device *dev, uint32_t flags)
51{ 51{
52 struct bochs_device *bochs = dev->dev_private; 52 struct bochs_device *bochs = dev->dev_private;
53 struct pci_dev *pdev = dev->pdev; 53 struct pci_dev *pdev = dev->pdev;
54 unsigned long addr, size, mem, ioaddr, iosize; 54 unsigned long addr, size, mem, ioaddr, iosize, qext_size;
55 u16 id; 55 u16 id;
56 56
57 if (pdev->resource[2].flags & IORESOURCE_MEM) { 57 if (pdev->resource[2].flags & IORESOURCE_MEM) {
@@ -115,6 +115,24 @@ int bochs_hw_init(struct drm_device *dev, uint32_t flags)
115 size / 1024, addr, 115 size / 1024, addr,
116 bochs->ioports ? "ioports" : "mmio", 116 bochs->ioports ? "ioports" : "mmio",
117 ioaddr); 117 ioaddr);
118
119 if (bochs->mmio && pdev->revision >= 2) {
120 qext_size = readl(bochs->mmio + 0x600);
121 if (qext_size < 4 || qext_size > iosize)
122 goto noext;
123 DRM_DEBUG("Found qemu ext regs, size %ld\n", qext_size);
124 if (qext_size >= 8) {
125#ifdef __BIG_ENDIAN
126 writel(0xbebebebe, bochs->mmio + 0x604);
127#else
128 writel(0x1e1e1e1e, bochs->mmio + 0x604);
129#endif
130 DRM_DEBUG(" qext endian: 0x%x\n",
131 readl(bochs->mmio + 0x604));
132 }
133 }
134
135noext:
118 return 0; 136 return 0;
119} 137}
120 138