nb/intel/sandybridge: Add x86_64 support

Fix compilation on x86_64 by using compatible types.
The MRC blob isn't supported yet as there's no x86_32 wrapper.

Tested on HP8200:
* Still boots on x86_32.
* Boots to payload in x86_64

Change-Id: Iab29a87d52ad3f6c480f21a3b8389a7f49cb5dd8
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/44677
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/src/northbridge/intel/sandybridge/raminit_common.c b/src/northbridge/intel/sandybridge/raminit_common.c
index 62a2139..4b5f2b3 100644
--- a/src/northbridge/intel/sandybridge/raminit_common.c
+++ b/src/northbridge/intel/sandybridge/raminit_common.c
@@ -1509,9 +1509,12 @@
 {
 	unsigned int j;
 	unsigned int channel_offset = get_precedening_channels(ctrl, channel) * 64;
+	uintptr_t addr;
 
-	for (j = 0; j < 16; j++)
-		write32((void *)(0x04000000 + channel_offset + 4 * j), j & 2 ? b : a);
+	for (j = 0; j < 16; j++) {
+		addr = 0x04000000 + channel_offset + 4 * j;
+		write32((void *)addr, j & 2 ? b : a);
+	}
 
 	sfence();
 
@@ -1531,13 +1534,16 @@
 	unsigned int j;
 	unsigned int channel_offset = get_precedening_channels(ctrl, channel) * 64;
 	unsigned int channel_step = 64 * num_of_channels(ctrl);
+	uintptr_t addr;
 
-	for (j = 0; j < 16; j++)
-		write32((void *)(0x04000000 + channel_offset + j * 4), 0xffffffff);
-
-	for (j = 0; j < 16; j++)
-		write32((void *)(0x04000000 + channel_offset + channel_step + j * 4), 0);
-
+	for (j = 0; j < 16; j++) {
+		addr = 0x04000000 + channel_offset + j * 4;
+		write32((void *)addr, 0xffffffff);
+	}
+	for (j = 0; j < 16; j++) {
+		addr = 0x04000000 + channel_offset + channel_step + j * 4;
+		write32((void *)addr, 0);
+	}
 	sfence();
 
 	program_wdb_pattern_length(channel, 16);
@@ -1929,6 +1935,7 @@
 	unsigned int i, j;
 	unsigned int offset = get_precedening_channels(ctrl, channel) * 64;
 	unsigned int step = 64 * num_of_channels(ctrl);
+	uintptr_t addr;
 
 	if (patno) {
 		u8 base8 = 0x80 >> ((patno - 1) % 8);
@@ -1940,14 +1947,16 @@
 				if (invert[patno - 1][i] & (1 << (j / 2)))
 					val = ~val;
 
-				write32((void *)((1 << 26) + offset + i * step + j * 4), val);
+				addr = (1 << 26) + offset + i * step + j * 4;
+				write32((void *)addr, val);
 			}
 		}
 	} else {
 		for (i = 0; i < ARRAY_SIZE(pattern); i++) {
 			for (j = 0; j < 16; j++) {
 				const u32 val = pattern[i][j];
-				write32((void *)((1 << 26) + offset + i * step + j * 4), val);
+				addr = (1 << 26) + offset + i * step + j * 4;
+				write32((void *)addr, val);
 			}
 		}
 		sfence();