Browse Source

Plan 9 from Bell Labs 2007-03-16

David du Colombier 17 years ago
parent
commit
5bf9a7f6b0
5 changed files with 205 additions and 161 deletions
  1. 2 1
      dist/replica/_plan9.db
  2. 2 2
      dist/replica/plan9.db
  3. 2 0
      dist/replica/plan9.log
  4. 148 135
      sys/man/8/plan9.ini
  5. 51 23
      sys/src/9/pc/etherga620.c

+ 2 - 1
dist/replica/_plan9.db

@@ -7754,7 +7754,7 @@ sys/man/8/nfsserver - 664 sys sys 1163208425 3587
 sys/man/8/pcmcia - 664 sys sys 944959679 408
 sys/man/8/pem - 664 sys sys 1060263669 1189
 sys/man/8/ping - 664 sys sys 1169105315 3650
-sys/man/8/plan9.ini - 664 sys sys 1167276434 22689
+sys/man/8/plan9.ini - 664 sys sys 1173993823 22729
 sys/man/8/pop3 - 664 sys sys 1063854676 2720
 sys/man/8/ppp - 664 sys sys 1125530075 4414
 sys/man/8/prep - 664 sys sys 1152729153 14013
@@ -15685,3 +15685,4 @@ usr/glenda/lib/profile - 664 glenda glenda 1105128663 890
 usr/glenda/readme.acme - 664 glenda glenda 1019860628 4753
 usr/glenda/readme.rio - 664 glenda glenda 1019860628 6370
 usr/glenda/tmp - 20000000775 glenda glenda 1018802620 0
+sys/src/9/pc/etherga620.c - 664 sys sys 1174018926 29784

+ 2 - 2
dist/replica/plan9.db

@@ -7754,7 +7754,7 @@ sys/man/8/nfsserver - 664 sys sys 1163208425 3587
 sys/man/8/pcmcia - 664 sys sys 944959679 408
 sys/man/8/pem - 664 sys sys 1060263669 1189
 sys/man/8/ping - 664 sys sys 1169105315 3650
-sys/man/8/plan9.ini - 664 sys sys 1167276434 22689
+sys/man/8/plan9.ini - 664 sys sys 1173993823 22729
 sys/man/8/pop3 - 664 sys sys 1063854676 2720
 sys/man/8/ppp - 664 sys sys 1125530075 4414
 sys/man/8/prep - 664 sys sys 1152729153 14013
@@ -7999,7 +7999,7 @@ sys/src/9/pc/ether8390.h - 664 sys sys 1015014517 1511
 sys/src/9/pc/etherdp83820.c - 664 sys sys 1160069116 29352
 sys/src/9/pc/etherec2t.c - 664 sys sys 1135784135 4092
 sys/src/9/pc/etherelnk3.c - 664 sys sys 1158012427 48807
-sys/src/9/pc/etherga620.c - 664 sys sys 1168306078 29326
+sys/src/9/pc/etherga620.c - 664 sys sys 1174018926 29784
 sys/src/9/pc/etherga620fw.h - 664 sys sys 1026847642 222295
 sys/src/9/pc/etherif.h - 664 sys sys 1088178711 961
 sys/src/9/pc/etherigbe.c - 664 sys sys 1168306113 44967

+ 2 - 0
dist/replica/plan9.log

@@ -47882,3 +47882,5 @@
 1173789006 6 c sys/src/libmach/5obj.c - 664 sys sys 1173788325 2268
 1173814206 0 c 386/bin/aux/listen - 775 sys sys 1173813638 109045
 1173907806 0 d sys/src/cmd/replica/proto.c - 664 sys sys 1081202238 0
+1173994206 0 c sys/man/8/plan9.ini - 664 sys sys 1173993823 22729
+1174019406 0 c sys/src/9/pc/etherga620.c - 664 sys sys 1174018926 29784

+ 148 - 135
sys/man/8/plan9.ini

@@ -11,9 +11,9 @@ containing configuration information from the boot disk.
 This file,
 .BR plan9.ini ,
 looks like a shell script containing lines of the form
-.PP
+.IP
 .EX
-	name=\f2value\fP
+name=\f2value\fP
 .EE
 .LP
 each of which defines a kernel or device parameter.
