summaryrefslogtreecommitdiffstats
path: root/src/core/misc.c
diff options
context:
space:
mode:
authorMichael Brown2007-07-14 16:42:26 +0200
committerMichael Brown2007-07-14 16:42:26 +0200
commite330db3c749c3ee638e8d652c5c3ae08c13af8e5 (patch)
treea69cefca27d7abe7863b87cb765ab55e26bd0fc5 /src/core/misc.c
parentBe more aggressive in attempts to enable A20, now that we have the (diff)
downloadipxe-e330db3c749c3ee638e8d652c5c3ae08c13af8e5.tar.gz
ipxe-e330db3c749c3ee638e8d652c5c3ae08c13af8e5.tar.xz
ipxe-e330db3c749c3ee638e8d652c5c3ae08c13af8e5.zip
Dead code removal.
Kill off use of etherboot.h outside drivers/net.
Diffstat (limited to 'src/core/misc.c')
-rw-r--r--src/core/misc.c73
1 files changed, 3 insertions, 70 deletions
diff --git a/src/core/misc.c b/src/core/misc.c
index 58399136..4219a36c 100644
--- a/src/core/misc.c
+++ b/src/core/misc.c
@@ -2,59 +2,10 @@
MISC Support Routines
**************************************************************************/
-#include <etherboot.h>
-#include <console.h>
#include <stdlib.h>
-#include <stdio.h>
-
-/**************************************************************************
-IPCHKSUM - Checksum IP Header
-**************************************************************************/
-uint16_t ipchksum(const void *data, unsigned long length)
-{
- unsigned long sum;
- unsigned long i;
- const uint8_t *ptr;
-
- /* In the most straight forward way possible,
- * compute an ip style checksum.
- */
- sum = 0;
- ptr = data;
- for(i = 0; i < length; i++) {
- unsigned long value;
- value = ptr[i];
- if (i & 1) {
- value <<= 8;
- }
- /* Add the new value */
- sum += value;
- /* Wrap around the carry */
- if (sum > 0xFFFF) {
- sum = (sum + (sum >> 16)) & 0xFFFF;
- }
- }
- return (~cpu_to_le16(sum)) & 0xFFFF;
-}
-
-uint16_t add_ipchksums(unsigned long offset, uint16_t sum, uint16_t new)
-{
- unsigned long checksum;
- sum = ~sum & 0xFFFF;
- new = ~new & 0xFFFF;
- if (offset & 1) {
- /* byte swap the sum if it came from an odd offset
- * since the computation is endian independant this
- * works.
- */
- new = bswap_16(new);
- }
- checksum = sum + new;
- if (checksum > 0xFFFF) {
- checksum -= 0xFFFF;
- }
- return (~checksum) & 0xFFFF;
-}
+#include <byteswap.h>
+#include <latch.h>
+#include <gpxe/in.h>
/**************************************************************************
SLEEP
@@ -69,24 +20,6 @@ unsigned int sleep(unsigned int secs)
}
/**************************************************************************
-INTERRUPTIBLE SLEEP
-**************************************************************************/
-void interruptible_sleep(int secs)
-{
- printf("<sleep>\n");
- sleep(secs);
-}
-
-/**************************************************************************
-STRCASECMP (not entirely correct, but this will do for our purposes)
-**************************************************************************/
-int strcasecmp(const char *a, const char *b)
-{
- while (*a && *b && (*a & ~0x20) == (*b & ~0x20)) {a++; b++; }
- return((*a & ~0x20) - (*b & ~0x20));
-}
-
-/**************************************************************************
INET_ATON - Convert an ascii x.x.x.x to binary form
**************************************************************************/
int inet_aton ( const char *cp, struct in_addr *inp ) {