Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F111917579
D15955.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D15955.diff
View Options
Index: sys/arm/allwinner/aw_mmc.c
===================================================================
--- sys/arm/allwinner/aw_mmc.c
+++ sys/arm/allwinner/aw_mmc.c
@@ -552,6 +552,8 @@
}
mtx_unlock(&sc->sim_mtx);
+ /* Force rescan */
+ mmccam_start_discovery(sc->sim);
#else /* !MMCCAM */
child = device_add_child(dev, "mmc", -1);
if (child == NULL) {
Index: sys/cam/mmc/mmc_all.h
===================================================================
--- sys/cam/mmc/mmc_all.h
+++ sys/cam/mmc/mmc_all.h
@@ -64,9 +64,11 @@
#ifndef CAM_MMC_ALL_H
#define CAM_MMC_ALL_H
+#include <cam/cam_sim.h>
#include <cam/mmc/mmc.h>
#include <dev/mmc/mmcreg.h>
void mmc_print_ident(struct mmc_params *ident_data);
+void mmccam_start_discovery(struct cam_sim *sim);
#endif
Index: sys/cam/mmc/mmc_xpt.c
===================================================================
--- sys/cam/mmc/mmc_xpt.c
+++ sys/cam/mmc/mmc_xpt.c
@@ -404,6 +404,33 @@
printf("XPT info: CLK %04X, ...\n", cts.proto_specific.mmc.ios.clock);
}
+void
+mmccam_start_discovery(struct cam_sim *sim) {
+ union ccb *ccb;
+ uint32_t pathid;
+
+ KASSERT(sim->sim_dev != NULL, ("mmccam_start_discovery(%s): sim_dev is not initialized,"
+ " has cam_sim_alloc_dev() been used?", cam_sim_name(sim)));
+ pathid = cam_sim_path(sim);
+ ccb = xpt_alloc_ccb();
+ if (ccb == NULL) {
+ device_printf(sim->sim_dev, "Cannot allocate CCB for starting MMC discovery\n");
+ return;
+ }
+
+ /*
+ * We create a rescan request for BUS:0:0, since the card
+ * will be at lun 0.
+ */
+ if (xpt_create_path(&ccb->ccb_h.path, NULL, pathid,
+ /* target */ 0, /* lun */ 0) != CAM_REQ_CMP) {
+ xpt_free_ccb(ccb);
+ device_printf(sim->sim_dev, "Cannot create path for MMC discovery request\n");
+ return;
+ }
+ xpt_rescan(ccb);
+}
+
/* This func is called per attached device :-( */
void
mmc_print_ident(struct mmc_params *ident_data)
Index: sys/dev/sdhci/sdhci.c
===================================================================
--- sys/dev/sdhci/sdhci.c
+++ sys/dev/sdhci/sdhci.c
@@ -626,29 +626,8 @@
slot_printf(slot, "Card inserted\n");
#ifdef MMCCAM
slot->card_present = 1;
- union ccb *ccb;
- uint32_t pathid;
- pathid = cam_sim_path(slot->sim);
- ccb = xpt_alloc_ccb_nowait();
- if (ccb == NULL) {
- slot_printf(slot, "Unable to alloc CCB for rescan\n");
- SDHCI_UNLOCK(slot);
- return;
- }
-
- /*
- * We create a rescan request for BUS:0:0, since the card
- * will be at lun 0.
- */
- if (xpt_create_path(&ccb->ccb_h.path, NULL, pathid,
- /* target */ 0, /* lun */ 0) != CAM_REQ_CMP) {
- slot_printf(slot, "Unable to create path for rescan\n");
- SDHCI_UNLOCK(slot);
- xpt_free_ccb(ccb);
- return;
- }
+ mmccam_start_discovery(slot->sim);
SDHCI_UNLOCK(slot);
- xpt_rescan(ccb);
#else
d = slot->dev = device_add_child(slot->bus, "mmc", -1);
SDHCI_UNLOCK(slot);
@@ -672,29 +651,8 @@
slot->dev = NULL;
#ifdef MMCCAM
slot->card_present = 0;
- union ccb *ccb;
- uint32_t pathid;
- pathid = cam_sim_path(slot->sim);
- ccb = xpt_alloc_ccb_nowait();
- if (ccb == NULL) {
- slot_printf(slot, "Unable to alloc CCB for rescan\n");
- SDHCI_UNLOCK(slot);
- return;
- }
-
- /*
- * We create a rescan request for BUS:0:0, since the card
- * will be at lun 0.
- */
- if (xpt_create_path(&ccb->ccb_h.path, NULL, pathid,
- /* target */ 0, /* lun */ 0) != CAM_REQ_CMP) {
- slot_printf(slot, "Unable to create path for rescan\n");
- SDHCI_UNLOCK(slot);
- xpt_free_ccb(ccb);
- return;
- }
+ mmccam_start_discovery(slot->sim);
SDHCI_UNLOCK(slot);
- xpt_rescan(ccb);
#else
slot->intmask &= ~sdhci_tuning_intmask(slot);
WR4(slot, SDHCI_INT_ENABLE, slot->intmask);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Mar 11, 6:09 AM (19 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17095823
Default Alt Text
D15955.diff (3 KB)
Attached To
Mode
D15955: Discover cards on boot
Attached
Detach File
Event Timeline
Log In to Comment