From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50167) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YHGWV-0008FX-Ne for qemu-devel@nongnu.org; Fri, 30 Jan 2015 13:42:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YHGWU-000084-J2 for qemu-devel@nongnu.org; Fri, 30 Jan 2015 13:42:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34011) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YHGWU-00006c-Aa for qemu-devel@nongnu.org; Fri, 30 Jan 2015 13:42:30 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t0UIgT9S003404 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Fri, 30 Jan 2015 13:42:29 -0500 From: John Snow Date: Fri, 30 Jan 2015 13:42:07 -0500 Message-Id: <1422643333-27926-14-git-send-email-jsnow@redhat.com> In-Reply-To: <1422643333-27926-1-git-send-email-jsnow@redhat.com> References: <1422643333-27926-1-git-send-email-jsnow@redhat.com> Subject: [Qemu-devel] [PATCH 13/19] libqos/ahci: add ahci command size setters List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: famz@redhat.com, mst@redhat.com, armbru@redhat.com, stefanha@redhat.com, pbonzini@redhat.com, John Snow Adds setters for size, prd_size and both via set_sizes. Signed-off-by: John Snow --- tests/libqos/ahci.c | 22 ++++++++++++++++++++++ tests/libqos/ahci.h | 5 +++++ 2 files changed, 27 insertions(+) diff --git a/tests/libqos/ahci.c b/tests/libqos/ahci.c index 594c821..3375d54 100644 --- a/tests/libqos/ahci.c +++ b/tests/libqos/ahci.c @@ -648,6 +648,28 @@ void ahci_command_set_buffer(AHCICommand *cmd, uint64_t buffer) cmd->buffer = buffer; } +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); + cmd->header.prdtl = size_to_prdtl(cmd->xbytes, cmd->prd_size); +} + +void ahci_command_set_size(AHCICommand *cmd, uint64_t xbytes) +{ + ahci_command_set_sizes(cmd, xbytes, cmd->prd_size); +} + +void ahci_command_set_prd_size(AHCICommand *cmd, unsigned prd_size) +{ + ahci_command_set_sizes(cmd, cmd->xbytes, prd_size); +} + void ahci_command_commit(AHCIQState *ahci, AHCICommand *cmd, uint8_t px) { uint16_t i, prdtl; diff --git a/tests/libqos/ahci.h b/tests/libqos/ahci.h index 46b7bf3..1300967 100644 --- a/tests/libqos/ahci.h +++ b/tests/libqos/ahci.h @@ -531,6 +531,11 @@ void ahci_command_verify(AHCIQState *ahci, AHCICommand *cmd); void ahci_command_free(AHCICommand *cmd); /* Command adjustments */ void ahci_command_set_buffer(AHCICommand *cmd, uint64_t buffer); +void ahci_command_set_size(AHCICommand *cmd, uint64_t xbytes); +void ahci_command_set_prd_size(AHCICommand *cmd, unsigned prd_size); +void ahci_command_set_sizes(AHCICommand *cmd, uint64_t xbytes, + unsigned prd_size); uint8_t ahci_command_slot(AHCICommand *cmd); + #endif -- 1.9.3