Anastasia Klimchuk has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/57917 )
Change subject: tests: Add wrap for libusb_init and use it in dediprog test
......................................................................
tests: Add wrap for libusb_init and use it in dediprog test
Missing wrap for libusb_init has been discovered while working
on the test for raiden_debug_spi. Both dediprog (existing test) and
raiden_debug_spi (new test, see later in this chain) are using
libusb_init, so it definitely needs to be wrapped and added to io_mock.
Why it worked before: my understanding is that real libusb_init was
called for dediprog? Looks like it worked by coincidence.
BUG=b:181803212
TEST=builds and ninja test
Change-Id: I51c9cb96db1afb3298f4d098df96509d3cb3c046
Signed-off-by: Anastasia Klimchuk <aklm(a)chromium.org>
---
M tests/init_shutdown.c
M tests/io_mock.h
M tests/libusb_wraps.c
M tests/meson.build
4 files changed, 18 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/17/57917/1
diff --git a/tests/init_shutdown.c b/tests/init_shutdown.c
index 03e888f..e64e58c 100644
--- a/tests/init_shutdown.c
+++ b/tests/init_shutdown.c
@@ -54,6 +54,13 @@
#endif
}
+
+int dediprog_libusb_init(void *state, libusb_context **ctx)
+{
+ *ctx = not_null();
+ return 0;
+}
+
int dediprog_libusb_control_transfer(void *state,
libusb_device_handle *devh,
uint8_t bmRequestType,
@@ -75,6 +82,7 @@
{
#if CONFIG_DEDIPROG == 1
const struct io_mock dediprog_io = {
+ .libusb_init = dediprog_libusb_init,
.libusb_control_transfer = dediprog_libusb_control_transfer,
};
diff --git a/tests/io_mock.h b/tests/io_mock.h
index 3ef61a5..237238c 100644
--- a/tests/io_mock.h
+++ b/tests/io_mock.h
@@ -75,6 +75,7 @@
unsigned int (*inl)(void *state, unsigned short port);
/* USB I/O */
+ int (*libusb_init)(void *state, libusb_context **ctx);
int (*libusb_control_transfer)(void *state,
libusb_device_handle *devh,
uint8_t bmRequestType,
diff --git a/tests/libusb_wraps.c b/tests/libusb_wraps.c
index 94ef652..978108e 100644
--- a/tests/libusb_wraps.c
+++ b/tests/libusb_wraps.c
@@ -23,6 +23,14 @@
return not_null();
}
+int __wrap_libusb_init(libusb_context **ctx)
+{
+ LOG_ME;
+ if (get_io() && get_io()->libusb_init)
+ return get_io()->libusb_init(get_io()->state, ctx);
+ return 0;
+}
+
int __wrap_libusb_set_configuration(libusb_device_handle *devh, int config)
{
LOG_ME;
diff --git a/tests/meson.build b/tests/meson.build
index 955f3bf..9179258 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -58,6 +58,7 @@
'-Wl,--wrap=test_outl',
'-Wl,--wrap=test_inl',
'-Wl,--wrap=usb_dev_get_by_vid_pid_number',
+ '-Wl,--wrap=libusb_init',
'-Wl,--wrap=libusb_set_configuration',
'-Wl,--wrap=libusb_claim_interface',
'-Wl,--wrap=libusb_control_transfer',
--
To view, visit https://review.coreboot.org/c/flashrom/+/57917
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I51c9cb96db1afb3298f4d098df96509d3cb3c046
Gerrit-Change-Number: 57917
Gerrit-PatchSet: 1
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: newchange
Anastasia Klimchuk has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/57914 )
Change subject: tests: Move LOG_ME to include/tests.h to be available everywhere
......................................................................
tests: Move LOG_ME to include/tests.h to be available everywhere
LOG_ME macro is very generic and can be useful anywhere in tests.
Previously was only used in scope of tests.c. With time more tests
are added, and more files, LOG_ME needs to be visible everywhere.
BUG=b:181803212
TEST=builds and ninja test
Change-Id: If7f3d256161bc8b81e996328e445cccab9a82174
Signed-off-by: Anastasia Klimchuk <aklm(a)chromium.org>
---
M tests/include/test.h
M tests/tests.c
2 files changed, 2 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/14/57914/1
diff --git a/tests/include/test.h b/tests/include/test.h
index 24fa963..dc1de22 100644
--- a/tests/include/test.h
+++ b/tests/include/test.h
@@ -27,4 +27,6 @@
#include <setjmp.h>
#include <cmocka.h>
+#define LOG_ME printf("%s is called\n", __func__)
+
#endif /* _TESTS_TEST_H */
diff --git a/tests/tests.c b/tests/tests.c
index f9490eb..72beb83 100644
--- a/tests/tests.c
+++ b/tests/tests.c
@@ -21,9 +21,6 @@
#include <string.h>
#include <stdint.h>
-/* redefinitions/wrapping */
-#define LOG_ME printf("%s is called\n", __func__)
-
static const struct io_mock *current_io = NULL;
void io_mock_register(const struct io_mock *io)
--
To view, visit https://review.coreboot.org/c/flashrom/+/57914
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: If7f3d256161bc8b81e996328e445cccab9a82174
Gerrit-Change-Number: 57914
Gerrit-PatchSet: 1
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: newchange
Attention is currently required from: Felix Singer, Alan Green, Nico Huber, Angel Pons, Michael Niewöhner.
Hello Felix Singer, build bot (Jenkins), Alan Green, Nico Huber, Angel Pons,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/57810
to look at the new patch set (#13).
Change subject: ft2232_spi: reintroduce generic GPIOL control
......................................................................
ft2232_spi: reintroduce generic GPIOL control
This reintroduces a reworked version of the GPIOL pin control first
introduced in commit 3207844 (CB:49637), which was reverted in commit
6518cf3 (CB:55692) due to breakage.
This change introduces a new argument `gpiolX` to allow use of the four
GPIOL pins either as generic gpios or as additional CS# signal(s). `X`
specifies the GPIOL pin (0-3) to be set to one of [HLC] with the
following meaning:
* H - set the pin as output high
* L - set the pin as output low
* C - use the pin as additional CS# signal
The third value, `C`, aims to replace the parameter `csgpiol`, that is
now marked as deprecated and can be removed at some point in the future.
`gpiol` and `csgpiol` are mutually exclusive and use of both results in
an error.
Multiple pins may be set by specifying the parameter multiple times.
Documentation was updated/added accordingly.
Change-Id: I3989f0f9596c090de52dca67183b1363dae59d3a
Signed-off-by: Alan Green <avg(a)google.com>
Signed-off-by: Michael Niewöhner <foss(a)mniewoehner.de>
---
M flashrom.8.tmpl
M ft2232_spi.c
2 files changed, 113 insertions(+), 7 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/10/57810/13
--
To view, visit https://review.coreboot.org/c/flashrom/+/57810
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I3989f0f9596c090de52dca67183b1363dae59d3a
Gerrit-Change-Number: 57810
Gerrit-PatchSet: 13
Gerrit-Owner: Michael Niewöhner <foss(a)mniewoehner.de>
Gerrit-Reviewer: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Reviewer: Alan Green <avg(a)google.com>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Attention: Alan Green <avg(a)google.com>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Attention: Michael Niewöhner <foss(a)mniewoehner.de>
Gerrit-MessageType: newpatchset
Attention is currently required from: Felix Singer, Alan Green, Nico Huber, Angel Pons.
Hello Felix Singer, build bot (Jenkins), Alan Green, Nico Huber, Angel Pons,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/57810
to look at the new patch set (#12).
Change subject: ft2232_spi: reintroduce generic GPIOL control
......................................................................
ft2232_spi: reintroduce generic GPIOL control
This reintroduces a reworked version of the GPIOL pin control first
introduced in commit 3207844 (CB:49637), which was reverted in commit
6518cf3 (CB:55692) due to breakage.
This change introduces a new argument `gpiolX` to allow use of the four
GPIOL pins either as generic gpios or as additional CS# signal(s). `X`
specifies the GPIOL pin (0-3) to be set to one of [HLC] with the
following meaning:
* H - set the pin as output high
* L - set the pin as output low
* C - use the pin as additional CS# signal
The third value, `C`, aims to replace the parameter `csgpiol`, that is
now marked as deprecated and can be removed at some point in the future.
`gpiol` and `csgpiol` are mutually exclusive and use of both results in
an error.
Multiple pins may be set by specifying the parameter multiple times.
Documentation was updated/added accordingly.
Change-Id: I3989f0f9596c090de52dca67183b1363dae59d3a
Signed-off-by: Alan Green <avg(a)google.com>
Signed-off-by: Michael Niewöhner <foss(a)mniewoehner.de>
---
M flashrom.8.tmpl
M ft2232_spi.c
2 files changed, 113 insertions(+), 7 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/10/57810/12
--
To view, visit https://review.coreboot.org/c/flashrom/+/57810
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I3989f0f9596c090de52dca67183b1363dae59d3a
Gerrit-Change-Number: 57810
Gerrit-PatchSet: 12
Gerrit-Owner: Michael Niewöhner <foss(a)mniewoehner.de>
Gerrit-Reviewer: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Reviewer: Alan Green <avg(a)google.com>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Attention: Alan Green <avg(a)google.com>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-MessageType: newpatchset
Attention is currently required from: Felix Singer, Alan Green, Nico Huber, Angel Pons.
Hello Felix Singer, build bot (Jenkins), Alan Green, Nico Huber, Angel Pons,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/57810
to look at the new patch set (#11).
Change subject: ft2232_spi: reintroduce generic GPIOL control
......................................................................
ft2232_spi: reintroduce generic GPIOL control
This reintroduces a reworked version of the GPIOL pin control first
introduced in commit 3207844 (CB:49637), which was reverted in commit
6518cf3 (CB:55692) due to breakage.
This change introduces a new argument `gpiolX` to allow use of the four
GPIOL pins either as generic gpios or as additional CS# signal(s). `X`
specifies the GPIOL pin (0-3) to be set to one of [HLC] with the
following meaning:
* H - set the pin as output high
* L - set the pin as output low
* C - use the pin as additional CS# signal
The third value, `C`, aims to replace the parameter `csgpiol`, that is
now marked as deprecated and can be removed at some point in the future.
`gpiol` and `csgpiol` are mutually exclusive and use of both results in
an error.
Multiple pins may be set by specifying the parameter multiple times.
Documentation was updated/added accordingly.
Change-Id: I3989f0f9596c090de52dca67183b1363dae59d3a
Signed-off-by: Alan Green <avg(a)google.com>
Signed-off-by: Michael Niewöhner <foss(a)mniewoehner.de>
---
M flashrom.8.tmpl
M ft2232_spi.c
2 files changed, 112 insertions(+), 7 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/10/57810/11
--
To view, visit https://review.coreboot.org/c/flashrom/+/57810
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I3989f0f9596c090de52dca67183b1363dae59d3a
Gerrit-Change-Number: 57810
Gerrit-PatchSet: 11
Gerrit-Owner: Michael Niewöhner <foss(a)mniewoehner.de>
Gerrit-Reviewer: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Reviewer: Alan Green <avg(a)google.com>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Attention: Alan Green <avg(a)google.com>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-MessageType: newpatchset
Attention is currently required from: Felix Singer, Alan Green, Nico Huber, Angel Pons.
Michael Niewöhner has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/57810 )
Change subject: ft2232_spi: reintroduce generic GPIOL control
......................................................................
Patch Set 10:
(5 comments)
Commit Message:
https://review.coreboot.org/c/flashrom/+/57810/comment/3fec54f1_3caaae77
PS2, Line 22:
: TODOs:
: - discuss merging `csgpiol` into `gpiol` as 'C' (see RFC comment)
: - reword commit message
: - man page for both `csgpiol`, `gpiol`
:
> Thank you for being thorough about this!
Done
Commit Message:
https://review.coreboot.org/c/flashrom/+/57810/comment/b8c350d1_5f06f271
PS4, Line 20: In the event that
: both arguments are specified, gpiol is used.
> This paragraph is also the original commit message, right?
yes
Patchset:
PS6:
> Ack, let's go for the gpiolX=y variant
Done
File ft2232_spi.c:
https://review.coreboot.org/c/flashrom/+/57810/comment/dabb1381_2029c10e
PS2, Line 530: /* * * * * * * * * * * * * * * * * * * * * * * * * * *
: * REQUEST FOR COMMENTS: 'C' could replace `csgpiol` *
: * * * * * * * * * * * * * * * * * * * * * * * * * * */
: case 'C':
: cs_bits |= 1 << gpiol_pin;
: pindir |= 1 << gpiol_pin;
: break;
:
> Sounds good. It would also allow us to make the two interfaces mutually […]
Done
File ft2232_spi.c:
https://review.coreboot.org/c/flashrom/+/57810/comment/df3bb258_5209b4e8
PS4, Line 90: * The variables `cs_bits` and `pindir` store the values for the
: * "set data bits low byte" MPSSE command that sets the initial
: * state and the direction of the I/O pins. `cs_bits` pins default
: * to high and will be toggled during SPI transactions. All other
: * output pins will be kept low all the time. GPIOL* pins are
: * configured as inputs, while it's possible to use one of them as
: * additional CS# signal through the parameter `csgpiol`. On exit,
: * all pins will be reconfigured as inputs
> Reminder: this comment will need updating.
Done
--
To view, visit https://review.coreboot.org/c/flashrom/+/57810
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I3989f0f9596c090de52dca67183b1363dae59d3a
Gerrit-Change-Number: 57810
Gerrit-PatchSet: 10
Gerrit-Owner: Michael Niewöhner <foss(a)mniewoehner.de>
Gerrit-Reviewer: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Reviewer: Alan Green <avg(a)google.com>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Attention: Alan Green <avg(a)google.com>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Comment-Date: Thu, 23 Sep 2021 19:53:05 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Alan Green <avg(a)google.com>
Comment-In-Reply-To: Nico Huber <nico.h(a)gmx.de>
Comment-In-Reply-To: Michael Niewöhner <foss(a)mniewoehner.de>
Gerrit-MessageType: comment
Attention is currently required from: Felix Singer, Nico Huber, Angel Pons.
Michael Niewöhner has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/57893 )
Change subject: flashrom.8: carve out `csgpiol` into its own section
......................................................................
Patch Set 1:
This change is ready for review.
--
To view, visit https://review.coreboot.org/c/flashrom/+/57893
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ic7379331d36b3068eacde5a983b4ccb3afc56c51
Gerrit-Change-Number: 57893
Gerrit-PatchSet: 1
Gerrit-Owner: Michael Niewöhner <foss(a)mniewoehner.de>
Gerrit-Reviewer: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Comment-Date: Thu, 23 Sep 2021 19:52:13 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: Felix Singer, Alan Green, Nico Huber, Angel Pons.
Hello Felix Singer, build bot (Jenkins), Alan Green, Nico Huber, Angel Pons,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/57810
to look at the new patch set (#10).
Change subject: ft2232_spi: reintroduce generic GPIOL control
......................................................................
ft2232_spi: reintroduce generic GPIOL control
This reintroduces a reworked version of the GPIOL pin control first
introduced in commit 3207844 (CB:49637), which was reverted in commit
6518cf3 (CB:55692) due to breakage.
This change introduces a new argument `gpiolX` to allow use of the four
GPIOL pins either as generic gpios or as additional CS# signal(s). `X`
specifies the GPIOL pin (0-3) to be set to one of [HLC] with the
following meaning:
* H - set the pin as output high
* L - set the pin as output low
* C - use the pin as additional CS# signal
The third value, `C`, aims to replace the parameter `csgpiol`, that is
now marked as deprecated and can be removed at some point in the future.
`gpiol` and `csgpiol` are mutually exclusive and use of both results in
an error.
Multiple pins may be set by specifying the parameter multiple times.
Documentation was updated/added accordingly.
Change-Id: I3989f0f9596c090de52dca67183b1363dae59d3a
Signed-off-by: Alan Green <avg(a)google.com>
Signed-off-by: Michael Niewöhner <foss(a)mniewoehner.de>
---
M flashrom.8.tmpl
M ft2232_spi.c
2 files changed, 111 insertions(+), 7 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/10/57810/10
--
To view, visit https://review.coreboot.org/c/flashrom/+/57810
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I3989f0f9596c090de52dca67183b1363dae59d3a
Gerrit-Change-Number: 57810
Gerrit-PatchSet: 10
Gerrit-Owner: Michael Niewöhner <foss(a)mniewoehner.de>
Gerrit-Reviewer: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Reviewer: Alan Green <avg(a)google.com>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Attention: Alan Green <avg(a)google.com>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-MessageType: newpatchset