Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/816632/?format=api
{ "id": 816632, "url": "http://patchwork.ozlabs.org/api/patches/816632/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170921012037.553-2-jsnow@redhat.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170921012037.553-2-jsnow@redhat.com>", "list_archive_url": null, "date": "2017-09-21T01:20:36", "name": "[1/2] ide: generic ide_data_read", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "7e11ddd14dfd804af25b9ca65ec5489582d58b74", "submitter": { "id": 64343, "url": "http://patchwork.ozlabs.org/api/people/64343/?format=api", "name": "John Snow", "email": "jsnow@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170921012037.553-2-jsnow@redhat.com/mbox/", "series": [ { "id": 4269, "url": "http://patchwork.ozlabs.org/api/series/4269/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=4269", "date": "2017-09-21T01:20:35", "name": "IDE: combine portio r/w functions", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/4269/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/816632/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/816632/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)", "ext-mx09.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com", "ext-mx09.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=jsnow@redhat.com" ], "Received": [ "from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xyJlG67t1z9s4q\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 21 Sep 2017 11:23:06 +1000 (AEST)", "from localhost ([::1]:51329 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1duqCn-0000yO-0A\n\tfor incoming@patchwork.ozlabs.org; Wed, 20 Sep 2017 21:23:05 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:40979)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <jsnow@redhat.com>) id 1duqAa-0008BT-De\n\tfor qemu-devel@nongnu.org; Wed, 20 Sep 2017 21:20:49 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <jsnow@redhat.com>) id 1duqAZ-00073a-1S\n\tfor qemu-devel@nongnu.org; Wed, 20 Sep 2017 21:20:48 -0400", "from mx1.redhat.com ([209.132.183.28]:46634)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <jsnow@redhat.com>)\n\tid 1duqAT-0006vy-SU; Wed, 20 Sep 2017 21:20:42 -0400", "from smtp.corp.redhat.com\n\t(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 01A9963E0E;\n\tThu, 21 Sep 2017 01:20:41 +0000 (UTC)", "from probe.bos.redhat.com (dhcp-17-130.bos.redhat.com\n\t[10.18.17.130])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 763FC60E3B;\n\tThu, 21 Sep 2017 01:20:40 +0000 (UTC)" ], "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 01A9963E0E", "From": "John Snow <jsnow@redhat.com>", "To": "qemu-block@nongnu.org", "Date": "Wed, 20 Sep 2017 21:20:36 -0400", "Message-Id": "<20170921012037.553-2-jsnow@redhat.com>", "In-Reply-To": "<20170921012037.553-1-jsnow@redhat.com>", "References": "<20170921012037.553-1-jsnow@redhat.com>", "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.12", "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.38]);\n\tThu, 21 Sep 2017 01:20:41 +0000 (UTC)", "X-detected-operating-system": "by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]", "X-Received-From": "209.132.183.28", "Subject": "[Qemu-devel] [PATCH 1/2] ide: generic ide_data_read", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.21", "Precedence": "list", "List-Id": "<qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<http://lists.nongnu.org/archive/html/qemu-devel/>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Cc": "John Snow <jsnow@redhat.com>, mark.cave-ayland@ilande.co.uk,\n\tqemu-devel@nongnu.org", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>" }, "content": "Signed-off-by: John Snow <jsnow@redhat.com>\n---\n hw/ide/core.c | 99 +++++++++++++++++++++--------------------------\n hw/ide/trace-events | 4 +-\n include/hw/ide/internal.h | 3 +-\n 3 files changed, 49 insertions(+), 57 deletions(-)", "diff": "diff --git a/hw/ide/core.c b/hw/ide/core.c\nindex a19bd90..393f523 100644\n--- a/hw/ide/core.c\n+++ b/hw/ide/core.c\n@@ -2266,6 +2266,49 @@ static bool ide_is_pio_out(IDEState *s)\n abort();\n }\n \n+uint32_t ide_data_read(void *opaque, uint32_t addr, short nbytes)\n+{\n+ IDEBus *bus = opaque;\n+ IDEState *s = idebus_active_if(bus);\n+ uint8_t *p;\n+ int ret;\n+\n+ g_assert(nbytes == 2 || nbytes == 4);\n+\n+ /* PIO data access allowed only when DRQ bit is set. The result of a read\n+ * during PIO in is indeterminate, return 0 and don't move forward. */\n+ if (!(s->status & DRQ_STAT) || !ide_is_pio_out(s)) {\n+ ret = 0;\n+ goto out;\n+ }\n+\n+ p = s->data_ptr;\n+ if (p + nbytes > s->data_end) {\n+ ret = 0;\n+ goto out;\n+ }\n+\n+ if (nbytes == 2) {\n+ ret = cpu_to_le16(*(uint16_t *)p);\n+ } else if (nbytes == 4) {\n+ ret = cpu_to_le32(*(uint32_t *)p);\n+ } else {\n+ ret = 0;\n+ goto out;\n+ }\n+\n+ p += nbytes;\n+ s->data_ptr = p;\n+ if (p >= s->data_end) {\n+ s->status &= ~DRQ_STAT;\n+ s->end_transfer_func(s);\n+ }\n+\n+ out:\n+ trace_ide_data_read(addr, nbytes, ret, bus, s);\n+ return ret;\n+}\n+\n void ide_data_writew(void *opaque, uint32_t addr, uint32_t val)\n {\n IDEBus *bus = opaque;\n@@ -2296,32 +2339,7 @@ void ide_data_writew(void *opaque, uint32_t addr, uint32_t val)\n \n uint32_t ide_data_readw(void *opaque, uint32_t addr)\n {\n- IDEBus *bus = opaque;\n- IDEState *s = idebus_active_if(bus);\n- uint8_t *p;\n- int ret;\n-\n- /* PIO data access allowed only when DRQ bit is set. The result of a read\n- * during PIO in is indeterminate, return 0 and don't move forward. */\n- if (!(s->status & DRQ_STAT) || !ide_is_pio_out(s)) {\n- return 0;\n- }\n-\n- p = s->data_ptr;\n- if (p + 2 > s->data_end) {\n- return 0;\n- }\n-\n- ret = cpu_to_le16(*(uint16_t *)p);\n- p += 2;\n- s->data_ptr = p;\n- if (p >= s->data_end) {\n- s->status &= ~DRQ_STAT;\n- s->end_transfer_func(s);\n- }\n-\n- trace_ide_data_readw(addr, ret, bus, s);\n- return ret;\n+ return ide_data_read(opaque, addr, 2);\n }\n \n void ide_data_writel(void *opaque, uint32_t addr, uint32_t val)\n@@ -2354,34 +2372,7 @@ void ide_data_writel(void *opaque, uint32_t addr, uint32_t val)\n \n uint32_t ide_data_readl(void *opaque, uint32_t addr)\n {\n- IDEBus *bus = opaque;\n- IDEState *s = idebus_active_if(bus);\n- uint8_t *p;\n- int ret;\n-\n- /* PIO data access allowed only when DRQ bit is set. The result of a read\n- * during PIO in is indeterminate, return 0 and don't move forward. */\n- if (!(s->status & DRQ_STAT) || !ide_is_pio_out(s)) {\n- ret = 0;\n- goto out;\n- }\n-\n- p = s->data_ptr;\n- if (p + 4 > s->data_end) {\n- return 0;\n- }\n-\n- ret = cpu_to_le32(*(uint32_t *)p);\n- p += 4;\n- s->data_ptr = p;\n- if (p >= s->data_end) {\n- s->status &= ~DRQ_STAT;\n- s->end_transfer_func(s);\n- }\n-\n-out:\n- trace_ide_data_readl(addr, ret, bus, s);\n- return ret;\n+ return ide_data_read(opaque, addr, 4);\n }\n \n static void ide_dummy_transfer_stop(IDEState *s)\ndiff --git a/hw/ide/trace-events b/hw/ide/trace-events\nindex 601bd97..e42c428 100644\n--- a/hw/ide/trace-events\n+++ b/hw/ide/trace-events\n@@ -7,10 +7,10 @@ ide_ioport_write(uint32_t addr, const char *reg, uint32_t val, void *bus, void *\n ide_status_read(uint32_t addr, uint32_t val, void *bus, void *s) \"IDE PIO rd @ 0x%\"PRIx32\" (Alt Status); val 0x%02\"PRIx32\"; bus %p; IDEState %p\"\n ide_cmd_write(uint32_t addr, uint32_t val, void *bus) \"IDE PIO wr @ 0x%\"PRIx32\" (Device Control); val 0x%02\"PRIx32\"; bus %p\"\n # Warning: verbose\n-ide_data_readw(uint32_t addr, uint32_t val, void *bus, void *s) \"IDE PIO rd @ 0x%\"PRIx32\" (Data: Word); val 0x%04\"PRIx32\"; bus %p; IDEState %p\"\n ide_data_writew(uint32_t addr, uint32_t val, void *bus, void *s) \"IDE PIO wr @ 0x%\"PRIx32\" (Data: Word); val 0x%04\"PRIx32\"; bus %p; IDEState %p\"\n-ide_data_readl(uint32_t addr, uint32_t val, void *bus, void *s) \"IDE PIO rd @ 0x%\"PRIx32\" (Data: Long); val 0x%08\"PRIx32\"; bus %p; IDEState %p\"\n ide_data_writel(uint32_t addr, uint32_t val, void *bus, void *s) \"IDE PIO wr @ 0x%\"PRIx32\" (Data: Long); val 0x%08\"PRIx32\"; bus %p; IDEState %p\"\n+ide_data_read(uint32_t addr, short nbytes, uint32_t val, void *bus, void *s) \"IDE PIO rd @ 0x%\"PRIx32\" (Data: %d bytes); val 0x%08\"PRIx32\"; bus %p; IDEState %p\"\n+\n # misc\n ide_exec_cmd(void *bus, void *state, uint32_t cmd) \"IDE exec cmd: bus %p; state %p; cmd 0x%02x\"\n ide_cancel_dma_sync_buffered(void *fn, void *req) \"invoking cb %p of buffered request %p with -ECANCELED\"\ndiff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h\nindex 180e00e..3159c66 100644\n--- a/include/hw/ide/internal.h\n+++ b/include/hw/ide/internal.h\n@@ -599,8 +599,9 @@ uint32_t ide_ioport_read(void *opaque, uint32_t addr1);\n uint32_t ide_status_read(void *opaque, uint32_t addr);\n void ide_cmd_write(void *opaque, uint32_t addr, uint32_t val);\n void ide_data_writew(void *opaque, uint32_t addr, uint32_t val);\n-uint32_t ide_data_readw(void *opaque, uint32_t addr);\n void ide_data_writel(void *opaque, uint32_t addr, uint32_t val);\n+uint32_t ide_data_read(void *opaque, uint32_t addr, short nbytes);\n+uint32_t ide_data_readw(void *opaque, uint32_t addr);\n uint32_t ide_data_readl(void *opaque, uint32_t addr);\n \n int ide_init_drive(IDEState *s, BlockBackend *blk, IDEDriveKind kind,\n", "prefixes": [ "1/2" ] }