Monday, August 19, 2013

Enhanced 10.8.4 Kernel For Haswell

Since OS X 10.8.5 or Mavericks 10.9 has not been released, I decided to enhance the 10.8.4 kernel to allow it to boot on Haswell based machines.

You can download the source for the 10.8.4 kernel at http://www.opensource.apple.com/tarballs/xnu/xnu-2050.24.15.tar.gz

Here are the changes I made:

In the file osfmk/i386/cpuid.h

Added:
#define CPUID_MODEL_HASWELL 0x3C

In the file osfmk/i386/cpuid.c

Added:
case CPUID_MODEL_HASWELL:

The pre-built kernel in a handy installer is now available at
http://www.tonymacx86.com/379-haswellhelper-enhanced-10-8-4-kernel-now-available.html

Enjoy.

Monday, May 21, 2012

Customizing SSDT: Power Management Optimization on 10.7.4


With the release of SSDTs in MultiBeast, I decided to limit the Overclocked SSDT to a maximum clock of 4.2 GHz since that is the maximum that About This Mac can report using auto detection.

Over the past few days, numerous users have been asking how to customize their SSDT to run at a higher clock rate, and how to see more P-states on a non-overclocked system. This post aims to explain the SSDT and how to customize it.

Lets look at the first block of code:

    External (\_PR_.CPU7, DeviceObj)
    External (\_PR_.CPU6, DeviceObj)
    External (\_PR_.CPU5, DeviceObj)
    External (\_PR_.CPU4, DeviceObj)
    External (\_PR_.CPU3, DeviceObj)
    External (\_PR_.CPU2, DeviceObj)
    External (\_PR_.CPU1, DeviceObj)
    External (\_PR_.CPU0, DeviceObj)

This block defines how many real or hyper-thread CPU's are available. So in this example, we are defining up to 8 CPUs. If your CPU has less (Core i3 or Core i5) it is safe to delete External (\_PR_.CPU4, DeviceObj) thru External (\_PR_.CPU7, DeviceObj). But then you will need to delete the corresponding entries Scope (\_PR.CPU4) thru Scope (\_PR.CPU7) at the end of the SSDT.

