Date: Thu, 8 Jul 1999 05:14:47 -0400 (EDT) From: Robert Watson <robert@cyrus.watson.org> To: James Van Vleet <vanvleet@vanvleet.net> Cc: freebsd-hardware@freebsd.org Subject: Re: AMD HomePNA card driver... Message-ID: <Pine.BSF.3.96.990707121801.13202B-100000@fledge.watson.org> In-Reply-To: <199907071509.KAA04157@dns1.sei-iss.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 7 Jul 1999, James Van Vleet wrote: > First of all, thanks for putting together support for this card. > I have it up and running using STABLE cvsuped from saturday and manually > patched. No problems with the card so far and I did quite a bit of > testing on the weekend. Some info for you: I was glad to do this--I'm making use of several of these in my machines in my home to link them over several floors. > 17.8 meg file, transfered at least 15 times per machine: > > Average throughput with FTP on Windows98 -> Windows NT 4.0 115.6 > K/s > > Average throughput with FTP on FreeBSD -> Windows NT 4.0 113.8 > K/s Unfortunately I'm on a different continent so don't have figures here right now. I won't be back for a couple of weeks, but I can assemble some figures. > No crashes, no broken connections. I would guess that the > difference may even be the way that the Windows FTP client times the > transfer compared with the FreeBSD FTP client. This test was over quite > a bit of phone line, as it was from the second floor of my house to my > detached garage. It's really quite a good system for me. I suspect my problem is some kind of interference in the frequency range used by the card. The cards work beautifully most of the day, but between 8:00pm and 2:00am they drop 50% of the packets, and not all the machines even see all the packets. I need to dig up an oscillascope and see what happens on the wire, but my belief is now that it is not my driver patches, although I'd still be interested in reports. Supposedly you can control the power level and speed used from software, so I may take a look at having the driver adaptively switch to low speed high power in the event of a certain frequency of losses. I'll be back in the US at the end of July/beginning of August, and will have time to look into it further then. > So what is the status of getting this committed? One thing that > was missing from the PR patches was the file/line for correctly > detecting the PCI ID of the card. I don't have the file name with me at > the moment, but I am sure that you know what I am taking about (unless > you got it working a differnt way! ;-) ) I'm not sure what the commit process is, other perhaps than leaving it in a pr for a while. I've cc'd this message to -hardware in case anyone is interested in committing the patches, or knows what to do with them. I'm attaching a more recent patch below, which may have more of what you are looking for. Again, since I'm out of town and not at a FreeBSD machine, this is hard to test :-). The code displays a fairly comprehensive error message in the event of a packet loss, as I was trying to pull up statistics using their manamagement interfeace (mii), unfortunately despite the datasheet's claim, it seems you can't access the statistics on this card. If you want to poke at it and see what you can do, that would be great. If not, I'll look some more when I get back. If I'm missing any files in the patch, let me know. Robert N M Watson robert@fledge.watson.org http://www.watson.org/~robert/ PGP key fingerprint: AF B5 5F FF A6 4A 79 37 ED 5F 55 E9 58 04 6A B1 TIS Labs at Network Associates, Computing Laboratory at Cambridge University Safeport Network Services Index: if_lnc.c =================================================================== RCS file: /home/ncvs/src/sys/i386/isa/if_lnc.c,v retrieving revision 1.60 diff -u -r1.60 if_lnc.c --- if_lnc.c 1999/05/09 23:24:47 1.60 +++ if_lnc.c 1999/06/05 04:59:49 @@ -151,6 +151,7 @@ "PCnet-PCI II", "PCnet-FAST", "PCnet-FAST+", + "PCnet-Home", }; static void lnc_setladrf __P((struct lnc_softc *sc)); @@ -226,6 +227,53 @@ return (inw(sc->bdp)); } +static __inline u_short +read_mii(struct lnc_softc *sc, u_short regnum) +{ + int preserverap; + u_short data, phy_addr, sh_phy_addr; + +#if 1 +#define PHY 1 +#else +#define PHY ((read_bcr(sc, BCR33) >> 5) & 0x1f) +#endif + + preserverap = inw(sc->rap); + data = read_bcr(sc, BCR32); + printf("read_mii: bcr32 %d\n", data); + data |= (1<<15); + write_bcr(sc, BCR32, data); + + phy_addr = read_bcr(sc, BCR33); + printf("read_mii: old bcr33 %d\n", phy_addr); + printf("read_mii: reading from phy %d, reg %d\n", + PHY, regnum); + sh_phy_addr = PHY << 5; + data = sh_phy_addr | (regnum & 0x1f); + write_bcr(sc, BCR33, data); + data = read_bcr(sc, BCR34); + /* data = read_bcr(sc, BCR34); */ +/* write_bcr(sc, BCR33, phy_addr); */ /* restore old? */ + + outw(sc->rap, preserverap); + return(data); +#undef PHY +} + +static __inline void +write_mii(struct lnc_softc *sc, u_short regnum, u_short value) +{ + u_short data, phy_addr, sh_phy_addr; + + phy_addr = read_bcr(sc, 33); + sh_phy_addr = ((phy_addr >> 5) & 0x1f) << 5; + data = sh_phy_addr | (regnum & 0x1f); + write_bcr(sc, 33, data); + write_bcr(sc, 34, value); + write_bcr(sc, 33, phy_addr); +} + static __inline u_long ether_crc(const u_char *ether_addr) { @@ -577,6 +625,17 @@ } /* Drop packet */ +#if 12345 + printf("lnc_rint: dropping packet\n"); + printf("lnc_rint: mii: reg0: %d; reg1: %d; reg16: %d; " + "reg17: %d, reg22: %d\n; reg25: %d\n", + read_mii(sc, 0), + read_mii(sc, 1), + read_mii(sc, 16), + read_mii(sc, 17), + read_mii(sc, 22), + read_mii(sc, 25)); +#endif LNCSTATS(rerr) sc->arpcom.ac_if.if_ierrors++; while (start_of_packet != sc->recv_next) { @@ -1192,7 +1251,13 @@ return (PCnet_FAST); case Am79C972: return (PCnet_FASTplus); + case Am79C978: + return (PCnet_Home); default: + if (bootverbose) + printf("pcnet_probe: unknown PCnet " + "type (%lx)\n", chip_id & + PART_MASK); break; } } @@ -1360,6 +1425,9 @@ } } else { + if (bootverbose) + printf("lnc_attach_ne2100_pci: sc->nic.ic = " + "%d, too low\n", sc->nic.ident); free(sc, M_DEVBUF); sc = NULL; } @@ -1490,6 +1558,24 @@ sc->pending_transmits = 0; /* Give the LANCE the physical address of the initialisation block */ + + if (sc->nic.ic == PCnet_Home) { + u_short media; + /* Set PHY_SEL to HomeRun */ +#ifdef DIAGNOSTIC + printf("lnc_init: setting PCnet_Home-specific register\n"); +#endif + media = read_bcr(sc, BCR49); +#ifdef DIAGNOSTIC + printf("lnc_init: old value %u\n", (u_int) media); +#endif + media &= ~3; + media |= 1; +#ifdef DIAGNOSTIC + printf("lnc_init: new value %u\n", (u_int) media); +#endif + write_bcr(sc, BCR49, media); + } write_csr(sc, CSR1, kvtop(sc->init_block)); write_csr(sc, CSR2, (kvtop(sc->init_block) >> 16) & 0xff); Index: if_lnc.h =================================================================== RCS file: /home/ncvs/src/sys/i386/isa/if_lnc.h,v retrieving revision 1.10 diff -u -r1.10 if_lnc.h --- if_lnc.h 1999/01/31 00:56:32 1.10 +++ if_lnc.h 1999/05/30 05:35:55 @@ -107,6 +107,7 @@ #define PCnet_PCI_II 8 /* Am79C970A */ #define PCnet_FAST 9 /* Am79C971 */ #define PCnet_FASTplus 10 /* Am79C972 */ +#define PCnet_Home 11 /* Am79C978 */ /* CSR88-89: Chip ID masks */ #define AMD_MASK 0x003 @@ -119,6 +120,7 @@ #define Am79C970A 0x2621 #define Am79C971 0x2623 #define Am79C972 0x2624 +#define Am79C978 0x2626 /* Board types */ #define UNKNOWN 0 Index: ic/Am7990.h =================================================================== RCS file: /home/ncvs/src/sys/i386/isa/ic/Am7990.h,v retrieving revision 1.2 diff -u -r1.2 Am7990.h --- Am7990.h 1995/05/30 08:03:30 1.2 +++ Am7990.h 1999/06/04 14:59:12 @@ -21,6 +21,10 @@ #define CSR1 1 #define CSR2 2 #define CSR3 3 +#define BCR49 49 +#define BCR32 32 +#define BCR33 33 +#define BCR34 34 #define CSR88 88 #define CSR89 89 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hardware" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.990707121801.13202B-100000>