Index: trunk/i386/libsaio/console.c =================================================================== --- trunk/i386/libsaio/console.c (revision 114) +++ trunk/i386/libsaio/console.c (revision 115) @@ -152,3 +152,10 @@ halt(); while (1); } + +/** Print a "Press a key to continue..." message and wait for a key press. */ +void pause() +{ + printf("Press a key to continue..."); + getc(); +} Index: trunk/i386/libsaio/smbios_patcher.c =================================================================== --- trunk/i386/libsaio/smbios_patcher.c (revision 114) +++ trunk/i386/libsaio/smbios_patcher.c (revision 115) @@ -277,22 +277,23 @@ static struct SMBEntryPoint *getAddressOfSmbiosTable(void) { struct SMBEntryPoint *smbios; - /* * The logic is to start at 0xf0000 and end at 0xfffff iterating 16 bytes at a time looking * for the SMBIOS entry-point structure anchor (literal ASCII "_SM_"). */ smbios = (struct SMBEntryPoint*) SMBIOS_RANGE_START; while (smbios <= (struct SMBEntryPoint *)SMBIOS_RANGE_END) { - if (COMPARE_DWORD(smbios->anchor, SMTAG) && COMPARE_DWORD(smbios->dmi.anchor, DMITAG) && - checksum8(smbios, sizeof(struct SMBEntryPoint)) == 0) + if (COMPARE_DWORD(smbios->anchor, SMTAG) && + COMPARE_DWORD(smbios->dmi.anchor, DMITAG) && + smbios->dmi.anchor[4]==DMITAG[4] && + checksum8(smbios, sizeof(struct SMBEntryPoint)) == 0) { return smbios; } - smbios = (((void*) smbios) + 16); + smbios = (struct SMBEntryPoint*) ( ((char*) smbios) + 16 ); } printf("ERROR: Unable to find SMBIOS!\n"); - sleep(5); + pause(); return NULL; } @@ -770,9 +771,15 @@ // verbose(">>>>>> DMI(%d): type=0x%02x, len=0x%d\n",i,dmihdr->type,dmihdr->length); #endif if (dmihdr->length < 4 || dmihdr->type == 127 /* EOT */) break; - DmiTablePair[DmiTablePairCount].dmi = dmihdr; - DmiTablePair[DmiTablePairCount].type = dmihdr->type; - DmiTablePairCount++; + if (DmiTablePairCount < MAX_DMI_TABLES) { + DmiTablePair[DmiTablePairCount].dmi = dmihdr; + DmiTablePair[DmiTablePairCount].type = dmihdr->type; + DmiTablePairCount++; + } + else { + printf("DMI table entries list is full! next entries won't be stored\n"); + + } #if DEBUG_SMBIOS printf("DMI header found for table type %d, length = %d\n", dmihdr->type, dmihdr->length); #endif @@ -785,31 +792,35 @@ } } -/** Get soriginal or new smbios entry point, if sucessfull, the adresses are cached for next time */ + +/** Get original or new smbios entry point, if sucessful, the adresses are cached for next time */ struct SMBEntryPoint *getSmbios(int which) { 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 (orig == NULL) orig = getAddressOfSmbiosTable(); - if (patched == NULL) { + if (first_time) { + + orig = getAddressOfSmbiosTable(); if (orig==NULL) { printf("Could not find original SMBIOS !!\n"); - getc(); - return NULL; + pause(); + } else { + patched = smbios_dry_run(orig); + if(patched==NULL) { + printf("Could not create new SMBIOS !!\n"); + pause(); + } + else { + smbios_real_run(orig, patched); + getSmbiosTableStructure(patched); // generate tables entry list for fast table finding + } } - patched = smbios_dry_run(orig); - if(patched==NULL) { - printf("Could not create new SMBIOS !!\n"); - getc(); - } - 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; @@ -817,14 +828,17 @@ return patched; default: printf("ERROR: invalid option for getSmbios() !!\n"); - return NULL; + break; } + + return NULL; } /** Find first new dmi Table with a particular type */ struct DMIHeader* FindFirstDmiTableOfType(int type, int minlength) { current_pos = 0; + return FindNextDmiTableOfType(type, minlength); }; @@ -833,6 +847,8 @@ { int i; + if (ftTablePairInit) getSmbios(SMBIOS_PATCHED); + for (i=current_pos; i < DmiTablePairCount; i++) { if (type == DmiTablePair[i].type && DmiTablePair[i].dmi && Index: trunk/i386/libsaio/platform.c =================================================================== --- trunk/i386/libsaio/platform.c (revision 114) +++ trunk/i386/libsaio/platform.c (revision 115) @@ -25,6 +25,7 @@ PlatformInfo_t Platform; +/** Return if a CPU feature specified by feature is activated (true) or not (false) */ bool platformCPUFeature(uint32_t feature) { if (Platform.CPU.Features & feature) { @@ -34,17 +35,28 @@ } } -void scan_platform(void) -{ +/** scan mem for memory autodection purpose */ +void scan_mem() { bool useAutodetection = false; getBoolForKey(kUseMemDetect, &useAutodetection, &bootInfo->bootConfig); + if (useAutodetection) { + scan_memory(&Platform); + scan_spd(&Platform); + } +} + +/** + Scan platform hardware information, called by the main entry point (common_boot() ) + _before_ bootConfig xml parsing settings are loaded +*/ +void scan_platform(void) +{ + memset(&Platform, 0, sizeof(Platform)); build_pci_dt(); scan_cpu(&Platform); + // disabled for now as options can't be read yet here: + // scan_mem(); - if (useAutodetection) { - scan_memory(&Platform); - scan_spd(&Platform); - } } Index: trunk/i386/libsaio/cpu.c =================================================================== --- trunk/i386/libsaio/cpu.c (revision 114) +++ trunk/i386/libsaio/cpu.c (revision 115) @@ -369,7 +369,6 @@ DBG("CPU: CPUFreq: %dMHz\n", p->CPU.CPUFrequency / 1000000); DBG("CPU: NoCores/NoThreads: %d/%d\n", p->CPU.NoCores, p->CPU.NoThreads); DBG("CPU: Features: 0x%08x\n", p->CPU.Features); - printf("(Press a key to continue...)\n"); - getc(); + pause(); #endif } Index: trunk/i386/libsaio/pci.c =================================================================== --- trunk/i386/libsaio/pci.c (revision 114) +++ trunk/i386/libsaio/pci.c (revision 115) @@ -136,8 +136,7 @@ scan_pci_bus(root_pci_dev, 0); #if DEBUG_PCI dump_pci_dt(root_pci_dev->children); - printf("(Press a key to continue...)\n"); - getc(); + pause(); #endif } Index: trunk/i386/libsaio/fake_efi.c =================================================================== --- trunk/i386/libsaio/fake_efi.c (revision 114) +++ trunk/i386/libsaio/fake_efi.c (revision 115) @@ -482,6 +482,7 @@ if (loadConfigFile(value, &bootInfo->smbiosConfig) == -1) { verbose("No SMBIOS replacement found\n"); } + smbios_p = (EFI_PTR32) getSmbios(SMBIOS_PATCHED); // process smbios asap } /* Installs all the needed configuration table entries */ Index: trunk/i386/libsaio/saio_internal.h =================================================================== --- trunk/i386/libsaio/saio_internal.h (revision 114) +++ trunk/i386/libsaio/saio_internal.h (revision 115) @@ -46,10 +46,11 @@ extern int ebiosread(int dev, unsigned long long sec, int count); extern int ebioswrite(int dev, long sec, int count); extern int get_drive_info(int drive, struct driveInfo *dp); -extern int ebiosEjectMedia(int biosdev); +extern int ebiosEjectMedia(int biosdev); extern void putc(int ch); extern void putca(int ch, int attr, int repeat); extern int getc(void); +extern void pause(); extern int readKeyboardStatus(void); extern int readKeyboardShiftFlags(void); extern unsigned int time18(void); Index: trunk/i386/boot2/graphics.c =================================================================== --- trunk/i386/boot2/graphics.c (revision 114) +++ trunk/i386/boot2/graphics.c (revision 115) @@ -124,16 +124,14 @@ modeInfo.ModeAttributes); if (line++ >= 20) { - printf("(Press a key to continue...)"); - getc(); + pause(); line = 0; clearScreenRows(0, 24); setCursorPosition( 0, 0, 1 ); } } if (line != 0) { - printf("(Press a key to continue...)"); - getc(); + pause(); } setActiveDisplayPage(0); } Index: trunk/i386/boot2/options.c =================================================================== --- trunk/i386/boot2/options.c (revision 114) +++ trunk/i386/boot2/options.c (revision 115) @@ -613,15 +613,13 @@ (unsigned long)(mp->length), mp->type); if (line++ > 20) { - printf("(Press a key to continue...)"); - getc(); + pause(); line = 0; } mp++; } if (line > 0) { - printf("(Press a key to continue...)"); - getc(); + pause(); } setActiveDisplayPage(0); @@ -661,8 +659,7 @@ dump_pci_dt(root_pci_dev->children); - printf("(Press a key to continue...)"); - getc(); + pause(); if (bootArgs->Video.v_display == VGA_TEXT_MODE) { setActiveDisplayPage(0);