This code is shared by multiple PowerPC BSPs including all
motorola_powerpc variants.
---
 c/src/lib/libbsp/powerpc/shared/bootloader/bootldr.h | 17 ++++++++++++++++-
 c/src/lib/libbsp/powerpc/shared/bootloader/em86.c    | 14 ++++++++------
 c/src/lib/libbsp/powerpc/shared/bootloader/lib.c     | 16 ++++++++++++++--
 c/src/lib/libbsp/powerpc/shared/bootloader/misc.c    | 13 ++++++-------
 c/src/lib/libbsp/powerpc/shared/bootloader/mm.c      |  3 +--
 c/src/lib/libbsp/powerpc/shared/bootloader/pci.c     |  4 ++--
 c/src/lib/libbsp/powerpc/shared/console/polled_io.c  | 19 ++++++++++---------
 7 files changed, 57 insertions(+), 29 deletions(-)

diff --git a/c/src/lib/libbsp/powerpc/shared/bootloader/bootldr.h 
b/c/src/lib/libbsp/powerpc/shared/bootloader/bootldr.h
index cd9f0b5..c2e95d5 100644
--- a/c/src/lib/libbsp/powerpc/shared/bootloader/bootldr.h
+++ b/c/src/lib/libbsp/powerpc/shared/bootloader/bootldr.h
@@ -1,6 +1,8 @@
 /*
  *  bootldr.h -- Include file for bootloader.
- *
+ */
+
+/*
  *  Copyright (C) 1998, 1999 Gabriel Paubert, paub...@iram.es
  *
  *  Modified to compile in RTEMS development environment
@@ -206,6 +208,19 @@ void cleanup_v86_mess(void);
 void em86_main(struct pci_dev *);
 int find_max_mem(struct pci_dev *);
 
+/*
+ * Prototypes for calls from assembly and across files.
+ */
+typedef struct _x86 x86;
+
+int em86_trap(x86 *p);
+void decompress_kernel(int kernel_size, void * zimage_start, int len,
+                      void * initrd_start, int initrd_len );
+void boot_udelay(uint32_t _microseconds);
+void setup_hw(void);
+void _handler(int vec, ctxt *p);
+int early_setup(u_long image_size);
+void mm_init(u_long image_size);
 #endif
 
 #ifdef ASM
