[coreboot] [flashrom] r625 - trunk

svn at coreboot.org svn at coreboot.org
Tue Jun 23 13:33:43 CEST 2009


Author: hailfinger
Date: 2009-06-23 13:33:43 +0200 (Tue, 23 Jun 2009)
New Revision: 625

Added:
   trunk/serprog.c
Modified:
   trunk/Makefile
   trunk/flash.h
   trunk/flashrom.c
Log:
Initial commit of an external serial flasher protocol.
Supports RS-232, USB serial converters (untested) and TCP streams.

All functionality is stubbed out to allow multiplatform compile testing
of the headers we use.
The real serial flasher protocol driver will be committed next.

Signed-off-by: Urja Rannikko <urjaman at gmail.com>
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>


Modified: trunk/Makefile
===================================================================
--- trunk/Makefile	2009-06-23 10:44:36 UTC (rev 624)
+++ trunk/Makefile	2009-06-23 11:33:43 UTC (rev 625)
@@ -49,7 +49,8 @@
 	sst49lfxxxc.o sst_fwhub.o layout.o cbtable.o flashchips.o physmap.o \
 	flashrom.o w39v080fa.o sharplhf00l04.o w29ee011.o spi.o it87spi.o \
 	ichspi.o w39v040c.o sb600spi.o wbsio_spi.o m29f002.o internal.o \
-	dummyflasher.o pcidev.o nic3com.o satasii.o ft2232_spi.o print.o
+	dummyflasher.o pcidev.o nic3com.o satasii.o ft2232_spi.o serprog.o \
+	print.o
 
 all: pciutils features dep $(PROGRAM)
 

Modified: trunk/flash.h
===================================================================
--- trunk/flash.h	2009-06-23 10:44:36 UTC (rev 624)
+++ trunk/flash.h	2009-06-23 11:33:43 UTC (rev 625)
@@ -87,6 +87,7 @@
 #define PROGRAMMER_SATASII	0x03
 #define PROGRAMMER_IT87SPI	0x04
 #define PROGRAMMER_FT2232SPI	0x05
+#define PROGRAMMER_SERPROG	0x06
 
 struct programmer_entry {
 	const char *vendor;
@@ -585,4 +586,12 @@
 int erase_stm50flw0x0x(struct flashchip *flash);
 int write_stm50flw0x0x(struct flashchip *flash, uint8_t *buf);
 
+/* serprog.c */
+extern char* serprog_param;
+int serprog_init(void);
+int serprog_shutdown(void);
+void serprog_chip_writeb(uint8_t val, chipaddr addr);
+uint8_t serprog_chip_readb(const chipaddr addr);
+void serprog_chip_readn(uint8_t *buf, const chipaddr addr, size_t len);
+void serprog_delay(int delay);
 #endif				/* !__FLASH_H__ */

Modified: trunk/flashrom.c
===================================================================
--- trunk/flashrom.c	2009-06-23 10:44:36 UTC (rev 624)
+++ trunk/flashrom.c	2009-06-23 11:33:43 UTC (rev 625)
@@ -130,6 +130,21 @@
 		.chip_writen		= fallback_chip_writen,
 		.delay			= internal_delay,
 	},
+	{
+		.init			= serprog_init,
+		.shutdown		= serprog_shutdown,
+		.map_flash_region	= fallback_map,
+		.unmap_flash_region	= fallback_unmap,
+		.chip_readb		= serprog_chip_readb,
+		.chip_readw		= fallback_chip_readw,
+		.chip_readl		= fallback_chip_readl,
+		.chip_readn		= serprog_chip_readn,
+		.chip_writeb		= serprog_chip_writeb,
+		.chip_writew		= fallback_chip_writew,
+		.chip_writel		= fallback_chip_writel,
+		.chip_writen		= fallback_chip_writen,
+		.delay			= serprog_delay,
+	},
 
 	{},
 };
@@ -500,7 +515,7 @@
 	     "   -z | --list-supported-wiki:       print supported devices in wiki syntax\n"
 	     "   -p | --programmer <name>:         specify the programmer device\n"
 	     "                                     (internal, dummy, nic3com, satasii,\n"
-	     "                                     it87spi, ft2232spi)\n"
+	     "                                     it87spi, ft2232spi, serprog)\n"
 	     "   -h | --help:                      print this help text\n"
 	     "   -R | --version:                   print the version (release)\n"
 	     "\nYou can specify one of -E, -r, -w, -v or no operation. "
@@ -653,6 +668,10 @@
 				programmer = PROGRAMMER_IT87SPI;
 			} else if (strncmp(optarg, "ft2232spi", 9) == 0) {
 				programmer = PROGRAMMER_FT2232SPI;
+ 			} else if (strncmp(optarg, "serprog", 7) == 0) {
+ 				programmer = PROGRAMMER_SERPROG;
+ 				if (optarg[7] == '=')
+ 					serprog_param = strdup(optarg + 8);
 			} else {
 				printf("Error: Unknown programmer.\n");
 				exit(1);

Added: trunk/serprog.c
===================================================================
--- trunk/serprog.c	                        (rev 0)
+++ trunk/serprog.c	2009-06-23 11:33:43 UTC (rev 625)
@@ -0,0 +1,80 @@
+/*
+ * This file is part of the flashrom project.
+ *
+ * Copyright (C) 2009 Urja Rannikko <urjaman at gmail.com>
+ * Copyright (C) 2009 Carl-Daniel Hailfinger
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ */
+
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <netdb.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <inttypes.h>
+#include <termios.h>
+#include "flash.h"
+
+char *serprog_param = NULL;
+
+#define SERPROG_SUPPORT 0
+#if SERPROG_SUPPORT == 1
+#else
+int serprog_init(void)
+{
+	fprintf(stderr, "Serial programmer support was not compiled in\n");
+	exit(1);
+}
+
+int serprog_shutdown(void)
+{
+	fprintf(stderr, "Serial programmer support was not compiled in\n");
+	exit(1);
+}
+
+void serprog_chip_writeb(uint8_t val, chipaddr addr)
+{
+	fprintf(stderr, "Serial programmer support was not compiled in\n");
+	exit(1);
+}
+
+uint8_t serprog_chip_readb(const chipaddr addr)
+{
+	fprintf(stderr, "Serial programmer support was not compiled in\n");
+	exit(1);
+}
+
+void serprog_chip_readn(uint8_t *buf, const chipaddr addr, size_t len)
+{
+	fprintf(stderr, "Serial programmer support was not compiled in\n");
+	exit(1);
+}
+
+void serprog_delay(int delay)
+{
+	fprintf(stderr, "Serial programmer support was not compiled in\n");
+	exit(1);
+}
+#endif





More information about the coreboot mailing list