Added improvements for 0x525A and interrupt map#4
Added improvements for 0x525A and interrupt map#4syscl wants to merge 17 commits intophilmb3487:masterfrom
Conversation
This implemented the basic power management for PCI-E SD-Card through wake and sleep.
|
@syscl i tried to build the kext with your recent changes, i installed the kext but as soon as i plug in the SD Card, after like 5 sec the system crashes (Reboots instantly). Im running macOS High Sierra 10.13.3 My SD Card Reader is 10EC 5227 ; Lenovo Thinkpad L440. With previous kext from Sinetek, there was no power management but it worked as long as i didn't let laptop to sleep. If you need more details, let me know what kind of logs you need to see what's going on with it Thank you ! |
|
Thank you! Please provide logs with my maclog. Would you mind trying my latest prebuilt driver? Thank you in advance, |
|
@syscl forgive for this but im new to Github and im still not familiar, at your fork of Sinetek-rtsx there is no issues tab |
|
Sure @BesnikRrustemi , please post it here: https://github.com/syscl/Sinetek-rtsx/issues Click the I am looking in your log and will upload test drivers for you once you created a new issue tab. syscl |
…kernel panic when card insert
|
Thanks for your work trying to untangle this mess @syscl. As said the logic in my driver might be wrong, and this is not made better by the fact there are not really any publicly available datasheets. There is one blog in Chinese language with more information about what the various control register bits do, might be worthwhile looking at that, but I couldn't find a leaked datasheet either. The code is wrong..
This structure has to be a IOService, it will attach to a parent IOPCIDevice nub, instead of being an IOPCIDevice nub itself. If you change that, it should stop crashing so much during power management init and deinit. There's 2 ways to detect the card.. the first will fire off an interrupt, and then the second way would be to have a timer call itself and have a state machine ... waiting for card -> card inserted not init -> card inited, commands coming -> card removing -> etc etc. Another issue is that the IOKit model is single threaded, meaning that the interrupt will wait for the workloop to be released. This is problematic because when the code is waiting for an interrupt (a command has been sent to the microchip on the PCIe bus, then waiting for signal back), the Workloop lock is already being held by the driver (either the interrupt that gave us the signal to init the card, or the timer polling for a card being there). In BSD terms : tsleep() will put the thread to sleep waiting for a wakeup() Hope it helps. tsleep() is actually available and you can use it, it's just if doing that you'll have to capture the interrupt without going through the IOKit workloop stuff at all, and make damn sure your threads don't crash the machine. I think this is what I did in this version of the driver before I tried doing it in pure IOKit |
|
Thank you so much for you pointing out the inherence issue, I have then changed the rtsx_softc from One more step forward, the Anyway, I am really happy that the driver now will not cause panic when card get inserted, and the log when card insert is as follow And, please let me know if you still have the link about the control register bits in Chinese :) |
…o char * use const_static due to ISO C++11 does not allow conversion from string literal to 'char *'
|
@syscl I think you're close. I don't know if you're getting back valid information, but at least the chip doesn't time out like mine always did (Error 60 vs Error 0). I would look into rewriting |
|
@sinetek , after commit v19, I got log like this No more errors when I inserted sdcard, but the problem is now that system cannot detect the sdcard either (though I can see it in the log). Maybe I need to have a look into Another issue is that, when I added Anyway, this driver is pretty promising for me, because I am waiting for syscl |
|
Card Reader recognised, but no card mounted... this is getting spammed in the Console... default 02:23:15.891807 +1000 kernel rtsx: cmd 17 arg=0 data= dlen=512 flags=0x1c51 proc="" (error 60) Thanks for working on this... you will be a hero if this reaches fruition !! |
|
Unfortunately, there is nothing I can really do because my hardware is a bit faulty. (I get errors under strange conditions even under Linux) If I ever get another thinkpad with a realtek chip I will look into this again, until then I handed the project over to @syscl. |
No description provided.