public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Marek Szuba" <marecki@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/flashrom/files/, sys-apps/flashrom/
Date: Mon, 12 Jun 2023 23:22:24 +0000 (UTC)	[thread overview]
Message-ID: <1686612134.bee3bcde7d86726cb8386d85a4c93b8d5df7aced.marecki@gentoo> (raw)

commit:     bee3bcde7d86726cb8386d85a4c93b8d5df7aced
Author:     Marek Szuba <marecki <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 12 23:20:43 2023 +0000
Commit:     Marek Szuba <marecki <AT> gentoo <DOT> org>
CommitDate: Mon Jun 12 23:22:14 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bee3bcde

sys-apps/flashrom: backport possible "incomplete spi master definition" fix to 1.3.0

Signed-off-by: Marek Szuba <marecki <AT> gentoo.org>

 .../flashrom/files/flashrom-1.3.0_spi-master.patch | 285 +++++++++++++++++++++
 sys-apps/flashrom/flashrom-1.3.0-r1.ebuild         | 132 ++++++++++
 2 files changed, 417 insertions(+)

diff --git a/sys-apps/flashrom/files/flashrom-1.3.0_spi-master.patch b/sys-apps/flashrom/files/flashrom-1.3.0_spi-master.patch
new file mode 100644
index 000000000000..72298f8cfca3
--- /dev/null
+++ b/sys-apps/flashrom/files/flashrom-1.3.0_spi-master.patch
@@ -0,0 +1,285 @@
+Backported upstream commit
+https://github.com/flashrom/flashrom/commit/e1f30bbce7a603d518ecec9d7e6885719f396719
+
+--- a/bitbang_spi.c
++++ b/bitbang_spi.c
+@@ -148,7 +148,6 @@
+ 	.write_256	= default_spi_write_256,
+ 	.write_aai	= default_spi_write_aai,
+ 	.shutdown	= bitbang_spi_shutdown,
+-	.probe_opcode	= default_spi_probe_opcode,
+ };
+ 
+ int register_spi_bitbang_master(const struct bitbang_spi_master *master, void *spi_data)
+--- a/buspirate_spi.c
++++ b/buspirate_spi.c
+@@ -183,7 +183,6 @@
+ 	.write_256	= default_spi_write_256,
+ 	.write_aai	= default_spi_write_aai,
+ 	.shutdown	= buspirate_spi_shutdown,
+-	.probe_opcode	= default_spi_probe_opcode,
+ };
+ 
+ static const struct buspirate_speeds spispeeds[] = {
+--- a/ch341a_spi.c
++++ b/ch341a_spi.c
+@@ -418,7 +418,6 @@
+ 	.write_256	= default_spi_write_256,
+ 	.write_aai	= default_spi_write_aai,
+ 	.shutdown	= ch341a_spi_shutdown,
+-	.probe_opcode	= default_spi_probe_opcode,
+ };
+ 
+ static int ch341a_spi_init(const struct programmer_cfg *cfg)
+--- a/dediprog.c
++++ b/dediprog.c
+@@ -1038,7 +1038,6 @@
+ 	.write_256	= dediprog_spi_write_256,
+ 	.write_aai	= dediprog_spi_write_aai,
+ 	.shutdown	= dediprog_shutdown,
+-	.probe_opcode	= default_spi_probe_opcode,
+ };
+ 
+ /*
+--- a/digilent_spi.c
++++ b/digilent_spi.c
+@@ -338,7 +338,6 @@
+ 	.write_256	= default_spi_write_256,
+ 	.write_aai	= default_spi_write_aai,
+ 	.shutdown	= digilent_spi_shutdown,
+-	.probe_opcode	= default_spi_probe_opcode,
+ };
+ 
+ static bool default_reset(struct libusb_device_handle *handle)
+--- a/dirtyjtag_spi.c
++++ b/dirtyjtag_spi.c
+@@ -198,7 +198,6 @@
+ 	.write_256	= default_spi_write_256,
+ 	.write_aai	= default_spi_write_aai,
+ 	.shutdown	= dirtyjtag_spi_shutdown,
+-	.probe_opcode	= default_spi_probe_opcode,
+ };
+ 
+ static int dirtyjtag_spi_init(const struct programmer_cfg *cfg)
+--- a/ft2232_spi.c
++++ b/ft2232_spi.c
+@@ -301,7 +301,6 @@
+ 	.write_256	= default_spi_write_256,
+ 	.write_aai	= default_spi_write_aai,
+ 	.shutdown	= ft2232_shutdown,
+-	.probe_opcode	= default_spi_probe_opcode,
+ };
+ 
+ /* Returns 0 upon success, a negative number upon errors. */
+--- a/include/chipdrivers.h
++++ b/include/chipdrivers.h
+@@ -26,6 +26,7 @@
+ int spi_aai_write(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
+ int spi_chip_write_256(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
+ int spi_chip_read(struct flashctx *flash, uint8_t *buf, unsigned int start, int unsigned len);
++bool spi_probe_opcode(const struct flashctx *flash, uint8_t opcode);
+ 
+ /* spi25.c */
+ int probe_spi_rdid(struct flashctx *flash);
+--- a/include/programmer.h
++++ b/include/programmer.h
+@@ -312,7 +312,7 @@
+ 	int (*write_256)(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
+ 	int (*write_aai)(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
+ 	int (*shutdown)(void *data);
+-	bool (*probe_opcode)(struct flashctx *flash, uint8_t opcode);
++	bool (*probe_opcode)(const struct flashctx *flash, uint8_t opcode); /* NULL func implies true. */
+ 	void *data;
+ };
+ 
+@@ -322,7 +322,6 @@
+ int default_spi_read(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
+ int default_spi_write_256(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
+ int default_spi_write_aai(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
+-bool default_spi_probe_opcode(struct flashctx *flash, uint8_t opcode);
+ int register_spi_master(const struct spi_master *mst, void *data);
+ 
+ /* The following enum is needed by ich_descriptor_tool and ich* code as well as in chipset_enable.c. */
+--- a/it87spi.c
++++ b/it87spi.c
+@@ -320,7 +320,6 @@
+ 	.write_256	= it8716f_spi_chip_write_256,
+ 	.write_aai	= spi_chip_write_1,
+ 	.shutdown	= it8716f_shutdown,
+-	.probe_opcode	= default_spi_probe_opcode,
+ };
+ 
+ static uint16_t it87spi_probe(const struct programmer_cfg *cfg, uint16_t port)
+--- a/jlink_spi.c
++++ b/jlink_spi.c
+@@ -190,7 +190,6 @@
+ 	.write_aai	= default_spi_write_aai,
+ 	.features	= SPI_MASTER_4BA,
+ 	.shutdown	= jlink_spi_shutdown,
+-	.probe_opcode	= default_spi_probe_opcode,
+ };
+ 
+ static int jlink_spi_init(const struct programmer_cfg *cfg)
+--- a/linux_spi.c
++++ b/linux_spi.c
+@@ -121,7 +121,6 @@
+ 	.write_256	= linux_spi_write_256,
+ 	.write_aai	= default_spi_write_aai,
+ 	.shutdown	= linux_spi_shutdown,
+-	.probe_opcode	= default_spi_probe_opcode,
+ };
+ 
+ /* Read max buffer size from sysfs, or use page size as fallback. */
+--- a/mediatek_i2c_spi.c
++++ b/mediatek_i2c_spi.c
+@@ -461,7 +461,6 @@
+ 	.write_256	= default_spi_write_256,
+ 	.write_aai	= default_spi_write_aai,
+ 	.shutdown	= mediatek_shutdown,
+-	.probe_opcode	= default_spi_probe_opcode,
+ };
+ 
+ static int get_params(const struct programmer_cfg *cfg, bool *allow_brick)
+--- a/mstarddc_spi.c
++++ b/mstarddc_spi.c
+@@ -147,7 +147,6 @@
+ 	.write_256	= default_spi_write_256,
+ 	.write_aai	= default_spi_write_aai,
+ 	.shutdown	= mstarddc_spi_shutdown,
+-	.probe_opcode	= default_spi_probe_opcode,
+ };
+ 
+ /* Returns 0 upon success, a negative number upon errors. */
+--- a/ni845x_spi.c
++++ b/ni845x_spi.c
+@@ -537,7 +537,6 @@
+ 	.write_256	= default_spi_write_256,
+ 	.write_aai	= default_spi_write_aai,
+ 	.shutdown	= ni845x_spi_shutdown,
+-	.probe_opcode	= default_spi_probe_opcode,
+ };
+ 
+ static int ni845x_spi_init(const struct programmer_cfg *cfg)
+--- a/parade_lspcon.c
++++ b/parade_lspcon.c
+@@ -435,7 +435,6 @@
+ 	.write_256	= parade_lspcon_write_256,
+ 	.write_aai	= parade_lspcon_write_aai,
+ 	.shutdown	= parade_lspcon_shutdown,
+-	.probe_opcode	= default_spi_probe_opcode,
+ };
+ 
+ static int get_params(const struct programmer_cfg *cfg, bool *allow_brick)
+--- a/pickit2_spi.c
++++ b/pickit2_spi.c
+@@ -385,7 +385,6 @@
+ 	.write_256	= default_spi_write_256,
+ 	.write_aai	= default_spi_write_aai,
+ 	.shutdown	= pickit2_shutdown,
+-	.probe_opcode	= default_spi_probe_opcode,
+ };
+ 
+ static int pickit2_spi_init(const struct programmer_cfg *cfg)
+--- a/raiden_debug_spi.c
++++ b/raiden_debug_spi.c
+@@ -1325,7 +1325,6 @@
+ 	.write_256	= default_spi_write_256,
+ 	.write_aai	= default_spi_write_aai,
+ 	.shutdown	= raiden_debug_spi_shutdown,
+-	.probe_opcode	= default_spi_probe_opcode,
+ };
+ 
+ static int match_endpoint(struct libusb_endpoint_descriptor const *descriptor,
+--- a/realtek_mst_i2c_spi.c
++++ b/realtek_mst_i2c_spi.c
+@@ -440,7 +440,6 @@
+ 	.write_256	= realtek_mst_i2c_spi_write_256,
+ 	.write_aai	= realtek_mst_i2c_spi_write_aai,
+ 	.shutdown	= realtek_mst_i2c_spi_shutdown,
+-	.probe_opcode	= default_spi_probe_opcode,
+ };
+ 
+ static int get_params(const struct programmer_cfg *cfg, bool *reset, bool *enter_isp, bool *allow_brick)
+--- a/sb600spi.c
++++ b/sb600spi.c
+@@ -581,7 +581,6 @@
+ 	.write_256	= default_spi_write_256,
+ 	.write_aai	= default_spi_write_aai,
+ 	.shutdown	= sb600spi_shutdown,
+-	.probe_opcode	= default_spi_probe_opcode,
+ };
+ 
+ static const struct spi_master spi_master_yangtze = {
+@@ -595,7 +594,6 @@
+ 	.write_256	= default_spi_write_256,
+ 	.write_aai	= default_spi_write_aai,
+ 	.shutdown	= sb600spi_shutdown,
+-	.probe_opcode	= default_spi_probe_opcode,
+ };
+ 
+ int sb600_probe_spi(const struct programmer_cfg *cfg, struct pci_dev *dev)
+--- a/serprog.c
++++ b/serprog.c
+@@ -463,7 +463,6 @@
+ 	.read		= default_spi_read,
+ 	.write_256	= default_spi_write_256,
+ 	.write_aai	= default_spi_write_aai,
+-	.probe_opcode	= default_spi_probe_opcode,
+ };
+ 
+ static int sp_check_opbuf_usage(int bytes_to_be_added)
+--- a/spi.c
++++ b/spi.c
+@@ -131,9 +131,11 @@
+ 	return flash->mst->spi.write_aai(flash, buf, start, len);
+ }
+ 
+-bool default_spi_probe_opcode(struct flashctx *flash, uint8_t opcode)
++bool spi_probe_opcode(const struct flashctx *flash, uint8_t opcode)
+ {
+-	return true;
++	if (!flash->mst->spi.probe_opcode)
++		return true; /* no probe_opcode implies default of supported. */
++	return flash->mst->spi.probe_opcode(flash, opcode);
+ }
+ 
+ int register_spi_master(const struct spi_master *mst, void *data)
+@@ -148,7 +150,7 @@
+ 	}
+ 
+ 	if (!mst->write_aai || !mst->write_256 || !mst->read || !mst->command ||
+-	    !mst->multicommand || !mst->probe_opcode ||
++	    !mst->multicommand ||
+ 	    ((mst->command == default_spi_send_command) &&
+ 	     (mst->multicommand == default_spi_send_multicommand))) {
+ 		msg_perr("%s called with incomplete master definition. "
+--- a/stlinkv3_spi.c
++++ b/stlinkv3_spi.c
+@@ -471,7 +471,6 @@
+ 	.write_256	= default_spi_write_256,
+ 	.write_aai	= default_spi_write_aai,
+ 	.shutdown	= stlinkv3_spi_shutdown,
+-	.probe_opcode	= default_spi_probe_opcode,
+ };
+ 
+ static int stlinkv3_spi_init(const struct programmer_cfg *cfg)
+--- a/usbblaster_spi.c
++++ b/usbblaster_spi.c
+@@ -173,7 +173,6 @@
+ 	.write_256	= default_spi_write_256,
+ 	.write_aai	= default_spi_write_aai,
+ 	.shutdown	= usbblaster_shutdown,
+-	.probe_opcode	= default_spi_probe_opcode,
+ };
+ 
+ /* Returns 0 upon success, a negative number upon errors. */
+--- a/wbsio_spi.c
++++ b/wbsio_spi.c
+@@ -193,7 +193,6 @@
+ 	.write_256	= spi_chip_write_1,
+ 	.write_aai	= spi_chip_write_1,
+ 	.shutdown	= wbsio_spi_shutdown,
+-	.probe_opcode	= default_spi_probe_opcode,
+ };
+ 
+ int wbsio_check_for_spi(void)

