lib: Rewrite qemu-armv7 ramdetect

* Move armv7 RAM dection to a common place
* Enable it for all emulated platforms
* Use 32bit probe values and restore memory even on failure
* Use the new logic on the following boards:
** qemu-armv7
** qemu-riscv

Tested on qemu-system-riscv:
Fixes kernel panic due to wrong memory limits reported.

Change-Id: I37386c6a95bfc3b7b25aeae32c6e14cff9913513
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/33934
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc
index 7492b16..9deb5bf 100644
--- a/src/lib/Makefile.inc
+++ b/src/lib/Makefile.inc
@@ -65,6 +65,7 @@
 verstage-$(CONFIG_GENERIC_UDELAY) += timer.c
 verstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
 
+romstage-$(CONFIG_VENDOR_EMULATION) += ramdetect.c
 romstage-y += prog_loaders.c
 romstage-y += prog_ops.c
 romstage-y += memchr.c
@@ -105,6 +106,7 @@
 
 romstage-$(CONFIG_GENERIC_UDELAY) += timer.c
 
+ramstage-$(CONFIG_VENDOR_EMULATION) += ramdetect.c
 ramstage-y += prog_loaders.c
 ramstage-y += prog_ops.c
 ramstage-y += hardwaremain.c
@@ -155,6 +157,7 @@
 ramstage-y += imd_cbmem.c
 ramstage-y += imd.c
 
+postcar-$(CONFIG_VENDOR_EMULATION) += ramdetect.c
 postcar-y += cbmem_common.c
 postcar-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
 postcar-y += imd_cbmem.c