From ce825859c45e453e0be66b7c4c05136091836d8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20V=C3=A1zquez=20Blanco?= Date: Mon, 9 Dec 2024 10:37:28 +0100 Subject: [PATCH] Move SPI declarations from flash.h to spi.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As a consecuence, some of the files that used to include flash.h no longer need to do so. For this reason, flash.h includes are also deleted in this commit. Change-Id: I794a71536a3b85fde39f83c802fa0f5dd8d428e0 Signed-off-by: Antonio Vázquez Blanco Reviewed-on: https://review.coreboot.org/c/flashrom/+/85539 Tested-by: build bot (Jenkins) Reviewed-by: Anastasia Klimchuk Reviewed-by: Peter Marheine Reviewed-by: David Reguera Garcia (Dreg) Reviewed-by: Matti Finder --- amd_imc.c | 1 - at45db.c | 1 - bitbang_spi.c | 1 - buspirate_spi.c | 1 - dediprog.c | 1 - dummyflasher.c | 1 - edi.c | 2 +- ft2232_spi.c | 1 - ichspi.c | 1 - include/cli_output.h | 2 +- include/flash.h | 11 ----------- include/programmer.h | 2 +- include/spi.h | 12 ++++++++++++ it87spi.c | 1 - jlink_spi.c | 1 - linux_spi.c | 1 - mediatek_i2c_spi.c | 1 - mstarddc_spi.c | 1 - ni845x_spi.c | 2 -- nicintel_eeprom.c | 1 - pickit2_spi.c | 1 - rpmc.c | 2 +- sb600spi.c | 1 - sfdp.c | 1 - spi.c | 4 ++-- spi25.c | 1 - spi25_statusreg.c | 1 - stlinkv3_spi.c | 1 - usbblaster_spi.c | 1 - wbsio_spi.c | 1 - writeprotect.c | 1 - 31 files changed, 18 insertions(+), 42 deletions(-) diff --git a/amd_imc.c b/amd_imc.c index d57728e56..0696732c0 100644 --- a/amd_imc.c +++ b/amd_imc.c @@ -15,7 +15,6 @@ * GNU General Public License for more details. */ -#include "flash.h" #include "programmer.h" #include "hwaccess_x86_io.h" #include "spi.h" diff --git a/at45db.c b/at45db.c index c0c6eafdb..baa2bff2f 100644 --- a/at45db.c +++ b/at45db.c @@ -16,7 +16,6 @@ */ #include -#include "flash.h" #include "chipdrivers.h" #include "programmer.h" #include "spi.h" diff --git a/bitbang_spi.c b/bitbang_spi.c index dde5dbc42..ef366530d 100644 --- a/bitbang_spi.c +++ b/bitbang_spi.c @@ -17,7 +17,6 @@ #include #include #include -#include "flash.h" #include "programmer.h" #include "spi.h" diff --git a/buspirate_spi.c b/buspirate_spi.c index 3a1e41437..a9df8ed35 100644 --- a/buspirate_spi.c +++ b/buspirate_spi.c @@ -20,7 +20,6 @@ #include #include #include -#include "flash.h" #include "programmer.h" #include "spi.h" diff --git a/dediprog.c b/dediprog.c index 05031fdee..223946a70 100644 --- a/dediprog.c +++ b/dediprog.c @@ -22,7 +22,6 @@ #include #include #include -#include "flash.h" #include "chipdrivers.h" #include "programmer.h" #include "spi.h" diff --git a/dummyflasher.c b/dummyflasher.c index ef49f48f9..1cfdd8002 100644 --- a/dummyflasher.c +++ b/dummyflasher.c @@ -22,7 +22,6 @@ #include #include #include -#include "flash.h" #include "chipdrivers.h" #include "programmer.h" #include "flashchips.h" diff --git a/edi.c b/edi.c index 56ed62cec..340688fd4 100644 --- a/edi.c +++ b/edi.c @@ -15,7 +15,7 @@ */ #include -#include "flash.h" +#include "spi.h" #include "chipdrivers.h" #include "ene.h" #include "edi.h" diff --git a/ft2232_spi.c b/ft2232_spi.c index 7d7283bc9..023507b29 100644 --- a/ft2232_spi.c +++ b/ft2232_spi.c @@ -20,7 +20,6 @@ #include #include #include -#include "flash.h" #include "programmer.h" #include "spi.h" #include diff --git a/ichspi.c b/ichspi.c index 94227de7f..ac70eed6e 100644 --- a/ichspi.c +++ b/ichspi.c @@ -22,7 +22,6 @@ #include #include #include -#include "flash.h" #include "programmer.h" #include "hwaccess_physmap.h" #include "spi.h" diff --git a/include/cli_output.h b/include/cli_output.h index 3a3db88ee..311c85e72 100644 --- a/include/cli_output.h +++ b/include/cli_output.h @@ -18,7 +18,7 @@ #define __CLI_OUTPUT_H__ #include -#include +#include "flash.h" extern enum flashrom_log_level verbose_screen; extern enum flashrom_log_level verbose_logfile; diff --git a/include/flash.h b/include/flash.h index a8451864c..80ee5f616 100644 --- a/include/flash.h +++ b/include/flash.h @@ -758,15 +758,4 @@ __attribute__((format(printf, 2, 3))); void init_progress(struct flashctx *flash, enum flashrom_progress_stage stage, size_t total); void update_progress(struct flashctx *flash, enum flashrom_progress_stage stage, size_t increment); -/* spi.c */ -struct spi_command { - unsigned int writecnt; - unsigned int readcnt; - const unsigned char *writearr; - unsigned char *readarr; -}; -#define NULL_SPI_CMD { 0, 0, NULL, NULL, } -int spi_send_command(const struct flashctx *flash, unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr); -int spi_send_multicommand(const struct flashctx *flash, struct spi_command *cmds); - #endif /* !__FLASH_H__ */ diff --git a/include/programmer.h b/include/programmer.h index e0630b887..e9c132ec0 100644 --- a/include/programmer.h +++ b/include/programmer.h @@ -23,7 +23,7 @@ #include #include -#include "flash.h" /* for chipaddr and flashctx */ +#include "spi.h" enum programmer_type { PCI = 1, /* to detect uninitialized values */ diff --git a/include/spi.h b/include/spi.h index 505aecd01..a44aaaf42 100644 --- a/include/spi.h +++ b/include/spi.h @@ -16,6 +16,8 @@ #ifndef __SPI_H__ #define __SPI_H__ 1 +#include "flash.h" + /* * Contains the generic SPI headers */ @@ -235,6 +237,16 @@ #define SPI_FLASHROM_BUG -5 #define SPI_PROGRAMMER_ERROR -6 +struct spi_command { + unsigned int writecnt; + unsigned int readcnt; + const unsigned char *writearr; + unsigned char *readarr; +}; +#define NULL_SPI_CMD { 0, 0, NULL, NULL, } +int spi_send_command(const struct flashctx *flash, unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr); +int spi_send_multicommand(const struct flashctx *flash, struct spi_command *cmds); + void clear_spi_id_cache(void); #endif /* !__SPI_H__ */ diff --git a/it87spi.c b/it87spi.c index fddae3bec..fc008d615 100644 --- a/it87spi.c +++ b/it87spi.c @@ -23,7 +23,6 @@ #include #include #include -#include "flash.h" #include "chipdrivers.h" #include "programmer.h" #include "hwaccess_physmap.h" diff --git a/jlink_spi.c b/jlink_spi.c index 447629cce..6c5a52494 100644 --- a/jlink_spi.c +++ b/jlink_spi.c @@ -26,7 +26,6 @@ #include #include -#include "flash.h" #include "programmer.h" #include "spi.h" diff --git a/linux_spi.c b/linux_spi.c index ceca05f9a..a84c77068 100644 --- a/linux_spi.c +++ b/linux_spi.c @@ -24,7 +24,6 @@ #include #include #include -#include "flash.h" #include "chipdrivers.h" #include "programmer.h" #include "spi.h" diff --git a/mediatek_i2c_spi.c b/mediatek_i2c_spi.c index d28e47818..792815ac3 100644 --- a/mediatek_i2c_spi.c +++ b/mediatek_i2c_spi.c @@ -21,7 +21,6 @@ #include #include -#include "flash.h" #include "i2c_helper.h" #include "programmer.h" #include "spi.h" diff --git a/mstarddc_spi.c b/mstarddc_spi.c index 44ebd0545..13881f064 100644 --- a/mstarddc_spi.c +++ b/mstarddc_spi.c @@ -26,7 +26,6 @@ #include #include #include -#include "flash.h" #include "programmer.h" #include "spi.h" diff --git a/ni845x_spi.c b/ni845x_spi.c index 1948387bc..5032a343b 100644 --- a/ni845x_spi.c +++ b/ni845x_spi.c @@ -29,8 +29,6 @@ #include #include #include - -#include "flash.h" #include "programmer.h" #include "spi.h" diff --git a/nicintel_eeprom.c b/nicintel_eeprom.c index 6a734b050..e3f2643da 100644 --- a/nicintel_eeprom.c +++ b/nicintel_eeprom.c @@ -31,7 +31,6 @@ #include #include -#include "flash.h" #include "spi.h" #include "programmer.h" #include "hwaccess_physmap.h" diff --git a/pickit2_spi.c b/pickit2_spi.c index a072a2059..1aa13edf1 100644 --- a/pickit2_spi.c +++ b/pickit2_spi.c @@ -39,7 +39,6 @@ #include #include -#include "flash.h" #include "chipdrivers.h" #include "programmer.h" #include "spi.h" diff --git a/rpmc.c b/rpmc.c index 72b0f2f74..d0b7d4d70 100644 --- a/rpmc.c +++ b/rpmc.c @@ -15,7 +15,6 @@ */ #include "rpmc.h" -#include "flash.h" #include #include #include @@ -23,6 +22,7 @@ #include #include #include +#include "spi.h" // OP1 commands #define RPMC_WRITE_ROOT_KEY_MSG_LENGTH (RPMC_OP1_MSG_HEADER_LENGTH + RPMC_HMAC_KEY_LENGTH + RPMC_TRUNCATED_SIG_LENGTH) diff --git a/sb600spi.c b/sb600spi.c index cec7e0a59..37e45f108 100644 --- a/sb600spi.c +++ b/sb600spi.c @@ -21,7 +21,6 @@ #include #include #include -#include "flash.h" #include "programmer.h" #include "hwaccess_physmap.h" #include "spi.h" diff --git a/sfdp.c b/sfdp.c index df05d973e..e63595437 100644 --- a/sfdp.c +++ b/sfdp.c @@ -16,7 +16,6 @@ #include #include #include -#include "flash.h" #include "spi.h" #include "chipdrivers.h" diff --git a/spi.c b/spi.c index b2ffc336f..a9ad938fd 100644 --- a/spi.c +++ b/spi.c @@ -18,13 +18,13 @@ * Contains the generic SPI framework */ +#include "spi.h" + #include #include -#include "flash.h" #include "flashchips.h" #include "chipdrivers.h" #include "programmer.h" -#include "spi.h" static int default_spi_send_command(const struct flashctx *flash, unsigned int writecnt, unsigned int readcnt, diff --git a/spi25.c b/spi25.c index ab479e50f..84ea7cb5c 100644 --- a/spi25.c +++ b/spi25.c @@ -21,7 +21,6 @@ #include #include #include -#include "flash.h" #include "flashchips.h" #include "chipdrivers.h" #include "programmer.h" diff --git a/spi25_statusreg.c b/spi25_statusreg.c index ceb2c7796..bf73488c2 100644 --- a/spi25_statusreg.c +++ b/spi25_statusreg.c @@ -19,7 +19,6 @@ #include -#include "flash.h" #include "chipdrivers.h" #include "programmer.h" #include "spi.h" diff --git a/stlinkv3_spi.c b/stlinkv3_spi.c index a5c228937..2afc862a8 100644 --- a/stlinkv3_spi.c +++ b/stlinkv3_spi.c @@ -23,7 +23,6 @@ * https://www.st.com/en/development-tools/stlink-v3-bridge.html */ -#include "flash.h" #include "programmer.h" #include "spi.h" #include "usbdev.h" diff --git a/usbblaster_spi.c b/usbblaster_spi.c index 43acaad8e..7350cdef5 100644 --- a/usbblaster_spi.c +++ b/usbblaster_spi.c @@ -35,7 +35,6 @@ #include #include #include -#include "flash.h" #include "programmer.h" #include "spi.h" diff --git a/wbsio_spi.c b/wbsio_spi.c index 9f33b18de..1481cbaf9 100644 --- a/wbsio_spi.c +++ b/wbsio_spi.c @@ -16,7 +16,6 @@ #include -#include "flash.h" #include "chipdrivers.h" #include "programmer.h" #include "hwaccess_physmap.h" diff --git a/writeprotect.c b/writeprotect.c index 964c31120..7420e398b 100644 --- a/writeprotect.c +++ b/writeprotect.c @@ -20,7 +20,6 @@ #include #include "spi.h" -#include "flash.h" #include "libflashrom.h" #include "chipdrivers.h" #include "writeprotect.h"