Jump to content
ApexDE

[SOLVED] JMicron SATA/IDE PCIe Card eSATA problem

43 posts in this topic

Recommended Posts

After hours of trying to make eSATA work with my new JMB363 PCIe Card i am frustrated. There seems to be no way to configure it to use pure AHCI, the card uses Legacy-IDE-AHCI on the eSATA ports. In pure AHCI Mode there should be two PCI Devices (one SATA, one IDE), mine is recognised as ONE device:

02:00.0 SATA controller: JMicron Technologies, Inc. JMicron 20360/20363 AHCI Controller (rev 03) (prog-if 01 [AHCI 1.0])
Subsystem: JMicron Technologies, Inc. JMicron 20360/20363 AHCI Controller
Flags: bus master, fast devsel, latency 0, IRQ 16
I/O ports at c000
I/O ports at c100
I/O ports at c200
I/O ports at c300
I/O ports at c400
Memory at f8000000 (32-bit, non-prefetchable)
Capabilities: [68] Power Management version 2
Capabilities: [50] Express Legacy Endpoint, MSI 01
Capabilities: [100] #197b
Capabilities: [236] #68

 

 

This way, SATA and IDE is mixed ;). There is no way to switch to AHCI in the Controller BIOS. Using the JMicronATA.kext Driver, connected SATA Devices are detected as IDE Drives!

 

 

Anyone knows if it is possible to make the card work in pure AHCI Mode? Otherwise pure SATA / eSATA Hotplug won't work :D

Share this post


Link to post
Share on other sites
Advertisement

For the Archives:

 

After many hours of reading and trying i got my JMicron JMB363 PCIe Card working as wanted. Some PCI Registers need to be set, so that the Card works in Dual Function Mode. One PCI Device has the SATA AHCI Function, the other one the Legacy IDE Function. This Dual Function Mode is needed to get AHCI working.

 

lspci:

02:00.0 SATA controller: JMicron Technologies, Inc. JMicron 20360/20363 AHCI Controller (rev 03)
02:00.1 IDE interface: JMicron Technologies, Inc. JMicron 20360/20363 AHCI Controller (rev 03)

 

You can archive that using the setpci command to write the PCI Registers of the Card:

 

sudo setpci -s 02:0.0 40.b=b3 41.b=a1 42.b=c2 (adapt 02:0.0 to your PCI Device number)

 

I also managed to built a DSDT Patch, which is needed cause you need to have the Card in Dual Function Mode on boot time so that the Apple AHCI Driver recognises the two eSATA Ports. If anyone wants the DSDT Patch, just post here, i subscribed this topic.

Share this post


Link to post
Share on other sites

Hi I have the same problem on my lappie:

06:00.0 IDE interface [0101]: JMicron Technologies, Inc. JMicron 20360/20363 AHCI Controller [197b:2360] (rev 02)

 

As you can see is set in legacy ide mode :|

I'd love to see that DSDT fix.

 

Thanks!

 

L.E. That command works! :ninja:

 

sudo setpci -s 06:0.0 40.b=b3 41.b=a1 42.b=c2 //in my case

And the result is:

06:00.0 SATA controller [0106]: JMicron Technologies, Inc. JMicron 20360/20363 AHCI Controller [197b:2360] (rev 02)

So it moved from legacy [0101] to AHCI [0106]

 

Wonder if I can do same thing for my desktop marvell {censored}(there i can set only legacy/raid in bios)

 

Waiting for DSDT fix :P

Share this post


Link to post
Share on other sites

