changelog shortlog tags branches files raw gz bz2 help

Mercurial > hg > plan9front / changeset: kernel: move common ethermii to port/

changeset 7305: 617312eef5e1
parent 7304: 077f4f4547a6
child 7306: 31c5e11c82f8
author: cinap_lenrek@felloff.net
date: Thu, 11 Jul 2019 07:47:39 +0200
files: sys/src/9/pc/ether8169.c sys/src/9/pc/etherdp83820.c sys/src/9/pc/etherigbe.c sys/src/9/pc/ethermii.c sys/src/9/pc/ethermii.h sys/src/9/pc/ethervgbe.c sys/src/9/pc/ethervt6102.c sys/src/9/pc/ethervt6105m.c sys/src/9/pc/mkfile sys/src/9/pc64/mkfile sys/src/9/port/ethermii.c sys/src/9/port/ethermii.h sys/src/9/port/portmkfile sys/src/9/teg2/ether8169.c sys/src/9/teg2/ethermii.c sys/src/9/teg2/ethermii.h
description: kernel: move common ethermii to port/
     1.1--- a/sys/src/9/pc/ether8169.c
     1.2+++ b/sys/src/9/pc/ether8169.c
     1.3@@ -16,8 +16,7 @@
     1.4 #include "../port/error.h"
     1.5 #include "../port/netif.h"
     1.6 #include "../port/etherif.h"
     1.7-
     1.8-#include "ethermii.h"
     1.9+#include "../port/ethermii.h"
    1.10 
    1.11 enum {					/* registers */
    1.12 	Idr0		= 0x00,		/* MAC address */
     2.1--- a/sys/src/9/pc/etherdp83820.c
     2.2+++ b/sys/src/9/pc/etherdp83820.c
     2.3@@ -13,8 +13,7 @@
     2.4 #include "../port/error.h"
     2.5 #include "../port/netif.h"
     2.6 #include "../port/etherif.h"
     2.7-
     2.8-#include "ethermii.h"
     2.9+#include "../port/ethermii.h"
    2.10 
    2.11 enum {					/* Registers */
    2.12 	Cr		= 0x00,		/* Command */
     3.1--- a/sys/src/9/pc/etherigbe.c
     3.2+++ b/sys/src/9/pc/etherigbe.c
     3.3@@ -25,8 +25,7 @@
     3.4 #include "../port/error.h"
     3.5 #include "../port/netif.h"
     3.6 #include "../port/etherif.h"
     3.7-
     3.8-#include "ethermii.h"
     3.9+#include "../port/ethermii.h"
    3.10 
    3.11 enum {
    3.12 	i82542		= (0x1000<<16)|0x8086,
     4.1--- a/sys/src/9/pc/ethervgbe.c
     4.2+++ b/sys/src/9/pc/ethervgbe.c
     4.3@@ -30,8 +30,7 @@
     4.4 #include "../port/error.h"
     4.5 #include "../port/netif.h"
     4.6 #include "../port/etherif.h"
     4.7-
     4.8-#include "ethermii.h"
     4.9+#include "../port/ethermii.h"
    4.10 
    4.11 #define DEBUG
    4.12 
     5.1--- a/sys/src/9/pc/ethervt6102.c
     5.2+++ b/sys/src/9/pc/ethervt6102.c
     5.3@@ -18,8 +18,7 @@
     5.4 #include "../port/error.h"
     5.5 #include "../port/netif.h"
     5.6 #include "../port/etherif.h"
     5.7-
     5.8-#include "ethermii.h"
     5.9+#include "../port/ethermii.h"
    5.10 
    5.11 enum {
    5.12 	Par0		= 0x00,		/* Ethernet Address */
     6.1--- a/sys/src/9/pc/ethervt6105m.c
     6.2+++ b/sys/src/9/pc/ethervt6105m.c
     6.3@@ -21,8 +21,7 @@
     6.4 #include "../port/error.h"
     6.5 #include "../port/netif.h"
     6.6 #include "../port/etherif.h"
     6.7-
     6.8-#include "ethermii.h"
     6.9+#include "../port/ethermii.h"
    6.10 
    6.11 enum {
    6.12 	Par0		= 0x00,			/* Ethernet Address */
     7.1--- a/sys/src/9/pc/mkfile
     7.2+++ b/sys/src/9/pc/mkfile
     7.3@@ -123,13 +123,12 @@ devusb.$O usbuhci.$O usbohci.$O usbehci.
     7.4 usbehci.$O usbehcipc.$O:	usbehci.h
     7.5 trap.$O:			/sys/include/tos.h
     7.6 uartaxp.$O:			uartaxp.i
     7.7-ethermii.$O:			ethermii.h
     7.8-ether8169.$O:			ethermii.h
     7.9-etherdp83820.$O:		ethermii.h
    7.10-etherigbe.$O:			ethermii.h
    7.11-ethervgbe.$O:			ethermii.h
    7.12-ethervt6102.$O:			ethermii.h
    7.13-ethervt6105m.$O:		ethermii.h
    7.14+ether8169.$O:			../port/ethermii.h
    7.15+etherdp83820.$O:		../port/ethermii.h
    7.16+etherigbe.$O:			../port/ethermii.h
    7.17+ethervgbe.$O:			../port/ethermii.h
    7.18+ethervt6102.$O:			../port/ethermii.h
    7.19+ethervt6105m.$O:		../port/ethermii.h
    7.20 etherm10g.$O:			etherm10g2k.i etherm10g4k.i
    7.21 etheriwl.$O:			../port/wifi.h
    7.22 etherwpi.$O:			../port/wifi.h
     8.1--- a/sys/src/9/pc64/mkfile
     8.2+++ b/sys/src/9/pc64/mkfile
     8.3@@ -85,7 +85,7 @@ install:V:	$p$CONF
     8.4 
     8.5 
     8.6 # copies generated by the rule below
     8.7-PCHEADERS=usbehci.h screen.h ethermii.h mp.h io.h ahci.h \
     8.8+PCHEADERS=usbehci.h screen.h mp.h io.h ahci.h \
     8.9 	yukdump.h
    8.10 
    8.11 REPCH=`{echo $PCHEADERS | sed 's/\.h//g; s/ /|/g'}
    8.12@@ -124,13 +124,12 @@ usbehci.$O usbehcipc.$O:	usbehci.h
    8.13 
    8.14 trap.$O:			/sys/include/tos.h
    8.15 
    8.16-ethermii.$O:			ethermii.h
    8.17-ether8169.$O:			ethermii.h
    8.18-etherdp83820.$O:		ethermii.h
    8.19-etherigbe.$O:			ethermii.h
    8.20-ethervgbe.$O:			ethermii.h
    8.21-ethervt6102.$O:			ethermii.h
    8.22-ethervt6105m.$O:		ethermii.h
    8.23+ether8169.$O:			../port/ethermii.h
    8.24+etherdp83820.$O:		../port/ethermii.h
    8.25+etherigbe.$O:			../port/ethermii.h
    8.26+ethervgbe.$O:			../port/ethermii.h
    8.27+ethervt6102.$O:			../port/ethermii.h
    8.28+ethervt6105m.$O:		../port/ethermii.h
    8.29 
    8.30 etheriwl.$O:			../port/wifi.h
    8.31 etherwpi.$O:			../port/wifi.h
     9.1rename from sys/src/9/pc/ethermii.c
     9.2rename to sys/src/9/port/ethermii.c
    10.1rename from sys/src/9/pc/ethermii.h
    10.2rename to sys/src/9/port/ethermii.h
    11.1--- a/sys/src/9/port/portmkfile
    11.2+++ b/sys/src/9/port/portmkfile
    11.3@@ -105,3 +105,4 @@ devusb.$O:	../port/usb.h
    11.4 devether.$O ethersink.$O:	../port/etherif.h ../port/netif.h
    11.5 wifi.$O:	../port/etherif.h ../port/netif.h ../port/wifi.h /sys/include/libsec.h
    11.6 wifi.$O:	../ip/ip.h ../ip/ipv6.h
    11.7+ethermii.$O:	../port/ethermii.h
    12.1--- a/sys/src/9/teg2/ether8169.c
    12.2+++ b/sys/src/9/teg2/ether8169.c
    12.3@@ -16,8 +16,7 @@
    12.4 #include "../port/error.h"
    12.5 #include "../port/netif.h"
    12.6 #include "../port/etherif.h"
    12.7-
    12.8-#include "ethermii.h"
    12.9+#include "../port/ethermii.h"
   12.10 
   12.11 typedef struct Ctlr Ctlr;
   12.12 typedef struct D D;			/* Transmit/Receive Descriptor */
    13.1deleted file mode 100644
    13.2--- a/sys/src/9/teg2/ethermii.c
    13.3+++ /dev/null
    13.4@@ -1,235 +0,0 @@
    13.5-#include "u.h"
    13.6-#include "../port/lib.h"
    13.7-#include "mem.h"
    13.8-#include "dat.h"
    13.9-#include "fns.h"
   13.10-#include "io.h"
   13.11-#include "../port/error.h"
   13.12-#include "../port/netif.h"
   13.13-#include "../port/etherif.h"
   13.14-
   13.15-#include "ethermii.h"
   13.16-
   13.17-int
   13.18-mii(Mii* mii, int mask)
   13.19-{
   13.20-	MiiPhy *miiphy;
   13.21-	int bit, oui, phyno, r, rmask;
   13.22-
   13.23-	/*
   13.24-	 * Probe through mii for PHYs in mask;
   13.25-	 * return the mask of those found in the current probe.
   13.26-	 * If the PHY has not already been probed, update
   13.27-	 * the Mii information.
   13.28-	 */
   13.29-	rmask = 0;
   13.30-	for(phyno = 0; phyno < NMiiPhy; phyno++){
   13.31-		bit = 1<<phyno;
   13.32-		if(!(mask & bit))
   13.33-			continue;
   13.34-		if(mii->mask & bit){
   13.35-			rmask |= bit;
   13.36-			continue;
   13.37-		}
   13.38-		if(mii->mir(mii, phyno, Bmsr) == -1)
   13.39-			continue;
   13.40-		r = mii->mir(mii, phyno, Phyidr1);
   13.41-		oui = (r & 0x3FFF)<<6;
   13.42-		r = mii->mir(mii, phyno, Phyidr2);
   13.43-		oui |= r>>10;
   13.44-		if(oui == 0xFFFFF || oui == 0)
   13.45-			continue;
   13.46-
   13.47-		if((miiphy = malloc(sizeof(MiiPhy))) == nil)
   13.48-			continue;
   13.49-
   13.50-		miiphy->mii = mii;
   13.51-		miiphy->oui = oui;
   13.52-		miiphy->phyno = phyno;
   13.53-
   13.54-		miiphy->anar = ~0;
   13.55-		miiphy->fc = ~0;
   13.56-		miiphy->mscr = ~0;
   13.57-
   13.58-		mii->phy[phyno] = miiphy;
   13.59-		if(mii->curphy == nil)
   13.60-			mii->curphy = miiphy;
   13.61-		mii->mask |= bit;
   13.62-		mii->nphy++;
   13.63-
   13.64-		rmask |= bit;
   13.65-	}
   13.66-	return rmask;
   13.67-}
   13.68-
   13.69-int
   13.70-miimir(Mii* mii, int r)
   13.71-{
   13.72-	if(mii == nil || mii->ctlr == nil || mii->curphy == nil)
   13.73-		return -1;
   13.74-	return mii->mir(mii, mii->curphy->phyno, r);
   13.75-}
   13.76-
   13.77-int
   13.78-miimiw(Mii* mii, int r, int data)
   13.79-{
   13.80-	if(mii == nil || mii->ctlr == nil || mii->curphy == nil)
   13.81-		return -1;
   13.82-	return mii->miw(mii, mii->curphy->phyno, r, data);
   13.83-}
   13.84-
   13.85-int
   13.86-miireset(Mii* mii)
   13.87-{
   13.88-	int bmcr;
   13.89-
   13.90-	if(mii == nil || mii->ctlr == nil || mii->curphy == nil)
   13.91-		return -1;
   13.92-	bmcr = mii->mir(mii, mii->curphy->phyno, Bmcr);
   13.93-	bmcr |= BmcrR;
   13.94-	mii->miw(mii, mii->curphy->phyno, Bmcr, bmcr);
   13.95-	microdelay(1);
   13.96-
   13.97-	return 0;
   13.98-}
   13.99-
  13.100-int
  13.101-miiane(Mii* mii, int a, int p, int e)
  13.102-{
  13.103-	int anar, bmsr, mscr, r, phyno;
  13.104-
  13.105-	if(mii == nil || mii->ctlr == nil || mii->curphy == nil)
  13.106-		return -1;
  13.107-	phyno = mii->curphy->phyno;
  13.108-
  13.109-	bmsr = mii->mir(mii, phyno, Bmsr);
  13.110-	if(!(bmsr & BmsrAna))
  13.111-		return -1;
  13.112-
  13.113-	if(a != ~0)
  13.114-		anar = (AnaTXFD|AnaTXHD|Ana10FD|Ana10HD) & a;
  13.115-	else if(mii->curphy->anar != ~0)
  13.116-		anar = mii->curphy->anar;
  13.117-	else{
  13.118-		anar = mii->mir(mii, phyno, Anar);
  13.119-		anar &= ~(AnaAP|AnaP|AnaT4|AnaTXFD|AnaTXHD|Ana10FD|Ana10HD);
  13.120-		if(bmsr & Bmsr10THD)
  13.121-			anar |= Ana10HD;
  13.122-		if(bmsr & Bmsr10TFD)
  13.123-			anar |= Ana10FD;
  13.124-		if(bmsr & Bmsr100TXHD)
  13.125-			anar |= AnaTXHD;
  13.126-		if(bmsr & Bmsr100TXFD)
  13.127-			anar |= AnaTXFD;
  13.128-	}
  13.129-	mii->curphy->anar = anar;
  13.130-
  13.131-	if(p != ~0)
  13.132-		anar |= (AnaAP|AnaP) & p;
  13.133-	else if(mii->curphy->fc != ~0)
  13.134-		anar |= mii->curphy->fc;
  13.135-	mii->curphy->fc = (AnaAP|AnaP) & anar;
  13.136-
  13.137-	if(bmsr & BmsrEs){
  13.138-		mscr = mii->mir(mii, phyno, Mscr);
  13.139-		mscr &= ~(Mscr1000TFD|Mscr1000THD);
  13.140-		if(e != ~0)
  13.141-			mscr |= (Mscr1000TFD|Mscr1000THD) & e;
  13.142-		else if(mii->curphy->mscr != ~0)
  13.143-			mscr = mii->curphy->mscr;
  13.144-		else{
  13.145-			r = mii->mir(mii, phyno, Esr);
  13.146-			if(r & Esr1000THD)
  13.147-				mscr |= Mscr1000THD;
  13.148-			if(r & Esr1000TFD)
  13.149-				mscr |= Mscr1000TFD;
  13.150-		}
  13.151-		mii->curphy->mscr = mscr;
  13.152-		mii->miw(mii, phyno, Mscr, mscr);
  13.153-	}
  13.154-	mii->miw(mii, phyno, Anar, anar);
  13.155-
  13.156-	r = mii->mir(mii, phyno, Bmcr);
  13.157-	if(!(r & BmcrR)){
  13.158-		r |= BmcrAne|BmcrRan;
  13.159-		mii->miw(mii, phyno, Bmcr, r);
  13.160-	}
  13.161-
  13.162-	return 0;
  13.163-}
  13.164-
  13.165-int
  13.166-miistatus(Mii* mii)
  13.167-{
  13.168-	MiiPhy *phy;
  13.169-	int anlpar, bmsr, p, r, phyno;
  13.170-
  13.171-	if(mii == nil || mii->ctlr == nil || mii->curphy == nil)
  13.172-		return -1;
  13.173-	phy = mii->curphy;
  13.174-	phyno = phy->phyno;
  13.175-
  13.176-	/*
  13.177-	 * Check Auto-Negotiation is complete and link is up.
  13.178-	 * (Read status twice as the Ls bit is sticky).
  13.179-	 */
  13.180-	bmsr = mii->mir(mii, phyno, Bmsr);
  13.181-	if(!(bmsr & (BmsrAnc|BmsrAna))) {
  13.182-		// print("miistatus: auto-neg incomplete\n");
  13.183-		return -1;
  13.184-	}
  13.185-
  13.186-	bmsr = mii->mir(mii, phyno, Bmsr);
  13.187-	if(!(bmsr & BmsrLs)){
  13.188-		// print("miistatus: link down\n");
  13.189-		phy->link = 0;
  13.190-		return -1;
  13.191-	}
  13.192-
  13.193-	phy->speed = phy->fd = phy->rfc = phy->tfc = 0;
  13.194-	if(phy->mscr){
  13.195-		r = mii->mir(mii, phyno, Mssr);
  13.196-		if((phy->mscr & Mscr1000TFD) && (r & Mssr1000TFD)){
  13.197-			phy->speed = 1000;
  13.198-			phy->fd = 1;
  13.199-		}
  13.200-		else if((phy->mscr & Mscr1000THD) && (r & Mssr1000THD))
  13.201-			phy->speed = 1000;
  13.202-	}
  13.203-
  13.204-	anlpar = mii->mir(mii, phyno, Anlpar);
  13.205-	if(phy->speed == 0){
  13.206-		r = phy->anar & anlpar;
  13.207-		if(r & AnaTXFD){
  13.208-			phy->speed = 100;
  13.209-			phy->fd = 1;
  13.210-		}
  13.211-		else if(r & AnaTXHD)
  13.212-			phy->speed = 100;
  13.213-		else if(r & Ana10FD){
  13.214-			phy->speed = 10;
  13.215-			phy->fd = 1;
  13.216-		}
  13.217-		else if(r & Ana10HD)
  13.218-			phy->speed = 10;
  13.219-	}
  13.220-	if(phy->speed == 0) {
  13.221-		// print("miistatus: phy speed 0\n");
  13.222-		return -1;
  13.223-	}
  13.224-
  13.225-	if(phy->fd){
  13.226-		p = phy->fc;
  13.227-		r = anlpar & (AnaAP|AnaP);
  13.228-		if(p == AnaAP && r == (AnaAP|AnaP))
  13.229-			phy->tfc = 1;
  13.230-		else if(p == (AnaAP|AnaP) && r == AnaAP)
  13.231-			phy->rfc = 1;
  13.232-		else if((p & AnaP) && (r & AnaP))
  13.233-			phy->rfc = phy->tfc = 1;
  13.234-	}
  13.235-
  13.236-	phy->link = 1;
  13.237-
  13.238-	return 0;
  13.239-}
    14.1deleted file mode 100644
    14.2--- a/sys/src/9/teg2/ethermii.h
    14.3+++ /dev/null
    14.4@@ -1,116 +0,0 @@
    14.5-typedef struct Mii Mii;
    14.6-typedef struct MiiPhy MiiPhy;
    14.7-
    14.8-enum {					/* registers */
    14.9-	Bmcr		= 0x00,		/* Basic Mode Control */
   14.10-	Bmsr		= 0x01,		/* Basic Mode Status */
   14.11-	Phyidr1		= 0x02,		/* PHY Identifier #1 */
   14.12-	Phyidr2		= 0x03,		/* PHY Identifier #2 */
   14.13-	Anar		= 0x04,		/* Auto-Negotiation Advertisement */
   14.14-	Anlpar		= 0x05,		/* AN Link Partner Ability */
   14.15-	Aner		= 0x06,		/* AN Expansion */
   14.16-	Annptr		= 0x07,		/* AN Next Page TX */
   14.17-	Annprr		= 0x08,		/* AN Next Page RX */
   14.18-	Mscr		= 0x09,		/* MASTER-SLAVE Control */
   14.19-	Mssr		= 0x0A,		/* MASTER-SLAVE Status */
   14.20-	Esr		= 0x0F,		/* Extended Status */
   14.21-
   14.22-	NMiiPhyr	= 32,
   14.23-	NMiiPhy		= 32,
   14.24-};
   14.25-
   14.26-enum {					/* Bmcr */
   14.27-	BmcrSs1		= 0x0040,	/* Speed Select[1] */
   14.28-	BmcrCte		= 0x0080,	/* Collision Test Enable */
   14.29-	BmcrDm		= 0x0100,	/* Duplex Mode */
   14.30-	BmcrRan		= 0x0200,	/* Restart Auto-Negotiation */
   14.31-	BmcrI		= 0x0400,	/* Isolate */
   14.32-	BmcrPd		= 0x0800,	/* Power Down */
   14.33-	BmcrAne		= 0x1000,	/* Auto-Negotiation Enable */
   14.34-	BmcrSs0		= 0x2000,	/* Speed Select[0] */
   14.35-	BmcrLe		= 0x4000,	/* Loopback Enable */
   14.36-	BmcrR		= 0x8000,	/* Reset */
   14.37-};
   14.38-
   14.39-enum {					/* Bmsr */
   14.40-	BmsrEc		= 0x0001,	/* Extended Capability */
   14.41-	BmsrJd		= 0x0002,	/* Jabber Detect */
   14.42-	BmsrLs		= 0x0004,	/* Link Status */
   14.43-	BmsrAna		= 0x0008,	/* Auto-Negotiation Ability */
   14.44-	BmsrRf		= 0x0010,	/* Remote Fault */
   14.45-	BmsrAnc		= 0x0020,	/* Auto-Negotiation Complete */
   14.46-	BmsrPs		= 0x0040,	/* Preamble Suppression Capable */
   14.47-	BmsrEs		= 0x0100,	/* Extended Status */
   14.48-	Bmsr100T2HD	= 0x0200,	/* 100BASE-T2 HD Capable */
   14.49-	Bmsr100T2FD	= 0x0400,	/* 100BASE-T2 FD Capable */
   14.50-	Bmsr10THD	= 0x0800,	/* 10BASE-T HD Capable */
   14.51-	Bmsr10TFD	= 0x1000,	/* 10BASE-T FD Capable */
   14.52-	Bmsr100TXHD	= 0x2000,	/* 100BASE-TX HD Capable */
   14.53-	Bmsr100TXFD	= 0x4000,	/* 100BASE-TX FD Capable */
   14.54-	Bmsr100T4	= 0x8000,	/* 100BASE-T4 Capable */
   14.55-};
   14.56-
   14.57-enum {					/* Anar/Anlpar */
   14.58-	Ana10HD		= 0x0020,	/* Advertise 10BASE-T */
   14.59-	Ana10FD		= 0x0040,	/* Advertise 10BASE-T FD */
   14.60-	AnaTXHD		= 0x0080,	/* Advertise 100BASE-TX */
   14.61-	AnaTXFD		= 0x0100,	/* Advertise 100BASE-TX FD */
   14.62-	AnaT4		= 0x0200,	/* Advertise 100BASE-T4 */
   14.63-	AnaP		= 0x0400,	/* Pause */
   14.64-	AnaAP		= 0x0800,	/* Asymmetrical Pause */
   14.65-	AnaRf		= 0x2000,	/* Remote Fault */
   14.66-	AnaAck		= 0x4000,	/* Acknowledge */
   14.67-	AnaNp		= 0x8000,	/* Next Page Indication */
   14.68-};
   14.69-
   14.70-enum {					/* Mscr */
   14.71-	Mscr1000THD	= 0x0100,	/* Advertise 1000BASE-T HD */
   14.72-	Mscr1000TFD	= 0x0200,	/* Advertise 1000BASE-T FD */
   14.73-};
   14.74-
   14.75-enum {					/* Mssr */
   14.76-	Mssr1000THD	= 0x0400,	/* Link Partner 1000BASE-T HD able */
   14.77-	Mssr1000TFD	= 0x0800,	/* Link Partner 1000BASE-T FD able */
   14.78-};
   14.79-
   14.80-enum {					/* Esr */
   14.81-	Esr1000THD	= 0x1000,	/* 1000BASE-T HD Capable */
   14.82-	Esr1000TFD	= 0x2000,	/* 1000BASE-T FD Capable */
   14.83-	Esr1000XHD	= 0x4000,	/* 1000BASE-X HD Capable */
   14.84-	Esr1000XFD	= 0x8000,	/* 1000BASE-X FD Capable */
   14.85-};
   14.86-
   14.87-typedef struct Mii {
   14.88-	Lock;
   14.89-	int	nphy;
   14.90-	int	mask;
   14.91-	MiiPhy*	phy[NMiiPhy];
   14.92-	MiiPhy*	curphy;
   14.93-
   14.94-	void*	ctlr;
   14.95-	int	(*mir)(Mii*, int, int);
   14.96-	int	(*miw)(Mii*, int, int, int);
   14.97-} Mii;
   14.98-
   14.99-typedef struct MiiPhy {
  14.100-	Mii*	mii;
  14.101-	int	oui;
  14.102-	int	phyno;
  14.103-
  14.104-	int	anar;
  14.105-	int	fc;
  14.106-	int	mscr;
  14.107-
  14.108-	int	link;
  14.109-	int	speed;
  14.110-	int	fd;
  14.111-	int	rfc;
  14.112-	int	tfc;
  14.113-};
  14.114-
  14.115-extern int mii(Mii*, int);
  14.116-extern int miiane(Mii*, int, int, int);
  14.117-extern int miimir(Mii*, int);
  14.118-extern int miimiw(Mii*, int, int);
  14.119-extern int miireset(Mii*);
  14.120-extern int miistatus(Mii*);