From 8bc20c1aa09ec521476f4b35b0a09c21e2e1e5f3 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Wed, 1 May 2013 20:42:57 +0100 Subject: [smbios] Allow access to multiple instances of SMBIOS structures Extend the syntax for numerical SMBIOS settings from smbios/.. to smbios/[.].. Where SMBIOS provides multiple structures with the same , this extended syntax allows for access to structures other than the first. If is omitted then it will default to zero, giving access to the first instance (and so matching existing behaviour). The 16-bit SMBIOS handle (which is an alternative way to disambiguate multiple instances of the same type of structure) can be accessed, if required, using smbios/..2.2:uint16 Signed-off-by: Michael Brown --- src/interface/smbios/smbios_settings.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/interface/smbios/smbios_settings.c') diff --git a/src/interface/smbios/smbios_settings.c b/src/interface/smbios/smbios_settings.c index 17f9a48ee..d2975df44 100644 --- a/src/interface/smbios/smbios_settings.c +++ b/src/interface/smbios/smbios_settings.c @@ -81,18 +81,21 @@ static int smbios_fetch ( struct settings *settings __unused, struct setting *setting, void *data, size_t len ) { struct smbios_structure structure; + unsigned int tag_instance; unsigned int tag_type; unsigned int tag_offset; unsigned int tag_len; int rc; - /* Split tag into type, offset and length */ + /* Split tag into instance, type, offset and length */ + tag_instance = ( ( setting->tag >> 24 ) & 0xff ); tag_type = ( ( setting->tag >> 16 ) & 0xff ); tag_offset = ( ( setting->tag >> 8 ) & 0xff ); tag_len = ( setting->tag & 0xff ); /* Find SMBIOS structure */ - if ( ( rc = find_smbios_structure ( tag_type, &structure ) ) != 0 ) + if ( ( rc = find_smbios_structure ( tag_type, tag_instance, + &structure ) ) != 0 ) return rc; { -- cgit v1.2.3-55-g7522