Anastasia Klimchuk submitted this change.

View Change


Approvals: build bot (Jenkins): Verified Felix Singer: Looks good to me, approved Anastasia Klimchuk: Looks good to me, approved
sb600spi.c: Allow passing programmer_cfg directly

Modify the type signature of the programmer entry-point
xxx_init() functions to allow for the consumption of the
programmer parameterisation string data.
Also plumb programmer_cfg though handle_imc and handle_speed.

Change-Id: I82f9ee75df90c582ef345c00a5487c687f28cdd5
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/66660
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <felixsinger@posteo.net>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
---
M chipset_enable.c
M include/programmer.h
M sb600spi.c
3 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/chipset_enable.c b/chipset_enable.c
index 5f46fbf..7a98fd4 100644
--- a/chipset_enable.c
+++ b/chipset_enable.c
@@ -1407,7 +1407,7 @@

internal_buses_supported &= BUS_LPC | BUS_FWH;

- ret = sb600_probe_spi(dev);
+ ret = sb600_probe_spi(NULL, dev); /* TODO(quasisec): pass prog_param */

/* Read ROM strap override register. */
OUTB(0x8f, 0xcd6);
diff --git a/include/programmer.h b/include/programmer.h
index 1372e2b..4ed68da 100644
--- a/include/programmer.h
+++ b/include/programmer.h
@@ -387,7 +387,7 @@


/* sb600spi.c */
-int sb600_probe_spi(struct pci_dev *dev);
+int sb600_probe_spi(const struct programmer_cfg *cfg, struct pci_dev *dev);

/* wbsio_spi.c */
int wbsio_check_for_spi(void);
diff --git a/sb600spi.c b/sb600spi.c
index df8d726..b5d10bc 100644
--- a/sb600spi.c
+++ b/sb600spi.c
@@ -408,7 +408,8 @@
return 0;
}

-static int handle_speed(struct pci_dev *dev, enum amd_chipset amd_gen, uint8_t *sb600_spibar)
+static int handle_speed(const struct programmer_cfg *cfg,
+ struct pci_dev *dev, enum amd_chipset amd_gen, uint8_t *sb600_spibar)
{
uint32_t tmp;
int16_t spispeed_idx = -1;
@@ -521,7 +522,7 @@
return set_speed(dev, amd_gen, spispeed_idx, sb600_spibar);
}

-static int handle_imc(struct pci_dev *dev, enum amd_chipset amd_gen)
+static int handle_imc(const struct programmer_cfg *cfg, struct pci_dev *dev, enum amd_chipset amd_gen)
{
/* Handle IMC everywhere but sb600 which does not have one. */
if (amd_gen == CHIPSET_SB6XX)
@@ -629,7 +630,7 @@
.probe_opcode = default_spi_probe_opcode,
};

-int sb600_probe_spi(struct pci_dev *dev)
+int sb600_probe_spi(const struct programmer_cfg *cfg, struct pci_dev *dev)
{
struct pci_dev *smbus_dev;
uint32_t tmp;
@@ -789,10 +790,10 @@
return 0;
}

- if (handle_speed(dev, amd_gen, sb600_spibar) != 0)
+ if (handle_speed(cfg, dev, amd_gen, sb600_spibar) != 0)
return ERROR_FATAL;

- if (handle_imc(dev, amd_gen) != 0)
+ if (handle_imc(cfg, dev, amd_gen) != 0)
return ERROR_FATAL;

struct sb600spi_data *data = calloc(1, sizeof(*data));

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

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I82f9ee75df90c582ef345c00a5487c687f28cdd5
Gerrit-Change-Number: 66660
Gerrit-PatchSet: 9
Gerrit-Owner: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-Reviewer: Felix Singer <felixsinger@posteo.net>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged