summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorYinghai Lu <yinghailu@gmail.com>2004-10-20 05:07:16 +0000
committerYinghai Lu <yinghailu@gmail.com>2004-10-20 05:07:16 +0000
commit6a61d6a4ae26d02844bf8043525d89b0ef9e0351 (patch)
treeffe2c7e2680ccb73502fe4129b9727051792dadb /util
parentabed01d81d0c55848232a9ebd9bb4c55d036f45d (diff)
downloadcoreboot-6a61d6a4ae26d02844bf8043525d89b0ef9e0351.tar.xz
Tyan update to work with new CPU Config
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1693 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util')
-rw-r--r--util/flash_and_burn/flash_rom.c70
-rw-r--r--util/flash_and_burn/pm49fl004.c9
2 files changed, 74 insertions, 5 deletions
diff --git a/util/flash_and_burn/flash_rom.c b/util/flash_and_burn/flash_rom.c
index 3fd56e31d8..d0d3b80794 100644
--- a/util/flash_and_burn/flash_rom.c
+++ b/util/flash_and_burn/flash_rom.c
@@ -3,6 +3,8 @@
*
*
* Copyright 2000 Silicon Integrated System Corporation
+ * Copyright 2004 Tyan Corp
+ * yhlu yhlu@tyan.com add exclude start and end option
*
* 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
@@ -49,6 +51,7 @@
#include "sst_fwhub.h"
struct flashchip flashchips[] = {
+#if 1
{"Am29F040B", AMD_ID, AM_29F040B, NULL, 512, 64 * 1024,
probe_29f040b, erase_29f040b, write_29f040b, NULL},
{"At29C040A", ATMEL_ID, AT_29C040A, NULL, 512, 256,
@@ -75,8 +78,10 @@ struct flashchip flashchips[] = {
probe_jedec, erase_chip_jedec, write_49lf040,NULL},
{"SST49LF008A", SST_ID, SST_49LF008A, NULL, 1024, 4096,
probe_sst_fwhub, erase_sst_fwhub, write_sst_fwhub, NULL},
+#endif
{"Pm49FL004", PMC_ID, PMC_49FL004, NULL, 512, 64 * 1024,
probe_jedec, erase_chip_jedec, write_49fl004,NULL},
+#if 1
{"W29C011", WINBOND_ID, W_29C011, NULL, 128, 128,
probe_jedec, erase_chip_jedec, write_jedec, NULL},
{"W29C020C", WINBOND_ID, W_29C020C, NULL, 256, 128,
@@ -93,6 +98,7 @@ struct flashchip flashchips[] = {
MSYSTEMS_ID, MSYSTEMS_MD2802,
NULL, 8, 8 * 1024,
probe_md2802, erase_md2802, write_md2802, read_md2802},
+#endif
{NULL,}
};
@@ -171,16 +177,20 @@ int verify_flash(struct flashchip *flash, char *buf, int verbose)
void usage(const char *name)
{
- printf("usage: %s [-rwv] [-c chipname][file]\n", name);
+ printf("usage: %s [-rwv] [-c chipname] [-s exclude_start] [-e exclude_end] [file]\n", name);
printf("-r: read flash and save into file\n"
"-w: write file into flash (default when file is specified)\n"
"-v: verify flash against file\n"
"-c: probe only for specified flash chip\n"
+ "-s: exclude start position\n"
+ "-e: exclude end postion\n"
" If no file is specified, then all that happens\n"
" is that flash info is dumped\n");
exit(1);
}
+int exclude_start_page, exclude_end_page;
+
int main(int argc, char *argv[])
{
char *buf;
@@ -191,9 +201,34 @@ int main(int argc, char *argv[])
int read_it = 0, write_it = 0, verify_it = 0, verbose = 0;
char *filename = NULL;
+
+ unsigned int exclude_start_position=0, exclude_end_position=0; // [x,y)
+ char *tempstr=NULL;
+#if 0
+
+#if 1
+ /* Keep fallback image */
+ exclude_start_position = 0x60000;
+ exclude_end_position = 0x80000;
+#else
+ /* Keep DMI etc. */
+ exclude_start_position = 0x60000;
+ exclude_end_position = 0x70000;
+#endif
+
+#endif
+
+ if (argc > 1) {
+ /* Yes, print them. */
+ int i;
+ printf ("The arguments are:\n");
+ for (i = 1; i < argc; ++i)
+ printf ("%s\n", argv[i]);
+ }
+
setbuf(stdout, NULL);
- while ((opt = getopt(argc, argv, "rwvVc:")) != EOF) {
+ while ((opt = getopt(argc, argv, "rwvVc:s:e:")) != EOF) {
switch (opt) {
case 'r':
read_it = 1;
@@ -210,11 +245,22 @@ int main(int argc, char *argv[])
case 'V':
verbose = 1;
break;
+ case 's':
+ tempstr = strdup(optarg);
+ sscanf(tempstr,"%x",&exclude_start_position);
+ break;
+ case 'e':
+ tempstr = strdup(optarg);
+ sscanf(tempstr,"%x",&exclude_end_position);
+ break;
+
default:
usage(argv[0]);
break;
}
}
+
+
if (read_it && write_it) {
printf("-r and -w are mutually exclusive\n");
usage(argv[0]);
@@ -239,7 +285,8 @@ int main(int argc, char *argv[])
printf("Part is %s\n", flash->name);
if (!filename) {
- printf("OK, only ENABLING flash write, but NOT FLASHING\n");
+ printf
+ ("OK, only ENABLING flash write, but NOT FLASHING\n");
return 0;
}
size = flash->total_size * 1024;
@@ -255,6 +302,10 @@ int main(int argc, char *argv[])
memcpy(buf, (const char *) flash->virt_addr, size);
else
flash->read(flash, buf);
+
+ if(exclude_end_position - exclude_start_position > 0)
+ memset(buf+exclude_start_position, 0, exclude_end_position-exclude_start_position);
+
fwrite(buf, sizeof(char), size, image);
fclose(image);
printf("done\n");
@@ -267,8 +318,19 @@ int main(int argc, char *argv[])
fclose(image);
}
- if (write_it || (!read_it && !verify_it))
+ if(exclude_end_position - exclude_start_position > 0)
+ memcpy(buf+exclude_start_position, (const char *) flash->virt_addr+exclude_start_position,
+ exclude_end_position-exclude_start_position);
+
+ exclude_start_page = exclude_start_position/flash->page_size;
+ if((exclude_start_position%flash->page_size) != 0) {
+ exclude_start_page++;
+ }
+ exclude_end_page = exclude_end_position/flash->page_size;
+
+ if (write_it || (!read_it && !verify_it)) {
flash->write(flash, buf);
+ }
if (verify_it)
verify_flash(flash, buf, verbose);
return 0;
diff --git a/util/flash_and_burn/pm49fl004.c b/util/flash_and_burn/pm49fl004.c
index cbb1f7ef9d..a3f42faf07 100644
--- a/util/flash_and_burn/pm49fl004.c
+++ b/util/flash_and_burn/pm49fl004.c
@@ -3,6 +3,7 @@
*
*
* Copyright 2004 Tyan Corporation
+ * yhlu yhlu@tyan.com add exclude range
*
* 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
@@ -55,15 +56,21 @@ static __inline__ int erase_block_49fl004(volatile unsigned char *bios,
return (0);
}
+
+extern int exclude_start_page, exclude_end_page;
+
int write_49fl004(struct flashchip *flash, unsigned char *buf)
{
int i;
int total_size = flash->total_size * 1024, page_size =
flash->page_size;
volatile char *bios = flash->virt_addr;
-
+
printf("Programming Page: ");
for (i = 0; i < total_size / page_size; i++) {
+ if( (i>=exclude_start_page) && (i<exclude_end_page))
+ continue;
+
/* erase the page before programming */
erase_block_49fl004(bios, i * page_size);