Attention is currently required from: Stefan Reinauer, Edward O'Callaghan, Angel Pons.
Xiang Wang has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/49256 )
Change subject: programmer.h: remove unused interfaces of bitbang_spi_master
......................................................................
Patch Set 6:
(1 comment)
Patchset:
PS3:
The meaning of the set_sck_set_mosi/set_sck_get_miso interface is ambiguous
set_sck_set_mosi should be set_mosi befor set_sck
set_sck_get_miso should be get_miso after set_sck
The replacement function in the absence of the set_sck_set_mosi interface is also wrong
> static void bitbang_spi_set_sck_set_mosi(const struct bitbang_spi_master * const master, int sck, int mosi)
> {
> if (master->set_sck_set_mosi) {
> master->set_sck_set_mosi(sck, mosi);
> return;
> }
>
> master->set_sck(sck);
> master->set_mosi(mosi);
> }
--
To view, visit https://review.coreboot.org/c/flashrom/+/49256
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I68e5fc39cf831e3b7d98a6e4797b36584c6082e8
Gerrit-Change-Number: 49256
Gerrit-PatchSet: 6
Gerrit-Owner: Xiang Wang <merle(a)hardenedlinux.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Shawn C <citypw(a)hardenedlinux.org>
Gerrit-Attention: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Comment-Date: Sat, 09 Jan 2021 16:54:57 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-MessageType: comment
Attention is currently required from: Stefan Reinauer, Edward O'Callaghan, Angel Pons.
Xiang Wang has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/49255 )
Change subject: bitbang-spi.c: support clock polarity and phase
......................................................................
Patch Set 4:
(2 comments)
Commit Message:
https://review.coreboot.org/c/flashrom/+/49255/comment/a593a5fa_1a702135
PS1, Line 8:
> Without any reasoning given as to why this functionality is necessary, I think this patch is harmful […]
https://en.wikipedia.org/wiki/Serial_Peripheral_Interface
I read the data sheet of W25Q128FV, it can work in mode0 and mode3, it just works. We can't keep the code just because it just works.
File bitbang_spi.c:
https://review.coreboot.org/c/flashrom/+/49255/comment/5cdd1467_8ddebd25
PS1, Line 78: bitbang_spi_xfer(
> I would not approve of such a patch either. […]
Splitting independent reading and writing is indeed good for speed
--
To view, visit https://review.coreboot.org/c/flashrom/+/49255
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I04c1dfe132d756119229b27c3cd611d1be1abc8d
Gerrit-Change-Number: 49255
Gerrit-PatchSet: 4
Gerrit-Owner: Xiang Wang <merle(a)hardenedlinux.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Shawn C <citypw(a)hardenedlinux.org>
Gerrit-Attention: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Comment-Date: Sat, 09 Jan 2021 16:47:40 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Edward O'Callaghan <quasisec(a)chromium.org>
Comment-In-Reply-To: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-MessageType: comment
Attention is currently required from: Stefan Reinauer, Edward O'Callaghan, Angel Pons.
Xiang Wang has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/49254 )
Change subject: sysfsgpio.c implement spi interface via linux sysfs
......................................................................
Patch Set 3:
(9 comments)
Commit Message:
https://review.coreboot.org/c/flashrom/+/49254/comment/f4b388be_36105b63
PS1, Line 10: some SBC
> Which one have you tested this on?
raspberry pi zero w
W25Q128.V
File Makefile:
https://review.coreboot.org/c/flashrom/+/49254/comment/9ab8fbb4_3a62ea0b
PS1, Line 1: #
> Both meson.* and the Makefile needs modifying as well unfortunately.
Done
File sysfsgpio.c:
https://review.coreboot.org/c/flashrom/+/49254/comment/4d35182f_7ff61e51
PS1, Line 36: #define GPIO_DIRECTION "/sys/class/gpio/gpio%d/direction"
> The only definition that gets used twice is `GPIO_PATH`. The others are only used once.
Done
https://review.coreboot.org/c/flashrom/+/49254/comment/6c3a4dad_2b187ca9
PS1, Line 38: #define EXIST_PATH(path) (access((path), F_OK) == 0
> It's only used twice, so I don't think this provides any benefit. […]
Done
https://review.coreboot.org/c/flashrom/+/49254/comment/66c7c57e_a7f92b35
PS1, Line 42: int pin;
> Looks like the code only uses the string representation of `pin`. […]
Remove the pin number of the integer, use a string to record the pin number
https://review.coreboot.org/c/flashrom/+/49254/comment/335ae1bb_7c5e7339
PS1, Line 47: static struct pin_desc pin_cs = {
: .name = "cs",
: .fd_direction = -1,
: .fd_value = -1
: };
:
: static struct pin_desc pin_sck = {
: .name = "sck",
: .fd_direction = -1,
: .fd_value = -1
: };
:
: static struct pin_desc pin_mosi = {
: .name = "mosi",
: .fd_direction = -1,
: .fd_value = -1
: };
:
: static struct pin_desc pin_miso = {
: .name = "miso",
: .fd_direction = -1,
: .fd_value = -1
: };
> I would suggest making another struct to hold all pins in a single global variable: […]
Done
https://review.coreboot.org/c/flashrom/+/49254/comment/5ef67f14_379fb3e8
PS1, Line 80: if (ret == (int)strlen(str))
> To avoid casting to int, I would test for failure here with `ret < strlen(str)`.
I tried it, and the compilation still reports an error
https://review.coreboot.org/c/flashrom/+/49254/comment/bc71e935_a47b1981
PS1, Line 92: snprintf(s, sizeof(s), "%d", desc->pin);
> If you can avoid clobbering the buffer contents with this snprintf call (see suggestion to use a `pi […]
Done
https://review.coreboot.org/c/flashrom/+/49254/comment/361a11d8_e959a707
PS1, Line 209: /* parameter format: pins=cs_pin:sck_pin:mosi_pin:miso_pin */
: char *pins = extract_programmer_param("pins");
: int pins_inited = 0;
: do {
: struct pin_desc *pins_tab[] = {
: &pin_cs, &pin_sck, &pin_mosi, &pin_miso
: };
: if (!(pins && strlen(pins)))
: break;
: char *token = strtok(pins, ":");
: for (unsigned i = 0; i < ARRAY_SIZE(pins_tab); i++) {
: long v;
: if (!token)
: break;
: if (atoi_s(token, 1, &v))
: break;
: pins_tab[i]->pin = v;
: if (export_sysfsgpio(pins_tab[i]))
: break;
: token = strtok(NULL, ":");
: pins_inited = (i + 1 == ARRAY_SIZE(pins_tab));
: }
: } while (0);
: if (pins)
: free(pins);
: if (!pins_inited)
: return 1;
> I suggest making this its own static fn for param extraction and pass in &pin_desc to fetch out the […]
The pin information can be extracted into the global variable pins. So not need pass parameters
--
To view, visit https://review.coreboot.org/c/flashrom/+/49254
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I1bc47ef8011bba560326b501a80869340bb9f733
Gerrit-Change-Number: 49254
Gerrit-PatchSet: 3
Gerrit-Owner: Xiang Wang <merle(a)hardenedlinux.org>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-CC: Shawn C <citypw(a)hardenedlinux.org>
Gerrit-Attention: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Comment-Date: Sat, 09 Jan 2021 16:39:19 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Edward O'Callaghan <quasisec(a)chromium.org>
Comment-In-Reply-To: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-MessageType: comment
Attention is currently required from: Xiang Wang, Stefan Reinauer, Edward O'Callaghan.
Hello build bot (Jenkins), Stefan Reinauer, Edward O'Callaghan, Angel Pons,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/49255
to look at the new patch set (#4).
Change subject: bitbang-spi.c: support clock polarity and phase
......................................................................
bitbang-spi.c: support clock polarity and phase
Change-Id: I04c1dfe132d756119229b27c3cd611d1be1abc8d
Signed-off-by: Xiang Wang <merle(a)hardenedlinux.org>
---
M bitbang_spi.c
1 file changed, 79 insertions(+), 33 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/55/49255/4
--
To view, visit https://review.coreboot.org/c/flashrom/+/49255
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I04c1dfe132d756119229b27c3cd611d1be1abc8d
Gerrit-Change-Number: 49255
Gerrit-PatchSet: 4
Gerrit-Owner: Xiang Wang <merle(a)hardenedlinux.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Shawn C <citypw(a)hardenedlinux.org>
Gerrit-Attention: Xiang Wang <merle(a)hardenedlinux.org>
Gerrit-Attention: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-MessageType: newpatchset
Attention is currently required from: Xiang Wang, Stefan Reinauer.
Hello build bot (Jenkins), Stefan Reinauer, Edward O'Callaghan,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/49254
to look at the new patch set (#3).
Change subject: sysfsgpio.c implement spi interface via linux sysfs
......................................................................
sysfsgpio.c implement spi interface via linux sysfs
Linux can operate gpio through sysfs, this patch implements a bitbang
spi interface through sysfs. Through this patch, some SBC can be used
as flash programmers.
Change-Id: I1bc47ef8011bba560326b501a80869340bb9f733
Signed-off-by: Xiang Wang <merle(a)hardenedliux.org>
---
M Makefile
M flashrom.c
M meson.build
M meson_options.txt
M programmer.h
A sysfsgpio.c
6 files changed, 291 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/54/49254/3
--
To view, visit https://review.coreboot.org/c/flashrom/+/49254
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I1bc47ef8011bba560326b501a80869340bb9f733
Gerrit-Change-Number: 49254
Gerrit-PatchSet: 3
Gerrit-Owner: Xiang Wang <merle(a)hardenedlinux.org>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-CC: Shawn C <citypw(a)hardenedlinux.org>
Gerrit-Attention: Xiang Wang <merle(a)hardenedlinux.org>
Gerrit-Attention: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-MessageType: newpatchset
Attention is currently required from: Xiang Wang, Stefan Reinauer.
Hello build bot (Jenkins), Stefan Reinauer, Edward O'Callaghan,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/49254
to look at the new patch set (#2).
Change subject: sysfsgpio.c implement spi interface via linux sysfs
......................................................................
sysfsgpio.c implement spi interface via linux sysfs
Linux can operate gpio through sysfs, this patch implements a bitbang
spi interface through sysfs. Through this patch, some SBC can be used
as flash programmers.
Change-Id: I1bc47ef8011bba560326b501a80869340bb9f733
Signed-off-by: Xiang Wang <merle(a)hardenedliux.org>
---
M Makefile
M flashrom.c
M programmer.h
A sysfsgpio.c
4 files changed, 285 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/54/49254/2
--
To view, visit https://review.coreboot.org/c/flashrom/+/49254
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I1bc47ef8011bba560326b501a80869340bb9f733
Gerrit-Change-Number: 49254
Gerrit-PatchSet: 2
Gerrit-Owner: Xiang Wang <merle(a)hardenedlinux.org>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-CC: Shawn C <citypw(a)hardenedlinux.org>
Gerrit-Attention: Xiang Wang <merle(a)hardenedlinux.org>
Gerrit-Attention: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-MessageType: newpatchset
Attention is currently required from: Xiang Wang, Stefan Reinauer, Edward O'Callaghan.
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/49255 )
Change subject: bitbang-spi.c: support clock polarity and phase
......................................................................
Patch Set 1: Code-Review-1
(2 comments)
Commit Message:
https://review.coreboot.org/c/flashrom/+/49255/comment/de4c7599_4fe4ad03
PS1, Line 8:
Without any reasoning given as to why this functionality is necessary, I think this patch is harmful.
File bitbang_spi.c:
https://review.coreboot.org/c/flashrom/+/49255/comment/8ad528e8_2f2ba8d0
PS1, Line 78: bitbang_spi_xfer(
> this is its own patch.
I would not approve of such a patch either. Having two separate functions for read and write is much more efficient, and speed matters when bitbanging.
--
To view, visit https://review.coreboot.org/c/flashrom/+/49255
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I04c1dfe132d756119229b27c3cd611d1be1abc8d
Gerrit-Change-Number: 49255
Gerrit-PatchSet: 1
Gerrit-Owner: Xiang Wang <merle(a)hardenedlinux.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Shawn C <citypw(a)hardenedlinux.org>
Gerrit-Attention: Xiang Wang <merle(a)hardenedlinux.org>
Gerrit-Attention: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Comment-Date: Sat, 09 Jan 2021 11:09:37 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-MessageType: comment
Attention is currently required from: Xiang Wang, Stefan Reinauer, Edward O'Callaghan.
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/49256 )
Change subject: programmer.h: remove unused interfaces of bitbang_spi_master
......................................................................
Patch Set 3: Code-Review-1
(1 comment)
Patchset:
PS3:
This and the previous change are removing some functionality. For bitbang, optimizing for speed is very important.
--
To view, visit https://review.coreboot.org/c/flashrom/+/49256
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I68e5fc39cf831e3b7d98a6e4797b36584c6082e8
Gerrit-Change-Number: 49256
Gerrit-PatchSet: 3
Gerrit-Owner: Xiang Wang <merle(a)hardenedlinux.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Shawn C <citypw(a)hardenedlinux.org>
Gerrit-Attention: Xiang Wang <merle(a)hardenedlinux.org>
Gerrit-Attention: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Comment-Date: Sat, 09 Jan 2021 11:02:26 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: Xiang Wang, Stefan Reinauer.
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/49254 )
Change subject: sysfsgpio.c implement spi interface via linux sysfs
......................................................................
Patch Set 1:
(7 comments)
Commit Message:
https://review.coreboot.org/c/flashrom/+/49254/comment/5407ebce_0bbc2305
PS1, Line 10: some SBC
Which one have you tested this on?
File sysfsgpio.c:
https://review.coreboot.org/c/flashrom/+/49254/comment/934a4daf_654b707a
PS1, Line 36: #define GPIO_DIRECTION "/sys/class/gpio/gpio%d/direction"
The only definition that gets used twice is `GPIO_PATH`. The others are only used once.
https://review.coreboot.org/c/flashrom/+/49254/comment/59be022d_aa407859
PS1, Line 38: #define EXIST_PATH(path) (access((path), F_OK) == 0
> cute but just inline it, the indirection is not necessary.
It's only used twice, so I don't think this provides any benefit. If anything, you could make it a static function and let the compiler decide whether to inline it or not.
https://review.coreboot.org/c/flashrom/+/49254/comment/51b24dea_824fd9f9
PS1, Line 42: int pin;
Looks like the code only uses the string representation of `pin`. To reduce `snprintf` usage, how about having a `char pin_str[8];` here?
https://review.coreboot.org/c/flashrom/+/49254/comment/7030f1bb_e7019109
PS1, Line 47: static struct pin_desc pin_cs = {
: .name = "cs",
: .fd_direction = -1,
: .fd_value = -1
: };
:
: static struct pin_desc pin_sck = {
: .name = "sck",
: .fd_direction = -1,
: .fd_value = -1
: };
:
: static struct pin_desc pin_mosi = {
: .name = "mosi",
: .fd_direction = -1,
: .fd_value = -1
: };
:
: static struct pin_desc pin_miso = {
: .name = "miso",
: .fd_direction = -1,
: .fd_value = -1
: };
I would suggest making another struct to hold all pins in a single global variable:
struct sysfsgpio_pins {
struct pin_desc cs;
struct pin_desc sck;
struct pin_desc mosi;
struct pin_desc miso;
};
static struct sysfsgpio_pins pins = {
.cs = {
.name = "cs",
.fd_direction = -1,
.fd_value = -1,
},
.sck = {
.name = "sck",
.fd_direction = -1,
.fd_value = -1,
},
.mosi = {
.name = "mosi",
.fd_direction = -1,
.fd_value = -1,
},
.miso = {
.name = "miso",
.fd_direction = -1,
.fd_value = -1,
},
};
https://review.coreboot.org/c/flashrom/+/49254/comment/664634ea_c98925f7
PS1, Line 80: if (ret == (int)strlen(str))
To avoid casting to int, I would test for failure here with `ret < strlen(str)`.
https://review.coreboot.org/c/flashrom/+/49254/comment/6e5477e6_6a137fc0
PS1, Line 92: snprintf(s, sizeof(s), "%d", desc->pin);
If you can avoid clobbering the buffer contents with this snprintf call (see suggestion to use a `pin_str` cache in global state), you should be able to reuse the buffer contents for the direction and value files.
--
To view, visit https://review.coreboot.org/c/flashrom/+/49254
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I1bc47ef8011bba560326b501a80869340bb9f733
Gerrit-Change-Number: 49254
Gerrit-PatchSet: 1
Gerrit-Owner: Xiang Wang <merle(a)hardenedlinux.org>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-CC: Shawn C <citypw(a)hardenedlinux.org>
Gerrit-Attention: Xiang Wang <merle(a)hardenedlinux.org>
Gerrit-Attention: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Comment-Date: Sat, 09 Jan 2021 10:58:39 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-MessageType: comment
Attention is currently required from: Xiang Wang, Stefan Reinauer.
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/49254 )
Change subject: sysfsgpio.c implement spi interface via linux sysfs
......................................................................
Patch Set 1:
(3 comments)
File Makefile:
https://review.coreboot.org/c/flashrom/+/49254/comment/c1706124_13507e25
PS1, Line 1: #
Both meson.* and the Makefile needs modifying as well unfortunately.
File sysfsgpio.c:
https://review.coreboot.org/c/flashrom/+/49254/comment/4a0f453a_8490890b
PS1, Line 38: #define EXIST_PATH(path) (access((path), F_OK) == 0
cute but just inline it, the indirection is not necessary.
https://review.coreboot.org/c/flashrom/+/49254/comment/a99344f5_029e7be1
PS1, Line 209: /* parameter format: pins=cs_pin:sck_pin:mosi_pin:miso_pin */
: char *pins = extract_programmer_param("pins");
: int pins_inited = 0;
: do {
: struct pin_desc *pins_tab[] = {
: &pin_cs, &pin_sck, &pin_mosi, &pin_miso
: };
: if (!(pins && strlen(pins)))
: break;
: char *token = strtok(pins, ":");
: for (unsigned i = 0; i < ARRAY_SIZE(pins_tab); i++) {
: long v;
: if (!token)
: break;
: if (atoi_s(token, 1, &v))
: break;
: pins_tab[i]->pin = v;
: if (export_sysfsgpio(pins_tab[i]))
: break;
: token = strtok(NULL, ":");
: pins_inited = (i + 1 == ARRAY_SIZE(pins_tab));
: }
: } while (0);
: if (pins)
: free(pins);
: if (!pins_inited)
: return 1;
I suggest making this its own static fn for param extraction and pass in &pin_desc to fetch out the result
--
To view, visit https://review.coreboot.org/c/flashrom/+/49254
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I1bc47ef8011bba560326b501a80869340bb9f733
Gerrit-Change-Number: 49254
Gerrit-PatchSet: 1
Gerrit-Owner: Xiang Wang <merle(a)hardenedlinux.org>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Shawn C <citypw(a)hardenedlinux.org>
Gerrit-Attention: Xiang Wang <merle(a)hardenedlinux.org>
Gerrit-Attention: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Comment-Date: Sat, 09 Jan 2021 10:25:13 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment