Solved MMC and SD Card Question

Hello again,

I have a question regarding the kernal loadable modules for MMC and SD Cards but before I get started let me tend to the formalities first:

uname -a

Code:
FreeBSD fisher.loga.us 11.2-RELEASE-p4 FreeBSD 11.2-RELEASE-p4 #0: Thu Sep 27 08:16:24 UTC 2018     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

Hardware: ThinkPad T480 i7-8550U

My laptop has a built-in SD Card Reader as indicated via the dmesg output:

Code:
da0 at umass-sim0 bus 0 scbus0 target 0 lun 0
da0: <Generic- SD/MMC 1.00> Removable Direct Access SPC-4 SCSI device
da0: Serial Number 20120501030900000
da0: 400.000MB/s transfers
da0: 30436MB (62333952 512 byte sectors)
da0: quirks=0x2<NO_6_BYTE>

In my /boot/loader.conf I enabled the following:

Code:
mmc_load="YES"
mmcsd_load="YES"
sdhci_load="YES"

After rebooting the laptop, I receive the following message:

Code:
module_register: cannot register mmc/mmcsd from kernel; already loaded from mmcsd.ko
Module mmc/mmcsd failed to register: 17

If I run kldstat on the command line I can see the module loaded:

Code:
8    1 0xffffffff827e8000 89f0     mmcsd.ko

Question 1: Are the mmc, mmcsd and sdhci kernal modules already compiled into the GENERIC KERNEL?

If I comment out the previous entries in my /boot/loader.conf, then reboot and run kldstat, the mmcsd.ko module is not present. However if I try to load the modules manually via kldload mmc I receive the following message:

Code:
module_register: cannot register mmc/mmcsd from kernel; already loaded from mmcsd.ko
Module mmc/mmcsd failed to register: 17

Question 2: Given the above should I leave the entries in my /boot/loader.conf enabled or should I remove them since they seemed to be loaded already?

I can access an SD Card in the reader in either situation, but are looking for some clarification.

Thanks in advance,

w5plt
 
Aragats,

Thanks for your reply. Here are the results of my findings:

With the following lines commented out in /boot/loader.conf:

Code:
#mmc_load="YES"
#mmcsd_load="YES"
#sdhci_load="YES"

One reboot later, then run kldstat -v | grep mmc yields the following results:

Code:
250 sdhci_pci/mmc
248 sdhci_acpi/mmc
196 mmc/mmcsd

This indicates the mmc, mmcsd and sdhci kernel modules are compiled into the GENERIC KERNEL.

With the following lines not commented out in /boot/loader.conf:

Code:
mmc_load="YES"
mmcsd_load="YES"
sdhci_load="YES"

One reboot later, then run kldstat -v | grep mmc yields the following results:

Code:
250 sdhci_pci/mmc
248 sdhci_acpi/mmc
8    1 0xffffffff827e8000 89f0    mmcsd.ko (/boot/kernel/mmcsd.ko)
10 mmc/mmcsd

This indicates it is attempting to load the mmc and mmcsd kernel modules again resulting in the message in dmesg

Code:
module_register: cannot register mmc/mmcsd from kernel; already loaded from mmcsd.ko
Module mmc/mmcsd failed to register: 17

Conclusion:

Using the kldstat -v cmd indicates the mmc, mmcsd, and sdhci kernel modules are compiled into GENERIC KERNEL and do not require entries into /boot/loader.conf

Thanks Aragats!
 
Back
Top