#define SMBIOS_VERSION( major, minor ) ( ( (major) << 8 ) | (minor) )
extern int find_smbios ( struct smbios *smbios );
-extern int find_smbios_structure ( unsigned int type,
+extern int find_smbios_structure ( unsigned int type, unsigned int instance,
struct smbios_structure *structure );
extern int read_smbios_structure ( struct smbios_structure *structure,
void *data, size_t len );
* Find specific structure type within SMBIOS
*
* @v type Structure type to search for
+ * @v instance Instance of this type of structure
* @v structure SMBIOS structure descriptor to fill in
* @ret rc Return status code
*/
-int find_smbios_structure ( unsigned int type,
+int find_smbios_structure ( unsigned int type, unsigned int instance,
struct smbios_structure *structure ) {
unsigned int count = 0;
size_t offset = 0;
structure->header.len, structure->strings_len );
/* If this is the structure we want, return */
- if ( structure->header.type == type ) {
+ if ( ( structure->header.type == type ) &&
+ ( instance-- == 0 ) ) {
structure->offset = offset;
return 0;
}
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;
{