diff --git a/c/src/lib/libbsp/powerpc/shared/bootloader/em86.c 
b/c/src/lib/libbsp/powerpc/shared/bootloader/em86.c
index a16b833..5ce4b0c 100644
--- a/c/src/lib/libbsp/powerpc/shared/bootloader/em86.c
+++ b/c/src/lib/libbsp/powerpc/shared/bootloader/em86.c
@@ -1,6 +1,8 @@
 /*
  *  em86.c -- Include file for bootloader.
- *
+ */
+
+/*
  *  Copyright (C) 1998, 1999 Gabriel Paubert, paub...@iram.es
  *
  *  Modified to compile in RTEMS development environment
@@ -132,7 +134,7 @@ static void dump86(x86 * p){
 #define dump86(x)
 #endif
 
-int bios86pci(x86 * p) {
+static int bios86pci(x86 * p) {
        unsigned reg=ld_le16(&DI);
        reg_type2 tmp;
 
@@ -190,21 +192,21 @@ int bios86pci(x86 * p) {
        return 0;
 }
 
-void push2(x86 *p, unsigned value) {
+static void push2(x86 *p, unsigned value) {
        unsigned char * sbase= p->ssbase;
        unsigned newsp = (ld_le16(&SP)-2)&0xffff;
        st_le16(&SP,newsp);
        st_le16((unsigned short *)(sbase+newsp), value);
 }
 
-unsigned pop2(x86 *p) {
+static unsigned pop2(x86 *p) {
        unsigned char * sbase=p->ssbase;
        unsigned oldsp = ld_le16(&SP);
        st_le16(&SP,oldsp+2);
        return ld_le16((unsigned short *)(sbase+oldsp));
 }
 
-int int10h(x86 * p) { /* Process BIOS video interrupt */
+static int int10h(x86 * p) { /* Process BIOS video interrupt */
        unsigned vector;
        vector=ld_le32((uint32_t *)p->vbase+0x10);
        if (((vector&0xffff0000)>>16)==0xc000) {
@@ -240,7 +242,7 @@ int int10h(x86 * p) { /* Process BIOS video interrupt */
        }
 }
 
-int process_softint(x86 * p) {
+static int process_softint(x86 * p) {
 #if 0
        if (p->parm1!=0x10 || AH!=0x0e) {
                printf("Soft interrupt\n");
diff --git a/c/src/lib/libbsp/powerpc/shared/bootloader/lib.c 
b/c/src/lib/libbsp/powerpc/shared/bootloader/lib.c
index e4de17d..a414c48 100644
--- a/c/src/lib/libbsp/powerpc/shared/bootloader/lib.c
+++ b/c/src/lib/libbsp/powerpc/shared/bootloader/lib.c
@@ -5,14 +5,26 @@
  *  from newlib or rtems  because they are not compiled with the right 
option!!!
  *
  *  You've been warned!!!.
- *
- *  CopyRight (C) 1998, 1999 vale...@crf.canon.fr
+ */
+
+/*
+ *  Copyright (C) 1998, 1999 vale...@crf.canon.fr
  *
  *  The license and distribution terms for this file may be
  *  found in the file LICENSE in this distribution or at
  *  http://www.rtems.org/license/LICENSE.
  */
 
+
+/*
+ * Provide our own prototypes to avoid warnings and risk getting inlined
+ * conflicts from the normal header files.
+ */
+void* memset(void *p, int c, unsigned int n);
+void* memcpy(void *dst, const void * src, unsigned int n);
+char* strcat(char * dest, const char * src);
+int strlen(const char* string);
+
 void* memset(void *p, int c, unsigned int n)
 {
   char *q =p;
diff --git a/c/src/lib/libbsp/powerpc/shared/bootloader/misc.c 
b/c/src/lib/libbsp/powerpc/shared/bootloader/misc.c
index c5aac16..8bdea71 100644
--- a/c/src/lib/libbsp/powerpc/shared/bootloader/misc.c
+++ b/c/src/lib/libbsp/powerpc/shared/bootloader/misc.c
@@ -86,7 +86,7 @@ void hang(const char *s, u_long x, ctxt *p) {
        exit();
 };
 
-void *zalloc(void *x, unsigned items, unsigned size)
+static void *zalloc(void *x, unsigned items, unsigned size)
 {
        void *p = salloc(items*size);
 
@@ -96,7 +96,7 @@ void *zalloc(void *x, unsigned items, unsigned size)
        return p;
 }
 
-void zfree(void *x, void *addr, unsigned nb)
+static void zfree(void *x, void *addr, unsigned nb)
 {
        sfree(addr);
 }
@@ -230,9 +230,11 @@ void decompress_kernel(int kernel_size, void * 
zimage_start, int len,
 
 static int ticks_per_ms=0;
 
-/* this is from rtems_bsp_delay from libcpu */
+/*
+ * This is based on rtems_bsp_delay from libcpu
+ */
 void
-boot_udelay(uint32_t   _microseconds)
+boot_udelay(uint32_t _microseconds)
 {
    uint32_t   start, ticks, now;
 
@@ -252,9 +254,6 @@ setup_hw(void)
        struct pci_dev *default_vga;
        int timer, err;
        u_short default_vga_cmd;
-       static unsigned int indic;
-
-       indic = 0;
 
        res=bd->residual;
        default_vga=NULL;
diff --git a/c/src/lib/libbsp/powerpc/shared/bootloader/mm.c 
b/c/src/lib/libbsp/powerpc/shared/bootloader/mm.c
index a419cd7..c3203c6 100644
--- a/c/src/lib/libbsp/powerpc/shared/bootloader/mm.c
+++ b/c/src/lib/libbsp/powerpc/shared/bootloader/mm.c
@@ -129,7 +129,6 @@ void print_maps(map *, const char *);
 /* The handler used for all exceptions although for now it is only
  * designed to properly handle MMU interrupts to fill the hash table.
  */
-
 void _handler(int vec, ctxt *p) {
        map *area;
        struct _mm_private *mm = (struct _mm_private *) bd->mm_private;
@@ -424,7 +423,7 @@ MEM_MAP seg_fix[] = {
  * data. This routine changes some things in a way that the bootloader and
  * linux are happy.
  */
-void
+static void
 fix_residual( RESIDUAL *res )
 {
 #if 0
diff --git a/c/src/lib/libbsp/powerpc/shared/bootloader/pci.c 
b/c/src/lib/libbsp/powerpc/shared/bootloader/pci.c
index b61c78d..4d51b35 100644
--- a/c/src/lib/libbsp/powerpc/shared/bootloader/pci.c
+++ b/c/src/lib/libbsp/powerpc/shared/bootloader/pci.c
@@ -713,7 +713,7 @@ static const struct pci_bootloader_config_access_functions 
direct_functions = {
    direct_pci_write_config_dword
 };
 
-void pci_read_bases(struct pci_dev *dev, unsigned int howmany)
+static void pci_read_bases(struct pci_dev *dev, unsigned int howmany)
 {
    unsigned int reg, nextreg;
 
@@ -798,7 +798,7 @@ void pci_read_bases(struct pci_dev *dev, unsigned int 
howmany)
    }
 }
 
-u_int pci_scan_bus(struct pci_bus *bus)
+static u_int pci_scan_bus(struct pci_bus *bus)
 {
    unsigned int devfn, max;
    uint32_t class;
diff --git a/c/src/lib/libbsp/powerpc/shared/console/polled_io.c 
b/c/src/lib/libbsp/powerpc/shared/console/polled_io.c
index 26fe4ad..76367a1 100644
--- a/c/src/lib/libbsp/powerpc/shared/console/polled_io.c
+++ b/c/src/lib/libbsp/powerpc/shared/console/polled_io.c
@@ -443,15 +443,15 @@ int debug_tstc(void)
 
 #define vidmem ((__io_ptr)(ptr_mem_map->isa_mem_base+0xb8000))
 
-void vacuum_putc(u_char c) {
+static void vacuum_putc(u_char c) {
        console_global_data.vacuum_sent++;
 }
 
-int vacuum_getc(void) {
+static int vacuum_getc(void) {
        return -1;
 }
 
-int vacuum_tstc(void) {
+static int vacuum_tstc(void) {
        return 0;
 }
 
@@ -496,7 +496,7 @@ static void pfree(void* p)
 }
 #endif
 
-void log_putc(const u_char c) {
+static void log_putc(const u_char c) {
        console_log *l;
        for(l=console_global_data.log; l; l=l->next) {
                if (l->offset<PAGE_LOG_CHARS) break;
@@ -549,19 +549,19 @@ void flush_log(void) {
 #error "BSP probably didn't define a console port"
 #endif
 
-void serial_putc(const u_char c)
+static void serial_putc(const u_char c)
 {
        while ((INL_CONSOLE_INB(lsr) & LSR_THRE) == 0) ;
        INL_CONSOLE_OUTB(thr, c);
 }
 
-int serial_getc(void)
+static int serial_getc(void)
 {
        while ((INL_CONSOLE_INB(lsr) & LSR_DR) == 0) ;
        return (INL_CONSOLE_INB(rbr));
 }
 
-int serial_tstc(void)
+static int serial_tstc(void)
 {
        return ((INL_CONSOLE_INB(lsr) & LSR_DR) != 0);
 }
@@ -592,7 +592,7 @@ cursor(int x, int y)
        vga_outb(0x15, pos);
 }
 
-void
+static void
 vga_putc(const u_char c)
 {
        int x,y;
@@ -811,7 +811,7 @@ int kbdreset(void)
        return 0;
 }
 
-int kbd_tstc(void)
+static int kbd_tstc(void)
 {
        return ((kbd_inb(KBD_STATUS_REG) & KBD_STAT_OBF) != 0);
 }
@@ -895,6 +895,7 @@ void  printk(const char *fmt, ...) {
 
        va_start(args, fmt);
        i = k_vsprintf(buf, fmt, args);
+       (void) i; /* avoid set but not used warning */
        va_end(args);
        my_puts((u_char*)buf);
 }
-- 
1.9.3

_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to