Module Name: src
Committed By: nisimura
Date: Tue Jan 11 09:45:25 UTC 2011
Modified Files:
src/sys/arch/sandpoint/stand/netboot: kse.c nvt.c pcn.c sip.c sme.c
wm.c
Log Message:
always have even numbered descriptors to avoid ones belong to Tx/Rx
share the same cacheline even for 32B cacheline CPU. These six are
provisional code stocks and untested.
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sandpoint/stand/netboot/kse.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/sandpoint/stand/netboot/nvt.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sandpoint/stand/netboot/pcn.c \
src/sys/arch/sandpoint/stand/netboot/sip.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/sandpoint/stand/netboot/sme.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/sandpoint/stand/netboot/wm.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/sandpoint/stand/netboot/kse.c
diff -u src/sys/arch/sandpoint/stand/netboot/kse.c:1.4 src/sys/arch/sandpoint/stand/netboot/kse.c:1.5
--- src/sys/arch/sandpoint/stand/netboot/kse.c:1.4 Sun May 2 13:36:30 2010
+++ src/sys/arch/sandpoint/stand/netboot/kse.c Tue Jan 11 09:45:25 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: kse.c,v 1.4 2010/05/02 13:36:30 phx Exp $ */
+/* $NetBSD: kse.c,v 1.5 2011/01/11 09:45:25 nisimura Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -100,10 +100,10 @@
#define FRAMESIZE 1536
struct local {
- struct desc txd;
+ struct desc txd[2];
struct desc rxd[2];
uint8_t rxstore[2][FRAMESIZE];
- unsigned csr, rx;
+ unsigned csr, tx, rx;
};
static void mii_dealan(struct local *, unsigned);
@@ -162,7 +162,7 @@
printf("\n");
}
- txd = &l->txd;
+ txd = &l->txd[0];
rxd = &l->rxd[0];
rxd[0].xd0 = htole32(R0_OWN);
rxd[0].xd1 = htole32(FRAMESIZE);
@@ -172,7 +172,7 @@
rxd[1].xd1 = htole32(R1_RER | FRAMESIZE);
rxd[1].xd2 = htole32(VTOPHYS(l->rxstore[1]));
rxd[1].xd3 = htole32(VTOPHYS(&rxd[0]));
- l->rx = 0;
+ l->tx = l->rx = 0;
CSR_WRITE_4(l, TDLB, VTOPHYS(txd));
CSR_WRITE_4(l, RDLB, VTOPHYS(rxd));
@@ -191,7 +191,7 @@
unsigned txstat, loop;
wbinv(buf, len);
- txd = &l->txd;
+ txd = &l->txd[l->tx];
txd->xd2 = htole32(VTOPHYS(buf));
txd->xd1 = htole32(T1_FS | T1_LS | (len & T1_TBS_MASK));
txd->xd0 = htole32(T0_OWN);
@@ -208,6 +208,7 @@
printf("xmit failed\n");
return -1;
done:
+ l->tx ^= 1;
return len;
}
Index: src/sys/arch/sandpoint/stand/netboot/nvt.c
diff -u src/sys/arch/sandpoint/stand/netboot/nvt.c:1.18 src/sys/arch/sandpoint/stand/netboot/nvt.c:1.19
--- src/sys/arch/sandpoint/stand/netboot/nvt.c:1.18 Sun May 2 13:36:30 2010
+++ src/sys/arch/sandpoint/stand/netboot/nvt.c Tue Jan 11 09:45:25 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: nvt.c,v 1.18 2010/05/02 13:36:30 phx Exp $ */
+/* $NetBSD: nvt.c,v 1.19 2011/01/11 09:45:25 nisimura Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -139,10 +139,10 @@
#define FRAMESIZE 1536
struct local {
- struct desc txd;
+ struct desc txd[2];
struct desc rxd[2];
uint8_t rxstore[2][FRAMESIZE];
- unsigned csr, rx;
+ unsigned csr, tx, rx;
unsigned phy, bmsr, anlpar;
unsigned ctl0;
};
@@ -210,7 +210,7 @@
printf("-FDX");
printf("\n");
- txd = &l->txd;
+ txd = &l->txd[0];
rxd = &l->rxd[0];
rxd[0].xd0 = htole32(R0_OWN);
rxd[0].xd1 = htole32(FRAMESIZE << 16);
@@ -221,7 +221,7 @@
rxd[1].xd2 = htole32(FRAMESIZE << 16);
rxd[1].xd3 = htole32(VTOPHYS(&rxd[0]));
wbinv(l, sizeof(struct local));
- l->rx = 0;
+ l->tx = l->rx = 0;
/* enable transmitter and receiver */
l->ctl0 = CTL0_TXON | CTL0_RXON | CTL0_START;
@@ -250,7 +250,7 @@
if (len < 60)
len = 60; /* needs to stretch to ETHER_MIN_LEN - 4 */
wbinv(buf, len);
- txd = &l->txd;
+ txd = &l->txd[l->tx];
txd->xd3 = htole32(txd);
txd->xd2 = htole32(VTOPHYS(buf));
txd->xd1 = htole32(T1_STP | T1_EDP | len);
@@ -267,6 +267,7 @@
printf("xmit failed\n");
return -1;
done:
+ l->tx ^= 1;
return len;
}
Index: src/sys/arch/sandpoint/stand/netboot/pcn.c
diff -u src/sys/arch/sandpoint/stand/netboot/pcn.c:1.17 src/sys/arch/sandpoint/stand/netboot/pcn.c:1.18
--- src/sys/arch/sandpoint/stand/netboot/pcn.c:1.17 Sun May 2 13:36:30 2010
+++ src/sys/arch/sandpoint/stand/netboot/pcn.c Tue Jan 11 09:45:25 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pcn.c,v 1.17 2010/05/02 13:36:30 phx Exp $ */
+/* $NetBSD: pcn.c,v 1.18 2011/01/11 09:45:25 nisimura Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -116,10 +116,10 @@
#define FRAMESIZE 1536
struct local {
- struct desc txd;
+ struct desc txd[2];
struct desc rxd[2];
uint8_t rxstore[2][FRAMESIZE];
- unsigned csr, rx;
+ unsigned csr, tx, rx;
unsigned phy, bmsr, anlpar;
};
@@ -179,13 +179,13 @@
printf("-FDX");
printf("\n");
- txd = &l->txd;
+ txd = &l->txd[0];
rxd = &l->rxd[0];
rxd[0].xd0 = htole32(VTOPHYS(l->rxstore[0]));
rxd[0].xd1 = htole32(R1_OWN | R1_ONES | FRAMESIZE);
rxd[1].xd0 = htole32(VTOPHYS(l->rxstore[1]));
rxd[1].xd1 = htole32(R1_OWN | R1_ONES | FRAMESIZE);
- l->rx = 0;
+ l->tx = l->rx = 0;
ib = &initblock;
ib->init_mode = htole32((0 << 28) | (1 << 20) | 0);
@@ -226,8 +226,8 @@
int tlen;
wbinv(buf, len);
+ txd = &l->txd[l->tx];
tlen = (-len) & T1_FLMASK; /* two's complement */
- txd = &l->txd;
txd->xd0 = htole32(VTOPHYS(buf));
txd->xd1 = htole32(T1_OWN | T1_STP | T1_ENP | T1_ONES | tlen);
wbinv(txd, sizeof(struct desc));
@@ -242,6 +242,7 @@
printf("xmit failed\n");
return -1;
done:
+ l->tx ^= 1;
return len;
}
Index: src/sys/arch/sandpoint/stand/netboot/sip.c
diff -u src/sys/arch/sandpoint/stand/netboot/sip.c:1.17 src/sys/arch/sandpoint/stand/netboot/sip.c:1.18
--- src/sys/arch/sandpoint/stand/netboot/sip.c:1.17 Sun May 2 13:36:31 2010
+++ src/sys/arch/sandpoint/stand/netboot/sip.c Tue Jan 11 09:45:25 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: sip.c,v 1.17 2010/05/02 13:36:31 phx Exp $ */
+/* $NetBSD: sip.c,v 1.18 2011/01/11 09:45:25 nisimura Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -98,10 +98,10 @@
#define FRAMESIZE 1536
struct local {
- struct desc txd;
+ struct desc txd[2];
struct desc rxd[2];
uint8_t store[2][FRAMESIZE];
- unsigned csr, rx;
+ unsigned csr, tx, rx;
unsigned phy, bmsr, anlpar;
unsigned cr;
};
@@ -191,7 +191,7 @@
printf("-FDX");
printf("\n");
- txd = &l->txd;
+ txd = &l->txd[0];
txd->xd0 = htole32(VTOPHYS(txd));
rxd = l->rxd;
rxd[0].xd0 = htole32(VTOPHYS(&rxd[1]));
@@ -201,7 +201,7 @@
rxd[1].xd1 = htole32(XD1_OWN | FRAMESIZE);
rxd[1].xd2 = htole32(VTOPHYS(l->store[1]));
wbinv(l, sizeof(struct local));
- l->rx = 0;
+ l->tx = l->rx = 0;
CSR_WRITE(l, SIP_RFCR, 0);
CSR_WRITE(l, SIP_RFDR, (en[1] << 8) | en[0]);
@@ -235,7 +235,7 @@
unsigned loop;
wbinv(buf, len);
- txd = &l->txd;
+ txd = &l->txd[l->tx];
txd->xd2 = htole32(VTOPHYS(buf));
txd->xd1 = htole32(XD1_OWN | (len & 0xfff));
wbinv(txd, sizeof(struct desc));
@@ -250,6 +250,7 @@
printf("xmit failed\n");
return -1;
done:
+ l->tx ^= 1;
return len;
}
Index: src/sys/arch/sandpoint/stand/netboot/sme.c
diff -u src/sys/arch/sandpoint/stand/netboot/sme.c:1.3 src/sys/arch/sandpoint/stand/netboot/sme.c:1.4
--- src/sys/arch/sandpoint/stand/netboot/sme.c:1.3 Sun May 2 13:36:31 2010
+++ src/sys/arch/sandpoint/stand/netboot/sme.c Tue Jan 11 09:45:25 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: sme.c,v 1.3 2010/05/02 13:36:31 phx Exp $ */
+/* $NetBSD: sme.c,v 1.4 2011/01/11 09:45:25 nisimura Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -91,10 +91,10 @@
#define FRAMESIZE 1536
struct local {
- struct desc txd;
+ struct desc txd[2];
struct desc rxd[2];
uint8_t rxstore[2][FRAMESIZE];
- unsigned csr, rx;
+ unsigned csr, tx, rx;
unsigned phy, bmsr, anlpar;
};
@@ -154,7 +154,7 @@
printf("-FDX");
printf("\n");
- txd = &l->txd;
+ txd = &l->txd[0];
rxd = &l->rxd[0];
rxd[0].xd0 = htole32(R0_OWN);
rxd[0].xd1 = htole32(R1_RCH | FRAMESIZE);
@@ -164,7 +164,7 @@
rxd[1].xd1 = htole32(R1_RER | FRAMESIZE);
rxd[1].xd2 = htole32(VTOPHYS(l->rxstore[1]));
/* R1_RER neglects xd3 */
- l->rx = 0;
+ l->tx = l->rx = 0;
wbinv(l, sizeof(struct local));
@@ -190,7 +190,7 @@
/* send a single frame with no T1_TER|T1_TCH designation */
wbinv(buf, len);
- txd = &l->txd;
+ txd = &l->txd[l->tx];
txd->xd2 = htole32(VTOPHYS(buf));
txd->xd1 = htole32(T1_FS | T1_LS | (len & T1_FL));
txd->xd0 = htole32(T0_OWN | (len & T0_FL) << 16);
@@ -209,6 +209,7 @@
printf("xmit failed\n");
return -1;
done:
+ l->tx ^= 1;
return len;
}
Index: src/sys/arch/sandpoint/stand/netboot/wm.c
diff -u src/sys/arch/sandpoint/stand/netboot/wm.c:1.11 src/sys/arch/sandpoint/stand/netboot/wm.c:1.12
--- src/sys/arch/sandpoint/stand/netboot/wm.c:1.11 Sun May 2 13:36:31 2010
+++ src/sys/arch/sandpoint/stand/netboot/wm.c Tue Jan 11 09:45:25 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: wm.c,v 1.11 2010/05/02 13:36:31 phx Exp $ */
+/* $NetBSD: wm.c,v 1.12 2011/01/11 09:45:25 nisimura Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -104,10 +104,10 @@
#define FRAMESIZE 1536
struct local {
- struct tdesc txd;
+ struct tdesc txd[2];
struct rdesc rxd[2];
uint8_t rxstore[2][FRAMESIZE];
- unsigned csr, rx;
+ unsigned csr, tx, rx;
unsigned ctl, tctl, rctl;
unsigned phy, bmsr, anlpar;
int sromsft;
@@ -175,7 +175,7 @@
printf("-FDX");
printf("\n");
- txd = &l->txd;
+ txd = &l->txd[0];
rxd = &l->rxd[0];
rxd[0].lo = htole32(VTOPHYS(l->rxstore[0]));
rxd[0].r2 = 0;
@@ -183,10 +183,10 @@
rxd[1].lo = htole32(VTOPHYS(l->rxstore[1]));
rxd[1].r2 = 0;
rxd[0].r3 = 0;
- l->rx = 0;
+ l->tx = l->rx = 0;
- CSR_WRITE(l, WMREG_TBDAH, 0);
- CSR_WRITE(l, WMREG_TBDAL, VTOPHYS(txd));
+ CSR_WRITE(l, WMREG_TDBAH, 0);
+ CSR_WRITE(l, WMREG_TDBAL, VTOPHYS(txd));
CSR_WRITE(l, WMREG_TDLEN, sizeof(l->txd));
CSR_WRITE(l, WMREG_TDH, 0);
CSR_WRITE(l, WMREG_TDT, 0);
@@ -227,7 +227,7 @@
unsigned loop;
wbinv(buf, len);
- txd = &l->txd;
+ txd = &l->txd[l->tx];
txd->lo = htole32(VTOPHYS(buf));
txd->t2 = htole32(T2_EOP|T2_IFCS|T2_RS | (len & T2_FLMASK));
txd->t3 = 0;
@@ -243,6 +243,7 @@
printf("xmit failed\n");
return -1;
done:
+ l->tx ^= 1;
return len;
}