From owner-freebsd-hackers Sun Jan 14 16:50:26 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from guild.plethora.net (guild.plethora.net [205.166.146.8]) by hub.freebsd.org (Postfix) with ESMTP id 165B637B400 for ; Sun, 14 Jan 2001 16:50:06 -0800 (PST) Received: from guild.plethora.net (seebs@localhost.plethora.net [127.0.0.1]) by guild.plethora.net (8.10.1/8.10.1) with ESMTP id f0F0o0W21693 for ; Sun, 14 Jan 2001 18:50:00 -0600 (CST) Message-Id: <200101150050.f0F0o0W21693@guild.plethora.net> From: seebs@plethora.net (Peter Seebach) To: freebsd-hackers@freebsd.org Reply-To: seebs@plethora.net (Peter Seebach) Subject: VirtualPC 4 and FreeBSD - together at last! Date: Sun, 14 Jan 2001 18:49:59 -0600 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I lack the focus or motivation to pursue this much further, but I have VPC 4 successfully booting FreeBSD 4.2, finding the ethernet card, and configuring it and pinging. The following hacks seem to fix it. (Note: The "if_de" hacks are, as a casual reader will note, mostly not necessary, since a lot of the changes only apply to VPC 3.x. However, it comes up and pings, so I don't care.) It might be useful to pursue adding this; I don't know that any other devices require patches to work, but I haven't tried X yet. *** pcibus.c.orig Sun Jan 14 02:40:46 2001 --- pcibus.c Sun Jan 14 02:41:26 2001 *************** *** 36,41 **** --- 36,43 ---- #include #include + #include + static int cfgmech; static int devmax; *************** *** 208,214 **** printf("pci_open(1a):\tmode1res=0x%08lx (0x%08lx)\n", mode1res, CONF1_ENABLE_CHK); ! if (mode1res) { if (pci_cfgcheck(32)) return (cfgmech); } --- 210,216 ---- printf("pci_open(1a):\tmode1res=0x%08lx (0x%08lx)\n", mode1res, CONF1_ENABLE_CHK); ! if (mode1res || !strcmp(cpu_vendor, "ConnectixCPU")) { if (pci_cfgcheck(32)) return (cfgmech); } *** if_de.c.safe Sun Jan 14 18:01:28 2001 --- if_de.c Sun Jan 14 18:18:54 2001 *************** *** 1,3 **** --- 1,5 ---- + #define VPC_CPU + int cpu_is_vpc = 4; /* $NetBSD: if_de.c,v 1.86 1999/06/01 19:17:59 thorpej Exp $ */ /* $FreeBSD: src/sys/pci/if_de.c,v 1.123.2.4 2000/08/04 23:25:09 peter Exp $ */ *************** *** 138,143 **** --- 140,148 ---- static int tulip_mii_map_abilities(tulip_softc_t * const sc, unsigned abilities); static tulip_media_t tulip_mii_phy_readspecific(tulip_softc_t * const sc); static int tulip_srom_decode(tulip_softc_t * const sc); + #ifdef VPC_CPU + static void tulip_initring(tulip_softc_t * const sc, tulip_ringinfo_t * const ri, tulip_desc_t *descs, int ndescs); + #endif static int tulip_ifmedia_change(struct ifnet * const ifp); static void tulip_ifmedia_status(struct ifnet * const ifp, struct ifmediareq *req); /* static void tulip_21140_map_media(tulip_softc_t *sc); */ *************** *** 3832,3837 **** --- 3837,3847 ---- TULIP_PERFSTART(intr) u_int32_t csr; + #ifdef VPC_CPU + if (cpu_is_vpc == 3) + TULIP_CSR_WRITE(sc, csr_intr, 0); + #endif + while ((csr = TULIP_CSR_READ(sc, csr_status)) & sc->tulip_intrmask) { *progress_p = 1; TULIP_CSR_WRITE(sc, csr_status, csr); *************** *** 3890,3895 **** --- 3900,3915 ---- TULIP_CSR_WRITE(sc, csr_command, sc->tulip_cmdmode); } } + #ifdef VPC_CPU + if (cpu_is_vpc) { + if (csr & TULIP_STS_TXINTR) + tulip_tx_intr(sc); + /* VirtualPC seems to spuriously set this bit. */ + if (csr & TULIP_STS_TXSTOPPED) { + csr &= ~(TULIP_STS_TXSTOPPED | TULIP_STS_ABNRMLINTR); + } + } + #endif if (csr & TULIP_STS_ABNRMLINTR) { u_int32_t tmp = csr & sc->tulip_intrmask & ~(TULIP_STS_NORMALINTR|TULIP_STS_ABNRMLINTR); *************** *** 3916,3921 **** --- 3936,3947 ---- tulip_ifstart(&sc->tulip_if); } } + #ifdef VPC_CPU + if (cpu_is_vpc == 3) { + sc->tulip_intrmask |= TULIP_STS_ABNRMLINTR; + TULIP_CSR_WRITE(sc, csr_intr, sc->tulip_intrmask); + } + #endif if (sc->tulip_flags & TULIP_NEEDRESET) { tulip_reset(sc); tulip_init(sc); *************** *** 4490,4498 **** --- 4516,4535 ---- sc->tulip_flags ^= TULIP_WANTSETUP|TULIP_DOINGSETUP; ri->ri_free--; nextout = ri->ri_nextout; + #ifdef VPC + if (cpu_is_vpc == 3) { + nextout->d_flag &= TULIP_DFLAG_ENDRING|TULIP_DFLAG_CHAIN; + nextout->d_flag |= TULIP_DFLAG_TxSETUPPKT; + } else { + nextout->d_flag &= TULIP_DFLAG_ENDRING|TULIP_DFLAG_CHAIN; + nextout->d_flag |= TULIP_DFLAG_TxFIRSTSEG|TULIP_DFLAG_TxLASTSEG + |TULIP_DFLAG_TxSETUPPKT|TULIP_DFLAG_TxWANTINTR; + } + #else nextout->d_flag &= TULIP_DFLAG_ENDRING|TULIP_DFLAG_CHAIN; nextout->d_flag |= TULIP_DFLAG_TxFIRSTSEG|TULIP_DFLAG_TxLASTSEG |TULIP_DFLAG_TxSETUPPKT|TULIP_DFLAG_TxWANTINTR; + #endif if (sc->tulip_flags & TULIP_WANTHASHPERFECT) nextout->d_flag |= TULIP_DFLAG_TxHASHFILT; else if (sc->tulip_flags & TULIP_WANTHASHONLY) *************** *** 4533,4542 **** --- 4570,4602 ---- */ TULIP_TXDESC_PRESYNC(sc, nextout, sizeof(u_int32_t)); TULIP_CSR_WRITE(sc, csr_txpoll, 1); + #ifdef VPC_CPU + if (cpu_is_vpc == 3) { + while (nextout->d_status & TULIP_DSTS_OWNER) + ; /* nasty spin-wait */ + TULIP_TXMAP_POSTSYNC(sc, sc->tulip_setupmap); + tulip_initring(sc, &sc->tulip_txinfo, sc->tulip_txdescs, TULIP_TXDESCS); + + sc->tulip_flags &= ~TULIP_DOINGSETUP; + sc->tulip_flags &= ~TULIP_WANTTXSTART; + tulip_rx_intr(sc); + sc->tulip_cmdmode |= TULIP_CMD_RXRUN|TULIP_CMD_TXRUN; + sc->tulip_intrmask |= TULIP_STS_RXSTOPPED|TULIP_STS_TXINTR|TULIP_STS_RXINTR; + TULIP_CSR_WRITE(sc, csr_intr, sc->tulip_intrmask); + TULIP_CSR_WRITE(sc, csr_command, sc->tulip_cmdmode); + sc->tulip_if.if_flags &= ~IFF_OACTIVE; + } else { + if ((sc->tulip_intrmask & TULIP_STS_TXINTR) == 0) { + sc->tulip_intrmask |= TULIP_STS_TXINTR; + TULIP_CSR_WRITE(sc, csr_intr, sc->tulip_intrmask); + } + } + #else if ((sc->tulip_intrmask & TULIP_STS_TXINTR) == 0) { sc->tulip_intrmask |= TULIP_STS_TXINTR; TULIP_CSR_WRITE(sc, csr_intr, sc->tulip_intrmask); } + #endif } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message