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
This commit is contained in:
Eric W. Biederman 2003-04-14 23:45:42 +00:00
parent bf2d57b99a
commit ebf98ebdc0
5 changed files with 22 additions and 170 deletions

View file

@ -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);

View file

@ -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;
}

View file

@ -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(&current, sizeof(tag_head) );
printk_info("Tag contents: ");
for(i=0; i<16; i++)
printk_info("%02x ", ( (char *) &current)[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; i<count; i++)
if(subject[i] != target[i])
break;
if ( i == count)
return(0);
return(subject[i] - target[i]);
}
void rom_get_tags(void *buffer)
{
int i;
tag_head *ptr = buffer;
int count;
for(i=0; i<tag_count; i++) {
rom_seek(tags[i]);
read_bytes(ptr, sizeof(tag_head));
// printk_info("copying tag at %08x, with block_count=%u to %08x\n", tags[i], ptr->block_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(&current, 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,

View file

@ -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]

View file

@ -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