Nico Huber merged this change.

View Change

Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved
tree: Remove unused functions with no prototypes

These functions are no longer used, or were never used in the first place.

generate_testpattern() - Introduced in commit eaac68bf8b, never used
list_programmers() - Introduced in commit 552420b0d6, never used
pci_dev_find_filter() - Prototype removed in commit 5c316f9549
erase_chip_jedec() - Usage and prototype removed in commit f52f784bb3
printlock_regspace2_blocks() - Introduced in commit ef3ac8ac17, never used
spi_write_status_enable() - Usage dropped in commit fcbdbbc0d4

Change-Id: I742164670521fea65ffa3808446594848ce63cec
Signed-off-by: Jacob Garber <jgarber1@ualberta.ca>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/33669
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
---
M flashrom.c
M internal.c
M jedec.c
M spi25_statusreg.c
4 files changed, 0 insertions(+), 186 deletions(-)

diff --git a/flashrom.c b/flashrom.c
index 5b85c14..cb1dca6 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -975,142 +975,6 @@
return first_len;
}

-/* This function generates various test patterns useful for testing controller
- * and chip communication as well as chip behaviour.
- *
- * If a byte can be written multiple times, each time keeping 0-bits at 0
- * and changing 1-bits to 0 if the new value for that bit is 0, the effect
- * is essentially an AND operation. That's also the reason why this function
- * provides the result of AND between various patterns.
- *
- * Below is a list of patterns (and their block length).
- * Pattern 0 is 05 15 25 35 45 55 65 75 85 95 a5 b5 c5 d5 e5 f5 (16 Bytes)
- * Pattern 1 is 0a 1a 2a 3a 4a 5a 6a 7a 8a 9a aa ba ca da ea fa (16 Bytes)
- * Pattern 2 is 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f (16 Bytes)
- * Pattern 3 is a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af (16 Bytes)
- * Pattern 4 is 00 10 20 30 40 50 60 70 80 90 a0 b0 c0 d0 e0 f0 (16 Bytes)
- * Pattern 5 is 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f (16 Bytes)
- * Pattern 6 is 00 (1 Byte)
- * Pattern 7 is ff (1 Byte)
- * Patterns 0-7 have a big-endian block number in the last 2 bytes of each 256
- * byte block.
- *
- * Pattern 8 is 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11... (256 B)
- * Pattern 9 is ff fe fd fc fb fa f9 f8 f7 f6 f5 f4 f3 f2 f1 f0 ef ee... (256 B)
- * Pattern 10 is 00 00 00 01 00 02 00 03 00 04... (128 kB big-endian counter)
- * Pattern 11 is ff ff ff fe ff fd ff fc ff fb... (128 kB big-endian downwards)
- * Pattern 12 is 00 (1 Byte)
- * Pattern 13 is ff (1 Byte)
- * Patterns 8-13 have no block number.
- *
- * Patterns 0-3 are created to detect and efficiently diagnose communication
- * slips like missed bits or bytes and their repetitive nature gives good visual
- * cues to the person inspecting the results. In addition, the following holds:
- * AND Pattern 0/1 == Pattern 4
- * AND Pattern 2/3 == Pattern 5
- * AND Pattern 0/1/2/3 == AND Pattern 4/5 == Pattern 6
- * A weakness of pattern 0-5 is the inability to detect swaps/copies between
- * any two 16-byte blocks except for the last 16-byte block in a 256-byte bloc.
- * They work perfectly for detecting any swaps/aliasing of blocks >= 256 bytes.
- * 0x5 and 0xa were picked because they are 0101 and 1010 binary.
- * Patterns 8-9 are best for detecting swaps/aliasing of blocks < 256 bytes.
- * Besides that, they provide for bit testing of the last two bytes of every
- * 256 byte block which contains the block number for patterns 0-6.
- * Patterns 10-11 are special purpose for detecting subblock aliasing with
- * block sizes >256 bytes (some Dataflash chips etc.)
- * AND Pattern 8/9 == Pattern 12
- * AND Pattern 10/11 == Pattern 12
- * Pattern 13 is the completely erased state.
- * None of the patterns can detect aliasing at boundaries which are a multiple
- * of 16 MBytes (but such chips do not exist anyway for Parallel/LPC/FWH/SPI).
- */
-int generate_testpattern(uint8_t *buf, uint32_t size, int variant)
-{
- int i;
-
- if (!buf) {
- msg_gerr("Invalid buffer!\n");
- return 1;
- }
-
- switch (variant) {
- case 0:
- for (i = 0; i < size; i++)
- buf[i] = (i & 0xf) << 4 | 0x5;
- break;
- case 1:
- for (i = 0; i < size; i++)
- buf[i] = (i & 0xf) << 4 | 0xa;
- break;
- case 2:
- for (i = 0; i < size; i++)
- buf[i] = 0x50 | (i & 0xf);
- break;
- case 3:
- for (i = 0; i < size; i++)
- buf[i] = 0xa0 | (i & 0xf);
- break;
- case 4:
- for (i = 0; i < size; i++)
- buf[i] = (i & 0xf) << 4;
- break;
- case 5:
- for (i = 0; i < size; i++)
- buf[i] = i & 0xf;
- break;
- case 6:
- memset(buf, 0x00, size);
- break;
- case 7:
- memset(buf, 0xff, size);
- break;
- case 8:
- for (i = 0; i < size; i++)
- buf[i] = i & 0xff;
- break;
- case 9:
- for (i = 0; i < size; i++)
- buf[i] = ~(i & 0xff);
- break;
- case 10:
- for (i = 0; i < size % 2; i++) {
- buf[i * 2] = (i >> 8) & 0xff;
- buf[i * 2 + 1] = i & 0xff;
- }
- if (size & 0x1)
- buf[i * 2] = (i >> 8) & 0xff;
- break;
- case 11:
- for (i = 0; i < size % 2; i++) {
- buf[i * 2] = ~((i >> 8) & 0xff);
- buf[i * 2 + 1] = ~(i & 0xff);
- }
- if (size & 0x1)
- buf[i * 2] = ~((i >> 8) & 0xff);
- break;
- case 12:
- memset(buf, 0x00, size);
- break;
- case 13:
- memset(buf, 0xff, size);
- break;
- }
-
- if ((variant >= 0) && (variant <= 7)) {
- /* Write block number in the last two bytes of each 256-byte
- * block, big endian for easier reading of the hexdump.
- * Note that this wraps around for chips larger than 2^24 bytes
- * (16 MB).
- */
- for (i = 0; i < size / 256; i++) {
- buf[i * 256 + 254] = (i >> 8) & 0xff;
- buf[i * 256 + 255] = i & 0xff;
- }
- }
-
- return 0;
-}
-
/* Returns the number of busses commonly supported by the current programmer and flash chip where the latter
* can not be completely accessed due to size/address limits of the programmer. */
unsigned int count_max_decode_exceedings(const struct flashctx *flash)
@@ -2003,18 +1867,6 @@
"mail flashrom@flashrom.org, thanks!\n");
}

