Bug 255130

Summary: Issue with rtsx driver
Product: Base System Reporter: Pol Dellaiera <d.paolino>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Open ---    
Severity: Affects Only Me CC: grahamperrin, hlh, jkim, lwhsu, techynotes, yuripv
Priority: --- Keywords: needs-patch, needs-qa
Version: 13.0-STABLEFlags: koobs: mfc-stable13?
Hardware: Any   
OS: Any   
Attachments:
Description Flags
/var/run/dmesg.boot
none
pciconf -lv
none
HP Dummy Plastic for SD Card Slot
none
SD Card used for testing
none
Error Message 01
none
Error Message 02
none
Tails-Boot with SD Card none

Description Pol Dellaiera 2021-04-16 17:53:39 UTC
Created attachment 224169 [details]
/var/run/dmesg.boot

Hi,

I upgraded from 12.2 to 13 this week and I'm having issue with RTSX.

My laptop takes around 4 minutes to boot and the same amount of time when it wakes up from sleep.

The error messages that I have in the log are:

rtsx0: Controller timeout for CMD8
rtsx0: Controller timeout for CMD8
rtsx0: Controller timeout for CMD8
rtsx0: Controller timeout for CMD8
rtsx0: Controller timeout for CMD55
rtsx0: Controller timeout for CMD55
rtsx0: Controller timeout for CMD55
rtsx0: Controller timeout for CMD55
rtsx0: Controller timeout for CMD1
rtsx0: Controller timeout for CMD1
rtsx0: Controller timeout for CMD1
rtsx0: Controller timeout for CMD1

It seems that it is related to the new RTSX driver.
Comment 1 Pol Dellaiera 2021-04-16 17:54:11 UTC
Created attachment 224170 [details]
pciconf -lv
Comment 2 Henri Hennebert 2021-04-17 14:22:54 UTC
What is the model of your computer?

When you boot, is an sd-card insered?
Comment 3 Pol Dellaiera 2021-04-17 14:29:52 UTC
My computer is an HP Elitebook 820 G1: https://support.hp.com/ie-en/document/c03955656

There is no sd-card slot on this model.
Comment 4 Henri Hennebert 2021-04-17 14:43:10 UTC
https://support.hp.com/ca-en/product/hp-elitebook-820-g1-notebook-pc/5405376/document/c03955674   	

On this picture, there is a smart card reader (19).

Anyway, can you add (see bug section of `man rtsx`):

dev.rtsx.0.inversion=1

in /boot/loader.conf or /boot/loader.conf.local

and reboot.
Comment 5 Pol Dellaiera 2021-04-17 14:49:02 UTC
Issue fixed, merci Henri, greetings from Nivelles!
Comment 6 Henri Hennebert 2021-04-17 14:50:36 UTC
Sorry for the previous comment about smart card (reader of bank/ID card).
It must be instead (4) on the right side view.

