Browse Source

Modify gPXE core and drivers to work with the new timer subsystem

Signed-off-by: Alexey Zaytsev <alexey.zaytsev@gmail.com>
tags/v0.9.4
Alexey Zaytsev 17 years ago
parent
commit
a1572e0ab0
58 changed files with 62 additions and 121 deletions
  1. 1
    0
      src/arch/i386/Makefile
  2. 3
    4
      src/arch/i386/firmware/pcbios/gateA20.c
  3. 0
    12
      src/arch/i386/include/latch.h
  4. 1
    1
      src/core/getkey.c
  5. 1
    1
      src/core/misc.c
  6. 1
    1
      src/core/random.c
  7. 1
    1
      src/core/serial.c
  8. 0
    1
      src/drivers/bitbash/bitbash.c
  9. 1
    1
      src/drivers/bitbash/i2c_bit.c
  10. 1
    1
      src/drivers/bitbash/spi_bit.c
  11. 1
    1
      src/drivers/bus/eisa.c
  12. 1
    1
      src/drivers/bus/isapnp.c
  13. 0
    1
      src/drivers/bus/mca.c
  14. 0
    1
      src/drivers/infiniband/arbel.c
  15. 0
    1
      src/drivers/infiniband/hermon.c
  16. 1
    1
      src/drivers/net/3c509.c
  17. 0
    1
      src/drivers/net/3c515.c
  18. 0
    1
      src/drivers/net/3c595.c
  19. 0
    1
      src/drivers/net/3c5x9.c
  20. 4
    3
      src/drivers/net/3c90x.c
  21. 0
    1
      src/drivers/net/amd8111e.c
  22. 0
    1
      src/drivers/net/bnx2.c
  23. 0
    1
      src/drivers/net/dmfe.c
  24. 0
    1
      src/drivers/net/e1000/e1000.h
  25. 1
    1
      src/drivers/net/e1000/e1000_osdep.h
  26. 0
    1
      src/drivers/net/eepro.c
  27. 8
    5
      src/drivers/net/eepro100.c
  28. 9
    7
      src/drivers/net/epic100.c
  29. 0
    1
      src/drivers/net/etherfabric.c
  30. 0
    1
      src/drivers/net/forcedeth.c
  31. 0
    1
      src/drivers/net/ipoib.c
  32. 0
    1
      src/drivers/net/mlx_ipoib/mt23108_imp.c
  33. 0
    1
      src/drivers/net/mlx_ipoib/mt25218_imp.c
  34. 1
    1
      src/drivers/net/mtnic.c
  35. 1
    1
      src/drivers/net/natsemi.c
  36. 0
    1
      src/drivers/net/pcnet32.c
  37. 0
    1
      src/drivers/net/prism2.c
  38. 0
    1
      src/drivers/net/r8169.c
  39. 1
    1
      src/drivers/net/rtl8139.c
  40. 0
    1
      src/drivers/net/sis900.c
  41. 0
    1
      src/drivers/net/smc9000.c
  42. 0
    1
      src/drivers/net/sundance.c
  43. 0
    1
      src/drivers/net/tg3.c
  44. 0
    1
      src/drivers/net/tlan.c
  45. 12
    9
      src/drivers/net/via-rhine.c
  46. 0
    2
      src/drivers/net/via-velocity.h
  47. 4
    5
      src/drivers/net/w89c840.c
  48. 1
    1
      src/drivers/nvs/spi.c
  49. 1
    1
      src/drivers/nvs/threewire.c
  50. 1
    1
      src/hci/mucurses/kb.c
  51. 1
    1
      src/hci/shell_banner.c
  52. 1
    1
      src/include/etherboot.h
  53. 0
    1
      src/include/gpxe/dhcp.h
  54. 0
    1
      src/include/gpxe/tcp.h
  55. 0
    27
      src/include/timer.h
  56. 1
    1
      src/net/retry.c
  57. 1
    1
      src/net/tcp.c
  58. 1
    0
      src/net/udp/dhcp.c

+ 1
- 0
src/arch/i386/Makefile View File

@@ -7,6 +7,7 @@ ISOLINUX_BIN	= /usr/lib/syslinux/isolinux.bin
7 7
 SRCDIRS		+= arch/i386/core arch/i386/transitions arch/i386/prefix
8 8
 SRCDIRS		+= arch/i386/firmware/pcbios
9 9
 SRCDIRS		+= arch/i386/image
10
+SRCDIRS		+= arch/i386/drivers
10 11
 SRCDIRS		+= arch/i386/drivers/bus
11 12
 SRCDIRS		+= arch/i386/drivers/net
12 13
 SRCDIRS		+= arch/i386/drivers/disk

+ 3
- 4
src/arch/i386/firmware/pcbios/gateA20.c View File

