mail.coreboot.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
List overview
Download
flashrom-gerrit
June 2021
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
flashrom-gerrit@flashrom.org
1 participants
877 discussions
Start a n
N
ew thread
Change in flashrom[master]: programmer.h: remove compile guard from programmer drivers
by Thomas Heijligen (Code Review)
10 Jun '21
10 Jun '21
Thomas Heijligen has uploaded this change for review. (
https://review.coreboot.org/c/flashrom/+/55387
) Change subject: programmer.h: remove compile guard from programmer drivers ...................................................................... programmer.h: remove compile guard from programmer drivers The definition of external structs musst not be guarded. See discussion under
review.coreboot.org/52946
. Change-Id: I01e6a785269c3e0bd648eeaee217a7a855ab0853 Signed-off-by: Thomas Heijligen <thomas.heijligen(a)secunet.de> --- M programmer.h 1 file changed, 43 insertions(+), 187 deletions(-) git pull ssh://review.coreboot.org:29418/flashrom refs/changes/87/55387/1 diff --git a/programmer.h b/programmer.h index be6010d..9d1a9ad 100644 --- a/programmer.h +++ b/programmer.h @@ -57,6 +57,47 @@ extern const struct programmer_entry *const programmer_table[]; extern const size_t programmer_table_size; +/* programmer drivers */ +extern const struct programmer_entry programmer_internal; +extern const struct programmer_entry programmer_dummy; +extern const struct programmer_entry programmer_nic3com; +extern const struct programmer_entry programmer_gfxnvidia; +extern const struct programmer_entry programmer_raiden_debug_spi; +extern const struct programmer_entry programmer_drkaiser; +extern const struct programmer_entry programmer_nicrealtek; +extern const struct programmer_entry programmer_nicnatsemi; +extern const struct programmer_entry programmer_nicintel; +extern const struct programmer_entry programmer_nicintel_spi; +extern const struct programmer_entry programmer_nicintel_eeprom; +extern const struct programmer_entry programmer_ogp_spi; +extern const struct programmer_entry programmer_satamv; +extern const struct programmer_entry programmer_satasii; +extern const struct programmer_entry programmer_atahpt; +extern const struct programmer_entry programmer_atavia; +extern const struct programmer_entry programmer_atapromise; +extern const struct programmer_entry programmer_it8212; +extern const struct programmer_entry programmer_ft2232_spi; +extern const struct programmer_entry programmer_usbblaster_spi; +extern const struct programmer_entry programmer_mstarddc_spi; +extern const struct programmer_entry programmer_pickit2_spi; +extern const struct programmer_entry programmer_stlinkv3_spi; +extern const struct programmer_entry programmer_rayer_spi; +extern const struct programmer_entry programmer_pony_spi; +extern const struct programmer_entry programmer_buspirate_spi; +extern const struct programmer_entry programmer_linux_mtd; +extern const struct programmer_entry programmer_linux_spi; +extern const struct programmer_entry programmer_dediprog; +extern const struct programmer_entry programmer_developerbox; +extern const struct programmer_entry programmer_ch341a_spi; +extern const struct programmer_entry programmer_digilent_spi; +extern const struct programmer_entry programmer_ene_lpc; +extern const struct programmer_entry programmer_jlink_spi; +extern const struct programmer_entry programmer_ni845x_spi; +extern const struct programmer_entry programmer_mec1308; +extern const struct programmer_entry programmer_serprog; +extern const struct programmer_entry programmer_lspcon_i2c_spi; +extern const struct programmer_entry programmer_realtek_mst_i2c_spi; + int programmer_init(const struct programmer_entry *prog, const char *param); int programmer_shutdown(void); @@ -241,7 +282,6 @@ void probe_superio(void); int register_superio(struct superio s); extern enum chipbustype internal_buses_supported; -extern const struct programmer_entry programmer_internal; #endif /* hwaccess.c */ @@ -277,178 +317,9 @@ void rmmio_valw(void *addr); void rmmio_vall(void *addr); -/* dummyflasher.c */ -#if CONFIG_DUMMY == 1 -extern const struct programmer_entry programmer_dummy; -#endif - -/* nic3com.c */ -#if CONFIG_NIC3COM == 1 -extern const struct programmer_entry programmer_nic3com; -#endif - -/* gfxnvidia.c */ -#if CONFIG_GFXNVIDIA == 1 -extern const struct programmer_entry programmer_gfxnvidia; -#endif - -/* raiden_debug_spi.c */ -#if CONFIG_RAIDEN_DEBUG_SPI == 1 -extern const struct programmer_entry programmer_raiden_debug_spi; -#endif - -/* drkaiser.c */ -#if CONFIG_DRKAISER == 1 -extern const struct programmer_entry programmer_drkaiser; -#endif - -/* nicrealtek.c */ -#if CONFIG_NICREALTEK == 1 -extern const struct programmer_entry programmer_nicrealtek; -#endif - -/* nicnatsemi.c */ -#if CONFIG_NICNATSEMI == 1 -extern const struct programmer_entry programmer_nicnatsemi; -#endif - -/* nicintel.c */ -#if CONFIG_NICINTEL == 1 -extern const struct programmer_entry programmer_nicintel; -#endif - -/* nicintel_spi.c */ -#if CONFIG_NICINTEL_SPI == 1 -extern const struct programmer_entry programmer_nicintel_spi; -#endif - -/* nicintel_eeprom.c */ -#if CONFIG_NICINTEL_EEPROM == 1 -extern const struct programmer_entry programmer_nicintel_eeprom; -#endif - -/* ogp_spi.c */ -#if CONFIG_OGP_SPI == 1 -extern const struct programmer_entry programmer_ogp_spi; -#endif - -/* satamv.c */ -#if CONFIG_SATAMV == 1 -extern const struct programmer_entry programmer_satamv; -#endif - -/* satasii.c */ -#if CONFIG_SATASII == 1 -extern const struct programmer_entry programmer_satasii; -#endif - -/* atahpt.c */ -#if CONFIG_ATAHPT == 1 -extern const struct programmer_entry programmer_atahpt; -#endif - -/* atavia.c */ -#if CONFIG_ATAVIA == 1 -extern const struct programmer_entry programmer_atavia; -#endif - -/* atapromise.c */ -#if CONFIG_ATAPROMISE == 1 -extern const struct programmer_entry programmer_atapromise; -#endif - -/* it8212.c */ -#if CONFIG_IT8212 == 1 -extern const struct programmer_entry programmer_it8212; -#endif - -/* ft2232_spi.c */ -#if CONFIG_FT2232_SPI == 1 -extern const struct programmer_entry programmer_ft2232_spi; -#endif - -/* usbblaster_spi.c */ -#if CONFIG_USBBLASTER_SPI == 1 -extern const struct programmer_entry programmer_usbblaster_spi; -#endif - -/* mstarddc_spi.c */ -#if CONFIG_MSTARDDC_SPI == 1 -extern const struct programmer_entry programmer_mstarddc_spi; -#endif - -/* pickit2_spi.c */ -#if CONFIG_PICKIT2_SPI == 1 -extern const struct programmer_entry programmer_pickit2_spi; -#endif - -/* stlinkv3_spi.c */ -#if CONFIG_STLINKV3_SPI == 1 -extern const struct programmer_entry programmer_stlinkv3_spi; -#endif - -/* rayer_spi.c */ -#if CONFIG_RAYER_SPI == 1 -extern const struct programmer_entry programmer_rayer_spi; -#endif - -/* pony_spi.c */ -#if CONFIG_PONY_SPI == 1 -extern const struct programmer_entry programmer_pony_spi; -#endif - /* bitbang_spi.c */ int register_spi_bitbang_master(const struct bitbang_spi_master *master, void *spi_data); -/* buspirate_spi.c */ -#if CONFIG_BUSPIRATE_SPI == 1 -extern const struct programmer_entry programmer_buspirate_spi; -#endif - -/* linux_mtd.c */ -#if CONFIG_LINUX_MTD == 1 -extern const struct programmer_entry programmer_linux_mtd; -#endif - -/* linux_spi.c */ -#if CONFIG_LINUX_SPI == 1 -extern const struct programmer_entry programmer_linux_spi; -#endif - -/* dediprog.c */ -#if CONFIG_DEDIPROG == 1 -extern const struct programmer_entry programmer_dediprog; -#endif - -/* developerbox_spi.c */ -#if CONFIG_DEVELOPERBOX_SPI == 1 -extern const struct programmer_entry programmer_developerbox; -#endif - -/* ch341a_spi.c */ -#if CONFIG_CH341A_SPI == 1 -extern const struct programmer_entry programmer_ch341a_spi; -#endif - -/* digilent_spi.c */ -#if CONFIG_DIGILENT_SPI == 1 -extern const struct programmer_entry programmer_digilent_spi; -#endif - -/* ene_lpc.c */ -#if CONFIG_ENE_LPC == 1 -extern const struct programmer_entry programmer_ene_lpc; -#endif - -/* jlink_spi.c */ -#if CONFIG_JLINK_SPI == 1 -extern const struct programmer_entry programmer_jlink_spi; -#endif - -/* ni845x_spi.c */ -#if CONFIG_NI845X_SPI == 1 -extern const struct programmer_entry programmer_ni845x_spi; -#endif /* flashrom.c */ struct decode_sizes { @@ -553,10 +424,7 @@ /* mcp6x_spi.c */ int mcp6x_spi_init(int want_spi); -/* mec1308.c */ -#if CONFIG_MEC1308 == 1 -extern const struct programmer_entry programmer_mec1308; -#endif + /* sb600spi.c */ int sb600_probe_spi(struct pci_dev *dev); @@ -611,10 +479,7 @@ extern int registered_master_count; int register_master(const struct registered_master *mst); -/* serprog.c */ -#if CONFIG_SERPROG == 1 -extern const struct programmer_entry programmer_serprog; -#endif + /* serial.c */ #if IS_WINDOWS @@ -682,14 +547,5 @@ struct libusb_device_handle *usb_dev_get_by_vid_pid_number( struct libusb_context *usb_ctx, uint16_t vid, uint16_t pid, unsigned int num); -/* lspcon_i2c_spi.c */ -#if CONFIG_LSPCON_I2C_SPI == 1 -extern const struct programmer_entry programmer_lspcon_i2c_spi; -#endif - -/* realtek_mst_i2c_spi.c */ -#if CONFIG_REALTEK_MST_I2C_SPI == 1 -extern const struct programmer_entry programmer_realtek_mst_i2c_spi; -#endif #endif /* !__PROGRAMMER_H__ */ -- To view, visit
https://review.coreboot.org/c/flashrom/+/55387
To unsubscribe, or for help writing mail filters, visit
https://review.coreboot.org/settings
Gerrit-Project: flashrom Gerrit-Branch: master Gerrit-Change-Id: I01e6a785269c3e0bd648eeaee217a7a855ab0853 Gerrit-Change-Number: 55387 Gerrit-PatchSet: 1 Gerrit-Owner: Thomas Heijligen <src(a)posteo.de> Gerrit-MessageType: newchange
1
0
0
0
Change in flashrom[master]: nicrealtek.c: Refactor singleton states into reentrant pattern
by Nico Huber (Code Review)
10 Jun '21
10 Jun '21
Nico Huber has submitted this change. (
https://review.coreboot.org/c/flashrom/+/55108
) Change subject: nicrealtek.c: Refactor singleton states into reentrant pattern ...................................................................... nicrealtek.c: Refactor singleton states into reentrant pattern Move global singleton states into a struct and store within the par_master data field for the life-time of the driver. This is one of the steps on the way to move par_master data memory management behind the initialisation API, for more context see other patches under the same topic "register_master_api". BUG=b:185191942 TEST=builds Change-Id: If0cb0fefb53b2c6bb65a85f4c8dc6f323954dd0c Signed-off-by: Anastasia Klimchuk <aklm(a)chromium.org> Reviewed-on:
https://review.coreboot.org/c/flashrom/+/55108
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec(a)chromium.org> Reviewed-by: Nico Huber <nico.h(a)gmx.de> --- M nicrealtek.c 1 file changed, 31 insertions(+), 10 deletions(-) Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, but someone else must approve Edward O'Callaghan: Looks good to me, approved diff --git a/nicrealtek.c b/nicrealtek.c index 53d3c3d..81d305b 100644 --- a/nicrealtek.c +++ b/nicrealtek.c @@ -24,8 +24,11 @@ #define PCI_VENDOR_ID_REALTEK 0x10ec #define PCI_VENDOR_ID_SMC1211 0x1113 -static uint32_t io_base_addr = 0; -static int bios_rom_addr, bios_rom_data; +struct nicrealtek_data { + uint32_t io_base_addr; + int bios_rom_addr; + int bios_rom_data; +}; static const struct dev_entry nics_realtek[] = { {0x10ec, 0x8139, OK, "Realtek", "RTL8139/8139C/8139C+"}, @@ -37,38 +40,41 @@ static void nicrealtek_chip_writeb(const struct flashctx *flash, uint8_t val, chipaddr addr) { + struct nicrealtek_data *data = flash->mst->par.data; + /* Output addr and data, set WE to 0, set OE to 1, set CS to 0, * enable software access. */ OUTL(((uint32_t)addr & 0x01FFFF) | 0x0A0000 | (val << 24), - io_base_addr + bios_rom_addr); + data->io_base_addr + data->bios_rom_addr); /* Output addr and data, set WE to 1, set OE to 1, set CS to 1, * enable software access. */ OUTL(((uint32_t)addr & 0x01FFFF) | 0x1E0000 | (val << 24), - io_base_addr + bios_rom_addr); + data->io_base_addr + data->bios_rom_addr); } static uint8_t nicrealtek_chip_readb(const struct flashctx *flash, const chipaddr addr) { + struct nicrealtek_data *data = flash->mst->par.data; uint8_t val; /* FIXME: Can we skip reading the old data and simply use 0? */ /* Read old data. */ - val = INB(io_base_addr + bios_rom_data); + val = INB(data->io_base_addr + data->bios_rom_data); /* Output new addr and old data, set WE to 1, set OE to 0, set CS to 0, * enable software access. */ OUTL(((uint32_t)addr & 0x01FFFF) | 0x060000 | (val << 24), - io_base_addr + bios_rom_addr); + data->io_base_addr + data->bios_rom_addr); /* Read new data. */ - val = INB(io_base_addr + bios_rom_data); + val = INB(data->io_base_addr + data->bios_rom_data); /* Output addr and new data, set WE to 1, set OE to 1, set CS to 1, * enable software access. */ OUTL(((uint32_t)addr & 0x01FFFF) | 0x1E0000 | (val << 24), - io_base_addr + bios_rom_addr); + data->io_base_addr + data->bios_rom_addr); return val; } @@ -87,12 +93,16 @@ static int nicrealtek_shutdown(void *data) { /* FIXME: We forgot to disable software access again. */ + free(data); return 0; } static int nicrealtek_init(void) { struct pci_dev *dev = NULL; + uint32_t io_base_addr = 0; + int bios_rom_addr; + int bios_rom_data; if (rget_io_perms()) return 1; @@ -119,10 +129,21 @@ break; } - if (register_shutdown(nicrealtek_shutdown, NULL)) + struct nicrealtek_data *data = calloc(1, sizeof(*data)); + if (!data) { + msg_perr("Unable to allocate space for PAR master data\n"); return 1; + } + data->io_base_addr = io_base_addr; + data->bios_rom_addr = bios_rom_addr; + data->bios_rom_data = bios_rom_data; - register_par_master(&par_master_nicrealtek, BUS_PARALLEL, NULL); + if (register_shutdown(nicrealtek_shutdown, data)) { + free(data); + return 1; + } + + register_par_master(&par_master_nicrealtek, BUS_PARALLEL, data); return 0; } -- To view, visit
https://review.coreboot.org/c/flashrom/+/55108
To unsubscribe, or for help writing mail filters, visit
https://review.coreboot.org/settings
Gerrit-Project: flashrom Gerrit-Branch: master Gerrit-Change-Id: If0cb0fefb53b2c6bb65a85f4c8dc6f323954dd0c Gerrit-Change-Number: 55108 Gerrit-PatchSet: 3 Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org> Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com> Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org> Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de> Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org> Gerrit-MessageType: merged
1
0
0
0
Change in flashrom[master]: buspirate_spi.c: Drop bp_ prefix for spi data struct members
by Nico Huber (Code Review)
10 Jun '21
10 Jun '21
Attention is currently required from: Angel Pons, Anastasia Klimchuk. Nico Huber has posted comments on this change. (
https://review.coreboot.org/c/flashrom/+/54886
) Change subject: buspirate_spi.c: Drop bp_ prefix for spi data struct members ...................................................................... Patch Set 2: Code-Review+2 -- To view, visit
https://review.coreboot.org/c/flashrom/+/54886
To unsubscribe, or for help writing mail filters, visit
https://review.coreboot.org/settings
Gerrit-Project: flashrom Gerrit-Branch: master Gerrit-Change-Id: Ia463e3f58497e4b10be072bdd29244f4868098e7 Gerrit-Change-Number: 54886 Gerrit-PatchSet: 2 Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org> Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com> Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org> Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de> Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org> Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org> Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com> Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org> Gerrit-Comment-Date: Thu, 10 Jun 2021 12:58:38 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1
0
0
0
Change in flashrom[master]: buspirate_spi.c: Refactor singleton states into reentrant pattern
by Nico Huber (Code Review)
10 Jun '21
10 Jun '21
Attention is currently required from: Angel Pons, Anastasia Klimchuk. Nico Huber has posted comments on this change. (
https://review.coreboot.org/c/flashrom/+/52958
) Change subject: buspirate_spi.c: Refactor singleton states into reentrant pattern ...................................................................... Patch Set 4: Code-Review+2 -- To view, visit
https://review.coreboot.org/c/flashrom/+/52958
To unsubscribe, or for help writing mail filters, visit
https://review.coreboot.org/settings
Gerrit-Project: flashrom Gerrit-Branch: master Gerrit-Change-Id: I418bbfff15fb126b042fbc9be09dbf59f4d243b8 Gerrit-Change-Number: 52958 Gerrit-PatchSet: 4 Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org> Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com> Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org> Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de> Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org> Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org> Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com> Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org> Gerrit-Comment-Date: Thu, 10 Jun 2021 12:57:51 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1
0
0
0
Change in flashrom[master]: enum programmer: not needed anymore. Remove
by Nico Huber (Code Review)
10 Jun '21
10 Jun '21
Nico Huber has submitted this change. (
https://review.coreboot.org/c/flashrom/+/55124
) Change subject: enum programmer: not needed anymore. Remove ...................................................................... enum programmer: not needed anymore. Remove Change-Id: I53cdb160616911a4beea6b5e8e56d582621818a4 Signed-off-by: Thomas Heijligen <thomas.heijligen(a)secunet.de> Reviewed-on:
https://review.coreboot.org/c/flashrom/+/55124
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org> Reviewed-by: Nico Huber <nico.h(a)gmx.de> Reviewed-by: Edward O'Callaghan <quasisec(a)chromium.org> --- M flashrom.c M programmer.h 2 files changed, 0 insertions(+), 128 deletions(-) Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved Edward O'Callaghan: Looks good to me, approved diff --git a/flashrom.c b/flashrom.c index c3bab17..90e1864 100644 --- a/flashrom.c +++ b/flashrom.c @@ -1708,13 +1708,6 @@ unsigned int i; int ret = 0; - /* Safety check. Instead of aborting after the first error, check - * if more errors exist. - */ - if (programmer_table_size != PROGRAMMER_INVALID) { - msg_gerr("Programmer table miscompilation!\n"); - ret = 1; - } for (i = 0; i < programmer_table_size; i++) { const struct programmer_entry *const p = programmer_table[i]; if (p == NULL) { diff --git a/programmer.h b/programmer.h index 809674f..be6010d 100644 --- a/programmer.h +++ b/programmer.h @@ -24,127 +24,6 @@ #include "flash.h" /* for chipaddr and flashctx */ -enum programmer { -#if CONFIG_INTERNAL == 1 - PROGRAMMER_INTERNAL, -#endif -#if CONFIG_DUMMY == 1 - PROGRAMMER_DUMMY, -#endif -#if CONFIG_MEC1308 == 1 - PROGRAMMER_MEC1308, -#endif -#if CONFIG_NIC3COM == 1 - PROGRAMMER_NIC3COM, -#endif -#if CONFIG_NICREALTEK == 1 - PROGRAMMER_NICREALTEK, -#endif -#if CONFIG_NICNATSEMI == 1 - PROGRAMMER_NICNATSEMI, -#endif -#if CONFIG_GFXNVIDIA == 1 - PROGRAMMER_GFXNVIDIA, -#endif -#if CONFIG_RAIDEN_DEBUG_SPI == 1 - PROGRAMMER_RAIDEN_DEBUG_SPI, -#endif -#if CONFIG_DRKAISER == 1 - PROGRAMMER_DRKAISER, -#endif -#if CONFIG_SATASII == 1 - PROGRAMMER_SATASII, -#endif -#if CONFIG_ATAHPT == 1 - PROGRAMMER_ATAHPT, -#endif -#if CONFIG_ATAVIA == 1 - PROGRAMMER_ATAVIA, -#endif -#if CONFIG_ATAPROMISE == 1 - PROGRAMMER_ATAPROMISE, -#endif -#if CONFIG_IT8212 == 1 - PROGRAMMER_IT8212, -#endif -#if CONFIG_FT2232_SPI == 1 - PROGRAMMER_FT2232_SPI, -#endif -#if CONFIG_SERPROG == 1 - PROGRAMMER_SERPROG, -#endif -#if CONFIG_BUSPIRATE_SPI == 1 - PROGRAMMER_BUSPIRATE_SPI, -#endif -#if CONFIG_DEDIPROG == 1 - PROGRAMMER_DEDIPROG, -#endif -#if CONFIG_DEVELOPERBOX_SPI == 1 - PROGRAMMER_DEVELOPERBOX_SPI, -#endif -#if CONFIG_ENE_LPC == 1 - PROGRAMMER_ENE_LPC, -#endif -#if CONFIG_RAYER_SPI == 1 - PROGRAMMER_RAYER_SPI, -#endif -#if CONFIG_PONY_SPI == 1 - PROGRAMMER_PONY_SPI, -#endif -#if CONFIG_NICINTEL == 1 - PROGRAMMER_NICINTEL, -#endif -#if CONFIG_NICINTEL_SPI == 1 - PROGRAMMER_NICINTEL_SPI, -#endif -#if CONFIG_NICINTEL_EEPROM == 1 - PROGRAMMER_NICINTEL_EEPROM, -#endif -#if CONFIG_OGP_SPI == 1 - PROGRAMMER_OGP_SPI, -#endif -#if CONFIG_SATAMV == 1 - PROGRAMMER_SATAMV, -#endif -#if CONFIG_LINUX_MTD == 1 - PROGRAMMER_LINUX_MTD, -#endif -#if CONFIG_LINUX_SPI == 1 - PROGRAMMER_LINUX_SPI, -#endif -#if CONFIG_USBBLASTER_SPI == 1 - PROGRAMMER_USBBLASTER_SPI, -#endif -#if CONFIG_MSTARDDC_SPI == 1 - PROGRAMMER_MSTARDDC_SPI, -#endif -#if CONFIG_PICKIT2_SPI == 1 - PROGRAMMER_PICKIT2_SPI, -#endif -#if CONFIG_CH341A_SPI == 1 - PROGRAMMER_CH341A_SPI, -#endif -#if CONFIG_DIGILENT_SPI == 1 - PROGRAMMER_DIGILENT_SPI, -#endif -#if CONFIG_JLINK_SPI == 1 - PROGRAMMER_JLINK_SPI, -#endif -#if CONFIG_NI845X_SPI == 1 - PROGRAMMER_NI845X_SPI, -#endif -#if CONFIG_STLINKV3_SPI == 1 - PROGRAMMER_STLINKV3_SPI, -#endif -#if CONFIG_LSPCON_I2C_SPI == 1 - PROGRAMMER_LSPCON_I2C_SPI, -#endif -#if CONFIG_REALTEK_MST_I2C_SPI == 1 - PROGRAMMER_REALTEK_MST_I2C_SPI, -#endif - PROGRAMMER_INVALID /* This must always be the last entry. */ -}; - enum programmer_type { PCI = 1, /* to detect uninitialized values */ USB, -- To view, visit
https://review.coreboot.org/c/flashrom/+/55124
To unsubscribe, or for help writing mail filters, visit
https://review.coreboot.org/settings
Gerrit-Project: flashrom Gerrit-Branch: master Gerrit-Change-Id: I53cdb160616911a4beea6b5e8e56d582621818a4 Gerrit-Change-Number: 55124 Gerrit-PatchSet: 17 Gerrit-Owner: Thomas Heijligen <src(a)posteo.de> Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org> Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de> Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org> Gerrit-CC: Anastasia Klimchuk <aklm(a)chromium.org> Gerrit-CC: Angel Pons <th3fanbus(a)gmail.com> Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org> Gerrit-CC: Xiang W <wxjstz(a)126.com> Gerrit-MessageType: merged
1
0
0
0
Change in flashrom[master]: CONFIG_DEFAULT_PROGRAMMER_NAME: Use programmer name instead of enum
by Nico Huber (Code Review)
10 Jun '21
10 Jun '21
Nico Huber has submitted this change. (
https://review.coreboot.org/c/flashrom/+/55123
) Change subject: CONFIG_DEFAULT_PROGRAMMER_NAME: Use programmer name instead of enum ...................................................................... CONFIG_DEFAULT_PROGRAMMER_NAME: Use programmer name instead of enum CONFIG_DEFAULT_PROGRAMER_NAME replaces CONFIG_DEFAULT_PROGRAMMER. It uses the name of the programmer for identification. make CONFIG_DEFAULT_PROGRAMER_NAME=dummy and meson -Ddefault_programmer_name=dummy will extend to CONFIG_DEFAULT_PROGRAMER_NAME=&programmer_dummy in the code. Change-Id: I976447787c6f6bfbdc0145d80d61e1ddcf97ac33 Signed-off-by: Thomas Heijligen <thomas.heijligen(a)secunet.de> Reviewed-on:
https://review.coreboot.org/c/flashrom/+/55123
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org> Reviewed-by: Nico Huber <nico.h(a)gmx.de> --- M Makefile M cli_classic.c M meson.build M meson_options.txt M tests/meson.build 5 files changed, 28 insertions(+), 16 deletions(-) Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved diff --git a/Makefile b/Makefile index 4eb4191..be6e551 100644 --- a/Makefile +++ b/Makefile @@ -44,14 +44,12 @@ # system attached to an external programmer while the default programmer is set to the internal programmer, and # you forget to use the -p parameter. This would (try to) overwrite the existing firmware of the computer # running flashrom). Please do not enable this without thinking about the possible consequences. Possible -# values are those specified in enum programmer in programmer.h (which depend on other CONFIG_* options -# evaluated below, namely those that enable/disable the various programmers). -# Compilation will fail for unspecified values. -CONFIG_DEFAULT_PROGRAMMER ?= PROGRAMMER_INVALID +# values can be found when running 'flashrom --list-supported' under the 'Supported programmers' section. +CONFIG_DEFAULT_PROGRAMMER_NAME ?= # The following adds a default parameter for the default programmer set above (only). -CONFIG_DEFAULT_PROGRAMMER_ARGS ?= '' +CONFIG_DEFAULT_PROGRAMMER_ARGS ?= # Example: compiling with -# make CONFIG_DEFAULT_PROGRAMMER=PROGRAMMER_SERPROG CONFIG_DEFAULT_PROGRAMMER_ARGS="dev=/dev/ttyUSB0:1500000" +# make CONFIG_DEFAULT_PROGRAMMER_NAME=serprog CONFIG_DEFAULT_PROGRAMMER_ARGS="dev=/dev/ttyUSB0:1500000" # would make executing './flashrom' (almost) equivialent to './flashrom -p serprog:dev=/dev/ttyUSB0:1500000'. # If your compiler spits out excessive warnings, run make WARNERROR=no @@ -868,7 +866,12 @@ # Programmer drivers and programmer support infrastructure. # Depending on the CONFIG_* variables set and verified above we set compiler flags and parameters below. -FEATURE_CFLAGS += -D'CONFIG_DEFAULT_PROGRAMMER=$(CONFIG_DEFAULT_PROGRAMMER)' +ifdef CONFIG_DEFAULT_PROGRAMMER_NAME +FEATURE_CFLAGS += -D'CONFIG_DEFAULT_PROGRAMMER_NAME=&programmer_$(CONFIG_DEFAULT_PROGRAMMER_NAME)' +else +FEATURE_CFLAGS += -D'CONFIG_DEFAULT_PROGRAMMER_NAME=NULL' +endif + FEATURE_CFLAGS += -D'CONFIG_DEFAULT_PROGRAMMER_ARGS="$(CONFIG_DEFAULT_PROGRAMMER_ARGS)"' ifeq ($(CONFIG_INTERNAL), yes) diff --git a/cli_classic.c b/cli_classic.c index 4537e1e..158110b 100644 --- a/cli_classic.c +++ b/cli_classic.c @@ -172,7 +172,6 @@ int read_it = 0, extract_it = 0, write_it = 0, erase_it = 0, verify_it = 0; int dont_verify_it = 0, dont_verify_all = 0, list_supported = 0, operation_specified = 0; struct flashrom_layout *layout = NULL; - // enum programmer prog = PROGRAMMER_INVALID; static const struct programmer_entry *prog = NULL; enum { OPTION_IFD = 0x0100, @@ -544,12 +543,14 @@ } if (prog == NULL) { - if (CONFIG_DEFAULT_PROGRAMMER != PROGRAMMER_INVALID) { - prog = programmer_table[CONFIG_DEFAULT_PROGRAMMER]; + const struct programmer_entry *const default_programmer = CONFIG_DEFAULT_PROGRAMMER_NAME; + + if (default_programmer) { + prog = default_programmer; /* We need to strdup here because we free(pparam) unconditionally later. */ pparam = strdup(CONFIG_DEFAULT_PROGRAMMER_ARGS); msg_pinfo("Using default programmer \"%s\" with arguments \"%s\".\n", - programmer_table[CONFIG_DEFAULT_PROGRAMMER]->name, pparam); + default_programmer->name, pparam); } else { msg_perr("Please select a programmer with the --programmer parameter.\n" #if CONFIG_INTERNAL == 1 diff --git a/meson.build b/meson.build index 0017071..6ebf3dc 100644 --- a/meson.build +++ b/meson.build @@ -69,6 +69,8 @@ config_lspcon_i2c_spi = get_option('config_lspcon_i2c_spi') config_realtek_mst_i2c_spi = get_option('config_realtek_mst_i2c_spi') config_print_wiki= get_option('print_wiki') +config_default_programmer_name = get_option('default_programmer_name') +config_default_programmer_args = get_option('default_programmer_args') cargs = [] deps = [] @@ -436,6 +438,14 @@ cargs += '-DCONFIG_PRINT_WIKI=1' endif +if config_default_programmer_name != '' + cargs += '-DCONFIG_DEFAULT_PROGRAMMER_NAME=&programmer_' + config_default_programmer_name +else + cargs += '-DCONFIG_DEFAULT_PROGRAMMER_NAME=NULL' +endif + +cargs += '-DCONFIG_DEFAULT_PROGRAMMER_ARGS="' + config_default_programmer_args + '"' + # we can't just link_with libflashrom as we require all the internal symbols... executable( 'flashrom', @@ -450,9 +460,7 @@ deps, ], c_args : [ - cargs, - '-DCONFIG_DEFAULT_PROGRAMMER=PROGRAMMER_INVALID', - '-DCONFIG_DEFAULT_PROGRAMMER_ARGS=""', + cargs ], install : true, install_dir : sbindir, diff --git a/meson_options.txt b/meson_options.txt index cd92f10..86a38c8 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,6 +1,8 @@ option('pciutils', type : 'boolean', value : true, description : 'use pciutils') option('usb', type : 'boolean', value : true, description : 'use libusb1') option('print_wiki', type : 'boolean', value : true, description : 'Print Wiki') +option('default_programmer_name', type : 'string', description : 'default programmer') +option('default_programmer_args', type : 'string', description : 'default programmer arguments') option('config_atahpt', type : 'boolean', value : false, description : 'Highpoint (HPT) ATA/RAID controllers') option('config_atapromise', type : 'boolean', value : false, description : 'Promise ATA controller') diff --git a/tests/meson.build b/tests/meson.build index d17567e..852fd4c 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -50,8 +50,6 @@ '-ffunction-sections', '-fdata-sections', # '-DSTANDALONE', - '-DCONFIG_DEFAULT_PROGRAMMER=PROGRAMMER_DUMMY', - '-DCONFIG_DEFAULT_PROGRAMMER_ARGS=""', ], export_dynamic : true, link_args : mocks, -- To view, visit
https://review.coreboot.org/c/flashrom/+/55123
To unsubscribe, or for help writing mail filters, visit
https://review.coreboot.org/settings
Gerrit-Project: flashrom Gerrit-Branch: master Gerrit-Change-Id: I976447787c6f6bfbdc0145d80d61e1ddcf97ac33 Gerrit-Change-Number: 55123 Gerrit-PatchSet: 17 Gerrit-Owner: Thomas Heijligen <src(a)posteo.de> Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de> Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org> Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org> Gerrit-CC: Xiang W <wxjstz(a)126.com> Gerrit-MessageType: merged
1
0
0
0
Change in flashrom[master]: cli_classic: replace enum programmer with programmer_entry*
by Nico Huber (Code Review)
10 Jun '21
10 Jun '21
Nico Huber has submitted this change. (
https://review.coreboot.org/c/flashrom/+/55122
) Change subject: cli_classic: replace enum programmer with programmer_entry* ...................................................................... cli_classic: replace enum programmer with programmer_entry* Change-Id: I4c45f278addeea0d486a316435e8dc15d93cbd70 Signed-off-by: Thomas Heijligen <thomas.heijligen(a)secunet.de> Reviewed-on:
https://review.coreboot.org/c/flashrom/+/55122
Reviewed-by: Angel Pons <th3fanbus(a)gmail.com> Reviewed-by: Nico Huber <nico.h(a)gmx.de> Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org> --- M cli_classic.c 1 file changed, 12 insertions(+), 8 deletions(-) Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved Angel Pons: Looks good to me, but someone else must approve diff --git a/cli_classic.c b/cli_classic.c index ba6885c..4537e1e 100644 --- a/cli_classic.c +++ b/cli_classic.c @@ -172,7 +172,8 @@ int read_it = 0, extract_it = 0, write_it = 0, erase_it = 0, verify_it = 0; int dont_verify_it = 0, dont_verify_all = 0, list_supported = 0, operation_specified = 0; struct flashrom_layout *layout = NULL; - enum programmer prog = PROGRAMMER_INVALID; + // enum programmer prog = PROGRAMMER_INVALID; + static const struct programmer_entry *prog = NULL; enum { OPTION_IFD = 0x0100, OPTION_FMAP, @@ -399,15 +400,16 @@ #endif break; case 'p': - if (prog != PROGRAMMER_INVALID) { + if (prog != NULL) { cli_classic_abort_usage("Error: --programmer specified " "more than once. You can separate " "multiple\nparameters for a programmer " "with \",\". Please see the man page " "for details.\n"); } - for (prog = 0; prog < programmer_table_size; prog++) { - name = programmer_table[prog]->name; + size_t p; + for (p = 0; p < programmer_table_size; p++) { + name = programmer_table[p]->name; namelen = strlen(name); if (strncmp(optarg, name, namelen) == 0) { switch (optarg[namelen]) { @@ -417,8 +419,10 @@ free(pparam); pparam = NULL; } + prog = programmer_table[p]; break; case '\0': + prog = programmer_table[p]; break; default: /* The continue refers to the @@ -431,7 +435,7 @@ break; } } - if (prog == PROGRAMMER_INVALID) { + if (prog == NULL) { fprintf(stderr, "Error: Unknown programmer \"%s\". Valid choices are:\n", optarg); list_programmers_linebreak(0, 80, 0); @@ -539,9 +543,9 @@ /* Keep chip around for later usage in case a forced read is requested. */ } - if (prog == PROGRAMMER_INVALID) { + if (prog == NULL) { if (CONFIG_DEFAULT_PROGRAMMER != PROGRAMMER_INVALID) { - prog = CONFIG_DEFAULT_PROGRAMMER; + prog = programmer_table[CONFIG_DEFAULT_PROGRAMMER]; /* We need to strdup here because we free(pparam) unconditionally later. */ pparam = strdup(CONFIG_DEFAULT_PROGRAMMER_ARGS); msg_pinfo("Using default programmer \"%s\" with arguments \"%s\".\n", @@ -562,7 +566,7 @@ /* FIXME: Delay calibration should happen in programmer code. */ myusec_calibrate_delay(); - if (programmer_init(programmer_table[prog], pparam)) { + if (programmer_init(prog, pparam)) { msg_perr("Error: Programmer initialization failed.\n"); ret = 1; goto out_shutdown; -- To view, visit
https://review.coreboot.org/c/flashrom/+/55122
To unsubscribe, or for help writing mail filters, visit
https://review.coreboot.org/settings
Gerrit-Project: flashrom Gerrit-Branch: master Gerrit-Change-Id: I4c45f278addeea0d486a316435e8dc15d93cbd70 Gerrit-Change-Number: 55122 Gerrit-PatchSet: 15 Gerrit-Owner: Thomas Heijligen <src(a)posteo.de> Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com> Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de> Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org> Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org> Gerrit-CC: Xiang W <wxjstz(a)126.com> Gerrit-MessageType: merged
1
0
0
0
Change in flashrom[master]: programmer_init: use struct programmer_entry*
by Nico Huber (Code Review)
10 Jun '21
10 Jun '21
Nico Huber has submitted this change. (
https://review.coreboot.org/c/flashrom/+/55121
) Change subject: programmer_init: use struct programmer_entry* ...................................................................... programmer_init: use struct programmer_entry* Change-Id: Iacf0f25abc94a84c5d52c8d69a3e8640817b060a Signed-off-by: Thomas Heijligen <thomas.heijligen(a)secunet.de> Reviewed-on:
https://review.coreboot.org/c/flashrom/+/55121
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org> Reviewed-by: Nico Huber <nico.h(a)gmx.de> --- M cli_classic.c M flashrom.c M libflashrom.c M programmer.h M tests/init_shutdown.c 5 files changed, 15 insertions(+), 15 deletions(-) Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved diff --git a/cli_classic.c b/cli_classic.c index f3ae123..ba6885c 100644 --- a/cli_classic.c +++ b/cli_classic.c @@ -562,7 +562,7 @@ /* FIXME: Delay calibration should happen in programmer code. */ myusec_calibrate_delay(); - if (programmer_init(prog, pparam)) { + if (programmer_init(programmer_table[prog], pparam)) { msg_perr("Error: Programmer initialization failed.\n"); ret = 1; goto out_shutdown; diff --git a/flashrom.c b/flashrom.c index 9a7fb18..c3bab17 100644 --- a/flashrom.c +++ b/flashrom.c @@ -130,15 +130,15 @@ return rc; } -int programmer_init(enum programmer prog, const char *param) +int programmer_init(const struct programmer_entry *prog, const char *param) { int ret; - if (prog >= programmer_table_size) { + if (prog == NULL) { msg_perr("Invalid programmer specified!\n"); return -1; } - programmer = programmer_table[prog]; + programmer = prog; /* Initialize all programmer specific data. */ /* Default to unlimited decode sizes. */ max_rom_decode = (const struct decode_sizes) { diff --git a/libflashrom.c b/libflashrom.c index 1a8b051..67d3ef3 100644 --- a/libflashrom.c +++ b/libflashrom.c @@ -287,7 +287,7 @@ list_programmers_linebreak(0, 80, 0); return 1; } - return programmer_init(prog, prog_param); + return programmer_init(programmer_table[prog], prog_param); } /** diff --git a/programmer.h b/programmer.h index 0dda67e..809674f 100644 --- a/programmer.h +++ b/programmer.h @@ -178,7 +178,7 @@ extern const struct programmer_entry *const programmer_table[]; extern const size_t programmer_table_size; -int programmer_init(enum programmer prog, const char *param); +int programmer_init(const struct programmer_entry *prog, const char *param); int programmer_shutdown(void); struct bitbang_spi_master { diff --git a/tests/init_shutdown.c b/tests/init_shutdown.c index 4d9c549..80440bd 100644 --- a/tests/init_shutdown.c +++ b/tests/init_shutdown.c @@ -19,22 +19,22 @@ #include "io_mock.h" #include "programmer.h" -static void run_lifecycle(void **state, enum programmer prog, const char *param) +static void run_lifecycle(void **state, const struct programmer_entry *prog, const char *param) { (void) state; /* unused */ - printf("Testing programmer_init for programmer=%u ...\n", prog); + printf("Testing programmer_init for programmer=%s ...\n", prog->name); assert_int_equal(0, programmer_init(prog, strdup(param))); - printf("... programmer_init for programmer=%u successful\n", prog); + printf("... programmer_init for programmer=%s successful\n", prog->name); - printf("Testing programmer_shutdown for programmer=%u ...\n", prog); + printf("Testing programmer_shutdown for programmer=%s ...\n", prog->name); assert_int_equal(0, programmer_shutdown()); - printf("... programmer_shutdown for programmer=%u successful\n", prog); + printf("... programmer_shutdown for programmer=%s successful\n", prog->name); } void dummy_init_and_shutdown_test_success(void **state) { - run_lifecycle(state, PROGRAMMER_DUMMY, "bus=parallel+lpc+fwh+spi"); + run_lifecycle(state, &programmer_dummy, "bus=parallel+lpc+fwh+spi"); } struct mec1308_io_state { @@ -72,7 +72,7 @@ io_mock_register(&mec1308_io); will_return_always(__wrap_sio_read, 0x4d); /* MEC1308_DEVICE_ID_VAL */ - run_lifecycle(state, PROGRAMMER_MEC1308, ""); + run_lifecycle(state, &programmer_mec1308, ""); io_mock_register(NULL); } @@ -131,7 +131,7 @@ io_mock_register(&ene_lpc_io); - run_lifecycle(state, PROGRAMMER_ENE_LPC, ""); + run_lifecycle(state, &programmer_ene_lpc, ""); io_mock_register(NULL); } @@ -144,5 +144,5 @@ * and the fallback to getpagesize(). This test does the latter (fallback to * getpagesize). */ - run_lifecycle(state, PROGRAMMER_LINUX_SPI, "dev=/dev/null"); + run_lifecycle(state, &programmer_linux_spi, "dev=/dev/null"); } -- To view, visit
https://review.coreboot.org/c/flashrom/+/55121
To unsubscribe, or for help writing mail filters, visit
https://review.coreboot.org/settings
Gerrit-Project: flashrom Gerrit-Branch: master Gerrit-Change-Id: Iacf0f25abc94a84c5d52c8d69a3e8640817b060a Gerrit-Change-Number: 55121 Gerrit-PatchSet: 14 Gerrit-Owner: Thomas Heijligen <src(a)posteo.de> Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org> Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com> Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org> Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de> Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org> Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org> Gerrit-CC: Xiang W <wxjstz(a)126.com> Gerrit-MessageType: merged
1
0
0
0
Change in flashrom[master]: flashrom.c libflashrom.c: replace enum programmer with size_t
by Nico Huber (Code Review)
10 Jun '21
10 Jun '21
Nico Huber has submitted this change. (
https://review.coreboot.org/c/flashrom/+/55120
) Change subject: flashrom.c libflashrom.c: replace enum programmer with size_t ...................................................................... flashrom.c libflashrom.c: replace enum programmer with size_t Using size_t since programmer_table_size uses ARRAY_SIZE which returns size_t. Change-Id: Id2ad9630fbc41e98d182768b553788e069fa5095 Signed-off-by: Thomas Heijligen <thomas.heijligen(a)secunet.de> Reviewed-on:
https://review.coreboot.org/c/flashrom/+/55120
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org> Reviewed-by: Nico Huber <nico.h(a)gmx.de> --- M flashrom.c M libflashrom.c 2 files changed, 2 insertions(+), 2 deletions(-) Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved diff --git a/flashrom.c b/flashrom.c index 0476b3d..9a7fb18 100644 --- a/flashrom.c +++ b/flashrom.c @@ -1582,7 +1582,7 @@ const char *pname; int pnamelen; int remaining = 0, firstline = 1; - enum programmer p; + size_t p; int i; for (p = 0; p < programmer_table_size; p++) { diff --git a/libflashrom.c b/libflashrom.c index f3df1c7..1a8b051 100644 --- a/libflashrom.c +++ b/libflashrom.c @@ -119,7 +119,7 @@ */ const char **flashrom_supported_programmers(void) { - enum programmer p = 0; + size_t p = 0; const char **supported_programmers = malloc((programmer_table_size + 1) * sizeof(char*)); if (supported_programmers != NULL) { -- To view, visit
https://review.coreboot.org/c/flashrom/+/55120
To unsubscribe, or for help writing mail filters, visit
https://review.coreboot.org/settings
Gerrit-Project: flashrom Gerrit-Branch: master Gerrit-Change-Id: Id2ad9630fbc41e98d182768b553788e069fa5095 Gerrit-Change-Number: 55120 Gerrit-PatchSet: 13 Gerrit-Owner: Thomas Heijligen <src(a)posteo.de> Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org> Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com> Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org> Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de> Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org> Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org> Gerrit-CC: Xiang W <wxjstz(a)126.com> Gerrit-MessageType: merged
1
0
0
0
Change in flashrom[master]: flashrom.c: replace enum programmer with struct programmer_entry*
by Nico Huber (Code Review)
10 Jun '21
10 Jun '21
Nico Huber has submitted this change. (
https://review.coreboot.org/c/flashrom/+/55119
) Change subject: flashrom.c: replace enum programmer with struct programmer_entry* ...................................................................... flashrom.c: replace enum programmer with struct programmer_entry* Change-Id: I478c56354d5f482010bfe1560489700bc889717a Signed-off-by: Thomas Heijligen <thomas.heijligen(a)secunet.de> Reviewed-on:
https://review.coreboot.org/c/flashrom/+/55119
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org> Reviewed-by: Nico Huber <nico.h(a)gmx.de> --- M flashrom.c 1 file changed, 12 insertions(+), 12 deletions(-) Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved diff --git a/flashrom.c b/flashrom.c index c036fea..0476b3d 100644 --- a/flashrom.c +++ b/flashrom.c @@ -43,7 +43,7 @@ const char flashrom_version[] = FLASHROM_VERSION; const char *chip_to_probe = NULL; -static enum programmer programmer = PROGRAMMER_INVALID; +static const struct programmer_entry *programmer = NULL; static const char *programmer_param = NULL; /* @@ -138,7 +138,7 @@ msg_perr("Invalid programmer specified!\n"); return -1; } - programmer = prog; + programmer = programmer_table[prog]; /* Initialize all programmer specific data. */ /* Default to unlimited decode sizes. */ max_rom_decode = (const struct decode_sizes) { @@ -155,8 +155,8 @@ programmer_may_write = 1; programmer_param = param; - msg_pdbg("Initializing %s programmer\n", programmer_table[programmer]->name); - ret = programmer_table[programmer]->init(); + msg_pdbg("Initializing %s programmer\n", programmer->name); + ret = programmer->init(); if (programmer_param && strlen(programmer_param)) { if (ret != 0) { /* It is quite possible that any unhandled programmer parameter would have been valid, @@ -200,7 +200,7 @@ void *programmer_map_flash_region(const char *descr, uintptr_t phys_addr, size_t len) { - void *ret = programmer_table[programmer]->map_flash_region(descr, phys_addr, len); + void *ret = programmer->map_flash_region(descr, phys_addr, len); msg_gspew("%s: mapping %s from 0x%0*" PRIxPTR " to 0x%0*" PRIxPTR "\n", __func__, descr, PRIxPTR_WIDTH, phys_addr, PRIxPTR_WIDTH, (uintptr_t) ret); return ret; @@ -208,7 +208,7 @@ void programmer_unmap_flash_region(void *virt_addr, size_t len) { - programmer_table[programmer]->unmap_flash_region(virt_addr, len); + programmer->unmap_flash_region(virt_addr, len); msg_gspew("%s: unmapped 0x%0*" PRIxPTR "\n", __func__, PRIxPTR_WIDTH, (uintptr_t)virt_addr); } @@ -256,7 +256,7 @@ void programmer_delay(unsigned int usecs) { if (usecs > 0) - programmer_table[programmer]->delay(usecs); + programmer->delay(usecs); } int read_memmapped(struct flashctx *flash, uint8_t *buf, unsigned int start, @@ -840,12 +840,12 @@ flash->chip->vendor, flash->chip->name, flash->chip->total_size, tmp); free(tmp); #if CONFIG_INTERNAL == 1 - if (programmer_table[programmer]->map_flash_region == physmap) + if (programmer->map_flash_region == physmap) msg_cinfo("mapped at physical address 0x%0*" PRIxPTR ".\n", PRIxPTR_WIDTH, flash->physical_memory); else #endif - msg_cinfo("on %s.\n", programmer_table[programmer]->name); + msg_cinfo("on %s.\n", programmer->name); /* Flash registers may more likely not be mapped if the chip was forced. * Lock info may be stored in registers, so avoid lock info printing. */ @@ -1548,7 +1548,7 @@ { msg_gerr("Good, writing to the flash chip apparently didn't do anything.\n"); #if CONFIG_INTERNAL == 1 - if (programmer == PROGRAMMER_INTERNAL) + if (programmer == &programmer_internal) msg_gerr("This means we have to add special support for your board, programmer or flash\n" "chip. Please report this on IRC at
chat.freenode.net
(channel #flashrom) or\n" "mail flashrom(a)flashrom.org, thanks!\n" @@ -1566,7 +1566,7 @@ { msg_gerr("Your flash chip is in an unknown state.\n"); #if CONFIG_INTERNAL == 1 - if (programmer == PROGRAMMER_INTERNAL) + if (programmer == &programmer_internal) msg_gerr("Get help on IRC at
chat.freenode.net
(channel #flashrom) or\n" "mail flashrom(a)flashrom.org with the subject \"FAILED: <your board name>\"!\n" "-------------------------------------------------------------------------------\n" @@ -2060,7 +2060,7 @@ } #if CONFIG_INTERNAL == 1 - if (programmer == PROGRAMMER_INTERNAL && cb_check_image(newcontents, flash_size) < 0) { + if (programmer == &programmer_internal && cb_check_image(newcontents, flash_size) < 0) { if (flashctx->flags.force_boardmismatch) { msg_pinfo("Proceeding anyway because user forced us to.\n"); } else { -- To view, visit
https://review.coreboot.org/c/flashrom/+/55119
To unsubscribe, or for help writing mail filters, visit
https://review.coreboot.org/settings
Gerrit-Project: flashrom Gerrit-Branch: master Gerrit-Change-Id: I478c56354d5f482010bfe1560489700bc889717a Gerrit-Change-Number: 55119 Gerrit-PatchSet: 12 Gerrit-Owner: Thomas Heijligen <src(a)posteo.de> Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org> Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com> Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org> Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de> Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org> Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org> Gerrit-CC: Xiang W <wxjstz(a)126.com> Gerrit-MessageType: merged
1
0
0
0
← Newer
1
...
54
55
56
57
58
59
60
...
88
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
Results per page:
10
25
50
100
200