X-Git-Url: http://git.joshuawise.com/netwatch.git/blobdiff_plain/3c2c3b0dd358924410d12f8a71b5fee7a3f02e83..7a914840b833dba82398623bbde04a1744627398:/net/net.c diff --git a/net/net.c b/net/net.c index b89abe2..575b5e4 100644 --- a/net/net.c +++ b/net/net.c @@ -1,36 +1,28 @@ #include +#include #include -#include "3c905.h" +#include "net.h" -static int found = 0, _bus, _dev, _fn; +static struct nic *_nic = 0x0; -static int bother_3c905(pci_dev_t *dev, void *nutrinus) +extern struct pci_driver a3c90x_driver; + +void eth_poll() { - if (dev->vid == 0x10B7 || dev->did == 0x9200) - { - outputf("Found a 3c905 to bother"); - - _bus = dev->bus; - _dev = dev->dev; - _fn = dev->fn; - found = 1; - - return 1; - } - return 0; + if (_nic) + _nic->poll(_nic, 0); } -void eth_poll() +int eth_register(struct nic *nic) { - if (!found) - return; - - pci_write16(_bus, _dev, _fn, 0x04, 0xFF); - - pci_write16(_bus, _dev, _fn, 0x04, 0x00); + if (_nic) + return -1; + _nic = nic; + return 0; } void eth_init() { - pci_probe(bother_3c905, 0x0); + if (pci_probe_driver(a3c90x_driver)) + outputf("found 3c90x, hopefully!"); }