Changeset 641

Show
Ignore:
Timestamp:
10/10/02 21:46:47 (6 years ago)
Author:
ebiederm
Message:

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

Location:
trunk/LinuxBIOSv1
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • trunk/LinuxBIOSv1/AUTHORS

    r8 r641  
    22Contributors (in alpha order): 
    33 
     4Eric Biederman <ebiederman@lnxi.com> - 440GX SPD, elfboot, mkelfImage, Athlon SMP, P4 Xeon, etc 
    45Jeff Garzik <jgarzik@mandrakesoft.com> - The essential /dev/fb! First freebios 
    56James Hendricks <jimi@lanl.gov> - SMP for 440GX among many other things 
  • trunk/LinuxBIOSv1/src/cpu/p5/delay_tsc.c

    r621 r641  
    9999static unsigned long long calibrate_tsc(void) 
    100100{ 
    101     unsigned long long retval, start, end, delta; 
    102     unsigned long allones = (unsigned long) -1, result; 
    103     unsigned long startlow, starthigh; 
    104     unsigned long endlow, endhigh; 
    105     unsigned long count; 
    106  
    107     rdtsc(startlow,starthigh); 
    108     // no udivdi3, dammit. 
    109     // so we count to 1<< 20 and then right shift 20 
    110     for(count = 0; count < (1<<20); count ++) 
    111         outb(0x80, 0x80); 
    112     rdtsc(endlow,endhigh); 
    113  
    114     // make delta be (endhigh - starthigh) + (endlow - startlow) 
    115     // but >> 20 
    116     // do it this way to avoid gcc warnings. 
    117     start = starthigh; 
    118     start <<= 32; 
    119     start |= startlow; 
    120     end = endhigh; 
    121     end <<= 32; 
    122     end |= endlow; 
    123     delta = end - start; 
    124     // at this point we have a delta for 1,000,000 outbs. Now rescale for one microsecond. 
    125     delta >>= 20; 
    126     // save this for microsecond timing. 
    127     clocks_per_usec = delta; 
    128 #define DEBUG 
    129 #ifdef DEBUG 
    130     printk_notice("end %x:%x, start %x:%x\n", 
    131         endhigh, endlow, starthigh, startlow); 
    132     printk_notice("32-bit delta %d\n", (unsigned long) delta); 
    133 #endif 
    134  
    135     retval = clocks_per_usec; 
    136 #ifdef DEBUG 
    137     printk_notice(__FUNCTION__ " 32-bit result is %d\n", result); 
    138 #endif 
    139     return retval; 
     101        unsigned long long retval, start, end, delta; 
     102        unsigned long allones = (unsigned long) -1, result; 
     103        unsigned long startlow, starthigh; 
     104        unsigned long endlow, endhigh; 
     105        unsigned long count; 
     106         
     107        rdtsc(startlow,starthigh); 
     108        // no udivdi3, dammit. 
     109        // so we count to 1<< 20 and then right shift 20 
     110        for(count = 0; count < (1<<20); count ++) 
     111                outb(0x80, 0x80); 
     112        rdtsc(endlow,endhigh); 
     113         
     114        // make delta be (endhigh - starthigh) + (endlow - startlow) 
     115        // but >> 20 
     116        // do it this way to avoid gcc warnings. 
     117        start = starthigh; 
     118        start <<= 32; 
     119        start |= startlow; 
     120        end = endhigh; 
     121        end <<= 32; 
     122        end |= endlow; 
     123        delta = end - start; 
     124        // at this point we have a delta for 1,000,000 outbs. Now rescale for one microsecond. 
     125        delta >>= 20; 
     126        // save this for microsecond timing. 
     127        result = delta; 
     128        printk_spew("end %x:%x, start %x:%x\n", 
     129                endhigh, endlow, starthigh, startlow); 
     130        printk_spew("32-bit delta %d\n", (unsigned long) delta); 
     131         
     132        printk_spew(__FUNCTION__ " 32-bit result is %d\n", result); 
     133        return retval; 
    140134} 
    141135 
     
    150144 
    151145        if (!clocks_per_usec) { 
    152                 calibrate_tsc(); 
     146                clocks_per_usec = calibrate_tsc(); 
    153147                printk_info("clocks_per_usec: %u\n", clocks_per_usec); 
    154148        } 
  • trunk/LinuxBIOSv1/src/include/smp/start_stop.h

    r408 r641  
    22#define SMP_START_STOP_H 
    33 
    4 #ifdef SMP 
     4#if SMP == 1 
    55#include <smp/atomic.h> 
    66unsigned long this_processors_id(void); 
  • trunk/LinuxBIOSv1/src/include/string.h

    r597 r641  
    3333extern int memcmp(const void *s1, const void *s2, size_t n); 
    3434 
     35extern int sprintf(char * buf, const char *fmt, ...); 
    3536#endif /* STRING_H */ 
  • trunk/LinuxBIOSv1/src/lib/elfboot.c

    r635 r641  
    6868        checksum = add_ip_checksums(bytes, checksum,  
    6969                compute_ip_checksum(phdr, ehdr->e_phnum*sizeof(*phdr))); 
    70         bytes += sizeof(*phdr); 
     70        bytes += ehdr->e_phnum*sizeof(*phdr); 
    7171        for(ptr = head->phdr_next; ptr != head; ptr = ptr->phdr_next) { 
    7272                checksum = add_ip_checksums(bytes, checksum, 
     
    575575        if (!verify_loaded_image(cb_chain, ehdr, phdr, &head))  
    576576                goto out; 
    577 /* 
    578  */ 
    579577 
    580578        printk_info("verified segments\n"); 
     
    627625                ehdr = (Elf_ehdr *)(&header[i]); 
    628626                if (memcmp(ehdr->e_ident, ELFMAG, 4) != 0) { 
    629                         printk_debug("NO header at %d\n", i); 
     627                        printk_spew("NO header at %d\n", i); 
    630628                        continue; 
    631629                } 
     
    646644                ehdr = 0; 
    647645        } 
    648         printk_debug("header_offset is %d\n", header_offset); 
     646        printk_spew("header_offset is %d\n", header_offset); 
    649647        if (header_offset == -1) { 
    650648                goto out; 
    651649        } 
    652650 
    653         printk_debug("Try to load at offset 0x%x\n", header_offset); 
     651        printk_spew("Try to load at offset 0x%x\n", header_offset); 
    654652        result = elfload(stream, mem,  
    655653                header + header_offset , ELF_HEAD_SIZE - header_offset); 
  • trunk/LinuxBIOSv1/src/lib/inflate.c

    r614 r641  
    10981098    } 
    10991099    (ulg)get_byte();    /* Get timestamp */ 
    1100     ((ulg)get_byte());// << 8; 
    1101     ((ulg)get_byte());// << 16; 
    1102     ((ulg)get_byte());// << 24; 
     1100    ((ulg)get_byte()) << 8; 
     1101    ((ulg)get_byte()) << 16; 
     1102    ((ulg)get_byte()) << 24; 
    11031103 
    11041104    (void)get_byte();  /* Ignore extra flags for the moment */ 
  • trunk/LinuxBIOSv1/src/lib/linuxpci.c

    r614 r641  
    2424#include <subr.h> 
    2525 
    26 // yes we could do Yet Another Include File, but ... 
    27 int sprintf(char * buf, const char *fmt, ...); 
     26 
    2827 
    2928/** 
     
    120119static void pci_get_resource(struct pci_dev *dev, struct resource *resource, unsigned long index) 
    121120{ 
    122         uint32_t addr, size; 
     121        uint32_t addr, size, base; 
    123122        unsigned long type; 
    124123 
     
    143142        pci_write_config_dword(dev, index, ~0); 
    144143        pci_read_config_dword(dev,  index, &size); 
     144 
     145        /* get the minimum value the bar can be set to */ 
     146        pci_write_config_dword(dev, index, 0); 
     147        pci_read_config_dword(dev, index, &base); 
    145148 
    146149        /* restore addr */ 
     
    158161         * read back as 0 for both address and size.  
    159162         */ 
    160         if (addr == size) { 
     163        if ((addr == size) && (addr == base)) { 
    161164                if (size != 0) { 
    162165                        printk_debug( 
     
    319322{ 
    320323        unsigned long base, limit; 
    321         unsigned long bridge_align = MEM_BRIDGE_ALIGN; // stupid warnings. 
     324        unsigned long bridge_align = MEM_BRIDGE_ALIGN; 
    322325        unsigned char buf[10]; 
    323326         
     
    448451} 
    449452 
    450  
    451 // probably dead. 
    452 #if 0 
    453 static void pci_noop(struct pci_dev *dev) 
    454 { 
    455         return; 
    456 } 
    457 #endif 
    458453struct pci_dev_operations default_pci_ops_dev = { 
    459454        .read_resources = pci_dev_read_resources, 
     
    484479                } 
    485480        } 
    486 #warning set_pci_dev_ops not yet finished 
    487481        /* If I don't have a specific driver use the default operations */ 
    488482        switch(dev->hdr_type & 0x7f) {  /* header type */ 
  • trunk/LinuxBIOSv1/src/lib/subr.c

    r593 r641  
    9090void post_code(uint8_t value) 
    9191{ 
    92 #ifdef SERIAL_POST 
     92#if SERIAL_POST 
    9393        unsigned long hi, lo; 
    9494        // DAMMIT! This just broke!