1 // SPDX-License-Identifier: GPL-2.0-only
2 // Copyright 2022 Google LLC
3 // Author: Ard Biesheuvel <ardb@google.com>
9 typedef union efi_smbios_protocol efi_smbios_protocol_t
;
11 union efi_smbios_protocol
{
13 efi_status_t (__efiapi
*add
)(efi_smbios_protocol_t
*, efi_handle_t
,
14 u16
*, struct efi_smbios_record
*);
15 efi_status_t (__efiapi
*update_string
)(efi_smbios_protocol_t
*, u16
*,
16 unsigned long *, u8
*);
17 efi_status_t (__efiapi
*remove
)(efi_smbios_protocol_t
*, u16
);
18 efi_status_t (__efiapi
*get_next
)(efi_smbios_protocol_t
*, u16
*, u8
*,
19 struct efi_smbios_record
**,
36 const struct efi_smbios_record
*efi_get_smbios_record(u8 type
)
38 struct efi_smbios_record
*record
;
39 efi_smbios_protocol_t
*smbios
;
43 status
= efi_bs_call(locate_protocol
, &EFI_SMBIOS_PROTOCOL_GUID
, NULL
,
45 efi_call_proto(smbios
, get_next
, &handle
, &type
, &record
, NULL
);
46 if (status
!= EFI_SUCCESS
)
51 const u8
*__efi_get_smbios_string(const struct efi_smbios_record
*record
,
59 strtable
= (u8
*)record
+ record
->length
;
60 for (int i
= 1; i
< *offset
; i
++) {
61 int len
= strlen(strtable
);