Received: from eggs.gnu.org ([2001:4830:134:3::10]:33657) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YR8C9-0007Ds-08 for qemu-devel@nongnu.org; Thu, 26 Feb 2015 18:50:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YR8C4-00050h-Cb for qemu-devel@nongnu.org; Thu, 26 Feb 2015 18:50:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51722) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YR8C4-00050P-4E for qemu-devel@nongnu.org; Thu, 26 Feb 2015 18:50:12 -0500 From: John Snow Date: Thu, 26 Feb 2015 18:49:59 -0500 Message-Id: <1424994606-32490-3-git-send-email-jsnow@redhat.com> In-Reply-To: <1424994606-32490-1-git-send-email-jsnow@redhat.com> References: <1424994606-32490-1-git-send-email-jsnow@redhat.com> Subject: [Qemu-devel] [PATCH v2 2/9] libqos/ahci: Fix sector set method List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, marc.mari.barcelo@gmail.com, mst@redhat.com, armbru@redhat.com, stefanha@redhat.com, pbonzini@redhat.com, John Snow || probably does not mean the same thing as |. Additionally, allow users to submit a prd_size of 0 to indicate that they'd like to continue using the default. Signed-off-by: John Snow --- tests/libqos/ahci.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/libqos/ahci.c b/tests/libqos/ahci.c index 5954ae4..a84e0c1 100644 --- a/tests/libqos/ahci.c +++ b/tests/libqos/ahci.c @@ -769,7 +769,7 @@ void ahci_command_set_offset(AHCICommand *cmd, uint64_t lba_sect) fis->lba_lo[1] = (lba_sect >> 8) & 0xFF; fis->lba_lo[2] = (lba_sect >> 16) & 0xFF; if (cmd->props->lba28) { - fis->device = (fis->device & 0xF0) || (lba_sect >> 24) & 0x0F; + fis->device = (fis->device & 0xF0) | ((lba_sect >> 24) & 0x0F); } fis->lba_hi[0] = (lba_sect >> 24) & 0xFF; fis->lba_hi[1] = (lba_sect >> 32) & 0xFF; @@ -787,7 +787,9 @@ void ahci_command_set_sizes(AHCICommand *cmd, uint64_t xbytes, /* 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; + if (prd_size) { + cmd->prd_size = prd_size; + } cmd->xbytes = xbytes; cmd->fis.count = (cmd->xbytes / AHCI_SECTOR_SIZE); cmd->header.prdtl = size_to_prdtl(cmd->xbytes, cmd->prd_size); -- 1.9.3