Date: Fri, 26 May 2006 19:58:45 GMT From: Warner Losh <imp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 97903 for review Message-ID: <200605261958.k4QJwjhM015534@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=97903 Change 97903 by imp@imp_lighthouse on 2006/05/26 19:57:51 Comment out the SD good for the moment. It's just a little too big to have it, xmodem and tftp in the 12k, alas. I need to get more clever if I'm to work this out. Add support for loading a kernel into spi and loading it to a specified location. Cheap, but ugly :-( Affected files ... .. //depot/projects/arm/src/sys/boot/arm/at91/Makefile#8 edit .. //depot/projects/arm/src/sys/boot/arm/at91/bootspi/Makefile#10 edit .. //depot/projects/arm/src/sys/boot/arm/at91/bootspi/loader_prompt.c#10 edit .. //depot/projects/arm/src/sys/boot/arm/at91/bootspi/loader_prompt.h#6 edit Differences ... ==== //depot/projects/arm/src/sys/boot/arm/at91/Makefile#8 (text+ko) ==== ==== //depot/projects/arm/src/sys/boot/arm/at91/bootspi/Makefile#10 (text+ko) ==== @@ -2,19 +2,14 @@ P=bootspi FILES=${P} -SRCS=arm_init.S main.c loader_prompt.c env_vars.c ints.c \ - mci_device.c sd-card.c stormy16-lib2.c +SRCS=arm_init.S main.c loader_prompt.c env_vars.c \ +#SRCS+=ints.c mci_device.c sd-card.c stormy16-lib2.c NO_MAN= LDFLAGS=-e 0 -T ${.CURDIR}/../linker.cfg OBJS+= ${SRCS:N*.h:R:S/$/.o/g} .include <bsd.prog.mk> -.if ${MK_TAG_LIST} != "no" -CFLAGS += -I${.CURDIR}/.. -DSUPPORT_TAG_LIST -SRCS+=tag_list.c -.endif - .if ${MK_FPGA} != "no" CFLAGS += -DTSC_FPGA .endif ==== //depot/projects/arm/src/sys/boot/arm/at91/bootspi/loader_prompt.c#10 (text+ko) ==== @@ -43,6 +43,11 @@ // argv pointer are either NULL or point to locations in inputBuffer static char *argv[MAX_COMMAND_PARAMS]; +#define FLASH_OFFSET (0 * FLASH_PAGE_SIZE) +#define FPGA_OFFSET (15 * FLASH_PAGE_SIZE) +#define FPGA_LEN (212608) +#define KERNEL_OFFSET (220 * FLASH_PAGE_SIZE) +#define KERNEL_LEN (3 * 1024 * FLASH_PAGE_SIZE) static const char *backspaceString = "\010 \010"; static const command_entry_t CommandTable[] = { @@ -56,6 +61,8 @@ {COMMAND_WRITE, "w"}, {COMMAND_XMODEM, "x"}, {COMMAND_RESET, "R"}, + {COMMAND_LOAD_SPI_KERNEL, "k"}, + {COMMAND_REPLACE_KERNEL_VIA_XMODEM, "K"}, {COMMAND_REPLACE_FLASH_VIA_XMODEM, "I"}, {COMMAND_REPLACE_FPGA_VIA_XMODEM, "F"}, {COMMAND_FINAL_FLAG, 0} @@ -78,8 +85,8 @@ int len, off, i, offset; char *addr = (char *)SDRAM_BASE + (1 << 20); /* Load to base + 1MB */ - len = 212608; - offset = 15 * FLASH_PAGE_SIZE; + len = FPGA_LEN; + offset = FPGA_OFFSET; for (i = 0; i < len; i+= FLASH_PAGE_SIZE) { off = i + offset; SPI_ReadFlash(off, addr + i, FLASH_PAGE_SIZE); @@ -203,6 +210,17 @@ } } +static void +LoadKernelFromSpi(char *addr) +{ + int i, off; + + for (i = 0; i < KERNEL_LEN; i+= FLASH_PAGE_SIZE) { + off = i + KERNEL_OFFSET; + SPI_ReadFlash(off, addr + i, FLASH_PAGE_SIZE); + } +} + /* * .KB_C_FN_DEFINITION_START * void ParseCommand(char *) @@ -302,6 +320,12 @@ WriteCommandTable(); break; + case COMMAND_LOAD_SPI_KERNEL: + // "k <address>" + if (argc > 1) + LoadKernelFromSpi((char *)p_ASCIIToHex(argv[1])); + break; + case COMMAND_XMODEM: // "x <address>" // download X-modem record at address @@ -315,13 +339,17 @@ while (1) continue; break; + case COMMAND_REPLACE_KERNEL_VIA_XMODEM: + printf("Updating KERNEL image\r\n"); + UpdateFlash(KERNEL_OFFSET); + break; case COMMAND_REPLACE_FPGA_VIA_XMODEM: printf("Updating FPGA image\r\n"); - UpdateFlash(15 * FLASH_PAGE_SIZE); + UpdateFlash(FPGA_OFFSET); break; case COMMAND_REPLACE_FLASH_VIA_XMODEM: printf("Updating FLASH image\r\n"); - UpdateFlash(0); + UpdateFlash(FLASH_OFFSET); break; default: break; ==== //depot/projects/arm/src/sys/boot/arm/at91/bootspi/loader_prompt.h#6 (text+ko) ==== @@ -41,6 +41,8 @@ COMMAND_WRITE, COMMAND_XMODEM, COMMAND_RESET, + COMMAND_LOAD_SPI_KERNEL, + COMMAND_REPLACE_KERNEL_VIA_XMODEM, COMMAND_REPLACE_FLASH_VIA_XMODEM, COMMAND_REPLACE_FPGA_VIA_XMODEM, COMMAND_FINAL_FLAG
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200605261958.k4QJwjhM015534>