Antonio Vázquez Blanco has uploaded this change for review.

View Change

Extract SPI declarations to the correct header

Change-Id: I794a71536a3b85fde39f83c802fa0f5dd8d428e0
Signed-off-by: Antonio Vázquez Blanco <antoniovazquezblanco@gmail.com>
---
M edi.c
M include/flash.h
M include/programmer.h
M include/spi.h
M rpmc.c
M spi.c
6 files changed, 17 insertions(+), 13 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/39/85539/1
diff --git a/edi.c b/edi.c
index 56ed62c..0d504e7 100644
--- a/edi.c
+++ b/edi.c
@@ -15,6 +15,7 @@
*/

#include <string.h>
+#include <spi.h>
#include "flash.h"
#include "chipdrivers.h"
#include "ene.h"
diff --git a/include/flash.h b/include/flash.h
index 629ef3a..f5ec4da 100644
--- a/include/flash.h
+++ b/include/flash.h
@@ -758,17 +758,6 @@
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);
-
enum chipbustype get_buses_supported(void);

#endif /* !__FLASH_H__ */
diff --git a/include/programmer.h b/include/programmer.h
index babb0bc..4784be1 100644
--- a/include/programmer.h
+++ b/include/programmer.h
@@ -23,6 +23,7 @@
#include <stdbool.h>
#include <stdint.h>

+#include <spi.h>
#include "flash.h" /* for chipaddr and flashctx */

enum programmer_type {
diff --git a/include/spi.h b/include/spi.h
index 505aecd..f5519d3 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/rpmc.c b/rpmc.c
index 72b0f2f..27e9332 100644
--- a/rpmc.c
+++ b/rpmc.c
@@ -23,6 +23,7 @@
#include <openssl/evp.h>
#include <openssl/rand.h>
#include <string.h>
+#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/spi.c b/spi.c
index b2ffc33..99f60fa 100644
--- a/spi.c
+++ b/spi.c
@@ -18,13 +18,13 @@
* Contains the generic SPI framework
*/

+#include <spi.h>
+
#include <strings.h>
#include <string.h>
-#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,

To view, visit change 85539. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: flashrom
Gerrit-Branch: main
Gerrit-Change-Id: I794a71536a3b85fde39f83c802fa0f5dd8d428e0
Gerrit-Change-Number: 85539
Gerrit-PatchSet: 1
Gerrit-Owner: Antonio Vázquez Blanco <antoniovazquezblanco@gmail.com>