]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
Modify gPXE core and drivers to work with the new timer subsystem
authorAlexey Zaytsev <alexey.zaytsev@gmail.com>
Sun, 2 Mar 2008 00:41:10 +0000 (03:41 +0300)
committerAlexey Zaytsev <alexey.zaytsev@gmail.com>
Sun, 2 Mar 2008 00:41:10 +0000 (03:41 +0300)
Signed-off-by: Alexey Zaytsev <alexey.zaytsev@gmail.com>
58 files changed:
src/arch/i386/Makefile
src/arch/i386/firmware/pcbios/gateA20.c
src/arch/i386/include/latch.h [deleted file]
src/core/getkey.c
src/core/misc.c
src/core/random.c
src/core/serial.c
src/drivers/bitbash/bitbash.c
src/drivers/bitbash/i2c_bit.c
src/drivers/bitbash/spi_bit.c
src/drivers/bus/eisa.c
src/drivers/bus/isapnp.c
src/drivers/bus/mca.c
src/drivers/infiniband/arbel.c
src/drivers/infiniband/hermon.c
src/drivers/net/3c509.c
src/drivers/net/3c515.c
src/drivers/net/3c595.c
src/drivers/net/3c5x9.c
src/drivers/net/3c90x.c
src/drivers/net/amd8111e.c
src/drivers/net/bnx2.c
src/drivers/net/dmfe.c
src/drivers/net/e1000/e1000.h
src/drivers/net/e1000/e1000_osdep.h
src/drivers/net/eepro.c
src/drivers/net/eepro100.c
src/drivers/net/epic100.c
src/drivers/net/etherfabric.c
src/drivers/net/forcedeth.c
src/drivers/net/ipoib.c
src/drivers/net/mlx_ipoib/mt23108_imp.c
src/drivers/net/mlx_ipoib/mt25218_imp.c
src/drivers/net/mtnic.c
src/drivers/net/natsemi.c
src/drivers/net/pcnet32.c
src/drivers/net/prism2.c
src/drivers/net/r8169.c
src/drivers/net/rtl8139.c
src/drivers/net/sis900.c
src/drivers/net/smc9000.c
src/drivers/net/sundance.c
src/drivers/net/tg3.c
src/drivers/net/tlan.c
src/drivers/net/via-rhine.c
src/drivers/net/via-velocity.h
src/drivers/net/w89c840.c
src/drivers/nvs/spi.c
src/drivers/nvs/threewire.c
src/hci/mucurses/kb.c
src/hci/shell_banner.c
src/include/etherboot.h
src/include/gpxe/dhcp.h
src/include/gpxe/tcp.h
src/include/timer.h [deleted file]
src/net/retry.c
src/net/tcp.c
src/net/udp/dhcp.c

index 5e7416cbbfcdb0ebe3be8a76d8b6e76757c8d7e6..da7976df782c5f3df4318f4ac3589a840e2fbfa0 100644 (file)
@@ -7,6 +7,7 @@ ISOLINUX_BIN    = /usr/lib/syslinux/isolinux.bin
 SRCDIRS                += arch/i386/core arch/i386/transitions arch/i386/prefix
 SRCDIRS                += arch/i386/firmware/pcbios
 SRCDIRS                += arch/i386/image
+SRCDIRS                += arch/i386/drivers
 SRCDIRS                += arch/i386/drivers/bus
 SRCDIRS                += arch/i386/drivers/net
 SRCDIRS                += arch/i386/drivers/disk
index 66b4da18aad7aa69a370bd3cd4f801494b8650d7..2caac8941682a23adcb6608af5ada82b8bfdefbf 100644 (file)
@@ -1,8 +1,7 @@
 #include <stdio.h>
-#include "realmode.h"
-#include "timer.h"
-#include "latch.h"
-#include "bios.h"
+#include <realmode.h>
+#include <bios.h>
+#include <gpxe/timer.h>
 
 #define K_RDWR         0x60            /* keyboard data & cmds (read/write) */
 #define K_STATUS       0x64            /* keyboard status */
diff --git a/src/arch/i386/include/latch.h b/src/arch/i386/include/latch.h
deleted file mode 100644 (file)
index 5000d58..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef LATCH_H
-#define LATCH_H
-
-#define        TICKS_PER_SEC           18
-
-/* For different calibrators of the TSC move the declaration of
- * sleep_latch and the definitions of it's length here...
- */
-
-extern unsigned long currticks ( void );
-
-#endif /* LATCH_H */
index 71ec6cc1be4bdd236ae85dd7589d3512aa18f8f2..1551cf37c659b7ccac299dd199d631aa7fda9ee3 100644 (file)
@@ -17,9 +17,9 @@
  */
 
 #include <console.h>
-#include <latch.h>
 #include <gpxe/process.h>
 #include <gpxe/keys.h>
+#include <gpxe/timer.h>
 
 /** @file
  *
index fcf0aeab39f5c6a3bb18003311aa436e325f5e43..a54f5a10856624fa1db2dd2640520faf61c10168 100644 (file)
@@ -4,8 +4,8 @@ MISC Support Routines
 
 #include <stdlib.h>
 #include <byteswap.h>
-#include <latch.h>
 #include <gpxe/in.h>
+#include <gpxe/timer.h>
 
 /**************************************************************************
 INET_ATON - Convert an ascii x.x.x.x to binary form
index e4a70d434fb64af53596e1136c97ef043d6ec8d2..d34e763a6b68cf2983bd38980be5e9001f4cd988 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #include <stdlib.h>
-#include <latch.h>
+#include <gpxe/timer.h>
 
 static int32_t rnd_seed = 0;
 
index f325bc45b3fe6c05360c4c2bea3b79fc29c001b2..f6d0ecbb9670e8b2303cafe1eb589f6935b3562a 100644 (file)
@@ -15,7 +15,7 @@
 #include "console.h"
 #include <gpxe/init.h>
 #include "io.h"
-#include "timer.h"
+#include <unistd.h>
 #include "config/serial.h"
 
 /* Set default values if none specified */
index ec94feeeaf103d7c4d269375c8fc4002701cfa29..c6f935202c21a6f97d37054aec947138753baf5b 100644 (file)
@@ -16,7 +16,6 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <timer.h>
 #include <gpxe/bitbash.h>
 
 /** @file
index d8fbacc0e93e7717e941862c2b112bed2d477486..a3af610b0e7d19fedf50aeaf331d15bb9982e88c 100644 (file)
@@ -20,7 +20,7 @@
 #include <stdint.h>
 #include <errno.h>
 #include <assert.h>
-#include <timer.h>
+#include <unistd.h>
 #include <gpxe/bitbash.h>
 #include <gpxe/i2c.h>
 
index a4e7136f8b5e701e063cd0bba32bc1b9268ab898..ef87b5a24a2d7bade13deda3c10c001e5a67eb9f 100644 (file)
@@ -22,7 +22,7 @@
 #include <byteswap.h>
 #include <errno.h>
 #include <assert.h>
-#include <timer.h>
+#include <unistd.h>
 #include <gpxe/bitbash.h>
 #include <gpxe/spi_bit.h>
 
index d9d02d727f68babd1f989920515aeeb71b720fd7..ee03df3af16790b45f0240cc42d0c2247d46406f 100644 (file)
@@ -4,7 +4,7 @@
 #include <stdio.h>
 #include <errno.h>
 #include <io.h>
-#include <timer.h>
+#include <unistd.h>
 #include <gpxe/eisa.h>
 
 static struct eisa_driver eisa_drivers[0]
index 7903208d0ac15f9823dabad73a49e7b62a8d4637..f4968eb1363a8f9dccfdd9f71891d4d5ef9c52c8 100644 (file)
@@ -61,7 +61,7 @@
 #include <stdio.h>
 #include <errno.h>
 #include <io.h>
-#include <timer.h>
+#include <unistd.h>
 #include <gpxe/isapnp.h>
 
 /**
index 375a68344ce5069ece1b19d3518ccb9e142c16f0..eb7b7e3951b090ae069f141b0984b1a9b31453f7 100644 (file)
@@ -11,7 +11,6 @@
 #include <stdio.h>
 #include <errno.h>
 #include <io.h>
-#include <timer.h>
 #include <gpxe/mca.h>
 
 static struct mca_driver mca_drivers[0]
index 147cf8b90b7e6d311b78f2abd763b8427a2f8243..462638eae4c38bb0628df8c115645de819971872 100644 (file)
@@ -26,7 +26,6 @@
 #include <strings.h>
 #include <unistd.h>
 #include <errno.h>
-#include <timer.h>
 #include <byteswap.h>
 #include <gpxe/pci.h>
 #include <gpxe/malloc.h>
index fecf3988229a97db76c4da98c86eb8702f314a77..c10559f98578578e0d5d1325a70b65ed76f70105 100644 (file)
@@ -24,7 +24,6 @@
 #include <strings.h>
 #include <unistd.h>
 #include <errno.h>
-#include <timer.h>
 #include <byteswap.h>
 #include <gpxe/pci.h>
 #include <gpxe/malloc.h>
index e704cfca1e14d19381d41cde4437e5db7ef8a0da..8a15aff29412565a0a8f50b0ee0d4d56370dd918 100644 (file)
@@ -9,7 +9,7 @@
 #include <string.h>
 #include <errno.h>
 #include <io.h>
-#include <timer.h>
+#include <unistd.h>
 #include <gpxe/device.h>
 #include <gpxe/isa.h>
 #include "3c509.h"
index d0bf3189e2a8127aa7e20c468ae4cecc2875cb80..02f03dc7894cf2f82e68daaa134a52050a60bbc6 100644 (file)
@@ -50,7 +50,6 @@
 #include "nic.h"
 #include <gpxe/isapnp.h>
 #include <gpxe/isa.h> /* for ISA_ROM */
