Index: branches/ErmaC/Trunk/Chameleon.xcodeproj/project.pbxproj =================================================================== --- branches/ErmaC/Trunk/Chameleon.xcodeproj/project.pbxproj (revision 2034) +++ branches/ErmaC/Trunk/Chameleon.xcodeproj/project.pbxproj (revision 2035) @@ -1317,6 +1317,23 @@ B00F494A11F6089500B1D7C5 /* aml_generator.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aml_generator.c; sourceTree = ""; }; B0146EFF11FDEF550010765C /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = ""; }; B0146F0011FDEFB90010765C /* GPL_V2_LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = GPL_V2_LICENSE; sourceTree = ""; }; + B412979E15BE0C4F00073B54 /* acpi_codec.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = acpi_codec.c; path = AcpiCodec/acpi_codec.c; sourceTree = ""; }; + B412979F15BE0C4F00073B54 /* acpi_tools.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = acpi_tools.c; path = AcpiCodec/acpi_tools.c; sourceTree = ""; }; + B41297A015BE0C4F00073B54 /* acpicode.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = acpicode.c; path = AcpiCodec/acpicode.c; sourceTree = ""; }; + B41297A115BE0C4F00073B54 /* ACPICodec.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = ACPICodec.c; path = AcpiCodec/ACPICodec.c; sourceTree = ""; }; + B41297A215BE0C4F00073B54 /* acpidecode.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = acpidecode.c; path = AcpiCodec/acpidecode.c; sourceTree = ""; }; + B41297A315BE0C4F00073B54 /* Cconfig */ = {isa = PBXFileReference; lastKnownFileType = text; name = Cconfig; path = AcpiCodec/Cconfig; sourceTree = ""; }; + B41297A515BE0C4F00073B54 /* acpi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = acpi.h; sourceTree = ""; }; + B41297A615BE0C4F00073B54 /* acpi_codec.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = acpi_codec.h; sourceTree = ""; }; + B41297A715BE0C4F00073B54 /* acpi_tools.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = acpi_tools.h; sourceTree = ""; }; + B41297A815BE0C4F00073B54 /* acpicode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = acpicode.h; sourceTree = ""; }; + B41297A915BE0C4F00073B54 /* acpidecode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = acpidecode.h; sourceTree = ""; }; + B41297AA15BE0C4F00073B54 /* datatype.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = datatype.h; sourceTree = ""; }; + B41297AB15BE0C4F00073B54 /* intel_acpi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = intel_acpi.h; sourceTree = ""; }; + B41297AC15BE0C4F00073B54 /* ppm.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ppm.h; sourceTree = ""; }; + B41297AD15BE0C4F00073B54 /* ppmsetup.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ppmsetup.h; sourceTree = ""; }; + B41297AE15BE0C4F00073B54 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; name = Makefile; path = AcpiCodec/Makefile; sourceTree = ""; }; + B41297AF15BE0C4F00073B54 /* Readme.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = Readme.txt; path = AcpiCodec/Readme.txt; sourceTree = ""; }; B41899FB14BFBE2400ED5B0B /* Cconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cconfig; sourceTree = ""; }; B41899FD14BFBE4500ED5B0B /* Cconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cconfig; sourceTree = ""; }; B41899FE14BFBE5200ED5B0B /* boot0md.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot0md.s; sourceTree = ""; }; @@ -2757,6 +2774,7 @@ A3561CAB1414024C00E9B51E /* modules */ = { isa = PBXGroup; children = ( + B412979C15BE0C3100073B54 /* AcpiCodec */, A3561CAC1414024C00E9B51E /* Cconfig */, A3561CAD1414024C00E9B51E /* HelloWorld */, A3561CB21414024C00E9B51E /* include */, @@ -3604,6 +3622,39 @@ path = User_Guide_src; sourceTree = ""; }; + B412979C15BE0C3100073B54 /* AcpiCodec */ = { + isa = PBXGroup; + children = ( + B412979E15BE0C4F00073B54 /* acpi_codec.c */, + B412979F15BE0C4F00073B54 /* acpi_tools.c */, + B41297A015BE0C4F00073B54 /* acpicode.c */, + B41297A115BE0C4F00073B54 /* ACPICodec.c */, + B41297A215BE0C4F00073B54 /* acpidecode.c */, + B41297A315BE0C4F00073B54 /* Cconfig */, + B41297A415BE0C4F00073B54 /* include */, + B41297AE15BE0C4F00073B54 /* Makefile */, + B41297AF15BE0C4F00073B54 /* Readme.txt */, + ); + name = AcpiCodec; + sourceTree = ""; + }; + B41297A415BE0C4F00073B54 /* include */ = { + isa = PBXGroup; + children = ( + B41297A515BE0C4F00073B54 /* acpi.h */, + B41297A615BE0C4F00073B54 /* acpi_codec.h */, + B41297A715BE0C4F00073B54 /* acpi_tools.h */, + B41297A815BE0C4F00073B54 /* acpicode.h */, + B41297A915BE0C4F00073B54 /* acpidecode.h */, + B41297AA15BE0C4F00073B54 /* datatype.h */, + B41297AB15BE0C4F00073B54 /* intel_acpi.h */, + B41297AC15BE0C4F00073B54 /* ppm.h */, + B41297AD15BE0C4F00073B54 /* ppmsetup.h */, + ); + name = include; + path = AcpiCodec/include; + sourceTree = ""; + }; B4189A0314BFBED900ED5B0B /* config */ = { isa = PBXGroup; children = ( Index: branches/ErmaC/Trunk/i386/libsaio/acpi_patcher.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/acpi_patcher.c (revision 2034) +++ branches/ErmaC/Trunk/i386/libsaio/acpi_patcher.c (revision 2035) @@ -159,14 +159,15 @@ void get_acpi_cpu_names(unsigned char* dsdt, uint32_t length) { uint32_t i; - // DBG("start finding cpu names. length %d\n", length); + + DBG("start finding cpu names. length %d\n", length); + for (i=0; i> 6); bool add_name = true; @@ -176,11 +177,6 @@ for (j=0; j<4; j++) { char c = dsdt[offset+j]; - if( c == '\\') - { - offset = i + 8 + (dsdt[i+7] >> 6); - c = dsdt[offset+j]; - } if (!aml_isvalidchar(c)) { @@ -196,20 +192,17 @@ memcpy(acpi_cpu_name[acpi_cpu_count], dsdt+offset, 4); i = offset + 5; - if (acpi_cpu_count == 0) - { - verbose("Found ACPI CPU: %c%c%c%c\n", acpi_cpu_name[acpi_cpu_count]); - } else { - verbose("And %c%c%c%c\n", acpi_cpu_name[acpi_cpu_count]); - } + if (acpi_cpu_count == 0) + acpi_cpu_p_blk = dsdt[i] | (dsdt[i+1] << 8); - if (++acpi_cpu_count == 32) - break; + verbose("Found ACPI CPU: %c%c%c%c\n", acpi_cpu_name[acpi_cpu_count][0], acpi_cpu_name[acpi_cpu_count][1], acpi_cpu_name[acpi_cpu_count][2], acpi_cpu_name[acpi_cpu_count][3]); + + if (++acpi_cpu_count == 32) return; } } } + DBG("end finding cpu names: cpu names found: %d\n", acpi_cpu_count); - return; } struct acpi_2_ssdt *generate_cst_ssdt(struct acpi_2_fadt* fadt) @@ -289,9 +282,9 @@ resource_template_register_fixedhw[9] = 0x00; resource_template_register_fixedhw[18] = 0x00; aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw)); - aml_add_byte(tmpl, 0x01); // C1 - aml_add_word(tmpl, 0x0001); // Latency - aml_add_dword(tmpl, 0x000003e8); // Power + aml_add_byte(tmpl, 0x01); // C1 + aml_add_word(tmpl, 0x0001); // Latency + aml_add_dword(tmpl, 0x000003e8); // Power uint8_t p_blk_lo, p_blk_hi; @@ -304,9 +297,9 @@ resource_template_register_systemio[11] = p_blk_lo; // C2 resource_template_register_systemio[12] = p_blk_hi; // C2 aml_add_buffer(tmpl, resource_template_register_systemio, sizeof(resource_template_register_systemio)); - aml_add_byte(tmpl, 0x02); // C2 - aml_add_word(tmpl, 0x0040); // Latency - aml_add_dword(tmpl, 0x000001f4); // Power + aml_add_byte(tmpl, 0x02); // C2 + aml_add_word(tmpl, 0x0040); // Latency + aml_add_dword(tmpl, 0x000001f4); // Power } if (c4_enabled) // C4 @@ -318,9 +311,9 @@ resource_template_register_systemio[11] = p_blk_lo; // C4 resource_template_register_systemio[12] = p_blk_hi; // C4 aml_add_buffer(tmpl, resource_template_register_systemio, sizeof(resource_template_register_systemio)); - aml_add_byte(tmpl, 0x04); // C4 - aml_add_word(tmpl, 0x0080); // Latency - aml_add_dword(tmpl, 0x000000C8); // Power + aml_add_byte(tmpl, 0x04); // C4 + aml_add_word(tmpl, 0x0080); // Latency + aml_add_dword(tmpl, 0x000000C8); // Power } else if (c3_enabled) // C3 { @@ -331,18 +324,22 @@ resource_template_register_systemio[11] = p_blk_lo; // C3 resource_template_register_systemio[12] = p_blk_hi; // C3 aml_add_buffer(tmpl, resource_template_register_systemio, sizeof(resource_template_register_systemio)); - aml_add_byte(tmpl, 0x03); // C3 - aml_add_word(tmpl, 0x0060); // Latency + aml_add_byte(tmpl, 0x03); // C3 + aml_add_word(tmpl, 0x0060); // Latency aml_add_dword(tmpl, 0x0000015e); // Power } } else { // C1 + resource_template_register_fixedhw[8] = 0x01; + resource_template_register_fixedhw[9] = 0x02; + resource_template_register_fixedhw[18] = 0x01; + resource_template_register_fixedhw[11] = 0x00; // C1 aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw)); - aml_add_byte(tmpl, 0x01); // C1 - aml_add_word(tmpl, 0x0001); // Latency + aml_add_byte(tmpl, 0x01); // C1 + aml_add_word(tmpl, 0x0001); // Latency aml_add_dword(tmpl, 0x000003e8); // Power resource_template_register_fixedhw[18] = 0x03; @@ -352,8 +349,8 @@ tmpl = aml_add_package(pack); resource_template_register_fixedhw[11] = 0x10; // C2 aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw)); - aml_add_byte(tmpl, 0x02); // C2 - aml_add_word(tmpl, 0x0040); // Latency + aml_add_byte(tmpl, 0x02); // C2 + aml_add_word(tmpl, 0x0040); // Latency aml_add_dword(tmpl, 0x000001f4); // Power } @@ -362,8 +359,8 @@ tmpl = aml_add_package(pack); resource_template_register_fixedhw[11] = 0x30; // C4 aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw)); - aml_add_byte(tmpl, 0x04); // C4 - aml_add_word(tmpl, 0x0080); // Latency + aml_add_byte(tmpl, 0x04); // C4 + aml_add_word(tmpl, 0x0080); // Latency aml_add_dword(tmpl, 0x000000C8); // Power } else if (c3_enabled) @@ -371,8 +368,8 @@ tmpl = aml_add_package(pack); resource_template_register_fixedhw[11] = 0x20; // C3 aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw)); - aml_add_byte(tmpl, 0x03); // C3 - aml_add_word(tmpl, 0x0060); // Latency + aml_add_byte(tmpl, 0x03); // C3 + aml_add_word(tmpl, 0x0060); // Latency aml_add_dword(tmpl, 0x0000015e); // Power } } @@ -581,12 +578,13 @@ case CPU_MODEL_SANDYBRIDGE: // Intel Core i3, i5, i7 LGA1155 (32nm) case CPU_MODEL_IVYBRIDGE: // Intel Core i3, i5, i7 LGA1155 (22nm) case CPU_MODEL_JAKETOWN: // Intel Core i7, Xeon E5 LGA2011 (32nm) + { if ((Platform.CPU.Model == CPU_MODEL_SANDYBRIDGE) || (Platform.CPU.Model == CPU_MODEL_JAKETOWN)) { - maximum.Control = (rdmsr64(MSR_IA32_PERF_STATUS) >> 8) & 0xff; + maximum.Control = (rdmsr64(MSR_IA32_PERF_STATUS) >> 8) & 0xff; } else { - maximum.Control = rdmsr64(MSR_IA32_PERF_STATUS) & 0xff; + maximum.Control = rdmsr64(MSR_IA32_PERF_STATUS) & 0xff; } minimum.Control = (rdmsr64(MSR_PLATFORM_INFO) >> 40) & 0xff; @@ -738,15 +736,17 @@ // Set PM_Profile from System-type if only user wanted this value to be forced if (fadt_mod->PM_Profile != Platform.Type) { - if (value) - { // user has overriden the SystemType so take care of it in FACP - verbose("FADT: changing PM_Profile from 0x%02x to 0x%02x\n", fadt_mod->PM_Profile, Platform.Type); - fadt_mod->PM_Profile = Platform.Type; - } - else - { // PM_Profile has a different value and no override has been set, so reflect the user value to ioregs - Platform.Type = fadt_mod->PM_Profile <= 6 ? fadt_mod->PM_Profile : 1; - } + if (value) + { + // user has overriden the SystemType so take care of it in FACP + verbose("FADT: changing PM_Profile from 0x%02x to 0x%02x\n", fadt_mod->PM_Profile, Platform.Type); + fadt_mod->PM_Profile = Platform.Type; + } + else + { + // PM_Profile has a different value and no override has been set, so reflect the user value to ioregs + Platform.Type = fadt_mod->PM_Profile <= 6 ? fadt_mod->PM_Profile : 1; + } } // We now have to write the systemm-type in ioregs: we cannot do it before in setupDeviceTree() // because we need to take care of facp original content, if it is correct. @@ -775,7 +775,7 @@ fadt_mod->Reset_AccessWidth = 0x01; // Byte access fadt_mod->Reset_Address = 0x0cf9; // Address of the register fadt_mod->Reset_Value = 0x06; // Value to write to reset the system - verbose("FADT: Restart Fix applied !\n"); + verbose("FADT: ACPI Restart Fix applied!\n"); } } @@ -856,8 +856,8 @@ getBoolForKey(kGeneratePStates, &generate_pstates, &bootInfo->chameleonConfig); getBoolForKey(kGenerateCStates, &generate_cstates, &bootInfo->chameleonConfig); - // DBG("generating p-states config: %d\n", generate_pstates); - // DBG("generating c-states config: %d\n", generate_cstates); + DBG("generating p-states config: %d\n", generate_pstates); + DBG("generating c-states config: %d\n", generate_cstates); { int i; @@ -967,7 +967,7 @@ // Generate _CST SSDT if (generate_cstates && (new_ssdt[ssdt_count] = generate_cst_ssdt(fadt_mod))) { - // DBG("c-states generated\n"); + DBG("C-States generated\n"); generate_cstates = false; // Generate SSDT only once! ssdt_count++; } @@ -975,7 +975,7 @@ // Generating _PSS SSDT if (generate_pstates && (new_ssdt[ssdt_count] = generate_pss_ssdt((void*)fadt_mod->DSDT))) { - // DBG("p-states generated\n"); + DBG("P-States generated\n"); generate_pstates = false; // Generate SSDT only once! ssdt_count++; } @@ -1173,7 +1173,7 @@ } else { - /* XXX aserebln why uint32 cast if pointer is uint64 ? */ + /* XXX aserebln why uint32 cast if pointer is uint64 ? */ acpi10_p = (uint32_t)rsdp_mod; addConfigurationTable(&gEfiAcpiTableGuid, &acpi10_p, "ACPI"); } Index: branches/ErmaC/Trunk/i386/libsaio/spd.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/spd.c (revision 2034) +++ branches/ErmaC/Trunk/i386/libsaio/spd.c (revision 2035) @@ -1,7 +1,7 @@ /* * spd.c - serial presence detect memory information * - * Originally restored from pcefi10.5 + * Originally restored from pcefi10.5 by netkas * Dynamic mem detection original impl. by Rekursor * System profiler fix and other fixes by Mozodojo. */ @@ -70,30 +70,31 @@ #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; + int l1, h1, l2, h2; + unsigned long long t; - outb(base + SMBHSTSTS, 0x1f); // reset SMBus Controller - outb(base + SMBHSTDAT, 0xff); + outb(base + SMBHSTSTS, 0x1f); // reset SMBus Controller + outb(base + SMBHSTDAT, 0xff); - rdtsc(l1, h1); - while ( inb(base + SMBHSTSTS) & 0x01) // wait until read - { - rdtsc(l2, h2); - t = ((h2 - h1) * 0xffffffff + (l2 - l1)) / (Platform.CPU.TSCFrequency / 100); - if (t > 5) - return 0xFF; // break - } + rdtsc(l1, h1); + while ( inb(base + SMBHSTSTS) & 0x01) // wait until read + { + rdtsc(l2, h2); + t = ((h2 - h1) * 0xffffffff + (l2 - l1)) / (Platform.CPU.TSCFrequency / 100); + if (t > 5) + return 0xFF; // break + } - outb(base + SMBHSTCMD, cmd); - outb(base + SMBHSTADD, (adr << 1) | 0x01 ); - outb(base + SMBHSTCNT, 0x48 ); + outb(base + SMBHSTCMD, cmd); + outb(base + SMBHSTADD, (adr << 1) | 0x01 ); + outb(base + SMBHSTCNT, 0x48 ); - rdtsc(l1, h1); + rdtsc(l1, h1); - while (!( inb(base + SMBHSTSTS) & 0x02)) // wait til command finished + while (!( inb(base + SMBHSTSTS) & 0x02)) // wait til command finished { rdtsc(l2, h2); t = ((h2 - h1) * 0xffffffff + (l2 - l1)) / (Platform.CPU.TSCFrequency / 100); @@ -123,7 +124,8 @@ static void init_spd(char * spd, uint32_t base, int slot) { int i; - for (i=0; i< SPD_INDEXES_SIZE; i++) { + for (i=0; i< SPD_INDEXES_SIZE; i++) + { READ_SPD(spd, base, slot, spd_indexes[i]); } } @@ -204,7 +206,7 @@ /** Get DDR3 or DDR2 serial number, 0 most of the times, always return a valid ptr */ const char *getDDRSerial(const char* spd) { - static char asciiSerial[16]; + static char asciiSerial[16]; if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR3) // DDR3 { @@ -215,7 +217,7 @@ sprintf(asciiSerial, "%X%X%X%X%X%X%X%X", SMST(95) /*& 0x7*/, SLST(95), SMST(96), SLST(96), SMST(97), SLST(97), SMST(98), SLST(98)); } - return strdup(asciiSerial); + return strdup(asciiSerial); } /** Get DDR3 or DDR2 Part Number, always return a valid ptr */ @@ -231,10 +233,11 @@ start = 73; } - // Check that the spd part name is zero terminated and that it is ascii: - bzero(asciiPartNo, sizeof(asciiPartNo)); + // Check that the spd part name is zero terminated and that it is ascii: + bzero(asciiPartNo, sizeof(asciiPartNo)); char c; - for (i=start; i < start + sizeof(asciiPartNo); i++) { + for (i=start; i < start + sizeof(asciiPartNo); i++) + { READ_SPD(spd, base, slot, i); // only read once the corresponding model part (ddr3 or ddr2) c = spd[i]; if (isalpha(c) || isdigit(c) || ispunct(c)) // It seems that System Profiler likes only letters and digits... @@ -252,75 +255,77 @@ /** Read from smbus the SPD content and interpret it for detecting memory attributes */ static void read_smb_intel(pci_dt_t *smbus_dev) { - int i, speed; - uint8_t spd_size, spd_type; - uint32_t base, mmio, hostc; -// bool dump = false; - RamSlotInfo_t* slot; + int i, speed; + uint8_t spd_size, spd_type; + uint32_t base, mmio, hostc; +// bool dump = false; + RamSlotInfo_t* slot; uint16_t cmd = pci_config_read16(smbus_dev->dev.addr, 0x04); DBG("SMBus CmdReg: 0x%x\n", cmd); pci_config_write16(smbus_dev->dev.addr, 0x04, cmd | 1); mmio = pci_config_read32(smbus_dev->dev.addr, 0x10);// & ~0x0f; - base = pci_config_read16(smbus_dev->dev.addr, 0x20) & 0xFFFE; + base = pci_config_read16(smbus_dev->dev.addr, 0x20) & 0xFFFE; hostc = pci_config_read8(smbus_dev->dev.addr, 0x40); - verbose("Scanning SMBus [%04x:%04x], mmio: 0x%x, ioport: 0x%x, hostc: 0x%x\n", - smbus_dev->vendor_id, smbus_dev->device_id, mmio, base, hostc); + verbose("Scanning SMBus [%04x:%04x], mmio: 0x%x, ioport: 0x%x, hostc: 0x%x\n", + smbus_dev->vendor_id, smbus_dev->device_id, mmio, base, hostc); //Azi: no use for this! // getBoolForKey("DumpSPD", &dump, &bootInfo->chameleonConfig); // needed at least for laptops - bool fullBanks = Platform.DMI.MemoryModules == Platform.DMI.CntMemorySlots; + bool fullBanks = Platform.DMI.MemoryModules == Platform.DMI.CntMemorySlots; char spdbuf[MAX_SPD_SIZE]; - // Search MAX_RAM_SLOTS slots - for (i = 0; i < MAX_RAM_SLOTS; i++){ - slot = &Platform.RAM.DIMM[i]; - spd_size = smb_read_byte_intel(base, 0x50 + i, 0); + // Search MAX_RAM_SLOTS slots + for (i = 0; i < MAX_RAM_SLOTS; i++){ + slot = &Platform.RAM.DIMM[i]; + spd_size = smb_read_byte_intel(base, 0x50 + i, 0); DBG("SPD[0] (size): 0x%02x @0x%x\n", spd_size, 0x50 + i); - // Check spd is present - if (spd_size && (spd_size != 0xff)) - { + // Check spd is present + if (spd_size && (spd_size != 0xff)) + { - slot->spd = spdbuf; - slot->InUse = true; + slot->spd = spdbuf; + slot->InUse = true; - bzero(slot->spd, spd_size); - + bzero(slot->spd, spd_size); + // Copy spd data into buffer - - //for (x = 0; x < spd_size; x++) slot->spd[x] = smb_read_byte_intel(base, 0x50 + i, x); - init_spd(slot->spd, base, i); - - switch (slot->spd[SPD_MEMORY_TYPE]) { - case SPD_MEMORY_TYPE_SDRAM_DDR2: - - slot->ModuleSize = ((1 << (slot->spd[SPD_NUM_ROWS] & 0x0f) + (slot->spd[SPD_NUM_COLUMNS] & 0x0f) - 17) * - ((slot->spd[SPD_NUM_DIMM_BANKS] & 0x7) + 1) * slot->spd[SPD_NUM_BANKS_PER_SDRAM]); - break; - - case SPD_MEMORY_TYPE_SDRAM_DDR3: - - slot->ModuleSize = ((slot->spd[4] & 0x0f) + 28 ) + ((slot->spd[8] & 0x7) + 3 ); - slot->ModuleSize -= (slot->spd[7] & 0x7) + 25; - slot->ModuleSize = ((1 << slot->ModuleSize) * (((slot->spd[7] >> 3) & 0x1f) + 1)); - - break; - } - - spd_type = (slot->spd[SPD_MEMORY_TYPE] < ((char) 12) ? slot->spd[SPD_MEMORY_TYPE] : 0); - slot->Type = spd_mem_to_smbios[spd_type]; - slot->PartNo = getDDRPartNum(slot->spd, base, i); - slot->Vendor = getVendorName(slot, base, i); - slot->SerialNo = getDDRSerial(slot->spd); - // determine spd speed - speed = getDDRspeedMhz(slot->spd); - if (slot->FrequencyFrequency = speed; + //for (x = 0; x < spd_size; x++) slot->spd[x] = smb_read_byte_intel(base, 0x50 + i, x); + init_spd(slot->spd, base, i); + + switch (slot->spd[SPD_MEMORY_TYPE]) + { + case SPD_MEMORY_TYPE_SDRAM_DDR2: + + slot->ModuleSize = ((1 << ((slot->spd[SPD_NUM_ROWS] & 0x0f) + (slot->spd[SPD_NUM_COLUMNS] & 0x0f) - 17)) * + ((slot->spd[SPD_NUM_DIMM_BANKS] & 0x7) + 1) * slot->spd[SPD_NUM_BANKS_PER_SDRAM]); + break; + + case SPD_MEMORY_TYPE_SDRAM_DDR3: + + slot->ModuleSize = ((slot->spd[4] & 0x0f) + 28 ) + ((slot->spd[8] & 0x7) + 3 ); + slot->ModuleSize -= (slot->spd[7] & 0x7) + 25; + slot->ModuleSize = ((1 << slot->ModuleSize) * (((slot->spd[7] >> 3) & 0x1f) + 1)); + + break; + } + + spd_type = (slot->spd[SPD_MEMORY_TYPE] < ((char) 12) ? slot->spd[SPD_MEMORY_TYPE] : 0); + slot->Type = spd_mem_to_smbios[spd_type]; + slot->PartNo = getDDRPartNum(slot->spd, base, i); + slot->Vendor = getVendorName(slot, base, i); + slot->SerialNo = getDDRSerial(slot->spd); + + // determine spd speed + speed = getDDRspeedMhz(slot->spd); + if (slot->FrequencyFrequency = speed; // pci memory controller if available, is more reliable - if (Platform.RAM.Frequency > 0) { + if (Platform.RAM.Frequency > 0) + { uint32_t freq = (uint32_t)Platform.RAM.Frequency / 500000; // now round off special cases uint32_t fmod100 = freq %100; @@ -343,20 +348,17 @@ slot->Vendor, slot->PartNo, slot->SerialNo); - - } - // laptops sometimes show slot 0 and 2 with slot 1 empty when only 2 slots are presents so: - Platform.DMI.DIMM[i]= - i>0 && Platform.RAM.DIMM[1].InUse==false && fullBanks && Platform.DMI.CntMemorySlots == 2 ? - mapping[i] : i; // for laptops case, mapping setup would need to be more generic than this - + } - + // laptops sometimes show slot 0 and 2 with slot 1 empty when only 2 slots are presents so: + Platform.DMI.DIMM[i]= + i>0 && Platform.RAM.DIMM[1].InUse==false && fullBanks && Platform.DMI.CntMemorySlots == 2 ? + mapping[i] : i; // for laptops case, mapping setup would need to be more generic than this slot->spd = NULL; - } // for + } // for } static struct smbus_controllers_t smbus_controllers[] = { @@ -383,33 +385,32 @@ // find_and_read_smbus_controller(root_pci_dev); bool find_and_read_smbus_controller(pci_dt_t* pci_dt) { - pci_dt_t *current = pci_dt; - int i; + pci_dt_t *current = pci_dt; + int i; - while (current) { + while (current) { #if 0 - printf("%02x:%02x.%x [%04x] [%04x:%04x] :: %s\n", - current->dev.bits.bus, current->dev.bits.dev, current->dev.bits.func, - current->class_id, current->vendor_id, current->device_id, - get_pci_dev_path(current)); + printf("%02x:%02x.%x [%04x] [%04x:%04x] :: %s\n", + current->dev.bits.bus, current->dev.bits.dev, current->dev.bits.func, + current->class_id, current->vendor_id, current->device_id, + get_pci_dev_path(current)); #endif for ( i = 0; i < sizeof(smbus_controllers) / sizeof(smbus_controllers[0]); i++ ) - { - if (current->vendor_id == smbus_controllers[i].vendor && - current->device_id == smbus_controllers[i].device) - { - smbus_controllers[i].read_smb(current); // read smb - return true; - } - } - find_and_read_smbus_controller(current->children); - current = current->next; - } + { + if (current->vendor_id == smbus_controllers[i].vendor && current->device_id == smbus_controllers[i].device) + { + smbus_controllers[i].read_smb(current); // read smb + return true; + } + } + find_and_read_smbus_controller(current->children); + current = current->next; + } return false; // not found } void scan_spd(PlatformInfo_t *p) { - find_and_read_smbus_controller(root_pci_dev); + find_and_read_smbus_controller(root_pci_dev); } Index: branches/ErmaC/Trunk/i386/libsaio/nvidia.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/nvidia.c (revision 2034) +++ branches/ErmaC/Trunk/i386/libsaio/nvidia.c (revision 2035) @@ -458,6 +458,22 @@ { 0x10DE0603, 0x174B1058, "PC Partner GeForce GT 230" }, { 0x10DE0603, 0x1B0A9044, "Pegatron GeForce GT 230" }, + { 0x10DE0604, 0x10DE0504, "nVidia GeForce 9800 GX2" }, + + { 0x10DE0605, 0x10DE0612, "nVidia GeForce 9800 GT" }, + { 0x10DE0605, 0x10DE062D, "nVidia GeForce 9800 GT" }, + { 0x10DE0605, 0x14621460, "MSi GeForce 9800 GT" }, + + { 0x10DE0607, 0x10DE0736, "nVidia GeForce GTS 240" }, + + { 0x10DE0608, 0x1028019C, "Dell GeForce 9800M GTX" }, + { 0x10DE0608, 0x102802A1, "Dell GeForce 9800M GTX" }, + { 0x10DE0608, 0x10432003, "Asus GeForce 9800M GTX" }, + { 0x10DE0608, 0x1179FF01, "Toshiba GeForce 9800M GTX" }, + { 0x10DE0608, 0x15580481, "Clevo GeForce 9800M GTX" }, + { 0x10DE0608, 0x15880577, "Solidum GeForce 9800M GTX" }, + { 0x10DE0608, 0x161F207A, "Arima GeForce 9800M GTX" }, + { 0x10DE0609, 0x1028019B, "Dell GeForce 8800M GTS" }, { 0x10DE0609, 0x103C30D4, "HP GeForce 8800M GTS" }, { 0x10DE0609, 0x104381F7, "Asus GeForce 8800M GTS" }, Index: branches/ErmaC/Trunk/i386/libsaio/ati.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/ati.c (revision 2034) +++ branches/ErmaC/Trunk/i386/libsaio/ati.c (revision 2035) @@ -816,6 +816,7 @@ { 0x6798, 0x23171787, CHIP_FAMILY_TAHITI, "AMD Radeon HD 7970", kNull }, { 0x6798, 0x254D1458, CHIP_FAMILY_TAHITI, "AMD Radeon HD 7970", kNull }, { 0x6798, 0x27701462, CHIP_FAMILY_TAHITI, "AMD Radeon HD 7970", kNull }, + { 0x6798, 0x30001002, CHIP_FAMILY_TAHITI, "AMD Radeon HD 7970", kNull }, { 0x6798, 0x32101682, CHIP_FAMILY_TAHITI, "AMD Radeon HD 7970", kNull }, { 0x6798, 0x32111682, CHIP_FAMILY_TAHITI, "AMD Radeon HD 7970", kNull }, { 0x6798, 0x32121682, CHIP_FAMILY_TAHITI, "AMD Radeon HD 7970", kNull },