aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Vadot <manu@FreeBSD.org>2021-04-23 12:50:04 +0000
committerEmmanuel Vadot <manu@FreeBSD.org>2021-04-27 17:03:09 +0000
commite017c1c92c990a78ac99987a008c9eb3d5620941 (patch)
treec489a33af87181864f21a860a20735038d4a8c02
parent7cbdf8a05db7da9c78e8ac74542febc646d24abd (diff)
downloadsrc-e017c1c92c990a78ac99987a008c9eb3d5620941.tar.gz
src-e017c1c92c990a78ac99987a008c9eb3d5620941.zip
mmcprobe_done: Style(9)
-rw-r--r--sys/cam/mmc/mmc_xpt.c332
1 files changed, 166 insertions, 166 deletions
diff --git a/sys/cam/mmc/mmc_xpt.c b/sys/cam/mmc/mmc_xpt.c
index d6b3761cb955..ca5d299d22ab 100644
--- a/sys/cam/mmc/mmc_xpt.c
+++ b/sys/cam/mmc/mmc_xpt.c
@@ -856,101 +856,101 @@ mmcprobe_done(struct cam_periph *periph, union ccb *done_ccb)
PROBE_SET_ACTION(softc, PROBE_SDIO_RESET);
break;
}
- case PROBE_SDIO_RESET:
- {
+ case PROBE_SDIO_RESET:
+ {
mmcio = &done_ccb->mmcio;
err = mmcio->cmd.error;
- CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
- ("SDIO_RESET: error %d, CCCR CTL register: %08x\n",
- err, mmcio->cmd.resp[0]));
- PROBE_SET_ACTION(softc, PROBE_SDIO_INIT);
- break;
- }
- case PROBE_SDIO_INIT:
- {
+ CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
+ ("SDIO_RESET: error %d, CCCR CTL register: %08x\n",
+ err, mmcio->cmd.resp[0]));
+ PROBE_SET_ACTION(softc, PROBE_SDIO_INIT);
+ break;
+ }
+ case PROBE_SDIO_INIT:
+ {
mmcio = &done_ccb->mmcio;
err = mmcio->cmd.error;
- struct mmc_params *mmcp = &path->device->mmc_ident_data;
-
- CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
- ("SDIO_INIT: error %d, %08x %08x %08x %08x\n",
- err, mmcio->cmd.resp[0],
- mmcio->cmd.resp[1],
- mmcio->cmd.resp[2],
- mmcio->cmd.resp[3]));
-
- /*
- * Error here means that this card is not SDIO,
- * so proceed with memory init as if nothing has happened
- */
+ struct mmc_params *mmcp = &path->device->mmc_ident_data;
+
+ CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
+ ("SDIO_INIT: error %d, %08x %08x %08x %08x\n",
+ err, mmcio->cmd.resp[0],
+ mmcio->cmd.resp[1],
+ mmcio->cmd.resp[2],
+ mmcio->cmd.resp[3]));
+
+ /*
+ * Error here means that this card is not SDIO,
+ * so proceed with memory init as if nothing has happened
+ */
if (err != MMC_ERR_NONE) {
- PROBE_SET_ACTION(softc, PROBE_SEND_APP_OP_COND);
- break;
+ PROBE_SET_ACTION(softc, PROBE_SEND_APP_OP_COND);
+ break;
}
- mmcp->card_features |= CARD_FEATURE_SDIO;
- uint32_t ioifcond = mmcio->cmd.resp[0];
- uint32_t io_ocr = ioifcond & R4_IO_OCR_MASK;
-
- mmcp->sdio_func_count = R4_IO_NUM_FUNCTIONS(ioifcond);
- CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
- ("SDIO card: %d functions\n", mmcp->sdio_func_count));
- if (io_ocr == 0) {
- CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
- ("SDIO OCR invalid, retrying\n"));
- break; /* Retry */
- }
-
- if (io_ocr != 0 && mmcp->io_ocr == 0) {
- mmcp->io_ocr = io_ocr;
- break; /* Retry, this time with non-0 OCR */
- }
- CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
- ("SDIO OCR: %08x\n", mmcp->io_ocr));
-
- if (ioifcond & R4_IO_MEM_PRESENT) {
- /* Combo card -- proceed to memory initialization */
- PROBE_SET_ACTION(softc, PROBE_SEND_APP_OP_COND);
- } else {
- /* No memory portion -- get RCA and select card */
- PROBE_SET_ACTION(softc, PROBE_SEND_RELATIVE_ADDR);
- }
- break;
- }
- case PROBE_MMC_INIT:
- {
+ mmcp->card_features |= CARD_FEATURE_SDIO;
+ uint32_t ioifcond = mmcio->cmd.resp[0];
+ uint32_t io_ocr = ioifcond & R4_IO_OCR_MASK;
+
+ mmcp->sdio_func_count = R4_IO_NUM_FUNCTIONS(ioifcond);
+ CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
+ ("SDIO card: %d functions\n", mmcp->sdio_func_count));
+ if (io_ocr == 0) {
+ CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
+ ("SDIO OCR invalid, retrying\n"));
+ break; /* Retry */
+ }
+
+ if (io_ocr != 0 && mmcp->io_ocr == 0) {
+ mmcp->io_ocr = io_ocr;
+ break; /* Retry, this time with non-0 OCR */
+ }
+ CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
+ ("SDIO OCR: %08x\n", mmcp->io_ocr));
+
+ if (ioifcond & R4_IO_MEM_PRESENT) {
+ /* Combo card -- proceed to memory initialization */
+ PROBE_SET_ACTION(softc, PROBE_SEND_APP_OP_COND);
+ } else {
+ /* No memory portion -- get RCA and select card */
+ PROBE_SET_ACTION(softc, PROBE_SEND_RELATIVE_ADDR);
+ }
+ break;
+ }
+ case PROBE_MMC_INIT:
+ {
mmcio = &done_ccb->mmcio;
err = mmcio->cmd.error;
- struct mmc_params *mmcp = &path->device->mmc_ident_data;
+ struct mmc_params *mmcp = &path->device->mmc_ident_data;
if (err != MMC_ERR_NONE) {
CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
("MMC_INIT: error %d, resp %08x\n",
err, mmcio->cmd.resp[0]));
PROBE_SET_ACTION(softc, PROBE_INVALID);
- break;
- }
- CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
- ("MMC card, OCR %08x\n", mmcio->cmd.resp[0]));
-
- if (mmcp->card_ocr == 0) {
- /* We haven't sent the OCR to the card yet -- do it */
- mmcp->card_ocr = mmcio->cmd.resp[0];
- CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
- ("-> sending OCR to card\n"));
- break;
- }
-
- if (!(mmcio->cmd.resp[0] & MMC_OCR_CARD_BUSY)) {
- CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
- ("Card is still powering up\n"));
- break;
- }
-
- mmcp->card_features |= CARD_FEATURE_MMC | CARD_FEATURE_MEMORY;
- PROBE_SET_ACTION(softc, PROBE_GET_CID);
- break;
- }
+ break;
+ }
+ CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
+ ("MMC card, OCR %08x\n", mmcio->cmd.resp[0]));
+
+ if (mmcp->card_ocr == 0) {
+ /* We haven't sent the OCR to the card yet -- do it */
+ mmcp->card_ocr = mmcio->cmd.resp[0];
+ CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
+ ("-> sending OCR to card\n"));
+ break;
+ }
+
+ if (!(mmcio->cmd.resp[0] & MMC_OCR_CARD_BUSY)) {
+ CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
+ ("Card is still powering up\n"));
+ break;
+ }
+
+ mmcp->card_features |= CARD_FEATURE_MMC | CARD_FEATURE_MEMORY;
+ PROBE_SET_ACTION(softc, PROBE_GET_CID);
+ break;
+ }
case PROBE_SEND_APP_OP_COND:
{
mmcio = &done_ccb->mmcio;
@@ -961,41 +961,41 @@ mmcprobe_done(struct cam_periph *periph, union ccb *done_ccb)
("APP_OP_COND: error %d, resp %08x\n",
err, mmcio->cmd.resp[0]));
PROBE_SET_ACTION(softc, PROBE_MMC_INIT);
- break;
- }
-
- if (!(softc->flags & PROBE_FLAG_ACMD_SENT)) {
- /* Don't change the state */
- softc->flags |= PROBE_FLAG_ACMD_SENT;
- break;
- }
-
- softc->flags &= ~PROBE_FLAG_ACMD_SENT;
- if ((mmcio->cmd.resp[0] & MMC_OCR_CARD_BUSY) ||
- (mmcio->cmd.arg & MMC_OCR_VOLTAGE) == 0) {
- struct mmc_params *mmcp = &path->device->mmc_ident_data;
- CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
- ("Card OCR: %08x\n", mmcio->cmd.resp[0]));
- if (mmcp->card_ocr == 0) {
- mmcp->card_ocr = mmcio->cmd.resp[0];
- /* Now when we know OCR that we want -- send it to card */
- CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
- ("-> sending OCR to card\n"));
- } else {
- /* We already know the OCR and despite of that we
- * are processing the answer to ACMD41 -> move on
- */
- PROBE_SET_ACTION(softc, PROBE_GET_CID);
- }
- /* Getting an answer to ACMD41 means the card has memory */
- mmcp->card_features |= CARD_FEATURE_MEMORY;
-
- /* Standard capacity vs High Capacity memory card */
- if (mmcio->cmd.resp[0] & MMC_OCR_CCS) {
- CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
- ("Card is SDHC\n"));
- mmcp->card_features |= CARD_FEATURE_SDHC;
- }
+ break;
+ }
+
+ if (!(softc->flags & PROBE_FLAG_ACMD_SENT)) {
+ /* Don't change the state */
+ softc->flags |= PROBE_FLAG_ACMD_SENT;
+ break;
+ }
+
+ softc->flags &= ~PROBE_FLAG_ACMD_SENT;
+ if ((mmcio->cmd.resp[0] & MMC_OCR_CARD_BUSY) ||
+ (mmcio->cmd.arg & MMC_OCR_VOLTAGE) == 0) {
+ struct mmc_params *mmcp = &path->device->mmc_ident_data;
+ CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
+ ("Card OCR: %08x\n", mmcio->cmd.resp[0]));
+ if (mmcp->card_ocr == 0) {
+ mmcp->card_ocr = mmcio->cmd.resp[0];
+ /* Now when we know OCR that we want -- send it to card */
+ CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
+ ("-> sending OCR to card\n"));
+ } else {
+ /* We already know the OCR and despite of that we
+ * are processing the answer to ACMD41 -> move on
+ */
+ PROBE_SET_ACTION(softc, PROBE_GET_CID);
+ }
+ /* Getting an answer to ACMD41 means the card has memory */
+ mmcp->card_features |= CARD_FEATURE_MEMORY;
+
+ /* Standard capacity vs High Capacity memory card */
+ if (mmcio->cmd.resp[0] & MMC_OCR_CCS) {
+ CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
+ ("Card is SDHC\n"));
+ mmcp->card_features |= CARD_FEATURE_SDHC;
+ }
/* Whether the card supports 1.8V signaling */
if (mmcio->cmd.resp[0] & MMC_OCR_S18A) {
@@ -1022,10 +1022,10 @@ mmcprobe_done(struct cam_periph *periph, union ccb *done_ccb)
PROBE_SET_ACTION(softc, PROBE_SEND_APP_OP_COND);
}
- break;
+ break;
}
- case PROBE_GET_CID: /* XXX move to mmc_da */
- {
+ case PROBE_GET_CID: /* XXX move to mmc_da */
+ {
mmcio = &done_ccb->mmcio;
err = mmcio->cmd.error;
@@ -1033,45 +1033,45 @@ mmcprobe_done(struct cam_periph *periph, union ccb *done_ccb)
CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
("PROBE_GET_CID: error %d\n", err));
PROBE_SET_ACTION(softc, PROBE_INVALID);
- break;
- }
-
- struct mmc_params *mmcp = &path->device->mmc_ident_data;
- memcpy(mmcp->card_cid, mmcio->cmd.resp, 4 * sizeof(uint32_t));
- CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
- ("CID %08x%08x%08x%08x\n",
- mmcp->card_cid[0],
- mmcp->card_cid[1],
- mmcp->card_cid[2],
- mmcp->card_cid[3]));
+ break;
+ }
+
+ struct mmc_params *mmcp = &path->device->mmc_ident_data;
+ memcpy(mmcp->card_cid, mmcio->cmd.resp, 4 * sizeof(uint32_t));
+ CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
+ ("CID %08x%08x%08x%08x\n",
+ mmcp->card_cid[0],
+ mmcp->card_cid[1],
+ mmcp->card_cid[2],
+ mmcp->card_cid[3]));
if (mmcp->card_features & CARD_FEATURE_MMC)
PROBE_SET_ACTION(softc, PROBE_MMC_SET_RELATIVE_ADDR);
else
PROBE_SET_ACTION(softc, PROBE_SEND_RELATIVE_ADDR);
- break;
- }
- case PROBE_SEND_RELATIVE_ADDR: {
+ break;
+ }
+ case PROBE_SEND_RELATIVE_ADDR: {
mmcio = &done_ccb->mmcio;
err = mmcio->cmd.error;
- struct mmc_params *mmcp = &path->device->mmc_ident_data;
- uint16_t rca = mmcio->cmd.resp[0] >> 16;
- CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
- ("Card published RCA: %u\n", rca));
- path->device->mmc_ident_data.card_rca = rca;
+ struct mmc_params *mmcp = &path->device->mmc_ident_data;
+ uint16_t rca = mmcio->cmd.resp[0] >> 16;
+ CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
+ ("Card published RCA: %u\n", rca));
+ path->device->mmc_ident_data.card_rca = rca;
if (err != MMC_ERR_NONE) {
CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
("PROBE_SEND_RELATIVE_ADDR: error %d\n", err));
PROBE_SET_ACTION(softc, PROBE_INVALID);
- break;
- }
-
- /* If memory is present, get CSD, otherwise select card */
- if (mmcp->card_features & CARD_FEATURE_MEMORY)
- PROBE_SET_ACTION(softc, PROBE_GET_CSD);
- else
- PROBE_SET_ACTION(softc, PROBE_SELECT_CARD);
+ break;
+ }
+
+ /* If memory is present, get CSD, otherwise select card */
+ if (mmcp->card_features & CARD_FEATURE_MEMORY)
+ PROBE_SET_ACTION(softc, PROBE_GET_CSD);
+ else
+ PROBE_SET_ACTION(softc, PROBE_SELECT_CARD);
break;
- }
+ }
case PROBE_MMC_SET_RELATIVE_ADDR:
mmcio = &done_ccb->mmcio;
err = mmcio->cmd.error;
@@ -1084,7 +1084,7 @@ mmcprobe_done(struct cam_periph *periph, union ccb *done_ccb)
path->device->mmc_ident_data.card_rca = MMC_PROPOSED_RCA;
PROBE_SET_ACTION(softc, PROBE_GET_CSD);
break;
- case PROBE_GET_CSD: {
+ case PROBE_GET_CSD: {
mmcio = &done_ccb->mmcio;
err = mmcio->cmd.error;
@@ -1092,33 +1092,33 @@ mmcprobe_done(struct cam_periph *periph, union ccb *done_ccb)
CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
("PROBE_GET_CSD: error %d\n", err));
PROBE_SET_ACTION(softc, PROBE_INVALID);
- break;
- }
-
- struct mmc_params *mmcp = &path->device->mmc_ident_data;
- memcpy(mmcp->card_csd, mmcio->cmd.resp, 4 * sizeof(uint32_t));
- CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
- ("CSD %08x%08x%08x%08x\n",
- mmcp->card_csd[0],
- mmcp->card_csd[1],
- mmcp->card_csd[2],
- mmcp->card_csd[3]));
- PROBE_SET_ACTION(softc, PROBE_SELECT_CARD);
- break;
- }
- case PROBE_SELECT_CARD: {
+ break;
+ }
+
+ struct mmc_params *mmcp = &path->device->mmc_ident_data;
+ memcpy(mmcp->card_csd, mmcio->cmd.resp, 4 * sizeof(uint32_t));
+ CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
+ ("CSD %08x%08x%08x%08x\n",
+ mmcp->card_csd[0],
+ mmcp->card_csd[1],
+ mmcp->card_csd[2],
+ mmcp->card_csd[3]));
+ PROBE_SET_ACTION(softc, PROBE_SELECT_CARD);
+ break;
+ }
+ case PROBE_SELECT_CARD: {
mmcio = &done_ccb->mmcio;
err = mmcio->cmd.error;
if (err != MMC_ERR_NONE) {
CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
("PROBE_SEND_RELATIVE_ADDR: error %d\n", err));
PROBE_SET_ACTION(softc, PROBE_INVALID);
- break;
- }
+ break;
+ }
PROBE_SET_ACTION(softc, PROBE_DONE);
- break;
- }
+ break;
+ }
default:
CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
("mmcprobe_done: invalid action state 0x%x\n", softc->action));