-#include "timer.h"
 #include <gpxe/ethernet.h>
 
 static void t3c515_wait(unsigned int nticks)
index 572a99e0bec735f4fcc83915bd3942cc4c6fc9cf..7138f936ecfab7f1171479e45b8f98c852cb5a27 100644 (file)
@@ -30,7 +30,6 @@
 #include <gpxe/pci.h>
 #include <gpxe/ethernet.h>
 #include "3c595.h"
-#include "timer.h"
 
 static struct nic_operations t595_operations;
 
index 1ade6f47de60ceebc03012fab363bbd712f232b3..565044a1120666ec1c7775fdc9344814f00f9d31 100644 (file)
@@ -28,7 +28,6 @@ $Id$
 #include "etherboot.h"
 #include "nic.h"
 #include <gpxe/isa.h>
-#include "timer.h"
 #include "3c509.h"
 
 static enum { none, bnc, utp } connector = none;       /* for 3C509 */
index 8e1f160eacce37e7765e4bbb8efb2e3c40a8f767..8158239d62a2aabea486f00bfdc10d2373b2ae8d 100644 (file)
@@ -43,7 +43,6 @@
 #include "nic.h"
 #include <gpxe/pci.h>
 #include <gpxe/ethernet.h>
-#include "timer.h"
 
 static struct nic_operations a3c90x_operations;
 
