]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/9/pc/ethersmc.c
[9front] [PATCH] audiohda: add PCI ID for Intel C610/X99
[plan9front.git] / sys / src / 9 / pc / ethersmc.c
old mode 100755 (executable)
new mode 100644 (file)
index 65ebffc..1241c60
@@ -10,7 +10,7 @@
 #include "io.h"
 #include "../port/error.h"
 #include "../port/netif.h"
-#include "etherif.h"
+#include "../port/etherif.h"
 
 enum {
        IoSize          = 0x10,         /* port pool size */
@@ -405,7 +405,7 @@ receive(Ether* ether)
                bp->wp++;
        }
          
-       etheriq(ether, bp, 1);
+       etheriq(ether, bp);
        ether->inpackets++;
        outs(port + MmuCmd, McRelease);
 }
@@ -644,7 +644,6 @@ ifstat(Ether* ether, void* a, long n, ulong offset)
                return 0;
 
        ctlr = ether->ctlr;
-       p = malloc(READSTR);
 
        s = 0;
        if (ctlr->rev > 0) {
@@ -660,6 +659,7 @@ ifstat(Ether* ether, void* a, long n, ulong offset)
                }
        }
 
+       p = smalloc(READSTR);
        len = snprint(p, READSTR, "rev: 91c%s\n", (s) ? s : "???");
        len += snprint(p + len, READSTR - len, "rxovrn: %uld\n", ctlr->rovrn);
        len += snprint(p + len, READSTR - len, "lcar: %uld\n", ctlr->lcar);
@@ -708,13 +708,14 @@ reset(Ether* ether)
                return -1;
        }
 
-       ether->ctlr = malloc(sizeof(Smc91xx));
-       ctlr = ether->ctlr;
+       ctlr = malloc(sizeof(Smc91xx));
        if (ctlr == 0) {
+               print("smc: can't allocate memory\n");
                iofree(ether->port);
                pcmspecialclose(slot);
                return -1;
        }
+       ether->ctlr = ctlr;
 
        ilock(ctlr);
        ctlr->rev = 0;
@@ -765,12 +766,15 @@ reset(Ether* ether)
 
        ether->attach = attach;
        ether->transmit = transmit;
-       ether->interrupt = interrupt;
        ether->ifstat = ifstat;
        ether->promiscuous = promiscuous;
        ether->multicast = multicast;
        ether->arg = ether;
+
        iunlock(ctlr);
+
+       intrenable(ether->irq, interrupt, ether, ether->tbdf, ether->name);
+
        return 0;
 }