-/* The way to go if you want a delimited list of programmers */
-void list_programmers(const char *delim)
-{
- enum programmer p;
- for (p = 0; p < PROGRAMMER_INVALID; p++) {
- msg_ginfo("%s", programmer_table[p].name);
- if (p < PROGRAMMER_INVALID - 1)
- msg_ginfo("%s", delim);
- }
- msg_ginfo("\n");
-}
-
void list_programmers_linebreak(int startcol, int cols, int paren)
{
const char *pname;
diff --git a/internal.c b/internal.c
index 2bb437c..12c0ba3 100644
--- a/internal.c
+++ b/internal.c
@@ -21,17 +21,6 @@
#include "programmer.h"
#include "hwaccess.h"

-struct pci_dev *pci_dev_find_filter(struct pci_filter filter)
-{
- struct pci_dev *temp;
-
- for (temp = pacc->devices; temp; temp = temp->next)
- if (pci_filter_match(&filter, temp))
- return temp;
-
- return NULL;
-}
-
struct pci_dev *pci_dev_find_vendorclass(uint16_t vendor, uint16_t devclass)
{
struct pci_dev *temp;
diff --git a/jedec.c b/jedec.c
index 54b7da7..ac1ea0d 100644
--- a/jedec.c
+++ b/jedec.c
@@ -550,14 +550,6 @@
return erase_block_jedec_common(flash, page, size, mask);
}

-int erase_chip_jedec(struct flashctx *flash)
-{
- unsigned int mask;
-
- mask = getaddrmask(flash->chip);
- return erase_chip_jedec_common(flash, mask);
-}
-
struct unlockblock {
unsigned int size;
unsigned int count;
@@ -616,11 +608,6 @@
return 0;
}

-int printlock_regspace2_blocks(const struct flashctx *flash, const struct unlockblock *blocks)
-{
- return regspace2_walk_unlockblocks(flash, blocks, &printlock_regspace2_block);
-}
-
static int printlock_regspace2_uniform(struct flashctx *flash, unsigned long block_size)
{
const unsigned int elems = flash->chip->total_size * 1024 / block_size;
diff --git a/spi25_statusreg.c b/spi25_statusreg.c
index 4cf7023..8cd5a28 100644
--- a/spi25_statusreg.c
+++ b/spi25_statusreg.c
@@ -22,20 +22,6 @@
#include "spi.h"

/* === Generic functions === */
-int spi_write_status_enable(struct flashctx *flash)
-{
- static const unsigned char cmd[JEDEC_EWSR_OUTSIZE] = { JEDEC_EWSR };
- int result;
-
- /* Send EWSR (Enable Write Status Register). */
- result = spi_send_command(flash, sizeof(cmd), JEDEC_EWSR_INSIZE, cmd, NULL);
-
- if (result)
- msg_cerr("%s failed\n", __func__);
-
- return result;
-}
-
static int spi_write_status_register_flag(struct flashctx *flash, int status, const unsigned char enable_opcode)
{
int result;

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

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I742164670521fea65ffa3808446594848ce63cec
Gerrit-Change-Number: 33669
Gerrit-PatchSet: 2
Gerrit-Owner: Jacob Garber <jgarber1@ualberta.ca>
Gerrit-Reviewer: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged