- Correct the remainder of confusing and error prone mix-ups between

"br" or "bridge" where - according to the terminology outlined in
  comments of bridge.h and mmcbr_if.m  around since their addition in
  r163516 - the bus is meant and used instead. Some of these instances
  are also rather old, while those in e. g. mmc_subr.c are as new as
  r315430 and were caused by choosing mmc_wait_for_request(), i. e. the
  one pre-r315430 outliner existing in mmc.c, as template for function
  parameters in mmc_subr.c inadvertently. This correction translates to
  renaming "brdev" to "busdev" and "mmcbr" to "mmcbus" respectively as
  appropriate.
  While at it, also rename "reqdev" to just "dev" in mmc_subr.[c,h]
  for consistency with was already used in mmm.c pre-r315430, again
  modulo mmc_wait_for_request() that is.
- Remove comment lines from bridge.h incorrectly suggesting that there
  would be a MMC bridge base class driver.
- Update comments in bridge.h regarding the star topology of SD and SDIO;
  since version 3.00 of the SDHCI specification, for eSD and eSDIO bus
  topologies are actually possible in form of so called "shared buses"
  (in some subcontext later on renamed to "embedded" buses).
This commit is contained in:
Marius Strobl 2017-08-02 21:11:51 +00:00
parent d2435d7c28
commit cd85acba1a
5 changed files with 84 additions and 86 deletions

View File

@ -65,12 +65,10 @@
* linux/mmc/host.h file.
*
* A mmc bridge is a chipset that can have one or more mmc and/or sd
* cards attached to it. mmc cards are attached on a bus topology,
* while sd and sdio cards are attached using a star topology (meaning
* in practice each sd card has its own, independent slot). Each
* mmcbr is assumed to be derived from the mmcbr. This is done to
* allow for easier addition of bridges (as each bridge does not need
* to be added to the mmcbus file).
* cards attached to it. mmc devices are attached on a bus topology,
* while sd and sdio cards usually are attached using a star topology
* (meaning in practice each sd card has its own, independent slot).
* Since SDHCI v3.00, buses for esd and esdio are possible, though.
*
* Attached to the mmc bridge is an mmcbus. The mmcbus is described
* in dev/mmc/mmcbus_if.m.

View File

