]> Zhao Yanbai Git Server - minix.git/commitdiff
umap fix
authorBen Gras <ben@minix3.org>
Mon, 8 Dec 2008 17:06:38 +0000 (17:06 +0000)
committerBen Gras <ben@minix3.org>
Mon, 8 Dec 2008 17:06:38 +0000 (17:06 +0000)
drivers/rtl8139/rtl8139.c

index 47512a41173c935ab87a81e8430707648a18c5ae..836984bec5f0169fec7fd2cf40cc804958695cf0 100755 (executable)
@@ -301,6 +301,7 @@ PRIVATE int int_event_check;                /* set to TRUE if events arrived */
 
 static char *progname;
 extern int errno;
+u32_t system_hz;
 
 /*===========================================================================*
  *                             main                                 *
@@ -313,6 +314,8 @@ int main(int argc, char *argv[])
        re_t *rep;
        long v;
 
+       system_hz = sys_hz();
+
        (progname=strrchr(argv[0],'/')) ? progname++ : (progname=argv[0]);
 
        env_setargs(argc, argv);
@@ -518,7 +521,7 @@ message *mp;
 
                tmra_inittimer(&rl_watchdog);
                /* Use a synchronous alarm instead of a watchdog timer. */
-               sys_setalarm(HZ, 0);
+               sys_setalarm(system_hz, 0);
        }
 
        port = mp->DL_PORT;
@@ -773,14 +776,10 @@ re_t *rep;
 
 #define BUF_ALIGNMENT (64*1024)
 
-       if(!(mallocbuf = malloc(BUF_ALIGNMENT + tot_bufsize))) {
+       if(!(mallocbuf = alloc_contig(BUF_ALIGNMENT + tot_bufsize, 0, &buf))) {
            panic("RTL8139","Couldn't allocate kernel buffer",i);
        }
 
-       if(OK != (i = sys_umap(SELF, D, (vir_bytes) mallocbuf, tot_bufsize, &buf))) {
-           panic("RTL8139","Couldn't re-map malloced buffer",i);
-       }
-
        /* click-align mallocced buffer. this is what we used to get
         * from kmalloc() too.
         */
@@ -872,7 +871,7 @@ re_t *rep;
        do {
                if (!(rl_inb(port, RL_BMCR) & MII_CTRL_RST))
                        break;
-       } while (getuptime(&t1)==OK && (t1-t0) < HZ);
+       } while (getuptime(&t1)==OK && (t1-t0) < system_hz);
        if (rl_inb(port, RL_BMCR) & MII_CTRL_RST)
                panic("rtl8139","reset PHY failed to complete", NO_NUM);
 #endif
@@ -885,7 +884,7 @@ re_t *rep;
        do {
                if (!(rl_inb(port, RL_CR) & RL_CR_RST))
                        break;
-       } while (getuptime(&t1)==OK && (t1-t0) < HZ);
+       } while (getuptime(&t1)==OK && (t1-t0) < system_hz);
        printf("rl_reset_hw: (after reset) port = 0x%x, RL_CR = 0x%x\n",
                port, rl_inb(port, RL_CR));
        if (rl_inb(port, RL_CR) & RL_CR_RST)
@@ -2225,7 +2224,7 @@ re_t *rep;
        do {
                if (!(rl_inb(port, RL_CR) & RL_CR_RE))
                        break;
-       } while (getuptime(&t1)==OK && (t1-t0) < HZ);
+       } while (getuptime(&t1)==OK && (t1-t0) < system_hz);
        if (rl_inb(port, RL_CR) & RL_CR_RE)
                panic("rtl8139","cannot disable receiver", NO_NUM);
 
@@ -2627,7 +2626,7 @@ re_t *rep;
                        do {
                                if (!(rl_inb(port, RL_CR) & RL_CR_TE))
                                        break;
-                       } while (getuptime(&t1)==OK && (t1-t0) < HZ);
+                       } while (getuptime(&t1)==OK && (t1-t0) < system_hz);
                        if (rl_inb(port, RL_CR) & RL_CR_TE)
                        {
                          panic("rtl8139","cannot disable transmitter",
@@ -2802,7 +2801,7 @@ timer_t *tp;
        int i;
        re_t *rep;
        /* Use a synchronous alarm instead of a watchdog timer. */
-       sys_setalarm(HZ, 0);
+       sys_setalarm(system_hz, 0);
 
        for (i= 0, rep = &re_table[0]; i<RE_PORT_NR; i++, rep++)
        {