- pci_write16(_bus, _dev, _fn, 0x04, 0x00);
+ memcpy(netif->hwaddr, nic->hwaddr, 6);
+ netif->mtu = 1500;
+ netif->hwaddr_len = ETHARP_HWADDR_LEN;
+ netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_LINK_UP;
+
+ return ERR_OK;
+}
+
+int eth_register(struct nic *nic)
+{
+ static struct ip_addr ipa = { 0 } , netmask = { 0 } , gw = { 0 };
+
+ if (_nic)
+ return -1;
+ netif_add(&_netif, &ipa, &netmask, &gw, (void*)nic, _init, ethernet_input);
+ netif_set_default(&_netif);
+ netif_set_up(&_netif);
+ dhcp_start(&_netif);
+ _nic = nic;
+ return 0;