To allow bios quirks early in the boot process, specifically
biosmem.c, before malloc is available, this splits SMBIOS
detection into two calls - smbios_detect (which looks for
SMBIOS and populates various data structures) amd smbios_setup,
which parses the SMBIOS table and sets up the kernel environment.
Also provide a function named smbios_match which can be used
to match a bios_vendor, maker and product. Each of the input
variables is optional, so it allows partial matching (e.g. only
look for a specific vendor).
The complete patch showing how this is intended to be used in
a future patch is available here:
http://blog.grem.de/bits/20150124_c720_loader.patch
Explaining some of the changes:
- Introducing an smbios_attr struct: This already used four different globals, as there were more to come, grouping them in a struct seemed cleaner.
- smbios_getstring: Before, smbios_setenv would only do this implicitly, so this has been factored out to allow direct strcmp (smbios_setenv makes use of it)
- Get rid of the ver parameter in smbios_parse_table, as the function is (and was) using globals anyway. Since we're storing ver now, the parameter isn't necessary anymore.
- smbios_find_struct: Allows finding a specific SMBIOS table structure by type - required to find the BIOS and SYSTEM structures.
- Split smbios_detetect into smbios_detect and smbios_setup
- Introduce match functions (not used yet, but this should make it easier to understand the intend of the patch).
- Change loader to call smbios_detect early and smbios_setup where it used to call smbios_detect.