mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 02:24:58 -06:00
hw/sd/sdcard: Convert SEND_WRITE_PROT to generic_read_byte (CMD30)
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Tested-by: Cédric Le Goater <clg@redhat.com> Reviewed-by: Cédric Le Goater <clg@redhat.com> Message-Id: <20240628070216.92609-25-philmd@linaro.org>
This commit is contained in:
parent
060f0dac86
commit
2c67f8e707
1 changed files with 4 additions and 13 deletions
17
hw/sd/sd.c
17
hw/sd/sd.c
|
@ -1194,6 +1194,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
|
||||||
{
|
{
|
||||||
uint16_t rca;
|
uint16_t rca;
|
||||||
uint64_t addr;
|
uint64_t addr;
|
||||||
|
uint32_t data;
|
||||||
|
|
||||||
sd->last_cmd_name = sd_cmd_name(req.cmd);
|
sd->last_cmd_name = sd_cmd_name(req.cmd);
|
||||||
/* CMD55 precedes an ACMD, so we are not interested in tracing it.
|
/* CMD55 precedes an ACMD, so we are not interested in tracing it.
|
||||||
|
@ -1547,12 +1548,8 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
|
||||||
req.arg, sd->blk_len)) {
|
req.arg, sd->blk_len)) {
|
||||||
return sd_r1;
|
return sd_r1;
|
||||||
}
|
}
|
||||||
|
data = sd_wpbits(sd, req.arg);
|
||||||
sd->state = sd_sendingdata_state;
|
return sd_cmd_to_sendingdata(sd, req, addr, &data, sizeof(data));
|
||||||
stl_be_p(sd->data, sd_wpbits(sd, req.arg));
|
|
||||||
sd->data_start = addr;
|
|
||||||
sd->data_offset = 0;
|
|
||||||
return sd_r1;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -2132,6 +2129,7 @@ uint8_t sd_read_byte(SDState *sd)
|
||||||
case 10: /* CMD10: SEND_CID */
|
case 10: /* CMD10: SEND_CID */
|
||||||
case 17: /* CMD17: READ_SINGLE_BLOCK */
|
case 17: /* CMD17: READ_SINGLE_BLOCK */
|
||||||
case 19: /* CMD19: SEND_TUNING_BLOCK (SD) */
|
case 19: /* CMD19: SEND_TUNING_BLOCK (SD) */
|
||||||
|
case 30: /* CMD30: SEND_WRITE_PROT */
|
||||||
sd_generic_read_byte(sd, &ret);
|
sd_generic_read_byte(sd, &ret);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2173,13 +2171,6 @@ uint8_t sd_read_byte(SDState *sd)
|
||||||
sd->state = sd_transfer_state;
|
sd->state = sd_transfer_state;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 30: /* CMD30: SEND_WRITE_PROT */
|
|
||||||
ret = sd->data[sd->data_offset ++];
|
|
||||||
|
|
||||||
if (sd->data_offset >= 4)
|
|
||||||
sd->state = sd_transfer_state;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 51: /* ACMD51: SEND_SCR */
|
case 51: /* ACMD51: SEND_SCR */
|
||||||
ret = sd->scr[sd->data_offset ++];
|
ret = sd->scr[sd->data_offset ++];
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue