Commit f1afe02aefb1eed1d1b4aa3e2a493ca8272515fb

Authored by aurel32
1 parent 2c7c13d4

pcnet: Avoid double conversion via PHYSADDR

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>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7049 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 10 additions and 10 deletions
hw/pcnet.c
... ... @@ -964,11 +964,11 @@ static void pcnet_rdte_poll(PCNetState *s)
964 964 (BCR_SWSTYLE(s) ? 16 : 8 );
965 965 #endif
966 966  
967   - CHECK_RMD(PHYSADDR(s,crda), bad);
  967 + CHECK_RMD(crda, bad);
968 968 if (!bad) {
969   - CHECK_RMD(PHYSADDR(s,nrda), bad);
  969 + CHECK_RMD(nrda, bad);
970 970 if (bad || (nrda == crda)) nrda = 0;
971   - CHECK_RMD(PHYSADDR(s,nnrd), bad);
  971 + CHECK_RMD(nnrd, bad);
972 972 if (bad || (nnrd == crda)) nnrd = 0;
973 973  
974 974 s->csr[28] = crda & 0xffff;
... ... @@ -980,11 +980,11 @@ static void pcnet_rdte_poll(PCNetState *s)
980 980 #ifdef PCNET_DEBUG
981 981 if (bad) {
982 982 printf("pcnet: BAD RMD RECORDS AFTER 0x" TARGET_FMT_plx "\n",
983   - PHYSADDR(s,crda));
  983 + crda);
984 984 }
985 985 } else {
986 986 printf("pcnet: BAD RMD RDA=0x" TARGET_FMT_plx "\n",
987   - PHYSADDR(s,crda));
  987 + crda);
988 988 #endif
989 989 }
990 990 }
... ... @@ -1023,7 +1023,7 @@ static int pcnet_tdte_poll(PCNetState *s)
1023 1023 (CSR_XMTRL(s) - CSR_XMTRC(s)) *
1024 1024 (BCR_SWSTYLE(s) ? 16 : 8);
1025 1025 int bad = 0;
1026   - CHECK_TMD(PHYSADDR(s, cxda),bad);
  1026 + CHECK_TMD(cxda, bad);
1027 1027 if (!bad) {
1028 1028 if (CSR_CXDA(s) != cxda) {
1029 1029 s->csr[60] = s->csr[34];
... ... @@ -1034,7 +1034,7 @@ static int pcnet_tdte_poll(PCNetState *s)
1034 1034 s->csr[34] = cxda & 0xffff;
1035 1035 s->csr[35] = cxda >> 16;
1036 1036 #ifdef PCNET_DEBUG_X
1037   - printf("pcnet: BAD TMD XDA=0x%08x\n", PHYSADDR(s,cxda));
  1037 + printf("pcnet: BAD TMD XDA=0x%08x\n", cxda);
1038 1038 #endif
1039 1039 }
1040 1040 }
... ... @@ -1107,7 +1107,7 @@ static void pcnet_receive(void *opaque, const uint8_t *buf, int size)
1107 1107 nrda = s->rdra +
1108 1108 (CSR_RCVRL(s) - rcvrc) *
1109 1109 (BCR_SWSTYLE(s) ? 16 : 8 );
1110   - RMDLOAD(&rmd, PHYSADDR(s,nrda));
  1110 + RMDLOAD(&rmd, nrda);
1111 1111 if (GET_FIELD(rmd.status, RMDS, OWN)) {
1112 1112 #ifdef PCNET_DEBUG_RMD
1113 1113 printf("pcnet - scan buffer: RCVRC=%d PREV_RCVRC=%d\n",
... ... @@ -1319,12 +1319,12 @@ static void pcnet_transmit(PCNetState *s)
1319 1319 } else
1320 1320 if (s->xmit_pos >= 0) {
1321 1321 struct pcnet_TMD tmd;
1322   - TMDLOAD(&tmd, PHYSADDR(s,xmit_cxda));
  1322 + TMDLOAD(&tmd, xmit_cxda);
1323 1323 SET_FIELD(&tmd.misc, TMDM, BUFF, 1);
1324 1324 SET_FIELD(&tmd.misc, TMDM, UFLO, 1);
1325 1325 SET_FIELD(&tmd.status, TMDS, ERR, 1);
1326 1326 SET_FIELD(&tmd.status, TMDS, OWN, 0);
1327   - TMDSTORE(&tmd, PHYSADDR(s,xmit_cxda));
  1327 + TMDSTORE(&tmd, xmit_cxda);
1328 1328 s->csr[0] |= 0x0200; /* set TINT */
1329 1329 if (!CSR_DXSUFLO(s)) {
1330 1330 s->csr[0] &= ~0x0010;
... ...