amdfwtool: Change the flag value to type bool
Change-Id: I8bb87e6b16b323b26dd5b411e0063e2e9e333d05 Signed-off-by: Zheng Bao <fishbaozi@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/58942 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
This commit is contained in:
parent
edd1e360f4
commit
ba3af5e2ff
|
@ -638,7 +638,7 @@ static void integrate_psp_firmwares(context *ctx,
|
||||||
* 1st-level cookie may indicate level 1 or flattened. If the caller
|
* 1st-level cookie may indicate level 1 or flattened. If the caller
|
||||||
* passes a pointer to a 2nd-level table, then assume not flat.
|
* passes a pointer to a 2nd-level table, then assume not flat.
|
||||||
*/
|
*/
|
||||||
if (cb_config->multi_level == 0)
|
if (!cb_config->multi_level)
|
||||||
level = PSP_BOTH;
|
level = PSP_BOTH;
|
||||||
else if (cookie == PSPL2_COOKIE)
|
else if (cookie == PSPL2_COOKIE)
|
||||||
level = PSP_LVL2;
|
level = PSP_LVL2;
|
||||||
|
@ -739,7 +739,7 @@ static void integrate_psp_firmwares(context *ctx,
|
||||||
fill_dir_header(pspdir, count, cookie, ctx);
|
fill_dir_header(pspdir, count, cookie, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *new_bios_dir(context *ctx, int multi)
|
static void *new_bios_dir(context *ctx, bool multi)
|
||||||
{
|
{
|
||||||
void *ptr;
|
void *ptr;
|
||||||
|
|
||||||
|
@ -822,7 +822,7 @@ static void integrate_bios_firmwares(context *ctx,
|
||||||
* 1st-level cookie may indicate level 1 or flattened. If the caller
|
* 1st-level cookie may indicate level 1 or flattened. If the caller
|
||||||
* passes a pointer to a 2nd-level table, then assume not flat.
|
* passes a pointer to a 2nd-level table, then assume not flat.
|
||||||
*/
|
*/
|
||||||
if (cb_config->multi_level == 0)
|
if (!cb_config->multi_level)
|
||||||
level = BDT_BOTH;
|
level = BDT_BOTH;
|
||||||
else if (cookie == BDT2_COOKIE)
|
else if (cookie == BDT2_COOKIE)
|
||||||
level = BDT_LVL2;
|
level = BDT_LVL2;
|
||||||
|
@ -1293,12 +1293,12 @@ int main(int argc, char **argv)
|
||||||
int debug = 0;
|
int debug = 0;
|
||||||
int list_deps = 0;
|
int list_deps = 0;
|
||||||
|
|
||||||
cb_config.have_whitelist = 0;
|
cb_config.have_whitelist = false;
|
||||||
cb_config.unlock_secure = 0;
|
cb_config.unlock_secure = false;
|
||||||
cb_config.use_secureos = 0;
|
cb_config.use_secureos = false;
|
||||||
cb_config.load_mp2_fw = 0;
|
cb_config.load_mp2_fw = false;
|
||||||
cb_config.s0i3 = 0;
|
cb_config.s0i3 = false;
|
||||||
cb_config.multi_level = 0;
|
cb_config.multi_level = false;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
int optindex = 0;
|
int optindex = 0;
|
||||||
|
@ -1322,24 +1322,24 @@ int main(int argc, char **argv)
|
||||||
sub = instance = 0;
|
sub = instance = 0;
|
||||||
break;
|
break;
|
||||||
case AMDFW_OPT_COMBO:
|
case AMDFW_OPT_COMBO:
|
||||||
comboable = 1;
|
comboable = true;
|
||||||
break;
|
break;
|
||||||
case AMDFW_OPT_MULTILEVEL:
|
case AMDFW_OPT_MULTILEVEL:
|
||||||
cb_config.multi_level = 1;
|
cb_config.multi_level = true;
|
||||||
break;
|
break;
|
||||||
case AMDFW_OPT_UNLOCK:
|
case AMDFW_OPT_UNLOCK:
|
||||||
register_fw_token_unlock();
|
register_fw_token_unlock();
|
||||||
cb_config.unlock_secure = 1;
|
cb_config.unlock_secure = true;
|
||||||
sub = instance = 0;
|
sub = instance = 0;
|
||||||
break;
|
break;
|
||||||
case AMDFW_OPT_USE_PSPSECUREOS:
|
case AMDFW_OPT_USE_PSPSECUREOS:
|
||||||
cb_config.use_secureos = 1;
|
cb_config.use_secureos = true;
|
||||||
break;
|
break;
|
||||||
case AMDFW_OPT_INSTANCE:
|
case AMDFW_OPT_INSTANCE:
|
||||||
instance = strtoul(optarg, &tmp, 16);
|
instance = strtoul(optarg, &tmp, 16);
|
||||||
break;
|
break;
|
||||||
case AMDFW_OPT_LOAD_MP2FW:
|
case AMDFW_OPT_LOAD_MP2FW:
|
||||||
cb_config.load_mp2_fw = 1;
|
cb_config.load_mp2_fw = true;
|
||||||
break;
|
break;
|
||||||
case AMDFW_OPT_NVRAM:
|
case AMDFW_OPT_NVRAM:
|
||||||
register_fw_filename(AMD_FW_PSP_NVRAM, sub, optarg);
|
register_fw_filename(AMD_FW_PSP_NVRAM, sub, optarg);
|
||||||
|
@ -1398,12 +1398,12 @@ int main(int argc, char **argv)
|
||||||
sub = instance = 0;
|
sub = instance = 0;
|
||||||
break;
|
break;
|
||||||
case AMDFW_OPT_LOAD_S0I3:
|
case AMDFW_OPT_LOAD_S0I3:
|
||||||
cb_config.s0i3 = 1;
|
cb_config.s0i3 = true;
|
||||||
break;
|
break;
|
||||||
case AMDFW_OPT_WHITELIST:
|
case AMDFW_OPT_WHITELIST:
|
||||||
register_fw_filename(AMD_FW_PSP_WHITELIST, sub, optarg);
|
register_fw_filename(AMD_FW_PSP_WHITELIST, sub, optarg);
|
||||||
sub = instance = 0;
|
sub = instance = 0;
|
||||||
cb_config.have_whitelist = 1;
|
cb_config.have_whitelist = true;
|
||||||
break;
|
break;
|
||||||
case AMDFW_OPT_VERSTAGE:
|
case AMDFW_OPT_VERSTAGE:
|
||||||
register_fw_filename(AMD_FW_PSP_VERSTAGE, sub, optarg);
|
register_fw_filename(AMD_FW_PSP_VERSTAGE, sub, optarg);
|
||||||
|
@ -1603,7 +1603,6 @@ int main(int argc, char **argv)
|
||||||
psp_directory_table *pspdir2 = new_psp_dir(&ctx, cb_config.multi_level);
|
psp_directory_table *pspdir2 = new_psp_dir(&ctx, cb_config.multi_level);
|
||||||
integrate_psp_firmwares(&ctx, pspdir2, NULL,
|
integrate_psp_firmwares(&ctx, pspdir2, NULL,
|
||||||
amd_psp_fw_table, PSPL2_COOKIE, &cb_config);
|
amd_psp_fw_table, PSPL2_COOKIE, &cb_config);
|
||||||
|
|
||||||
pspdir = new_psp_dir(&ctx, cb_config.multi_level);
|
pspdir = new_psp_dir(&ctx, cb_config.multi_level);
|
||||||
integrate_psp_firmwares(&ctx, pspdir, pspdir2,
|
integrate_psp_firmwares(&ctx, pspdir, pspdir2,
|
||||||
amd_psp_fw_table, PSP_COOKIE, &cb_config);
|
amd_psp_fw_table, PSP_COOKIE, &cb_config);
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#define _AMD_FW_TOOL_H_
|
#define _AMD_FW_TOOL_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
typedef enum _amd_fw_type {
|
typedef enum _amd_fw_type {
|
||||||
AMD_FW_PSP_PUBKEY = 0,
|
AMD_FW_PSP_PUBKEY = 0,
|
||||||
|
@ -220,12 +221,12 @@ typedef struct _amd_fw_entry {
|
||||||
} amd_fw_entry;
|
} amd_fw_entry;
|
||||||
|
|
||||||
typedef struct _amd_cb_config {
|
typedef struct _amd_cb_config {
|
||||||
uint8_t have_whitelist;
|
bool have_whitelist;
|
||||||
uint8_t unlock_secure;
|
bool unlock_secure;
|
||||||
uint8_t use_secureos;
|
bool use_secureos;
|
||||||
uint8_t load_mp2_fw;
|
bool load_mp2_fw;
|
||||||
uint8_t multi_level;
|
bool multi_level;
|
||||||
uint8_t s0i3;
|
bool s0i3;
|
||||||
} amd_cb_config;
|
} amd_cb_config;
|
||||||
|
|
||||||
void register_fw_fuse(char *str);
|
void register_fw_fuse(char *str);
|
||||||
|
|
|
@ -108,7 +108,7 @@ static uint8_t find_register_fw_filename_psp_dir(char *fw_name, char *filename,
|
||||||
uint8_t subprog;
|
uint8_t subprog;
|
||||||
|
|
||||||
if (strcmp(fw_name, "PSPBTLDR_WL_FILE") == 0) {
|
if (strcmp(fw_name, "PSPBTLDR_WL_FILE") == 0) {
|
||||||
if (cb_config->have_whitelist == 1) {
|
if (cb_config->have_whitelist) {
|
||||||
fw_type = AMD_FW_PSP_BOOTLOADER_AB;
|
fw_type = AMD_FW_PSP_BOOTLOADER_AB;
|
||||||
subprog = 0;
|
subprog = 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -160,14 +160,14 @@ static uint8_t find_register_fw_filename_psp_dir(char *fw_name, char *filename,
|
||||||
fw_type = AMD_FW_PSP_SMU_FIRMWARE2;
|
fw_type = AMD_FW_PSP_SMU_FIRMWARE2;
|
||||||
subprog = 2;
|
subprog = 2;
|
||||||
} else if (strcmp(fw_name, "PSP_SEC_DBG_KEY_FILE") == 0) {
|
} else if (strcmp(fw_name, "PSP_SEC_DBG_KEY_FILE") == 0) {
|
||||||
if (cb_config->unlock_secure == 1) {
|
if (cb_config->unlock_secure) {
|
||||||
fw_type = AMD_FW_PSP_SECURED_DEBUG;
|
fw_type = AMD_FW_PSP_SECURED_DEBUG;
|
||||||
subprog = 0;
|
subprog = 0;
|
||||||
} else {
|
} else {
|
||||||
fw_type = AMD_FW_SKIP;
|
fw_type = AMD_FW_SKIP;
|
||||||
}
|
}
|
||||||
} else if (strcmp(fw_name, "PSP_SEC_DEBUG_FILE") == 0) {
|
} else if (strcmp(fw_name, "PSP_SEC_DEBUG_FILE") == 0) {
|
||||||
if (cb_config->unlock_secure == 1) {
|
if (cb_config->unlock_secure) {
|
||||||
fw_type = AMD_DEBUG_UNLOCK;
|
fw_type = AMD_DEBUG_UNLOCK;
|
||||||
subprog = 0;
|
subprog = 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -198,7 +198,7 @@ static uint8_t find_register_fw_filename_psp_dir(char *fw_name, char *filename,
|
||||||
fw_type = AMD_ABL7;
|
fw_type = AMD_ABL7;
|
||||||
subprog = 0;
|
subprog = 0;
|
||||||
} else if (strcmp(fw_name, "PSPSECUREOS_FILE") == 0) {
|
} else if (strcmp(fw_name, "PSPSECUREOS_FILE") == 0) {
|
||||||
if (cb_config->use_secureos == 1) {
|
if (cb_config->use_secureos) {
|
||||||
fw_type = AMD_FW_PSP_SECURED_OS;
|
fw_type = AMD_FW_PSP_SECURED_OS;
|
||||||
subprog = 0;
|
subprog = 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -231,21 +231,21 @@ static uint8_t find_register_fw_filename_psp_dir(char *fw_name, char *filename,
|
||||||
fw_type = AMD_SEC_GASKET;
|
fw_type = AMD_SEC_GASKET;
|
||||||
subprog = 2;
|
subprog = 2;
|
||||||
} else if (strcmp(fw_name, "PSP_MP2FW0_FILE") == 0) {
|
} else if (strcmp(fw_name, "PSP_MP2FW0_FILE") == 0) {
|
||||||
if (cb_config->load_mp2_fw == 1) {
|
if (cb_config->load_mp2_fw) {
|
||||||
fw_type = AMD_MP2_FW;
|
fw_type = AMD_MP2_FW;
|
||||||
subprog = 0;
|
subprog = 0;
|
||||||
} else {
|
} else {
|
||||||
fw_type = AMD_FW_SKIP;
|
fw_type = AMD_FW_SKIP;
|
||||||
}
|
}
|
||||||
} else if (strcmp(fw_name, "PSP_MP2FW1_FILE") == 0) {
|
} else if (strcmp(fw_name, "PSP_MP2FW1_FILE") == 0) {
|
||||||
if (cb_config->load_mp2_fw == 1) {
|
if (cb_config->load_mp2_fw) {
|
||||||
fw_type = AMD_MP2_FW;
|
fw_type = AMD_MP2_FW;
|
||||||
subprog = 1;
|
subprog = 1;
|
||||||
} else {
|
} else {
|
||||||
fw_type = AMD_FW_SKIP;
|
fw_type = AMD_FW_SKIP;
|
||||||
}
|
}
|
||||||
} else if (strcmp(fw_name, "PSP_MP2FW2_FILE") == 0) {
|
} else if (strcmp(fw_name, "PSP_MP2FW2_FILE") == 0) {
|
||||||
if (cb_config->load_mp2_fw == 1) {
|
if (cb_config->load_mp2_fw) {
|
||||||
fw_type = AMD_MP2_FW;
|
fw_type = AMD_MP2_FW;
|
||||||
subprog = 2;
|
subprog = 2;
|
||||||
} else {
|
} else {
|
||||||
|
@ -255,7 +255,7 @@ static uint8_t find_register_fw_filename_psp_dir(char *fw_name, char *filename,
|
||||||
fw_type = AMD_DRIVER_ENTRIES;
|
fw_type = AMD_DRIVER_ENTRIES;
|
||||||
subprog = 0;
|
subprog = 0;
|
||||||
} else if (strcmp(fw_name, "PSP_S0I3_FILE") == 0) {
|
} else if (strcmp(fw_name, "PSP_S0I3_FILE") == 0) {
|
||||||
if (cb_config->s0i3 == 1) {
|
if (cb_config->s0i3) {
|
||||||
fw_type = AMD_S0I3_DRIVER;
|
fw_type = AMD_S0I3_DRIVER;
|
||||||
subprog = 0;
|
subprog = 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -295,7 +295,7 @@ static uint8_t find_register_fw_filename_psp_dir(char *fw_name, char *filename,
|
||||||
fw_type = AMD_RPMC_NVRAM;
|
fw_type = AMD_RPMC_NVRAM;
|
||||||
subprog = 0;
|
subprog = 0;
|
||||||
} else if (strcmp(fw_name, "PSPBTLDR_AB_FILE") == 0) {
|
} else if (strcmp(fw_name, "PSPBTLDR_AB_FILE") == 0) {
|
||||||
if (cb_config->have_whitelist == 0) {
|
if (!cb_config->have_whitelist) {
|
||||||
fw_type = AMD_FW_PSP_BOOTLOADER_AB;
|
fw_type = AMD_FW_PSP_BOOTLOADER_AB;
|
||||||
subprog = 0;
|
subprog = 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -372,7 +372,7 @@ static uint8_t find_register_fw_filename_bios_dir(char *fw_name, char *filename,
|
||||||
subprog = 0;
|
subprog = 0;
|
||||||
instance = 0;
|
instance = 0;
|
||||||
} else if (strcmp(fw_name, "PSP_MP2CFG_FILE") == 0) {
|
} else if (strcmp(fw_name, "PSP_MP2CFG_FILE") == 0) {
|
||||||
if (cb_config->load_mp2_fw == 1) {
|
if (cb_config->load_mp2_fw) {
|
||||||
fw_type = AMD_BIOS_MP2_CFG;
|
fw_type = AMD_BIOS_MP2_CFG;
|
||||||
subprog = 0;
|
subprog = 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue