https://git.reactos.org/?p=reactos.git;a=commitdiff;h=afdb42023cd326d6c1637…
commit afdb42023cd326d6c16375066fe1f656d7bfb602
Author: Stanislav Motylkov <x86corez(a)gmail.com>
AuthorDate: Tue Jan 14 22:20:22 2020 +0300
Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org>
CommitDate: Tue Jan 14 20:20:22 2020 +0100
[FREELDR][XBOXVMP] Check only low 28 bits for framebuffer address (#2249)
Fixes framebuffer detection on real hardware Xbox.
---
boot/freeldr/freeldr/arch/i386/xboxvideo.c | 5 ++++-
win32ss/drivers/miniport/xboxvmp/xboxvmp.c | 5 +++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/boot/freeldr/freeldr/arch/i386/xboxvideo.c
b/boot/freeldr/freeldr/arch/i386/xboxvideo.c
index ffc2144d408..b1fd2518d6d 100644
--- a/boot/freeldr/freeldr/arch/i386/xboxvideo.c
+++ b/boot/freeldr/freeldr/arch/i386/xboxvideo.c
@@ -158,7 +158,10 @@ XboxGetFramebufferSize(PVOID Offset)
{
TRACE("i = %d, base_addr_low = 0x%p, MemoryMap->length_low =
0x%p\n", i, MemoryMap->base_addr_low, MemoryMap->length_low);
- if (MemoryMap->base_addr_low == (ULONG)Offset &&
MemoryMap->base_addr_high == 0)
+ /* Framebuffer address offset value is coming from the GPU within
+ * memory mapped I/O address space, so we're comparing only low
+ * 28 bits of the address within actual RAM address space */
+ if (MemoryMap->base_addr_low == ((ULONG)Offset & 0x0FFFFFFF) &&
MemoryMap->base_addr_high == 0)
{
TRACE("Video memory found\n");
return MemoryMap->length_low;
diff --git a/win32ss/drivers/miniport/xboxvmp/xboxvmp.c
b/win32ss/drivers/miniport/xboxvmp/xboxvmp.c
index 98f584ec086..cf4ddf6de39 100644
--- a/win32ss/drivers/miniport/xboxvmp/xboxvmp.c
+++ b/win32ss/drivers/miniport/xboxvmp/xboxvmp.c
@@ -394,6 +394,10 @@ XboxVmpMapVideoMemory(
/* Reuse framebuffer that was set up by firmware */
FrameBuffer.QuadPart = *((PULONG)((ULONG_PTR)DeviceExtension->VirtControlStart +
NV2A_CONTROL_FRAMEBUFFER_ADDRESS_OFFSET));
+ /* Framebuffer address offset value is coming from the GPU within
+ * memory mapped I/O address space, so we're comparing only low
+ * 28 bits of the address within actual RAM address space */
+ FrameBuffer.QuadPart &= 0x0FFFFFFF;
if (FrameBuffer.QuadPart != 0x3C00000 && FrameBuffer.QuadPart != 0x7C00000)
{
/* Check framebuffer address (high 4 MB of either 64 or 128 MB RAM) */
@@ -402,6 +406,7 @@ XboxVmpMapVideoMemory(
/* Verify that framebuffer address is page-aligned */
ASSERT(FrameBuffer.QuadPart % PAGE_SIZE == 0);
+ /* Return the address back to GPU memory mapped I/O */
FrameBuffer.QuadPart += DeviceExtension->PhysFrameBufferStart.QuadPart;
MapInformation->VideoRamBase = RequestedAddress->RequestedVirtualAddress;
/* FIXME: obtain fb size from firmware somehow (Cromwell reserves high 4 MB of RAM)
*/