From ebf98ebdc034e77c48d32e0078a61a782f3524e6 Mon Sep 17 00:00:00 2001 From: "Eric W. Biederman" Date: Mon, 14 Apr 2003 23:45:42 +0000 Subject: [PATCH] include/rom/read_bytes.h - Remove baremetal toolkit code src/rom/rom_fill_inbuf.c - Remove tag support util/config/NLBConfig.py - Remove crt0.o from OBJECTS-1 util/getpir/Makefile - set LINUXBSIOSROOT to an always working path --- src/include/rom/read_bytes.h | 10 -- src/mainboard/supermicro/p4dpr/mainboard.c | 14 -- src/rom/rom_fill_inbuf.c | 162 +++------------------ util/config/NLBConfig.py | 3 +- util/getpir/Makefile | 3 +- 5 files changed, 22 insertions(+), 170 deletions(-) diff --git a/src/include/rom/read_bytes.h b/src/include/rom/read_bytes.h index 3c50d25496..e786a31e65 100644 --- a/src/include/rom/read_bytes.h +++ b/src/include/rom/read_bytes.h @@ -5,18 +5,8 @@ typedef long byte_offset_t; -typedef struct tag_t { - char signature[5]; - unsigned char block_count; - unsigned long length; - char data[6]; -} __attribute__ ((packed)) tag_head; - struct stream { int (*init)(void); - int (*init_tags)(void); - void (*get_tags)(void *buf); - void (*load_tag)(int tag); byte_offset_t (*read)(void *vdest, byte_offset_t count); byte_offset_t (*skip)(byte_offset_t count); void (*fini)(void); diff --git a/src/mainboard/supermicro/p4dpr/mainboard.c b/src/mainboard/supermicro/p4dpr/mainboard.c index f9362956dd..8fa71517b4 100644 --- a/src/mainboard/supermicro/p4dpr/mainboard.c +++ b/src/mainboard/supermicro/p4dpr/mainboard.c @@ -65,18 +65,6 @@ static void set_thermal_monitoring(int thermal_monitoring) return; } -static void enable_perr_serr(void) -{ -#if 0 - uint8_t data61,data70,data74; - data61=inb(0x61); - data70=inb(0x70); - data74=inb(0x74); - printk_debug("Temp Test 70 = %x, 74 = %x, 61 = %x\n",data70,data74, - data61); -#endif - return; -} void mainboard_fixup(void) { int cpu_clock_multiplier; @@ -112,8 +100,6 @@ void mainboard_fixup(void) thermal_monitoring = THERMAL_MONITORING_OFF; set_thermal_monitoring(thermal_monitoring); - enable_perr_serr(); - return; } diff --git a/src/rom/rom_fill_inbuf.c b/src/rom/rom_fill_inbuf.c index 164a73dd2a..b06664e0b4 100644 --- a/src/rom/rom_fill_inbuf.c +++ b/src/rom/rom_fill_inbuf.c @@ -14,14 +14,8 @@ #define ZKERNEL_MASK 0x0000ffff #endif -#ifndef _ROMTOP -#define _ROMTOP 0xfffffff0 -#endif - /* The inbuf copy option has been killed... */ -#define K64 (64 * 1024) - static unsigned char *zkernel_start = (unsigned char *)ZKERNEL_START; static unsigned long zkernel_mask = ZKERNEL_MASK; @@ -29,20 +23,23 @@ static unsigned char *nvram; static int block_count; static int block_offset; -static unsigned int max_block = (_ROMTOP - ZKERNEL_START)/K64; +#define K64 (64 * 1024) - -static int init_bytes(void); - -int rom_seek(unsigned long int where) +static int init_bytes(void) { - block_count = where / K64; - block_offset = where - (block_count * K64); - nvram = zkernel_start + (K64 * block_count); + block_count = 0; + block_offset = 0; + nvram = zkernel_start; - return(where); + printk_debug("%6d:%s() - zkernel_start:0x%08x " + "zkernel_mask:0x%08x\n", + __LINE__, __FUNCTION__, + zkernel_start, zkernel_mask); + + return 0; } + static void fini_bytes(void) { return; @@ -59,9 +56,14 @@ static byte_offset_t rom_read_bytes(int cp, void *vdest, byte_offset_t count) block_count++; nvram+= K64; } - if (block_count > max_block) { - printk_emerg( "%6d:%s() - overflowed source buffer. max_block = %u\n", - __LINE__, __FUNCTION__, max_block); + if (!(zkernel_mask & (1 << block_count))) { + printk_debug("%6d:%s() - skipping block %d\n", + __LINE__, __FUNCTION__, block_count); + continue; + } + if (block_count > 31) { + printk_emerg( "%6d:%s() - overflowed source buffer\n", + __LINE__, __FUNCTION__); return bytes; } length = K64 - block_offset; @@ -88,132 +90,8 @@ static byte_offset_t read_bytes(void *vdest, byte_offset_t count) return rom_read_bytes(1, vdest, count); } -static int tag_count=0; -static int tag_blocks=0; -unsigned long tags[32]; - -void rom_load_tag(int tag) -{ - tag_head current; - int i; - - printk_info("Loading tag %u @ %08x\n", tag, tags[tag]); - - if(tag < tag_count) { - rom_seek( tags[tag] ); - read_bytes(¤t, sizeof(tag_head) ); - - printk_info("Tag contents: "); - for(i=0; i<16; i++) - printk_info("%02x ", ( (char *) ¤t)[i] ); - - printk_info("\n"); - - printk_info("TAG block count = %u\n", current.block_count); - - skip_bytes( current.block_count * sizeof(tag_head) ); - } - -} - -int strncmp(char *subject, char *target, int count) -{ - int i; - - for(i=0; iblock_count, (int) ptr); - count = ptr->block_count; - ptr++; - if(count) { - read_bytes(ptr, sizeof(tag_head) * count); - ptr += count; - } - } -} - - -int search_tags(void) -{ - tag_head current; - - - rom_seek(0); - tag_count=0; - tag_blocks=0; - - printk_info("Searching for %u byte tags\n", sizeof(tag_head) ); - - if(!tag_count) { - while( read_bytes(¤t, sizeof(tag_head)) == sizeof(tag_head) ) { - if(strncmp(current.signature, "$TAG$", 5)) - continue; - - // we found a tag, now look at it - tag_blocks++; - tags[tag_count++] = K64 * block_count + block_offset - sizeof(tag_head); - - printk_info("Found tag at %08x block_count = %u\n", tags[tag_count-1], current.block_count); - - if(current.block_count >0) { - skip_bytes( current.block_count * sizeof(tag_head) ); - tag_blocks += current.block_count; - } - - } - } - - if(tag_count) { - rom_load_tag(0); - } else - rom_seek(0); - - return(tag_blocks); -} - -static int init_bytes(void) -{ - int i; - - block_count = 0; - block_offset = 0; - nvram = zkernel_start; - - printk_debug("%6d:%s() - zkernel_start:0x%08x " - "zkernel_mask:0x%08x\n", - __LINE__, __FUNCTION__, - zkernel_start, zkernel_mask); - - i = search_tags(); - - printk_info("init_bytes found %u tags\n", i); - - return 0; -} - static struct stream rom_stream __stream = { .init = init_bytes, - .init_tags = search_tags, - .get_tags = rom_get_tags, - .load_tag = rom_load_tag, .read = read_bytes, .skip = skip_bytes, .fini = fini_bytes, diff --git a/util/config/NLBConfig.py b/util/config/NLBConfig.py index 825fa9b8a2..1e924b5142 100644 --- a/util/config/NLBConfig.py +++ b/util/config/NLBConfig.py @@ -1056,8 +1056,7 @@ CPUFLAGS := $(foreach _var_,$(VARIABLES),$(call D_item,$(_var_))) # print out all the object dependencies file.write("\n# object dependencies (objectrules:)\n") - # There is ALWAYS a crt0.o - #file.write("OBJECTS-1 := crt0.o\n") + file.write("OBJECTS-1 :=\n") file.write("DRIVERS-1 :=\n") for objrule in objectrules: obj_name = objrule[0] diff --git a/util/getpir/Makefile b/util/getpir/Makefile index 823fa1f7db..59afc6f962 100644 --- a/util/getpir/Makefile +++ b/util/getpir/Makefile @@ -1,5 +1,4 @@ -# change to the path of your linuxbios tree -LINUXBIOSROOT=/home/rminnich/src/bios/freebios/ +LINUXBIOSROOT=../.. INCLUDEPATH=$(LINUXBIOSROOT)/src/arch/i386/include/arch INCLUDE2=$(LINUXBIOSROOT)/src/include