-}
-
-eninit(unit)
- int unit;
-{
- register struct endevice *addr;
- register struct uba_device *ui;
- int uban, x;
- static reenter;
-
- if (unit >= NEN || (ui = eninfo[unit]) == 0 || ui->ui_alive == 0) {
- printf("en%d: not alive\n", unit);
- return;
- }
- x = splimp();
- if (reenter == 0) {
- int n, j, i, k; char *cp;
- reenter = 1;
- n = 10;
- k = n<<1;
- i = rmalloc(netmap, n*2);
- if (i == 0)
- panic("eninit");
- j = i << 1;
- cp = (char *)pftom(i);
- if (memall(&Netmap[j], k, proc, CSYS) == 0)
- return (0);
- vmaccess(&Netmap[j], (caddr_t)cp, k);
- rpkt = (struct en_packet *)
- (cp + 1024 - sizeof (struct en_prefix));
- xpkt = (struct en_packet *)
- (cp + 5 * 1024 + 1024 - sizeof (struct en_prefix));
- for (j = 0; j < n; j++)
- mprefcnt[i+j] = 1;
- }
- uban = ui->ui_ubanum;
- addr = (struct endevice *)ui->ui_addr;
- addr->en_istat = 0;
- addr->en_ostat = 0;
- imp_stat.iaddr =
- uballoc(uban, (caddr_t)rpkt, 1024+512, UBA_NEED16|UBA_NEEDBDP);
- imp_stat.oaddr =
- uballoc(uban, (caddr_t)xpkt, 1024+512, UBA_NEED16|UBA_NEEDBDP);
- enuba = ui->ui_hd->uh_uba;
- enrbdp = (imp_stat.iaddr >> 28) & 0xf;
- enwbdp = (imp_stat.oaddr >> 28) & 0xf;
- enrproto = UBAMR_MRV | (enrbdp << 21);
- enwproto = UBAMR_MRV | (enwbdp << 21);
- enrmr = &enuba->uba_map[((imp_stat.iaddr>>9)&0x1ff) + 1];
- enxmr = &enuba->uba_map[((imp_stat.oaddr>>9)&0x1ff) + 1];
- enxmap[0] = enxmr[0];
- enxmap[1] = enxmr[1];
- enxswapd = 0;
- printf("enrbdp %x enrproto %x enrmr %x imp_stat.iaddr %x\n",
- enrbdp, enrproto, enrmr, imp_stat.iaddr);
- imp_stat.impopen = 1;
- imp_stat.flush = 0;
- splx(x);
-#ifdef IMPDEBUG
- printf("eninit(%d): iaddr = %x, oaddr = %x\n",
- unit, imp_stat.iaddr, imp_stat.oaddr);
+ es->es_if.if_unit = ui->ui_unit;
+ es->es_if.if_name = "en";
+ es->es_if.if_mtu = ENMTU;
+ es->es_if.if_net = ui->ui_flags & 0xff;
+ es->es_if.if_host[0] =
+ (~(((struct endevice *)eninfo[ui->ui_unit]->ui_addr)->en_addr)) & 0xff;
+ sin = (struct sockaddr_in *)&es->es_if.if_addr;
+ sin->sin_family = AF_INET;
+ sin->sin_addr = if_makeaddr(es->es_if.if_net, es->es_if.if_host[0]);
+ sin = (struct sockaddr_in *)&es->es_if.if_broadaddr;
+ sin->sin_family = AF_INET;
+ sin->sin_addr = if_makeaddr(es->es_if.if_net, 0);
+ es->es_if.if_flags = IFF_BROADCAST;
+ es->es_if.if_init = eninit;
+ es->es_if.if_output = enoutput;
+ es->es_if.if_ubareset = enreset;
+ es->es_ifuba.ifu_flags = UBA_NEEDBDP | UBA_NEED16;
+ if_attach(&es->es_if);
+#if NIMP == 0
+ /* here's one for you john baby.... */
+ enlhinit((ui->ui_flags &~ 0xff) | 0x0a);