OK. Check if you have a JMB Device in your DSDT (mine had, cause Gigabyte seems to use a generic DSDT for all Boards, some have the JMB363 onboard). I had to change "Device (\_SB.PCI0.PEX3.JMB0)" to "Device (\_SB.PCI0.PEX0.JMB0)" cause the PCIe Card is in PCIe Slot 0. Use IORegistryExplorer to look where your Card is. Then i adapted the entry to:

			Device (\_SB.PCI0.PEX0.JMB0)
		{
			Name (_ADR, 0x00)
			OperationRegion (BAR0, PCI_Config, 0x40, 0x04)
			Field (BAR0, WordAcc, NoLock, Preserve)
			{
			Offset (0x00),
			M1, 8,
			Offset (0x01),
			M2, 8,
			Offset (0x02),
			M3, 8
			}

			Method (_DSM, 4, NotSerialized)
			{
			Store (0xb3, M1)
			Store (0xa1, M2)
			Store (0xc2, M3)
			Return (0x00)
			}
....
....
....

 

 

I can now use the Controller with true SATA Hotplugging. Connecting a SATA Harddisk and turning it on results in showing on the Desktop just fine. After ejecting and turning it off, it also disappears from Harddiskutility.

Share this post


Link to post
Share on other sites

Thank you mate!

 

You made my day!

After DSDT fix:

06:00.0 SATA controller [0106]: JMicron Technologies, Inc. JMicron 20360/20363 AHCI Controller [197b:2360] (rev 02)

06:00.1 IDE interface [0101]: JMicron Technologies, Inc. JMicron 20360/20363 AHCI Controller [197b:2360] (rev 02)

 

One tip for those who used jmicronata.kext remove it! at least on me it cause panic.

For cosmetic stuff create a dummy.kext for it and add :

		<key>JMicron JMB360 AHCI</key>
	<dict>
		<key>CFBundleIdentifier</key>
		<string>com.apple.driver.AppleAHCIPort</string>
		<key>Chipset Name</key>
		<string>JMB360 eSATA AHCI</string>
		<key>IOClass</key>
		<string>AppleAHCI</string>
		<key>IOPCIClassMatch</key>
		<string>0x01060100&0xffffff00</string>
		<key>IOPCIPrimaryMatch</key>
		<string>0x2360197b</string>
		<key>IOProbeScore</key>
		<integer>800</integer>
		<key>IOProviderClass</key>
		<string>IOPCIDevice</string>
		<key>Vendor Name</key>
		<string>JMicron</string>
	</dict>

IOPCIClassMatch is very important w/o it again panic!

 

If you don't mind can you explain how did you find the info/fix?

I tried to set the same thing on my desktop marvell but seems to not work, so i need more info :)

 

Thanks again.

Share this post


Link to post
Share on other sites

I got the infos from the Linux Driver Sources (drivers/pci/quirks.c), maybe you can get the needed infos from the linux sources too (drivers/ata/ahci.c has some marvell entries)

Share this post


Link to post
Share on other sites

Great work ApexDE. I'd really like to be able to do this with my onboard JMB363 which seems fixed in IDE mode:

 

05:00.0 IDE interface [0101]: JMicron Technology Corp. 20360/20363 Serial ATA Controller [197b:2363] (rev 03)

 

Running sudo setpci -s 05:0.0 40.b=b3 41.b=a1 42.b=c2 works exactly as you suggest and we're now in ACHI mode:

 

05:00.0 SATA controller [0106]: JMicron Technology Corp. 20360/20363 Serial ATA Controller [197b:2363] (rev 03)

 

IORegistryExplorer tells me the controller is on P0P5

 

post-201695-1256758985_thumb.jpg

 

However I'm having trouble adapting your DSDT patch for my DSDT. There's already a (Device) JMB0 and (Device) JMB1 section, quite an extensive one, here as dsdtclip.txt

 

dsdtclip.txt

 

I've tried removing much of this and replacing it with something closer to the suggested patch, but I'm getting errors which I don't completely understand. I'm sure I'm doing something wrong. Thus far I have only limited experience in editing DSDT.

 

Any help anyone can offer in fixing my DSDT to allow the JMicron controller to work in AHCI mode will be very much appreciated.

 

Many Thanks

Share this post


Link to post
Share on other sites

@ the king

 

