From 08d9c383acf0961547e2b4fbbda6858fc154ecac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20V=C3=A1zquez?= Date: Thu, 9 Oct 2025 21:47:26 +0200 Subject: [PATCH] parallel.h: Extract parallel declarations to a separate header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch moves all the declarations relevant to parallel into their own header in include/parallel.h The corresponding functions implementations are already in parallel.c, so the declarations naturally can be in parallel.h Currently, most of the declarations reside in flash.h making it difficult to really understand file dependency. Change-Id: I69f6e224a7ece373fbd6606e802930a52da1dd85 Signed-off-by: Antonio Vázquez Reviewed-on: https://review.coreboot.org/c/flashrom/+/89503 Reviewed-by: Anastasia Klimchuk Tested-by: build bot (Jenkins) --- 82802ab.c | 1 + en29lv640b.c | 1 + flashrom.c | 1 + include/flash.h | 10 ---------- include/parallel.h | 21 +++++++++++++++++++++ jedec.c | 1 + parallel.c | 2 +- printlock.c | 1 + sst28sf040.c | 1 + sst49lfxxxc.c | 1 + sst_fwhub.c | 1 + stm50.c | 1 + w29ee011.c | 1 + w39.c | 1 + 14 files changed, 33 insertions(+), 11 deletions(-) create mode 100644 include/parallel.h diff --git a/82802ab.c b/82802ab.c index 148042c77..95ff19972 100644 --- a/82802ab.c +++ b/82802ab.c @@ -24,6 +24,7 @@ #include #include "flash.h" +#include "parallel.h" #include "chipdrivers.h" void print_status_82802ab(uint8_t status) diff --git a/en29lv640b.c b/en29lv640b.c index b6473929d..10f5f7469 100644 --- a/en29lv640b.c +++ b/en29lv640b.c @@ -16,6 +16,7 @@ */ #include "flash.h" +#include "parallel.h" #include "chipdrivers.h" /* diff --git a/flashrom.c b/flashrom.c index ce844e12c..c5a2d6941 100644 --- a/flashrom.c +++ b/flashrom.c @@ -30,6 +30,7 @@ #include #include "flash.h" +#include "parallel.h" #include "flashchips.h" #include "programmer.h" #include "hwaccess_physmap.h" diff --git a/include/flash.h b/include/flash.h index 59f9a8ae5..c3321fcee 100644 --- a/include/flash.h +++ b/include/flash.h @@ -645,16 +645,6 @@ struct flashrom_flashctx { extern const struct flashchip flashchips[]; extern const unsigned int flashchips_size; -/* parallel.c */ -void chip_writeb(const struct flashctx *flash, uint8_t val, chipaddr addr); -void chip_writew(const struct flashctx *flash, uint16_t val, chipaddr addr); -void chip_writel(const struct flashctx *flash, uint32_t val, chipaddr addr); -void chip_writen(const struct flashctx *flash, const uint8_t *buf, chipaddr addr, size_t len); -uint8_t chip_readb(const struct flashctx *flash, const chipaddr addr); -uint16_t chip_readw(const struct flashctx *flash, const chipaddr addr); -uint32_t chip_readl(const struct flashctx *flash, const chipaddr addr); -void chip_readn(const struct flashctx *flash, uint8_t *buf, const chipaddr addr, size_t len); - /* print.c */ int print_supported(void); diff --git a/include/parallel.h b/include/parallel.h new file mode 100644 index 000000000..72d6baac6 --- /dev/null +++ b/include/parallel.h @@ -0,0 +1,21 @@ +/* + * This file is part of the flashrom project. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef __PARALLEL_H__ +#define __PARALLEL_H__ 1 + +#include "flash.h" + +void chip_writeb(const struct flashctx *flash, uint8_t val, chipaddr addr); +void chip_writew(const struct flashctx *flash, uint16_t val, chipaddr addr); +void chip_writel(const struct flashctx *flash, uint32_t val, chipaddr addr); +void chip_writen(const struct flashctx *flash, const uint8_t *buf, chipaddr addr, size_t len); +uint8_t chip_readb(const struct flashctx *flash, const chipaddr addr); +uint16_t chip_readw(const struct flashctx *flash, const chipaddr addr); +uint32_t chip_readl(const struct flashctx *flash, const chipaddr addr); +void chip_readn(const struct flashctx *flash, uint8_t *buf, const chipaddr addr, size_t len); + +#endif /* !__PARALLEL_H__ */ \ No newline at end of file diff --git a/jedec.c b/jedec.c index df0d93ace..1cf025e7a 100644 --- a/jedec.c +++ b/jedec.c @@ -20,6 +20,7 @@ */ #include "flash.h" +#include "parallel.h" #include "chipdrivers.h" #define MAX_REFLASH_TRIES 0x10 diff --git a/parallel.c b/parallel.c index b19372302..3976c954e 100644 --- a/parallel.c +++ b/parallel.c @@ -19,7 +19,7 @@ * GNU General Public License for more details. */ -#include "flash.h" +#include "parallel.h" #include "programmer.h" void chip_writeb(const struct flashctx *flash, uint8_t val, chipaddr addr) diff --git a/printlock.c b/printlock.c index f6eea7f46..1872d234f 100644 --- a/printlock.c +++ b/printlock.c @@ -20,6 +20,7 @@ */ #include "flash.h" +#include "parallel.h" #include "chipdrivers.h" diff --git a/sst28sf040.c b/sst28sf040.c index e6a4b3675..b2cb5feb5 100644 --- a/sst28sf040.c +++ b/sst28sf040.c @@ -17,6 +17,7 @@ */ #include "flash.h" +#include "parallel.h" #include "chipdrivers.h" #define AUTO_PG_ERASE1 0x20 diff --git a/sst49lfxxxc.c b/sst49lfxxxc.c index a69ab7539..c7b1512c9 100644 --- a/sst49lfxxxc.c +++ b/sst49lfxxxc.c @@ -17,6 +17,7 @@ */ #include "flash.h" +#include "parallel.h" #include "chipdrivers.h" int erase_sector_49lfxxxc(struct flashctx *flash, unsigned int address, diff --git a/sst_fwhub.c b/sst_fwhub.c index d688a350d..56e79555e 100644 --- a/sst_fwhub.c +++ b/sst_fwhub.c @@ -19,6 +19,7 @@ /* Adapted from the Intel FW hub stuff for 82802ax parts. */ #include "flash.h" +#include "parallel.h" #include "chipdrivers.h" static int check_sst_fwhub_block_lock(struct flashctx *flash, unsigned int offset) diff --git a/stm50.c b/stm50.c index d495e0954..25c3c2cb0 100644 --- a/stm50.c +++ b/stm50.c @@ -23,6 +23,7 @@ */ #include "flash.h" +#include "parallel.h" #include "chipdrivers.h" static int stm50_erase_sector(struct flashctx *flash, unsigned int addr) diff --git a/w29ee011.c b/w29ee011.c index 234b865c8..23330247c 100644 --- a/w29ee011.c +++ b/w29ee011.c @@ -18,6 +18,7 @@ #include #include "flash.h" +#include "parallel.h" #include "chipdrivers.h" bool w29ee011_can_override(const char *const chip_name, const char *const override_chip) diff --git a/w39.c b/w39.c index 114d0b563..250d6bd63 100644 --- a/w39.c +++ b/w39.c @@ -16,6 +16,7 @@ */ #include "flash.h" +#include "parallel.h" #include "chipdrivers.h" static uint8_t w39_idmode_readb(struct flashctx *flash, unsigned int offset)