[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC 08/10] ahci: Check cmd_fis[1] more explicitly
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [RFC 08/10] ahci: Check cmd_fis[1] more explicitly |
Date: |
Sat, 13 Sep 2014 15:26:32 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 |
Il 13/09/2014 06:34, John Snow ha scritto:
> Instead of checking for a known byte, inspect the
> fields of this byte explicitly to produce more meaningful
> error messages and improve the readability of this section.
>
> Signed-off-by: John Snow <address@hidden>
> ---
> hw/ide/ahci.c | 23 ++++++++++++-----------
> 1 file changed, 12 insertions(+), 11 deletions(-)
>
> diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
> index 1153ce9..e4eae0c 100644
> --- a/hw/ide/ahci.c
> +++ b/hw/ide/ahci.c
> @@ -993,17 +993,18 @@ static int handle_cmd(AHCIState *s, int port, int slot)
> break;
> }
>
> - switch (cmd_fis[1]) {
> - case SATA_FIS_REG_H2D_UPDATE_COMMAND_REGISTER:
> - break;
> - case 0:
> - break;
> - default:
> - DPRINTF(port, "unknown command cmd_fis[0]=%02x cmd_fis[1]=%02x "
> - "cmd_fis[2]=%02x\n", cmd_fis[0], cmd_fis[1],
> - cmd_fis[2]);
> - goto out;
> - break;
> + if (cmd_fis[1] & 0x0F) {
> + DPRINTF(port, "Port Multiplier not supported."
> + " cmd_fis[0]=%02x cmd_fis[1]=%02x cmd_fis[2]=%02x\n",
> + cmd_fis[0], cmd_fis[1], cmd_fis[2]);
> + goto out;
> + }
> +
> + if (cmd_fis[1] & 0x70) {
> + DPRINTF(port, "Reserved flags set in H2D Register FIS."
> + " cmd_fis[0]=%02x cmd_fis[1]=%02x cmd_fis[2]=%02x\n",
> + cmd_fis[0], cmd_fis[1], cmd_fis[2]);
> + goto out;
> }
>
> if (!(cmd_fis[1] & SATA_FIS_REG_H2D_UPDATE_COMMAND_REGISTER)) {
>
Reviewed-by: Paolo Bonzini <address@hidden>
- [Qemu-devel] [RFC 01/10] ide: add is_write() macro for semantic consistency, (continued)
- [Qemu-devel] [RFC 01/10] ide: add is_write() macro for semantic consistency, John Snow, 2014/09/13
- [Qemu-devel] [RFC 06/10] AHCI: Fix FIS decomposition, John Snow, 2014/09/13
- [Qemu-devel] [RFC 07/10] ide/ahci: Reorder error cases in handle_cmd, John Snow, 2014/09/13
- [Qemu-devel] [RFC 10/10] AHCI: Fix SDB FIS Construction, John Snow, 2014/09/13
- [Qemu-devel] [RFC 09/10] ahci: factor out FIS decomposition, John Snow, 2014/09/13
- [Qemu-devel] [RFC 08/10] ahci: Check cmd_fis[1] more explicitly, John Snow, 2014/09/13
- Re: [Qemu-devel] [RFC 08/10] ahci: Check cmd_fis[1] more explicitly,
Paolo Bonzini <=