libflashrom: Drop querying functions
This implementation of querying functions has shown too many
maintainability issues and at the same time we couldn't find
any user of it. Questions on Gerrit and the ML [1] were left
unanswered.
Part of it was already removed, let's remove all of it to re-
duce the churn.
[1] https://mail.coreboot.org/hyperkitty/list/flashrom@flashrom.org/message/3OJVU6QVYV47HLLVDZEWMFS24ND7PHB2/
Change-Id: I006db190e69bc07959df40ce8737db93c9559265
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/71299
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
diff --git a/libflashrom.c b/libflashrom.c
index 41abb35..1f8aa00 100644
--- a/libflashrom.c
+++ b/libflashrom.c
@@ -105,152 +105,7 @@
* @{
*/
-/**
- * @brief Returns flashrom version
- * @return flashrom version
- */
-const char *flashrom_version_info(void)
-{
- return flashrom_version;
-}
-
-/**
- * @brief Returns list of supported programmers
- * @return List of supported programmers, or NULL if an error occurred
- */
-const char **flashrom_supported_programmers(void)
-{
- enum programmer p = 0;
- const char **supported_programmers = malloc((PROGRAMMER_INVALID + 1) * sizeof(char*));
-
- if (supported_programmers != NULL) {
- for (; p < PROGRAMMER_INVALID; ++p) {
- supported_programmers[p] = programmer_table[p].name;
- }
- } else {
- msg_gerr("Memory allocation error!\n");
- }
-
- return supported_programmers;
-}
-
-/**
- * @brief Returns list of supported flash chips
- * @return List of supported flash chips, or NULL if an error occurred
- */
-struct flashrom_flashchip_info *flashrom_supported_flash_chips(void)
-{
- unsigned int i = 0;
- struct flashrom_flashchip_info *supported_flashchips =
- malloc(flashchips_size * sizeof(*supported_flashchips));
-
- if (supported_flashchips != NULL) {
- for (; i < flashchips_size; ++i) {
- supported_flashchips[i].vendor = flashchips[i].vendor;
- supported_flashchips[i].name = flashchips[i].name;
- supported_flashchips[i].tested.erase =
- (enum flashrom_test_state)flashchips[i].tested.erase;
- supported_flashchips[i].tested.probe =
- (enum flashrom_test_state)flashchips[i].tested.probe;
- supported_flashchips[i].tested.read =
- (enum flashrom_test_state)flashchips[i].tested.read;
- supported_flashchips[i].tested.write =
- (enum flashrom_test_state)flashchips[i].tested.write;
- supported_flashchips[i].total_size = flashchips[i].total_size;
- }
- } else {
- msg_gerr("Memory allocation error!\n");
- }
-
- return supported_flashchips;
-}
-
-/**
- * @brief Returns list of supported mainboards
- * @return List of supported mainboards, or NULL if an error occurred
- */
-struct flashrom_board_info *flashrom_supported_boards(void)
-{
-#if CONFIG_INTERNAL == 1
- int boards_known_size = 0;
- int i = 0;
- const struct board_info *binfo = boards_known;
-
- while ((binfo++)->vendor)
- ++boards_known_size;
- binfo = boards_known;
- /* add place for {0} */
- ++boards_known_size;
-
- struct flashrom_board_info *supported_boards =
- malloc(boards_known_size * sizeof(*binfo));
-
- if (supported_boards != NULL) {
- for (; i < boards_known_size; ++i) {
- supported_boards[i].vendor = binfo[i].vendor;
- supported_boards[i].name = binfo[i].name;
- supported_boards[i].working =
- (enum flashrom_test_state) binfo[i].working;
- }
- } else {
- msg_gerr("Memory allocation error!\n");
- }
-
- return supported_boards;
-#else
- return NULL;
-#endif
-}
-
-/**
- * @brief Returns list of supported chipsets
- * @return List of supported chipsets, or NULL if an error occurred
- */
-struct flashrom_chipset_info *flashrom_supported_chipsets(void)
-{
-#if CONFIG_INTERNAL == 1
- int chipset_enables_size = 0;
- int i = 0;
- const struct penable *chipset = chipset_enables;
-
- while ((chipset++)->vendor_name)
- ++chipset_enables_size;
- chipset = chipset_enables;
- /* add place for {0}*/
- ++chipset_enables_size;
-
- struct flashrom_chipset_info *supported_chipsets =
- malloc(chipset_enables_size * sizeof(*supported_chipsets));
-
- if (supported_chipsets != NULL) {
- for (; i < chipset_enables_size; ++i) {
- supported_chipsets[i].vendor = chipset[i].vendor_name;
- supported_chipsets[i].chipset = chipset[i].device_name;
- supported_chipsets[i].vendor_id = chipset[i].vendor_id;
- supported_chipsets[i].chipset_id = chipset[i].device_id;
- supported_chipsets[i].status =
- (enum flashrom_test_state) chipset[i].status;
- }
- } else {
- msg_gerr("Memory allocation error!\n");
- }
-
- return supported_chipsets;
-#else
- return NULL;
-#endif
-}
-
-/**
- * @brief Frees memory allocated by libflashrom API
- * @param Pointer to block of memory which should be freed
- * @return 0 on success
- */
-int flashrom_data_free(void *const p)
-{
- free(p);
- return 0;
-}
+/* TBD */
/** @} */ /* end flashrom-query */
diff --git a/libflashrom.h b/libflashrom.h
index 0c007e6..972e7d1 100644
--- a/libflashrom.h
+++ b/libflashrom.h
@@ -40,50 +40,6 @@
typedef int(flashrom_log_callback)(enum flashrom_log_level, const char *format, va_list);
void flashrom_set_log_callback(flashrom_log_callback *);
-/** @ingroup flashrom-query */
-enum flashrom_test_state {
- FLASHROM_TESTED_OK = 0,
- FLASHROM_TESTED_NT = 1,
- FLASHROM_TESTED_BAD = 2,
- FLASHROM_TESTED_DEP = 3,
- FLASHROM_TESTED_NA = 4,
-};
-
-struct flashrom_flashchip_info {
- const char *vendor;
- const char *name;
- unsigned int total_size;
- struct flashrom_tested {
- enum flashrom_test_state probe;
- enum flashrom_test_state read;
- enum flashrom_test_state erase;
- enum flashrom_test_state write;
- enum flashrom_test_state wp;
- } tested;
-};
-
-struct flashrom_board_info {
- const char *vendor;
- const char *name;
- enum flashrom_test_state working;
-};
-
-struct flashrom_chipset_info {
- const char *vendor;
- const char *chipset;
- uint16_t vendor_id;
- uint16_t chipset_id;
- enum flashrom_test_state status;
-};
-
-const char *flashrom_version_info(void);
-void flashrom_system_info(void);
-const char **flashrom_supported_programmers(void);
-struct flashrom_flashchip_info *flashrom_supported_flash_chips(void);
-struct flashrom_board_info *flashrom_supported_boards(void);
-struct flashrom_chipset_info *flashrom_supported_chipsets(void);
-int flashrom_data_free(void *const p);
-
/** @ingroup flashrom-prog */
struct flashrom_programmer;
int flashrom_programmer_init(struct flashrom_programmer **, const char *prog_name, const char *prog_params);
diff --git a/libflashrom.map b/libflashrom.map
index d6dd24d..3c287ff 100644
--- a/libflashrom.map
+++ b/libflashrom.map
@@ -1,11 +1,7 @@
LIBFLASHROM_1.0 {
global:
- flashrom_board_info;
- flashrom_chipset_info;
- flashrom_data_free;
flashrom_flag_get;
flashrom_flag_set;
- flashrom_flashchip_info;
flashrom_flash_erase;
flashrom_flash_getsize;
flashrom_flash_probe;
@@ -24,8 +20,5 @@
flashrom_programmer_shutdown;
flashrom_set_log_callback;
flashrom_shutdown;
- flashrom_supported_programmers;
- flashrom_system_info;
- flashrom_version_info;
local: *;
};