~kris/9p

9hist

004c679d006b5955f8c30bb6eea99c3d45bf963b — David du Colombier 23 years ago f5405d8
Plan 9 from Bell Labs 2002-10-08
1 files changed, 33 insertions(+), 6 deletions(-)

M pc/ether2114x.c
M pc/ether2114x.c => pc/ether2114x.c +33 -6
@@ 188,6 188,7 @@ enum {					/* Variants */
	Tulip3		= (0x0019<<16)|0x1011,
	Pnic		= (0x0002<<16)|0x11AD,
	Pnic2		= (0xC115<<16)|0x11AD,
	CentaurP	= (0x0985<<16)|0x1317,
};

typedef struct Ctlr Ctlr;


@@ 989,7 990,7 @@ typephymode(Ctlr* ctlr, uchar* block, int wait)
	if(!wait)
		return 0;

	for(timeo = 0; timeo < 30; timeo++){
	for(timeo = 0; timeo < 45; timeo++){
		if(typephylink(ctlr, block))
			return 0;
		delay(100);


@@ 1361,7 1362,7 @@ srom(Ctlr* ctlr)
	}

	/*
	 * There are 2 SROM layouts:
	 * There are at least 2 SROM layouts:
	 *	e.g. Digital EtherWORKS	station address at offset 20;
	 *				this complies with the 21140A SROM
	 *				application note from Digital;


@@ 1383,9 1384,10 @@ srom(Ctlr* ctlr)
	}

	/*
	 * Fake up the SROM for the PNIC.
	 * It looks like a 21140 with a PHY.
	 * The MAC address is byte-swapped in the orginal SROM data.
	 * Fake up the SROM for the PNIC and AMDtek.
	 * They look like a 21140 with a PHY.
	 * The MAC address is byte-swapped in the orginal
	 * PNIC SROM data.
	 */
	if(ctlr->id == Pnic){
		memmove(&ctlr->srom[20], leafpnic, sizeof(leafpnic));


@@ 1394,6 1396,13 @@ srom(Ctlr* ctlr)
			ctlr->srom[20+i+1] = ctlr->srom[i];
		}
	}
	if(ctlr->id == CentaurP){
		memmove(&ctlr->srom[20], leafpnic, sizeof(leafpnic));
		for(i = 0; i < Eaddrlen; i += 2){
			ctlr->srom[20+i] = ctlr->srom[8+i];
			ctlr->srom[20+i+1] = ctlr->srom[8+i+1];
		}
	}

	/*
	 * Next, try to find the info leaf in the SROM for media detection.


@@ 1466,8 1475,11 @@ srom(Ctlr* ctlr)
	if(phy){
		x = 0;
		for(k = 0; k < nelem(ctlr->phy); k++){
			if(ctlr->id == CentaurP && k != 1)
				continue;
			if((oui = miir(ctlr, k, 2)) == -1 || oui == 0)
				continue;
debug("phy reg 2 %4.4uX\n", oui);
			if(DEBUG){
				oui = (oui & 0x3FF)<<6;
				oui |= miir(ctlr, k, 3)>>10;


@@ 1510,9 1522,10 @@ dec2114xpci(void)
			pcicfgw32(p, 0x40, x);
			/*FALLTHROUGH*/

		case Tulip0:			/* 21140 */
		case Pnic:			/* PNIC */
		case Pnic2:			/* PNIC-II */
		case Tulip0:			/* 21140 */
		case CentaurP:			/* ADMtek */
			break;
		}



@@ 1555,6 1568,20 @@ dec2114xpci(void)
			 */
			csr32w(ctlr, 15, 0x00000001);
			break;
		case CentaurP:
			/*
			 * Nice - the register offsets change from *8 to *4
			 * for CSR16 and up...
			 * CSR25/26 give the MAC address read from the SROM.
			 * Don't really need to use this other than as a check,
			 * the SROM will be read in anyway so the value there
			 * can be used directly.
			 */
			debug("csr25 %8.8luX csr26 %8.8luX\n",
				inl(ctlr->port+0xA4), inl(ctlr->port+0xA8));
			debug("phyidr1 %4.4luX phyidr2 %4.4luX\n",
				inl(ctlr->port+0xBC), inl(ctlr->port+0xC0));
			break;
		}

		if(ctlrhead != nil)