Jump to content
joe82

AppleSDXC driver/DSDT patch for O2 Micro SD card readers

Recommended Posts

My E7440 has an SD card reader. With some  relative minor patches, I was able to get the Apple AppleSDXC.kext driver to load and work. Here are the details.
 
The SD card reader in my E7440 uses an O2 micro part. Here is the lspci output:

03:00.0 SD Host controller: O2 Micro, Inc. Unknown device 8520 (rev 01)

The driver matches on IOName, which has a default value of pci14e4,16bc.
This needs to change. First I patched the binary driver AppleSDXC with the following perl script.

perl -pi -e 's|pci14e4,16bc|pci1217,8520|g' AppleSDXC

Next you need to modify the following section of Info.plist from:

<key>IONameMatch</key>
<array>
        <string>pci14e4,16bc</string>
</array>

to

<key>IONameMatch</key>
<array>
        <string>pci1217,8520</string>
        <string>pci14e4,16bc</string>
</array>

I added the correct value for the O2 Micro part: pci1217,8520. You most like only need to replace the old line with the new one, but I added it. Lastly I modified the RP05.PXSX device to match the Apple device SDXC. My modified PXSX function now looks like this:

Device (SDXC)
{
        Name (_ADR, Zero)  // _ADR: Address
        Method (_PRW, 0, NotSerialized)  // _PRW: Power Resources for Wake
        {
                Return (GPRW (0x69, 0x04))
        }
        Method (_RMV, 0, NotSerialized)
        {
                Return (0x00)
        }
}

I doubt this last step is necessary, but I like to match the Apple names when possible. After you make the changes, regenerate the cache and reboot.
 
I have tried this change with 10.9.1, 10.9.2, 10.9.3 and 10.9.4 and they all work. I have not had a chance to try 10.9.5, but it should work.
 
I will attach the modified files from 10.9.1 as a reference.
 
Joe

SDXC_10P9P1.tar.gz

  • Like 2

Share this post


Link to post
Share on other sites

I use this patch for E7440/E7240, no need to patch kext anymore

into device label PXSX parent_label RP05 insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
Store (Package (0x08)\n
    {\n
        "AAPL,slot-name",\n 
        "Built-in",\n
        "device_type",\n 
        Buffer (0x11)\n
        {\n
              "Media controller"\n
         },\n

         "model",\n 
        Buffer (0x18)\n
         {\n
             "O2 Micro SD card reader"\n
         },\n
                                
        "compatible",\n
         Buffer (0x0D)\n
        {\n
            "pci14e4,16bc"\n
        }\n
                            
     }, Local0)\n
    DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))\n
    Return (Local0)\n
}\n 
end;
  • Like 1

Share this post


Link to post
Share on other sites

This one works too

#Patch for O2Micro SD Card Reader
into device label PXSX parent_label RP05 insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
    If (LEqual (Arg2, Zero)) { Return (Buffer() { 0x03 } ) }\n
    Return (Package()\n
    {\n
        "AAPL,slot-name",\n
        "Built-in",\n
        "device-type", Buffer() { "Media Controller" },\n
        "model", Buffer() { "O2 Micro SD Card Reader" },\n
        "compatible", Buffer() { "pci14e4,16bc" },\n
    })\n
}\n
end;

Share this post


Link to post
Share on other sites

This patch applies to PCIe SD card readers only, not USB readers. It's known to work with several O2 Micro devices but may not work with all of them. It does not appear to work with non-O2 Micro devices (Ricoh or Realtek for instance).
 
To patch your DSDT, use the following process:
 