@@ -30,9 +30,9 @@ appears at the start of a line.
 For devices, the generic format of
 .I value
 is
-.PP
+.IP
 .EX
-	type=TYPE [port=N] [irq=N] [mem=N] [size=N] [dma=N] [ea=N]
+type=TYPE [port=N] [irq=N] [mem=N] [size=N] [dma=N] [ea=N]
 .EE
 .LP
 specifying the controller type,
@@ -56,6 +56,7 @@ However, values whose names begin with an asterisk
 are used by the kernel and are not converted into environment variables.
 .PP
 The following sections describe how variables are used.
+.SS DEVICES
 .SS \fLetherX=value\fP
 This defines an Ethernet interface.
 .IR X ,
@@ -85,30 +86,70 @@ Some cards are software configurable and do not require all options.
 Unspecified options default to the factory defaults.
 .PP
 Known types are
+.TF ga620
+.PD
 .TP
-.B ne2000
-Not software configurable. 16-bit card.
-Defaults are
-.EX
-	port=0x300 irq=2 mem=0x04000 size=0x4000
-.EE
-The option (no value)
-.B nodummyrr
-is needed on some (near) clones to turn off a dummy remote read in the driver.
+.B igbe
+The Intel 8254X Gigabit Ethernet controllers,
+as found on the Intel PRO/1000 adapters for copper (not fiber).
 .TP
-.B amd79c970
-The AMD PCnet PCI Ethernet Adapter (AM79C970).
-(This is the ethernet adapter used by VMware.)
+.B rtl8169
+The Realtek 8169 Gigabit Ethernet controller.
+.TP
+.B ga620
+Netgear GA620 and GA620T Gigabit Ethernet cards,
+and other cards using the Alteon Acenic chip such as the
+Alteon Acenic fiber and copper cards,
+the DEC DEGPA-SA and the SGI Acenic.
+Completely configurable.
+.TP
+.B 83820
+National Semiconductor DP83820-based gigabit ethernet adapters, notably
+the D-Link DGE-500T.
+.TP
+.B i82557
+Cards using the Intel 8255[789] Fast Ethernet PCI Bus LAN Controller such as the
+Intel EtherExpress PRO/100B.
 Completely configurable, no options need be given.
+If you need to force the media, specify
+one of the options (no value)
+.BR 10BASE-T ,
+.BR 10BASE-2 ,
+.BR 10BASE-5 ,
+.BR 100BASE-TX ,
+.BR 10BASE-TFD ,
+.BR 100BASE-TXFD ,
+.BR 100BASE-T4 ,
+.BR 100BASE-FX ,
+or
+.BR 100BASE-FXFD .
 .TP
-.B wd8003
-Includes WD8013 and SMC Elite and Elite Ultra cards. There are varying degrees
-of software configurability. Cards may be in either 8-bit or 16-bit slots.
-Defaults are
-.EX
-	port=0x280 irq=3 mem=0xD0000 size=0x2000
-.EE
-BUG: On many machines only the 16 bit card works.
+.B 2114x
+Cards using the Digital Equipment (now Intel) 2114x PCI Fast Ethernet Adapter Controller,
+for example the Netgear FA310.
+Completely configurable, no options need be given.
+Media can be specified the same was as for the
+.BR i82557 .
+Some cards using the
+.B PNIC
+and
+.B PNIC2
+near-clone chips may also work.
+.TP
+.B 83815
+National Semiconductor DP83815-based adapters, notably
+the Netgear FA311, Netgear FA312, and various SiS built-in
+controllers such as the SiS900.
+On the SiS controllers, the ethernet address is not detected properly;
+specify it with an
+.B ea=
+attribute.
+.TP
+.B rtl8139
+The Realtek 8139 Fast Ethernet controller.
+.TP
+.B smc91cxx
+SMC 91cXX chip-based PCMCIA adapters, notably the SMC EtherEZ card.
 .TP
 .B elnk3
 The 3COM Etherlink III series of cards including the 5x9, 59x, and 905 and 905B.
@@ -167,7 +208,7 @@ where
 is a unique identifier string contained in the attribute
 memory of the card (see
 .IR pcmcia (8));
