diff options
author | Alistair Popple <alistair@popple.id.au> | 2015-03-20 14:59:15 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-03-26 11:12:18 +1100 |
commit | fc2906d321adf27db33918711b1055a8ea5b34f9 (patch) | |
tree | 609849d3bbc735d0643d9cb42fa5e2764ab8da88 /external/memboot | |
parent | 822403ea5dcc51a5c70c0ab061ef49adb17d82e4 (diff) | |
download | skiboot-fc2906d321adf27db33918711b1055a8ea5b34f9.zip skiboot-fc2906d321adf27db33918711b1055a8ea5b34f9.tar.gz skiboot-fc2906d321adf27db33918711b1055a8ea5b34f9.tar.bz2 |
memboot: Add a memboot flash backend
memboot uses bmc system memory instead of a real flash chip. This
patch adds a flash backend for bmc system memory to allow use of the
memboot tool (in external/memboot) to boot the system.
Signed-off-by: Alistair Popple <alistair@popple.id.au>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'external/memboot')
-rw-r--r-- | external/memboot/memboot.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/external/memboot/memboot.c b/external/memboot/memboot.c index fa42ea9..848c5fe 100644 --- a/external/memboot/memboot.c +++ b/external/memboot/memboot.c @@ -33,6 +33,10 @@ #define LPC_HICR6 0x80 #define LPC_HICR7 0x88 #define LPC_HICR8 0x8c +#define LPC_SCR0SIO 0x170 + +#define MEMBOOT_SIO_VERSION_FLAG 0x42 +#define MEMBOOT_SIO_FLAG (0x10 << 8) uint32_t readl(void *addr) { @@ -97,6 +101,7 @@ int main(int argc, char *argv[]) { int mem_fd; void *lpcreg; + uint32_t lpc_scr0sio_val; uint32_t lpc_hicr7_val = (FLASH_IMG_BASE | 0xe00); if (argc > 2) { @@ -117,9 +122,17 @@ int main(int argc, char *argv[]) exit(1); } + lpc_scr0sio_val = readl(lpcreg+LPC_SCR0SIO); + lpc_scr0sio_val &= ~0xff; + lpc_scr0sio_val |= MEMBOOT_SIO_VERSION_FLAG; + lpc_scr0sio_val &= ~MEMBOOT_SIO_FLAG; + if (argc == 2) { boot_firmware_image(mem_fd, argv[1]); lpc_hicr7_val = (MEM_IMG_BASE | 0xe00); + + /* Set the boot mode scratch register to indicate a memboot */ + lpc_scr0sio_val |= MEMBOOT_SIO_FLAG; printf("Booting from memory after power cycle\n"); } @@ -128,6 +141,10 @@ int main(int argc, char *argv[]) writel(lpc_hicr7_val, lpcreg+LPC_HICR7); } + /* Set the magic value */ + writel(0x42, lpcreg+LPC_SCR0SIO); + + writel(lpc_scr0sio_val, lpcreg+LPC_SCR0SIO); printf("LPC_HICR7 = 0x%x\n", lpc_hicr7_val); return 0; } |