smbios: Pass smbios_info to smbios_next_table()
At present smbios_next_table() does not support SMBIOS v2 tables. Pass in the info struct so that it can check for the end of the tables. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -401,7 +401,7 @@ static int do_smbios(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
(unsigned long long)map_to_sysmem(info.table));
|
||||
|
||||
for (struct smbios_header *pos = info.table; pos;
|
||||
pos = smbios_next_table(pos)) {
|
||||
pos = smbios_next_table(&info, pos)) {
|
||||
printf("\nHandle 0x%04x, DMI type %d, %d bytes at 0x%llx\n",
|
||||
pos->handle, pos->type, pos->length,
|
||||
(unsigned long long)map_to_sysmem(pos));
|
||||
|
||||
@@ -413,10 +413,12 @@ const char *smbios_get_string(void *table, int index);
|
||||
/**
|
||||
* smbios_next_table() - Find the next table
|
||||
*
|
||||
* @info: SMBIOS info
|
||||
* @table: Table to start from
|
||||
* Return: Pointer to the next table, or NULL if @table is the last
|
||||
*/
|
||||
struct smbios_header *smbios_next_table(struct smbios_header *table);
|
||||
struct smbios_header *smbios_next_table(const struct smbios_info *info,
|
||||
struct smbios_header *table);
|
||||
|
||||
/**
|
||||
* smbios_locate() - Locate the SMBIOS tables
|
||||
|
||||
@@ -32,10 +32,13 @@ const char *smbios_get_string(void *table, int index)
|
||||
return str;
|
||||
}
|
||||
|
||||
struct smbios_header *smbios_next_table(struct smbios_header *table)
|
||||
struct smbios_header *smbios_next_table(const struct smbios_info *info,
|
||||
struct smbios_header *table)
|
||||
{
|
||||
const char *str;
|
||||
|
||||
if ((ulong)table - (ulong)info->table >= info->max_size)
|
||||
return NULL;
|
||||
if (table->type == SMBIOS_END_OF_TABLE)
|
||||
return NULL;
|
||||
|
||||
@@ -317,7 +320,7 @@ int smbios_locate(ulong addr, struct smbios_info *info)
|
||||
|
||||
info->count = 0;
|
||||
for (struct smbios_header *pos = info->table; pos;
|
||||
pos = smbios_next_table(pos))
|
||||
pos = smbios_next_table(info, pos))
|
||||
info->count++;
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user