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.
Paolo
+ 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 :)