From owner-p4-projects@FreeBSD.ORG Fri May 26 19:59:50 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 2CA9416A5FB; Fri, 26 May 2006 19:59:50 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E7C0516A59A for ; Fri, 26 May 2006 19:59:46 +0000 (UTC) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id ADB5043D48 for ; Fri, 26 May 2006 19:59:46 +0000 (GMT) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k4QJwjx5015537 for ; Fri, 26 May 2006 19:58:45 GMT (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k4QJwjhM015534 for perforce@freebsd.org; Fri, 26 May 2006 19:58:45 GMT (envelope-from imp@freebsd.org) Date: Fri, 26 May 2006 19:58:45 GMT Message-Id: <200605261958.k4QJwjhM015534@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Cc: Subject: PERFORCE change 97903 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 May 2006 19:59:55 -0000 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 -.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
" + if (argc > 1) + LoadKernelFromSpi((char *)p_ASCIIToHex(argv[1])); + break; + case COMMAND_XMODEM: // "x
" // 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