[PATCH 11/11] powerpc bootloader: Remove warnings
Joel Sherrill
joel.sherrill at oarcorp.com
Thu Oct 9 21:58:51 UTC 2014
This code is shared by multiple PowerPC BSPs including all
motorola_powerpc variants.
---
c/src/lib/libbsp/powerpc/shared/bootloader/em86.c | 14 +++++++-----
c/src/lib/libbsp/powerpc/shared/bootloader/lib.c | 14 +++++++++++-
c/src/lib/libbsp/powerpc/shared/bootloader/misc.c | 25 ++++++++++++++++------
c/src/lib/libbsp/powerpc/shared/bootloader/mm.c | 13 +++++++++--
c/src/lib/libbsp/powerpc/shared/bootloader/pci.c | 4 ++--
.../lib/libbsp/powerpc/shared/console/polled_io.c | 19 ++++++++--------
6 files changed, 63 insertions(+), 26 deletions(-)
diff --git a/c/src/lib/libbsp/powerpc/shared/bootloader/em86.c b/c/src/lib/libbsp/powerpc/shared/bootloader/em86.c
index a16b833..cee0006 100644
--- a/c/src/lib/libbsp/powerpc/shared/bootloader/em86.c
+++ b/c/src/lib/libbsp/powerpc/shared/bootloader/em86.c
@@ -132,7 +132,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 +190,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 +240,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");
@@ -309,6 +309,10 @@ int process_softint(x86 * p) {
#define code_outsw_a32 1024+512+256+128+2
#define code_outsl_a32 1024+512+256+128+4
+/*
+ * This is involved from em86real.S and cannot be static.
+ */
+int em86_trap(x86 *p);
int em86_trap(x86 *p) {
#ifndef __BOOT__
int i;
diff --git a/c/src/lib/libbsp/powerpc/shared/bootloader/lib.c b/c/src/lib/libbsp/powerpc/shared/bootloader/lib.c
index e4de17d..2da9287 100644
--- a/c/src/lib/libbsp/powerpc/shared/bootloader/lib.c
+++ b/c/src/lib/libbsp/powerpc/shared/bootloader/lib.c
@@ -5,7 +5,9 @@
* from newlib or rtems because they are not compiled with the right option!!!
*
* You've been warned!!!.
- *
+ */
+
+/*
* CopyRight (C) 1998, 1999 valette at crf.canon.fr
*
* The license and distribution terms for this file may be
@@ -13,6 +15,16 @@
* 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..a46e452 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);
}
@@ -156,6 +156,11 @@ void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp)
inflateEnd(&s);
}
+/*
+ * This method is invoked from head.S so cannot be static.
+ */
+void decompress_kernel(int kernel_size, void * zimage_start, int len,
+ void * initrd_start, int initrd_len );
void decompress_kernel(int kernel_size, void * zimage_start, int len,
void * initrd_start, int initrd_len ) {
u_char *parea;
@@ -230,9 +235,14 @@ 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 method is invoked from polled_io.c so cannot be static.
+ *
+ * This is from rtems_bsp_delay from libcpu
+ */
+void boot_udelay(uint32_t _microseconds);
void
-boot_udelay(uint32_t _microseconds)
+boot_udelay(uint32_t _microseconds)
{
uint32_t start, ticks, now;
@@ -243,6 +253,10 @@ boot_udelay(uint32_t _microseconds)
} while (now - start < ticks);
}
+/*
+ * This method is invoked from head.S so cannot be static.
+ */
+void setup_hw(void);
void
setup_hw(void)
{
@@ -252,9 +266,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..a25ebad 100644
--- a/c/src/lib/libbsp/powerpc/shared/bootloader/mm.c
+++ b/c/src/lib/libbsp/powerpc/shared/bootloader/mm.c
@@ -128,8 +128,10 @@ 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.
+ *
+ * This is invoked from exception.S and cannot be static.
*/
-
+void _handler(int vec, ctxt *p);
void _handler(int vec, ctxt *p) {
map *area;
struct _mm_private *mm = (struct _mm_private *) bd->mm_private;
@@ -424,7 +426,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
@@ -467,7 +469,10 @@ fix_residual( RESIDUAL *res )
/* This routine is the first C code called with very little stack space!
* Its goal is to find where the boot image can be moved. This will
* be the highest address with enough room.
+ *
+ * This is invoked from head.S and cannot be static.
*/
+int early_setup(u_long image_size);
int early_setup(u_long image_size) {
register RESIDUAL *res = bd->residual;
u_long minpages = PAGE_ALIGN(image_size)>>PAGE_SHIFT;
@@ -715,6 +720,10 @@ void add_perm_map(u_long start, u_long size) {
insert_map(& mm->physperm , p);
}
+/*
+ * This is invoked from head.S and cannot be static.
+ */
+void mm_init(u_long image_size);
void mm_init(u_long image_size)
{
u_long lowpage=ULONG_MAX, highpage;
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
More information about the devel
mailing list