drm/i915: Fix detection of base of stolen memory
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 15 Nov 2012 11:32:18 +0000 (11:32 +0000)
committerBen Hutchings <ben@decadent.org.uk>
Mon, 13 May 2013 14:02:43 +0000 (15:02 +0100)
commit53e587aa5ca81497d0ea6e340320ec5778d1f311
tree402832fa3950b8f93cfaa6d45dc0996bf1cb758d
parent03000102c151f4dab9a38aee831182df3be748d1
drm/i915: Fix detection of base of stolen memory

commit e12a2d53ae45a69aea499b64f75e7222cca0f12f upstream.

The routine to query the base of stolen memory was using the wrong
registers and the wrong encodings on virtually every platform.

It was not until the G33 refresh, that a PCI config register was
introduced that explicitly said where the stolen memory was. Prior to
865G there was not even a register that said where the end of usable
low memory was and where the stolen memory began (or ended depending
upon chipset). Before then, one has to look at the BIOS memory maps to
find the Top of Memory. Alas that is not exported by arch/x86 and so we
have to resort to disabling stolen memory on gen2 for the time being.

Then SandyBridge enlarged the PCI register to a full 32-bits and change
the encoding of the address, so even though we happened to be querying
the right register, we read the wrong bits and ended up using address 0
for our stolen data, i.e. notably FBC.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
[bwh: Backported to 3.2: adjust filename, context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/gpu/drm/i915/i915_dma.c
drivers/gpu/drm/i915/i915_drv.h