[Top][All Lists]

[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: John Snow
Subject: Re: [Qemu-devel] [PATCH 04/19] libqos/ahci: Add command header helpers
Date: Mon, 02 Feb 2015 15:38:35 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0

On 02/02/2015 05:27 AM, Paolo Bonzini wrote:

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.


+    memwrite(ba, cmd, sizeof(AHCICommandHeader));

You're right. I had just never actually thought to reference the command after committing it before, so I hadn't considered it in that light.

If I intend to share goodies with other tests it would be nice if they didn't do secretly evil things :)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]