mmccam: Add a generic mmccam_start_discovery function
This is a generic function start a scan request for the given cam_sim. Other driver can now just use this function to request a new rescan. Submitted by: kibab
This commit is contained in:
parent
d5bfd287c2
commit
c7a4994853
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=363425
@ -64,6 +64,7 @@
|
|||||||
#ifndef CAM_MMC_ALL_H
|
#ifndef CAM_MMC_ALL_H
|
||||||
#define CAM_MMC_ALL_H
|
#define CAM_MMC_ALL_H
|
||||||
|
|
||||||
|
#include <cam/cam_sim.h>
|
||||||
#include <cam/mmc/mmc.h>
|
#include <cam/mmc/mmc.h>
|
||||||
#include <dev/mmc/mmcreg.h>
|
#include <dev/mmc/mmcreg.h>
|
||||||
|
|
||||||
@ -72,5 +73,6 @@ struct ccb_pathinq;
|
|||||||
struct cam_sim;
|
struct cam_sim;
|
||||||
void mmc_path_inq(struct ccb_pathinq *cpi, const char *hba,
|
void mmc_path_inq(struct ccb_pathinq *cpi, const char *hba,
|
||||||
const struct cam_sim *sim, size_t maxio);
|
const struct cam_sim *sim, size_t maxio);
|
||||||
|
void mmccam_start_discovery(struct cam_sim *sim);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -404,6 +404,29 @@ mmc_announce_periph(struct cam_periph *periph)
|
|||||||
printf("XPT info: CLK %04X, ...\n", cts.proto_specific.mmc.ios.clock);
|
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;
|
||||||
|
|
||||||
|
pathid = cam_sim_path(sim);
|
||||||
|
ccb = xpt_alloc_ccb_nowait();
|
||||||
|
if (ccb == NULL) {
|
||||||
|
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);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
xpt_rescan(ccb);
|
||||||
|
}
|
||||||
|
|
||||||
/* This func is called per attached device :-( */
|
/* This func is called per attached device :-( */
|
||||||
void
|
void
|
||||||
mmc_print_ident(struct mmc_params *ident_data)
|
mmc_print_ident(struct mmc_params *ident_data)
|
||||||
|
@ -626,29 +626,8 @@ sdhci_card_task(void *arg, int pending __unused)
|
|||||||
slot_printf(slot, "Card inserted\n");
|
slot_printf(slot, "Card inserted\n");
|
||||||
#ifdef MMCCAM
|
#ifdef MMCCAM
|
||||||
slot->card_present = 1;
|
slot->card_present = 1;
|
||||||
union ccb *ccb;
|
mmccam_start_discovery(slot->sim);
|
||||||
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);
|
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;
|
|
||||||
}
|
|
||||||
SDHCI_UNLOCK(slot);
|
|
||||||
xpt_rescan(ccb);
|
|
||||||
#else
|
#else
|
||||||
d = slot->dev = device_add_child(slot->bus, "mmc", -1);
|
d = slot->dev = device_add_child(slot->bus, "mmc", -1);
|
||||||
SDHCI_UNLOCK(slot);
|
SDHCI_UNLOCK(slot);
|
||||||
@ -672,29 +651,8 @@ sdhci_card_task(void *arg, int pending __unused)
|
|||||||
slot->dev = NULL;
|
slot->dev = NULL;
|
||||||
#ifdef MMCCAM
|
#ifdef MMCCAM
|
||||||
slot->card_present = 0;
|
slot->card_present = 0;
|
||||||
union ccb *ccb;
|
mmccam_start_discovery(slot->sim);
|
||||||
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);
|
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;
|
|
||||||
}
|
|
||||||
SDHCI_UNLOCK(slot);
|
|
||||||
xpt_rescan(ccb);
|
|
||||||
#else
|
#else
|
||||||
slot->intmask &= ~sdhci_tuning_intmask(slot);
|
slot->intmask &= ~sdhci_tuning_intmask(slot);
|
||||||
WR4(slot, SDHCI_INT_ENABLE, slot->intmask);
|
WR4(slot, SDHCI_INT_ENABLE, slot->intmask);
|
||||||
|
Loading…
Reference in New Issue
Block a user