Time2Retire Posted May 6, 2011 Author Share Posted May 6, 2011 Based on superhai's SMBIOSResolver I made this little kext. It reads out /efi/platform and you can use setProperty() to do your magic. You might want to change IOResourceMatch to IOKit and IOProviderClass to IOService in the plist, depending on what you want to do. I'll load it up and see if it's necessary. For anybody else downloading this: it's an Xcode project with a kext skeleton, it doesn't actually do anything Ok that compiles. Cool. Thanks! So what do we need now to inject "FSBFrequency"? Please note that this property will be missing due to the new AppleSMBIOS.cpp of which of course the source code is still missing / not released. I've seen at least 3 different versions now, but the Apple Open Source website is still at 41. Link to comment Share on other sites More sharing options...
flAked Posted May 6, 2011 Share Posted May 6, 2011 http://mydellmini.googlecode.com/svn/trunk...IOSResolver.cpp Search for fsbFrequency. superhai actually accounted for the quad-pumping. I do actually have /efi/platform/FSBFrequency or did you meant something else? Link to comment Share on other sites More sharing options...
mrmojorisin17 Posted May 6, 2011 Share Posted May 6, 2011 Hi DHP, hi flAked What are you trying to do practically with this injector? Don't ask you what are you trying to do technically beacuse I'm not a developer and it could be very hard to me to understand. Link to comment Share on other sites More sharing options...
Time2Retire Posted May 6, 2011 Author Share Posted May 6, 2011 http://mydellmini.googlecode.com/svn/trunk...IOSResolver.cpp Search for fsbFrequency. superhai actually accounted for the quad-pumping. I do actually have /efi/platform/FSBFrequency or did you meant something else? Sure. You now have efi/platform/FSBFrequency but you won't anymore soon. That is why we need to inject if after AppleSMBIOS.kext did its thing. I guess it should be something like: platformNode->setProperty("FSBFrequency", 100000000, 16) What do you think? Can you test drive this with a fake property? Should be the same format (data) as what your FSBFrequency now looks like. It is all a bit of a hack right now, I know, but I have no other options since the AppleSMBIOS / XNU source code has yet to be released. Hi DHP, hi flAked What are you trying to do practically with this injector? Don't ask you what are you trying to do technically beacuse I'm not a developer and it could be very hard to me to understand. Simple put. All boot loaders inject the FSB frequency, and this value gets quad pumped by AppleSMBIOS.kext Which is standard for most processors but not for Sandy Bridge and JakeTown. This is why we cannot inject it from the boot loader anymore. We have to do it after the mach_kernel has initialized the values and AppleSMBIOS.kext did what it has to do. Suck Link to comment Share on other sites More sharing options...
flAked Posted May 6, 2011 Share Posted May 6, 2011 platformNode->setProperty("FSBFrequency", 100000000, 16) Not quite right, need to set it as 'data' Link to comment Share on other sites More sharing options...
Time2Retire Posted May 6, 2011 Author Share Posted May 6, 2011 Not quite right, need to set it as 'data' Oops. Look here. That might help Link to comment Share on other sites More sharing options...
mrmojorisin17 Posted May 6, 2011 Share Posted May 6, 2011 Simple put. All boot loader inject the FSB frequency, and this value gets quad pumped by AppleSMBIOS.kext Which is standard for most processors but not for Sandy Bridge and JakeTown. This is why we cannot inject it from the boot loader anymore. We have to do it after the mach_kernel has initialized the values and AppleSMBIOS.kext did what it has to do. Suck Ok. Now it's more clear And what we have to modify in injector before compiling it? I'm a n00b \ò/ Link to comment Share on other sites More sharing options...
Time2Retire Posted May 6, 2011 Author Share Posted May 6, 2011 Ok. Now it's more clear And what we have to modify in injector before compiling it? I'm a n00b \ò/ Nothing when it is done as flAked is doing all the hard work for us!!! Link to comment Share on other sites More sharing options...
mrmojorisin17 Posted May 6, 2011 Share Posted May 6, 2011 I know, just trying to learn something new Link to comment Share on other sites More sharing options...
flAked Posted May 6, 2011 Share Posted May 6, 2011 Can't quite figure out how they are setting these bytes. The first one is set like this OSData *fakeFreq = OSData::withBytes("100000000", 8); And the second OSData *fakeFreq2 = OSData::withCapacity(9); if(fakeFreq2) { fakeFreq2->appendBytes("100000000", 8); fakeFreq2->appendByte('\0', 1); efiPlatform->setProperty("FAKE2frequency", fakeFreq2); fakeFreq2->release(); } Link to comment Share on other sites More sharing options...
Time2Retire Posted May 6, 2011 Author Share Posted May 6, 2011 Looks like a format error. I am using uint8_t in efi.c And what if you use: OSData *fakeFreq = OSData::withBytes(100000000, 8); I found this in IOPlatformExpert.cpp // Correct the bus frequency in the device tree. busFrequency = OSData::withBytesNoCopy((void *)&gPEClockFrequencyInfo.bus_clock_rate_hz, 4); provider->setProperty("clock-frequency", busFrequency); busFrequency->release(); In the correct format. p.s. It is 1:46AM here and I have a hockey match tomorrow so... Good night Link to comment Share on other sites More sharing options...
flAked Posted May 7, 2011 Share Posted May 7, 2011 p.s. It is 1:46AM here and I have a hockey match tomorrow so... Good night Nothing beats Tom Waits and a bunch of handmade kernel panics But I'm getting really tired as well, same time zone here... good night and have fun tomorrow! Allright, this works: static const UInt8 freq[] = { 0x00, 0xE1, 0xF5, 0x05, 0x00, 0x00, 0x00, 0x00 }; //0x5F5E100 OSData *fakeFreq = OSData::withBytes((void*)freq, sizeof(freq)); efiPlatform->setProperty("FAKEfrequency", fakeFreq); But don't we want to extract the frequency from the MSR anyways? What's the next step? Link to comment Share on other sites More sharing options...
Time2Retire Posted May 7, 2011 Author Share Posted May 7, 2011 But don't we want to extract the frequency from the MSR anyways? What's the next step? Difficult to reply from my girly white but I need a NullCPUPM kext and the injector to work in both 32/64 bit so that I can test it. Should be back home in no time... Ok so here I am. Now. It was getting late yesterday but here it is. Add this to cpu/Intel/dynamic_data.h #define MSR_MISC_PWR_MGMT 0x01AA #define IA32_MISC_ENABLES 0x01A0 msr = rdmsr64(IA32_MISC_ENABLES); // 0x850089 printf("IA32_MISC_ENABLES : 0x%x\n", msr); msr = rdmsr64(MSR_MISC_PWR_MGMT); // 0x400000 printf("MSR_MISC_PWR_MGMT: 0x%x\n", msr); I included the values I get. Please note that changing the EIST/Turbo setting in the BIOS should change these values, but it doesn't (see: APPENDIX B MODEL-SPECIFIC REGISTERS) Go ahead and test it. Please ask other people, in other forums, with different boards, to test run this! We need this data. I mean what if Apple does things correctly... BOOM. There's your KP. Source: Intel® 64 and IA-32 Architectures Software Developer’s Manual Volume 3B: System Programming Guide, Part 2 Automatic Thermal Control Circuit Enable (bit 3) Performance Monitoring Available (bit 7) TM2 Enable (bit 13) Enhanced Intel SpeedStep Technology Enable (bit 16) ENABLE MONITOR FSM (bit 18) Enhanced Intel SpeedStep Technology Select Lock (bit 20) Turbo IDA Disable (bit 38) I bet that when it works for people, on other boards, without NullCPUPM.kext that Eist hardware coordination (bit 1) in MSR_MISC_PWR_MGMT is set because Apple checks this bit in SSDT-5.dsl. Look here: Method (_PSD, 0, NotSerialized) { If (LNot (PSDF)) { Store (TCNT, Index (DerefOf (Index (HPSD, 0x00)), 0x04)) Store (TCNT, Index (DerefOf (Index (SPSD, 0x00)), 0x04)) Store (Ones, PSDF) } If (And (PDC0, 0x0800)) { Return (HPSD) } Return (SPSD) } Name (HPSD, Package (0x01) { Package (0x05) { 0x05, 0x00, 0x00, 0xFE, 0x80 } }) Name (SPSD, Package (0x01) { Package (0x05) { 0x05, 0x00, 0x00, 0xFC, 0x80 } }) This value 0x0800 represents bit 11 and that means: "OSPM is capable of hardware coordination of P-States" Source: http://www.insanelymac.com/forum/index.php...p;#entry1294522 Now I need to go to a doctor to get some stitches – got a stick where it didn't belong, and it won't stop bleeding. Great start for a weekend with two more matches coming up (: Link to comment Share on other sites More sharing options...
flAked Posted May 7, 2011 Share Posted May 7, 2011 This value 0x0800 represents bit 11 and that means: "OSPM is capable of hardware coordination of P-States" Allright, so we need to set the registers ourself, man thats annoying. And could change with any BIOS-update... Our PSD-return is correct then, but where is that 0x80 coming from again? (where we have 0x04) Ah yes, NumProcessors. Funky, I always wanted 128 cores! Now I need to go to a doctor to get some stitches – got a stick where it didn't belong, and it won't stop bleeding. Great start for a weekend with two more matches coming up (: I know the drill, playing skate hockey for over 10 years now, nearly poked my spleen one day, brr. Be well, and remember, more scars, more street cred Link to comment Share on other sites More sharing options...
flAked Posted May 7, 2011 Share Posted May 7, 2011 I included the values I get. Please note that changing the EIST/Turbo setting in the BIOS should change these values, but it doesn't (see: APPENDIX B MODEL-SPECIFIC REGISTERS) Go ahead and test it. Confirmed, I get the same values as you do. And they don't change if I change BIOS settings. But according to our bits, everything is enabled. And about MSR_MISC_PWR_MGMT bit 0: When 0, enables hardware coordination of EIST request from processor cores;So maybe on Apple hardware this bit is set to 1. NEWS Here is a custom build of RevoBoot to test this, we need your help! boot_RevoBoot_custom_cpu_debug.zip 1) Copy boot to /boot, backup your old one 2) Activate EIST/Turbo in your BIOS 3) Write down the values of MSR_MISC_PWR_MGMT IA32_MISC_ENABLES 4) Change the values of EIST/Turbo in your BIOS 5) Write down the values again 6) Post them here Thank you very much. P.S. I posted this at tonymac http://www.tonymacx86.com/viewtopic.php?f=79&t=19175 Link to comment Share on other sites More sharing options...
Time2Retire Posted May 7, 2011 Author Share Posted May 7, 2011 Perfect. The Injector.kext works but... we need to load it before AppleSMBIOS.kext with the current value divided by 4. I need to sit for a while (mom, being the doctor, glued it together for a nicer end-result. And thanks for posting it over at TonyMac - you may add that people can boot from any (bootable) USB-media. This to simplify things for them. To not break their installation. back later... Link to comment Share on other sites More sharing options...
flAked Posted May 7, 2011 Share Posted May 7, 2011 Perfect. The Injector.kext works but... we need to load it before AppleSMBIOS.kext with the current value divided by 4. I need to sit for a while (mom, being the doctor, glued it together for a nicer end-result. Now loading directly after ACPI May 7 15:32:02 localhost kernel[0]: ACPI: System State [s0 S3 S4 S5] (S3)May 7 15:32:02 localhost kernel[0]: Injector: current FSBFrequency is: 100328335 May 7 15:32:02 localhost kernel[0]: RTC: Only single RAM bank (128 bytes) btw, if you don't have /efi/platform/FSBFrequency, how would you get the the current value? Link to comment Share on other sites More sharing options...
Time2Retire Posted May 7, 2011 Author Share Posted May 7, 2011 Now loading directly after ACPI Thanks. So what do I need to change? btw, if you don't have /efi/platform/FSBFrequency, how would you get the the current value? fsbFrequency = tscFrequency (/ max_ratio) Link to comment Share on other sites More sharing options...
mrmojorisin17 Posted May 7, 2011 Share Posted May 7, 2011 NEWSHere is a custom build of RevoBoot to test this, we need your help! boot_RevoBoot_custom_cpu_debug.zip 1) Copy boot to /boot, backup your old one 2) Activate EIST/Turbo in your BIOS 3) Write down the values of MSR_MISC_PWR_MGMT IA32_MISC_ENABLES 4) Change the values of EIST/Turbo in your BIOS 5) Write down the values again 6) Post them here Thank you very much. I'll try this a.s.a.p. Thanks for your work! Link to comment Share on other sites More sharing options...
flAked Posted May 7, 2011 Share Posted May 7, 2011 I'll try this a.s.a.p. Thanks for your work! Great! Do you know someone with a new Gigabyte board? Figured it out, phew. FAKEfrequency is now quad-reduced. Link to comment Share on other sites More sharing options...
mrmojorisin17 Posted May 7, 2011 Share Posted May 7, 2011 Nope, sorry That's my values w/ and w/o Turbo Mode enabled in BIOS: MSR_MISC_PWR_MGMT 0x850089 IA32_MISC_ENABLES 0x400000 Tell me if I can make other test for you Link to comment Share on other sites More sharing options...
Time2Retire Posted May 7, 2011 Author Share Posted May 7, 2011 Correction: EIST Hardware Coordination Disable (R/W). "When 0, enables hardware coordination of EIST request from processor cores; When 1, disables hardware coordination of EIST requests." And thus hardware coordinated P-States are active. Link to comment Share on other sites More sharing options...
flAked Posted May 7, 2011 Share Posted May 7, 2011 UInt64 fsbFrequency = 0; IORegistryEntry *efiPlatform = fromPath("/efi/platform", gIODTPlane); if (efiPlatform) { OSData *efiFSBFreq = OSDynamicCast(OSData, efiPlatform->getProperty("FSBFrequency")); if(efiFSBFreq) { bcopy(efiFSBFreq->getBytesNoCopy(), &fsbFrequency, efiFSBFreq->getLength()); IOLog("Injector: current FSBFrequency is: %u\n", (uint)fsbFrequency); UInt64 divFreq = fsbFrequency / 4; IOLog("Injector: New quad-reduced frequency: %u\n", (uint)divFreq); OSData *num = OSData::withBytes(&divFreq, sizeof(divFreq)); if(num) { efiPlatform->setProperty("FAKEfrequency", num); IOLog("Injector: Stored in FAKEfrequency. All done.\n"); } } efiPlatform->release(); } else { // No /efi/platform found } Note: you need to copy your msr frequency code from revo. Link to comment Share on other sites More sharing options...
davidm71 Posted May 7, 2011 Share Posted May 7, 2011 I want to help testing w/ my deluxe board. What can I do to help? Link to comment Share on other sites More sharing options...
flAked Posted May 7, 2011 Share Posted May 7, 2011 I want to help testing w/ my deluxe board. What can I do to help? The instructions are there, search for how you can swap/replace your boot-loader. If you installed Chameleon, you should have /boot. You need to make a backup of it and replace it with the download. BTW; A new BIOS-update 1503 came out for the P8P67, but it didn't change anything in regards to our registers. Link to comment Share on other sites More sharing options...
Recommended Posts