Jump to content

[SOLVED] JMicron SATA/IDE PCIe Card eSATA problem


  • Please log in to reply
40 replies to this topic

#1
ApexDE

ApexDE

    InsanelyMac Geek

  • Members
  • PipPipPipPip
  • 217 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

#2
ApexDE

ApexDE

    InsanelyMac Geek

  • Members
  • PipPipPipPip
  • 217 posts
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.

#3
THe KiNG

THe KiNG

    InsanelyMac Legend

  • Gurus
  • 682 posts
  • Gender:Male
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:

[codebox]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)

[/codebox]
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

#4
ApexDE

ApexDE

    InsanelyMac Geek

  • Members
  • PipPipPipPip
  • 217 posts
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.

#5
THe KiNG

THe KiNG

    InsanelyMac Legend

  • Gurus
  • 682 posts
  • Gender:Male
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&amp;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.

#6
ApexDE

ApexDE

    InsanelyMac Geek

  • Members
  • PipPipPipPip
  • 217 posts
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)

#7
THe KiNG

THe KiNG

    InsanelyMac Legend

  • Gurus
  • 682 posts
  • Gender:Male
Something like this? http://marc.info/?l=...86924301674&w=2 and this : http://www.mail-arch...g/msg03281.html ?
To be honest I don't understand much...maybe you can explain in detail...

#8
pharillion

pharillion

    InsanelyMac Protégé

  • Members
  • Pip
  • 22 posts
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

Attached File  jmbioreg.jpg   85.63KB   400 downloads

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

Attached File  dsdtclip.txt   32.97KB   150 downloads

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

#9
ApexDE

ApexDE

    InsanelyMac Geek

  • Members
  • PipPipPipPip
  • 217 posts
@ 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

#10
pharillion

pharillion

    InsanelyMac Protégé

  • Members
  • Pip
  • 22 posts
Thanks very much ApexDE

What you very helpfully included was one of the possibilities I'd already tried as Attached File  dsdtjmb.dsl.txt   249.58KB   39 downloads but unfortunately at least in my hands this produces lots of errors which I've included here: Attached File  errors.txt   18.06KB   17 downloads
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.
Attached File  dsdt.dsl.txt   249.15KB   46 downloads

Thanks again for your help.

#11
ApexDE

ApexDE

    InsanelyMac Geek

  • Members
  • PipPipPipPip
  • 217 posts
Lets try two OperationRegion Definitions. Try if it works.

Attached Files



#12
pharillion

pharillion

    InsanelyMac Protégé

  • Members
  • Pip
  • 22 posts

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.

#13
pharillion

pharillion

    InsanelyMac Protégé

  • Members
  • Pip
  • 22 posts
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,

#14
THe KiNG

THe KiNG

    InsanelyMac Legend

  • Gurus
  • 682 posts
  • Gender:Male
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...

#15
pharillion

pharillion

    InsanelyMac Protégé

  • Members
  • Pip
  • 22 posts

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.

#16
ApexDE

ApexDE

    InsanelyMac Geek

  • Members
  • PipPipPipPip
  • 217 posts
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.co...SATA_42406.html

#17
THe KiNG

THe KiNG

    InsanelyMac Legend

  • Gurus
  • 682 posts
  • Gender:Male
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)
					}
				}


#18
ApexDE

ApexDE

    InsanelyMac Geek

  • Members
  • PipPipPipPip
  • 217 posts
@ the king

i just had this idea too :)

#19
pharillion

pharillion

    InsanelyMac Protégé

  • Members
  • Pip
  • 22 posts

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.co...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.

#20
ApexDE

ApexDE

    InsanelyMac Geek

  • Members
  • PipPipPipPip
  • 217 posts
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.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy