aboutsummaryrefslogtreecommitdiff
path: root/hw/sd
diff options
context:
space:
mode:
authorBin Meng <bin.meng@windriver.com>2021-01-28 14:30:28 +0800
committerPhilippe Mathieu-Daudé <f4bug@amsat.org>2021-02-20 00:17:09 +0100
commitcdf6701bcc71331f8d0744c7f4c3cb309c71d541 (patch)
tree494d6174e4fb659c70450d5992e4c863eb1b7ba6 /hw/sd
parent1365d863a71803a8aac7922986c858ed4dedd826 (diff)
downloadqemu-cdf6701bcc71331f8d0744c7f4c3cb309c71d541.zip
qemu-cdf6701bcc71331f8d0744c7f4c3cb309c71d541.tar.gz
qemu-cdf6701bcc71331f8d0744c7f4c3cb309c71d541.tar.bz2
hw/sd: sd: Remove duplicated codes in single/multiple block read/write
The single block read (CMD17) codes are the same as the multiple block read (CMD18). Merge them into one. The same applies to single block write (CMD24) and multiple block write (CMD25). Signed-off-by: Bin Meng <bin.meng@windriver.com> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Acked-by: Alistair Francis <alistair.francis@wdc.com> Message-Id: <20210128063035.15674-3-bmeng.cn@gmail.com> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Diffstat (limited to 'hw/sd')
-rw-r--r--hw/sd/sd.c47
1 files changed, 0 insertions, 47 deletions
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 8517dbc..a85a821 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -1181,24 +1181,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
break;
case 17: /* CMD17: READ_SINGLE_BLOCK */
- switch (sd->state) {
- case sd_transfer_state:
-
- if (addr + sd->blk_len > sd->size) {
- sd->card_status |= ADDRESS_ERROR;
- return sd_r1;
- }
-
- sd->state = sd_sendingdata_state;
- sd->data_start = addr;
- sd->data_offset = 0;
- return sd_r1;
-
- default:
- break;
- }
- break;
-
case 18: /* CMD18: READ_MULTIPLE_BLOCK */
switch (sd->state) {
case sd_transfer_state:
@@ -1245,35 +1227,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
/* Block write commands (Class 4) */
case 24: /* CMD24: WRITE_SINGLE_BLOCK */
- switch (sd->state) {
- case sd_transfer_state:
- /* Writing in SPI mode not implemented. */
- if (sd->spi)
- break;
-
- if (addr + sd->blk_len > sd->size) {
- sd->card_status |= ADDRESS_ERROR;
- return sd_r1;
- }
-
- sd->state = sd_receivingdata_state;
- sd->data_start = addr;
- sd->data_offset = 0;
- sd->blk_written = 0;
-
- if (sd_wp_addr(sd, sd->data_start)) {
- sd->card_status |= WP_VIOLATION;
- }
- if (sd->csd[14] & 0x30) {
- sd->card_status |= WP_VIOLATION;
- }
- return sd_r1;
-
- default:
- break;
- }
- break;
-
case 25: /* CMD25: WRITE_MULTIPLE_BLOCK */
switch (sd->state) {
case sd_transfer_state: