Add new fields to mmc_data in preparation to SDIO CMD53 block mode support

SDIO command CMD53 (IO_RW_EXTENDED) allows data transfers using blocks of 1-2048 bytes,
with a maximum of 511 blocks per request.
Extend mmc_data structure to properly describe such requests,
and initialize the new fields in kernel and userland consumers.

No actual driver changes happen yet, these will follow in the separate changes.

Reviewed by:	bz
Approved by:	imp (mentor)
Differential Revision:	https://reviews.freebsd.org/D19779
This commit is contained in:
kibab 2019-04-10 19:49:35 +00:00
parent ac7512a382
commit 674b0be51d
3 changed files with 12 additions and 0 deletions

View File

@ -7788,6 +7788,7 @@ mmcsdcmd(struct cam_device *device, int argc, char **argv, char *combinedopt,
flags |= CAM_DIR_IN;
mmc_data = malloc(mmc_data_len);
memset(mmc_data, 0, mmc_data_len);
memset(&mmc_d, 0, sizeof(mmc_d));
mmc_d.len = mmc_data_len;
mmc_d.data = mmc_data;
mmc_d.flags = MMC_DATA_READ;

View File

@ -791,6 +791,11 @@ sddaregister(struct cam_periph *periph, void *arg)
softc->state = SDDA_STATE_INIT;
softc->mmcdata =
(struct mmc_data *)malloc(sizeof(struct mmc_data), M_DEVBUF, M_NOWAIT|M_ZERO);
if (softc->mmcdata == NULL) {
printf("sddaregister: Unable to probe new device. "
"Unable to allocate mmcdata\n");
return (CAM_REQ_CMP_ERR);
}
periph->softc = softc;
softc->periph = periph;
@ -889,6 +894,7 @@ mmc_send_ext_csd(struct cam_periph *periph, union ccb *ccb,
struct mmc_data d;
KASSERT(buf_len == 512, ("Buffer for ext csd must be 512 bytes"));
memset(&d, 0, sizeof(d));
d.data = rawextcsd;
d.len = buf_len;
d.flags = MMC_DATA_READ;
@ -1013,6 +1019,7 @@ mmc_sd_switch(struct cam_periph *periph, union ccb *ccb,
int err;
memset(res, 0, 64);
memset(&mmc_d, 0, sizeof(mmc_d));
mmc_d.len = 64;
mmc_d.data = res;
mmc_d.flags = MMC_DATA_READ;
@ -1804,6 +1811,7 @@ sddastart(struct cam_periph *periph, union ccb *start_ccb)
mmcio->cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC;
mmcio->cmd.data = softc->mmcdata;
memset(mmcio->cmd.data, 0, sizeof(struct mmc_data));
mmcio->cmd.data->data = bp->bio_data;
mmcio->cmd.data->len = 512 * count;
mmcio->cmd.data->flags = (bp->bio_cmd == BIO_READ ? MMC_DATA_READ : MMC_DATA_WRITE);

View File

@ -197,7 +197,10 @@ struct mmc_data {
#define MMC_DATA_READ (1UL << 1)
#define MMC_DATA_STREAM (1UL << 2)
#define MMC_DATA_MULTI (1UL << 3)
#define MMC_DATA_BLOCK_SIZE (1UL << 4)
struct mmc_request *mrq;
size_t block_size; /* block size for CMD53 */
size_t block_count; /* block count for CMD53 */
};
struct mmc_request {