Skip to content

Commit

Permalink
igsc: lib: add oprom image 4ids and 2ids extension query functions
Browse files Browse the repository at this point in the history
Added helper functions to check whether the oprom image
supports 4ids or 2ids extension.

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 e83e9d5 commit 29a4fe4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/oprom.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ static bool oprom_match_device_4ids(struct igsc_device_info *device,
(device->device_id == oprom_device->device_id);
}


int igsc_image_oprom_match_device(IN struct igsc_oprom_image *img,
IN enum igsc_oprom_type request_type,
IN struct igsc_device_info *device)
Expand All @@ -324,7 +323,7 @@ int igsc_image_oprom_match_device(IN struct igsc_oprom_image *img,
struct igsc_oprom_device_info_4ids oprom_device_4ids;
int ret;
uint32_t count = 0;
bool image_4ids = true;
bool image_4ids;

if (img == NULL || device == NULL)
{
Expand All @@ -346,6 +345,8 @@ int igsc_image_oprom_match_device(IN struct igsc_oprom_image *img,
goto exit;
}

image_4ids = image_oprom_has_4ids_extension(img, request_type);

if (image_4ids)
{
/* search the device list for a match */
Expand Down
17 changes: 17 additions & 0 deletions lib/oprom_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,23 @@ static void debug_print_pci_data(const struct oprom_pci_data *p)
p->DMTF_CLP_entry_point_pointer);
}

bool image_oprom_has_4ids_extension(struct igsc_oprom_image *img, enum igsc_oprom_type type)
{
if (type == IGSC_OPROM_DATA)
{
return (img->cpd_img.dev_4ids_data != NULL);
}
else
{
return (img->cpd_img.dev_4ids_code != NULL);
}
}

bool image_oprom_has_2ids_extension(struct igsc_oprom_image *img)
{
return (img->cpd_img.dev_ext != NULL);
}

static int image_oprom_parse_extensions(struct igsc_oprom_image *img,
size_t ext_start, size_t ext_end, uint8_t type)
{
Expand Down
3 changes: 3 additions & 0 deletions lib/oprom_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,8 @@ int image_oprom_get_device_4ids(struct igsc_oprom_image *img, uint32_t pos,
int image_oprom_get_next_4ids(struct igsc_oprom_image *img,
enum igsc_oprom_type type,
struct igsc_oprom_device_info_4ids *device);
bool image_oprom_has_4ids_extension(struct igsc_oprom_image *img,
enum igsc_oprom_type type);
bool image_oprom_has_2ids_extension(struct igsc_oprom_image *img);

#endif /* !__IGSC_OPROM_PARSER_H__ */

0 comments on commit 29a4fe4

Please sign in to comment.