-unlike most options in 
+unlike most options in
 .BR plan9.ini ,
 this string is case-sensitive.
 The option
@@ -176,44 +217,40 @@ can be used to turn off (0) or on (1) a dummy remote read in the driver
 in such cases,
 depending on how NE2000 compatible they are.
 .TP
-.B i82557
-Cards using the Intel 8255[789] Fast Ethernet PCI Bus LAN Controller such as the
-Intel EtherExpress PRO/100B.
-Completely configurable, no options need be given.
-If you need to force the media, specify
-one of the options (no value)
-.BR 10BASE-T ,
-.BR 10BASE-2 ,
-.BR 10BASE-5 ,
-.BR 100BASE-TX ,
-.BR 10BASE-TFD ,
-.BR 100BASE-TXFD ,
-.BR 100BASE-T4 ,
-.BR 100BASE-FX ,
-or
-.BR 100BASE-FXFD .
+.B ne2000
+Not software configurable. 16-bit card.
+Defaults are
+.EX
+	port=0x300 irq=2 mem=0x04000 size=0x4000
+.EE
+The option (no value)
+.B nodummyrr
+is needed on some (near) clones to turn off a dummy remote read in the driver.
 .TP
-.B 2114x
-Cards using the Digital Equipment (now Intel) 2114x PCI Fast Ethernet Adapter Controller,
-for example the Netgear FA310.
+.B amd79c970
+The AMD PCnet PCI Ethernet Adapter (AM79C970).
+(This is the ethernet adapter used by VMware.)
 Completely configurable, no options need be given.
