chromeos: Add code to read FMAP on ARM
On ARM the SPI flash is not memory mapped. Use the CBFS interface to map the correct portion. Change-Id: I8ea9aa0119e90a892bf777313fdc389c4739154e Signed-off-by: Stefan Reinauer <reinauer@google.com> Reviewed-on: https://chromium-review.googlesource.com/169781 Reviewed-by: David Hendrix <dhendrix@chromium.org> (cherry picked from commit a263d3717e82c43fe91e7c4e82d167e74bf27527) Signed-off-by: Isaac Christensen <isaac.christensen@se-eng.com> Reviewed-on: http://review.coreboot.org/6522 Tested-by: build bot (Jenkins) Reviewed-by: David Hendricks <dhendrix@chromium.org>
This commit is contained in:
parent
da36bcf0d4
commit
9ad28b940f
|
@ -21,6 +21,7 @@
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
|
#include <cbfs.h>
|
||||||
#include "fmap.h"
|
#include "fmap.h"
|
||||||
|
|
||||||
/* Find FMAP data structure in ROM.
|
/* Find FMAP data structure in ROM.
|
||||||
|
@ -36,9 +37,19 @@ const struct fmap *fmap_find(void)
|
||||||
* and possibly cros_bundle_firmware.
|
* and possibly cros_bundle_firmware.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if CONFIG_ARCH_X86
|
||||||
/* wrapping around 0x100000000 */
|
/* wrapping around 0x100000000 */
|
||||||
const struct fmap *fmap = (void *)
|
const struct fmap *fmap = (void *)
|
||||||
(CONFIG_FLASHMAP_OFFSET - CONFIG_ROM_SIZE);
|
(CONFIG_FLASHMAP_OFFSET - CONFIG_ROM_SIZE);
|
||||||
|
#elif CONFIG_ARCH_ARMV7
|
||||||
|
struct cbfs_media default_media, *media;
|
||||||
|
media = &default_media;
|
||||||
|
init_default_cbfs_media(media);
|
||||||
|
media->open(media);
|
||||||
|
const struct fmap *fmap = (void *)
|
||||||
|
media->map(media, CONFIG_FLASHMAP_OFFSET, 4096); // FIXME size
|
||||||
|
media->close(media);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (memcmp(fmap, FMAP_SIGNATURE, sizeof(FMAP_SIGNATURE)-1)) {
|
if (memcmp(fmap, FMAP_SIGNATURE, sizeof(FMAP_SIGNATURE)-1)) {
|
||||||
printk(BIOS_DEBUG, "No FMAP found at %p.\n", fmap);
|
printk(BIOS_DEBUG, "No FMAP found at %p.\n", fmap);
|
||||||
|
@ -104,9 +115,11 @@ int find_fmap_entry(const char name[], void **pointer)
|
||||||
base = (void *)(unsigned long)fmap->base;
|
base = (void *)(unsigned long)fmap->base;
|
||||||
printk(BIOS_DEBUG, "FMAP: %s base at %p\n", name, base);
|
printk(BIOS_DEBUG, "FMAP: %s base at %p\n", name, base);
|
||||||
} else {
|
} else {
|
||||||
|
#if CONFIG_ARCH_X86
|
||||||
base = (void *)(0 - CONFIG_ROM_SIZE);
|
base = (void *)(0 - CONFIG_ROM_SIZE);
|
||||||
printk(BIOS_WARNING, "FMAP: No valid base address, using"
|
printk(BIOS_WARNING, "FMAP: No valid base address, using"
|
||||||
" 0x%p\n", base);
|
" 0x%p\n", base);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
*pointer = (void*) ((u32)base + area->offset);
|
*pointer = (void*) ((u32)base + area->offset);
|
||||||
|
|
Loading…
Reference in New Issue