Skip to content

Commit

Permalink
igsc: lib: add igsc_image_oprom_code_devid_enforced()
Browse files Browse the repository at this point in the history
Add igsc_image_oprom_code_devid_enforced() API. The function
checks whether the firmware enforce device id match on oprom
code partition.

Signed-off-by: Vitaly Lubart <vitaly.lubart@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
  • Loading branch information
vlubart authored and tomasbw committed Jul 24, 2022
1 parent 566784b commit d46db3c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
14 changes: 13 additions & 1 deletion include/igsc_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ enum igsc_fwdata_version_compare_result {
};

/**
* Structure to store OEM manufacturing data version and data major VCN
* Structure to store OEM manufacturing data version and data major VCN
* for GSC in-field data firmware update image
*/
struct igsc_fwdata_version {
Expand Down Expand Up @@ -971,6 +971,18 @@ IGSC_EXPORT
int igsc_image_oprom_has_2ids_extension(IN struct igsc_oprom_image *img,
OUT bool *has_2ids_extension);

/**
* @brief returns whether the oprom code config has devId enforcement bit set
*
* @param igsc_hw_config device hardware configuration.
* @param devid_enforced true when devId is enforced, false otherwise
*
* @return IGSC_SUCCESS if successful, otherwise error code.
*/
IGSC_EXPORT
int igsc_image_oprom_code_devid_enforced(IN struct igsc_hw_config *hw_config,
OUT bool *devid_enforced);

/**
* @brief release the OPROM image handle
*
Expand Down
16 changes: 16 additions & 0 deletions lib/igsc_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1702,6 +1702,22 @@ static int gsc_image_hw_config(const struct gsc_fwu_img_layout *layout,
return IGSC_SUCCESS;
}

int igsc_image_oprom_code_devid_enforced(IN struct igsc_hw_config *hw_config, OUT bool *devid_enforced)
{
struct gsc_hw_config_1 *hw_config_1;

if (!hw_config || !devid_enforced)
{
return IGSC_ERROR_INVALID_PARAMETER;
}

hw_config_1 = (struct gsc_hw_config_1 *)hw_config->blob;

*devid_enforced = (hw_config_1->oprom_code_devid_enforcement == 1);

return IGSC_SUCCESS;
}

int igsc_image_hw_config(IN const uint8_t *buffer,
IN uint32_t buffer_len,
OUT struct igsc_hw_config *hw_config)
Expand Down

0 comments on commit d46db3c

Please sign in to comment.