-Media can be specified the same was as for the
-.BR i82557 .
-Some cards using the
-.B PNIC
-and
-.B PNIC2
-near-clone chips may also work.
-.\" .TP
-.\" .B ga620
-.\" Netgear GA620 and GA620T Gigabit Ethernet cards,
-.\" and other cards using the Alteon Acenic chip such as the
-.\" Alteon Acenic fiber and copper cards,
-.\" the DEC DEGPA-SA and the SGI Acenic.
-.\" Completely configurable.
+.TP
+.B wd8003
+Includes WD8013 and SMC Elite and Elite Ultra cards. There are varying degrees
+of software configurability. Cards may be in either 8-bit or 16-bit slots.
+Defaults are
+.EX
+	port=0x280 irq=3 mem=0xD0000 size=0x2000
+.EE
+BUG: On many machines only the 16 bit card works.
+.TP
+.B sink
+A
+.B /dev/null
+for ethernet packets \(em the interface discards sent
+packets and never receives any.
+This is used to provide a test bed for
+some experimental ethernet bridging software.
 .TP
 .B wavelan
-Lucent Wavelan (Orinoco) IEEE 802.11b 
+Lucent Wavelan (Orinoco) IEEE 802.11b
 and compatible PCMCIA cards.
 Compatible cards include the Dell TrueMobile 1150
 and the Linksys Instant Wireless Network PC Card.
@@ -298,7 +335,7 @@ If it is desired to exclude or include unencrypted packets
 configures reception and defaults to inclusion.
 
 The defaults are intended to match the common case of
-a managed network with encryption and a typical entry would 
+a managed network with encryption and a typical entry would
 only require, for example
 .EX
 	essid=left-armpit key1=afish key2=calledraawaru
@@ -321,40 +358,6 @@ PCI ethernet adapters that use the same Wavelan
 programming interface.
 Currently the only tested cards are those based on the
 Intersil Prism 2.5 chipset.
-.TP
-.B 83815
-National Semiconductor DP83815-based adapters, notably
-the Netgear FA311, Netgear FA312, and various SiS built-in
-controllers such as the SiS900.
-On the SiS controllers, the ethernet address is not detected properly;
-specify it with an
-.B ea=
-attribute.
-.\" .TP
-.\" .B 83820
-.\" National Semiconductor DP83820-based gigabit ethernet adapters, notably
-.\" the D-Link DGE-500T.
-.TP
-.B rtl8139
-The Realtek 8139 Fast Ethernet controller.
-.TP
-.B rtl8169
-The Realtek 8169 Gigabit Ethernet controller.
-.TP
-.B igbe
-The Intel 8254X Gigabit Ethernet controllers,
-as found on the Intel PRO/1000 adapters for copper (not fiber).
-.TP
-.B smc91cxx
-SMC 91cXX chip-based PCMCIA adapters, notably the SMC EtherEZ card.
-.TP
-.B sink
-A
-.B /dev/null
-for ethernet packets \(em the interface discards sent
-packets and never receives any.
-This is used to provide a test bed for
-some experimental ethernet bridging software.
 .SS \fLusbX=type=uhci port=xxx irq=xxx\fP
 This specifies the settings for a USB UHCI controller.
 Like the ethernet controllers, USB controllers are autodetected
@@ -393,6 +396,23 @@ both the hard reset and SCSI bus reset flags in the driver interface.
 If a variable
 .BR *noscsireset
 is defined, the SCSI bus reset flag is omitted.
+.SS \fLaudioX=value\fP
+This defines a sound interface.
+.PP
+Known types are
+.TP
+.B sb16
+Sound Blaster 16.
+.TP
+.B ess1688
+A Sound Blaster clone.
+.PP
+The DMA channel may be any of 5, 6, or 7.
+The defaults are
+.IP
+.EX
+port=0x220 irq=7 dma=5
+.EE
 .SS Uarts
 Plan 9 automatically configures COM1 and COM2, if found,
 as
@@ -403,10 +423,12 @@ and
 (port 0x2F8, IRQ3)
 respectively.
 These devices can be disabled by adding a line:
+.IP
 .EX
-    eia\fIX\fP=disabled
+eia\fIX\fP=disabled
 .EE
-This is typically done in order to reuse the IRQ for 
+.LP
+This is typically done in order to reuse the IRQ for
 another device.
 .PP
 Plan 9 used to support various serial concentrators,
@@ -444,16 +466,6 @@ This is used when connecting to a file server over
 an async line.
 .I Value
 is the number of the port.
-.SS \fLpccard0=disabled\fP
-Disable probing for and automatic configuration of PC card controllers.
-.SS \fLpcmciaX=type=XXX irq=value\fP
-If the default IRQ for the
-PCMCIA
-is correct, this entry can be omitted.  The value of
-.B type
-is ignored.
-.SS \fLpcmcia0=disabled\fP
-Disable probing for and automatic configuration of PCMCIA controllers.
 .SS \fLconsole=value params\fP
 This is used to specify the console device.
 The default
@@ -487,11 +499,25 @@ sign in the
 .I params
 syntax.
 For example,
+.IP
 .EX
-    console=0 b19200 po
+console=0 b19200 po
 .EE
+.LP
 would use COM1 at 19,200 baud
 with odd parity.
+.SS "PC CARD"
+.SS \fLpccard0=disabled\fP
+Disable probing for and automatic configuration of PC card controllers.
+.SS \fLpcmciaX=type=XXX irq=value\fP
+If the default IRQ for the
+PCMCIA
+is correct, this entry can be omitted.  The value of
+.B type
+is ignored.
+.SS \fLpcmcia0=disabled\fP
+Disable probing for and automatic configuration of PCMCIA controllers.
+.SS BOOTING
 .SS \fLbootfile=value\fP
 This is used to direct the actions of
 .IR 9load (8)
@@ -576,14 +602,20 @@ By default, a partition table in a Plan 9 partition
 is consulted; if no such table is found, an old-Plan 9
 partition table on the next-to-last or last sector
 of the disk is consulted.
-A value of 
+A value of
 .B new
 consults only the first table,
 .B old
 only the second.
+.SS \fLfs=a.b.c.d\fP
+.SS \fLauth=a.b.c.d\fP
+These specify the IP address of the file and authentication server
+to use when mounting a network-provided root file system.
+They are used only if the addresses cannot be determined via DHCP.
+.SS PROCESSOR
 .SS \fL*norealmode=\fP
-The PC kernel switches the processor to 16-bit real mode 
-to run BIOS interrupts, for example to find the memory map or to enable VESA. 
+The PC kernel switches the processor to 16-bit real mode
+to run BIOS interrupts, for example to find the memory map or to enable VESA.
 This variable disables such switches.
 .SS \fL*noe820scan=\fP
 When available, the PC kernel uses the BIOS E820 memory map
@@ -637,7 +669,7 @@ on a PCI bus (default 255).
 For example, a
 .I value
 of 1 should suffice on a 'standard' motherboard with an AGP slot.
-This, and 
+This, and
 .B *pcimaxdno
 below are rarely used and only on troublesome or suspect hardware.
 .SS \fL*pcimaxdno=value\fP
@@ -676,6 +708,7 @@ The main feature of the interface is the ability to watch
 battery life (see
 .IR stats (8)).
 It is not on by default because it causes problems on some laptops.
+.SS VIDEO
 .SS \fLmonitor=value\fP
 .SS \fLvgasize=value\fP
 These are used not by the kernel but by
@@ -694,6 +727,7 @@ and
 .BR off .
 The first two specify differing levels of power saving;
 the third turns the monitor off completely.
+.SS NVRAM
 .SS \fLnvram=file\fP
 .SS \fLnvrlen=length\fP
 .SS \fLnvroff=offset\fP
@@ -728,27 +762,6 @@ where
 .I unit
 is the numeric unit id.
 This variant syntax is a vestige of the file server kernel's origins.
-.SS \fLaudioX=value\fP
-This defines a sound interface.
-.PP
-Known types are
-.TP
-.B sb16
-Sound Blaster 16.
-.TP
-.B ess1688
-A Sound Blaster clone.
-.PP
-The DMA channel may be any of 5, 6, or 7.
-The defaults are
-.EX
-	port=0x220 irq=7 dma=5
-.EE
-.SS \fLfs=a.b.c.d\fP
-.SS \fLauth=a.b.c.d\fP
-These specify the IP address of the file and authentication server
-to use when mounting a network-provided root file system.
-They are used only if the addresses cannot be determined via DHCP.
 .SH Multiple Configurations
 .PP
 A
@@ -830,7 +843,7 @@ modemport=1
 serial0=type=generic port=0x3E8 irq=5
 monitor=445x
 vgasize=1600x1200x8
-% 
+%
 .EE
 .PP
 Minimum CONFIG.SYS and AUTOEXEC.BAT files to use
@@ -845,7 +858,7 @@ PROMPT $p$g
 PATH C:\eDOS;C:\eBIN
 mode com2:96,n,8,1,p
 SET TEMP=C:\eTMP
-% 
+%
 .EE
 .PP
 Simple
@@ -876,7 +889,7 @@ Plan 9 Startup Menu:
 ====================
     1. Plan 9 with VGA
     2. Plan 9 no automatic VGA
-Selection[default==1]: 
+Selection[default==1]:
 .EE
 .PP
 Selecting item 1 generates the following

+ 51 - 23
sys/src/9/pc/etherga620.c

@@ -124,7 +124,11 @@ enum {					/* Om */
 enum {					/* Lmw */
 	Lmwsz		= 2*1024,	/* Local Memory Window Size */
 
-	Sr		= 0x3800,	/* Send Ring (accessed via Lmw) */
+	/*
+	 * legal values are 0x3800 iff Nsr is 128, 0x3000 iff Nsr is 256,
+	 * or 0x2000 iff Nsr is 512.
+	 */
+	Sr		= 0x2000,	/* Send Ring (accessed via Lmw) */
 };
 
 enum {					/* Link */
@@ -223,13 +227,17 @@ typedef struct Gib {			/* General Information Block */
 	Host64	rsp;			/* Refresh Stats */
 } Gib;
 
+/*
+ * these sizes are all fixed in the card,
+ * except for Nsr, which has only 3 valid sizes.
+ */
 enum {					/* Host/NIC Interface ring sizes */
 	Ner		= 256,		/* event ring */
 	Ncr		= 64,		/* command ring */
-	Nsr		= 512,		/* send ring */
+	Nsr		= 512,		/* send ring: 128, 256 or 512 */
 	Nrsr		= 512,		/* receive standard ring */
 	Nrjr		= 256,		/* receive jumbo ring */
-	Nrmr		= 1024,		/* receive mini ring */
+	Nrmr		= 1024,		/* receive mini ring, optional */
 	Nrrr		= 2048,		/* receive return ring */
 };
 
@@ -243,7 +251,7 @@ enum {
 };
 
 typedef struct Ctlr Ctlr;
-typedef struct Ctlr {
+struct Ctlr {
 	int	port;
 	Pcidev*	pcidev;
 	Ctlr*	next;
@@ -286,7 +294,7 @@ typedef struct Ctlr {
 	int	st;			/* Stat Ticks */
 	int	smcbd;			/* Send Max. Coalesced BDs */
 	int	rmcbd;			/* Receive Max. Coalesced BDs */
-} Ctlr;
+};
 
 static Ctlr* ctlrhead;
 static Ctlr* ctlrtail;
@@ -552,39 +560,46 @@ ga620replenish(Ctlr* ctlr)
 static void
 ga620event(Ether *edev, int eci, int epi)
 {
-	int event;
-	ulong gls, fls;
+	unsigned event, code;
 	Ctlr *ctlr;
 
 	ctlr = edev->ctlr;
 	while(eci != epi){
 		event = ctlr->er[eci].event;
+		code = (event >> 12) & ((1<<12)-1);
 		switch(event>>24){
 		case 0x01:		/* firmware operational */
+			/* host stack (us) is up.  3rd arg of 2 means down. */
 			ga620command(ctlr, 0x01, 0x01, 0x00);
+			/*
+			 * link negotiation: any speed is okay.
+			 * 3rd arg of 1 selects gigabit only; 2 10/100 only.
+			 */
 			ga620command(ctlr, 0x0B, 0x00, 0x00);
-print("ga620: %8.8uX: %8.8uX\n", ctlr->port, event);
+			print("#l%d: ga620: port %8.8uX: event %8.8uX\n",
+				edev->ctlrno, ctlr->port, event);
 			break;
 		case 0x04:		/* statistics updated */
 			break;
 		case 0x06:		/* link state changed */
-print("ga620: %8.8uX: %8.8uX %8.8uX %8.8uX\n",
-    ctlr->port, event, csr32r(ctlr, Gls), csr32r(ctlr, Fls));
-			gls = csr32r(ctlr, Gls);
-			fls = csr32r(ctlr, Fls);
-			if ((gls&(Le|L1000MB)) == (Le|L1000MB))
+			switch (code) {
+			case 1:
 				edev->mbps = 1000;
-			else if ((fls&(Le|L100MB)) == (Le|L100MB))
-				edev->mbps = 100;
-			else if ((fls&(Le|L10MB)) == (Le|L10MB))
-				edev->mbps = 10;
-			else
 				break;
-			print("#l%d: %dMbps\n", edev->ctlrno, edev->mbps);
+			case 2:
+				print("#l%d: link down\n", edev->ctlrno);
+				break;
+			case 3:
+				edev->mbps = 100;	/* it's 10 or 100 */
+				break;
+			}
+			if (code != 2)
+				print("#l%d: %dMbps link up\n",
+					edev->ctlrno, edev->mbps);
 			break;
 		case 0x07:		/* event error */
 		default:
-			print("er[%d] = %8.8uX\n", eci, event);
+			print("ga620: er[%d] = %8.8uX\n", eci, event);
 			break;
 		}
 		eci = NEXT(eci, Ner);
@@ -1175,10 +1190,23 @@ ga620pci(void)
 	}
 }
 
-/* multicast may already be on, so we don't need to do anything */
 static void
-ga620multicast(void*, uchar*, int)
+ga620promiscuous(void *arg, int on)
 {
+	Ether *ether = arg;
+
+	/* 3rd arg: 1 enables, 2 disables */
+	ga620command(ether->ctlr, 0xa, (on? 1: 2), 0);
+}
+
+static void
+ga620multicast(void *arg, uchar *addr, int on)
+{
+	Ether *ether = arg;
+
+	USED(addr);
+	/* 3rd arg: 1 enables, 2 disables */
+	ga620command(ether->ctlr, 0xe, (on? 1: 2), 0);
 }
 
 static int
@@ -1232,7 +1260,7 @@ ga620pnp(Ether* edev)
 	edev->ctl = ga620ctl;
 
 	edev->arg = edev;
-	edev->promiscuous = nil;
+	edev->promiscuous = ga620promiscuous;
 	edev->multicast = ga620multicast;
 	edev->shutdown = ga620shutdown;