1) Using IORegistryExplorer, identify your DSDT device (pay good attention to displayed PCI vendor and device ids). The device will differ from one system to another.
2) Open up your DSDT with MacIASL
3) look for your SD card device identified in step #1 (for instance: device PXSX under RP05)
4) paste the following code under the _ADR and _PWR sections:

                   Method (_DSM, 4, NotSerialized)  // _DSM: Device-Specific Method
                   {
                        If (LEqual (Arg2, Zero))
                        {
                            Return (Buffer (One)
                            {
                                 0x03                                           
                            })
                        }
                        Return (Package ()
                        {
                            "AAPL,slot-name",                     // Optional
                            Buffer (0x09)                         // Optional
                            {                                     // Optional
                                "Built-in"                        // Optional
                            },                                    // Optional
                            "device_type",                        // Optional
                            Buffer (0x11)                         // Optional
                            {                                     // Optional
                                "Media Controller"                // Optional
                            },                                    // Optional
                            "model",                              // Optional
                            Buffer ()                             // Optional
                            {                                     // Optional
                                "<specify your model here>"       // Optional
                            },                                    // Optional
                            "compatible", 
                            Buffer (0x0D)
                            {
                                "pci14e4,16bc"
                            }
                        })
                    }

5) Recompile your DSDT and replace your initial table.
 
Below is an example for the Latitude E6230 (with original DSDT device "PXSX" renamed to "SDXC"):

 

               Device (SDXC)                    // Renamed from PXSX to SDXC as per Apple convention
               {
                    Name (_ADR, Zero)           // _ADR: Address
                    Name (_PRW, Package (0x02)  // _PRW: Power Resources for Wake
                    {
                        0x09, 
                        0x04
                    })
                    Method (_DSM, 4, NotSerialized)  // _DSM: Device-Specific Method
                    {
                        If (LEqual (Arg2, Zero))
                        {
                            Return (Buffer (One)
                            {
                                 0x03                                           
                            })
                        }

                        Return (Package (0x08)
                        {
                            "AAPL,slot-name", 
                            Buffer (0x09)
                            {
                                "Built-in"
                            }, 
                            "device_type", 
                            Buffer (0x11)
                            {
                                "Media Controller"
                            }, 
                            "model", 
                            Buffer (0x18)
                            {
                                "O2 Micro SD Card Reader"
                            }, 
                            "compatible", 
                            Buffer (0x0D)
                            {
                                "pci14e4,16bc"
                            }
                        })
                    }
                }

                Method (HPME, 0, Serialized)
                {
                    If (PMSX)
                    {
                        Store (0xC8, Local0)
                        While (Local0)
                        {
                            Store (One, PMSX)
                            If (PMSX)
                            {
                                Decrement (Local0)
                            }
                            Else
                            {
                                Store (Zero, Local0)
                            }
                        }
                        Notify (SDXC, 0x02)                    // PXSX renamed to SDXC
                    }
                }

                Method (_PRT, 0, NotSerialized)  // _PRT: PCI Routing Table
                {
                    If (PICM)
                    {
                        Return (AR09 ())
                    }
                    Return (PR09 ())
                }
          }

 

 

Share this post


Link to post
Share on other sites

O2 Micro SD card readers known to work with DSDT patch (non-exhaustive list):

  • 1217:8221 (fitted to Latitude E5x20/E6x20, E5x30/E6x30)
  • 1217:8231 (fitted to Latitude E5x20/E6x20, E5x30/E6x30)
  • 1217:8520 (fitted to Latitude E5x40/E6x40/E7x40, E5x50/E7x50, Precision M6800)

 

To be updated as info comes along.

Share this post


Link to post
Share on other sites

@Herve...

 

I need your help.

 

I have Dell 6320, I had patch dsdt to activate internal card reader, my system profile recognized, my o2 card reader, but when I inserting SDcard Kingston sdhc 8 gb, nothing happen/not show up/not mounting...did I missed something?...please take a look,my  dsdt and io reg

 

Regards

Andrew

Dell 6320_DSDT_IOREG.zip

Share this post


Link to post
Share on other sites

Your DSDT is properly patched and the card reader clearly visible in IOReg with AppleSDXC kext loaded. The issue lies elsewhere, probably with the card itself.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×