clean up headers as requested. drop some dead code.

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Ronald G. Minnich <rminnich@gmail.com>



git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@111 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
Stefan Reinauer 2007-02-24 17:03:53 +00:00
parent 326b94d572
commit 5a65718dcc
10 changed files with 81 additions and 82 deletions

View file

@ -83,12 +83,11 @@ $(obj)/stage0.init:
$(Q)# other lib parts
$(Q)$(CC) $(INITCFLAGS) -c $(src)/lib/mem.c -o $(obj)/mem.o
$(Q)$(CC) $(INITCFLAGS) -c $(src)/lib/newelfboot.c -o $(obj)/newelfboot.o
$(Q)$(CC) $(INITCFLAGS) -c $(src)/lib/compute_ip_checksum.c -o $(obj)/compute_ip_checksum.o
$(Q)cd $(obj); $(CC) -m32 -nostdlib -static \
-T $(src)/arch/x86/ldscript.ld cachemain.o \
console.o uart8250.o serial.o archelfboot.o vtxprintf.o \
vsprintf.o lar.o newelfboot.o compute_ip_checksum.o mem.o stage0_i586.o -o stage0.o
vsprintf.o lar.o newelfboot.o mem.o stage0_i586.o -o stage0.o
$(Q)objcopy -O binary $(obj)/stage0.o $(obj)/stage0.init.pre

View file

@ -1,5 +1,5 @@
#include <console/console.h>
#include <ip_checksum.h>
// #include <ip_checksum.h>
#include <elf.h>
#include <elf_boot.h>
#include <string.h>

View file

@ -1,3 +1,22 @@
/*
* Copright (C) 2003 Eric Biederman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
*
* This file may be dual licensed with the new BSD license.
*/
#ifndef ELF_H
#define ELF_H

View file

@ -1,3 +1,23 @@
/*
* Copright (C) 2003 Eric Biederman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
*
* This file may be dual licensed with the new BSD license.
*/
#ifndef ELF_BOOT_H
#define ELF_BOOT_H

View file

@ -1,18 +0,0 @@
#ifndef PART_FALLBACK_BOOT_H
#define PART_FALLBACK_BOOT_H
#ifndef ASSEMBLY
#if HAVE_FALLBACK_BOOT == 1
void set_boot_successful(void);
#else
#define set_boot_successful()
#endif
void boot_successful(void);
#endif /* ASSEMBLY */
#define RTC_BOOT_BYTE 48
#endif /* PART_FALLBACK_BOOT_H */

View file

@ -1,7 +0,0 @@
#ifndef IP_CHECKSUM_H
#define IP_CHECKSUM_H
unsigned long compute_ip_checksum(void *addr, unsigned long length);
unsigned long add_ip_checksums(unsigned long offset, unsigned long sum, unsigned long new);
#endif /* IP_CHECKSUM_H */

View file

@ -1,3 +1,23 @@
/*
* Copright (C) 2000 Eric Biederman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
*
* This file may be dual licensed with the new BSD license.
*/
#ifndef LINUXBIOS_TABLES_H
#define LINUXBIOS_TABLES_H

View file

@ -1,3 +1,22 @@
/*
* Derived from the Linux kernel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
*
* This file may be dual licensed with the new BSD license.
*/
#ifndef STRING_H
#define STRING_H

View file

@ -1,53 +0,0 @@
#include <stdint.h>
#include <ip_checksum.h>
unsigned long compute_ip_checksum(void *addr, unsigned long length)
{
uint8_t *ptr;
volatile union {
uint8_t byte[2];
uint16_t word;
} value;
unsigned long sum;
unsigned long i;
/* In the most straight forward way possible,
* compute an ip style checksum.
*/
sum = 0;
ptr = addr;
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;
}
}
value.byte[0] = sum & 0xff;
value.byte[1] = (sum >> 8) & 0xff;
return (~value.word) & 0xFFFF;
}
unsigned long add_ip_checksums(unsigned long offset, unsigned long sum, unsigned long 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 = ((new >> 8) & 0xff) | ((new << 8) & 0xff00);
}
checksum = sum + new;
if (checksum > 0xFFFF) {
checksum -= 0xFFFF;
}
return (~checksum) & 0xFFFF;
}

View file

@ -3,7 +3,7 @@
#include <elf.h>
#include <elf_boot.h>
#include <linuxbios_tables.h>
#include <ip_checksum.h>
//#include <ip_checksum.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>