Page MenuHomeFreeBSD

Make MMCCAM work with sdhci_acpi
AbandonedPublic

Authored by kibab on Sep 22 2017, 3:08 PM.

Details

Reviewers
imp
Summary

Due to the missing call to sdhci_cam_start_slot() the system panics if booting with MMCCAM-enabled kernel.

Test Plan

Boot FreeBSD-CURRENT on Acer Aspire E11 with MMCCAM enabled.

Obtained from: Jakob Alvermark <jakob@alvermark.net>

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 11693
Build 12039: arc lint + arc unit

Event Timeline

Not sure I like another special case. Please consider this instead. It would also correctly detect this at compile time.

diff --git a/sys/dev/sdhci/fsl_sdhci.c b/sys/dev/sdhci/fsl_sdhci.c
index 08f5b94df83..633f39a0246 100644
--- a/sys/dev/sdhci/fsl_sdhci.c
+++ b/sys/dev/sdhci/fsl_sdhci.c
@@ -913,11 +913,7 @@ fsl_sdhci_attach(device_t dev)
        bus_generic_probe(dev);
        bus_generic_attach(dev);

-#ifdef MMCCAM
-       sdhci_cam_start_slot(&sc->slot);
-#else
        sdhci_start_slot(&sc->slot);
-#endif

        return (0);

diff --git a/sys/dev/sdhci/sdhci.c b/sys/dev/sdhci/sdhci.c
index 294f3f48e65..e3efc3332bf 100644
--- a/sys/dev/sdhci/sdhci.c
+++ b/sys/dev/sdhci/sdhci.c
@@ -1051,12 +1051,14 @@ no_tuning:
        return (0);
 }

+#ifndef MMCCAM
 void
 sdhci_start_slot(struct sdhci_slot *slot)
 {

        sdhci_card_task(slot, 0);
 }
+#endif

 int
 sdhci_cleanup_slot(struct sdhci_slot *slot)
@@ -2383,7 +2385,7 @@ sdhci_generic_write_ivar(device_t bus, device_t child, int which,

 #ifdef MMCCAM
 void
-sdhci_cam_start_slot(struct sdhci_slot *slot)
+sdhci_start_slot(struct sdhci_slot *slot)
 {
         if ((slot->devq = cam_simq_alloc(1)) == NULL) {
                 goto fail;
diff --git a/sys/dev/sdhci/sdhci.h b/sys/dev/sdhci/sdhci.h
index b11cabb8416..883655002ee 100644
--- a/sys/dev/sdhci/sdhci.h
+++ b/sys/dev/sdhci/sdhci.h
@@ -430,9 +430,4 @@ bool sdhci_generic_get_card_present(device_t brdev, struct sdhci_slot *slot);
 void sdhci_generic_set_uhs_timing(device_t brdev, struct sdhci_slot *slot);
 void sdhci_handle_card_present(struct sdhci_slot *slot, bool is_present);

-#ifdef MMCCAM
-/* CAM-related */
-void sdhci_cam_start_slot(struct sdhci_slot *slot);
-#endif
-
 #endif /* __SDHCI_H__ */
diff --git a/sys/dev/sdhci/sdhci_pci.c b/sys/dev/sdhci/sdhci_pci.c
index 1b568bee950..ebafee025b7 100644
--- a/sys/dev/sdhci/sdhci_pci.c
+++ b/sys/dev/sdhci/sdhci_pci.c
@@ -395,11 +395,7 @@ sdhci_pci_attach(device_t dev)
        pci_enable_busmaster(dev);
        /* Process cards detection. */
        for (i = 0; i < sc->num_slots; i++) {
-#ifdef MMCCAM
-               sdhci_cam_start_slot(&sc->slots[i]);
-#else
                sdhci_start_slot(&sc->slots[i]);
-#endif
        }

        return (0);
sys/dev/sdhci/sdhci_acpi.c
291

Wouldn't it be better to move this into sdhci.c and have the #ifdef there so the clients don't know or care?

Superceded by D12471 that provides more generic way of adding MMCCAM support to SDHCI drivers.