@ -72,7 +72,7 @@ __FBSDID("$FreeBSD$");
#define LOG_PPS 5 /* Log no more than 5 errors per second. */
int
mmc_wait_for_cmd(device_t brdev, device_t reqdev, struct mmc_command *cmd,
mmc_wait_for_cmd(device_t busdev, device_t dev, struct mmc_command *cmd,
int retries)
{
struct mmc_request mreq;
@ -87,14 +87,14 @@ mmc_wait_for_cmd(device_t brdev, device_t reqdev, struct mmc_command *cmd,
if (cmd->data != NULL)
cmd->data->mrq = &mreq;
mreq.cmd = cmd;
if (MMCBUS_WAIT_FOR_REQUEST(brdev, reqdev, &mreq) != 0)
if (MMCBUS_WAIT_FOR_REQUEST(busdev, dev, &mreq) != 0)
err = MMC_ERR_FAILED;
else
err = cmd->error;
} while (err != MMC_ERR_NONE && retries-- > 0);
if (err != MMC_ERR_NONE && brdev == reqdev) {
sc = device_get_softc(brdev);
if (err != MMC_ERR_NONE && busdev == dev) {
sc = device_get_softc(busdev);
if (sc->squelched == 0 && ppsratecheck(&sc->log_time,
&sc->log_count, LOG_PPS)) {
device_printf(sc->dev, "CMD%d failed, RESULT: %d\n",
@ -106,14 +106,14 @@ mmc_wait_for_cmd(device_t brdev, device_t reqdev, struct mmc_command *cmd,
}
int
mmc_wait_for_app_cmd(device_t brdev, device_t reqdev, uint16_t rca,
mmc_wait_for_app_cmd(device_t busdev, device_t dev, uint16_t rca,
struct mmc_command *cmd, int retries)
{
struct mmc_command appcmd;
struct mmc_softc *sc;
int err;
sc = device_get_softc(brdev);
sc = device_get_softc(busdev);
/* Squelch error reporting at lower levels, we report below. */
sc->squelched++;
@ -122,14 +122,14 @@ mmc_wait_for_app_cmd(device_t brdev, device_t reqdev, uint16_t rca,
appcmd.opcode = MMC_APP_CMD;
appcmd.arg = (uint32_t)rca << 16;
appcmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
if (mmc_wait_for_cmd(brdev, reqdev, &appcmd, 0) != 0)
if (mmc_wait_for_cmd(busdev, dev, &appcmd, 0) != 0)
err = MMC_ERR_FAILED;
else
err = appcmd.error;
if (err == MMC_ERR_NONE) {
if (!(appcmd.resp[0] & R1_APP_CMD))
err = MMC_ERR_FAILED;
else if (mmc_wait_for_cmd(brdev, reqdev, cmd, 0) != 0)
else if (mmc_wait_for_cmd(busdev, dev, cmd, 0) != 0)
err = MMC_ERR_FAILED;
else
err = cmd->error;
@ -137,7 +137,7 @@ mmc_wait_for_app_cmd(device_t brdev, device_t reqdev, uint16_t rca,
} while (err != MMC_ERR_NONE && retries-- > 0);
sc->squelched--;
if (err != MMC_ERR_NONE && brdev == reqdev) {
if (err != MMC_ERR_NONE && busdev == dev) {
if (sc->squelched == 0 && ppsratecheck(&sc->log_time,
&sc->log_count, LOG_PPS)) {
device_printf(sc->dev, "ACMD%d failed, RESULT: %d\n",
@ -149,7 +149,7 @@ mmc_wait_for_app_cmd(device_t brdev, device_t reqdev, uint16_t rca,
}
int
mmc_switch(device_t brdev, device_t reqdev, uint16_t rca, uint8_t set,
mmc_switch(device_t busdev, device_t dev, uint16_t rca, uint8_t set,
uint8_t index, uint8_t value, u_int timeout, bool status)
{
struct mmc_command cmd;
@ -158,7 +158,7 @@ mmc_switch(device_t brdev, device_t reqdev, uint16_t rca, uint8_t set,
KASSERT(timeout != 0, ("%s: no timeout", __func__));
sc = device_get_softc(brdev);
sc = device_get_softc(busdev);
memset(&cmd, 0, sizeof(cmd));
cmd.opcode = MMC_SWITCH_FUNC;
@ -169,8 +169,8 @@ mmc_switch(device_t brdev, device_t reqdev, uint16_t rca, uint8_t set,
* exceeds the maximum host timeout, use a R1 instead of a R1B
* response in order to keep the hardware from timing out.
*/
if (mmcbr_get_caps(brdev) & MMC_CAP_WAIT_WHILE_BUSY &&
timeout > mmcbr_get_max_busy_timeout(brdev))
if (mmcbr_get_caps(busdev) & MMC_CAP_WAIT_WHILE_BUSY &&
timeout > mmcbr_get_max_busy_timeout(busdev))
cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
else
cmd.flags = MMC_RSP_R1B | MMC_CMD_AC;
@ -180,17 +180,17 @@ mmc_switch(device_t brdev, device_t reqdev, uint16_t rca, uint8_t set,
* than to a tuning command that may have snuck in between.
*/
sc->retune_paused++;
err = mmc_wait_for_cmd(brdev, reqdev, &cmd, CMD_RETRIES);
err = mmc_wait_for_cmd(busdev, dev, &cmd, CMD_RETRIES);
if (err != MMC_ERR_NONE || status == false)
goto out;
err = mmc_switch_status(brdev, reqdev, rca, timeout);
err = mmc_switch_status(busdev, dev, rca, timeout);
out:
sc->retune_paused--;
return (err);
}
int
mmc_switch_status(device_t brdev, device_t reqdev, uint16_t rca, u_int timeout)
mmc_switch_status(device_t busdev, device_t dev, uint16_t rca, u_int timeout)
{
struct timeval cur, end;
int err;
@ -205,7 +205,7 @@ mmc_switch_status(device_t brdev, device_t reqdev, uint16_t rca, u_int timeout)
*/
end.tv_sec = end.tv_usec = 0;
for (;;) {
err = mmc_send_status(brdev, reqdev, rca, &status);
err = mmc_send_status(busdev, dev, rca, &status);
if (err != MMC_ERR_NONE)
break;
if (R1_CURRENT_STATE(status) == R1_STATE_TRAN)
@ -226,7 +226,7 @@ mmc_switch_status(device_t brdev, device_t reqdev, uint16_t rca, u_int timeout)
}
int
mmc_send_ext_csd(device_t brdev, device_t reqdev, uint8_t *rawextcsd)
mmc_send_ext_csd(device_t busdev, device_t dev, uint8_t *rawextcsd)
{
struct mmc_command cmd;
struct mmc_data data;
@ -244,12 +244,12 @@ mmc_send_ext_csd(device_t brdev, device_t reqdev, uint8_t *rawextcsd)
data.len = MMC_EXTCSD_SIZE;
data.flags = MMC_DATA_READ;
err = mmc_wait_for_cmd(brdev, reqdev, &cmd, CMD_RETRIES);
err = mmc_wait_for_cmd(busdev, dev, &cmd, CMD_RETRIES);
return (err);
}
int
mmc_send_status(device_t brdev, device_t reqdev, uint16_t rca, uint32_t *status)
mmc_send_status(device_t busdev, device_t dev, uint16_t rca, uint32_t *status)
{
struct mmc_command cmd;
int err;
@ -258,7 +258,7 @@ mmc_send_status(device_t brdev, device_t reqdev, uint16_t rca, uint32_t *status)
cmd.opcode = MMC_SEND_STATUS;
cmd.arg = (uint32_t)rca << 16;
cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
err = mmc_wait_for_cmd(brdev, reqdev, &cmd, CMD_RETRIES);
err = mmc_wait_for_cmd(busdev, dev, &cmd, CMD_RETRIES);
*status = cmd.resp[0];
return (err);
}

View File

@ -57,16 +57,16 @@
struct mmc_command;
int mmc_send_ext_csd(device_t brdev, device_t reqdev, uint8_t *rawextcsd);
int mmc_send_status(device_t brdev, device_t reqdev, uint16_t rca,
int mmc_send_ext_csd(device_t busdev, device_t dev, uint8_t *rawextcsd);
int mmc_send_status(device_t busdev, device_t dev, uint16_t rca,
uint32_t *status);
int mmc_switch(device_t brdev, device_t reqdev, uint16_t rca, uint8_t set,
int mmc_switch(device_t busdev, device_t dev, uint16_t rca, uint8_t set,
uint8_t index, uint8_t value, u_int timeout, bool send_status);
int mmc_switch_status(device_t brdev, device_t reqdev, uint16_t rca,
int mmc_switch_status(device_t busdev, device_t dev, uint16_t rca,
u_int timeout);
int mmc_wait_for_app_cmd(device_t brdev, device_t reqdev, uint16_t rca,
int mmc_wait_for_app_cmd(device_t busdev, device_t dev, uint16_t rca,
struct mmc_command *cmd, int retries);
int mmc_wait_for_cmd(device_t brdev, device_t reqdev, struct mmc_command *cmd,
int mmc_wait_for_cmd(device_t busdev, device_t dev, struct mmc_command *cmd,
int retries);
#endif /* DEV_MMC_SUBR_H */

View File

@ -68,7 +68,7 @@ INTERFACE mmcbus;
# the bus to be claimed.
#
METHOD void retune_pause {
device_t brdev;
device_t busdev;
device_t reqdev;
bool retune;
};
@ -77,7 +77,7 @@ METHOD void retune_pause {
# Unpause re-tuning. Requires the bus to be claimed.
#
METHOD void retune_unpause {
device_t brdev;
device_t busdev;
device_t reqdev;
};
@ -85,7 +85,7 @@ METHOD void retune_unpause {
# Queue and wait for a request. Requires the bus to be claimed.
#
METHOD int wait_for_request {
device_t brdev;
device_t busdev;
device_t reqdev;
struct mmc_request *req;
};
@ -95,7 +95,7 @@ METHOD int wait_for_request {
# longer busy.
#
METHOD int acquire_bus {
device_t brdev;
device_t busdev;
device_t reqdev;
};
@ -103,6 +103,6 @@ METHOD int acquire_bus {
# Release the current bus.
#
METHOD int release_bus {
device_t brdev;
device_t busdev;
device_t reqdev;
};

View File

@ -117,7 +117,7 @@ struct mmcsd_part {
struct mmcsd_softc {
device_t dev;
device_t mmcbr;
device_t mmcbus;
struct mmcsd_part *part[MMC_PART_MAX];
enum mmc_card_mode mode;
u_int max_data; /* Maximum data size [blocks] */
@ -215,7 +215,7 @@ mmcsd_probe(device_t dev)
static int
mmcsd_attach(device_t dev)
{
device_t mmcbr;
device_t mmcbus;
struct mmcsd_softc *sc;
const uint8_t *ext_csd;
off_t erase_size, sector_size, size, wp_size;
@ -227,8 +227,8 @@ mmcsd_attach(device_t dev)
sc = device_get_softc(dev);
sc->dev = dev;
sc->mmcbr = mmcbr = device_get_parent(dev);
sc->mode = mmcbr_get_mode(mmcbr);
sc->mmcbus = mmcbus = device_get_parent(dev);
sc->mode = mmcbr_get_mode(mmcbus);
/*
* Note that in principle with an SDHCI-like re-tuning implementation,
* the maximum data size can change at runtime due to a device removal/
@ -245,9 +245,9 @@ mmcsd_attach(device_t dev)
/* Only MMC >= 4.x devices support EXT_CSD. */
if (mmc_get_spec_vers(dev) >= 4) {
MMCBUS_ACQUIRE_BUS(mmcbr, dev);
err = mmc_send_ext_csd(mmcbr, dev, sc->ext_csd);
MMCBUS_RELEASE_BUS(mmcbr, dev);
MMCBUS_ACQUIRE_BUS(mmcbus, dev);
err = mmc_send_ext_csd(mmcbus, dev, sc->ext_csd);
MMCBUS_RELEASE_BUS(mmcbus, dev);
if (err != MMC_ERR_NONE)
bzero(sc->ext_csd, sizeof(sc->ext_csd));
}
@ -330,7 +330,7 @@ mmcsd_attach(device_t dev)
/* Add boot partitions, which are of a fixed multiple of 128 KB. */
size = ext_csd[EXT_CSD_BOOT_SIZE_MULT] * MMC_BOOT_RPMB_BLOCK_SIZE;
if (size > 0 && (mmcbr_get_caps(mmcbr) & MMC_CAP_BOOT_NOACC) == 0) {
if (size > 0 && (mmcbr_get_caps(mmcbus) & MMC_CAP_BOOT_NOACC) == 0) {
mmcsd_add_part(sc, EXT_CSD_PART_CONFIG_ACC_BOOT0,
MMCSD_FMT_BOOT, 0, size, MMC_BOOT_RPMB_BLOCK_SIZE,
ro | ((ext_csd[EXT_CSD_BOOT_WP_STATUS] &
@ -422,7 +422,7 @@ mmcsd_add_part(struct mmcsd_softc *sc, u_int type, const char *name, u_int cnt,
off_t media_size, off_t erase_size, bool ro)
{
struct make_dev_args args;
device_t dev, mmcbr;
device_t dev, mmcbus;
const char *ext;
const uint8_t *ext_csd;
struct mmcsd_part *part;
@ -435,7 +435,7 @@ mmcsd_add_part(struct mmcsd_softc *sc, u_int type, const char *name, u_int cnt,
char unit[2];
dev = sc->dev;
mmcbr = sc->mmcbr;
mmcbus = sc->mmcbus;
part = sc->part[type] = malloc(sizeof(*part), M_DEVBUF,
M_WAITOK | M_ZERO);
part->sc = sc;
@ -502,10 +502,10 @@ mmcsd_add_part(struct mmcsd_softc *sc, u_int type, const char *name, u_int cnt,
bytes = mmcsd_pretty_size(media_size, unit);
if (type == EXT_CSD_PART_CONFIG_ACC_DEFAULT) {
speed = mmcbr_get_clock(mmcbr);
speed = mmcbr_get_clock(mmcbus);
printf("%s%d: %ju%sB <%s>%s at %s %d.%01dMHz/%dbit/%d-block\n",
part->name, cnt, bytes, unit, mmc_get_card_id_string(dev),
ro ? " (read-only)" : "", device_get_nameunit(mmcbr),
ro ? " (read-only)" : "", device_get_nameunit(mmcbus),
speed / 1000000, (speed / 100000) % 10,
mmcsd_bus_bit_width(dev), sc->max_data);
} else if (type == EXT_CSD_PART_CONFIG_ACC_RPMB) {
@ -802,7 +802,7 @@ mmcsd_ioctl_cmd(struct mmcsd_part *part, struct mmc_ioc_cmd *mic, int fflag)
struct mmc_command cmd;
struct mmc_data data;
struct mmcsd_softc *sc;
device_t dev, mmcbr;
device_t dev, mmcbus;
void *dp;
u_long len;
int err, retries;
@ -885,9 +885,9 @@ mmcsd_ioctl_cmd(struct mmcsd_part *part, struct mmc_ioc_cmd *mic, int fflag)
}
}
dev = sc->dev;
mmcbr = sc->mmcbr;
MMCBUS_ACQUIRE_BUS(mmcbr, dev);
err = mmcsd_switch_part(mmcbr, dev, rca, part->type);
mmcbus = sc->mmcbus;
MMCBUS_ACQUIRE_BUS(mmcbus, dev);
err = mmcsd_switch_part(mmcbus, dev, rca, part->type);
if (err != MMC_ERR_NONE)
goto release;
if (part->type == EXT_CSD_PART_CONFIG_ACC_RPMB) {
@ -897,9 +897,9 @@ mmcsd_ioctl_cmd(struct mmcsd_part *part, struct mmc_ioc_cmd *mic, int fflag)
goto switch_back;
}
if (mic->is_acmd != 0)
(void)mmc_wait_for_app_cmd(mmcbr, dev, rca, &cmd, 0);
(void)mmc_wait_for_app_cmd(mmcbus, dev, rca, &cmd, 0);
else
(void)mmc_wait_for_cmd(mmcbr, dev, &cmd, 0);
(void)mmc_wait_for_cmd(mmcbus, dev, &cmd, 0);
if (part->type == EXT_CSD_PART_CONFIG_ACC_RPMB) {
/*
* If the request went to the RPMB partition, try to ensure
@ -907,7 +907,7 @@ mmcsd_ioctl_cmd(struct mmcsd_part *part, struct mmc_ioc_cmd *mic, int fflag)
*/
retries = MMCSD_CMD_RETRIES;
do {
err = mmc_send_status(mmcbr, dev, rca, &status);
err = mmc_send_status(mmcbus, dev, rca, &status);
if (err != MMC_ERR_NONE)
break;
if (R1_STATUS(status) == 0 &&
@ -918,7 +918,7 @@ mmcsd_ioctl_cmd(struct mmcsd_part *part, struct mmc_ioc_cmd *mic, int fflag)
switch_back:
/* ... and always switch back to the default partition. */
err = mmcsd_switch_part(mmcbr, dev, rca,
err = mmcsd_switch_part(mmcbus, dev, rca,
EXT_CSD_PART_CONFIG_ACC_DEFAULT);
if (err != MMC_ERR_NONE)
goto release;
@ -929,11 +929,11 @@ mmcsd_ioctl_cmd(struct mmcsd_part *part, struct mmc_ioc_cmd *mic, int fflag)
* so retrieve EXT_CSD again.
*/
if (cmd.opcode == MMC_SWITCH_FUNC) {
err = mmc_send_ext_csd(mmcbr, dev, sc->ext_csd);
err = mmc_send_ext_csd(mmcbus, dev, sc->ext_csd);
if (err != MMC_ERR_NONE)
goto release;
}
MMCBUS_RELEASE_BUS(mmcbr, dev);
MMCBUS_RELEASE_BUS(mmcbus, dev);
if (cmd.error != MMC_ERR_NONE) {
switch (cmd.error) {
case MMC_ERR_TIMEOUT:
@ -963,7 +963,7 @@ mmcsd_ioctl_cmd(struct mmcsd_part *part, struct mmc_ioc_cmd *mic, int fflag)
goto out;
release:
MMCBUS_RELEASE_BUS(mmcbr, dev);
MMCBUS_RELEASE_BUS(mmcbus, dev);
err = EIO;
out:
@ -1009,7 +1009,7 @@ mmcsd_set_blockcount(struct mmcsd_softc *sc, u_int count, bool reliable)
if (reliable)
cmd.arg |= 1 << 31;
cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
MMCBUS_WAIT_FOR_REQUEST(sc->mmcbr, sc->dev, &req);
MMCBUS_WAIT_FOR_REQUEST(sc->mmcbus, sc->dev, &req);
return (cmd.error);
}
@ -1036,7 +1036,7 @@ mmcsd_switch_part(device_t bus, device_t dev, uint16_t rca, u_int part)
* anew.
*/
if (part == EXT_CSD_PART_CONFIG_ACC_RPMB)
MMCBUS_RETUNE_PAUSE(sc->mmcbr, sc->dev, true);
MMCBUS_RETUNE_PAUSE(sc->mmcbus, sc->dev, true);
if (sc->part_curr == part)
return (MMC_ERR_NONE);
@ -1048,13 +1048,13 @@ mmcsd_switch_part(device_t bus, device_t dev, uint16_t rca, u_int part)
EXT_CSD_PART_CONFIG, value, sc->part_time, true);
if (err != MMC_ERR_NONE) {
if (part == EXT_CSD_PART_CONFIG_ACC_RPMB)
MMCBUS_RETUNE_UNPAUSE(sc->mmcbr, sc->dev);
MMCBUS_RETUNE_UNPAUSE(sc->mmcbus, sc->dev);
return (err);
}
sc->ext_csd[EXT_CSD_PART_CONFIG] = value;
if (sc->part_curr == EXT_CSD_PART_CONFIG_ACC_RPMB)
MMCBUS_RETUNE_UNPAUSE(sc->mmcbr, sc->dev);
MMCBUS_RETUNE_UNPAUSE(sc->mmcbus, sc->dev);
sc->part_curr = part;
return (MMC_ERR_NONE);
}
@ -1077,13 +1077,13 @@ mmcsd_rw(struct mmcsd_part *part, struct bio *bp)
struct mmc_request req;
struct mmc_data data;
struct mmcsd_softc *sc;
device_t dev, mmcbr;
device_t dev, mmcbus;
u_int numblocks, sz;
char *vaddr;
sc = part->sc;
dev = sc->dev;
mmcbr = sc->mmcbr;
mmcbus = sc->mmcbus;
block = bp->bio_pblkno;
sz = part->disk->d_sectorsize;
@ -1128,7 +1128,7 @@ mmcsd_rw(struct mmcsd_part *part, struct bio *bp)
stop.mrq = &req;
req.stop = &stop;
}
MMCBUS_WAIT_FOR_REQUEST(mmcbr, dev, &req);
MMCBUS_WAIT_FOR_REQUEST(mmcbus, dev, &req);
if (req.cmd->error != MMC_ERR_NONE) {
if (ppsratecheck(&sc->log_time, &sc->log_count,
LOG_PPS))
@ -1149,12 +1149,12 @@ mmcsd_delete(struct mmcsd_part *part, struct bio *bp)
struct mmc_command cmd;
struct mmc_request req;
struct mmcsd_softc *sc;
device_t dev, mmcbr;
device_t dev, mmcbus;
u_int erase_sector, sz;
sc = part->sc;
dev = sc->dev;
mmcbr = sc->mmcbr;
mmcbus = sc->mmcbus;
block = bp->bio_pblkno;
sz = part->disk->d_sectorsize;
@ -1182,7 +1182,7 @@ mmcsd_delete(struct mmcsd_part *part, struct bio *bp)
* commands. Note that these latter don't use the data lines, so
* re-tuning shouldn't actually become necessary during erase.
*/
MMCBUS_RETUNE_PAUSE(mmcbr, dev, false);
MMCBUS_RETUNE_PAUSE(mmcbus, dev, false);
/* Set erase start position. */
memset(&req, 0, sizeof(req));
memset(&cmd, 0, sizeof(cmd));
@ -1196,7 +1196,7 @@ mmcsd_delete(struct mmcsd_part *part, struct bio *bp)
if (sc->high_cap == 0)
cmd.arg <<= 9;
cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
MMCBUS_WAIT_FOR_REQUEST(mmcbr, dev, &req);
MMCBUS_WAIT_FOR_REQUEST(mmcbus, dev, &req);
if (req.cmd->error != MMC_ERR_NONE) {
device_printf(dev, "Setting erase start position failed %d\n",
req.cmd->error);
@ -1216,7 +1216,7 @@ mmcsd_delete(struct mmcsd_part *part, struct bio *bp)
cmd.arg <<= 9;
cmd.arg--;
cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
MMCBUS_WAIT_FOR_REQUEST(mmcbr, dev, &req);
MMCBUS_WAIT_FOR_REQUEST(mmcbus, dev, &req);
if (req.cmd->error != MMC_ERR_NONE) {
device_printf(dev, "Setting erase stop position failed %d\n",
req.cmd->error);
@ -1230,7 +1230,7 @@ mmcsd_delete(struct mmcsd_part *part, struct bio *bp)
cmd.opcode = MMC_ERASE;
cmd.arg = 0;
cmd.flags = MMC_RSP_R1B | MMC_CMD_AC;
MMCBUS_WAIT_FOR_REQUEST(mmcbr, dev, &req);
MMCBUS_WAIT_FOR_REQUEST(mmcbus, dev, &req);
if (req.cmd->error != MMC_ERR_NONE) {
device_printf(dev, "erase err3: %d\n", req.cmd->error);
device_printf(dev, "Issuing erase command failed %d\n",
@ -1248,7 +1248,7 @@ mmcsd_delete(struct mmcsd_part *part, struct bio *bp)
}
block = end;
unpause:
MMCBUS_RETUNE_UNPAUSE(mmcbr, dev);
MMCBUS_RETUNE_UNPAUSE(mmcbus, dev);
return (block);
}
@ -1261,7 +1261,7 @@ mmcsd_dump(void *arg, void *virtual, vm_offset_t physical, off_t offset,
struct disk *disk;
struct mmcsd_softc *sc;
struct mmcsd_part *part;
device_t dev, mmcbr;
device_t dev, mmcbus;
int err;
/* length zero is special and really means flush buffers to media */
@ -1272,7 +1272,7 @@ mmcsd_dump(void *arg, void *virtual, vm_offset_t physical, off_t offset,
part = disk->d_drv1;
sc = part->sc;
dev = sc->dev;
mmcbr = sc->mmcbr;
mmcbus = sc->mmcbus;
g_reset_bio(&bp);
bp.bio_disk = disk;
@ -1281,16 +1281,16 @@ mmcsd_dump(void *arg, void *virtual, vm_offset_t physical, off_t offset,
bp.bio_data = virtual;
bp.bio_cmd = BIO_WRITE;
end = bp.bio_pblkno + bp.bio_bcount / disk->d_sectorsize;
MMCBUS_ACQUIRE_BUS(mmcbr, dev);
err = mmcsd_switch_part(mmcbr, dev, sc->rca, part->type);
MMCBUS_ACQUIRE_BUS(mmcbus, dev);
err = mmcsd_switch_part(mmcbus, dev, sc->rca, part->type);
if (err != MMC_ERR_NONE) {
if (ppsratecheck(&sc->log_time, &sc->log_count, LOG_PPS))
device_printf(dev, "Partition switch error\n");
MMCBUS_RELEASE_BUS(mmcbr, dev);
MMCBUS_RELEASE_BUS(mmcbus, dev);
return (EIO);
}
block = mmcsd_rw(part, &bp);
MMCBUS_RELEASE_BUS(mmcbr, dev);
MMCBUS_RELEASE_BUS(mmcbus, dev);
return ((end < block) ? EIO : 0);
}
@ -1301,13 +1301,13 @@ mmcsd_task(void *arg)
struct mmcsd_part *part;
struct mmcsd_softc *sc;
struct bio *bp;
device_t dev, mmcbr;
device_t dev, mmcbus;
int err, sz;
part = arg;
sc = part->sc;
dev = sc->dev;
mmcbr = sc->mmcbr;
mmcbus = sc->mmcbus;
while (1) {
MMCSD_DISK_LOCK(part);
@ -1327,11 +1327,11 @@ mmcsd_task(void *arg)
biodone(bp);
continue;
}
MMCBUS_ACQUIRE_BUS(mmcbr, dev);
MMCBUS_ACQUIRE_BUS(mmcbus, dev);
sz = part->disk->d_sectorsize;
block = bp->bio_pblkno;
end = bp->bio_pblkno + (bp->bio_bcount / sz);
err = mmcsd_switch_part(mmcbr, dev, sc->rca, part->type);
err = mmcsd_switch_part(mmcbus, dev, sc->rca, part->type);
if (err != MMC_ERR_NONE) {
if (ppsratecheck(&sc->log_time, &sc->log_count,
LOG_PPS))
@ -1347,7 +1347,7 @@ mmcsd_task(void *arg)
block = mmcsd_delete(part, bp);
}
release:
MMCBUS_RELEASE_BUS(mmcbr, dev);
MMCBUS_RELEASE_BUS(mmcbus, dev);
if (block < end) {
bp->bio_error = EIO;
bp->bio_resid = (end - block) * sz;