Nico Huber has uploaded this change for review.

View Change

[TESTME]sb600spi: Remove memory-mapped read workaround

The actual reasons for this workaround are unknown and it bricks systems
with >16MiB chips. The controller has support to restrict the available
commands to a specific set of opcodes. So it seems possible that an in-
compatible set of commands was locked during testing.

With this patch applied, flashrom would try to use the actual SPI read
command for reading. When the set of allowed opcodes is not locked, it
might even work for >16MiB (then, flashrom could use extended-address
register commands to access pages of 16MiB).

Change-Id: I67f9ca0cd88de35953d988ab51b4b5f485085f49
Signed-off-by: Nico Huber <nico.h@gmx.de>
---
M sb600spi.c
1 file changed, 1 insertion(+), 33 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/76/58776/1
diff --git a/sb600spi.c b/sb600spi.c
index 7fa01af..ba3786f 100644
--- a/sb600spi.c
+++ b/sb600spi.c
@@ -53,7 +53,6 @@
#define FIFO_SIZE_YANGTZE 71

struct sb600spi_data {
- struct flashctx *flash;
uint8_t *spibar;
};

@@ -556,25 +555,8 @@
return amd_imc_shutdown(dev);
}

-static int promontory_read_memmapped(struct flashctx *flash, uint8_t *buf,
- unsigned int start, unsigned int len)
-{
- struct sb600spi_data * data = (struct sb600spi_data *)flash->mst->spi.data;
- if (!data->flash) {
- map_flash(flash);
- data->flash = flash; /* keep a copy of flashctx for unmap() on tear-down. */
- }
- mmio_readn((void *)(flash->virtual_memory + start), buf, len);
- return 0;
-}
-
static int sb600spi_shutdown(void *data)
{
- struct sb600spi_data *sb600_data = data;
- struct flashctx *flash = sb600_data->flash;
- if (flash)
- finalize_flash_access(flash);
-
free(data);
return 0;
}
@@ -601,17 +583,6 @@
.shutdown = sb600spi_shutdown,
};

-static const struct spi_master spi_master_promontory = {
- .max_data_read = MAX_DATA_READ_UNLIMITED,
- .max_data_write = FIFO_SIZE_YANGTZE - 3,
- .command = spi100_spi_send_command,
- .multicommand = default_spi_send_multicommand,
- .read = promontory_read_memmapped,
- .write_256 = default_spi_write_256,
- .write_aai = default_spi_write_aai,
- .shutdown = sb600spi_shutdown,
-};
-
int sb600_probe_spi(struct pci_dev *dev)
{
struct pci_dev *smbus_dev;
@@ -784,16 +755,13 @@
return SPI_GENERIC_ERROR;
}

- data->flash = NULL;
data->spibar = sb600_spibar;

/* Starting with Yangtze the SPI controller got a different interface with a much bigger buffer. */
if (amd_gen < CHIPSET_YANGTZE)
register_spi_master(&spi_master_sb600, data);
- else if (amd_gen == CHIPSET_YANGTZE)
- register_spi_master(&spi_master_yangtze, data);
else
- register_spi_master(&spi_master_promontory, data);
+ register_spi_master(&spi_master_yangtze, data);

return 0;
}

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

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I67f9ca0cd88de35953d988ab51b4b5f485085f49
Gerrit-Change-Number: 58776
Gerrit-PatchSet: 1
Gerrit-Owner: Nico Huber <nico.h@gmx.de>
Gerrit-CC: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-MessageType: newchange