@@ -1,8 +1,7 @@
1 1
 #include <stdio.h>
2
-#include "realmode.h"
3
-#include "timer.h"
4
-#include "latch.h"
5
-#include "bios.h"
2
+#include <realmode.h>
3
+#include <bios.h>
4
+#include <gpxe/timer.h>
6 5
 
7 6
 #define K_RDWR		0x60		/* keyboard data & cmds (read/write) */
8 7
 #define K_STATUS	0x64		/* keyboard status */

+ 0
- 12
src/arch/i386/include/latch.h View File

@@ -1,12 +0,0 @@
1
-#ifndef LATCH_H
2
-#define LATCH_H
3
-
4
-#define	TICKS_PER_SEC		18
5
-
6
-/* For different calibrators of the TSC move the declaration of
7
- * sleep_latch and the definitions of it's length here...
8
- */
9
-
10
-extern unsigned long currticks ( void );
11
-
12
-#endif /* LATCH_H */

+ 1
- 1
src/core/getkey.c View File

@@ -17,9 +17,9 @@
17 17
  */
18 18
 
19 19
 #include <console.h>
20
-#include <latch.h>
21 20
 #include <gpxe/process.h>
22 21
 #include <gpxe/keys.h>
22
+#include <gpxe/timer.h>
23 23
 
24 24
 /** @file
25 25
  *

+ 1
- 1
src/core/misc.c View File

@@ -4,8 +4,8 @@ MISC Support Routines
4 4
 
5 5
 #include <stdlib.h>
6 6
 #include <byteswap.h>
7
-#include <latch.h>
8 7
 #include <gpxe/in.h>
8
+#include <gpxe/timer.h>
9 9
 
10 10
 /**************************************************************************
11 11
 INET_ATON - Convert an ascii x.x.x.x to binary form

+ 1
- 1
src/core/random.c View File

@@ -5,7 +5,7 @@
5 5
  */
6 6
 
7 7
 #include <stdlib.h>
8
-#include <latch.h>
8
+#include <gpxe/timer.h>
9 9
 
10 10
 static int32_t rnd_seed = 0;
11 11
 

+ 1
- 1
src/core/serial.c View File

@@ -15,7 +15,7 @@
15 15
 #include "console.h"
16 16
 #include <gpxe/init.h>
17 17
 #include "io.h"
18
-#include "timer.h"
18
+#include <unistd.h>
19 19
 #include "config/serial.h"
20 20
 
21 21
 /* Set default values if none specified */

+ 0
- 1
src/drivers/bitbash/bitbash.c View File

@@ -16,7 +16,6 @@
16 16
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 17
  */
18 18
 
19
-#include <timer.h>
20 19
 #include <gpxe/bitbash.h>
21 20
 
22 21
 /** @file

+ 1
- 1
src/drivers/bitbash/i2c_bit.c View File

@@ -20,7 +20,7 @@
20 20
 #include <stdint.h>
21 21
 #include <errno.h>
22 22
 #include <assert.h>
23
-#include <timer.h>
23
+#include <unistd.h>
24 24
 #include <gpxe/bitbash.h>
25 25
 #include <gpxe/i2c.h>
26 26
 

+ 1
- 1
src/drivers/bitbash/spi_bit.c View File

@@ -22,7 +22,7 @@
22 22
 #include <byteswap.h>
23 23
 #include <errno.h>
24 24
 #include <assert.h>
25
-#include <timer.h>
25
+#include <unistd.h>
26 26
 #include <gpxe/bitbash.h>
27 27
 #include <gpxe/spi_bit.h>
28 28
 

+ 1
- 1
src/drivers/bus/eisa.c View File

@@ -4,7 +4,7 @@
4 4
 #include <stdio.h>
5 5
 #include <errno.h>
6 6
 #include <io.h>
7
-#include <timer.h>
7
+#include <unistd.h>
8 8
 #include <gpxe/eisa.h>
9 9
 
10 10
 static struct eisa_driver eisa_drivers[0]

+ 1
- 1
src/drivers/bus/isapnp.c View File

@@ -61,7 +61,7 @@
61 61
 #include <stdio.h>
62 62
 #include <errno.h>
63 63
 #include <io.h>
64
-#include <timer.h>
64
+#include <unistd.h>
65 65
 #include <gpxe/isapnp.h>
66 66
 
67 67
 /**

+ 0
- 1
src/drivers/bus/mca.c View File

@@ -11,7 +11,6 @@
11 11
 #include <stdio.h>
12 12
 #include <errno.h>
13 13
 #include <io.h>
14
-#include <timer.h>
15 14
 #include <gpxe/mca.h>
16 15
 
17 16
 static struct mca_driver mca_drivers[0]

+ 0
- 1
src/drivers/infiniband/arbel.c View File

@@ -26,7 +26,6 @@
26 26
 #include <strings.h>
27 27
 #include <unistd.h>
28 28
 #include <errno.h>
29
-#include <timer.h>
30 29
 #include <byteswap.h>
31 30
 #include <gpxe/pci.h>
32 31
 #include <gpxe/malloc.h>

+ 0
- 1
src/drivers/infiniband/hermon.c View File

@@ -24,7 +24,6 @@
24 24
 #include <strings.h>
25 25
 #include <unistd.h>
26 26
 #include <errno.h>
27
-#include <timer.h>
28 27
 #include <byteswap.h>
29 28
 #include <gpxe/pci.h>
30 29
 #include <gpxe/malloc.h>

+ 1
- 1
src/drivers/net/3c509.c View File

@@ -9,7 +9,7 @@
9 9
 #include <string.h>
10 10
 #include <errno.h>
11 11
 #include <io.h>
12
-#include <timer.h>
12
+#include <unistd.h>
13 13
 #include <gpxe/device.h>
14 14
 #include <gpxe/isa.h>
15 15
 #include "3c509.h"

+ 0
- 1
src/drivers/net/3c515.c View File

@@ -50,7 +50,6 @@
50 50
 #include "nic.h"
51 51
 #include <gpxe/isapnp.h>
52 52
 #include <gpxe/isa.h> /* for ISA_ROM */
