aboutsummaryrefslogtreecommitdiff
path: root/hw/net
diff options
context:
space:
mode:
authorFinn Thain <fthain@telegraphics.com.au>2020-01-20 09:59:21 +1100
committerMichael Roth <mdroth@linux.vnet.ibm.com>2020-06-01 20:46:46 -0500
commiteb54a2f9cee10cf1c7832a3536a8d5980ec313e9 (patch)
treeffc1190e09bf8d493b91c3137eeaae0b1aaa4744 /hw/net
parentfa446ae444d7daa24971f74888771120de0b5f97 (diff)
downloadqemu-eb54a2f9cee10cf1c7832a3536a8d5980ec313e9.zip
qemu-eb54a2f9cee10cf1c7832a3536a8d5980ec313e9.tar.gz
qemu-eb54a2f9cee10cf1c7832a3536a8d5980ec313e9.tar.bz2
dp8393x: Mask EOL bit from descriptor addresses
The Least Significant bit of a descriptor address register is used as an EOL flag. It has to be masked when the register value is to be used as an actual address for copying memory around. But when the registers are to be updated the EOL bit should not be masked. Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Tested-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Jason Wang <jasowang@redhat.com> (cherry picked from commit 88f632fbb1b3d31d5b6978d28f8735a6ed18b8f5) Conflicts: hw/net/dp8393x.c *drop context dep. on 19f70347731 Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'hw/net')
-rw-r--r--hw/net/dp8393x.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c
index 3d991af..7ca6a6d 100644
--- a/hw/net/dp8393x.c
+++ b/hw/net/dp8393x.c
@@ -145,6 +145,9 @@ do { printf("sonic ERROR: %s: " fmt, __func__ , ## __VA_ARGS__); } while (0)
#define SONIC_ISR_PINT 0x0800
#define SONIC_ISR_LCD 0x1000
+#define SONIC_DESC_EOL 0x0001
+#define SONIC_DESC_ADDR 0xFFFE
+
#define TYPE_DP8393X "dp8393x"
#define DP8393X(obj) OBJECT_CHECK(dp8393xState, (obj), TYPE_DP8393X)
@@ -197,7 +200,8 @@ static uint32_t dp8393x_crba(dp8393xState *s)
static uint32_t dp8393x_crda(dp8393xState *s)
{
- return (s->regs[SONIC_URDA] << 16) | s->regs[SONIC_CRDA];
+ return (s->regs[SONIC_URDA] << 16) |
+ (s->regs[SONIC_CRDA] & SONIC_DESC_ADDR);
}
static uint32_t dp8393x_rbwc(dp8393xState *s)
@@ -217,7 +221,8 @@ static uint32_t dp8393x_tsa(dp8393xState *s)
static uint32_t dp8393x_ttda(dp8393xState *s)
{
- return (s->regs[SONIC_UTDA] << 16) | s->regs[SONIC_TTDA];
+ return (s->regs[SONIC_UTDA] << 16) |
+ (s->regs[SONIC_TTDA] & SONIC_DESC_ADDR);
}
static uint32_t dp8393x_wt(dp8393xState *s)
@@ -507,7 +512,7 @@ static void dp8393x_do_transmit_packets(dp8393xState *s)
(4 + 3 * s->regs[SONIC_TFC]) * width,
MEMTXATTRS_UNSPECIFIED, (uint8_t *)s->data, size, 0);
s->regs[SONIC_CTDA] = dp8393x_get(s, width, 0) & ~0x1;
- if (dp8393x_get(s, width, 0) & 0x1) {
+ if (dp8393x_get(s, width, 0) & SONIC_DESC_EOL) {
/* EOL detected */
break;
}
@@ -763,13 +768,13 @@ static ssize_t dp8393x_receive(NetClientState *nc, const uint8_t * buf,
/* XXX: Check byte ordering */
/* Check for EOL */
- if (s->regs[SONIC_LLFA] & 0x1) {
+ if (s->regs[SONIC_LLFA] & SONIC_DESC_EOL) {
/* Are we still in resource exhaustion? */
size = sizeof(uint16_t) * 1 * width;
address = dp8393x_crda(s) + sizeof(uint16_t) * 5 * width;
address_space_rw(&s->as, address, MEMTXATTRS_UNSPECIFIED,
(uint8_t *)s->data, size, 0);
- if (dp8393x_get(s, width, 0) & 0x1) {
+ if (dp8393x_get(s, width, 0) & SONIC_DESC_EOL) {
/* Still EOL ; stop reception */
return -1;
} else {
@@ -827,7 +832,7 @@ static ssize_t dp8393x_receive(NetClientState *nc, const uint8_t * buf,
address_space_rw(&s->as, dp8393x_crda(s) + sizeof(uint16_t) * 5 * width,
MEMTXATTRS_UNSPECIFIED, (uint8_t *)s->data, size, 0);
s->regs[SONIC_LLFA] = dp8393x_get(s, width, 0);
- if (s->regs[SONIC_LLFA] & 0x1) {
+ if (s->regs[SONIC_LLFA] & SONIC_DESC_EOL) {
/* EOL detected */
s->regs[SONIC_ISR] |= SONIC_ISR_RDE;
} else {