Sean Anderson has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/43608 )
Change subject: buspirate: Add option for setting the aux pin
......................................................................
buspirate: Add option for setting the aux pin
This adds a parameter to drive the aux pin low (or high if you
explicitly want the previous behavior). Some boards need to have a reset
pin driven low before the firmware can be safely flashed. With the Bus
Pirate, this is most easily done with the auxiliary pin.
Change-Id: Ieeecfdf1afc06dadda9b8f99547cd74854ca6775
Signed-off-by: Sean Anderson <seanga2(a)gmail.com>
---
M buspirate_spi.c
M flashrom.8.tmpl
2 files changed, 33 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/08/43608/1
diff --git a/buspirate_spi.c b/buspirate_spi.c
index fdfc0e4..1ccb107 100644
--- a/buspirate_spi.c
+++ b/buspirate_spi.c
@@ -228,6 +228,7 @@
int serialspeed_index = -1;
int ret = 0;
int pullup = 0;
+ int aux = 1;
dev = extract_programmer_param("dev");
if (dev && !strlen(dev)) {
@@ -277,6 +278,17 @@
}
free(tmp);
+ tmp = extract_programmer_param("aux");
+ if (tmp) {
+ if (strcasecmp("high", tmp) == 0)
+ ; /* Default */
+ else if (strcasecmp("low", tmp) == 0)
+ aux = 0;
+ else
+ msg_perr("Invalid AUX state, driving high by default.\n");
+ }
+ free(tmp);
+
/* Default buffer size is 19: 16 bytes data, 3 bytes control. */
#define DEFAULT_BUFSIZE (16 + 3)
bp_commbuf = malloc(DEFAULT_BUFSIZE);
@@ -520,11 +532,18 @@
}
/* Initial setup (SPI peripherals config): Enable power, CS high, AUX */
- bp_commbuf[0] = 0x40 | 0x0b;
+ bp_commbuf[0] = 0x40 | 0x09;
if (pullup == 1) {
bp_commbuf[0] |= (1 << 2);
msg_pdbg("Enabling pull-up resistors.\n");
}
+ if (aux) {
+ bp_commbuf[0] |= (1 << 1);
+ msg_pdbg("Driving AUX high.\n");
+ } else {
+ msg_pdbg("Driving AUX low.\n");
+ }
+
ret = buspirate_sendrecv(bp_commbuf, 1, 1);
if (ret)
return 1;
diff --git a/flashrom.8.tmpl b/flashrom.8.tmpl
index db50d59..caf860c 100644
--- a/flashrom.8.tmpl
+++ b/flashrom.8.tmpl
@@ -902,6 +902,19 @@
.URLB "http://dangerousprototypes.com/docs/Practical_guide_to_Bus_Pirate_pull-up_r…" \
"in a guide by dangerousprototypes" .
Only the external supply voltage (Vpu) is supported as of this writing.
+.sp
+An optional aux parameter specifies the state of the Bus Pirate auxiliary pin.
+This may be used to drive the auxiliary pin high or low before a transfer.
+Syntax is
+.sp
+.B " flashrom -p buspirate_spi:aux=state"
+.sp
+where
+.B state
+can be
+.BR high " or " low .
+The default
+.BR state " is " high .
.SS
.BR "pickit2_spi " programmer
.IP
--
To view, visit https://review.coreboot.org/c/flashrom/+/43608
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ieeecfdf1afc06dadda9b8f99547cd74854ca6775
Gerrit-Change-Number: 43608
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Anderson <seanga2(a)gmail.com>
Gerrit-MessageType: newchange
Attention is currently required from: Edward O'Callaghan, Sergii Dmytruk.
Nikolai Artemiev has uploaded a new patch set (#8) to the change originally created by Edward O'Callaghan. ( https://review.coreboot.org/c/flashrom/+/64375 )
Change subject: writeprotect.c: Allow opaque masters to hook spi_{rw}_register()
......................................................................
writeprotect.c: Allow opaque masters to hook spi_{rw}_register()
Allow specialisation in opaque masters, such as ichspi hwseq, to
write to status registers.
Also update the dispatch logic in libflashrom to call wp code when
status register access functions are provided by an opaque master.
Change-Id: I3ab0d7f5f48338c8ecb118a69651c203fbc516ac
Signed-off-by: Edward O'Callaghan <quasisec(a)google.com>
Signed-off-by: Nikolai Artemiev <nartemiev(a)google.com>
Co-Authored-by: Nikolai Artemiev <nartemiev(a)google.com>
---
M include/programmer.h
M libflashrom.c
M writeprotect.c
3 files changed, 35 insertions(+), 13 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/75/64375/8
--
To view, visit https://review.coreboot.org/c/flashrom/+/64375
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I3ab0d7f5f48338c8ecb118a69651c203fbc516ac
Gerrit-Change-Number: 64375
Gerrit-PatchSet: 8
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Reviewer: Sergii Dmytruk <sergii.dmytruk(a)3mdeb.com>
Gerrit-Reviewer: Subrata Banik <subratabanik(a)google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Sergii Dmytruk <sergii.dmytruk(a)3mdeb.com>
Gerrit-MessageType: newpatchset
Attention is currently required from: Edward O'Callaghan, Sergii Dmytruk.
Nikolai Artemiev has uploaded a new patch set (#7) to the change originally created by Edward O'Callaghan. ( https://review.coreboot.org/c/flashrom/+/64375 )
Change subject: writeprotect.c: Allow opaque masters to hook spi_{rw}_register()
......................................................................
writeprotect.c: Allow opaque masters to hook spi_{rw}_register()
Allow specialisation in opaque masters, such as ichspi hwseq, to
write to status registers.
Also update the dispatch logic in libflashrom to use call wp code when
status register access functions are provided by an opaque master.
Change-Id: I3ab0d7f5f48338c8ecb118a69651c203fbc516ac
Signed-off-by: Edward O'Callaghan <quasisec(a)google.com>
Signed-off-by: Nikolai Artemiev <nartemiev(a)google.com>
Co-Authored-by: Nikolai Artemiev <nartemiev(a)google.com>
---
M include/programmer.h
M libflashrom.c
M writeprotect.c
3 files changed, 35 insertions(+), 13 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/75/64375/7
--
To view, visit https://review.coreboot.org/c/flashrom/+/64375
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I3ab0d7f5f48338c8ecb118a69651c203fbc516ac
Gerrit-Change-Number: 64375
Gerrit-PatchSet: 7
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Reviewer: Sergii Dmytruk <sergii.dmytruk(a)3mdeb.com>
Gerrit-Reviewer: Subrata Banik <subratabanik(a)google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Sergii Dmytruk <sergii.dmytruk(a)3mdeb.com>
Gerrit-MessageType: newpatchset
Anastasia Klimchuk has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/64881 )
Change subject: tests: Use regular cmocka wraps for hwaccess functions
......................................................................
tests: Use regular cmocka wraps for hwaccess functions
hwaccess functions used to be static inline functions and needed
a special treatment so that they could be mocked for unit tests.
This has changed, see include/hwaccess_x86_io.h now the functions
are not static inline anymore, and it is possible to use regular
cmocka wraps.
Fixes https://ticket.coreboot.org/issues/385
BUG=b:181803212
TEST=ninja test
Change-Id: Iafce071ea7ad5bcfdebbba968699d5743705f8e0
Signed-off-by: Anastasia Klimchuk <aklm(a)chromium.org>
---
M meson.build
D tests/hwaccess_x86_io_unittest.h
M tests/meson.build
M tests/tests.c
M tests/wraps.h
5 files changed, 29 insertions(+), 83 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/81/64881/1
diff --git a/meson.build b/meson.build
index a8e5a7b..abaed4e 100644
--- a/meson.build
+++ b/meson.build
@@ -512,7 +512,6 @@
compile_args : [
'-includestdlib.h',
'-includeunittest_env.h',
- '-includehwaccess_x86_io_unittest.h'
],
dependencies : [
deps,
diff --git a/tests/hwaccess_x86_io_unittest.h b/tests/hwaccess_x86_io_unittest.h
deleted file mode 100644
index 14f3caa..0000000
--- a/tests/hwaccess_x86_io_unittest.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * This file is part of the flashrom project.
- *
- * Copyright 2021 Google LLC
- *
- * 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
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-/*
- * This header is used instead of hwaccess_x86_io.h for unit tests
- * (see flashrom_test_dep in meson.build).
- *
- * There is no hardware in unit test environment and all hardware operations
- * need to be mocked.
- */
-
-/*
- * The same guard is used intentionally for hwaccess_x86_io.h and
- * hwaccess_x86_io_unittest.h. When build is made for the test environment,
- * hwaccess_x86_io_unittest.h is included first, and it effectively
- * replaces hwaccess_x86_io.h.
- */
-#ifndef __HWACCESS_X86_IO_H__
-#define __HWACCESS_X86_IO_H__ 1
-
-#define OUTB(v, p) test_outb(v, p)
-#define OUTW(v, p) test_outw(v, p)
-#define OUTL(v, p) test_outl(v, p)
-#define INB(p) test_inb(p)
-#define INW(p) test_inw(p)
-#define INL(p) test_inl(p)
-
-#include <stdint.h>
-
-int rget_io_perms(void);
-
-/*
- * Dummy implementation of iopl from sys/io.h.
- * sys/io.h by itself is platform-specific, so instead of including
- * the header we just have this dummy function, which is sufficient
- * for test purposes.
- */
-static inline int iopl(int level)
-{
- return 0;
-}
-
-/* All functions below are mocked in unit tests. */
-
-void test_outb(uint8_t value, uint16_t port);
-uint8_t test_inb(uint16_t port);
-void test_outw(uint16_t value, uint16_t port);
-uint16_t test_inw(uint16_t port);
-void test_outl(uint32_t value, uint16_t port);
-uint32_t test_inl(uint16_t port);
-
-#endif /* !__HWACCESS_X86_IO_H__ */
diff --git a/tests/meson.build b/tests/meson.build
index 588ac17..38f5be5 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -67,12 +67,12 @@
'-Wl,--wrap=clearerr',
'-Wl,--wrap=setvbuf',
'-Wl,--wrap=rget_io_perms',
- '-Wl,--wrap=test_outb',
- '-Wl,--wrap=test_inb',
- '-Wl,--wrap=test_outw',
- '-Wl,--wrap=test_inw',
- '-Wl,--wrap=test_outl',
- '-Wl,--wrap=test_inl',
+ '-Wl,--wrap=OUTB',
+ '-Wl,--wrap=INB',
+ '-Wl,--wrap=OUTW',
+ '-Wl,--wrap=INW',
+ '-Wl,--wrap=OUTL',
+ '-Wl,--wrap=INL',
'-Wl,--wrap=usb_dev_get_by_vid_pid_number',
'-Wl,--wrap=libusb_init',
'-Wl,--wrap=libusb_open',
diff --git a/tests/tests.c b/tests/tests.c
index a719a8f..8f002ab 100644
--- a/tests/tests.c
+++ b/tests/tests.c
@@ -321,14 +321,14 @@
return 0;
}
-void __wrap_test_outb(unsigned char value, unsigned short port)
+void __wrap_OUTB(unsigned char value, unsigned short port)
{
/* LOG_ME; */
if (get_io() && get_io()->outb)
get_io()->outb(get_io()->state, value, port);
}
-unsigned char __wrap_test_inb(unsigned short port)
+unsigned char __wrap_INB(unsigned short port)
{
/* LOG_ME; */
if (get_io() && get_io()->inb)
@@ -336,14 +336,14 @@
return 0;
}
-void __wrap_test_outw(unsigned short value, unsigned short port)
+void __wrap_OUTW(unsigned short value, unsigned short port)
{
/* LOG_ME; */
if (get_io() && get_io()->outw)
get_io()->outw(get_io()->state, value, port);
}
-unsigned short __wrap_test_inw(unsigned short port)
+unsigned short __wrap_INW(unsigned short port)
{
/* LOG_ME; */
if (get_io() && get_io()->inw)
@@ -351,14 +351,14 @@
return 0;
}
-void __wrap_test_outl(unsigned int value, unsigned short port)
+void __wrap_OUTL(unsigned int value, unsigned short port)
{
/* LOG_ME; */
if (get_io() && get_io()->outl)
get_io()->outl(get_io()->state, value, port);
}
-unsigned int __wrap_test_inl(unsigned short port)
+unsigned int __wrap_INL(unsigned short port)
{
/* LOG_ME; */
if (get_io() && get_io()->inl)
@@ -366,6 +366,17 @@
return 0;
}
+/*
+ * Dummy implementation of iopl from sys/io.h.
+ * sys/io.h by itself is platform-specific, so instead of including
+ * the header we just have this dummy function, which is sufficient
+ * for test purposes.
+ */
+static inline int iopl(int level)
+{
+ return 0;
+}
+
int main(void)
{
int ret = 0;
diff --git a/tests/wraps.h b/tests/wraps.h
index c088d98..bfa8a41 100644
--- a/tests/wraps.h
+++ b/tests/wraps.h
@@ -58,12 +58,12 @@
int __wrap_ferror(FILE *fp);
void __wrap_clearerr(FILE *fp);
int __wrap_rget_io_perms(void);
-void __wrap_test_outb(unsigned char value, unsigned short port);
-unsigned char __wrap_test_inb(unsigned short port);
-void __wrap_test_outw(unsigned short value, unsigned short port);
-unsigned short __wrap_test_inw(unsigned short port);
-void __wrap_test_outl(unsigned int value, unsigned short port);
-unsigned int __wrap_test_inl(unsigned short port);
+void __wrap_OUTB(unsigned char value, unsigned short port);
+unsigned char __wrap_INB(unsigned short port);
+void __wrap_OUTW(unsigned short value, unsigned short port);
+unsigned short __wrap_INW(unsigned short port);
+void __wrap_OUTL(unsigned int value, unsigned short port);
+unsigned int __wrap_INL(unsigned short port);
int __wrap_spi_send_command(const struct flashctx *flash,
unsigned int writecnt, unsigned int readcnt,
const unsigned char *writearr, unsigned char *readarr);
--
To view, visit https://review.coreboot.org/c/flashrom/+/64881
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Iafce071ea7ad5bcfdebbba968699d5743705f8e0
Gerrit-Change-Number: 64881
Gerrit-PatchSet: 1
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: newchange
Attention is currently required from: Daniel Campello, Light.
Evan Benn has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/64668 )
Change subject: cli_output.c: Format progress output to show in single line
......................................................................
Patch Set 1:
(2 comments)
File cli_output.c:
https://review.coreboot.org/c/flashrom/+/64668/comment/307a03bd_a99bab11
PS1, Line 88: msg_ginfo("\r[%s] %u%% complete... ", flashrom_progress_stage_to_string(progress_state->stage), pc);
How does this \r interact with other messages from other sources?
eg:
msg_ginfo("\r[%s] %u%% complete")
msg_gerror("important information")
msg_ginfo("\r[%s] %u%% complete")
https://review.coreboot.org/c/flashrom/+/64668/comment/7c79a67f_9773f694
PS1, Line 89: }
I would assume \r is only appropriate for interactive usage. Is any mechanism already implemented for detecting interactive usage? EG. isatty?
If using isatty, terminal escape sequences may be a better choice (or they might not, I'm not sure). EG: https://chromium-review.googlesource.com/c/external/repo/+/3592792
--
To view, visit https://review.coreboot.org/c/flashrom/+/64668
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: If982193f9857f0da47cd71706ce6cebaa60d4323
Gerrit-Change-Number: 64668
Gerrit-PatchSet: 1
Gerrit-Owner: Light <aarya.chaumal(a)gmail.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Daniel Campello <campello(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Evan Benn <evanbenn(a)google.com>
Gerrit-CC: Richard Hughes <richard(a)hughsie.com>
Gerrit-CC: Thomas Heijligen <src(a)posteo.de>
Gerrit-Attention: Daniel Campello <campello(a)chromium.org>
Gerrit-Attention: Light <aarya.chaumal(a)gmail.com>
Gerrit-Comment-Date: Wed, 01 Jun 2022 04:58:37 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: Daniel Campello, Light.
Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/64668 )
Change subject: cli_output.c: Format progress output to show in single line
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
Aarya, thank you for the patch! Can I ask you, when you run this, do you see percentage working and increasing from 0 to 100% ? Thanks!
--
To view, visit https://review.coreboot.org/c/flashrom/+/64668
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: If982193f9857f0da47cd71706ce6cebaa60d4323
Gerrit-Change-Number: 64668
Gerrit-PatchSet: 1
Gerrit-Owner: Light <aarya.chaumal(a)gmail.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Daniel Campello <campello(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Richard Hughes <richard(a)hughsie.com>
Gerrit-CC: Thomas Heijligen <src(a)posteo.de>
Gerrit-Attention: Daniel Campello <campello(a)chromium.org>
Gerrit-Attention: Light <aarya.chaumal(a)gmail.com>
Gerrit-Comment-Date: Wed, 01 Jun 2022 04:33:49 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: Felix Singer, Nikolai Artemiev.
Evan Benn has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/64851 )
Change subject: libflashrom.map: Add missing functions from libflashrom.h
......................................................................
Patch Set 2:
(2 comments)
Commit Message:
https://review.coreboot.org/c/flashrom/+/64851/comment/094bc8d5_b16e4484
PS1, Line 7: Add all functions from header
> Suggestion: […]
Done
https://review.coreboot.org/c/flashrom/+/64851/comment/4a3fb9b3_fc0e63da
PS1, Line 9: I added all
: functioned declared in the header.
> Please use imperative. Suggestion: […]
Done
--
To view, visit https://review.coreboot.org/c/flashrom/+/64851
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ic90b3c20780d3a07b00bfca82d23d44c4fa6f22f
Gerrit-Change-Number: 64851
Gerrit-PatchSet: 2
Gerrit-Owner: Evan Benn <evanbenn(a)google.com>
Gerrit-Reviewer: Nikolai Artemiev <nartemiev(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Attention: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Attention: Nikolai Artemiev <nartemiev(a)chromium.org>
Gerrit-Comment-Date: Wed, 01 Jun 2022 04:26:49 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Felix Singer <felixsinger(a)posteo.net>
Gerrit-MessageType: comment