MCPcopy Index your code
hub / github.com/FrameworkComputer/framework-system / smbios_data

Function smbios_data

framework_lib/src/fw_uefi/mod.rs:78–112  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

76const SMBIOS_V3_EP_SIZE: usize = 24;
77
78pub fn smbios_data() -> Option<(Vec<u8>, Vec<u8>)> {
79 use dmidecode::EntryPoint;
80
81 with_config_table(|slice| {
82 for i in slice {
83 let ep_size = match i.guid {
84 ConfigTableEntry::SMBIOS3_GUID => Some(SMBIOS_V3_EP_SIZE),
85 ConfigTableEntry::SMBIOS_GUID => Some(SMBIOS_V2_EP_SIZE),
86 _ => None,
87 };
88 if let Some(size) = ep_size {
89 unsafe {
90 let ep_ptr = i.address as *const u8;
91 let ep_bytes = slice::from_raw_parts(ep_ptr, size);
92 if let Ok(entry) = EntryPoint::search(ep_bytes) {
93 debug!(
94 "SMBIOS entry point found, version {}.{}",
95 entry.major(),
96 entry.minor()
97 );
98 let table_data = slice::from_raw_parts(
99 entry.smbios_address() as *const u8,
100 entry.smbios_len() as usize,
101 );
102 // Return directly here because there is only ever the old config
103 // table or the new V3 config table. Never both.
104 return Some((ep_bytes.to_vec(), table_data.to_vec()));
105 }
106 }
107 }
108 }
109
110 None
111 })
112}

Callers 1

get_smbiosFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected