- Add myself
src/cpu/p5/delay_tsc.c
- Fix the indentation
- Don't have the new calibrate_tsc function directly
  update global variables.
src/include/smp/start_stop.h
- Change #ifdef SMP to #if SMP == 1
src/include/string.h
- Declare sprintf
src/lib/elfboot.c
- Minor fixes to verify_loaded_image
- Change all of the new debugging messages to printk_spew
src/lib/inflate.c
- Remove sensless warning message fixes
src/lib/linuxpci.c
- move declaration of sprintf to string.h
- Better detection of read only bars in pci_get_resource
- Remove pci_noop
- Remove warning about set_pci_dev_ops not being finished
src/lib/src.c
- change #ifdef SERIAL_POST to #if SERIAL_POST in post_code
This commit is contained in:
Eric W. Biederman 2002-10-10 19:46:47 +00:00
parent b708444232
commit b1a740bc28
8 changed files with 53 additions and 65 deletions

View file

@ -1,6 +1,7 @@
Contributors (in alpha order):
Eric Biederman <ebiederman@lnxi.com> - 440GX SPD, elfboot, mkelfImage, Athlon SMP, P4 Xeon, etc
Jeff Garzik <jgarzik@mandrakesoft.com> - The essential /dev/fb! First freebios
James Hendricks <jimi@lanl.gov> - SMP for 440GX among many other things
Ollie Lho <ollie@sis.com.tw> - SIS 630

View file

@ -98,45 +98,39 @@ bad_ctc:
*/
static unsigned long long calibrate_tsc(void)
{
unsigned long long retval, start, end, delta;
unsigned long allones = (unsigned long) -1, result;
unsigned long startlow, starthigh;
unsigned long endlow, endhigh;
unsigned long count;
rdtsc(startlow,starthigh);
// no udivdi3, dammit.
// so we count to 1<< 20 and then right shift 20
for(count = 0; count < (1<<20); count ++)
outb(0x80, 0x80);
rdtsc(endlow,endhigh);
// make delta be (endhigh - starthigh) + (endlow - startlow)
// but >> 20
// do it this way to avoid gcc warnings.
start = starthigh;
start <<= 32;
start |= startlow;
end = endhigh;
end <<= 32;
end |= endlow;
delta = end - start;
// at this point we have a delta for 1,000,000 outbs. Now rescale for one microsecond.
delta >>= 20;
// save this for microsecond timing.
clocks_per_usec = delta;
#define DEBUG
#ifdef DEBUG
printk_notice("end %x:%x, start %x:%x\n",
endhigh, endlow, starthigh, startlow);
printk_notice("32-bit delta %d\n", (unsigned long) delta);
#endif
retval = clocks_per_usec;
#ifdef DEBUG
printk_notice(__FUNCTION__ " 32-bit result is %d\n", result);
#endif
return retval;
unsigned long long retval, start, end, delta;
unsigned long allones = (unsigned long) -1, result;
unsigned long startlow, starthigh;
unsigned long endlow, endhigh;
unsigned long count;
rdtsc(startlow,starthigh);
// no udivdi3, dammit.
// so we count to 1<< 20 and then right shift 20
for(count = 0; count < (1<<20); count ++)
outb(0x80, 0x80);
rdtsc(endlow,endhigh);
// make delta be (endhigh - starthigh) + (endlow - startlow)
// but >> 20
// do it this way to avoid gcc warnings.
start = starthigh;
start <<= 32;
start |= startlow;
end = endhigh;
end <<= 32;
end |= endlow;
delta = end - start;
// at this point we have a delta for 1,000,000 outbs. Now rescale for one microsecond.
delta >>= 20;
// save this for microsecond timing.
result = delta;
printk_spew("end %x:%x, start %x:%x\n",
endhigh, endlow, starthigh, startlow);
printk_spew("32-bit delta %d\n", (unsigned long) delta);
printk_spew(__FUNCTION__ " 32-bit result is %d\n", result);
return retval;
}
@ -149,7 +143,7 @@ void udelay(unsigned long us)
unsigned long long clocks;
if (!clocks_per_usec) {
calibrate_tsc();
clocks_per_usec = calibrate_tsc();
printk_info("clocks_per_usec: %u\n", clocks_per_usec);
}
clocks = us;

View file

@ -1,7 +1,7 @@
#ifndef SMP_START_STOP_H
#define SMP_START_STOP_H
#ifdef SMP
#if SMP == 1
#include <smp/atomic.h>
unsigned long this_processors_id(void);
int processor_index(unsigned long processor_id);

View file

@ -32,4 +32,5 @@ extern void *memcpy(void *dest, const void *src, size_t n);
extern void *memset(void *s, int c, size_t n);
extern int memcmp(const void *s1, const void *s2, size_t n);
extern int sprintf(char * buf, const char *fmt, ...);
#endif /* STRING_H */

View file

@ -67,7 +67,7 @@ int verify_ip_checksum(
bytes += sizeof(*ehdr);
checksum = add_ip_checksums(bytes, checksum,
compute_ip_checksum(phdr, ehdr->e_phnum*sizeof(*phdr)));
bytes += sizeof(*phdr);
bytes += ehdr->e_phnum*sizeof(*phdr);
for(ptr = head->phdr_next; ptr != head; ptr = ptr->phdr_next) {
checksum = add_ip_checksums(bytes, checksum,
compute_ip_checksum((void *)ptr->s_addr, ptr->s_memsz));
@ -574,8 +574,6 @@ int elfload(struct stream *stream, struct lb_memory *mem,
/* Verify the loaded image */
if (!verify_loaded_image(cb_chain, ehdr, phdr, &head))
goto out;
/*
*/
printk_info("verified segments\n");
/* Shutdown the stream device */
@ -626,7 +624,7 @@ int elfboot(struct stream *stream, struct lb_memory *mem)
for(i = 0; i < ELF_HEAD_SIZE - (sizeof(Elf_ehdr) + sizeof(Elf_phdr)); i+=16) {
ehdr = (Elf_ehdr *)(&header[i]);
if (memcmp(ehdr->e_ident, ELFMAG, 4) != 0) {
printk_debug("NO header at %d\n", i);
printk_spew("NO header at %d\n", i);
continue;
}
printk_debug("Found ELF candiate at offset %d\n", i);
@ -645,12 +643,12 @@ int elfboot(struct stream *stream, struct lb_memory *mem)
}
ehdr = 0;
}
printk_debug("header_offset is %d\n", header_offset);
printk_spew("header_offset is %d\n", header_offset);
if (header_offset == -1) {
goto out;
}
printk_debug("Try to load at offset 0x%x\n", header_offset);
printk_spew("Try to load at offset 0x%x\n", header_offset);
result = elfload(stream, mem,
header + header_offset , ELF_HEAD_SIZE - header_offset);
out:

View file

@ -1097,9 +1097,9 @@ int gunzip(void)
return -1;
}
(ulg)get_byte(); /* Get timestamp */
((ulg)get_byte());// << 8;
((ulg)get_byte());// << 16;
((ulg)get_byte());// << 24;
((ulg)get_byte()) << 8;
((ulg)get_byte()) << 16;
((ulg)get_byte()) << 24;
(void)get_byte(); /* Ignore extra flags for the moment */
(void)get_byte(); /* Ignore OS type for the moment */

View file

@ -23,8 +23,7 @@ static char rcsid[] = "$Id$";
#include <string.h>
#include <subr.h>
// yes we could do Yet Another Include File, but ...
int sprintf(char * buf, const char *fmt, ...);
/**
* This is the root of the PCI tree. A PCI tree always has
@ -119,7 +118,7 @@ void pci_set_master(struct pci_dev *dev)
*/
static void pci_get_resource(struct pci_dev *dev, struct resource *resource, unsigned long index)
{
uint32_t addr, size;
uint32_t addr, size, base;
unsigned long type;
/* Initialize the resources to nothing */
@ -143,6 +142,10 @@ static void pci_get_resource(struct pci_dev *dev, struct resource *resource, uns
pci_write_config_dword(dev, index, ~0);
pci_read_config_dword(dev, index, &size);
/* get the minimum value the bar can be set to */
pci_write_config_dword(dev, index, 0);
pci_read_config_dword(dev, index, &base);
/* restore addr */
pci_write_config_dword(dev, index, addr);
@ -157,7 +160,7 @@ static void pci_get_resource(struct pci_dev *dev, struct resource *resource, uns
* This incidentally catches the common case where registers
* read back as 0 for both address and size.
*/
if (addr == size) {
if ((addr == size) && (addr == base)) {
if (size != 0) {
printk_debug(
"PCI: %02x:%02x.%01x register %02x(%08x), read-only ignoring it\n",
@ -318,7 +321,7 @@ static void pci_bus_read_resources(struct pci_dev *dev)
static void pci_set_resource(struct pci_dev *dev, struct resource *resource)
{
unsigned long base, limit;
unsigned long bridge_align = MEM_BRIDGE_ALIGN; // stupid warnings.
unsigned long bridge_align = MEM_BRIDGE_ALIGN;
unsigned char buf[10];
/* Make certain the resource has actually been set */
@ -447,14 +450,6 @@ static void pci_dev_set_resources(struct pci_dev *dev)
pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 64 >> 2);
}
// probably dead.
#if 0
static void pci_noop(struct pci_dev *dev)
{
return;
}
#endif
struct pci_dev_operations default_pci_ops_dev = {
.read_resources = pci_dev_read_resources,
.set_resources = pci_dev_set_resources,
@ -483,7 +478,6 @@ static void set_pci_ops(struct pci_dev *dev)
break;
}
}
#warning set_pci_dev_ops not yet finished
/* If I don't have a specific driver use the default operations */
switch(dev->hdr_type & 0x7f) { /* header type */
case PCI_HEADER_TYPE_NORMAL: /* standard header */

View file

@ -89,7 +89,7 @@ void error(char errmsg[])
*/
void post_code(uint8_t value)
{
#ifdef SERIAL_POST
#if SERIAL_POST
unsigned long hi, lo;
// DAMMIT! This just broke!
//rdtsc(lo, hi);