* [Qemu-devel] [PATCH] pcnet: Avoid double conversion via PHYSADDR
@ 2009-04-07 17:33 Jan Kiszka
2009-04-08 22:59 ` Aurelien Jarno
0 siblings, 1 reply; 2+ messages in thread
From: Jan Kiszka @ 2009-04-07 17:33 UTC (permalink / raw)
To: qemu-devel
rdra and tdra are already kept converted in the pcnet state structure.
Avoid converting derivatives a second time. The same case with the local
variable xmit_cxda: it already contains a converted cxda address. This
issue only causes troubles when using the pcnet in 16-bit legacy mode.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
hw/pcnet.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/hw/pcnet.c b/hw/pcnet.c
index 15167ac..be68f28 100644
--- a/hw/pcnet.c
+++ b/hw/pcnet.c
@@ -964,11 +964,11 @@ static void pcnet_rdte_poll(PCNetState *s)
(BCR_SWSTYLE(s) ? 16 : 8 );
#endif
- CHECK_RMD(PHYSADDR(s,crda), bad);
+ CHECK_RMD(crda, bad);
if (!bad) {
- CHECK_RMD(PHYSADDR(s,nrda), bad);
+ CHECK_RMD(nrda, bad);
if (bad || (nrda == crda)) nrda = 0;
- CHECK_RMD(PHYSADDR(s,nnrd), bad);
+ CHECK_RMD(nnrd, bad);
if (bad || (nnrd == crda)) nnrd = 0;
s->csr[28] = crda & 0xffff;
@@ -980,11 +980,11 @@ static void pcnet_rdte_poll(PCNetState *s)
#ifdef PCNET_DEBUG
if (bad) {
printf("pcnet: BAD RMD RECORDS AFTER 0x" TARGET_FMT_plx "\n",
- PHYSADDR(s,crda));
+ crda);
}
} else {
printf("pcnet: BAD RMD RDA=0x" TARGET_FMT_plx "\n",
- PHYSADDR(s,crda));
+ crda);
#endif
}
}
@@ -1023,7 +1023,7 @@ static int pcnet_tdte_poll(PCNetState *s)
(CSR_XMTRL(s) - CSR_XMTRC(s)) *
(BCR_SWSTYLE(s) ? 16 : 8);
int bad = 0;
- CHECK_TMD(PHYSADDR(s, cxda),bad);
+ CHECK_TMD(cxda, bad);
if (!bad) {
if (CSR_CXDA(s) != cxda) {
s->csr[60] = s->csr[34];
@@ -1034,7 +1034,7 @@ static int pcnet_tdte_poll(PCNetState *s)
s->csr[34] = cxda & 0xffff;
s->csr[35] = cxda >> 16;
#ifdef PCNET_DEBUG_X
- printf("pcnet: BAD TMD XDA=0x%08x\n", PHYSADDR(s,cxda));
+ printf("pcnet: BAD TMD XDA=0x%08x\n", cxda);
#endif
}
}
@@ -1107,7 +1107,7 @@ static void pcnet_receive(void *opaque, const uint8_t *buf, int size)
nrda = s->rdra +
(CSR_RCVRL(s) - rcvrc) *
(BCR_SWSTYLE(s) ? 16 : 8 );
- RMDLOAD(&rmd, PHYSADDR(s,nrda));
+ RMDLOAD(&rmd, nrda);
if (GET_FIELD(rmd.status, RMDS, OWN)) {
#ifdef PCNET_DEBUG_RMD
printf("pcnet - scan buffer: RCVRC=%d PREV_RCVRC=%d\n",
@@ -1319,12 +1319,12 @@ static void pcnet_transmit(PCNetState *s)
} else
if (s->xmit_pos >= 0) {
struct pcnet_TMD tmd;
- TMDLOAD(&tmd, PHYSADDR(s,xmit_cxda));
+ TMDLOAD(&tmd, xmit_cxda);
SET_FIELD(&tmd.misc, TMDM, BUFF, 1);
SET_FIELD(&tmd.misc, TMDM, UFLO, 1);
SET_FIELD(&tmd.status, TMDS, ERR, 1);
SET_FIELD(&tmd.status, TMDS, OWN, 0);
- TMDSTORE(&tmd, PHYSADDR(s,xmit_cxda));
+ TMDSTORE(&tmd, xmit_cxda);
s->csr[0] |= 0x0200; /* set TINT */
if (!CSR_DXSUFLO(s)) {
s->csr[0] &= ~0x0010;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] pcnet: Avoid double conversion via PHYSADDR
2009-04-07 17:33 [Qemu-devel] [PATCH] pcnet: Avoid double conversion via PHYSADDR Jan Kiszka
@ 2009-04-08 22:59 ` Aurelien Jarno
0 siblings, 0 replies; 2+ messages in thread
From: Aurelien Jarno @ 2009-04-08 22:59 UTC (permalink / raw)
To: Jan Kiszka; +Cc: qemu-devel
On Tue, Apr 07, 2009 at 07:33:05PM +0200, Jan Kiszka wrote:
> rdra and tdra are already kept converted in the pcnet state structure.
> Avoid converting derivatives a second time. The same case with the local
> variable xmit_cxda: it already contains a converted cxda address. This
> issue only causes troubles when using the pcnet in 16-bit legacy mode.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
Thanks, applied.
> hw/pcnet.c | 20 ++++++++++----------
> 1 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/hw/pcnet.c b/hw/pcnet.c
> index 15167ac..be68f28 100644
> --- a/hw/pcnet.c
> +++ b/hw/pcnet.c
> @@ -964,11 +964,11 @@ static void pcnet_rdte_poll(PCNetState *s)
> (BCR_SWSTYLE(s) ? 16 : 8 );
> #endif
>
> - CHECK_RMD(PHYSADDR(s,crda), bad);
> + CHECK_RMD(crda, bad);
> if (!bad) {
> - CHECK_RMD(PHYSADDR(s,nrda), bad);
> + CHECK_RMD(nrda, bad);
> if (bad || (nrda == crda)) nrda = 0;
> - CHECK_RMD(PHYSADDR(s,nnrd), bad);
> + CHECK_RMD(nnrd, bad);
> if (bad || (nnrd == crda)) nnrd = 0;
>
> s->csr[28] = crda & 0xffff;
> @@ -980,11 +980,11 @@ static void pcnet_rdte_poll(PCNetState *s)
> #ifdef PCNET_DEBUG
> if (bad) {
> printf("pcnet: BAD RMD RECORDS AFTER 0x" TARGET_FMT_plx "\n",
> - PHYSADDR(s,crda));
> + crda);
> }
> } else {
> printf("pcnet: BAD RMD RDA=0x" TARGET_FMT_plx "\n",
> - PHYSADDR(s,crda));
> + crda);
> #endif
> }
> }
> @@ -1023,7 +1023,7 @@ static int pcnet_tdte_poll(PCNetState *s)
> (CSR_XMTRL(s) - CSR_XMTRC(s)) *
> (BCR_SWSTYLE(s) ? 16 : 8);
> int bad = 0;
> - CHECK_TMD(PHYSADDR(s, cxda),bad);
> + CHECK_TMD(cxda, bad);
> if (!bad) {
> if (CSR_CXDA(s) != cxda) {
> s->csr[60] = s->csr[34];
> @@ -1034,7 +1034,7 @@ static int pcnet_tdte_poll(PCNetState *s)
> s->csr[34] = cxda & 0xffff;
> s->csr[35] = cxda >> 16;
> #ifdef PCNET_DEBUG_X
> - printf("pcnet: BAD TMD XDA=0x%08x\n", PHYSADDR(s,cxda));
> + printf("pcnet: BAD TMD XDA=0x%08x\n", cxda);
> #endif
> }
> }
> @@ -1107,7 +1107,7 @@ static void pcnet_receive(void *opaque, const uint8_t *buf, int size)
> nrda = s->rdra +
> (CSR_RCVRL(s) - rcvrc) *
> (BCR_SWSTYLE(s) ? 16 : 8 );
> - RMDLOAD(&rmd, PHYSADDR(s,nrda));
> + RMDLOAD(&rmd, nrda);
> if (GET_FIELD(rmd.status, RMDS, OWN)) {
> #ifdef PCNET_DEBUG_RMD
> printf("pcnet - scan buffer: RCVRC=%d PREV_RCVRC=%d\n",
> @@ -1319,12 +1319,12 @@ static void pcnet_transmit(PCNetState *s)
> } else
> if (s->xmit_pos >= 0) {
> struct pcnet_TMD tmd;
> - TMDLOAD(&tmd, PHYSADDR(s,xmit_cxda));
> + TMDLOAD(&tmd, xmit_cxda);
> SET_FIELD(&tmd.misc, TMDM, BUFF, 1);
> SET_FIELD(&tmd.misc, TMDM, UFLO, 1);
> SET_FIELD(&tmd.status, TMDS, ERR, 1);
> SET_FIELD(&tmd.status, TMDS, OWN, 0);
> - TMDSTORE(&tmd, PHYSADDR(s,xmit_cxda));
> + TMDSTORE(&tmd, xmit_cxda);
> s->csr[0] |= 0x0200; /* set TINT */
> if (!CSR_DXSUFLO(s)) {
> s->csr[0] &= ~0x0010;
>
>
>
>
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-04-08 22:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-07 17:33 [Qemu-devel] [PATCH] pcnet: Avoid double conversion via PHYSADDR Jan Kiszka
2009-04-08 22:59 ` Aurelien Jarno
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).