https://git.reactos.org/?p=reactos.git;a=commitdiff;h=10e52f68b2c3b9968b61d…
commit 10e52f68b2c3b9968b61dc8be973d7895ec6a0a4
Author: Stanislav Motylkov <x86corez(a)gmail.com>
AuthorDate: Fri May 8 23:02:42 2020 +0300
Commit: Stanislav Motylkov <x86corez(a)gmail.com>
CommitDate: Fri May 8 23:02:42 2020 +0300
[FREELDR] Fix some more register accesses and magic values
Addendum to 764e884.
---
boot/freeldr/freeldr/arch/i386/xbox/machxbox.c | 4 ++--
boot/freeldr/freeldr/arch/i386/xbox/xboxmem.c | 13 +++++++------
boot/freeldr/freeldr/include/arch/i386/machxbox.h | 2 ++
3 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/boot/freeldr/freeldr/arch/i386/xbox/machxbox.c
b/boot/freeldr/freeldr/arch/i386/xbox/machxbox.c
index 438e887d059..b1ed4c94be0 100644
--- a/boot/freeldr/freeldr/arch/i386/xbox/machxbox.c
+++ b/boot/freeldr/freeldr/arch/i386/xbox/machxbox.c
@@ -261,8 +261,8 @@ MachInit(const char *CmdLine)
/* Check for Xbox by identifying device at PCI 0:0:0, if it's
* 0x10DE/0x02A5 then we're running on an Xbox */
- WRITE_PORT_ULONG((ULONG *)0xCF8, CONFIG_CMD(0, 0, 0));
- PciId = READ_PORT_ULONG((ULONG *)0xCFC);
+ WRITE_PORT_ULONG((PULONG)0xCF8, CONFIG_CMD(0, 0, 0));
+ PciId = READ_PORT_ULONG((PULONG)0xCFC);
if (PciId != 0x02A510DE)
{
ERR("This is not original Xbox!\n");
diff --git a/boot/freeldr/freeldr/arch/i386/xbox/xboxmem.c
b/boot/freeldr/freeldr/arch/i386/xbox/xboxmem.c
index e8ea7b016ea..29e1382be18 100644
--- a/boot/freeldr/freeldr/arch/i386/xbox/xboxmem.c
+++ b/boot/freeldr/freeldr/arch/i386/xbox/xboxmem.c
@@ -60,11 +60,12 @@ XboxMemInit(VOID)
PVOID MembaseTop = (PVOID)(64 * 1024 * 1024);
PVOID MembaseLow = (PVOID)0;
- (*(PULONG)(0xfd000000 + 0x100200)) = 0x03070103;
- (*(PULONG)(0xfd000000 + 0x100204)) = 0x11448000;
+ WRITE_REGISTER_ULONG((PULONG)NV2A_FB_CFG0, 0x03070103);
+ WRITE_REGISTER_ULONG((PULONG)NV2A_FB_CFG0 + 4, 0x11448000);
- WRITE_PORT_ULONG((ULONG*) 0xcf8, CONFIG_CMD(0, 0, 0x84));
- WRITE_PORT_ULONG((ULONG*) 0xcfc, 0x7ffffff); /* Prep hardware for 128 Mb
*/
+ /* Prep hardware for 128 Mb */
+ WRITE_PORT_ULONG((PULONG)0xCF8, CONFIG_CMD(0, 0, 0x84));
+ WRITE_PORT_ULONG((PULONG)0xCFC, 0x7FFFFFF);
InstalledMemoryMb = 64;
memset(ControlRegion, TEST_PATTERN1, TEST_SIZE);
@@ -93,8 +94,8 @@ XboxMemInit(VOID)
}
/* Set hardware for amount of memory detected */
- WRITE_PORT_ULONG((ULONG*) 0xcf8, CONFIG_CMD(0, 0, 0x84));
- WRITE_PORT_ULONG((ULONG*) 0xcfc, InstalledMemoryMb * 1024 * 1024 - 1);
+ WRITE_PORT_ULONG((PULONG)0xCF8, CONFIG_CMD(0, 0, 0x84));
+ WRITE_PORT_ULONG((PULONG)0xCFC, InstalledMemoryMb * 1024 * 1024 - 1);
AvailableMemoryMb = InstalledMemoryMb;
}
diff --git a/boot/freeldr/freeldr/include/arch/i386/machxbox.h
b/boot/freeldr/freeldr/include/arch/i386/machxbox.h
index 6a95fe6025d..3f41e848666 100644
--- a/boot/freeldr/freeldr/include/arch/i386/machxbox.h
+++ b/boot/freeldr/freeldr/include/arch/i386/machxbox.h
@@ -38,6 +38,8 @@
#define LPC_CONFIG_DEVICE_INTERRUPT 0x70
#define NV2A_CONTROL_OFFSET 0xFD000000
+#define NV2A_FB_OFFSET (0x100000 + NV2A_CONTROL_OFFSET)
+#define NV2A_FB_CFG0 (0x200 + NV2A_FB_OFFSET)
#define NV2A_CRTC_OFFSET (0x600000 + NV2A_CONTROL_OFFSET)
#define NV2A_CRTC_FRAMEBUFFER_START (0x800 + NV2A_CRTC_OFFSET)
#define NV2A_CRTC_REGISTER_INDEX (0x13D4 + NV2A_CRTC_OFFSET)