i guess there is no way to fix the marvell controller via dsdt patching :( it seems you need a special driver for os x.

 

@ papi

 

try to insert this at the start of the JMB0 Device entry:

				Device (JMB0)
			{
				Name (_ADR, Zero)
			OperationRegion (BAR0, PCI_Config, 0x40, 0x04)
			Field (BAR0, WordAcc, NoLock, Preserve)
			{
			Offset (0x00),
			M1, 8,
			Offset (0x01),
			M2, 8,
			Offset (0x02),
			M3, 8
			}

			Method (_DSM, 4, NotSerialized)
			{
			Store (0xb3, M1)
			Store (0xa1, M2)
			Store (0xc2, M3)
			Return (0x00)
			}

….
….

 

 

If you get errors, post the log

Share this post


Link to post
Share on other sites

Thanks very much ApexDE

 

What you very helpfully included was one of the possibilities I'd already tried as dsdtjmb.dsl.txt but unfortunately at least in my hands this produces lots of errors which I've included here: errors.txt

Much of these errors seem unrelated to the JMB0 additions though perhaps I've got a misplaced bracket somewhere. The "^ Use of compiler reserved name (_T_0)" warning existed before I made any changes and seems harmless.

 

I'm also including the full dsdt.dsl in case this is useful. The only changes I've made to it are removing CPU aliases, HPET and RTC fixes, and adding a HDEF device and DTGP method. Apart from the warning mentioned above this compiles ok. It would be terrific if you could pinpoint where I'm going wrong.

dsdt.dsl.txt

 

Thanks again for your help.

Share this post


Link to post
Share on other sites
Lets try two OperationRegion Definitions. Try if it works.

Brilliant! Thank you so much ApexDE. That works beautifully and I've now got my JMicron controller working perfectly in AHCI mode.

 

I would never have thought of duplicating the OperatorRegion definition but I've clearly got a lot to learn about dsdt editing.

 

Thank you very much indeed for your kind help.

Share this post


Link to post
Share on other sites

Hmm, unfortunately it seems I may have spoken too soon. :D

 

Any disk connected to the JMicron controller ports in AHCI/eSATA mode seems fine to begin with but gradually accumulates errors which fsck and other utilities cannot repair.

 

If I revert to IDE non-removable mode with the same disk(s) and cabling after removing the dsdt patch and replacing LegacyJmicronAHCI.kext with JMicronATA.kext, such errors no longer accumulate.

 

I suspect I may have to go back to IDE mode for stability. I hope my problem is an isolated one and therefore doesn't cause problems for other users adopting this innovative dsdt patch.

 

Best regards,

Share this post


Link to post
Share on other sites

What kind of errors you get?

Paste some log or something, does that with any disk?

 

L.E. I restored my working install on eSATA disk and booted from it, all works OK so far...

Share this post


Link to post
Share on other sites
What kind of errors you get?

Paste some log or something, does that with any disk?

from console.log

 

29/10/2009 23:39:01 kernel hfs_swap_HFSPlusBTInternalNode: unrecognized catalog record type (0x000A; record #6)

29/10/2009 23:39:01 kernel hfs: node=15502 fileID=4 volume=eSATA device=/dev/disk2s2

29/10/2009 23:39:01 kernel hfs: Runtime corruption detected on eSATA, fsck will be forced on next mount.

29/10/2009 23:39:01 kernel hfs: FindNextLeafNode: Error from hfs_swap_BTNode (node 15502)

29/10/2009 23:39:08 mdworker[316] (Error) SyncInfo: searchfs error (Result too large) -- falling back to fsw search /Volumes/eSATA

 

I've had unexplained hangs and slowness on two different disks connected to the JMicron controller in AHCI mode, but both disks work correctly when in IDE mode without the DSDT patch.

 

Turning on the eSATA/AHCI disk after boot and allowing it to automount seems to work better.

L.E. I restored my working install on eSATA disk and booted from it, all works OK so far...

I restored a bootable SuperDuper! disk image to an external disk connected to the JMicron controller in IDE mode and booted successfully from this. The same disk connected to the JMicron controller in AHCI mode would not boot and eventually hung with many disk I/O errors.

 

I'm glad your controller is working in AHCI mode without problems.

Share this post


Link to post
Share on other sites

It might be a problem with the eSATA Case too. I tried 3 different HDs with two different eSATA Cases, no errors here, anything works as expected. If you are using the eSATA Ports, make sure there is NO JMicron kext loaded. You don't need a JMicron kext unless you want to use the IDE Port or SATA Ports in IDE Mode

 

Try hooking up a SATA HD directly to the eSATA Port without any Bridge Chip inbetween. My IcyBox Combocase with eSATA Port is very bitchy too :) (sometimes HD is recognised, sometimes not). Best thing is to get a pure eSATA Case like this one IMHO: http://www.delock.com/produkte/gruppen/Geh...SATA_42406.html

Share this post


Link to post
Share on other sites

Try to cleanup the JMB0 section or remove both and make just one with the hacked registers, AHCI dosen't need all that code.

Look on mine, maybe that will help you:

				Device (EATA)
			{
				Name (_ADR, Zero)
				Name (_SUN, 0x06)
				OperationRegion (BAR0, PCI_Config, 0x40, 0x04)
				Field (BAR0, WordAcc, NoLock, Preserve)
				{
						Offset (0x00),
					M1, 8,
						Offset (0x01),
					M2, 8,
						Offset (0x02),
					M3, 8
				}

				Method (_DSM, 4, NotSerialized)
				{
					Store (0xb3, M1)
					Store (0xa1, M2)
					Store (0xc2, M3)
					Store (Package (0x02)
						{
							"name", 
							Buffer (0x16)
							{
								"J-Micron JMB360 eSATA"
							}
						}, Local0)
					DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
					Return (Local0)
				}
				OperationRegion (SATE, PCI_Config, Zero, 0xF0)
				Field (SATE, DWordAcc, NoLock, Preserve)
				{
							Offset (0x2C), 
					SA2C,   32, 
							Offset (0x43), 
					SA43,   8, 
							Offset (0xD3), 
					SAD3,   8
				}

				Method (_INI, 0, NotSerialized)
				{
				}

				Method (ESAT, 0, NotSerialized)
				{
					Notify (RP06, Zero)
					And (SAD3, 0x7F, SAD3)
					Or (SA43, 0x40, SA43)
					Store (0x13481043, SA2C)
					And (SA43, 0xBF, SA43)
				}

				Method (ESID, 0, NotSerialized)
				{
					Return (SA2C)
				}
			}

Share this post


Link to post
Share on other sites
It might be a problem with the eSATA Case too. I tried 3 different HDs with two different eSATA Cases, no errors here, anything works as expected. If you are using the eSATA Ports, make sure there is NO JMicron kext loaded. You don't need a JMicron kext unless you want to use the IDE Port or SATA Ports in IDE Mode

Thanks, yes, I should have explained better. The only JMicron kext I have loaded is a cosmetic "legacy" one which simply changes "Unknown AHCI Controller" as reported by the standard AppleAHCIPort.kext to "JMicron JMB36x AHCI Controller". Without this loaded the same problems exist.

Try hooking up a SATA HD directly to the eSATA Port without any Bridge Chip inbetween. My IcyBox Combocase with eSATA Port is very bitchy too :P (sometimes HD is recognised, sometimes not). Best thing is to get a pure eSATA Case like this one IMHO: http://www.delock.com/produkte/gruppen/Geh...SATA_42406.html

I'm using a pure eSATA case with no USB - the external eSATA connection goes straight to the drive backplane connector. This wasn't particularly expensive but I've had it working on Intel ICH10 and SiI 3132 without problems under Leopard.

 

Thanks again for your help.

 

Try to cleanup the JMB0 section or remove both and make just one with the hacked registers, AHCI dosen't need all that code.

Look on mine, maybe that will help you:

Thanks THe KiNG (and ApexDE too), that's very helpful. I will try adding something following your dsdt code example and report back.

 

Something I have noticed is that with drive(s) mounted on the JMicron controller, either in AHCI/eSATA or IDE mode, NCQ is reported as "No" or unsupported. I wasn't expecting this in AHCI mode.

Share this post


Link to post
Share on other sites

NCQ is working here. Try TheKings suggested changes and report back. You have loads of other changes in your JMB entry, maybe thats the cause of your problems.

Share this post


Link to post
Share on other sites
NCQ is working here. Try TheKings suggested changes and report back. You have loads of other changes in your JMB entry, maybe thats the cause of your problems.

Thank you ApexDE. I wish I had enough skill to do this properly. Unfortunately all my attempts to cut down my JMB0 and JMB1 device entries or even just to match my JMB0 device with the example given by THe KiNG just seem to produce lots of compilation errors and therefore no working dsdt.aml. Of course I'll keep trying, and continue my reading on ACPI and dsdt syntax, but really I think I'm rather out of my depth.

Removing almost anything from my existing and over-long Device (JMB0) entry seems to result in an error!

Thanks again.

Share this post


Link to post
Share on other sites

Now to complete this hack, how to disable the PATA port :P

 

Add a new device like in this example:

                Device (EPTA)
               {
                   Name (_ADR, One)
                   OperationRegion (BAR0, PCI_Config, 0x40, 0x04)
                   Field (BAR0, WordAcc, NoLock, Preserve)
                   {
                           Offset (0x00),
                       M1, 8,
                           Offset (0x01),
                       M2, 8,
                           Offset (0x02),
                       M3, 8
                   }

                   Method (_DSM, 4, NotSerialized)
                   {
                       Store (Zero, M1)
                       Store (Zero, M2)
                       Store (Zero, M3)
                       Return (Zero)
                   }
               }

Compile, reboot and then look on lspci/ioreg the PATA is gone! :)

 

@pharillion

Try to add this 2 device instead of yours:

                Device (EATA)
               {
                   Name (_ADR, Zero)
                   OperationRegion (BAR0, PCI_Config, 0x40, 0x04)
                   Field (BAR0, WordAcc, NoLock, Preserve)
                   {
                           Offset (0x00),
                       M1, 8,
                           Offset (0x01),
                       M2, 8,
                           Offset (0x02),
                       M3, 8
                   }

                   Method (_DSM, 4, NotSerialized)
                   {
                       Store (0xb3, M1)
                       Store (0xa1, M2)
                       Store (0xc2, M3)
                       Store (Package (0x02)
                           {
                               "name", 
                               Buffer (0x16)
                               {
                                   "J-Micron JMB36x eSATA"
                               }
                           }, Local0)
                       DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                       Return (Local0)
                   }
               }

               Device (EPTA)
               {
                   Name (_ADR, One)
                   OperationRegion (BAR0, PCI_Config, 0x40, 0x04)
                   Field (BAR0, WordAcc, NoLock, Preserve)
                   {
                           Offset (0x00),
                       M1, 8,
                           Offset (0x01),
                       M2, 8,
                           Offset (0x02),
                       M3, 8
                   }

                   Method (_DSM, 4, NotSerialized)
                   {
                       Store (Zero, M1)
                       Store (Zero, M2)
                       Store (Zero, M3)
                       Return (Zero)
                   }
               }

If you don't want the PATA to be disabled just remove the second device(with what is in brackets)

 

Thanks ApexDE for opening my eyes on this, now the hack is complete -_-

Share this post


Link to post
Share on other sites
Now to complete this hack, how to disable the PATA port :P

 

Add a new device like in this example:

                Device (EPTA)
               {
                   Name (_ADR, One)
                   OperationRegion (BAR0, PCI_Config, 0x40, 0x04)
                   Field (BAR0, WordAcc, NoLock, Preserve)
                   {
                           Offset (0x00),
                       M1, 8,
                           Offset (0x01),
                       M2, 8,
                           Offset (0x02),
                       M3, 8
                   }

                   Method (_DSM, 4, NotSerialized)
                   {
                       Store (Zero, M1)
                       Store (Zero, M2)
                       Store (Zero, M3)
                       Return (Zero)
                   }
               }

Compile, reboot and then look on lspci/ioreg the PATA is gone! B)

 

