From patchwork Tue Nov 5 16:38:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 21338 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f71.google.com (mail-oa0-f71.google.com [209.85.219.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A195C25E6D for ; Tue, 5 Nov 2013 16:38:46 +0000 (UTC) Received: by mail-oa0-f71.google.com with SMTP id j17sf2400764oag.6 for ; Tue, 05 Nov 2013 08:38:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=zjARmUCzBSpLwaA6y+wM21UzKn4OF8sbvLYe0fQsY8Q=; b=NQKubbwZxu3Yb6S6O7Q/eZZdUTJ49ZfZNnJ7Uh+gAzSfqgTOS1P0DnyJaw/FfqpMCB 8/VZFT0OmZAwJguQhG1miSyziFM9kEwpt7MU5QEgaVq+qgkjFrt9Hs0/HtXfF7qoEG65 NOHgO7Oiq+YfmcjLAbkAB9XvzTKX5+5vfS39Z8U3wix/XBaRLizuHyyG4DUijHuXfyBb D++/QuaoZpjwfiPoqT35/mjcVN3myFWveDBqy+UwMu6ePE6TWM8DqezoUQmAxgYIZuFp 4s2EKc86ZfSpj/D2G6k74Z1BsXWJ+4rTP/iYi/YhfQLqUjmz5nloqPiMssVne8WF2KtV wQEw== X-Gm-Message-State: ALoCoQkWYRNHCXEWbM2Fsy+XZhKxJtU9mHGqRwrW0rqgOWVFc9MRDW2LNSCxEzuOjW+7uf0p8ALs X-Received: by 10.182.104.200 with SMTP id gg8mr724483obb.45.1383669526241; Tue, 05 Nov 2013 08:38:46 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.3.106 with SMTP id b10ls255050qeb.40.gmail; Tue, 05 Nov 2013 08:38:46 -0800 (PST) X-Received: by 10.58.169.49 with SMTP id ab17mr53411vec.82.1383669526144; Tue, 05 Nov 2013 08:38:46 -0800 (PST) Received: from mail-ve0-f179.google.com (mail-ve0-f179.google.com [209.85.128.179]) by mx.google.com with ESMTPS id hs8si5418939veb.22.2013.11.05.08.38.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 05 Nov 2013 08:38:46 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.179; Received: by mail-ve0-f179.google.com with SMTP id cz12so2649482veb.38 for ; Tue, 05 Nov 2013 08:38:46 -0800 (PST) X-Received: by 10.220.164.202 with SMTP id f10mr6507496vcy.25.1383669526034; Tue, 05 Nov 2013 08:38:46 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp220005vcz; Tue, 5 Nov 2013 08:38:45 -0800 (PST) X-Received: by 10.66.26.49 with SMTP id i17mr8661050pag.148.1383669522321; Tue, 05 Nov 2013 08:38:42 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by mx.google.com with ESMTPS id ei3si14048678pbc.260.2013.11.05.08.38.41 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 05 Nov 2013 08:38:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1VdjeH-0006fj-IH; Tue, 05 Nov 2013 16:38:37 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: Anthony Liguori , patches@linaro.org, Kevin Wolf , Stefan Hajnoczi , "Michael S. Tsirkin" , Richard Henderson Subject: [PATCH v2 6/9] bswap.h: Remove cpu_to_be16wu() Date: Tue, 5 Nov 2013 16:38:34 +0000 Message-Id: <1383669517-25598-7-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1383669517-25598-1-git-send-email-peter.maydell@linaro.org> References: <1383669517-25598-1-git-send-email-peter.maydell@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Replace the legacy cpu_to_be16wu() with stw_be_p(). Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Michael S. Tsirkin --- hw/block/cdrom.c | 4 ++-- hw/ide/atapi.c | 16 ++++++++-------- hw/net/e1000.c | 19 ++++++++----------- include/qemu/bswap.h | 5 ----- 4 files changed, 18 insertions(+), 26 deletions(-) diff --git a/hw/block/cdrom.c b/hw/block/cdrom.c index 38469fa..5c69f34 100644 --- a/hw/block/cdrom.c +++ b/hw/block/cdrom.c @@ -77,7 +77,7 @@ int cdrom_read_toc(int nb_sectors, uint8_t *buf, int msf, int start_track) q += 4; } len = q - buf; - cpu_to_be16wu((uint16_t *)buf, len - 2); + stw_be_p(buf, len - 2); return len; } @@ -150,6 +150,6 @@ int cdrom_read_toc_raw(int nb_sectors, uint8_t *buf, int msf, int session_num) } len = q - buf; - cpu_to_be16wu((uint16_t *)buf, len - 2); + stw_be_p(buf, len - 2); return len; } diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c index 05e60b1..f7d2009 100644 --- a/hw/ide/atapi.c +++ b/hw/ide/atapi.c @@ -437,7 +437,7 @@ static int ide_dvd_read_structure(IDEState *s, int format, cpu_to_ube32(buf + 16, total_sectors - 1); /* l0 end sector */ /* Size of buffer, not including 2 byte size field */ - cpu_to_be16wu((uint16_t *)buf, 2048 + 2); + stw_be_p(buf, 2048 + 2); /* 2k data + 4 byte header */ return (2048 + 4); @@ -448,7 +448,7 @@ static int ide_dvd_read_structure(IDEState *s, int format, buf[5] = 0; /* no region restrictions */ /* Size of buffer, not including 2 byte size field */ - cpu_to_be16wu((uint16_t *)buf, 4 + 2); + stw_be_p(buf, 4 + 2); /* 4 byte header + 4 byte data */ return (4 + 4); @@ -458,7 +458,7 @@ static int ide_dvd_read_structure(IDEState *s, int format, case 0x04: /* DVD disc manufacturing information */ /* Size of buffer, not including 2 byte size field */ - cpu_to_be16wu((uint16_t *)buf, 2048 + 2); + stw_be_p(buf, 2048 + 2); /* 2k data + 4 byte header */ return (2048 + 4); @@ -471,22 +471,22 @@ static int ide_dvd_read_structure(IDEState *s, int format, buf[4] = 0x00; /* Physical format */ buf[5] = 0x40; /* Not writable, is readable */ - cpu_to_be16wu((uint16_t *)(buf + 6), 2048 + 4); + stw_be_p(buf + 6, 2048 + 4); buf[8] = 0x01; /* Copyright info */ buf[9] = 0x40; /* Not writable, is readable */ - cpu_to_be16wu((uint16_t *)(buf + 10), 4 + 4); + stw_be_p(buf + 10, 4 + 4); buf[12] = 0x03; /* BCA info */ buf[13] = 0x40; /* Not writable, is readable */ - cpu_to_be16wu((uint16_t *)(buf + 14), 188 + 4); + stw_be_p(buf + 14, 188 + 4); buf[16] = 0x04; /* Manufacturing info */ buf[17] = 0x40; /* Not writable, is readable */ - cpu_to_be16wu((uint16_t *)(buf + 18), 2048 + 4); + stw_be_p(buf + 18, 2048 + 4); /* Size of buffer, not including 2 byte size field */ - cpu_to_be16wu((uint16_t *)buf, 16 + 2); + stw_be_p(buf, 16 + 2); /* data written + 4 byte header */ return (16 + 4); diff --git a/hw/net/e1000.c b/hw/net/e1000.c index a5fb8fc..34ac625 100644 --- a/hw/net/e1000.c +++ b/hw/net/e1000.c @@ -528,8 +528,7 @@ putsum(uint8_t *data, uint32_t n, uint32_t sloc, uint32_t css, uint32_t cse) n = cse + 1; if (sloc < n-1) { sum = net_checksum_add(n-css, data+css); - cpu_to_be16wu((uint16_t *)(data + sloc), - net_checksum_finish(sum)); + stw_be_p(data + sloc, net_checksum_finish(sum)); } } @@ -590,13 +589,11 @@ xmit_seg(E1000State *s) DBGOUT(TXSUM, "frames %d size %d ipcss %d\n", frames, tp->size, css); if (tp->ip) { // IPv4 - cpu_to_be16wu((uint16_t *)(tp->data+css+2), - tp->size - css); - cpu_to_be16wu((uint16_t *)(tp->data+css+4), + stw_be_p(tp->data+css+2, tp->size - css); + stw_be_p(tp->data+css+4, be16_to_cpup((uint16_t *)(tp->data+css+4))+frames); } else // IPv6 - cpu_to_be16wu((uint16_t *)(tp->data+css+4), - tp->size - css); + stw_be_p(tp->data+css+4, tp->size - css); css = tp->tucss; len = tp->size - css; DBGOUT(TXSUM, "tcp %d tucss %d len %d\n", tp->tcp, css, len); @@ -607,14 +604,14 @@ xmit_seg(E1000State *s) if (tp->paylen - sofar > tp->mss) tp->data[css + 13] &= ~9; // PSH, FIN } else // UDP - cpu_to_be16wu((uint16_t *)(tp->data+css+4), len); + stw_be_p(tp->data+css+4, len); if (tp->sum_needed & E1000_TXD_POPTS_TXSM) { unsigned int phsum; // add pseudo-header length before checksum calculation sp = (uint16_t *)(tp->data + tp->tucso); phsum = be16_to_cpup(sp) + len; phsum = (phsum >> 16) + (phsum & 0xffff); - cpu_to_be16wu(sp, phsum); + stw_be_p(sp, phsum); } tp->tso_frames++; } @@ -684,9 +681,9 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp) if (vlan_enabled(s) && is_vlan_txd(txd_lower) && (tp->cptse || txd_lower & E1000_TXD_CMD_EOP)) { tp->vlan_needed = 1; - cpu_to_be16wu((uint16_t *)(tp->vlan_header), + stw_be_p(tp->vlan_header, le16_to_cpup((uint16_t *)(s->mac_reg + VET))); - cpu_to_be16wu((uint16_t *)(tp->vlan_header + 2), + stw_be_p(tp->vlan_header + 2, le16_to_cpu(dp->upper.fields.special)); } diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h index 9524931..3bb6b71 100644 --- a/include/qemu/bswap.h +++ b/include/qemu/bswap.h @@ -412,11 +412,6 @@ static inline void stfq_be_p(void *ptr, float64 v) /* Legacy unaligned versions. Note that we never had a complete set. */ -static inline void cpu_to_be16wu(uint16_t *p, uint16_t v) -{ - stw_be_p(p, v); -} - static inline void cpu_to_be32wu(uint32_t *p, uint32_t v) { stl_be_p(p, v);