Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Modify gPXE core and drivers to work with the new timer subsystem
Signed-off-by: Alexey Zaytsev <alexey.zaytsev@gmail.com>
  • Loading branch information
xl0 committed Mar 2, 2008
1 parent 4006d22 commit a1572e0
Show file tree
Hide file tree
Showing 58 changed files with 62 additions and 121 deletions.
1 change: 1 addition & 0 deletions src/arch/i386/Makefile
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions src/arch/i386/firmware/pcbios/gateA20.c
@@ -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 */
Expand Down
12 changes: 0 additions & 12 deletions src/arch/i386/include/latch.h

This file was deleted.

2 changes: 1 addition & 1 deletion src/core/getkey.c
Expand Up @@ -17,9 +17,9 @@
*/

#include <console.h>
#include <latch.h>
#include <gpxe/process.h>
#include <gpxe/keys.h>
#include <gpxe/timer.h>

/** @file
*
Expand Down
2 changes: 1 addition & 1 deletion src/core/misc.c
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/core/random.c
Expand Up @@ -5,7 +5,7 @@
*/

#include <stdlib.h>
#include <latch.h>
#include <gpxe/timer.h>

static int32_t rnd_seed = 0;

Expand Down
2 changes: 1 addition & 1 deletion src/core/serial.c
Expand Up @@ -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 */
Expand Down
1 change: 0 additions & 1 deletion src/drivers/bitbash/bitbash.c
Expand Up @@ -16,7 +16,6 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include <timer.h>
#include <gpxe/bitbash.h>

/** @file
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/bitbash/i2c_bit.c
Expand Up @@ -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>

Expand Down
2 changes: 1 addition & 1 deletion src/drivers/bitbash/spi_bit.c
Expand Up @@ -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>

Expand Down
2 changes: 1 addition & 1 deletion src/drivers/bus/eisa.c
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/bus/isapnp.c
Expand Up @@ -61,7 +61,7 @@
#include <stdio.h>
#include <errno.h>
#include <io.h>
#include <timer.h>
#include <unistd.h>
#include <gpxe/isapnp.h>

/**
Expand Down
1 change: 0 additions & 1 deletion src/drivers/bus/mca.c
Expand Up @@ -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]
Expand Down
1 change: 0 additions & 1 deletion src/drivers/infiniband/arbel.c
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion src/drivers/infiniband/hermon.c
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/net/3c509.c
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion src/drivers/net/3c515.c
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion src/drivers/net/3c595.c
Expand Up @@ -30,7 +30,6 @@
#include <gpxe/pci.h>
#include <gpxe/ethernet.h>
#include "3c595.h"
#include "timer.h"

static struct nic_operations t595_operations;

Expand Down
1 change: 0 additions & 1 deletion src/drivers/net/3c5x9.c
Expand Up @@ -28,7 +28,6 @@ Author: Martin Renters.
#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 */
Expand Down
7 changes: 4 additions & 3 deletions src/drivers/net/3c90x.c
Expand Up @@ -43,7 +43,6 @@
#include "nic.h"
#include <gpxe/pci.h>
#include <gpxe/ethernet.h>
#include "timer.h"

static struct nic_operations a3c90x_operations;

Expand Down Expand Up @@ -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++)
{
Expand Down Expand Up @@ -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))
Expand Down
1 change: 0 additions & 1 deletion src/drivers/net/amd8111e.c
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion src/drivers/net/bnx2.c
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion src/drivers/net/dmfe.c
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/drivers/net/e1000/e1000.h
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/net/e1000/e1000_osdep.h
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion src/drivers/net/eepro.c
Expand Up @@ -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 */
Expand Down
13 changes: 8 additions & 5 deletions src/drivers/net/eepro100.c
Expand Up @@ -107,7 +107,6 @@
#include "nic.h"
#include <gpxe/ethernet.h>
#include <gpxe/pci.h>
#include "timer.h"

static int ioaddr;

Expand Down Expand Up @@ -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. */
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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 */
Expand Down
16 changes: 9 additions & 7 deletions src/drivers/net/epic100.c
Expand Up @@ -8,7 +8,6 @@
#include <gpxe/pci.h>
#include <gpxe/ethernet.h>
#include "nic.h"
#include "timer.h"
#include "console.h"
#include "epic100.h"

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion src/drivers/net/etherfabric.c
Expand Up @@ -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"

Expand Down
1 change: 0 additions & 1 deletion src/drivers/net/forcedeth.c
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion src/drivers/net/ipoib.c
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion src/drivers/net/mlx_ipoib/mt23108_imp.c
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion src/drivers/net/mlx_ipoib/mt25218_imp.c
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/net/mtnic.c
Expand Up @@ -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>
Expand Down

0 comments on commit a1572e0

Please sign in to comment.