Index: trunk/i386/libsaio/spd.c =================================================================== --- trunk/i386/libsaio/spd.c (revision 106) +++ trunk/i386/libsaio/spd.c (revision 107) @@ -63,7 +63,35 @@ #define SMBHSTCMD 3 #define SMBHSTADD 4 #define SMBHSTDAT 5 +#define SBMBLKDAT 7 +/** Read one byte from the intel i2c, used for reading SPD on intel chipsets only. */ +unsigned char smb_read_byte_intel(uint32_t base, uint8_t adr, uint8_t cmd) +{ + int l1, h1, l2, h2; + unsigned long long t; + + outb(base + SMBHSTSTS, 0x1f); // reset SMBus Controller + outb(base + SMBHSTDAT, 0xff); + + while( inb(base + SMBHSTSTS) & 0x01); // wait until ready + + outb(base + SMBHSTCMD, cmd); + outb(base + SMBHSTADD, (adr << 1) | 0x01 ); + outb(base + SMBHSTCNT, 0x48 ); + + rdtsc(l1, h1); + + while (!( inb(base + SMBHSTSTS) & 0x02)) // wait til command finished + { + rdtsc(l2, h2); + t = ((h2 - h1) * 0xffffffff + (l2 - l1)) / (Platform.CPU.TSCFrequency / 40); + if (t > 10) + break; // break after 10ms + } + return inb(base + SMBHSTDAT); +} + /** Get Vendor Name from spd, 2 cases handled DDR3 and DDR2, have different formats, always return a valid ptr.*/ const char * getVendorName(RamSlotInfo_t* slot) @@ -179,33 +207,6 @@ "N/A" : sPart; } -/** Read one byte from the intel i2c, used for reading SPD on intel chipsets only. */ -unsigned char smb_read_byte_intel(uint32_t base, uint8_t adr, uint8_t cmd) -{ - int l1, h1, l2, h2; - unsigned long long t; - - outb(base + SMBHSTSTS, 0x1f); // reset SMBus Controller - outb(base + SMBHSTDAT, 0xff); - - while( inb(base + SMBHSTSTS) & 0x01); // wait until ready - - outb(base + SMBHSTCMD, cmd); - outb(base + SMBHSTADD, (adr << 1) | 0x01 ); - outb(base + SMBHSTCNT, 0x48 ); - - rdtsc(l1, h1); - - while (!( inb(base + SMBHSTSTS) & 0x02)) // wait til command finished - { - rdtsc(l2, h2); - t = ((h2 - h1) * 0xffffffff + (l2 - l1)) / (Platform.CPU.TSCFrequency / 40); - if (t > 10) - break; // break after 10ms - } - return inb(base + SMBHSTDAT); -} - int mapping []= {0,2,1,3,4,6,5,7,8,10,9,11}; /** Read from smbus the SPD content and interpret it for detecting memory attributes */ Index: trunk/i386/libsaio/platform.c =================================================================== --- trunk/i386/libsaio/platform.c (revision 106) +++ trunk/i386/libsaio/platform.c (revision 107) @@ -36,9 +36,15 @@ void scan_platform(void) { + bool useAutodetection = true; + getBoolForKey(kUseMemDetect, &useAutodetection, &bootInfo->bootConfig); + memset(&Platform, 0, sizeof(Platform)); build_pci_dt(); scan_cpu(&Platform); - scan_memory(&Platform); - scan_spd(&Platform); + + if (useAutodetection) { + scan_memory(&Platform); + scan_spd(&Platform); + } } Index: trunk/i386/boot2/boot.h =================================================================== --- trunk/i386/boot2/boot.h (revision 106) +++ trunk/i386/boot2/boot.h (revision 107) @@ -86,7 +86,8 @@ #define kDeviceProperties "device-properties" /* device_inject.c */ #define kHidePartition "Hide Partition" /* disk.c */ #define kRenamePartition "Rename Partition" /* disk.c */ -#define kRestartFix "RestartFix" /* dsdt_patcher.c */ +#define kUseMemDetect "UseMemDetect" /* platform.c */ +#define kRestartFix "RestartFix" /* dsdt_patcher.c */ /* * Flags to the booter or kernel