diff --git a/sys-apps/flashrom/flashrom-1.3.0-r1.ebuild b/sys-apps/flashrom/flashrom-1.3.0-r1.ebuild
new file mode 100644
index 000000000000..3e8afdbc98d6
--- /dev/null
+++ b/sys-apps/flashrom/flashrom-1.3.0-r1.ebuild
@@ -0,0 +1,132 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit meson
+
+MY_P="${PN}-v${PV}"
+SRC_URI="https://download.flashrom.org/releases/${MY_P}.tar.bz2"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~x86"
+S="${WORKDIR}/${MY_P}"
+
+DESCRIPTION="Utility for reading, writing, erasing and verifying flash ROM chips"
+HOMEPAGE="https://flashrom.org/Flashrom"
+
+LICENSE="GPL-2"
+SLOT="0"
+
+# The defaults should match the upstream "default" flags in meson.build
+IUSE_PROGRAMMERS="
+	atahpt
+	atapromise
+	+atavia
+	+buspirate-spi
+	+ch341a-spi
+	+dediprog
+	+developerbox-spi
+	+digilent-spi
+	+dirtyjtag-spi
+	+drkaiser
+	+dummy
+	+ft2232-spi
+	+gfxnvidia
+	+internal
+	+it8212
+	jlink-spi
+	+linux-mtd
+	+linux-spi
+	mediatek-i2c-spi
+	mstarddc-spi
+	+nic3com
+	+nicintel
+	+nicintel-eeprom
+	+nicintel-spi
+	nicnatsemi
+	+nicrealtek
+	+ogp-spi
+	parade-lspcon
+	+pickit2-spi
+	+pony-spi
+	+raiden-debug-spi
+	+rayer-spi
+	realtek-mst-i2c-spi
+	+satamv
+	+satasii
+	+serprog
+	+stlinkv3-spi
+	+usbblaster-spi"
+IUSE="${IUSE_PROGRAMMERS} +internal-dmi test tools"
+
+RESTRICT="!test? ( test )"
+
+COMMON="atahpt? ( sys-apps/pciutils )
+	atapromise? ( sys-apps/pciutils )
+	atavia? ( sys-apps/pciutils )
+	ch341a-spi? ( virtual/libusb:1 )
+	dediprog? ( virtual/libusb:1 )
+	developerbox-spi? ( virtual/libusb:1 )
+	digilent-spi? ( virtual/libusb:1 )
+	dirtyjtag-spi? ( virtual/libusb:1 )
+	drkaiser? ( sys-apps/pciutils )
+	ft2232-spi? ( dev-embedded/libftdi:1= )
+	gfxnvidia? ( sys-apps/pciutils )
+	internal? ( sys-apps/pciutils )
+	it8212? ( sys-apps/pciutils )
+	jlink-spi? ( dev-embedded/libjaylink )
+	nic3com? ( sys-apps/pciutils )
+	nicintel? ( sys-apps/pciutils )
+	nicintel-eeprom? ( sys-apps/pciutils )
+	nicintel-spi? ( sys-apps/pciutils )
+	nicnatsemi? ( sys-apps/pciutils )
+	nicrealtek? ( sys-apps/pciutils )
+	ogp-spi? ( sys-apps/pciutils )
+	pickit2-spi? ( virtual/libusb:1 )
+	raiden-debug-spi? ( virtual/libusb:1 )
+	satamv? ( sys-apps/pciutils )
+	satasii? ( sys-apps/pciutils )
+	stlinkv3-spi? ( virtual/libusb:1 )
+	usbblaster-spi? ( dev-embedded/libftdi:1= )"
+RDEPEND="${COMMON}
+	!internal-dmi? ( sys-apps/dmidecode )"
+DEPEND="${COMMON}
+	sys-apps/diffutils
+	linux-mtd? ( sys-kernel/linux-headers )
+	linux-spi? ( sys-kernel/linux-headers )
+	mediatek-i2c-spi? ( sys-kernel/linux-headers )
+	mstarddc-spi? ( sys-kernel/linux-headers )
+	parade-lspcon? ( sys-kernel/linux-headers )
+	realtek-mst-i2c-spi? ( sys-kernel/linux-headers )"
+BDEPEND="test? ( dev-util/cmocka )"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-1.3.0_spi-master.patch
+)
+
+DOCS=( README Documentation/ )
+
+src_configure() {
+	local programmers="$(printf '%s,' $(for flag in ${IUSE_PROGRAMMERS//+/}; do usev ${flag}; done))"
+	programmers="${programmers%,}"
+	programmers="${programmers//-/_}"
+	local emesonargs=(
+		-Dclassic_cli="enabled"
+		-Dprogrammer="${programmers}"
+		$(meson_feature test tests)
+		$(meson_feature tools ich_descriptors_tool)
+	)
+	meson_src_configure
+}
+
+src_install() {
+	meson_src_install
+
+	# Upstream requires libflashrom.a to be present at build time because the classic CLI
+	# executable uses internal symbols from that library. Therefore, we let it be built
+	# but keep it out of the installed tree.
+	find "${ED}" -name '*.a' -delete || die
+
+	if use tools; then
+		dosbin "${BUILD_DIR}"/util/ich_descriptors_tool/ich_descriptors_tool
+	fi
+}


             reply	other threads:[~2023-06-12 23:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-12 23:22 Marek Szuba [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-06-28 19:08 [gentoo-commits] repo/gentoo:master commit in: sys-apps/flashrom/files/, sys-apps/flashrom/ Fabian Groffen
2024-04-24 13:27 Marek Szuba
2022-03-11 16:40 Marek Szuba
2021-11-16 15:06 Marek Szuba
2021-05-17 12:58 Marek Szuba
2020-11-09 17:42 Marek Szuba
2020-11-09 16:22 Marek Szuba
2020-05-02 16:37 Marek Szuba
2020-04-28  9:34 Marek Szuba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1686612134.bee3bcde7d86726cb8386d85a4c93b8d5df7aced.marecki@gentoo \
    --to=marecki@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox