Attention is currently required from: Dmitry Zhadinets.
Anastasia Klimchuk has posted comments on this change by Dmitry Zhadinets. ( https://review.coreboot.org/c/flashrom/+/86921?usp=email )
Change subject: libflashrom: Added API to enumerate supported programmers
......................................................................
Patch Set 2:
(2 comments)
File tests/libflashrom.c:
https://review.coreboot.org/c/flashrom/+/86921/comment/a3bc684b_95243370?us… :
PS2, Line 22: enumerators_test_success
I would rename this to `flashrom_supported_programmers_test_success` to use the same name as the function which is being tested.
So that it's super obvious what the test is testing.
(and in the next patch you will need to create a new test method, but I will comment there too)
https://review.coreboot.org/c/flashrom/+/86921/comment/f4005871_86c305a4?us… :
PS2, Line 24: (void) state; /* unused */
: const char** array = flashrom_supported_programmers();
: const char** ptr = array;
: assert_non_null(array);
: while (*(ptr++)){}
: flashrom_data_free(array);
: assert_int_not_equal(ptr - array, 0);
This needs a fix for the indentation (use tabs always)
Maybe you saw that already, but just in case, our code style is documented here: https://flashrom.org/dev_guide/development_guide.html#coding-style
Also, for readability, if you could add few more new lines: between 26-27, b/w 27-28, b/w 29-30
--
To view, visit https://review.coreboot.org/c/flashrom/+/86921?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: flashrom
Gerrit-Branch: main
Gerrit-Change-Id: Ib5275b742b849183b1fe701900040fee369a1d78
Gerrit-Change-Number: 86921
Gerrit-PatchSet: 2
Gerrit-Owner: Dmitry Zhadinets <dzhadinets(a)gmail.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Dmitry Zhadinets <dzhadinets(a)gmail.com>
Gerrit-Comment-Date: Fri, 21 Mar 2025 06:31:38 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Attention is currently required from: Dmitry Zhadinets.
Peter Marheine has posted comments on this change by Dmitry Zhadinets. ( https://review.coreboot.org/c/flashrom/+/86921?usp=email )
Change subject: libflashrom: Added API to enumerate supported programmers
......................................................................
Patch Set 2:
(2 comments)
File include/libflashrom.h:
https://review.coreboot.org/c/flashrom/+/86921/comment/fe0f46fe_73394f25?us… :
PS1, Line 166: * @return List of supported programmers, or NULL if an error occurred.
Just to be explicit, this should say that the last entry in the returned list is followed by a NULL.
https://review.coreboot.org/c/flashrom/+/86921/comment/32d9d2b6_e0ffb585?us… :
PS1, Line 169: const char ** flashrom_supported_programmers(void);
> I thought about this but flashrom already uses such approach in all […]
That the existing enumeration APIs return copies (I didn't realize that!) seems like a good enough reason to do the same for this one, even if we'd design it differently now. It can stay as you wrote it.
--
To view, visit https://review.coreboot.org/c/flashrom/+/86921?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: flashrom
Gerrit-Branch: main
Gerrit-Change-Id: Ib5275b742b849183b1fe701900040fee369a1d78
Gerrit-Change-Number: 86921
Gerrit-PatchSet: 2
Gerrit-Owner: Dmitry Zhadinets <dzhadinets(a)gmail.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Dmitry Zhadinets <dzhadinets(a)gmail.com>
Gerrit-Comment-Date: Fri, 21 Mar 2025 05:37:20 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Dmitry Zhadinets <dzhadinets(a)gmail.com>
Comment-In-Reply-To: Peter Marheine <pmarheine(a)chromium.org>
Attention is currently required from: Anastasia Klimchuk.
Dmitry Zhadinets has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/86947?usp=email )
Change subject: libflashrom: Iterator like API to get list of programmers
......................................................................
libflashrom: Iterator like API to get list of programmers
Change-Id: I89cce7625e8731ee26331934f36cfd1c8c570225
Signed-off-by: Dmitry Zhadinets <dzhadinets(a)gmail.com>
---
M include/libflashrom.h
M libflashrom.c
M libflashrom.map
M tests/libflashrom.c
4 files changed, 22 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/47/86947/1
diff --git a/include/libflashrom.h b/include/libflashrom.h
index 7f90fa4..7ee60a8 100644
--- a/include/libflashrom.h
+++ b/include/libflashrom.h
@@ -168,6 +168,13 @@
*/
const char ** flashrom_supported_programmers(void);
/**
+ * @brief Return the name of the programmer with the given ID, starting from 0.
+ *
+ * @return NULL if n is larger than the number of available programmers or less
+ * than zero.
+ */
+const char *flashrom_get_programmer_name(int n);
+/**
* @brief Returns list of supported flash chips
* @return List of supported flash chips, or NULL if an error occurred
*/
diff --git a/libflashrom.c b/libflashrom.c
index 76ab32a..ad19073 100644
--- a/libflashrom.c
+++ b/libflashrom.c
@@ -156,6 +156,13 @@
return result;
}
+const char *flashrom_get_programmer_name(int n)
+{
+ if (n < 0 || (size_t)n >= programmer_table_size)
+ return NULL;
+ return programmer_table[n]->name;
+}
+
struct flashrom_flashchip_info *flashrom_supported_flash_chips(void)
{
struct flashrom_flashchip_info *supported_flashchips =
diff --git a/libflashrom.map b/libflashrom.map
index 9af163e..e2c734e 100644
--- a/libflashrom.map
+++ b/libflashrom.map
@@ -7,6 +7,7 @@
flashrom_flash_getsize;
flashrom_flash_probe;
flashrom_flash_release;
+ flashrom_get_programmer_name;
flashrom_image_read;
flashrom_image_verify;
flashrom_image_write;
diff --git a/tests/libflashrom.c b/tests/libflashrom.c
index 173c8a9..653df28 100644
--- a/tests/libflashrom.c
+++ b/tests/libflashrom.c
@@ -1,7 +1,7 @@
/*
* This file is part of the flashrom project.
*
- * Copyright 2020 Google LLC
+ * Copyright 2025 Dmitry Zhadinets <dzhadinets(a)gmail.com>
*
* 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
@@ -18,6 +18,7 @@
#include <include/test.h>
#include "tests.h"
#include "libflashrom.h"
+ extern const size_t programmer_table_size;
void enumerators_test_success(void **state)
{
@@ -29,6 +30,11 @@
flashrom_data_free(array);
assert_int_not_equal(ptr - array, 0);
+ assert_null(flashrom_get_programmer_name(-1));
+ assert_non_null(flashrom_get_programmer_name(0));
+ assert_null(flashrom_get_programmer_name(programmer_table_size));
+ assert_non_null(flashrom_get_programmer_name(programmer_table_size - 1));
+
#if CONFIG_DUMMY == 1
struct flashrom_programmer *flashprog = NULL;
flashrom_programmer_init(&flashprog, "dummy", "emulate=SST25VF040.REMS");
--
To view, visit https://review.coreboot.org/c/flashrom/+/86947?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: flashrom
Gerrit-Branch: main
Gerrit-Change-Id: I89cce7625e8731ee26331934f36cfd1c8c570225
Gerrit-Change-Number: 86947
Gerrit-PatchSet: 1
Gerrit-Owner: Dmitry Zhadinets <dzhadinets(a)gmail.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Attention is currently required from: Peter Marheine.
Dmitry Zhadinets has posted comments on this change by Dmitry Zhadinets. ( https://review.coreboot.org/c/flashrom/+/86921?usp=email )
Change subject: libflashrom: Added API to enumerate supported programmers
......................................................................
Patch Set 1:
(1 comment)
File include/libflashrom.h:
https://review.coreboot.org/c/flashrom/+/86921/comment/4a70547f_2179c3d8?us… :
PS1, Line 169: const char ** flashrom_supported_programmers(void);
> I think this would be better avoiding any allocation, by exposing an iterator-like API. […]
I thought about this but flashrom already uses such approach in all
flashrom_supported_* functions i.e. https://review.coreboot.org/c/flashrom/+/86921/1/libflashrom.c#161
I'm not sure how to implement it in flashrom_programmer_capabilities because it is temporary data https://review.coreboot.org/c/flashrom/+/86922 . please take a look
I will implement both
--
To view, visit https://review.coreboot.org/c/flashrom/+/86921?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: flashrom
Gerrit-Branch: main
Gerrit-Change-Id: Ib5275b742b849183b1fe701900040fee369a1d78
Gerrit-Change-Number: 86921
Gerrit-PatchSet: 1
Gerrit-Owner: Dmitry Zhadinets <dzhadinets(a)gmail.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Comment-Date: Thu, 20 Mar 2025 23:19:28 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Peter Marheine <pmarheine(a)chromium.org>
Attention is currently required from: Anastasia Klimchuk, Dolan Liu, Nikolai Artemiev, Stefan Reinauer.
DZ has posted comments on this change by Dolan Liu. ( https://review.coreboot.org/c/flashrom/+/86348?usp=email )
Change subject: flashchips: Add Macronix MX77U25650FZ4I42
......................................................................
Patch Set 2: Code-Review+1
(1 comment)
Patchset:
PS2:
> Hello Daniel! I wanted to ask you, if you could help review this patch? It is not possible for me to […]
Hi Anastasia, I have compared this with RPMC datasheet, all the flashchip definition is correct.
--
To view, visit https://review.coreboot.org/c/flashrom/+/86348?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: flashrom
Gerrit-Branch: main
Gerrit-Change-Id: I7866b2db343f4eb2bc194400ceca099d3af3b87d
Gerrit-Change-Number: 86348
Gerrit-PatchSet: 2
Gerrit-Owner: Dolan Liu <liuyong5(a)huaqin.corp-partner.google.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: DZ <danielzhang(a)mxic.com.cn>
Gerrit-Reviewer: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Reviewer: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Dolan Liu <liuyong5(a)huaqin.corp-partner.google.com>
Gerrit-Attention: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Attention: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Comment-Date: Thu, 20 Mar 2025 05:58:25 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Anastasia Klimchuk <aklm(a)chromium.org>
Attention is currently required from: Dmitry Zhadinets.
Peter Marheine has posted comments on this change by Dmitry Zhadinets. ( https://review.coreboot.org/c/flashrom/+/86921?usp=email )
Change subject: libflashrom: Added API to enumerate supported programmers
......................................................................
Patch Set 1:
(2 comments)
Patchset:
PS1:
At least `list_programmers_linebreak` can be converted to use the new API, so it makes sense to do that.
File include/libflashrom.h:
https://review.coreboot.org/c/flashrom/+/86921/comment/305f6656_3d9d7212?us… :
PS1, Line 169: const char ** flashrom_supported_programmers(void);
I think this would be better avoiding any allocation, by exposing an iterator-like API. I was initially thinking something complex with an opaque iterator type, but then the user would need to call a function to allocate an iterator instance so just exposing an integer ID seems okay.
```
/**
* Return the name of the programmer with the given ID, starting from 0.
*
* Returns NULL if n is larger than the number of available programmers or less
* than zero.
*/
const char *flashrom_get_programmer_name(int n);
```
A possible downside is that it could be more challenging to support dynamic programmer detection (like if we were to add some kind of plugin architecture) with this API, but it is much easier for users to use this version because there's no dynamic allocation.
--
To view, visit https://review.coreboot.org/c/flashrom/+/86921?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: flashrom
Gerrit-Branch: main
Gerrit-Change-Id: Ib5275b742b849183b1fe701900040fee369a1d78
Gerrit-Change-Number: 86921
Gerrit-PatchSet: 1
Gerrit-Owner: Dmitry Zhadinets <dzhadinets(a)gmail.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Dmitry Zhadinets <dzhadinets(a)gmail.com>
Gerrit-Comment-Date: Thu, 20 Mar 2025 03:58:05 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Attention is currently required from: Dmitry Zhadinets, Peter Marheine.
Anastasia Klimchuk has posted comments on this change by Dmitry Zhadinets. ( https://review.coreboot.org/c/flashrom/+/86921?usp=email )
Change subject: libflashrom: Added API to enumerate supported programmers
......................................................................
Patch Set 1:
(2 comments)
Patchset:
PS1:
Dmitry thank you for your work! I will go through and respond to all the patches in a few days, but I wanted to say special thanks for adding tests :)
File tests/libflashrom.c:
https://review.coreboot.org/c/flashrom/+/86921/comment/744210ac_9c978d0e?us… :
PS1, Line 4: Copyright 2020 Google LLC
That's you are adding a new test, should be your name here
--
To view, visit https://review.coreboot.org/c/flashrom/+/86921?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: flashrom
Gerrit-Branch: main
Gerrit-Change-Id: Ib5275b742b849183b1fe701900040fee369a1d78
Gerrit-Change-Number: 86921
Gerrit-PatchSet: 1
Gerrit-Owner: Dmitry Zhadinets <dzhadinets(a)gmail.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Dmitry Zhadinets <dzhadinets(a)gmail.com>
Gerrit-Attention: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Comment-Date: Thu, 20 Mar 2025 02:23:02 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Attention is currently required from: DZ, Dolan Liu, Nikolai Artemiev, Stefan Reinauer.
Anastasia Klimchuk has posted comments on this change by Dolan Liu. ( https://review.coreboot.org/c/flashrom/+/86348?usp=email )
Change subject: flashchips: Add Macronix MX77U25650FZ4I42
......................................................................
Patch Set 2:
(1 comment)
Patchset:
PS2:
Hello Daniel! I wanted to ask you, if you could help review this patch? It is not possible for me to access the datasheet, but I think you would be able to get the datasheet for yourself?
If you could review the flashchip definition (feature flags, values), it would be so helpful. I will check the overall structure of the patch.
Thank you so much!
--
To view, visit https://review.coreboot.org/c/flashrom/+/86348?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: flashrom
Gerrit-Branch: main
Gerrit-Change-Id: I7866b2db343f4eb2bc194400ceca099d3af3b87d
Gerrit-Change-Number: 86348
Gerrit-PatchSet: 2
Gerrit-Owner: Dolan Liu <liuyong5(a)huaqin.corp-partner.google.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: DZ <danielzhang(a)mxic.com.cn>
Gerrit-Reviewer: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Reviewer: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: DZ <danielzhang(a)mxic.com.cn>
Gerrit-Attention: Dolan Liu <liuyong5(a)huaqin.corp-partner.google.com>
Gerrit-Attention: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Attention: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Comment-Date: Thu, 20 Mar 2025 02:01:17 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Attention is currently required from: Anastasia Klimchuk, Nikolai Artemiev, Stefan Reinauer.
Dolan Liu has posted comments on this change by Dolan Liu. ( https://review.coreboot.org/c/flashrom/+/86348?usp=email )
Change subject: flashchips: Add Macronix MX77U25650FZ4I42
......................................................................
Patch Set 2:
(1 comment)
Patchset:
PS2:
> ya, thanks for commetns, we are asking HW team to request the datasheet, i will attached the link he […]
Hi Anastasia,
we have try to ask Macronix to request datasheet link, but they were reject because the RPMC device need theirs internal approval or license limited, and it was have watermakr with company confidential.
sorry for that, may need you apply to Macronix...
--
To view, visit https://review.coreboot.org/c/flashrom/+/86348?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: flashrom
Gerrit-Branch: main
Gerrit-Change-Id: I7866b2db343f4eb2bc194400ceca099d3af3b87d
Gerrit-Change-Number: 86348
Gerrit-PatchSet: 2
Gerrit-Owner: Dolan Liu <liuyong5(a)huaqin.corp-partner.google.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Reviewer: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Attention: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Comment-Date: Wed, 19 Mar 2025 06:42:25 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Dolan Liu <liuyong5(a)huaqin.corp-partner.google.com>
Comment-In-Reply-To: Anastasia Klimchuk <aklm(a)chromium.org>