Silenced some compiler warnings that occur when compiling with prototype checks

The compiler flags -Wmissing-prototypes and -Wstrict-prototypes generally help
to write code with proper prototypes. This way one can avoid some ugly bugs
because it helps to identify functions that do not have prototypes in headers.
It also helps to improve performance since local functions then have to be
declared "static", so the compiler can do better optimizations.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
This commit is contained in:
Thomas Huth 2011-11-28 11:35:08 +01:00
parent ec10f8af35
commit 33bb95bab2
40 changed files with 139 additions and 85 deletions

View File

@ -20,6 +20,8 @@
#include <hw.h>
void io_init(void);
short reg_get_flashside(void);
void rtas_init(void);
typedef struct {
uint64_t r3;
@ -29,7 +31,7 @@ typedef struct {
volatile slave_t rtas_slave_interface;
void
static void
rtas_slave_loop(volatile slave_t * pIface)
{
uint64_t mask = pIface->id;
@ -39,8 +41,8 @@ rtas_slave_loop(volatile slave_t * pIface)
while (dly--);
}
pIface->id = 0;
asm(" mr 3,%0 ; mtctr %1 ; bctr "::"r"(pIface->r3), "r"(pIface->addr));
asm volatile (" mr 3,%0 ; mtctr %1 ; bctr "
::"r"(pIface->r3), "r"(pIface->addr));
}
void
@ -162,7 +164,7 @@ rtas_get_blade_descr(rtas_args_t * pArgs)
}
// for JS20 cannot read blade descr
uint32_t
static uint32_t
dummy_get_blade_descr(uint8_t *dst, uint32_t maxlen, uint32_t *len)
{
// to not have a warning we need to do _something_ with *dst and maxlen...

View File

@ -216,7 +216,7 @@ write_flash(unsigned long offset, unsigned char *data)
clr_ci();
}
void
static void
write_flash_page(unsigned long offset, unsigned short *data)
{
int i = 0;

View File

@ -16,3 +16,5 @@
#define FLASH SB_FLASH_adr
#define BUFSIZE 4096
#define FLASH_BLOCK_SIZE 0x20000
void write_flash(unsigned long offset, unsigned char *data);

View File

@ -15,6 +15,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <rtas.h>
#include <hw.h>
@ -35,7 +36,7 @@ io_init(void)
}
}
void
static void
display_char(char ch)
{
volatile int i = 0;
@ -52,7 +53,7 @@ display_char(char ch)
}
}
size_t
ssize_t
write(int fd __attribute((unused)), const void *buf, size_t cnt)
{
while (cnt--) {

View File

@ -37,7 +37,7 @@ pInterruptFunc_t vectorTable[0x2E << 1];
void c_memInit(uint64_t r3, uint64_t r4);
void proceedInterrupt();
void proceedInterrupt(void);
void exception_forward(void)
{

View File

@ -15,6 +15,7 @@
#include "rtas.h"
#include <stdio.h>
#include <string.h>
#include <of.h> // use translate_address_dev and get_puid from net-snk
#include "debug.h"
typedef struct {
@ -26,10 +27,6 @@ typedef struct {
uint64_t size;
} __attribute__ ((__packed__)) assigned_address_t;
// use translate_address_dev and get_puid from net-snk's net_support.c
void translate_address_dev(uint64_t *, phandle_t);
uint64_t get_puid(phandle_t node);
// scan all adresses assigned to the device ("assigned-addresses" and "reg")
// store in translate_address_array for faster translation using dev_translate_address

View File

@ -12,6 +12,7 @@
#include <stdio.h>
#include <cpu.h>
#include <pci.h>
#include "device.h"
#include "rtas.h"
#include "debug.h"
@ -20,9 +21,6 @@
#include <x86emu/x86emu.h>
#include <time.h>
// those are defined in net-snk/oflib/pci.c
extern unsigned int read_io(void *, size_t);
extern int write_io(void *, unsigned int, size_t);
//defined in net-snk/kernel/timer.c
extern uint64_t get_time(void);

View File

@ -22,6 +22,7 @@ extern int vbe_get_info(char argc, char**argv);
#endif
extern void _callback_entry(void);
int callback(int argc, char *argv[]);
int

View File

@ -14,6 +14,7 @@
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include "args.h"
/**
* Returns pointer of the n'th argument within a string.

View File

@ -24,6 +24,7 @@
#include <netapps/args.h>
#include <libbootmsg/libbootmsg.h>
#include <of.h>
#include "netapps.h"
#define IP_INIT_DEFAULT 2
#define IP_INIT_NONE 0

View File

@ -19,6 +19,7 @@
#include <string.h>
#include <stdlib.h>
#include <sys/socket.h>
#include "netapps.h"
int netflash(int argc, char * argv[])
{

View File

@ -19,6 +19,7 @@
#include <stdlib.h>
#include <time.h>
#include <netapps/args.h>
#include "netapps.h"
struct ping_args {
union {
@ -37,7 +38,7 @@ struct ping_args {
};
static void
usage()
usage(void)
{
printf
("\nping device-path:[device-args,]server-ip,[client-ip],[gateway-ip][,timeout]\n");

View File

@ -25,15 +25,16 @@
static char * response_buffer;
void
#if DEBUG
static void
print_ip(char *ip)
{
printf("%d.%d.%d.%d\n", ip[0], ip[1], ip[2], ip[3]);
}
#endif
/* IP header checksum calculation */
unsigned short
static unsigned short
checksum(unsigned short *packet, int words)
{
unsigned long checksum;

View File

@ -12,11 +12,15 @@
#ifndef KERNEL_H
#define KERNEL_H
#include <stddef.h>
#include <stdint.h>
int printk(const char *, ...);
void *memcpy(void *, const void *, size_t);
void *memset(void *, int, size_t);
uint64_t get_time(void);
void udelay(unsigned int);
void mdelay(unsigned int);
int getchar(void);

View File

@ -10,9 +10,11 @@
* IBM Corporation - initial implementation
*****************************************************************************/
#ifndef OF_H
#define OF_H
#include <stdint.h>
#define p32 int
#define p32cast (int) (unsigned long) (void*)
@ -53,4 +55,9 @@ int vpd_read(unsigned int , unsigned int , char *);
int vpd_write(unsigned int , unsigned int , char *);
int write_mm_log(char *, unsigned int , unsigned short );
void get_mac(char *mac);
uint64_t get_puid(phandle_t node);
void translate_address_dev(uint64_t *, phandle_t);
void translate_address(unsigned long *addr);
#endif

View File

@ -23,4 +23,7 @@ int pci_bus_scan_puid(long long puid, int class_to_check,
pci_config_t *pci_devices, int max_devs);
long long get_next_phb (phandle_t *phb);
unsigned int read_io(void *addr, size_t sz);
int write_io(void *addr, unsigned int value, size_t sz);
#endif

View File

@ -30,14 +30,14 @@ typedef void (*thread_t) (int);
int rtas_token(const char *);
int rtas_call(int, int, int, int *, ...);
void rtas_init();
void rtas_init(void);
int rtas_pci_config_read (long long, int, int, int, int);
int rtas_pci_config_write (long long, int, int, int, int, int);
int rtas_set_time_of_day(dtime *);
int rtas_get_time_of_day(dtime *);
int rtas_ibm_update_flash_64(long long, long long);
int rtas_ibm_update_flash_64_and_reboot(long long, long long);
int rtas_system_reboot();
int rtas_system_reboot(void);
int rtas_start_cpu (int, thread_t, int);
int rtas_stop_self (void);
int rtas_ibm_manage_flash(int);

View File

@ -14,7 +14,7 @@
#ifndef SYSTEMCALL_H
#define SYSTEMCALL_H
extern inline int
static inline int
syscall (int nr)
{
register unsigned long r0 asm("r0") = nr;
@ -24,7 +24,7 @@ syscall (int nr)
return r3;
}
extern inline long
static inline long
syscall_1 (int nr, long arg0)
{
register unsigned long r0 asm("r0") = nr;
@ -34,7 +34,7 @@ syscall_1 (int nr, long arg0)
return r3;
}
extern inline long
static inline long
syscall_2 (int nr, long arg0, long arg1)
{
register unsigned long r0 asm("r0") = nr;
@ -45,7 +45,7 @@ syscall_2 (int nr, long arg0, long arg1)
return r3;
}
extern inline long
static inline long
syscall_3 (int nr, long arg0, long arg1, long arg2)
{
register unsigned long r0 asm("r0") = nr;
@ -57,7 +57,7 @@ syscall_3 (int nr, long arg0, long arg1, long arg2)
return r3;
}
extern inline long
static inline long
syscall_4 (int nr, long arg0, long arg1, long arg2, long arg3)
{
register unsigned long r0 asm("r0") = nr;
@ -70,7 +70,7 @@ syscall_4 (int nr, long arg0, long arg1, long arg2, long arg3)
return r3;
}
extern inline long
static inline long
syscall_5 (int nr, long arg0, long arg1, long arg2, long arg3,
long arg4)
{
@ -86,7 +86,7 @@ syscall_5 (int nr, long arg0, long arg1, long arg2, long arg3,
return r3;
}
extern inline long
static inline long
syscall_6 (int nr, long arg0, long arg1, long arg2, long arg3,
long arg4, long arg5)
{
@ -103,7 +103,7 @@ syscall_6 (int nr, long arg0, long arg1, long arg2, long arg3,
return r3;
}
extern inline long
static inline long
syscall_7 (int nr, long arg0, long arg1, long arg2, long arg3,
long arg4, long arg5, long arg6)
{

View File

@ -24,11 +24,11 @@ extern unsigned long tb_freq;
/* setup the timer to start counting from the given parameter */
void set_timer(int);
/* read the current value from the decrementer */
int get_timer();
int get_timer(void);
/* get the number of ticks for which the decrementer needs 1 second */
int get_sec_ticks();
int get_sec_ticks(void);
/* get the number of ticks for which the decrementer needs 1 millisecond */
int get_msec_ticks();
int get_msec_ticks(void);
#define TICKS_MSEC get_msec_ticks()
#define TICKS_SEC get_sec_ticks()

View File

@ -10,14 +10,18 @@
* IBM Corporation - initial implementation
*****************************************************************************/
#include <stdlib.h>
#include <string.h>
extern int main (int, char**);
extern int callback (int, char **);
int _start(char *arg_string, long len);
unsigned long callback_entry(void *base, unsigned long len);
#define MAX_ARGV 10
int
static int
gen_argv(const char *arg_string, int len, char* argv[])
{
const char *str, *str_end, *arg_string_end = arg_string + len;

View File

@ -10,22 +10,22 @@
* IBM Corporation - initial implementation
*****************************************************************************/
#include <stdint.h>
#include <string.h>
#include <stdlib.h> /* malloc */
#include <of.h>
#include <pci.h>
#include <kernel.h>
#include <stdint.h>
#include <string.h>
#include <cpu.h>
#include <fileio.h>
#include <stdlib.h> /* malloc */
#include <ioctl.h> /* ioctl */
#include "modules.h"
/* Application entry point .*/
extern int _start(unsigned char *arg_string, long len);
extern int main(int, char**);
int _start_kernel(unsigned long p0, unsigned long p1);
void * malloc_aligned(size_t size, int align);
extern snk_module_t *insmod_by_type(int);
extern void rmmod_by_type(int);
unsigned long exception_stack_frame;
@ -33,8 +33,6 @@ snk_fileio_t fd_array[FILEIO_MAX];
extern uint64_t tb_freq;
void modules_init(void);
void modules_term(void);
int glue_init(snk_kernel_t *, unsigned int *, size_t, size_t);
void glue_release(void);
@ -74,7 +72,7 @@ malloc_aligned(size_t size, int align)
}
static void
copy_exception_vectors()
copy_exception_vectors(void)
{
char *dest;
char *src;
@ -92,7 +90,7 @@ copy_exception_vectors()
}
static void
restore_exception_vectors()
restore_exception_vectors(void)
{
char *dest;
char *src;

View File

@ -18,12 +18,9 @@
#include <cpu.h> /* flush_cache */
#include <unistd.h> /* open, close, read, write */
#include <stdio.h>
#include <pci.h>
#include "modules.h"
unsigned int read_io(void *, size_t);
int write_io(void *, unsigned int, size_t);
extern void get_mac(char *mac);
extern snk_module_t of_module;
extern char __client_start[];
@ -146,7 +143,7 @@ modules_init(void)
}
void
modules_term()
modules_term(void)
{
int i;

View File

@ -0,0 +1,17 @@
/******************************************************************************
* Copyright (c) 2011 IBM Corporation
* All rights reserved.
* This program and the accompanying materials
* are made available under the terms of the BSD License
* which accompanies this distribution, and is available at
* http://www.opensource.org/licenses/bsd-license.php
*
* Contributors:
* IBM Corporation - initial implementation
*****************************************************************************/
extern void modules_init(void);
extern void modules_term(void);
extern snk_module_t *insmod_by_type(int);
extern void rmmod_by_type(int);
extern snk_module_t *get_module_by_type(int type);

View File

@ -10,19 +10,21 @@
* IBM Corporation - initial implementation
*****************************************************************************/
#include <stdint.h>
#include <stdarg.h>
#include <string.h>
#include <of.h>
#include <systemcall.h>
#include <stdarg.h>
#include <netdriver_int.h>
#include <string.h>
#include <fileio.h>
#include "modules.h"
//extern ihandle_t fd_array[32];
extern snk_module_t *get_module_by_type(int type);
extern int vsprintf(char *, const char *, va_list);
extern void _exit(int status);
long _system_call(long arg0, long arg1, long arg2, long arg3,
long arg4, long arg5, long arg6, int nr);
void exit(int status);
int printk(const char*, ...);
static int

View File

@ -11,6 +11,7 @@
*****************************************************************************/
#include <stdint.h>
#include "kernel.h"
//*******************************************************************
// variable "tb_freq" contains the frequency in Hz
@ -39,7 +40,7 @@ uint64_t get_time(void)
//-------------------------------------------------------------------
// wait for ticks/scale timebase ticks
void wait_ticks(uint64_t ticks)
static void wait_ticks(uint64_t ticks)
{
uint64_t timeout = get_time() + ticks;
while (get_time() < timeout) {

View File

@ -10,7 +10,7 @@
* IBM Corporation - initial implementation
*****************************************************************************/
#include <ioctl.h>
#include "systemcall.h"

View File

@ -10,6 +10,8 @@
* IBM Corporation - initial implementation
*****************************************************************************/
#include <unistd.h>
#define HEAP_SIZE 0x200000

View File

@ -10,7 +10,7 @@
* IBM Corporation - initial implementation
*****************************************************************************/
#include <kernel.h>
#include "time.h"
int get_msec_ticks()
@ -34,6 +34,3 @@ int get_timer()
asm volatile ("mfdec %0":"=r" (val));
return val;
}

View File

@ -10,13 +10,13 @@
* IBM Corporation - initial implementation
*****************************************************************************/
#include <stdint.h>
#include <of.h>
#include <rtas.h>
#include <string.h>
#include <netdriver_int.h>
#include <fileio.h>
#include <stdint.h>
#include <libbootmsg.h>
extern void call_client_interface(of_arg_t *);
@ -27,6 +27,9 @@ static int ofmod_read(char *buffer, int len);
static int ofmod_write(char *buffer, int len);
static int ofmod_ioctl(int request, void *data);
int glue_init(snk_kernel_t *, unsigned int *, size_t, size_t);
void glue_release(void);
snk_module_t of_module = {
.version = 1,
.type = MOD_TYPE_OTHER,
@ -45,7 +48,7 @@ static int claim_rc = 0;
static void* client_start;
static size_t client_size;
extern inline int
static inline int
of_0_1(const char *serv)
{
of_arg_t arg = {
@ -59,7 +62,7 @@ of_0_1(const char *serv)
return arg.args[0];
}
extern inline void
static inline void
of_1_0(const char *serv, int arg0)
{
of_arg_t arg = {
@ -71,7 +74,7 @@ of_1_0(const char *serv, int arg0)
call_client_interface(&arg);
}
extern inline unsigned int
static inline unsigned int
of_1_1(const char *serv, int arg0)
{
of_arg_t arg = {
@ -84,7 +87,7 @@ of_1_1(const char *serv, int arg0)
return arg.args[1];
}
extern inline unsigned int
static inline unsigned int
of_1_2(const char *serv, int arg0, int *ret0)
{
of_arg_t arg = {
@ -98,7 +101,7 @@ of_1_2(const char *serv, int arg0, int *ret0)
return arg.args[1];
}
extern inline void
static inline void
of_2_0(const char *serv, int arg0, int arg1)
{
of_arg_t arg = {
@ -110,7 +113,7 @@ of_2_0(const char *serv, int arg0, int arg1)
call_client_interface(&arg);
}
extern inline unsigned int
static inline unsigned int
of_2_1(const char *serv, int arg0, int arg1)
{
of_arg_t arg = {
@ -123,7 +126,7 @@ of_2_1(const char *serv, int arg0, int arg1)
return arg.args[2];
}
extern inline unsigned int
static inline unsigned int
of_2_2(const char *serv, int arg0, int arg1, int *ret0)
{
of_arg_t arg = {
@ -137,7 +140,7 @@ of_2_2(const char *serv, int arg0, int arg1, int *ret0)
return arg.args[2];
}
extern inline unsigned int
static inline unsigned int
of_2_3(const char *serv, int arg0, int arg1, int *ret0, int *ret1)
{
of_arg_t arg = {
@ -152,7 +155,7 @@ of_2_3(const char *serv, int arg0, int arg1, int *ret0, int *ret1)
return arg.args[2];
}
extern inline void
static inline void
of_3_0(const char *serv, int arg0, int arg1, int arg2)
{
of_arg_t arg = {
@ -165,7 +168,7 @@ of_3_0(const char *serv, int arg0, int arg1, int arg2)
return;
}
extern inline unsigned int
static inline unsigned int
of_3_1(const char *serv, int arg0, int arg1, int arg2)
{
of_arg_t arg = {
@ -178,7 +181,7 @@ of_3_1(const char *serv, int arg0, int arg1, int arg2)
return arg.args[3];
}
extern inline unsigned int
static inline unsigned int
of_3_2(const char *serv, int arg0, int arg1, int arg2, int *ret0)
{
of_arg_t arg = {
@ -192,7 +195,7 @@ of_3_2(const char *serv, int arg0, int arg1, int arg2, int *ret0)
return arg.args[3];
}
extern inline unsigned int
static inline unsigned int
of_3_3(const char *serv, int arg0, int arg1, int arg2, int *ret0, int *ret1)
{
of_arg_t arg = {
@ -207,7 +210,7 @@ of_3_3(const char *serv, int arg0, int arg1, int arg2, int *ret0, int *ret1)
return arg.args[3];
}
extern inline unsigned int
static inline unsigned int
of_4_1(const char *serv, int arg0, int arg1, int arg2, int arg3)
{
of_arg_t arg = {

View File

@ -10,6 +10,7 @@
* IBM Corporation - initial implementation
*****************************************************************************/
#include <stdint.h>
#include <rtas.h>
#include <of.h>
#include <pci.h>

View File

@ -10,11 +10,11 @@
* IBM Corporation - initial implementation
*****************************************************************************/
#include <stdint.h>
#include <stdarg.h>
#include <stdio.h>
#include <rtas.h>
#include <of.h>
#include <stdint.h>
#include <netdriver_int.h>
#include "kernel.h"

View File

@ -73,21 +73,21 @@
#define EXPAND(x) STRINGIFY(x)
static inline void
set_ci()
set_ci(void)
{
unsigned long tmp;
asm volatile(EXPAND(SETCI(%0)) : "=r"(tmp) :: "memory", "cc");
}
static inline void
clr_ci()
clr_ci(void)
{
unsigned long tmp;
asm volatile(EXPAND(CLRCI(%0)) : "=r"(tmp) :: "memory", "cc");
}
static inline void
eieio()
eieio(void)
{
asm volatile ("eieio":::"memory");
}

View File

@ -45,7 +45,7 @@ static inline void flush_cache(void* r, long n)
}
static inline void
eieio()
eieio(void)
{
asm volatile ("eieio":::"memory");
}

View File

@ -26,6 +26,7 @@ char *strchr(const char *s, int c);
char *strrchr(const char *s, int c);
size_t strlen(const char *s);
char *strstr(const char *hay, const char *needle);
char *strtok(char *src, const char *pattern);
void *memset(void *s, int c, size_t n);
void *memchr(const void *s, int c, size_t n);

View File

@ -13,6 +13,8 @@
#ifndef _UNISTD_H
#define _UNISTD_H
#include <stddef.h>
typedef long ssize_t;
extern int open(const char *name, int flags);

View File

@ -10,6 +10,8 @@
* IBM Corporation - initial implementation
*****************************************************************************/
#include <stdlib.h>
long int strtol(const char *S, char **PTR,int BASE)
{
long rval = 0;

View File

@ -10,6 +10,8 @@
* IBM Corporation - initial implementation
*****************************************************************************/
#include <stdlib.h>
unsigned long int strtoul(const char *S, char **PTR,int BASE)
{
unsigned long rval = 0;

View File

@ -12,6 +12,7 @@
#include <product.h>
#include <stdio.h>
#include "block_lists.h"
unsigned char sig_org[] = FLASHFS_PLATFORM_MAGIC;
@ -25,7 +26,7 @@ void write_flash(unsigned long, unsigned short *);
int progress = 0;
int
print_progress()
print_progress(void)
{
static int i = 3;
switch (i--) {
@ -47,13 +48,13 @@ print_progress()
}
void
print_hash()
print_hash(void)
{
printf("\b# ");
}
void
print_writing()
print_writing(void)
{
int counter = 42;
printf("\nWriting Flash: |");

View File

@ -13,7 +13,7 @@
extern int progress;
extern unsigned char sig_org[];
void print_progress(void);
int print_progress(void);
void print_hash(void);
int get_block_list_version(unsigned char *);
int image_check_crc(unsigned long *, int);

View File

@ -28,6 +28,10 @@ int rtas_callcount[0x40] __attribute__((aligned (16)));
long rtas_config;
/* Prototype */
void rtas_call (rtas_args_t *rtas_args);
/*
Function: rtas_call
Input: