1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-27 07:02:34 +02:00

tree: Retype variable programmer_may_write with bool

Use the bool type instead of an integer for the variable
`programmer_may_write`, since this represents its purpose much better.

Signed-off-by: Felix Singer <felixsinger@posteo.net>
Change-Id: I69958527ae018a92f1c42734a7990d0c532dee0c
Reviewed-on: https://review.coreboot.org/c/flashrom/+/66885
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Felix Singer 2022-08-19 02:48:15 +02:00 committed by Anastasia Klimchuk
parent bf85c62a8d
commit 2ffc56b337
5 changed files with 9 additions and 6 deletions

View File

@ -26,6 +26,7 @@
#define _LARGEFILE64_SOURCE
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@ -1526,7 +1527,7 @@ static int enable_flash_ck804(const struct programmer_cfg *cfg, struct pci_dev *
if (err > 0) {
msg_pinfo("%d locks could not be disabled, disabling writes (reads may also fail).\n", err);
programmer_may_write = 0;
programmer_may_write = false;
}
reg = 0x88;

View File

@ -50,7 +50,7 @@ struct decode_sizes max_rom_decode;
unsigned long flashbase;
/* Is writing allowed with this programmer? */
int programmer_may_write;
bool programmer_may_write;
#define SHUTDOWN_MAXFN 32
static int shutdown_fn_count = 0;
@ -148,7 +148,7 @@ int programmer_init(const struct programmer_entry *prog, const char *param)
/* Registering shutdown functions is now allowed. */
may_register_shutdown = true;
/* Default to allowing writes. Broken programmers set this to 0. */
programmer_may_write = 1;
programmer_may_write = true;
programmer_param = param;
msg_pdbg("Initializing %s programmer\n", programmer->name);

View File

@ -14,6 +14,7 @@
* GNU General Public License for more details.
*/
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include "flash.h"
@ -140,7 +141,7 @@ static int gfxnvidia_init(const struct programmer_cfg *cfg)
pci_write_long(dev, REG_FLASH_ACCESS, reg32);
/* Write/erase doesn't work. */
programmer_may_write = 0;
programmer_may_write = false;
return register_par_master(&par_master_gfxnvidia, BUS_PARALLEL, data);
}

View File

@ -286,7 +286,7 @@ struct decode_sizes {
};
// FIXME: These need to be local, not global
extern struct decode_sizes max_rom_decode;
extern int programmer_may_write;
extern bool programmer_may_write;
extern unsigned long flashbase;
unsigned int count_max_decode_exceedings(const struct flashctx *flash);
char *extract_programmer_param_str(const struct programmer_cfg *cfg, const char *param_name);

View File

@ -18,6 +18,7 @@
* GNU General Public License for more details.
*/
#include <stdbool.h>
#include <string.h>
#include <stdlib.h>
#include "flash.h"
@ -554,7 +555,7 @@ static int handle_imc(const struct programmer_cfg *cfg, struct pci_dev *dev, enu
}
if (!amd_imc_force)
programmer_may_write = 0;
programmer_may_write = false;
msg_pinfo("Writes have been disabled for safety reasons because the presence of the IMC\n"
"was detected and it could interfere with accessing flash memory. Flashrom will\n"
"try to disable it temporarily but even then this might not be safe:\n"