[coreboot] [PATCH] AMD F10h: set MMCONF bus count according toconfigured value

Scott Duplichan scott at notabs.org
Tue Oct 19 20:56:14 CEST 2010


]I would say it isn't worth the effort, but it's up to you.  The
]problem with macros in assembly is that it's unclear which registers
]they clobber.  That was why I suggested a pre-processor macro, but
]it's not that important.
]
]Thanks,
]Myles

Hello Myles,

Good point. Best would be a 'macro' that allows writing:
   movl  highestSetBit (busn), %eax
But that is not possible apparently. How about then, back
to inlined code with the extra error checks:

Signed-off-by: Scott Duplichan <scott at notabs.org

Index: src/cpu/amd/car/cache_as_ram.inc
===================================================================
--- src/cpu/amd/car/cache_as_ram.inc	(revision 5975)
+++ src/cpu/amd/car/cache_as_ram.inc	(working copy)
@@ -132,15 +132,35 @@
 	wrmsr
 
 #if CONFIG_MMCONF_SUPPORT
-	/* Set MMIO config space BAR. */
-	movl	$MSR_MCFG_BASE, %ecx
-	rdmsr
-	andl	$(~(0xfff00000 | (0xf << 2))), %eax
-	orl	$((CONFIG_MMCONF_BASE_ADDRESS & 0xfff00000)), %eax
-	orl	$((8 << 2) | (1 << 0)), %eax
-	andl	$(~(0x0000ffff)), %edx
-	orl	$(CONFIG_MMCONF_BASE_ADDRESS >> 32), %edx
-	wrmsr
+   #if (CONFIG_MMCONF_BASE_ADDRESS > 0xFFFFFFFF)
+   #error "MMCONF_BASE_ADDRESS too big"
+   #elif (CONFIG_MMCONF_BASE_ADDRESS & 0xFFFFF)
+   #error "MMCONF_BASE_ADDRESS not 1MB aligned"
+   #endif
+	movl	$0, %edx
+	movl	$((CONFIG_MMCONF_BASE_ADDRESS) | (1 << 0)), %eax
+   #if (CONFIG_MMCONF_BUS_NUMBER == 1)
+   #elif (CONFIG_MMCONF_BUS_NUMBER == 2)
+	orl	$(1 << 2), %eax
+   #elif (CONFIG_MMCONF_BUS_NUMBER == 4)
+	orl	$(2 << 2), %eax	
+   #elif (CONFIG_MMCONF_BUS_NUMBER == 8)
+	orl	$(3 << 2), %eax
+   #elif (CONFIG_MMCONF_BUS_NUMBER == 16)
+	orl	$(4 << 2), %eax
+   #elif (CONFIG_MMCONF_BUS_NUMBER == 32)
+	orl	$(5 << 2), %eax
+   #elif (CONFIG_MMCONF_BUS_NUMBER == 64)
+	orl	$(6 << 2), %eax
+   #elif (CONFIG_MMCONF_BUS_NUMBER == 128)
+	orl	$(7 << 2), %eax
+   #elif (CONFIG_MMCONF_BUS_NUMBER == 256)
+	orl	$(8 << 2), %eax
+   #else
+	#error "bad MMCONF_BUS_NUMBER value"
+   #endif
+	movl	$(0xc0010058), %ecx
+	wrmsr
 #endif
 
 CAR_FAM10_out_post_errata:

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mmconf-patch-1.txt
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20101019/1122fa41/attachment.txt>


More information about the coreboot mailing list