- 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): 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 Jeff Garzik <jgarzik@mandrakesoft.com> - The essential /dev/fb! First freebios
James Hendricks <jimi@lanl.gov> - SMP for 440GX among many other things James Hendricks <jimi@lanl.gov> - SMP for 440GX among many other things
Ollie Lho <ollie@sis.com.tw> - SIS 630 Ollie Lho <ollie@sis.com.tw> - SIS 630

View file

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

View file

@ -1,7 +1,7 @@
#ifndef SMP_START_STOP_H #ifndef SMP_START_STOP_H
#define SMP_START_STOP_H #define SMP_START_STOP_H
#ifdef SMP #if SMP == 1
#include <smp/atomic.h> #include <smp/atomic.h>
unsigned long this_processors_id(void); unsigned long this_processors_id(void);
int processor_index(unsigned long processor_id); 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 void *memset(void *s, int c, size_t n);
extern int memcmp(const void *s1, const void *s2, 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 */ #endif /* STRING_H */

View file

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

View file

@ -1097,9 +1097,9 @@ int gunzip(void)
return -1; return -1;
} }
(ulg)get_byte(); /* Get timestamp */ (ulg)get_byte(); /* Get timestamp */
((ulg)get_byte());// << 8; ((ulg)get_byte()) << 8;
((ulg)get_byte());// << 16; ((ulg)get_byte()) << 16;
((ulg)get_byte());// << 24; ((ulg)get_byte()) << 24;
(void)get_byte(); /* Ignore extra flags for the moment */ (void)get_byte(); /* Ignore extra flags for the moment */
(void)get_byte(); /* Ignore OS type 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 <string.h>
#include <subr.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 * 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) 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; unsigned long type;
/* Initialize the resources to nothing */ /* 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_write_config_dword(dev, index, ~0);
pci_read_config_dword(dev, index, &size); 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 */ /* restore addr */
pci_write_config_dword(dev, index, 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 * This incidentally catches the common case where registers
* read back as 0 for both address and size. * read back as 0 for both address and size.
*/ */
if (addr == size) { if ((addr == size) && (addr == base)) {
if (size != 0) { if (size != 0) {
printk_debug( printk_debug(
"PCI: %02x:%02x.%01x register %02x(%08x), read-only ignoring it\n", "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) static void pci_set_resource(struct pci_dev *dev, struct resource *resource)
{ {
unsigned long base, limit; unsigned long base, limit;
unsigned long bridge_align = MEM_BRIDGE_ALIGN; // stupid warnings. unsigned long bridge_align = MEM_BRIDGE_ALIGN;
unsigned char buf[10]; unsigned char buf[10];
/* Make certain the resource has actually been set */ /* 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); 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 = { struct pci_dev_operations default_pci_ops_dev = {
.read_resources = pci_dev_read_resources, .read_resources = pci_dev_read_resources,
.set_resources = pci_dev_set_resources, .set_resources = pci_dev_set_resources,
@ -483,7 +478,6 @@ static void set_pci_ops(struct pci_dev *dev)
break; break;
} }
} }
#warning set_pci_dev_ops not yet finished
/* If I don't have a specific driver use the default operations */ /* If I don't have a specific driver use the default operations */
switch(dev->hdr_type & 0x7f) { /* header type */ switch(dev->hdr_type & 0x7f) { /* header type */
case PCI_HEADER_TYPE_NORMAL: /* standard header */ case PCI_HEADER_TYPE_NORMAL: /* standard header */

View file

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