@@ -498,6 +497,7 @@ a3c90x_transmit(struct nic *nic __unused, const char *d, unsigned int t,
 
     unsigned char status;
     unsigned i, retries;
+    tick_t ct;
 
     for (retries=0; retries < XMIT_RETRIES ; retries++)
        {
@@ -540,9 +540,10 @@ a3c90x_transmit(struct nic *nic __unused, const char *d, unsigned int t,
            ;
 
        /** Wait for NIC Transmit to Complete **/
-       load_timer2(10*TICKS_PER_MS);   /* Give it 10 ms */
+       ct = currticks();
+
        while (!(inw(INF_3C90X.IOAddr + regCommandIntStatus_w)&0x0004) &&
-               timer2_running())
+               ct + 10*USECS_IN_MSEC < currticks());
                ;
 
        if (!(inw(INF_3C90X.IOAddr + regCommandIntStatus_w)&0x0004))
index c26c07cf0c47f957af556b0d4b553e81b49e8bc4..1c41add12a86365db6a8ae595cec0b3222313414 100644 (file)
@@ -33,7 +33,6 @@
 #include "mii.h"
 #include <gpxe/pci.h>
 #include <gpxe/ethernet.h>
-#include "timer.h"
 #include "string.h"
 #include "stdint.h"
 #include "amd8111e.h"
index fdd6655bb30f84ba3050479ccf61e2fdbcf31d11..9c989c4c12c3bec90bd0e305c706a5b1a9cc9110 100644 (file)
@@ -18,7 +18,6 @@
 #include <errno.h>
 #include <gpxe/pci.h>
 #include <gpxe/ethernet.h>
-#include "timer.h"
 #include "string.h"
 #include "bnx2.h"
 #include "bnx2_fw.h"
index 34e211d4b03dff60b69cd4ebf2af9ba6314e2f65..9cf50418d0a1a563ffb550711a50c792120170ef 100644 (file)
@@ -43,7 +43,6 @@
 /* to get the PCI support functions, if this is a PCI NIC */
 #include <gpxe/pci.h>
 #include <gpxe/ethernet.h>
-#include "timer.h"
 
 /* #define EDEBUG 1 */
 #ifdef EDEBUG
index b4bc1d874ff42e20ec075592abb7c1fd7667708b..4ae414513aedad95df9c71b68809ed4fe376490d 100644 (file)
@@ -36,7 +36,6 @@
 #include <stdio.h>
 #include <io.h>
 #include <errno.h>
-#include <timer.h>
 #include <byteswap.h>
 #include <gpxe/pci.h>
 #include <gpxe/malloc.h>
index 04e14892712f8f62c71fd3d14bd4dc69008cd040..7df9b5e9d74fbf383e7fd4133e728776f5f97367 100644 (file)
@@ -39,7 +39,7 @@
 #include <stdio.h>
 #include <io.h>
 #include <errno.h>
-#include <timer.h>
+#include <unistd.h>
 #include <byteswap.h>
 #include <gpxe/pci.h>
 #include <gpxe/if_ether.h>
index 0a9c95e65368de1bf875556910b8d8871aedbdc9..2a163d1b35db3da4d992998c1889e6002eaa9ae0 100644 (file)
@@ -35,7 +35,6 @@ has 34 pins, the top row of 2 are not used.
 #include <errno.h>
 #include "nic.h"
 #include <gpxe/isa.h>
-#include "timer.h"
 #include <gpxe/ethernet.h>
 
 /* Different 82595 chips */
index bb46d163c8fc9f5bfe0b0fe4bffa04953b9962b8..f746976add6f53a0bf39201e30b8848c286b13b4 100644 (file)
 #include "nic.h"
 #include <gpxe/ethernet.h>
 #include <gpxe/pci.h>
-#include "timer.h"
 
 static int ioaddr;
 
@@ -408,6 +407,7 @@ static void eepro100_transmit(struct nic *nic, const char *d, unsigned int t, un
        } hdr;
        unsigned short status;
        int s1, s2;
+       tick_t ct;
 
        status = inw(ioaddr + SCBStatus);
        /* Acknowledge all of the current interrupt sources ASAP. */
@@ -445,8 +445,10 @@ static void eepro100_transmit(struct nic *nic, const char *d, unsigned int t, un
        wait_for_cmd_done(ioaddr + SCBCmd);
 
        s1 = inw (ioaddr + SCBStatus);
-       load_timer2(10*TICKS_PER_MS);           /* timeout 10 ms for transmit */
-       while (!txfd.status && timer2_running())
+
+       ct = currticks();
+       /* timeout 10 ms for transmit */
+       while (!txfd.status && ct + 10*USECS_IN_MSEC)
                /* Wait */;
        s2 = inw (ioaddr + SCBStatus);
 
@@ -606,6 +608,7 @@ static int eepro100_probe ( struct nic *nic, struct pci_device *pci ) {
        int read_cmd, ee_size;
        int options;
        int rx_mode;
+       tick_t ct;
 
        /* we cache only the first few words of the EEPROM data
           be careful not to access beyond this array */
@@ -749,8 +752,8 @@ static int eepro100_probe ( struct nic *nic, struct pci_device *pci ) {
 
        whereami ("started TX thingy (config, iasetup).");
 
-       load_timer2(10*TICKS_PER_MS);
-       while (!txfd.status && timer2_running())
+       ct = currticks();
+       while (!txfd.status && ct + 10*USECS_IN_MSEC < currticks())
                /* Wait */;
 
        /* Read the status register once to disgard stale data */
index e79da2b9bb64f1a256d31831a461c572f7de9e0a..67b4f0fb4d5e0dbcc9c0ca8a2e3636765aaa05a8 100644 (file)
@@ -8,7 +8,6 @@
 #include <gpxe/pci.h>
 #include <gpxe/ethernet.h>
 #include "nic.h"
-#include "timer.h"
 #include "console.h"
 #include "epic100.h"
 
@@ -310,6 +309,7 @@ epic100_transmit(struct nic *nic, const char *destaddr, unsigned int type,
     unsigned short nstype;
     unsigned char *txp;
     int entry;
+    tick_t ct;
 
     /* Calculate the next Tx descriptor entry. */
     entry = cur_tx % TX_RING_SIZE;
@@ -339,18 +339,20 @@ epic100_transmit(struct nic *nic, const char *destaddr, unsigned int type,
      * set the base address with the "ownership"
      * bits last.
      */
-    
+   
     tx_ring[entry].buflength |= cpu_to_le32(len);
-    tx_ring[entry].status = cpu_to_le32(len << 16) | 
+    tx_ring[entry].status = cpu_to_le32(len << 16) |
            cpu_to_le32(TRING_OWN);     /* Pass ownership to the chip. */
 
     cur_tx++;
 
     /* Trigger an immediate transmit demand. */
-    outl(CR_QUEUE_TX, command); 
-    
-    load_timer2(10*TICKS_PER_MS);         /* timeout 10 ms for transmit */
-    while ((le32_to_cpu(tx_ring[entry].status) & (TRING_OWN)) && timer2_running())
+    outl(CR_QUEUE_TX, command);
+
+    ct = currticks();
+    /* timeout 10 ms for transmit */
+    while ((le32_to_cpu(tx_ring[entry].status) & (TRING_OWN)) &&
+               ct + 10*USECS_IN_MSEC < currticks())
        /* Wait */;
 
     if ((le32_to_cpu(tx_ring[entry].status) & TRING_OWN) != 0)
index 6b76345160e51b64ad279edc82fc09dcaccbb622..90cc73f4b675f71a2b9f9eb3e5ea88a149008a7c 100644 (file)
@@ -24,7 +24,6 @@
 #include <gpxe/i2c.h>
 #include <gpxe/spi.h>
 #include <gpxe/nvo.h>
-#include "timer.h"
 #define dma_addr_t unsigned long
 #include "etherfabric.h"
 
index 9ef1dd79327af99d7d7b0c4245e4bd7ebb94a45f..f619588528ef52ec2645d1bd3dda5253454056d8 100644 (file)
@@ -51,7 +51,6 @@
 #include <gpxe/pci.h>
 /* Include timer support functions */
 #include <gpxe/ethernet.h>
-#include "timer.h"
 #include "mii.h"
 
 #define drv_version "v1.2"
index 905051bfad389ed4adeedfd2d7271d4df2142f8f..d457b258a4095afe4bff41ea41dc1d336fdac5fe 100644 (file)
@@ -22,7 +22,6 @@
 #include <string.h>
 #include <byteswap.h>
 #include <errno.h>
-#include "timer.h"
 #include <gpxe/if_arp.h>
 #include <gpxe/iobuf.h>
 #include <gpxe/netdevice.h>
index 4e601668cf7f3a4ad98effac25d7c975beb6ad88..bb2383c5fa7f5fa6a27beeb18fee8d528740be31 100644 (file)
@@ -37,7 +37,6 @@ static void be_to_cpu_buf(void *buf, int size)
        }
 }
 
-#include "timer.h"
 #include "cmdif_mt23108.c"
 #include "cmdif_comm.c"
 #include "ib_mt23108.c"
index fe407041e43209612408154bc803fb8d031ca0f8..007ee653c5867a6246db4e9bcd4a5ea99a92847c 100644 (file)
@@ -37,7 +37,6 @@ static void be_to_cpu_buf(void *buf, int size)
        }
 }
 
-#include "timer.h"
 #include "cmdif_mt25218.c"
 #include "cmdif_comm.c"
 #include "ib_mt25218.c"
index a568b2f7e02b7d643696d03414ec01706eecd340..536fcb8d7318a12241f3b89577b6d7a6f8d421af 100755 (executable)
@@ -37,7 +37,7 @@
 #include <gpxe/umalloc.h>
 #include <bits/byteswap.h>
 #include <little_bswap.h>
-#include <timer.h>
+#include <unistd.h>
 #include <gpxe/pci.h>
 #include <gpxe/ethernet.h>
 #include <gpxe/netdevice.h>
index 7204761091bd2ecc665a96a98ae55bd69afbbf87..98a5ff84851073789411df2922c385da3024a59a 100644 (file)
@@ -63,8 +63,8 @@
 #include <stdio.h>
 #include <io.h>
 #include <errno.h>
-#include <timer.h>
 #include <byteswap.h>
+#include <unistd.h>
 #include <gpxe/pci.h>
 #include <gpxe/if_ether.h>
 #include <gpxe/ethernet.h>
index e4318429aa0252f893b2cf8f2c03045322928fbf..d8529da176dc455d9aaa8913812d8fcb53fe4f05 100644 (file)
@@ -43,7 +43,6 @@
 #include "nic.h"
 #include <gpxe/pci.h>
 #include <gpxe/ethernet.h>
-#include "timer.h"
 #include "mii.h"
 
 /* void hex_dump(const char *data, const unsigned int len); */
index 3c512519213715ccccc6589f178cad12d808a2fd..aaf4c968f1e2ae94da7cf596a5ef2ff4924ae033 100644 (file)
@@ -62,7 +62,6 @@ static const char hardcoded_ssid[] = "";
  * quicker to convert code from the Linux Prism2 driver.
  */
 #include <errno.h>
-#include "timer.h"
 #define __le16_to_cpu(x) (x)
 #define __le32_to_cpu(x) (x)
 #define __cpu_to_le16(x) (x)
index 52cb0d0e4cc01e413385f37da65d43a1a145f950..ab9a30f881558e202f03d455be0c9fde1b584d56 100644 (file)
@@ -49,7 +49,6 @@
 #include <gpxe/pci.h>
 #include <gpxe/ethernet.h>
 #include <gpxe/malloc.h>
-#include "timer.h"
 
 #define drv_version "v1.6"
 #define drv_date "03-27-2004"
index b4c99fcbdb33ca7b0f3c5c7171dbc0cbf78c8c6f..83fac554a7cd374a5fc8947f9765898a2c806fa2 100644 (file)
@@ -71,7 +71,7 @@
 #include <stdio.h>
 #include <io.h>
 #include <errno.h>
-#include <timer.h>
+#include <unistd.h>
 #include <byteswap.h>
 #include <gpxe/pci.h>
 #include <gpxe/if_ether.h>
index cf9b2ce6af98313ccccbfaaf742e1949b69da947..585265063233664572c23749882de32939ebcf36 100644 (file)
@@ -46,7 +46,6 @@
 #include "etherboot.h"
 #include <gpxe/pci.h>
 #include "nic.h"
-#include "timer.h"
 
 #include "sis900.h"
 
index c6219ee74e32a1f022de4026a9a6fc8b6a5eba1d..31a1e1b118e4892413d56a3110addc8a1d9ad133 100644 (file)
@@ -40,7 +40,6 @@
 #include "etherboot.h"
 #include "nic.h"
 #include <gpxe/isa.h>
-#include "timer.h"
 #include "smc9000.h"
 
 # define _outb outb
index 3bbfbfbbda490bf4e368aed1a391f5fcbc1ad74a..3b6f5a88b73bb682dc2ff3f92fc98e112d80c8bb 100644 (file)
@@ -46,7 +46,6 @@
 #include "nic.h"
 /* to get the PCI support functions, if this is a PCI NIC */
 #include <gpxe/pci.h>
-#include "timer.h"
 #include "mii.h"
 
 #define drv_version "v1.12"
index 2188def42061a59685e912375d8e1fc6e2c8a89d..57b9df1e0dc5a2a8a3ed4cd3cfd3fb5e24b5ec75 100644 (file)
@@ -17,7 +17,6 @@
 #include <errno.h>
 #include <gpxe/pci.h>
 #include <gpxe/ethernet.h>
-#include "timer.h"
 #include "string.h"
 #include "tg3.h"
 
index 60ca182e68170fb151151b712f5db585f097031d..4fae017037f923c18139be3a57f4f6477f364ccf 100644 (file)
@@ -42,7 +42,6 @@
 #include "nic.h"
 #include <gpxe/pci.h>
 #include <gpxe/ethernet.h>
-#include "timer.h"
 #include "tlan.h"
 
 #define drv_version "v1.4"
index 0c955fab38ab5271faa31e7f44820da64b160a94..81350091b7d1c6ddc4e3330615833916264ce9ef 100644 (file)
@@ -50,7 +50,6 @@ static const char *version = "rhine.c v1.0.2 2004-10-29\n";
 #include "nic.h"
 #include <gpxe/pci.h>
 #include <gpxe/ethernet.h>
-#include "timer.h"
 
 /* define all ioaddr */
 
@@ -785,6 +784,7 @@ ReadMII (int byMIIIndex, int ioaddr)
     char byMIIAdrbak;
     char byMIICRbak;
     char byMIItemp;
+    tick_t ct;
 
     byMIIAdrbak = inb (byMIIAD);
     byMIICRbak = inb (byMIICR);
@@ -799,8 +799,8 @@ ReadMII (int byMIIIndex, int ioaddr)
     byMIItemp = inb (byMIICR);
     byMIItemp = byMIItemp & 0x40;
 
-    load_timer2(2*TICKS_PER_MS);
-    while (byMIItemp != 0 && timer2_running())
+    ct = currticks();
+    while (byMIItemp != 0 && ct + 2*USECS_IN_MSEC < currticks())
     {
        byMIItemp = inb (byMIICR);
        byMIItemp = byMIItemp & 0x40;
@@ -825,6 +825,7 @@ WriteMII (char byMIISetByte, char byMIISetBit, char byMIIOP, int ioaddr)
     char byMIIAdrbak;
     char byMIICRbak;
     char byMIItemp;
+    tick_t ct;
 
 
     byMIIAdrbak = inb (byMIIAD);
@@ -840,8 +841,8 @@ WriteMII (char byMIISetByte, char byMIISetBit, char byMIIOP, int ioaddr)
     byMIItemp = inb (byMIICR);
     byMIItemp = byMIItemp & 0x40;
 
-    load_timer2(2*TICKS_PER_MS);
-    while (byMIItemp != 0 && timer2_running())
+    ct = currticks();
+    while (byMIItemp != 0 && ct + 2*USECS_IN_MSEC < currticks())
     {
        byMIItemp = inb (byMIICR);
        byMIItemp = byMIItemp & 0x40;
@@ -870,8 +871,8 @@ WriteMII (char byMIISetByte, char byMIISetBit, char byMIIOP, int ioaddr)
     byMIItemp = inb (byMIICR);
     byMIItemp = byMIItemp & 0x20;
 
-    load_timer2(2*TICKS_PER_MS);
-    while (byMIItemp != 0 && timer2_running())
+    ct = currticks();
+    while (byMIItemp != 0 && ct + 2*USECS_IN_MSEC < currticks())
     {
        byMIItemp = inb (byMIICR);
        byMIItemp = byMIItemp & 0x20;
@@ -1345,6 +1346,7 @@ rhine_transmit (struct nic *nic,
     unsigned char CR1bak;
     unsigned char CR0bak;
     unsigned int nstype;
+    tick_t ct;
 
 
     /*printf ("rhine_transmit\n"); */
@@ -1385,9 +1387,10 @@ rhine_transmit (struct nic *nic,
     outb (CR1bak, byCR1);
     do
     {
-        load_timer2(10*TICKS_PER_MS);
+       ct = currticks();
         /* Wait until transmit is finished or timeout*/
-        while((tp->tx_ring[entry].tx_status.bits.own_bit !=0) && timer2_running())
+        while((tp->tx_ring[entry].tx_status.bits.own_bit !=0) &&
+               ct + 10*USECS_IN_MSEC < currticks())
         ;
 
         if(tp->tx_ring[entry].tx_status.bits.terr == 0)
index c296d28992d405fe262b9f0b70278c71472de913..a43028bd9063bb23342cc85a630104797a3d28f6 100644 (file)
@@ -24,8 +24,6 @@
  *       Copyright (c) 2006 by Timothy Legge <tlegge@rogers.com>
  */
 
-#include "timer.h"
-
 #ifndef VELOCITY_H
 #define VELOCITY_H
 
index 2f141aa98c9cd66f2d5f598a244778cf74514c63..14497640431cbf636d097200951c4ef00d03698a 100644 (file)
@@ -81,7 +81,6 @@
 #include "nic.h"
 #include <gpxe/pci.h>
 #include <gpxe/ethernet.h>
-#include "timer.h"
 
 static const char *w89c840_version = "driver Version 0.94 - December 12, 2003";
 
@@ -113,7 +112,7 @@ static const char *w89c840_version = "driver Version 0.94 - December 12, 2003";
 
 /* Operational parameters that usually are not changed. */
 /* Time in jiffies before concluding the transmitter is hung. */
-#define TX_TIMEOUT  (10*TICKS_PER_MS)
+#define TX_TIMEOUT  (10*USECS_IN_MSEC)
 
 #define PKT_BUF_SZ  1536  /* Size of each temporary Rx buffer.*/
 
@@ -487,6 +486,7 @@ static void w89c840_transmit(
     /* send the packet to destination */
     unsigned entry;
     int transmit_status;
+    tick_t ct;
 
     /* Caution: the write order is important here, set the field
        with the "ownership" bits last. */
@@ -535,8 +535,7 @@ static void w89c840_transmit(
     /* Now wait for TX to complete. */
     transmit_status = w840private.tx_ring[entry].status;
 
-    load_timer2(TX_TIMEOUT);
-
+    ct = currticks();
     {
 #if defined W89C840_DEBUG
         u32 intr_stat = 0;
@@ -547,7 +546,7 @@ static void w89c840_transmit(
              decode_interrupt(intr_stat);
 #endif
 
-                while ( (transmit_status & DescOwn) && timer2_running()) {
+                while ( (transmit_status & DescOwn) && ct + TX_TIMEOUT < currticks()) {
 
                     transmit_status = w840private.tx_ring[entry].status;
                 }
index be6b5904f1d9fc07e32d3e05c6bf4a761e9f6f1e..dbdc32f61e5a1203a4744680ae80cbefa6d70ccd 100644 (file)
@@ -18,7 +18,7 @@
 
 #include <stddef.h>
 #include <errno.h>
-#include <timer.h>
+#include <unistd.h>
 #include <gpxe/spi.h>
 
 /** @file
index 622e85857454f1326a4499d6d205c3961bcc13ec..dbecf90993b23843e94941d15dc3b5ac823c15e0 100644 (file)
@@ -18,7 +18,7 @@
 
 #include <stddef.h>
 #include <assert.h>
-#include <timer.h>
+#include <unistd.h>
 #include <gpxe/threewire.h>
 
 /** @file
index 291ee6ac8a02e7d3e73b15212d9a38f115543d82..cada729176d17e6eee15138890a8305226044b8a 100644 (file)
@@ -1,6 +1,6 @@
 #include <curses.h>
 #include <stddef.h>
-#include <timer.h>
+#include <unistd.h>
 #include "mucurses.h"
 
 /** @file
index d313d4dd036cd99c4ca127ee74da92ce101cf67b..62da487c78c598e062b3ed40170f793dfeb630a1 100644 (file)
@@ -18,8 +18,8 @@
 
 #include <stdio.h>
 #include <console.h>
-#include <latch.h>
 #include <gpxe/features.h>
+#include <gpxe/timer.h>
 #include <gpxe/shell_banner.h>
 
 /** @file
index 8d658194f3a9e0a3458f1f3458d988d97bc8579f..2a465954f29f3771167294c215dee423a4e42e10 100644 (file)
@@ -12,8 +12,8 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <strings.h>
-#include <latch.h>
 #include <console.h>
+#include <gpxe/timer.h>
 #include <gpxe/if_arp.h>
 #include <gpxe/if_ether.h>
 
index 9a9ba7484f6d784ed0eccb81604b1cb95166e85f..6db0e026c72a3bb08488b28067170e7a5167f0f5 100644 (file)
@@ -12,7 +12,6 @@
 #include <gpxe/in.h>
 #include <gpxe/refcnt.h>
 #include <gpxe/tables.h>
-#include <latch.h>
 
 struct net_device;
 struct job_interface;
index e2753120c9c83efdd2046b0592e9df866dca8395..264ec29b436802c7742698bd356f2281a25e334b 100644 (file)
@@ -9,7 +9,6 @@
  *
  */
 
-#include "latch.h"
 #include <gpxe/tcpip.h>
 
 /**
diff --git a/src/include/timer.h b/src/include/timer.h
deleted file mode 100644 (file)
index cd1b282..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef TIMER_H
-#define TIMER_H
-
-/*
- * This file should be removed as soon as there are no
- * currticks() abusers.
- */
-
-#include <stddef.h>
-/*
-#warning Please fix me. I'm abusing the deprecated include/timer.h
-*/
-#include <unistd.h>
-
-/* Duplicates include/gpxe/timer.h */
-typedef uint32_t tick_t;
-
-#define MSECS_IN_SEC (1000)
-#define USECS_IN_SEC (1000*1000)
-#define USECS_IN_MSEC (1000)
-
-#define        TICKS_PER_SEC USECS_IN_SEC
-
-tick_t currticks(void);
-
-#endif
-
index 0f711e6d1684d8b3447dc7b916edeae9c031d5d6..90b89711254428e9973ec7f18119b8ade50da225 100644 (file)
@@ -17,7 +17,7 @@
  */
 
 #include <stddef.h>
-#include <latch.h>
+#include <gpxe/timer.h>
 #include <gpxe/list.h>
 #include <gpxe/process.h>
 #include <gpxe/init.h>
index d6b44b02ba652a0cfd60ffc9676a3295d0870bfa..da8e87b4b4360b0fe90d3d6a7c4268ee3541f233 100644 (file)
@@ -4,7 +4,7 @@
 #include <assert.h>
 #include <errno.h>
 #include <byteswap.h>
-#include <timer.h>
+#include <gpxe/timer.h>
 #include <gpxe/iobuf.h>
 #include <gpxe/malloc.h>
 #include <gpxe/retry.h>
index 081fa841a1ff31b6e39dc92c1dc07327dc81426e..2cb258e4394927cade3971c8d454eb809d829c01 100644 (file)
@@ -33,6 +33,7 @@
 #include <gpxe/ip.h>
 #include <gpxe/uuid.h>
 #include <gpxe/dhcp.h>
+#include <gpxe/timer.h>
 
 /** @file
  *