[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 07/18] hw/sd: sd: Fix incorrect populated function switch sta
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH 07/18] hw/sd: sd: Fix incorrect populated function switch status data structure |
Date: |
Sat, 15 Aug 2020 09:58:50 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 |
+Sai Pavan
On 8/14/20 6:40 PM, Bin Meng wrote:
> From: Bin Meng <bin.meng@windriver.com>
>
> At present the function switch status data structure bit [399:376]
> are wrongly pupulated. These 3 bytes encode function switch status
> for the 6 function groups, with 4 bits per group, starting from
> function group 6 at bit 399, then followed by function group 5 at
> bit 395, and so on.
>
> However the codes mistakenly fills in the function group 1 status
> at bit 399. This fixes the code logic.
>
Fixes: a1bb27b1e9 ("SD card emulation (initial implementation)")
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> ---
>
> hw/sd/sd.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/hw/sd/sd.c b/hw/sd/sd.c
> index fad9cf1..51f5900 100644
> --- a/hw/sd/sd.c
> +++ b/hw/sd/sd.c
> @@ -806,11 +806,15 @@ static void sd_function_switch(SDState *sd, uint32_t
> arg)
> sd->data[11] = 0x43;
> sd->data[12] = 0x80; /* Supported group 1 functions */
> sd->data[13] = 0x03;
> +
> + sd->data[14] = 0;
> + sd->data[15] = 0;
> + sd->data[16] = 0;
Pointless zero initialization.
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
I'll wait until next week in case Sai Pavan wants to test this
patch (I don't have access to the Xilinx images anymore) then
I'll queue this via my sd-next tree.
Regards,
Phil.
> for (i = 0; i < 6; i ++) {
> new_func = (arg >> (i * 4)) & 0x0f;
> if (mode && new_func != 0x0f)
> sd->function_group[i] = new_func;
> - sd->data[14 + (i >> 1)] = new_func << ((i * 4) & 4);
> + sd->data[16 - (i >> 1)] |= new_func << ((i % 2) * 4);
> }
> memset(&sd->data[17], 0, 47);
> stw_be_p(sd->data + 64, sd_crc16(sd->data, 64));
>
- Re: [PATCH 02/18] hw/riscv: hart: Add a new 'resetvec' property, (continued)
- [PATCH 03/18] target/riscv: cpu: Set reset vector based on the configured property value, Bin Meng, 2020/08/14
- [PATCH 04/18] hw/riscv: Initial support for Microchip PolarFire SoC Icicle Kit board, Bin Meng, 2020/08/14
- [PATCH 05/18] hw/char: Add Microchip PolarFire SoC MMUART emulation, Bin Meng, 2020/08/14
- [PATCH 06/18] hw/riscv: microchip_pfsoc: Connect 5 MMUARTs, Bin Meng, 2020/08/14
- [PATCH 07/18] hw/sd: sd: Fix incorrect populated function switch status data structure, Bin Meng, 2020/08/14
- Re: [PATCH 07/18] hw/sd: sd: Fix incorrect populated function switch status data structure,
Philippe Mathieu-Daudé <=
[PATCH 08/18] hw/sd: sd: Correctly set the high capacity bit, Bin Meng, 2020/08/14
[PATCH 09/18] hw/sd: sdhci: Make sdhci_poweron_reset() internal visible, Bin Meng, 2020/08/14