Let's look at the next section:

    Scope (\_PR.CPU0)
    {
        Name (APSN, 0x04)
        Name (APSS, Package (0x1B)
        {

Here we are defining the details for CPU0. The first line is assigning 0x4 to APSN which is an Apple-specific object. The next object APSS is also Apple-specific, but is defined the same as the ACPI object _PSS. The key thing in this line is Package (0x1B) as 0x1B defines in hexadecimal the number of definitions contained within. So 0x1B corresponds to 27 decimal. This means we have 27 states defined.

Next let's look at the top most entry but with comments added based on the ACPI Specification for _PSS:

            Package (0x06)
            {
                0x1068,   // CoreFreq
                Zero,        // Power
                0x0A,      //  TransitionLatency
                0x0A,      //  BusMasterLatency
                0x2A00,  // Control
                0x2A00   // Status
            },

From ACPI Specification- Section 8.4.4.2:

CoreFreq. Indicates the core CPU operating frequency (in MHz).
Power. Indicates the performance state’s maximum power dissipation (in milliWatts).
TransitionLatency. Indicates the worst-case latency in microseconds that the CPU is unavailable during a transition from any performance state to this performance state.
BusMasterLatency. Indicates the worst-case latency in microseconds that Bus Masters are prevented from accessing memory during a transition from any performance state to this performance state.
Control. Indicates the value to be written to the Performance Control Register (PERF_CTRL) in order to initiate a transition to the performance state.
Status. Indicates the value that OSPM will compare to a value read from the Performance Status Register (PERF_STATUS) to ensure that the transition to the performance state was successful. OSPM may always place the CPU in the lowest power state, but additional states are only available when indicated by the _PPC method.

So in our example CoreFreq is 0x1068 is 4200 or 4.2 GHz. It seems that Apple is ignoring the value for Power, though you can use the Power values from the motherboard's SSDT extract. I've found that TransitionLatency and BusMasterLatency are always 0x0A. Now for the final two values, 0x2A00 or 4200. In this case we ignore the two zeros and are only concerned with the two numbers. This is the value that will be displayed by MSRDumper. So when the system is running at 4.2 GHz MSRDumper will show the P-state as 42.

Ok now let's look at the next entry.

            Package (0x06)
            {
                0x1004,
                Zero,
                0x0A,
                0x0A,
                0x2900,
                0x2900
            },

So 0x1004 is 4100 or 4.1 GHz and 0x2900 translates to 41. Pretty simple. If you keep following down you will see that CoreFreq decrease by 0x64 or 100 for each state and Control and Status decrease by 1. The last entry will have a CoreFreq of 0x0640 and Control and Status will be 0x1000. This corresponds to 1600 or 1.6 GHz and 16, the minimum clock rate for a desktop Sandy Bridge CPU.

Now that that has been explained lets look at the next Scope.

Scope (\_PR.CPU1)
    {
        Method (APSS, 0, NotSerialized)
        {
            Return (\_PR.CPU0.APSS)
        }
    }

All this is showing is that instead of repeating what we did for the CPU0, we can have the SSDT return what was defined for CPU0. Alternately, you can define individual P-states for each processor, but it is a very time consuming process. The way I've described is much easier and less work.

Finally we can discuss what we need to change when modifying the SSDT. If you remove P-states you must decrease the value in Name (APSS, Package (0x1B) to reflect the number of states deleted. The MultiBeast i7 SSDT has a maximum clock of 3.9 GHz. The means the top entry will look like this:

        Name (APSS, Package (0x18)
        {
            Package (0x06)
            {
                0x0F3C,
                Zero,
                0x0A,
                0x0A,
                0x2700,
                0x2700
            },

So the Package count went down by 3 from Package (0x1B) to  Name (APSS, Package (0x18) and the first package shows the CoreFreq of 0x0F3C is 3900 or 3.9 GHz and Control and Status are now 0x2700 or 39.

Likewise if you want to add states, remember to add 0x64 to each CoreFreq and 1 to Control and Status and make sure that the value in Name (APSS, Package (0x18) corresponds to the total number of P-states defined.

Something everyone should be aware of is that there is a limit to the number of entries that AppleIntelCPUPowerManagement can handle. If you define more P-states then you can use, like using the Overclock SSDT on a non-overclocked system, you will lose P-states at the bottom of the table. When I used the MultiBeast Overclock SSDT which has a maximum clock of 4.2 GHz on a system that can reach a maximum of 3.8 GHz you will see the following from MSRDumper:

MSRDumper PStatesReached: 16 23 24 25 26 27 38

Versus using the MultiBeast i7 SSDT where you will see:

MSRDumper PStatesReached: 16 17 18 19 20 21 35 36 37 

You may say what's the big deal? Well it relates to power consumption. The lower the P-state (CPU frequency) the lower the power consumption. So by using the Overclocked SSDT my power consumption will be higher which will cost me money in the long run.

I hope you found this information helpful!

-MacMan

For discussions on this and other topics, register today at tonymacx86.com!

Monday, February 27, 2012

Chimera 1.8.0 Source

The Chimera 1.8.0 source is now available for downloading. Here is the link to the commit: http://forge.voodooprojects.org/p/chameleon/source/commit/1832/
    There is a standalone installer, available at tonymacx86.com/downloads. For bug reporting, feature requests, and general feedback please use the Chimera forum.

    -tonymacx86 & MacMan

    Related Posts:
    Chimera 1.8 Change Log
    Chimera 1.8 Update: OS X 10.8 Mountain Lion Support
    For discussions on this and other topics, register today at tonymacx86.com!

    Friday, February 24, 2012

    Chimera 1.8.0 Change Log

    Here are the details on specifically what I changed in Chimera 1.8.0.

    • Mountain Lion Boot Support:
    Based on cparm's patch.

    i386/boot2/boot.c
    Changed all (checkOSVersion("10.7") to ((checkOSVersion("10.7")) || (checkOSVersion("10.8")))

    i386/libsaio/bootstruct.c
    Changed:
    && (gMacOSVersion[2] == '.') && (gMacOSVersion[3] == '7'))

    To:
    && (gMacOSVersion[2] == '.') && ((gMacOSVersion[3] == '7') || (gMacOSVersion[3] == '8')))

    • Fixed showing boot volume detail:

    i386/boot2/gui.c
    Changed:
    shoWinfo = true

    To:
    shoWinfo = false

    • Trunk Commit: 1827 Xcode 4.3 compile fix:

    i386/util/fdisk/misc.c
    Changed:
    void
    putshort(p, l)
    void *p;
    u_int16_t l;

    To:
    putshort(
    void *p,
    u_int16_t l)

    • Added addtitional NVIDIA cards and fixed some card definitions using info from latest trunk, ErmaC branch and tonymacx86.com users:

    i386/libsaio/nvidia.c
    Added:
    { 0x10DE05E7, "Tesla C1060" },
    { 0x10DE061E, "Quadro FX 3700M" },
    { 0x10DE0621, "GeForce GT 230" },
    { 0x10DE062B, "GeForce 9800M GS" },
    { 0x10DE0655, "GeForce GT 120" },
    { 0x10DE06F1, "GeForce G105M" },
    { 0x10DE06FF, "HICx16 + Graphics" },
    { 0x10DE0840, "GeForce 8200M" },
    { 0x10DE0869, "GeForce 9400" },
    { 0x10DE08A0, "GeForce 320M" },
    { 0x10DE08A4, "GeForce 320M" },
    { 0x10DE0A26, "GeForce 405" },
    { 0x10DE0A27, "GeForce 405" },
    { 0x10DE0A38, "Quadro 400" },
    { 0x10DE0A76, "ION" },
    { 0x10DE0A7A, "GeForce 315M" },
    { 0x10DE0CA5, "GeForce GT 220" },
    { 0x10DE0CAC, "GeForce GT 220" },
    { 0x10DE1051, "GeForce GT 520MX" },
    { 0x10DE1084, "GeForce GTX 560" },
    { 0x10DE1087, "GeForce GTX 560 Ti 448 Cores" },
    { 0x10DE1089, "GeForce GTX 580" },
    { 0x10DE108B, "GeForce GTX 590" },
    { 0x10DE1091, "Tesla M2090" },
    { 0x10DE109B, "Quadro 7000" },
    { 0x10DE10C0, "GeForce 9300 GS" },
    { 0x10DE10D8, "NVS 300" },
    { 0x10DE1241, "GeForce GT 545" },
    { 0x10DE1243, "GeForce GT 545" },

    Changed:
    { 0x10DE0CAC, "GeForce 315" }, to { 0x10DE0CAC, "GeForce GT 220" },
    { 0x10DE0DF4, "GeForce GT 450M" }, to { 0x10DE0DF4, "GeForce GT 540M" },
    { 0x10DE109A, "N12E-Q5" }, to { 0x10DE109A, "Quadro 5010M" },

    • Added additional AMD/ATI Cards:

    i386/libsaio/ati.c
    Added from trunk, ErmaC and tonymacx86.com users:
    { 0x9440, 0x0851174B, CHIP_FAMILY_RV770, "ATI Radeon HD 4870", kMotmot },
    { 0x68BA, 0x31501682, CHIP_FAMILY_JUNIPER, "AMD Radeon HD 6770", kVervet },
    { 0x68BF, 0x31401682, CHIP_FAMILY_JUNIPER, "AMD Radeon HD 6750", kVervet },
    { 0x68C0, 0x395217AA, CHIP_FAMILY_REDWOOD, "ATI Mobility Radeon HD 5730", kNull },
    { 0x68C1, 0x02051025, CHIP_FAMILY_REDWOOD, "ATI Mobility Radeon HD 5750", kNull },
    { 0x68C1, 0x02961025, CHIP_FAMILY_REDWOOD, "ATI Mobility Radeon HD 5750", kNull },
    { 0x68C1, 0x030A1025, CHIP_FAMILY_REDWOOD, "ATI Mobility Radeon HD 5750", kNull },
    { 0x68C1, 0x033D1025, CHIP_FAMILY_REDWOOD, "ATI Mobility Radeon HD 5750", kNull },
    { 0x68C1, 0x03471025, CHIP_FAMILY_REDWOOD, "ATI Mobility Radeon HD 5750", kNull },
    { 0x68C1, 0x03561025, CHIP_FAMILY_REDWOOD, "ATI Mobility Radeon HD 5750", kNull },
    { 0x68C1, 0x03581025, CHIP_FAMILY_REDWOOD, "ATI Mobility Radeon HD 5750", kNull },
    { 0x68C1, 0x035A1025, CHIP_FAMILY_REDWOOD, "ATI Mobility Radeon HD 5750", kNull },
    { 0x68C1, 0x035C1025, CHIP_FAMILY_REDWOOD, "ATI Mobility Radeon HD 5750", kNull },
    { 0x68C1, 0x03641025, CHIP_FAMILY_REDWOOD, "ATI Mobility Radeon HD 5750", kNull },
    { 0x68C1, 0x03791025, CHIP_FAMILY_REDWOOD, "ATI Mobility Radeon HD 5750", kNull },
    { 0x68C1, 0x037E1025, CHIP_FAMILY_REDWOOD, "ATI Mobility Radeon HD 5750", kNull },
    { 0x68C1, 0x03821025, CHIP_FAMILY_REDWOOD, "ATI Mobility Radeon HD 5750", kNull },
    { 0x68E4, 0x1426103C, CHIP_FAMILY_CEDAR, "AMD Radeon HD 6370M ", kNull },
    { 0x68E4, 0x397917AA, CHIP_FAMILY_CEDAR, "AMD Radeon HD 6370M ", kNull },
    { 0x6719, 0x21FD1458, CHIP_FAMILY_CAYMAN, "AMD Radeon HD 6950", kGibba },
    { 0x6719, 0x186B174B, CHIP_FAMILY_CAYMAN, "AMD Radeon HD 6950", kNull },
    { 0x6720, 0x04901028, CHIP_FAMILY_BARTS, "AMD Radeon HD 6970M", kElodea },
    { 0x6739, 0x03B41043, CHIP_FAMILY_BARTS, "AMD Radeon HD 6850", kDuckweed },
    { 0x6740, 0x1631103C, CHIP_FAMILY_TURKS, "AMD FirePro M5950", kNull },
    { 0x6740, 0x3388103C, CHIP_FAMILY_TURKS, "AMD Radeon HD 6770M", kNull },
    { 0x6741, 0x1688103C, CHIP_FAMILY_TURKS, "AMD Radeon HD 7690M", kNull },
    { 0x6758, 0x00121028, CHIP_FAMILY_TURKS, "AMD Radeon HD 6670", kBulrushes },
    { 0x6759, 0x20121787, CHIP_FAMILY_TURKS, "AMD Radeon HD 6570", kPithecia },
    { 0x6760, 0x00031179, CHIP_FAMILY_CAICOS, "AMD Radeon HD 6450M", kNull },
    { 0x6779, 0xE180174B, CHIP_FAMILY_CAICOS, "AMD Radeon HD 6450", kPithecia },

    • Added the following missing AMD/ATI default card definitions:

    i386/libsaio/ati.c
    { 0x944A, 0x00000000, CHIP_FAMILY_RV770, "ATI Radeon HD 4800 Series", kMotmot },
    { 0x9480, 0x00000000, CHIP_FAMILY_RV730, "ATI Mobility Radeon HD 4650 Series", kGliff },
    { 0x9553, 0x00000000, CHIP_FAMILY_RV710, "ATI Radeon HD 4300/4500 Series", kShrike },
    { 0x9581, 0x00000000, CHIP_FAMILY_RV630, "ATI Radeon HD 3600 Series", kNull },
    { 0x9583, 0x00000000, CHIP_FAMILY_RV630, "ATI Radeon HD 3600 Series", kNull },
    { 0x9588, 0x00000000, CHIP_FAMILY_RV630, "ATI Radeon HD 2600 XT Series", kNull },
    { 0x9589, 0x00000000, CHIP_FAMILY_RV630, "ATI Radeon HD 3610 Series", kNull },
    { 0x9591, 0x00000000, CHIP_FAMILY_RV635, "ATI Radeon HD 3600 Series", kNull },
    { 0x68A1, 0x00000000, CHIP_FAMILY_CYPRESS, "ATI Mobility Radeon HD 5800 Series", kNomascus },
    { 0x68A8, 0x00000000, CHIP_FAMILY_CYPRESS, "AMD Radeon HD 6800M Series", kUakari },
    { 0x68BF, 0x00000000, CHIP_FAMILY_JUNIPER, "AMD Radeon HD 6700 Series", kVervet },
    { 0x68C0, 0x00000000, CHIP_FAMILY_REDWOOD, "AMD Radeon HD 6570M/5700 Series", kNull },
    { 0x68C1, 0x00000000, CHIP_FAMILY_REDWOOD, "AMD Radeon HD 6500M/5600/5700 Series", kNull },
    { 0x68E0, 0x00000000, CHIP_FAMILY_CEDAR, "ATI Mobility Radeon HD 5400 Series", kEulemur },
    { 0x68E1, 0x00000000, CHIP_FAMILY_CEDAR, "ATI Mobility Radeon HD 5400 Series", kEulemur },
    { 0x68E4, 0x00000000, CHIP_FAMILY_CEDAR, "ATI Radeon HD 6300M Series", kNull },
    { 0x6750, 0x00000000, CHIP_FAMILY_TURKS, "AMD Radeon HD 6600A Series", kNull },

    • Added the following missing AMD/ATI chip family:

    i386/libsaio/ati.c
    Added CHIP_FAMILY_RV790 to chip_family_t;
    Added "RV790" to chip_family_name[]

    • Made the following cosmetic changes for AMD/ATI cards:

    i386/libsaio/ati.c
    • Changed all vendor names in radeon_cards to ATI as that would be contrary to what Apple would report.
    • For any specific card configuration that contained a generic name using something like "ATI Radeon HD 4800 Series" changed it to the specific card name and removed "Series".
    • Added "Series" to any generic card configuration to signify it's a generic and not card specific.
    • Corrected a bunch of card names.
    There is a standalone installer, available at tonymacx86.com/downloads. For bug reporting, feature requests, and general feedback please use the Chimera forum.

    -MacMan tonymacx86  
    For discussions on this and other topics, register today at tonymacx86.com!

    Tuesday, December 13, 2011

    Chimera 1.7.0 Change Log

    Back ported the following Chameleon commits:
    • r1671 Updated credits
    • r1674 Improved Multi-drive boot support from dmazar.
    • r1710 Fix for kernel flags not being passed to kernel on RAID volumes.
    Added the following AMD GPUs:
    • 0x9440, 0x114A174B, CHIP_FAMILY_RV770, "Sapphire Radeon HD4870 Vapor-X", kCardinal
    • 0x954F, 0x20081787, CHIP_FAMILY_RV710, "ATI Radeon HD 4350", kNull
    • 0x6899, 0xE174174B, CHIP_FAMILY_CYPRESS, "ATI Radeon HD 5850", kUakari
    • 0x68A0, 0x043A1028, CHIP_FAMILY_CYPRESS, "ATI Mobility Radeon HD 5870", kNomascus
    • 0x68B8, 0x21F61458, CHIP_FAMILY_JUNIPER, "ATI Radeon HD 5770", kVervet
    • 0x68B8, 0x200A1787, CHIP_FAMILY_JUNIPER, "ATI Radeon HD 5770", kVervet
    • 0x68BE, 0x22881787, CHIP_FAMILY_JUNIPER, "ATI Radeon HD 5750", kVervet
    • 0x68F9, 0x010E1002, CHIP_FAMILY_CEDAR, "ATI Radeon HD 5450", kEulemur
    • 0x68F9, 0x03741043, CHIP_FAMILY_CEDAR, "ATI Radeon HD 5450", kEulemur
    • 0x68F9, 0x23401462, CHIP_FAMILY_CEDAR, "ATI Radeon HD 5450", kEulemur
    • 0x68F9, 0xE145174B, CHIP_FAMILY_CEDAR, "ATI Radeon HD 5450", kEulemur
    • 0x68F9, 0xE153174B, CHIP_FAMILY_CEDAR, "ATI Radeon HD 5450", kEulemur
    • 0x6719, 0x0B001002, CHIP_FAMILY_CAYMAN, "AMD Radeon HD 6950", kGibba
    • 0x6719, 0x20101787, CHIP_FAMILY_CAYMAN, "AMD Radeon HD 6950", kGibba
    • 0x6720, 0x04BA1028, CHIP_FAMILY_BARTS, "AMD Radeon HD 6970M", kElodea
    • 0x6738, 0x31071682, CHIP_FAMILY_BARTS, "AMD Radeon HD 6870", kDuckweed
    • 0x6738, 0x31081682, CHIP_FAMILY_BARTS, "AMD Radeon HD 6870", kDuckweed
    • 0x6738, 0x174B174B, CHIP_FAMILY_BARTS, "AMD Radeon HD 6870", kBulrushes
    • 0x6739, 0xAA881002, CHIP_FAMILY_BARTS, "AMD Radeon HD 6850", kDuckweed
    • 0x6740, 0x1D121043, CHIP_FAMILY_TURKS, "AMD Radeon HD 6730M", kNull
    • 0x6760, 0x165A103C, CHIP_FAMILY_CAICOS, "AMD Radeon HD 6470M", kNull
    • 0x6760, 0x167D103C, CHIP_FAMILY_CAICOS, "AMD Radeon HD 6470M", kNull
    • 0x68A0, 0x00000000, CHIP_FAMILY_CYPRESS, "ATI Radeon HD 5800M Series", kNomascus
    • 0x68BA, 0x00000000, CHIP_FAMILY_JUNIPER, "ATI Radeon HD 6770 Series", kVervet
    • 0x6719, 0x00000000, CHIP_FAMILY_CAYMAN, "AMD Radeon HD 6950 Series", kGibbas
    Added a change that should hopefully allow the ability to override kNull frame buffer definitions.

    Added the following NVIDIA GPUs:
    • 0x10DE06DF, "Tesla M2070-Q" 
    • 0x10DE0DCD, "GeForce GT 555M" 
    • 0x10DE0DCE, "GeForce GT 555M" 
    • 0x10DE0DD6, "GeForce GT 550M" 
    • 0x10DE0DDA, "Quadro 2000M" 
    • 0x10DE0DEC, "GeForce GT 525M" 
    • 0x10DE0DED, "GeForce GT 520M" 
    • 0x10DE0DF4, "GeForce GT 450M" 
    • 0x10DE0DF5, "GeForce GT 525M" 
    • 0x10DE0DF6, "GeForce GT 550M" 
    • 0x10DE0DF7, "GeForce GT 520M" 
    • 0x10DE0DFA, "Quadro 1000M" 
    • 0x10DE0E31, "GeForce GTX 485M" 
    • 0x10DE0E3A, "Quadro 3000M" 
    • 0x10DE0E3B, "Quadro 4000M" 
    • 0x10DE1054, "GeForce GT 410M" 
    • 0x10DE1057, "Quadro NVS 4200M" 
    • 0x10DE107F, "NVIDIA GF119-ES" 
    • 0x10DE10C5, "GeForce 405" 
    • 0x10DE1201, "GeForce GTX 560" 
    • 0x10DE1251, "GeForce GTX 560M"
    Added the following cards to the NVIDIA memory detection bug workaround:
    • GT 440 Device ID 0x0DE0 
    • GT 525M Device ID 0x0DEC
    There is a standalone installer, available at tonymacx86.com/downloads. For bug reporting, feature requests, and general feedback please use the Chimera forum.

    -MacMan tonymacx86  
    For discussions on this and other topics, register today at tonymacx86.com!