Index: trunk/i386/libsaio/smbios_patcher.c =================================================================== --- trunk/i386/libsaio/smbios_patcher.c (revision 117) +++ trunk/i386/libsaio/smbios_patcher.c (revision 118) @@ -797,13 +797,17 @@ { static struct SMBEntryPoint *orig = NULL; // cached static struct SMBEntryPoint *patched = NULL; // cached - static bool first_time = true; // whatever we are called with orig or new flag, initialize asap both structures - if (first_time) { - - orig = getAddressOfSmbiosTable(); + switch (which) { + case SMBIOS_ORIGINAL: if (orig==NULL) { + orig = getAddressOfSmbiosTable(); + getSmbiosTableStructure(orig); // generate tables entry list for fast table finding + } + return orig; + case SMBIOS_PATCHED: + if (orig==NULL && (orig = getAddressOfSmbiosTable())==NULL ) { printf("Could not find original SMBIOS !!\n"); pause(); } else { @@ -814,17 +818,10 @@ } else { smbios_real_run(orig, patched); - getSmbiosTableStructure(patched); // generate tables entry list for fast table finding } } - first_time = false; - } - switch (which) { - case SMBIOS_ORIGINAL: - return orig; - case SMBIOS_PATCHED: - return patched; + return patched; default: printf("ERROR: invalid option for getSmbios() !!\n"); break; @@ -833,7 +830,7 @@ return NULL; } -/** Find first new dmi Table with a particular type */ +/** Find first original dmi Table with a particular type */ struct DMIHeader* FindFirstDmiTableOfType(int type, int minlength) { current_pos = 0; @@ -841,12 +838,12 @@ return FindNextDmiTableOfType(type, minlength); }; -/** Find next new dmi Table with a particular type */ +/** Find next original dmi Table with a particular type */ struct DMIHeader* FindNextDmiTableOfType(int type, int minlength) { int i; - if (ftTablePairInit) getSmbios(SMBIOS_PATCHED); + if (ftTablePairInit) getSmbios(SMBIOS_ORIGINAL); for (i=current_pos; i < DmiTablePairCount; i++) { if (type == DmiTablePair[i].type && Index: trunk/i386/libsaio/fake_efi.c =================================================================== --- trunk/i386/libsaio/fake_efi.c (revision 117) +++ trunk/i386/libsaio/fake_efi.c (revision 118) @@ -484,14 +484,17 @@ if (loadConfigFile(value, &bootInfo->smbiosConfig) == -1) { verbose("No SMBIOS replacement found\n"); } + // get a chance to scan mem dynamically if user asks for it while having the config options loaded as well - // as opposed to when it was in scan_platform() + // as opposed to when it was in scan_platform(), also load the orig. smbios so that we can access dmi info without + // patching the smbios yet + getSmbios(SMBIOS_ORIGINAL); scan_mem(); smbios_p = (EFI_PTR32) getSmbios(SMBIOS_PATCHED); // process smbios asap } /* Installs all the needed configuration table entries */ -void setupEfiConfigurationTable() +static void setupEfiConfigurationTable() { smbios_p = (EFI_PTR32)getSmbios(SMBIOS_PATCHED); addConfigurationTable(&gEfiSmbiosTableGuid, &smbios_p, NULL); @@ -503,7 +506,7 @@ fixupEfiSystemTableCRC32(gST); } -void setupEfiDevices(void) +static void setupEfiDevices(setup) { setup_pci_devs(root_pci_dev); }