53
-#include "timer.h"
54 53
 #include <gpxe/ethernet.h>
55 54
 
56 55
 static void t3c515_wait(unsigned int nticks)

+ 0
- 1
src/drivers/net/3c595.c View File

@@ -30,7 +30,6 @@
30 30
 #include <gpxe/pci.h>
31 31
 #include <gpxe/ethernet.h>
32 32
 #include "3c595.h"
33
-#include "timer.h"
34 33
 
35 34
 static struct nic_operations t595_operations;
36 35
 

+ 0
- 1
src/drivers/net/3c5x9.c View File

@@ -28,7 +28,6 @@ $Id$
28 28
 #include "etherboot.h"
29 29
 #include "nic.h"
30 30
 #include <gpxe/isa.h>
31
-#include "timer.h"
32 31
 #include "3c509.h"
33 32
 
34 33
 static enum { none, bnc, utp } connector = none;	/* for 3C509 */

+ 4
- 3
src/drivers/net/3c90x.c View File

@@ -43,7 +43,6 @@
43 43
 #include "nic.h"
44 44
 #include <gpxe/pci.h>
45 45
 #include <gpxe/ethernet.h>
46
-#include "timer.h"
47 46
 
48 47
 static struct nic_operations a3c90x_operations;
49 48
 
@@ -498,6 +497,7 @@ a3c90x_transmit(struct nic *nic __unused, const char *d, unsigned int t,
498 497
 
499 498
     unsigned char status;
500 499
     unsigned i, retries;
500
+    tick_t ct;
501 501
 
502 502
     for (retries=0; retries < XMIT_RETRIES ; retries++)
503 503
 	{
@@ -540,9 +540,10 @@ a3c90x_transmit(struct nic *nic __unused, const char *d, unsigned int t,
540 540
 	    ;
541 541
 
542 542
 	/** Wait for NIC Transmit to Complete **/
543
-	load_timer2(10*TICKS_PER_MS);	/* Give it 10 ms */
543
+	ct = currticks();
544
+
544 545
 	while (!(inw(INF_3C90X.IOAddr + regCommandIntStatus_w)&0x0004) &&
545
-		timer2_running())
546
+		ct + 10*USECS_IN_MSEC < currticks());
546 547
 		;
547 548
 
548 549
 	if (!(inw(INF_3C90X.IOAddr + regCommandIntStatus_w)&0x0004))

+ 0
- 1
src/drivers/net/amd8111e.c View File

@@ -33,7 +33,6 @@
33 33
 #include "mii.h"
34 34
 #include <gpxe/pci.h>
35 35
 #include <gpxe/ethernet.h>
36
-#include "timer.h"
37 36
 #include "string.h"
38 37
 #include "stdint.h"
39 38
 #include "amd8111e.h"

+ 0
- 1
src/drivers/net/bnx2.c View File

@@ -18,7 +18,6 @@
18 18
 #include <errno.h>
19 19
 #include <gpxe/pci.h>
20 20
 #include <gpxe/ethernet.h>
21
-#include "timer.h"
22 21
 #include "string.h"
23 22
 #include "bnx2.h"
24 23
 #include "bnx2_fw.h"

+ 0
- 1
src/drivers/net/dmfe.c View File

@@ -43,7 +43,6 @@
43 43
 /* to get the PCI support functions, if this is a PCI NIC */
44 44
 #include <gpxe/pci.h>
45 45
 #include <gpxe/ethernet.h>
46
-#include "timer.h"
47 46
 
48 47
 /* #define EDEBUG 1 */
49 48
 #ifdef EDEBUG

+ 0
- 1
src/drivers/net/e1000/e1000.h View File

@@ -36,7 +36,6 @@
36 36
 #include <stdio.h>
37 37
 #include <io.h>
38 38
 #include <errno.h>
39
-#include <timer.h>
40 39
 #include <byteswap.h>
41 40
 #include <gpxe/pci.h>
42 41
 #include <gpxe/malloc.h>

+ 1
- 1
src/drivers/net/e1000/e1000_osdep.h View File

@@ -39,7 +39,7 @@
39 39
 #include <stdio.h>
40 40
 #include <io.h>
41 41
 #include <errno.h>
42
-#include <timer.h>
42
+#include <unistd.h>
43 43
 #include <byteswap.h>
44 44
 #include <gpxe/pci.h>
45 45
 #include <gpxe/if_ether.h>

+ 0
- 1
src/drivers/net/eepro.c View File

@@ -35,7 +35,6 @@ has 34 pins, the top row of 2 are not used.
35 35
 #include <errno.h>
36 36
 #include "nic.h"
37 37
 #include <gpxe/isa.h>
38
-#include "timer.h"
39 38
 #include <gpxe/ethernet.h>
40 39
 
41 40
 /* Different 82595 chips */

+ 8
- 5
src/drivers/net/eepro100.c View File

@@ -107,7 +107,6 @@
107 107
 #include "nic.h"
108 108
 #include <gpxe/ethernet.h>
109 109
 #include <gpxe/pci.h>
110
-#include "timer.h"
111 110
 
112 111
 static int ioaddr;
113 112
 
@@ -408,6 +407,7 @@ static void eepro100_transmit(struct nic *nic, const char *d, unsigned int t, un
408 407
 	} hdr;
409 408
 	unsigned short status;
410 409
 	int s1, s2;
410
+	tick_t ct;
411 411
 
412 412
 	status = inw(ioaddr + SCBStatus);
413 413
 	/* 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
445 445
 	wait_for_cmd_done(ioaddr + SCBCmd);
446 446
 
447 447
 	s1 = inw (ioaddr + SCBStatus);
448
-	load_timer2(10*TICKS_PER_MS);		/* timeout 10 ms for transmit */
449
-	while (!txfd.status && timer2_running())
448
+
449
+	ct = currticks();
450
+	/* timeout 10 ms for transmit */
451
+	while (!txfd.status && ct + 10*USECS_IN_MSEC)
450 452
 		/* Wait */;
451 453
 	s2 = inw (ioaddr + SCBStatus);
452 454
 
@@ -606,6 +608,7 @@ static int eepro100_probe ( struct nic *nic, struct pci_device *pci ) {
606 608
 	int read_cmd, ee_size;
607 609
 	int options;
608 610
 	int rx_mode;
611
+	tick_t ct;
609 612
 
610 613
 	/* we cache only the first few words of the EEPROM data
611 614
 	   be careful not to access beyond this array */
@@ -749,8 +752,8 @@ static int eepro100_probe ( struct nic *nic, struct pci_device *pci ) {
749 752
 
750 753
 	whereami ("started TX thingy (config, iasetup).");
751 754
 
752
-	load_timer2(10*TICKS_PER_MS);
753
-	while (!txfd.status && timer2_running())
755
+	ct = currticks();
756
+	while (!txfd.status && ct + 10*USECS_IN_MSEC < currticks())
754 757
 		/* Wait */;
755 758
 
756 759
 	/* Read the status register once to disgard stale data */

+ 9
- 7
src/drivers/net/epic100.c View File

@@ -8,7 +8,6 @@
8 8
 #include <gpxe/pci.h>
9 9
 #include <gpxe/ethernet.h>
10 10
 #include "nic.h"
11
-#include "timer.h"
12 11
 #include "console.h"
13 12
 #include "epic100.h"
14 13
 
@@ -310,6 +309,7 @@ epic100_transmit(struct nic *nic, const char *destaddr, unsigned int type,
310 309
     unsigned short nstype;
311 310
     unsigned char *txp;
312 311
     int entry;
312
+    tick_t ct;
313 313
 
314 314
     /* Calculate the next Tx descriptor entry. */
315 315
     entry = cur_tx % TX_RING_SIZE;
@@ -339,18 +339,20 @@ epic100_transmit(struct nic *nic, const char *destaddr, unsigned int type,
339 339
      * set the base address with the "ownership"
340 340
      * bits last.
341 341
      */
342
-    
342
+   
343 343
     tx_ring[entry].buflength |= cpu_to_le32(len);
344
-    tx_ring[entry].status = cpu_to_le32(len << 16) | 
344
+    tx_ring[entry].status = cpu_to_le32(len << 16) |
345 345
 	    cpu_to_le32(TRING_OWN);	/* Pass ownership to the chip. */
346 346
 
347 347
     cur_tx++;
348 348
 
349 349
     /* Trigger an immediate transmit demand. */
350
-    outl(CR_QUEUE_TX, command); 
351
-    
352
-    load_timer2(10*TICKS_PER_MS);         /* timeout 10 ms for transmit */
353
-    while ((le32_to_cpu(tx_ring[entry].status) & (TRING_OWN)) && timer2_running())
350
+    outl(CR_QUEUE_TX, command);
351
+
352
+    ct = currticks();
353
+    /* timeout 10 ms for transmit */
354
+    while ((le32_to_cpu(tx_ring[entry].status) & (TRING_OWN)) &&
355
+		ct + 10*USECS_IN_MSEC < currticks())
354 356
 	/* Wait */;
355 357
 
356 358
     if ((le32_to_cpu(tx_ring[entry].status) & TRING_OWN) != 0)

+ 0
- 1
src/drivers/net/etherfabric.c View File

@@ -24,7 +24,6 @@
24 24
 #include <gpxe/i2c.h>
25 25
 #include <gpxe/spi.h>
26 26
 #include <gpxe/nvo.h>
27
-#include "timer.h"
28 27
 #define dma_addr_t unsigned long
29 28
 #include "etherfabric.h"
30 29
 

+ 0
- 1
src/drivers/net/forcedeth.c View File

@@ -51,7 +51,6 @@
51 51
 #include <gpxe/pci.h>
52 52
 /* Include timer support functions */
53 53
 #include <gpxe/ethernet.h>
54
-#include "timer.h"
55 54
 #include "mii.h"
56 55
 
57 56
 #define drv_version "v1.2"

+ 0
- 1
src/drivers/net/ipoib.c View File

@@ -22,7 +22,6 @@
22 22
 #include <string.h>
23 23
 #include <byteswap.h>
24 24
 #include <errno.h>
25
-#include "timer.h"
26 25
 #include <gpxe/if_arp.h>
27 26
 #include <gpxe/iobuf.h>
28 27
 #include <gpxe/netdevice.h>

+ 0
- 1
src/drivers/net/mlx_ipoib/mt23108_imp.c View File

@@ -37,7 +37,6 @@ static void be_to_cpu_buf(void *buf, int size)
37 37
 	}
38 38
 }
39 39
 
40
-#include "timer.h"
41 40
 #include "cmdif_mt23108.c"
42 41
 #include "cmdif_comm.c"
43 42
 #include "ib_mt23108.c"

+ 0
- 1
src/drivers/net/mlx_ipoib/mt25218_imp.c View File

@@ -37,7 +37,6 @@ static void be_to_cpu_buf(void *buf, int size)
37 37
 	}
38 38
 }
39 39
 
40
-#include "timer.h"
41 40
 #include "cmdif_mt25218.c"
42 41
 #include "cmdif_comm.c"
43 42
 #include "ib_mt25218.c"

+ 1
- 1
src/drivers/net/mtnic.c View File

@@ -37,7 +37,7 @@
37 37
 #include <gpxe/umalloc.h>
38 38
 #include <bits/byteswap.h>
39 39
 #include <little_bswap.h>
40
-#include <timer.h>
40
+#include <unistd.h>
41 41
 #include <gpxe/pci.h>
42 42
 #include <gpxe/ethernet.h>
43 43
 #include <gpxe/netdevice.h>

+ 1
- 1
src/drivers/net/natsemi.c View File

@@ -63,8 +63,8 @@
63 63
 #include <stdio.h>
64 64
 #include <io.h>
65 65
 #include <errno.h>
66
-#include <timer.h>
67 66
 #include <byteswap.h>
67
+#include <unistd.h>
68 68
 #include <gpxe/pci.h>
69 69
 #include <gpxe/if_ether.h>
70 70
 #include <gpxe/ethernet.h>

+ 0
- 1
src/drivers/net/pcnet32.c View File

@@ -43,7 +43,6 @@
43 43
 #include "nic.h"
44 44
 #include <gpxe/pci.h>
45 45
 #include <gpxe/ethernet.h>
46
-#include "timer.h"
47 46
 #include "mii.h"
48 47
 
49 48
 /* void hex_dump(const char *data, const unsigned int len); */

+ 0
- 1
src/drivers/net/prism2.c View File

@@ -62,7 +62,6 @@ static const char hardcoded_ssid[] = "";
62 62
  * quicker to convert code from the Linux Prism2 driver.
63 63
  */
64 64
 #include <errno.h>
65
-#include "timer.h"
66 65
 #define __le16_to_cpu(x) (x)
67 66
 #define __le32_to_cpu(x) (x)
68 67
 #define __cpu_to_le16(x) (x)

+ 0
- 1
src/drivers/net/r8169.c View File

@@ -49,7 +49,6 @@
49 49
 #include <gpxe/pci.h>
50 50
 #include <gpxe/ethernet.h>
51 51
 #include <gpxe/malloc.h>
52
-#include "timer.h"
53 52
 
54 53
 #define drv_version "v1.6"
55 54
 #define drv_date "03-27-2004"

+ 1
- 1
src/drivers/net/rtl8139.c View File

@@ -71,7 +71,7 @@
71 71
 #include <stdio.h>
72 72
 #include <io.h>
73 73
 #include <errno.h>
74
-#include <timer.h>
74
+#include <unistd.h>
75 75
 #include <byteswap.h>
76 76
 #include <gpxe/pci.h>
77 77
 #include <gpxe/if_ether.h>

+ 0
- 1
src/drivers/net/sis900.c View File

@@ -46,7 +46,6 @@
46 46
 #include "etherboot.h"
47 47
 #include <gpxe/pci.h>
48 48
 #include "nic.h"
49
-#include "timer.h"
50 49
 
51 50
 #include "sis900.h"
52 51
 

+ 0
- 1
src/drivers/net/smc9000.c View File

@@ -40,7 +40,6 @@
40 40
 #include "etherboot.h"
41 41
 #include "nic.h"
42 42
 #include <gpxe/isa.h>
43
-#include "timer.h"
44 43
 #include "smc9000.h"
45 44
 
46 45
 # define _outb outb

+ 0
- 1
src/drivers/net/sundance.c View File

@@ -46,7 +46,6 @@
46 46
 #include "nic.h"
47 47
 /* to get the PCI support functions, if this is a PCI NIC */
48 48
 #include <gpxe/pci.h>
49
-#include "timer.h"
50 49
 #include "mii.h"
51 50
 
52 51
 #define drv_version "v1.12"

+ 0
- 1
src/drivers/net/tg3.c View File

@@ -17,7 +17,6 @@
17 17
 #include <errno.h>
18 18
 #include <gpxe/pci.h>
19 19
 #include <gpxe/ethernet.h>
20
-#include "timer.h"
21 20
 #include "string.h"
22 21
 #include "tg3.h"
23 22
 

+ 0
- 1
src/drivers/net/tlan.c View File

@@ -42,7 +42,6 @@
42 42
 #include "nic.h"
43 43
 #include <gpxe/pci.h>
44 44
 #include <gpxe/ethernet.h>
45
-#include "timer.h"
46 45
 #include "tlan.h"
47 46
 
48 47
 #define drv_version "v1.4"

+ 12
- 9
src/drivers/net/via-rhine.c View File

@@ -50,7 +50,6 @@ static const char *version = "rhine.c v1.0.2 2004-10-29\n";
50 50
 #include "nic.h"
51 51
 #include <gpxe/pci.h>
52 52
 #include <gpxe/ethernet.h>
53
-#include "timer.h"
54 53
 
55 54
 /* define all ioaddr */
56 55
 
@@ -785,6 +784,7 @@ ReadMII (int byMIIIndex, int ioaddr)
785 784
     char byMIIAdrbak;
786 785
     char byMIICRbak;
787 786
     char byMIItemp;
787
+    tick_t ct;
788 788
 
789 789
     byMIIAdrbak = inb (byMIIAD);
790 790
     byMIICRbak = inb (byMIICR);
@@ -799,8 +799,8 @@ ReadMII (int byMIIIndex, int ioaddr)
799 799
     byMIItemp = inb (byMIICR);
800 800
     byMIItemp = byMIItemp & 0x40;
801 801
 
802
-    load_timer2(2*TICKS_PER_MS);
803
-    while (byMIItemp != 0 && timer2_running())
802
+    ct = currticks();
803
+    while (byMIItemp != 0 && ct + 2*USECS_IN_MSEC < currticks())
804 804
     {
805 805
 	byMIItemp = inb (byMIICR);
806 806
 	byMIItemp = byMIItemp & 0x40;
@@ -825,6 +825,7 @@ WriteMII (char byMIISetByte, char byMIISetBit, char byMIIOP, int ioaddr)
825 825
     char byMIIAdrbak;
826 826
     char byMIICRbak;
827 827
     char byMIItemp;
828
+    tick_t ct;
828 829
 
829 830
 
830 831
     byMIIAdrbak = inb (byMIIAD);
@@ -840,8 +841,8 @@ WriteMII (char byMIISetByte, char byMIISetBit, char byMIIOP, int ioaddr)
840 841
     byMIItemp = inb (byMIICR);
841 842
     byMIItemp = byMIItemp & 0x40;
842 843
 
843
-    load_timer2(2*TICKS_PER_MS);
844
-    while (byMIItemp != 0 && timer2_running())
844
+    ct = currticks();
845
+    while (byMIItemp != 0 && ct + 2*USECS_IN_MSEC < currticks())
845 846
     {
846 847
 	byMIItemp = inb (byMIICR);
847 848
 	byMIItemp = byMIItemp & 0x40;
@@ -870,8 +871,8 @@ WriteMII (char byMIISetByte, char byMIISetBit, char byMIIOP, int ioaddr)
870 871
     byMIItemp = inb (byMIICR);
871 872
     byMIItemp = byMIItemp & 0x20;
872 873
 
873
-    load_timer2(2*TICKS_PER_MS);
874
-    while (byMIItemp != 0 && timer2_running())
874
+    ct = currticks();
875
+    while (byMIItemp != 0 && ct + 2*USECS_IN_MSEC < currticks())
875 876
     {
876 877
 	byMIItemp = inb (byMIICR);
877 878
 	byMIItemp = byMIItemp & 0x20;
@@ -1345,6 +1346,7 @@ rhine_transmit (struct nic *nic,
1345 1346
     unsigned char CR1bak;
1346 1347
     unsigned char CR0bak;
1347 1348
     unsigned int nstype;
1349
+    tick_t ct;
1348 1350
 
1349 1351
 
1350 1352
     /*printf ("rhine_transmit\n"); */
@@ -1385,9 +1387,10 @@ rhine_transmit (struct nic *nic,
1385 1387
     outb (CR1bak, byCR1);
1386 1388
     do
1387 1389
     {
1388
-        load_timer2(10*TICKS_PER_MS);
1390
+	ct = currticks();
1389 1391
         /* Wait until transmit is finished or timeout*/
1390
-        while((tp->tx_ring[entry].tx_status.bits.own_bit !=0) && timer2_running())
1392
+        while((tp->tx_ring[entry].tx_status.bits.own_bit !=0) &&
1393
+		ct + 10*USECS_IN_MSEC < currticks())
1391 1394
         ;
1392 1395
 
1393 1396
         if(tp->tx_ring[entry].tx_status.bits.terr == 0)

+ 0
- 2
src/drivers/net/via-velocity.h View File

@@ -24,8 +24,6 @@
24 24
  *       Copyright (c) 2006 by Timothy Legge <tlegge@rogers.com>
25 25
  */
26 26
 
27
-#include "timer.h"
28
-
29 27
 #ifndef VELOCITY_H
30 28
 #define VELOCITY_H
31 29
 

+ 4
- 5
src/drivers/net/w89c840.c View File

@@ -81,7 +81,6 @@
81 81
 #include "nic.h"
82 82
 #include <gpxe/pci.h>
83 83
 #include <gpxe/ethernet.h>
84
-#include "timer.h"
85 84
 
86 85
 static const char *w89c840_version = "driver Version 0.94 - December 12, 2003";
87 86
 
@@ -113,7 +112,7 @@ static const char *w89c840_version = "driver Version 0.94 - December 12, 2003";
113 112
 
114 113
 /* Operational parameters that usually are not changed. */
115 114
 /* Time in jiffies before concluding the transmitter is hung. */
116
-#define TX_TIMEOUT  (10*TICKS_PER_MS)
115
+#define TX_TIMEOUT  (10*USECS_IN_MSEC)
117 116
 
118 117
 #define PKT_BUF_SZ  1536  /* Size of each temporary Rx buffer.*/
119 118
 
@@ -487,6 +486,7 @@ static void w89c840_transmit(
487 486
     /* send the packet to destination */
488 487
     unsigned entry;
489 488
     int transmit_status;
489
+    tick_t ct;
490 490
 
491 491
     /* Caution: the write order is important here, set the field
492 492
        with the "ownership" bits last. */
@@ -535,8 +535,7 @@ static void w89c840_transmit(
535 535
     /* Now wait for TX to complete. */
536 536
     transmit_status = w840private.tx_ring[entry].status;
537 537
 
538
-    load_timer2(TX_TIMEOUT);
539
-
538
+    ct = currticks();
540 539
     {
541 540
 #if defined W89C840_DEBUG
542 541
         u32 intr_stat = 0;
@@ -547,7 +546,7 @@ static void w89c840_transmit(
547 546
 	      decode_interrupt(intr_stat);
548 547
 #endif
549 548
 
550
-                while ( (transmit_status & DescOwn) && timer2_running()) {
549
+                while ( (transmit_status & DescOwn) && ct + TX_TIMEOUT < currticks()) {
551 550
 
552 551
                     transmit_status = w840private.tx_ring[entry].status;
553 552
                 }

+ 1
- 1
src/drivers/nvs/spi.c View File

@@ -18,7 +18,7 @@
18 18
 
19 19
 #include <stddef.h>
20 20
 #include <errno.h>
21
-#include <timer.h>
21
+#include <unistd.h>
22 22
 #include <gpxe/spi.h>
23 23
 
24 24
 /** @file

+ 1
- 1
src/drivers/nvs/threewire.c View File

@@ -18,7 +18,7 @@
18 18
 
19 19
 #include <stddef.h>
20 20
 #include <assert.h>
21
-#include <timer.h>
21
+#include <unistd.h>
22 22
 #include <gpxe/threewire.h>
23 23
 
24 24
 /** @file

+ 1
- 1
src/hci/mucurses/kb.c View File

@@ -1,6 +1,6 @@
1 1
 #include <curses.h>
2 2
 #include <stddef.h>
3
-#include <timer.h>
3
+#include <unistd.h>
4 4
 #include "mucurses.h"
5 5
 
6 6
 /** @file

+ 1
- 1
src/hci/shell_banner.c View File

@@ -18,8 +18,8 @@
18 18
 
19 19
 #include <stdio.h>
20 20
 #include <console.h>
21
-#include <latch.h>
22 21
 #include <gpxe/features.h>
22
+#include <gpxe/timer.h>
23 23
 #include <gpxe/shell_banner.h>
24 24
 
25 25
 /** @file

+ 1
- 1
src/include/etherboot.h View File

@@ -12,8 +12,8 @@
12 12
 #include <stdio.h>
13 13
 #include <unistd.h>
14 14
 #include <strings.h>
15
-#include <latch.h>
16 15
 #include <console.h>
16
+#include <gpxe/timer.h>
17 17
 #include <gpxe/if_arp.h>
18 18
 #include <gpxe/if_ether.h>
19 19
 

+ 0
- 1
src/include/gpxe/dhcp.h View File

@@ -12,7 +12,6 @@
12 12
 #include <gpxe/in.h>
13 13
 #include <gpxe/refcnt.h>
14 14
 #include <gpxe/tables.h>
15
-#include <latch.h>
16 15
 
17 16
 struct net_device;
18 17
 struct job_interface;

+ 0
- 1
src/include/gpxe/tcp.h View File

@@ -9,7 +9,6 @@
9 9
  *
10 10
  */
11 11
 
12
-#include "latch.h"
13 12
 #include <gpxe/tcpip.h>
14 13
 
15 14
 /**

+ 0
- 27
src/include/timer.h View File

@@ -1,27 +0,0 @@
1
-#ifndef TIMER_H
2
-#define TIMER_H
3
-
4
-/*
5
- * This file should be removed as soon as there are no
6
- * currticks() abusers.
7
- */
8
-
9
-#include <stddef.h>
10
-/*
11
-#warning Please fix me. I'm abusing the deprecated include/timer.h
12
-*/
13
-#include <unistd.h>
14
-
15
-/* Duplicates include/gpxe/timer.h */
16
-typedef uint32_t tick_t;
17
-
18
-#define MSECS_IN_SEC (1000)
19
-#define USECS_IN_SEC (1000*1000)
20
-#define USECS_IN_MSEC (1000)
21
-
22
-#define	TICKS_PER_SEC USECS_IN_SEC
23
-
24
-tick_t currticks(void);
25
-
26
-#endif
27
-

+ 1
- 1
src/net/retry.c View File

@@ -17,7 +17,7 @@
17 17
  */
18 18
 
19 19
 #include <stddef.h>
20
-#include <latch.h>
20
+#include <gpxe/timer.h>
21 21
 #include <gpxe/list.h>
22 22
 #include <gpxe/process.h>
23 23
 #include <gpxe/init.h>

+ 1
- 1
src/net/tcp.c View File

@@ -4,7 +4,7 @@
4 4
 #include <assert.h>
5 5
 #include <errno.h>
6 6
 #include <byteswap.h>
7
-#include <timer.h>
7
+#include <gpxe/timer.h>
8 8
 #include <gpxe/iobuf.h>
9 9
 #include <gpxe/malloc.h>
10 10
 #include <gpxe/retry.h>

+ 1
- 0
src/net/udp/dhcp.c View File

@@ -33,6 +33,7 @@
33 33
 #include <gpxe/ip.h>
34 34
 #include <gpxe/uuid.h>
35 35
 #include <gpxe/dhcp.h>
36
+#include <gpxe/timer.h>
36 37
 
37 38
 /** @file
38 39
  *

Loading…
Cancel
Save