[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 04/19] libqos/ahci: Add command header helpers
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 04/19] libqos/ahci: Add command header helpers |
Date: |
Mon, 02 Feb 2015 11:27:10 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 |
On 30/01/2015 19:41, John Snow wrote:
> +/* Set the #cx'th command of port #px. */
> +void ahci_set_command_header(AHCIQState *ahci, uint8_t px,
> + uint8_t cx, AHCICommandHeader *cmd)
> +{
> + uint64_t ba = ahci->port[px].clb;
> + ba += cx * sizeof(AHCICommandHeader);
> +
> + cmd->flags = cpu_to_le16(cmd->flags);
> + cmd->prdtl = cpu_to_le16(cmd->prdtl);
> + cmd->prdbc = cpu_to_le32(cmd->prdbc);
> + cmd->ctba = cpu_to_le64(cmd->ctba);
Modifying cmd is uglyish, and especially it might hide bugs that only
happen on big endian system. Please copy to a local AHCICommandHeader
variable before adjusting for host endianness.
Paolo
> + memwrite(ba, cmd, sizeof(AHCICommandHeader));
> +}