Index: flash.h
===================================================================
--- flash.h	(revision 580)
+++ flash.h	(working copy)
@@ -713,6 +713,7 @@
 void map_flash_registers(struct flashchip *flash);
 int read_memmapped(struct flashchip *flash, uint8_t *buf);
 extern char *pcidev_bdf;
+struct flashchip *current_flashchip;
 
 /* layout.c */
 int show_id(uint8_t *bios, int size, int force);
Index: flashrom.c
===================================================================
--- flashrom.c	(revision 580)
+++ flashrom.c	(working copy)
@@ -33,6 +33,7 @@
 int exclude_start_page, exclude_end_page;
 int verbose = 0;
 int programmer = PROGRAMMER_INTERNAL;
+struct flashchip* current_flashchip;
 
 const struct programmer_entry programmer_table[] = {
 	{
@@ -247,6 +248,7 @@
 	char *tmp;
 
 	for (flash = first_flash; flash && flash->name; flash++) {
+		current_flashchip = flash;
 		if (chip_to_probe && strcmp(flash->name, chip_to_probe) != 0)
 			continue;
 		printf_debug("Probing for %s %s, %d KB: ",
@@ -707,7 +709,7 @@
 		exit(1);
 	}
 
-	flash = flashes[0];
+	current_flashchip = flash = flashes[0];
 
 	if (TEST_OK_MASK != (flash->tested & TEST_OK_MASK)) {
 		printf("===\n");
