[flashrom] Re: patch for allowing the use of the SOCKET target of the SF600

2019-01-14 Thread David Hendricks
Looks good to me. Thanks!

FWIW, I actually wrote a patch that is very similar, but never quite
completed it: https://review.coreboot.org/c/flashrom/+/19673

So at least we know your patch is already tested ;-)

On Mon, Jan 14, 2019 at 5:02 AM Florian Kaiser 
wrote:

> Hello Nico,
>
> thanks for your feedback! I attached an improved patch that hopefully
> solves
> these issues.
>
> Thanks a lot!
>
> Florian
>
> Am Sonntag, 23. Dezember 2018, 14:34:16 schrieb Nico Huber:
> > Hello Florian,
> >
> > thanks for your patch, I've commented on it inline.
> >
> > On 10.12.18 11:05, Florian Kaiser wrote:
> > > I am using this patch for a while now and I did not encounter any
> > > problems. I am not sure if this was/is not supported. Is there any
> reason
> > > why this is not supported?
> >
> > No reason beside that nobody cared about it yet, I guess.
> >
> > Nico
> >
> > > From 5df0b1ff7bb95f4384c98727a56a03660dde6aaa Mon Sep 17 00:00:00 2001
> > > From: Florian Kaiser 
> > > Date: Tue, 31 Jul 2018 13:42:22 +0200
> > > Subject: [PATCH] dediprog: allow the use of the programming target
> > > "socket".
> > >
> > > Change-Id: I8c5120ce2151138093be0f27951916ec7f725574
> > > Signed-off-by: Florian Kaiser 
> > > ---
> > >
> > >  dediprog.c  | 6 +-
> > >  flashrom.8.tmpl | 5 +++--
> > >  2 files changed, 8 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/dediprog.c b/dediprog.c
> > > index 72818ea..0eb84ec 100644
> > > --- a/dediprog.c
> > > +++ b/dediprog.c
> > > @@ -1028,7 +1028,7 @@ int dediprog_init(void)
> > >
> > > free(target_str);
> > > return 1;
> > >
> > > }
> > >
> > > -   if (target < 1 || target > 2) {
> > > +   if (target < 1 || target > 3) {
> > >
> > > msg_perr("Error: Value for 'target' is out of
> range.\n");
> > > free(target_str);
> > > return 1;
> > >
> > > @@ -1047,6 +1047,10 @@ int dediprog_init(void)
> > >
> > > msg_pinfo("Using target %s.\n",
> "FLASH_TYPE_APPLICATION_FLASH_2");
> > > target = FLASH_TYPE_APPLICATION_FLASH_2;
> > > break;
> > >
> > > +   case 3:
> > > +   msg_pinfo("Using target %s.\n",
> "FLASH_TYPE_SOCKET");
> > > +   target = FLASH_TYPE_SOCKET;
> > > +   break;
> >
> > This makes a flaw in set_target_flash() obvious now. Not all programmers
> > have a socket. I just checked set_target_flash() silently fails with an
> > SF 100. So we should check for compatibility there or at the calling
> > site.
> >
> > > default:
> > > break;
> > >
> > > }
> > >
> > > diff --git a/flashrom.8.tmpl b/flashrom.8.tmpl
> > > index c557af7..04fd1c8 100644
> > > --- a/flashrom.8.tmpl
> > > +++ b/flashrom.8.tmpl
> > > @@ -946,8 +946,9 @@ parameter specifies which target chip should be
> used.
> > > Syntax is>
> > >  where
> > >  .B value
> > >  can be
> > >
> > > -.BR 1 " or " 2
> > > -to select target chip 1 or 2 respectively. The default is target chip
> 1.
> > > +.BR 1 ", " 2 " or " 3
> > > +to select target chip 1 or 2 respectively. The default is target chip
> 1.
> > > To use the programming socket
> > This reads confusing now (set 1, 2 or 3 to choose between 1 and 2?).
> >
> > > +of the SF600 you need to select target 3.
> > >
> > >  .SS
>
> --
> Mit freundlichen Grüssen
>
> Florian Kaiser
> Microkernel Systems Development
> tel +49 89 991950 - 320
>
> ~~~
> genua
> Gesellschaft für Netzwerk - und Unix-Administration mbH
> Domagkstr. 7, D-85551 Kirchheim. http://www.genua.de
> Tel: (089) 99 19 50-0, Fax: (089) 99 19 50 - 999
>
> Geschaeftsfuehrer: Matthias Ochs, Marc Tesch
> Amtsgericht Muenchen HRB 98238
> 
> --
> Mit freundlichen Grüssen
>
> Florian Kaiser
> Microkernel Systems Development
> tel +49 89 991950 - 320
>
> ~~~
> genua
> Gesellschaft für Netzwerk - und Unix-Administration mbH
> Domagkstr. 7, D-85551 Kirchheim. http://www.genua.de
> Tel: (089) 99 19 50-0, Fax: (089) 99 19 50 - 999
>
> Geschaeftsfuehrer: Matthias Ochs, Marc Tesch
> Amtsgericht Muenchen HRB 98238
> 
> ___
> flashrom mailing list -- flashrom@flashrom.org
> To unsubscribe send an email to flashrom-le...@flashrom.org
>
___
flashrom mailing list -- flashrom@flashrom.org
To unsubscribe send an email to flashrom-le...@flashrom.org


[flashrom] Re: ENE KB9012QF A3 reflash help needed

2019-01-14 Thread Mike Banon
That is because KB9012 is active after your laptop has booted and not
in debug state where it is possible to reflash it without a problem.

Have you double checked your laptop's datasheet to make sure your
connection is correct, and also that your laptop's corner ground is
really connected to its' ground? (what if not all its' copper circles
are the grounds in your case)

On Fri, Jan 11, 2019 at 5:01 PM Nyúlós Lónyál  wrote:
>
> Sorry for double mail. Erasing and writing fails too.
>
> xubuntu@xubuntu:~/flashrom$ sudo ./flashrom -p internal -c "KB9012 (EDI)" -w 
> /home/xubuntu/Desktop/EC-FD-Extract.bin
> flashrom p1.0-141-g9cecc7e on Linux 4.15.0-20-generic (x86_64)
> flashrom is free software, get the source code at https://flashrom.org
>
> Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
> Found chipset "Intel ICH7/ICH7R".
> Enabling flash write... OK.
> edi_read: Retrying read with greater buffer length!
> edi_read: Retrying read with greater buffer length!
> Found ENE flash chip "KB9012 (EDI)" (128 kB, SPI) mapped at physical address 
> 0xfffe.
> Reading old flash chip contents... done.
> Erasing and writing flash chip... edi_chip_block_erase: Timed out waiting for 
> SPI not busy!
> Reading current flash chip contents... done. Looking for another erase 
> function.
> Looking for another erase function.
> Looking for another erase function.
> Looking for another erase function.
> Looking for another erase function.
> Looking for another erase function.
> Looking for another erase function.
> No usable erase functions left.
> FAILED!
> Uh oh. Erase/write failed. Checking if anything has changed.
> Reading current flash chip contents... done.
> Apparently at least some data has changed.
> Your flash chip is in an unknown state.
> Get help on IRC at chat.freenode.net (channel #flashrom) or
> mail flashrom@flashrom.org with the subject "FAILED: "!
> ---
> DO NOT REBOOT OR POWEROFF!
>
> xubuntu@xubuntu:~/flashrom$ sudo ./flashrom -p internal -c "KB9012 (EDI)" -E
> flashrom p1.0-141-g9cecc7e on Linux 4.15.0-20-generic (x86_64)
> flashrom is free software, get the source code at https://flashrom.org
>
> Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
> Found chipset "Intel ICH7/ICH7R".
> Enabling flash write... OK.
> edi_read: Retrying read with greater buffer length!
> edi_read: Retrying read with greater buffer length!
> Found ENE flash chip "KB9012 (EDI)" (128 kB, SPI) mapped at physical address 
> 0xfffe.
> Erasing and writing flash chip... edi_chip_block_erase: Timed out waiting for 
> SPI not busy!
> Looking for another erase function.
> Looking for another erase function.
> Looking for another erase function.
> Looking for another erase function.
> Looking for another erase function.
> Looking for another erase function.
> Looking for another erase function.
> No usable erase functions left.
> FAILED!
> Your flash chip is in an unknown state.
> Get help on IRC at chat.freenode.net (channel #flashrom) or
> mail flashrom@flashrom.org with the subject "FAILED: "!
> ---
> DO NOT REBOOT OR POWEROFF!
>
> Nyúlós Lónyál  ezt írta (időpont: 2019. jan. 11., 
> P, 13:49):
>>
>> Finally managed it to detect KBC's internal flash using the motherboard's 
>> BIOS socket with removing it's SPI chip after boot, and connecting KB9012 in 
>> there. But the read always gives me different files, so I can't backup the 
>> current content of KB9012.
>>
>> xubuntu@xubuntu:~/flashrom$ sudo ./flashrom -p internal -c "KB9012 (EDI)" -r 
>> /home/xubuntu/Desktop/ene1.bin
>> flashrom p1.0-141-g9cecc7e on Linux 4.15.0-20-generic (x86_64)
>> flashrom is free software, get the source code at https://flashrom.org
>>
>> Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
>> Found chipset "Intel ICH7/ICH7R".
>> Enabling flash write... OK.
>> edi_read: Retrying read with greater buffer length!
>> edi_read: Retrying read with greater buffer length!
>> Found ENE flash chip "KB9012 (EDI)" (128 kB, SPI) mapped at physical address 
>> 0xfffe.
>> Reading flash... done.
>> xubuntu@xubuntu:~/flashrom$ sudo ./flashrom -p internal -c "KB9012 (EDI)" -v 
>> /home/xubuntu/Desktop/ene1.bin
>> flashrom p1.0-141-g9cecc7e on Linux 4.15.0-20-generic (x86_64)
>> flashrom is free software, get the source code at https://flashrom.org
>>
>> Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
>> Found chipset "Intel ICH7/ICH7R".
>> Enabling flash write... OK.
>> edi_read: Retrying read with greater buffer length!
>> edi_read: Retrying read with greater buffer length!
>> Found ENE flash chip "KB9012 (EDI)" (128 kB, SPI) mapped at physical address 
>> 0xfffe.
>> Verifying flash... FAILED at 0x34c2! Expected=0xff, Found=0x78, failed 
>> byte count from 0x-0x0001: 0x6c52
>>
>>
>> Nyúlós 

[flashrom] Re: patch for allowing the use of the SOCKET target of the SF600

2019-01-14 Thread Florian Kaiser
Hello Nico,

thanks for your feedback! I attached an improved patch that hopefully solves 
these issues.

Thanks a lot!

Florian

Am Sonntag, 23. Dezember 2018, 14:34:16 schrieb Nico Huber:
> Hello Florian,
> 
> thanks for your patch, I've commented on it inline.
> 
> On 10.12.18 11:05, Florian Kaiser wrote:
> > I am using this patch for a while now and I did not encounter any
> > problems. I am not sure if this was/is not supported. Is there any reason
> > why this is not supported?
> 
> No reason beside that nobody cared about it yet, I guess.
> 
> Nico
> 
> > From 5df0b1ff7bb95f4384c98727a56a03660dde6aaa Mon Sep 17 00:00:00 2001
> > From: Florian Kaiser 
> > Date: Tue, 31 Jul 2018 13:42:22 +0200
> > Subject: [PATCH] dediprog: allow the use of the programming target
> > "socket".
> > 
> > Change-Id: I8c5120ce2151138093be0f27951916ec7f725574
> > Signed-off-by: Florian Kaiser 
> > ---
> > 
> >  dediprog.c  | 6 +-
> >  flashrom.8.tmpl | 5 +++--
> >  2 files changed, 8 insertions(+), 3 deletions(-)
> > 
> > diff --git a/dediprog.c b/dediprog.c
> > index 72818ea..0eb84ec 100644
> > --- a/dediprog.c
> > +++ b/dediprog.c
> > @@ -1028,7 +1028,7 @@ int dediprog_init(void)
> > 
> > free(target_str);
> > return 1;
> > 
> > }
> > 
> > -   if (target < 1 || target > 2) {
> > +   if (target < 1 || target > 3) {
> > 
> > msg_perr("Error: Value for 'target' is out of 
> > range.\n");
> > free(target_str);
> > return 1;
> > 
> > @@ -1047,6 +1047,10 @@ int dediprog_init(void)
> > 
> > msg_pinfo("Using target %s.\n", 
"FLASH_TYPE_APPLICATION_FLASH_2");
> > target = FLASH_TYPE_APPLICATION_FLASH_2;
> > break;
> > 
> > +   case 3:
> > +   msg_pinfo("Using target %s.\n", "FLASH_TYPE_SOCKET");
> > +   target = FLASH_TYPE_SOCKET;
> > +   break;
> 
> This makes a flaw in set_target_flash() obvious now. Not all programmers
> have a socket. I just checked set_target_flash() silently fails with an
> SF 100. So we should check for compatibility there or at the calling
> site.
> 
> > default:
> > break;
> > 
> > }
> > 
> > diff --git a/flashrom.8.tmpl b/flashrom.8.tmpl
> > index c557af7..04fd1c8 100644
> > --- a/flashrom.8.tmpl
> > +++ b/flashrom.8.tmpl
> > @@ -946,8 +946,9 @@ parameter specifies which target chip should be used.
> > Syntax is> 
> >  where
> >  .B value
> >  can be
> > 
> > -.BR 1 " or " 2
> > -to select target chip 1 or 2 respectively. The default is target chip 1.
> > +.BR 1 ", " 2 " or " 3
> > +to select target chip 1 or 2 respectively. The default is target chip 1.
> > To use the programming socket
> This reads confusing now (set 1, 2 or 3 to choose between 1 and 2?).
> 
> > +of the SF600 you need to select target 3.
> > 
> >  .SS

-- 
Mit freundlichen Grüssen

Florian Kaiser
Microkernel Systems Development
tel +49 89 991950 - 320

~~~
genua
Gesellschaft für Netzwerk - und Unix-Administration mbH
Domagkstr. 7, D-85551 Kirchheim. http://www.genua.de
Tel: (089) 99 19 50-0, Fax: (089) 99 19 50 - 999

Geschaeftsfuehrer: Matthias Ochs, Marc Tesch
Amtsgericht Muenchen HRB 98238

-- 
Mit freundlichen Grüssen

Florian Kaiser
Microkernel Systems Development
tel +49 89 991950 - 320

~~~
genua
Gesellschaft für Netzwerk - und Unix-Administration mbH
Domagkstr. 7, D-85551 Kirchheim. http://www.genua.de
Tel: (089) 99 19 50-0, Fax: (089) 99 19 50 - 999

Geschaeftsfuehrer: Matthias Ochs, Marc Tesch
Amtsgericht Muenchen HRB 98238

>From f452463c4592f5ef2f7c52929eac885b8c153948 Mon Sep 17 00:00:00 2001
From: Florian Kaiser 
Date: Tue, 31 Jul 2018 13:42:22 +0200
Subject: [PATCH] dediprog: allow the use of the programming target "socket".

Change-Id: I8c5120ce2151138093be0f27951916ec7f725574
Signed-off-by: Florian Kaiser 
---
 dediprog.c  | 15 +--
 flashrom.8.tmpl |  5 +++--
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/dediprog.c b/dediprog.c
index 72818ea..0f7da9f 100644
--- a/dediprog.c
+++ b/dediprog.c
@@ -860,7 +860,14 @@ static int dediprog_command_b(void)
 
 static int set_target_flash(enum dediprog_target target)
 {
-	int ret = dediprog_write(CMD_SET_TARGET, target, 0, NULL, 0);
+	int ret;
+
+	if (dediprog_devicetype != DEV_SF600 && target == FLASH_TYPE_SOCKET) {
+		msg_perr("Target type 'FLASH_TYPE_SOCKET' can only be used with a SF600 Programmer.\n");
+		return 1;
+	}
+
+	ret = dediprog_write(CMD_SET_TARGET, target, 0, NULL, 0);
 	if (ret != 0) {
 		msg_perr("set_target_flash failed (%s)!\n", libusb_error_name(ret));
 		return 1;