You are welcome.
Comment 7 Li-Wen Hsu freebsd_committer 2021-04-17 14:52:01 UTC
(In reply to Henri Hennebert from comment #4)
Maybe we can detect those specified models and automatically set dev.rtsx.0.inversion=1 for them?
Comment 8 Henri Hennebert 2021-04-17 14:58:42 UTC
I don't see how to do detect the model without dmidecode installed.

Or maybe a message in the driver after some timeout (say 8 successive timeouts)
a message about /boot/loader.conf. But I am not too sure this is a good solution.
Comment 9 Yuri Pankov freebsd_committer 2021-04-17 15:03:12 UTC
(In reply to Henri Hennebert from comment #8)
dmidecode isn't much help in kernel driver :)

Check kenv(1) output and use kern_getenv("smbios.system.product") and the like to get the information you need.
Comment 10 Henri Hennebert 2021-04-17 15:11:35 UTC
Pol Dellaiera,

can you run 

`kenv|grep smbios.system.family`

and show the output so I can have a first try to add a detection of this exception.

Thanks in advance

Henri
Comment 11 Pol Dellaiera 2021-04-17 15:44:32 UTC
Sure, here you go: 

smbios.system.family="103C_5336AN G=N L=BUS B=HP S=ELI"
Comment 12 Henri Hennebert 2021-04-17 15:49:17 UTC
(In reply to Henri Hennebert from comment #10)

Sorry, I make a mistake due to the output on my own system (Acer).

cat you run

`kenv|grep smbios.system`

Thanks
Comment 13 Henri Hennebert 2021-04-17 16:29:57 UTC
(In reply to Yuri Pankov from comment #9)
I add some code to test maker and product and it seems a good solution.
Thank you for your clue.
Henri
Comment 14 Pol Dellaiera 2021-04-17 17:15:20 UTC
Here you go:

smbios.system.family="103C_5336AN G=N L=BUS B=HP S=ELI"
smbios.system.maker="Hewlett-Packard"
smbios.system.product="HP EliteBook 820 G2"
smbios.system.serial="XXXXXXXXXX"
smbios.system.sku="F6N29AV"
smbios.system.uuid="XXXXXXXXXX"
smbios.system.version="A3009D510303"

I also notice that it's a G2 instead of a G1 !
Comment 15 Henri Hennebert 2021-04-19 11:32:52 UTC
(In reply to Pol Dellaiera from comment #14)

Thank you for your information!

I push version 2.0d on https://github.com/hlh-restart/rtsx

If you have some time to spare, can you test this version.

If you are running __FreeBSD_version > 1300000 with rtsx in the kernel config (eg GENERIC):

  mkdir /tmp/rtsx
  git clone -b master https://github.com/hlh-restart/rtsx /tmp/rtsx
  cp /tmp/rtsx/rtsx.c /usr/src/sys/dev/rtsx/
  rebuild and install kernel and reboot
  check `dmesg|grep rtsx`

If you are using rtsx as a module (kldstat|grep rtsx):

  mkdir /tmp/rtsx
  git clone -b master https://github.com/hlh-restart/rtsx /tmp/rtsx
  cd /tmp/rtsx
  make depend
  make
  make install
  rm /boot/kernel/rtsx.ko
  kldunload rtsx
  kldload rtsx
  dmesg | tail

If the inversion is created, you can remove 'dev.rtsx.0.inbersion=1' from loader.conf(5).

Please send me the rtsx messages.

Thank you for your time!

Henri
Comment 16 Sriram Narayanan 2021-04-24 17:56:43 UTC
Hi,

I have a similar problem in my HP Elitebook 840 G3 with freeBSD 13.0-RELEASE; over 5 minutes wait for the boot sequence to complete with similar error as follows:

rtsx0: Controller timeout for CMD8
rtsx0: Controller timeout for CMD8
rtsx0: Controller timeout for CMD8
rtsx0: Controller timeout for CMD8
rtsx0: Controller timeout for CMD55
rtsx0: Controller timeout for CMD55
rtsx0: Controller timeout for CMD55
rtsx0: Controller timeout for CMD55
rtsx0: Controller timeout for CMD1
rtsx0: Controller timeout for CMD1
rtsx0: Controller timeout for CMD1
rtsx0: Controller timeout for CMD1

Here is the output from "kenv | grep smbios.system"

smbios.system.family="103C_5336AN HP EliteBook"
smbios.system.maker="HP"
smbios.system.product="HP EliteBook 840 G3"
smbios.system.serial="5CG8054JQC"
smbios.system.sku="L3C67AV"
smbios.system.uuid="7579e113-099f-11e8-ac27-1520e40200f3"
smbios.system.version=" "

Tried the following options:

Option 1: I tried the option "dev.rtsx.0.inversion=1" in loader.conf, did not work.

Option 2: I downloaded the source from the mentopned mentioned GITHUB link and followed the procedure to rebuild the kernel only for this module 'rtsx'. I included the following line in /etc/make.conf
MODULES_OVERRIDE = rtsx, then built the kernel 
cd /usr/src
make buildkernel KERNCONF=GENERIC
make installkernel KERNCONF=GENERIC

The rebuilt kernel did not work and booted only to "mountroot>". Hence, reverted to the original kernel. I have never built any kernel before ever. This will be the start I guess! :)

This error was not present in 12.1; I have not upgraded to 13.0 instead did a fresh install on my laptop and I am stuck here.

Should you need more information, do not hesitate to ask.
Would apperciate if you could suggest / point me for a solution.

Thanks.
Comment 17 Henri Hennebert 2021-04-25 07:14:49 UTC
(In reply to Sriram Narayanan from comment #16)

Sorry for this late answer...

Can you show the output of

sysctl dev.rtsx
Comment 18 Henri Hennebert 2021-04-25 08:02:32 UTC
(In reply to Sriram Narayanan from comment #16)

About the boot to "mountroot>"

This is normal, you ask to rebuild the kernel and only the rtsx module.

After installkernel, /boot/kernel contain only the kernel and the rtsx module.
If you boot from a zpool, there is no zfs module and so the mountroot prompt.
Comment 19 Sriram Narayanan 2021-04-25 09:48:33 UTC
(In reply to Henri Hennebert from comment #17)
Hi

Here you go the output of doas sysctl dev.rtsx

dev.rtsx.0.wake: 0
dev.rtsx.0.write_count: 0
dev.rtsx.0.read_count: 0
dev.rtsx.0.debug: 0
dev.rtsx.0.force_timing: 0
dev.rtsx.0.inversion: 0
dev.rtsx.0.read_only: 0
dev.rtsx.0.req_timeout: 10
dev.rtsx.0.%parent: pci1
dev.rtsx.0.%pnpinfo: vendor=0x10ec device=0x522a subvendor=0x103c subdevice=0x8079 class=0xff0000
dev.rtsx.0.%location: slot=0 function=0 dbsf=pci0:1:0:0 handle=\_SB_.PCI0.RP02.PXSX
dev.rtsx.0.%driver: rtsx
dev.rtsx.0.%desc: 2.0d Realtek RTS522A PCI MMC/SD Card Reader
dev.rtsx.%parent: 

Also, follow the link on the hw-probe report of this machine:
https://bsd-hardware.info/?probe=2b97986de1
Comment 20 Sriram Narayanan 2021-04-25 09:50:35 UTC
(In reply to Henri Hennebert from comment #18)
Ok, learning! My first Kernel build.

Subsequently, I removed the lines from make.conf and built's the full kernel and it booted well. Though, the rtsx problem remained as in GENERIC kernel.
Comment 21 Sriram Narayanan 2021-04-25 09:52:13 UTC
(In reply to Sriram Narayanan from comment #19)
The NO CARD is present while booting.
Comment 22 Henri Hennebert 2021-04-25 09:58:25 UTC
(In reply to Sriram Narayanan from comment #19)

dev.rtsx.0.inversion: 0

show that the

dev.rtsx.0.inversion=1 in /boot/loader.conf or /boot/loader.conf.local
was not properly set.

After this update to loader.conf(5) you must reboot.
Comment 23 Henri Hennebert 2021-04-25 10:14:39 UTC
I push version 2.0e for "HP EliteBook 840 G3"

https://github.com/hlh-restart/rtsx
Comment 24 Sriram Narayanan 2021-04-25 11:12:26 UTC
(In reply to Henri Hennebert from comment #23)
Ok, I have updated the source from GIT and have rebuilt the Kernel. Have removed the entry from /boot/loader.conf of "dev.rtsx.0.inversion=1".

Installed the new Kernel, after reboot it works fine no rtsx0 timeout error any more.

Thank you for your support.
Comment 25 Henri Hennebert 2021-04-25 11:21:18 UTC
(In reply to Sriram Narayanan from comment #24)

You are welcome!

Can you send me the output of the driver after boot:

dmesg | grep rtsx

And if possible test some I/O un a SD card...

Thanks

PS. Take care if you update the kernel to put back the 2.0e version in place.

I will try to push the update to the FreeBSD source but it may take some time and
will take more time to land in stable/13.0

I find it really strange that dev.rtsx.0.inversion=1 don't work in loader.conf
Comment 26 Sriram Narayanan 2021-04-25 11:27:19 UTC
(In reply to Henri Hennebert from comment #25)

Here is the output from dmesg on rtsx as requested:

doas dmesg | grep rtsx
rtsx0: <2.0e Realtek RTS522A PCI MMC/SD Card Reader> mem 0xe1000000-0xe1000fff at device 0.0 on pci1
rtsx0: Inversion activated for HP/103C_5336AN HP EliteBook/HP EliteBook 840 G3, see BUG in rtsx(4)
rtsx0: If a card is detected without an SD card present, add dev.rtsx.0.inversion=0 in loader.conf(5)
rtsx0: Card absent
rtsx0: <2.0e Realtek RTS522A PCI MMC/SD Card Reader> mem 0xe1000000-0xe1000fff at device 0.0 on pci1
rtsx0: Inversion activated for HP/103C_5336AN HP EliteBook/HP EliteBook 840 G3, see BUG in rtsx(4)
rtsx0: If a card is detected without an SD card present, add dev.rtsx.0.inversion=0 in loader.conf(5)
rtsx0: Card absent

Yes, I have put the new source you had updated on GIT and will keep a TAB until it lands in 13.0 Stable. Would appreciate if you could update the promotion to STABLE here, so that I will know about the same.

As regards with SD Card I/O, give me sometime, I am in midst of something, will send update shortly. What kind of output on the I/0 testing you want, anything specific or just to know that it works...?
Comment 27 Yuri Pankov freebsd_committer 2021-04-25 11:29:55 UTC
(In reply to Henri Hennebert from comment #25)
If it's per-device-instance tunable, try specifying 'hint.rtsx.0.inversion=1' on loader prompt (with 'set') or in /boot/device.hints.
Comment 28 Henri Hennebert 2021-04-25 11:33:45 UTC
(In reply to Sriram Narayanan from comment #26)

To test the IO something like (depending on the card size):

dd if=/dev/random of=/tmp/random0 bs=32768 count=262144
dd if=/tmp/random0 of=/dev/mmcsd0 bs=32768
dd if=/dev/mmcsd0 of=/tmp/random1 bs=8192
md5 /tmp/random0 /tmp/random1

Would be nice.
Comment 29 Yuri Pankov freebsd_committer 2021-04-25 11:40:53 UTC
(In reply to Yuri Pankov from comment #27)
Actually, that's wrong, please ignore :)
Comment 30 Sriram Narayanan 2021-04-25 12:32:03 UTC
Created attachment 224417 [details]
HP Dummy Plastic for SD Card Slot
Comment 31 Sriram Narayanan 2021-04-25 12:32:53 UTC
Created attachment 224418 [details]
SD Card used for testing
Comment 32 Sriram Narayanan 2021-04-25 12:33:23 UTC
Created attachment 224419 [details]
Error Message 01
Comment 33 Sriram Narayanan 2021-04-25 12:34:51 UTC
Created attachment 224420 [details]
Error Message 02
Comment 34 Sriram Narayanan 2021-04-25 12:35:41 UTC
(In reply to Henri Hennebert from comment #28)

Ok, i did the following:

Strange issue.

Step 1:
I remove the dummy plastic from the SD Card Slot. See attached Image. (DummySDPlastic.png)

Step 2:
I rebooted and notcied that the rtsx timeout error has returned!

Step 3:
I inserted the dummy plastic and rebooted, the machine booted without rtsx timeout errors.

Step 4a:
Removed the dummy plastic and inserted the SD Card. See atatched file (SDCard.png)
Step 4b:
Following error was displayed. (See attached screenshot from Laptop Screen LP-Error01.png)

Step 5:
Removed the inserted SD Card; the following timeout error was displayed (LP-Error02.jpeg) mentioning No compatible cards found in bus.

Your thoughts please...
Comment 35 Henri Hennebert 2021-04-25 16:29:39 UTC
(In reply to Sriram Narayanan from comment #34)
Sorry to come back late, I was with a old fried of mine.

I think that the HP hardware is sold with an adapter for micro SD. The adapter is detected as a card but without memory. This produce the timeout. (I test on my ACER and encounter the same problem).

This symptom were the same occuring on Lenovo and so I believe, wrongly, that the inversion was needed.

But you must have a "normal" RTS522A and don't need inversion.

If you use the official version 2.0c and boot without the adapter inserted all will be OK and then you can insert your card and have a test.

Sorry for this but I was not aware of this problem with an empty adapter.

BTW Pol Dellaiera may be in the same case of HP sold with an empty adapter.
Comment 36 Sriram Narayanan 2021-04-25 17:10:37 UTC
(In reply to Henri Hennebert from comment #35)

Ok; however the HP provided plastic is not an ADAPTOR as assumed by you. It is just a plastic piece used as a cover when SD Card Slot is not used. The plastic piece does not have any GOLDEN-Leads as in the case of an SD Card adaptor. It is just a cover to avoid dust getting in when not in use. The plastic is moulded in a shape to cover the SD slot as well as to adapt to the shape of the Laptop bottom cover.

Case 1:
In normal circumstance, the HP plastic cover will be plugged in always. Hence, during boot it should not throw any error.

Case 2:
When SD Card slot is required to be used, then the HP plastic cover will be removed. No error should occur in this stage as well.

Case 3: (following Case 2)
The SD Card adaptor along with the Micro SD card (OR) SD Card will be inserted. It should get mounted automatically. No Error should occur.

Case 4:
After using the SD Card or Micro SD Card (as the case maybe) the Card will be unmounted and removed. No Error should occur.

Case 5: (following Case 4)
The HP plastic cover will be reinserted to protect the slot from dust when not in use. No Error should occur.

Given, the above scenarios, let me know your throughts as to which Kernel should be used or rather the modified rtsx.c or the original one with freebsd 13.0 Stable Release.

The above mentioned Test Case are the Normal course of action when using the SD Card slot in my opinion.

If you differ or think otherwise on the Test CASEs mentioned above; please eloborate.

I will test and revert after your reply.
Comment 37 Henri Hennebert 2021-04-25 18:48:17 UTC
(In reply to Sriram Narayanan from comment #36)

I agree with your scenario but I don't see, for now, a solution in the driver.

Just to know how Linux work on this configuration, can you download:

https://tails.boum.org/

I know this usb stick has the linux rtsx driver (at least in previuos version)

Does it work in your scenario?

Thank you!
Comment 38 Sriram Narayanan 2021-04-25 19:42:52 UTC
(In reply to Henri Hennebert from comment #37)

Ok, understand that.

I am downloading the Tails amd64 4.18.img now, will boot and update you.
Comment 39 Sriram Narayanan 2021-04-25 20:23:51 UTC
Created attachment 224430 [details]
Tails-Boot with SD Card

Booted on Tails as suggested.

Steps: 
1. Inserted the HP Plastic Dust Cover inserted to the SD Card Slot
2. Booted with Tails on USB Driver
3. No Boot Errors noticed
4. Removed the HP Plastic dust cover from the SD Card Slot
5. Inserted SD Card Adaptor with Micro SD Card
6. It was auto mounted without any Errors
7. Created two folder in the SD Card
8. Screen Shot taken on my Phone from HP Machine with Tails booted
9. Ejected the Card, no Errors
10. Again Inserted the HP Plastic dust cover to the SD Card Slot
11. No Errors what so ever....
12. Inserted the Card in my MacBook, was auto mounted with errors and were able to access the folders
13. Screen Shot taken on my Phone from MacBook
14. Both images combined to one and have attached....
Comment 40 Henri Hennebert 2021-04-26 13:21:59 UTC
(In reply to Sriram Narayanan from comment #39)

Hello,

I publish an new version (2.0f) on GitHub.

I lower the timeout to 1 seconds for the setup commands (CMD8/CMD55/CMD1/...)
to reduce the nuisance at boot (+/- 15 second if dust cover inserted)

Can you then test some IO on a SD card.

Thanks
Comment 41 Sriram Narayanan 2021-04-26 17:51:39 UTC
(In reply to Henri Hennebert from comment #40)

Hi

As requested I have rebuilt the Kernel with rtsx.c version 2.0f.
Following are the results:

Refer Comment(#35) for Test Cases
The Boot process is close to NORMAL
Case 1: It shows the timeout error but as you have modified, just for 1 sec and boots normally.
Case 2: When plastic cover is removed; in the terminal it is displayed as card removed.
Case 3: When the SD Card Adaptor with Micro Sd Card is inserted; it is displayed card inserted/found/mountable.
Case 4: I ran your "dd" I/O tests results below. When the SD Card Adaptor is removed; it is displayed as card removed/absent.
Case 5: When plastic cover is reinserted; it is displaed as Card Present and the 1 sec timeout starts.

Here are the test results from the "dd" I/O:

Note: Tests were run as root user from SSH connected from Macbook to HP 840 G3 Laptop.

dd if=/dev/random of=/tmp/random0 bs=32768 count=262144
262144+0 records in
262144+0 records out
8589934592 bytes transferred in 28.754103 secs (298737701 bytes/sec)

dd if=/tmp/random0 of=/dev/mmcsd0 bs=32768
262144+0 records in
262144+0 records out
8589934592 bytes transferred in 962.844957 secs (8921410 bytes/sec)

dd if=/dev/mmcsd0 of=/tmp/random1 bs=8192
3772992+0 records in
3772992+0 records out
30908350464 bytes transferred in 2576.025591 secs (11998464 bytes/sec)

md5 /tmp/random0 /tmp/random1
MD5 (/tmp/random0) = 05fd7861fd15e6bc2fffea5ebe7e2675
MD5 (/tmp/random1) = ab827ad77c67ce1f04b02f9ee9534be8

Are above the expected results? The MD5 looks different though, I am not sure, your are the best judge to throw light on these. Let me know if you need any further support from my end.

I still feel there could be a way to learn if the inserted item to the SD card slot is a real SD Adaptor or Card as against a dummy plastic. Maybe some value would be set in some flag or something, Just a wild guess (I am not a systems/low level programmer). If this is possible, then the timeouts could be totally avoided on all devs pertaining to these. More clean this way. 

THANK YOU for this 2.0f change.

BTW, can you tell me how to update src (Source) to the latest stable from Git/SVN. I opted to install the Source during installation. As when you update the stable I like to have the latest source. Now, I am switching to GENERIC kernel. I wish to stay with GENERIC as I have not reached the stage of wanting a CUSTOM kernel. Though, I would like to eliminate all that is not required for HP 840 G3 from the kernel. But, first need to find and make a list of items not required, do you know or can you point me to links on how to achieve this?

Thank you again!
Comment 42 Henri Hennebert 2021-04-26 19:13:54 UTC
(In reply to Sriram Narayanan from comment #41)

Thank you for this good news.
for the md5 I forget to set the right count= (shame on me!)

I think that Linux simply don't display error.

I have read and reread Linux sources and can't find something about a plastic insert case.

For stable/13.0 just be really patient. I will ping you when it is done.

For the source you can do this (with git from ports):

With an empty /usr/src:

git clone -o freebsd -b stable/13 https://git.freebsd.org/src.git /usr/src

for an update later:

cd /usr/src
git pull --ff-only

You can make an easy special kernel like this file:

/usr/src/sys/amd64/conf/LOCALGENERIC:

include GENERIC
ident LOCALGENERIC
nodevice rtsx

put in /etc/make.conf

KERNCONF?=LOCALGENERIC

and use the rtsx module by adding in /boot/loader.conf

rtsx_load="YES"

This is more versatile in case of problem: you can kldunload rtsx / kldload rtsx.

For building a specific kernel,

copy GENERIC to MYKERNEL

replace GENERIC by MYKERNEL in the ident entry,

and delete devices that are not detected during boot (dmesg).

It is a try and error method that I use but it is not necessary the best one ;-)

Thank you for your time!

Henri
Comment 43 Sriram Narayanan 2021-04-30 14:31:59 UTC
Hi Henri

Sorry for the delayed reply was held up hence he delayed reply.

Will try out the suggestions mentioned.

Thanks for your support.

Cheers, Sriram
Comment 44 Henri Hennebert 2021-05-28 11:19:42 UTC
See https://reviews.freebsd.org/D30499
Comment 45 commit-hook freebsd_committer 2021-09-09 18:27:04 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=9d3bc163825415f900d06d62efdf02caaad2d51d

commit 9d3bc163825415f900d06d62efdf02caaad2d51d
Author:     Henri Hennebert <hlh@restart.be>
AuthorDate: 2021-09-09 17:33:51 +0000
Commit:     Jung-uk Kim <jkim@FreeBSD.org>
CommitDate: 2021-09-09 18:26:17 +0000

    rtsx: Call taskqueue sooner, adjust DELAY(9) calls, add an inversion heuristic

    - Some configurations, e.g. HP EliteBook 840 G3, come with a dummy card
    in the card slot which is detected as a valid SD card.  This added long
    timeout at boot time.  To alleviate the problem, the default timeout is
    reduced to one second during the setup phase. [1]

    - Some configurations crash at boot if rtsx(4) is defined in the kernel
    config.  At boot time, without a card inserted, the driver found that
    a card is present and just after that a "spontaneous" interrupt is
    generated showing that no card is present.  To solve this problem,
    DELAY(9) is set to one quarter of a second before checking card presence
    during driver attach.

    - As advised by adrian, taskqueue and DMA are set up sooner during
    the driver attach.  A heuristic to try to detect configuration needing
    inversion was added.

    PR:             255130 [1]
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D30499

 share/man/man4/rtsx.4 |  13 +++--
 sys/dev/rtsx/rtsx.c   | 132 ++++++++++++++++++++++++++++++++++----------------
 2 files changed, 99 insertions(+), 46 deletions(-)
Comment 46 commit-hook freebsd_committer 2021-09-16 13:51:32 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=277a326b1e3f8cf23af529e075e157c7a2cc67e4

commit 277a326b1e3f8cf23af529e075e157c7a2cc67e4
Author:     Henri Hennebert <hlh@restart.be>
AuthorDate: 2021-09-09 17:33:51 +0000
Commit:     Jung-uk Kim <jkim@FreeBSD.org>
CommitDate: 2021-09-16 13:49:21 +0000

    rtsx: Call taskqueue sooner, adjust DELAY(9) calls, add an inversion heuristic

    - Some configurations, e.g. HP EliteBook 840 G3, come with a dummy card
    in the card slot which is detected as a valid SD card.  This added long
    timeout at boot time.  To alleviate the problem, the default timeout is
    reduced to one second during the setup phase. [1]

    - Some configurations crash at boot if rtsx(4) is defined in the kernel
    config.  At boot time, without a card inserted, the driver found that
    a card is present and just after that a "spontaneous" interrupt is
    generated showing that no card is present.  To solve this problem,
    DELAY(9) is set to one quarter of a second before checking card presence
    during driver attach.

    - As advised by adrian, taskqueue and DMA are set up sooner during
    the driver attach.  A heuristic to try to detect configuration needing
    inversion was added.

    PR:             255130 [1]
    Differential Revision:  https://reviews.freebsd.org/D30499

    (cherry picked from commit 9d3bc163825415f900d06d62efdf02caaad2d51d)

 share/man/man4/rtsx.4 |  13 +++--
 sys/dev/rtsx/rtsx.c   | 132 ++++++++++++++++++++++++++++++++++----------------
 2 files changed, 99 insertions(+), 46 deletions(-)