On 30/01/2015 19:42, John Snow wrote: > +void ahci_command_set_sizes(AHCICommand *cmd, uint64_t xbytes, > + unsigned prd_size) > +{ > + /* Each PRD can describe up to 4MiB, and must not be odd. */ > + g_assert_cmphex(prd_size, <=, 4096 * 1024); > + g_assert_cmphex(prd_size & 0x01, ==, 0x00); > + cmd->prd_size = prd_size; > + cmd->xbytes = xbytes; > + cmd->fis.count = cpu_to_le16(cmd->xbytes / AHCI_SECTOR_SIZE);
Why do you need cpu_to_le16 here, instead of having it in the function that writes the command to guest memory? Paolo > + cmd->header.prdtl = size_to_prdtl(cmd->xbytes, cmd->prd_size); > +} > +