mirror of
https://github.com/ipxe/ipxe
synced 2026-01-02 01:42:37 +03:00
[smbios] Allow access to multiple instances of SMBIOS structures
Extend the syntax for numerical SMBIOS settings from smbios/<type>.<offset>.<length> to smbios/[<instance>.]<type>.<offset>.<length> Where SMBIOS provides multiple structures with the same <type>, this extended syntax allows for access to structures other than the first. If <instance> 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/<instance>.<type>.2.2:uint16 Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -59,10 +59,11 @@ static size_t find_strings_terminator ( size_t offset ) {
|
||||
* 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;
|
||||
@@ -105,7 +106,8 @@ int find_smbios_structure ( unsigned int type,
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user