@pharillion

Try to add this 2 device instead of yours:

                Device (EATA)
               {
                   Name (_ADR, Zero)
                   OperationRegion (BAR0, PCI_Config, 0x40, 0x04)
                   Field (BAR0, WordAcc, NoLock, Preserve)
                   {
                           Offset (0x00),
                       M1, 8,
                           Offset (0x01),
                       M2, 8,
                           Offset (0x02),
                       M3, 8
                   }

                   Method (_DSM, 4, NotSerialized)
                   {
                       Store (0xb3, M1)
                       Store (0xa1, M2)
                       Store (0xc2, M3)
                       Store (Package (0x02)
                           {
                               "name", 
                               Buffer (0x16)
                               {
                                   "J-Micron JMB36x eSATA"
                               }
                           }, Local0)
                       DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                       Return (Local0)
                   }
               }

               Device (EPTA)
               {
                   Name (_ADR, One)
                   OperationRegion (BAR0, PCI_Config, 0x40, 0x04)
                   Field (BAR0, WordAcc, NoLock, Preserve)
                   {
                           Offset (0x00),
                       M1, 8,
                           Offset (0x01),
                       M2, 8,
                           Offset (0x02),
                       M3, 8
                   }

                   Method (_DSM, 4, NotSerialized)
                   {
                       Store (Zero, M1)
                       Store (Zero, M2)
                       Store (Zero, M3)
                       Return (Zero)
                   }
               }

If you don't want the PATA to be disabled just remove the second device(with what is in brackets)

 

Thanks ApexDE for opening my eyes on this, now the hack is complete :angel:

Hi THe KiNG...It's a personnal request, could you please upload your patched dsdt lappy (I think we've the same Asus M50sv), it much needed for SL. Thanks in advance. :rolleyes:

Share this post


Link to post
Share on other sites
Then wait for the new guide.

I cant post the actual one since is in beta stage, and has on it a lot of {censored}.

I don't post unfinished {censored} like some does...is not me.

@ THe KiNG, all the credits is yours if I succeeded in installing Mac OS X in my lappy. Be sure, I'm patiently waiting the new guide. With my regards. ;)

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

  • Recently Browsing   0 members

    No registered users viewing this page.

×