On Wed, Aug 13, 2014 at 05:56:15PM -0400, John Snow wrote:
> +    /* Copy the existing Command #0 structure from the CLB into local memory,
> +     * and build a new command #0. */
> +    memread(clb, &cmd, sizeof(cmd));
> +    cmd.b1 = 5;    /* reg_h2d_fis is 5 double-words long */
> +    cmd.b2 = 0x04; /* clear PxTFD.STS.BSY when done */
> +    cmd.prdtl = 1; /* One PRD table entry. */

What about endianness?  This will be copied into guest memory, we should
use cpu_to_X() to ensure the correct endianness.

> +    cmd.prdbc = 0;
> +    cmd.ctba = table;
> +    cmd.ctbau = 0;
> +
> +    /* Construct our PRD, noting that DBC is 0-indexed. */
> +    prd.dba = data_ptr;

Endianness

> +    reg = px_rreg(i, AHCI_PX_TFD);
> +    g_assert_cmphex((reg & AHCI_PX_TFD_ERR), ==, pio->error);
> +    g_assert_cmphex((reg & AHCI_PX_TFD_STS), ==, pio->status);
> +    /* PIO FIS contains a "bytes read" field, it should match up. */
> +    g_assert_cmphex(pio->res4, ==, cmd.prdbc);

Endianness

Attachment: pgpbnKYjKYvFr.pgp
Description: PGP signature

Reply via email to