The new build system uses quite a few more -W flags for the compiler by
default than the old one. And that's for the better.
Change-Id: Ia8e3d28fb35c56760c2bd0983046c7067e8c5dd6
Signed-off-by: Patrick Georgi <patrick@georgi-clan.de>
Reviewed-on: http://review.coreboot.org/72
Tested-by: build bot (Jenkins)
Reviewed-by: Uwe Hermann <uwe@hermann-uwe.de>
20 files changed:
+config MEMMAP_RAM_ONLY
+ bool "Only consider RAM entries in memory map for further processing"
+ default n
+
config MULTIBOOT
bool "Multiboot header support"
depends on TARGET_I386
config MULTIBOOT
bool "Multiboot header support"
depends on TARGET_I386
struct cb_memory_range *range =
(struct cb_memory_range *)MEM_RANGE_PTR(mem, i);
struct cb_memory_range *range =
(struct cb_memory_range *)MEM_RANGE_PTR(mem, i);
+#ifdef CONFIG_MEMMAP_RAM_ONLY
if (range->type != CB_MEM_RAM)
continue;
#endif
if (range->type != CB_MEM_RAM)
continue;
#endif
* This is our C entry function - set up the system
* and jump into the payload entry point.
*/
* This is our C entry function - set up the system
* and jump into the payload entry point.
*/
void start_main(void)
{
extern int main(int argc, char **argv);
void start_main(void)
{
extern int main(int argc, char **argv);
while(ptr < (start + table->mmap_length)) {
struct multiboot_mmap *mmap = (struct multiboot_mmap *) ptr;
while(ptr < (start + table->mmap_length)) {
struct multiboot_mmap *mmap = (struct multiboot_mmap *) ptr;
+#ifdef CONFIG_MEMMAP_RAM_ONLY
/* 1 == normal RAM. Ignore everything else for now */
if (mmap->type == 1) {
/* 1 == normal RAM. Ignore everything else for now */
if (mmap->type == 1) {
if (++info->n_memranges == SYSINFO_MAX_MEM_RANGES)
return;
if (++info->n_memranges == SYSINFO_MAX_MEM_RANGES)
return;
+#ifdef CONFIG_MEMMAP_RAM_ONLY
unsigned long virtual_offset = 0;
unsigned long virtual_offset = 0;
struct cb_memory_range *range =
(struct cb_memory_range *)MEM_RANGE_PTR(mem, i);
struct cb_memory_range *range =
(struct cb_memory_range *)MEM_RANGE_PTR(mem, i);
+#ifdef CONFIG_MEMMAP_RAM_ONLY
if (range->type != CB_MEM_RAM)
continue;
#endif
if (range->type != CB_MEM_RAM)
continue;
#endif
* This is our C entry function - set up the system
* and jump into the payload entry point.
*/
* This is our C entry function - set up the system
* and jump into the payload entry point.
*/
void start_main(void)
{
extern int main(int argc, char **argv);
void start_main(void)
{
extern int main(int argc, char **argv);
unsigned long virtual_offset = 0;
unsigned long virtual_offset = 0;
int key;
} escape_codes[] = {
{ "[A", KEY_UP },
int key;
} escape_codes[] = {
{ "[A", KEY_UP },
return 27;
for(i = 0; escape_codes[i].seq != NULL; i++) {
return 27;
for(i = 0; escape_codes[i].seq != NULL; i++) {
- char *p = escape_codes[i].seq;
+ const char *p = escape_codes[i].seq;
for(t = 0; t < len; t++) {
if (!*p || *p != buffer[t])
for(t = 0; t < len; t++) {
if (!*p || *p != buffer[t])
/* ================ Keyboard ================ */
/* ================ Keyboard ================ */
-static int curses_getchar(int delay)
+static int curses_getchar(int _delay)
{
#if defined(CONFIG_USB_HID) || defined(CONFIG_PC_KEYBOARD) || defined(CONFIG_SERIAL_CONSOLE)
unsigned short c;
{
#if defined(CONFIG_USB_HID) || defined(CONFIG_PC_KEYBOARD) || defined(CONFIG_SERIAL_CONSOLE)
unsigned short c;
int wgetch(WINDOW *win)
{
int wgetch(WINDOW *win)
{
- return curses_getchar(delay);
+ return curses_getchar(_delay);
}
int nodelay(WINDOW *win, NCURSES_BOOL flag)
}
int nodelay(WINDOW *win, NCURSES_BOOL flag)
}
// void wsyncdown (WINDOW *) {}
// void wsyncup (WINDOW *) {}
}
// void wsyncdown (WINDOW *) {}
// void wsyncup (WINDOW *) {}
-/* D */ void wtimeout(WINDOW *win, int delay) { win->_delay = delay; }
+/* D */ void wtimeout(WINDOW *win, int _delay) { win->_delay = _delay; }
/* D */ int wtouchln(WINDOW *win, int y, int n, int changed)
{
int i;
/* D */ int wtouchln(WINDOW *win, int y, int n, int changed)
{
int i;
#define I8042_MODE_XLATE 0x40
struct layout_maps {
#define I8042_MODE_XLATE 0x40
struct layout_maps {
- char *country;
- unsigned short map[4][0x57];
+ const char *country;
+ const unsigned short map[4][0x57];
};
static struct layout_maps *map;
};
static struct layout_maps *map;
static int keyboard_wait_read(void)
{
static int keyboard_wait_read(void)
{
- while(timeout-- && !(inb(0x64) & 0x01))
+ while(retries-- && !(inb(0x64) & 0x01))
- return (timeout <= 0) ? -1 : 0;
+ return (retries <= 0) ? -1 : 0;
}
static int keyboard_wait_write(void)
{
}
static int keyboard_wait_write(void)
{
- while(timeout-- && (inb(0x64) & 0x02))
+ while(retries-- && (inb(0x64) & 0x02))
- return (timeout <= 0) ? -1 : 0;
+ return (retries <= 0) ? -1 : 0;
}
static unsigned char keyboard_get_mode(void)
}
static unsigned char keyboard_get_mode(void)
/* A vt100 doesn't do color, setaf/setab below are from xterm-color. */
#define VT100_SET_COLOR "\e[3%d;4%dm"
/* A vt100 doesn't do color, setaf/setab below are from xterm-color. */
#define VT100_SET_COLOR "\e[3%d;4%dm"
-static void serial_putcmd(char *str)
+static void serial_putcmd(const char *str)
{
while(*str)
serial_putchar(*(str++));
{
while(*str)
serial_putchar(*(str++));
td_dump (td_t *td)
{
char td_value[3];
td_dump (td_t *td)
{
char td_value[3];
switch (td->pid) {
case UHCI_SETUP:
td_type="SETUP";
switch (td->pid) {
case UHCI_SETUP:
td_type="SETUP";
#define KEYBOARD_BUFFER_SIZE 16
static short keybuffer[KEYBOARD_BUFFER_SIZE];
#define KEYBOARD_BUFFER_SIZE 16
static short keybuffer[KEYBOARD_BUFFER_SIZE];
-char *countries[36][2] = {
+const char *countries[36][2] = {
{ "not supported", "us" },
{ "Arabic", "ae" },
{ "Belgian", "be" },
{ "not supported", "us" },
{ "Arabic", "ae" },
{ "Belgian", "be" },
- char *country;
- short map[4][0x80];
+ const char *country;
+ const short map[4][0x80];
-static struct layout_maps *map;
+static const struct layout_maps *map;
-static struct layout_maps keyboard_layouts[] = {
+static const struct layout_maps keyboard_layouts[] = {
// #ifdef CONFIG_PC_KEYBOARD_LAYOUT_US
{ .country = "us", .map = {
{ /* No modifier */
// #ifdef CONFIG_PC_KEYBOARD_LAYOUT_US
{ .country = "us", .map = {
{ /* No modifier */
-int usb_hid_set_layout (char *country)
+static int usb_hid_set_layout (const char *country)
{
/* FIXME should be per keyboard */
int i;
{
/* FIXME should be per keyboard */
int i;
void SHA1Init(SHA1_CTX *context);
void SHA1Transform(u32 state[5], const u8 buffer[SHA1_BLOCK_LENGTH]);
void SHA1Update(SHA1_CTX *context, const u8 *data, size_t len);
void SHA1Init(SHA1_CTX *context);
void SHA1Transform(u32 state[5], const u8 buffer[SHA1_BLOCK_LENGTH]);
void SHA1Update(SHA1_CTX *context, const u8 *data, size_t len);
+void SHA1Pad(SHA1_CTX *context);
void SHA1Final(u8 digest[SHA1_DIGEST_LENGTH], SHA1_CTX *context);
u8 *sha1(const u8 *data, size_t len, u8 *buf);
/** @} */
void SHA1Final(u8 digest[SHA1_DIGEST_LENGTH], SHA1_CTX *context);
u8 *sha1(const u8 *data, size_t len, u8 *buf);
/** @} */
#include <libpayload.h>
#include <getopt.h>
#define warnx(x...) printf(x)
#include <libpayload.h>
#include <getopt.h>
#define warnx(x...) printf(x)
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <string.h>
#define REPLACE_GETOPT /* use this getopt as the system getopt(3) */
#ifdef REPLACE_GETOPT
#define REPLACE_GETOPT /* use this getopt as the system getopt(3) */
#ifdef REPLACE_GETOPT
#define BADARG ((*options == ':') ? (int)':' : (int)'?')
#define INORDER (int)1
#define BADARG ((*options == ':') ? (int)':' : (int)'?')
#define INORDER (int)1
static int getopt_internal(int, char * const *, const char *,
const struct option *, int *, int);
static int getopt_internal(int, char * const *, const char *,
const struct option *, int *, int);
size_t count;
if (str == NULL) {
size_t count;
if (str == NULL) {
- char *nullstr = "(NULL)";
+ const char *nullstr = "(NULL)";
return printf_putnchars(nullstr, strlen(nullstr), ps);
}
return printf_putnchars(nullstr, strlen(nullstr), ps);
}
int ffs(int i)
{
int count = 1;
int ffs(int i)
{
int count = 1;
#include <libpayload.h>
#include <sysinfo.h>
#include <libpayload.h>
#include <sysinfo.h>
-extern struct sysinfo_t lib_sysinfo;
-
int sysinfo_have_multiboot(unsigned long *addr)
{
*addr = (unsigned long) lib_sysinfo.mbtable;
int sysinfo_have_multiboot(unsigned long *addr)
{
*addr = (unsigned long) lib_sysinfo.mbtable;
+static char *invalid_pci_device_string = (char *)"invalid pci device string";
+
/* parse domain:bus:dev.func (with all components but "dev" optional)
* into filter.
* Returns NULL on success, a string pointer to the error message otherwise.
/* parse domain:bus:dev.func (with all components but "dev" optional)
* into filter.
* Returns NULL on success, a string pointer to the error message otherwise.
char *funcp = strrchr(id, '.');
if (funcp) {
filter->func = strtoul(funcp+1, &endptr, 0);
char *funcp = strrchr(id, '.');
if (funcp) {
filter->func = strtoul(funcp+1, &endptr, 0);
- if (endptr[0] != '\0') return "invalid pci device string";
+ if (endptr[0] != '\0') return invalid_pci_device_string;
}
char *devp = strrchr(id, ':');
}
char *devp = strrchr(id, ':');
} else {
filter->dev = strtoul(devp+1, &endptr, 0);
}
} else {
filter->dev = strtoul(devp+1, &endptr, 0);
}
- if (endptr != funcp) return "invalid pci device string";
+ if (endptr != funcp) return invalid_pci_device_string;
if (!devp) return NULL;
char *busp = strchr(id, ':');
if (!devp) return NULL;
char *busp = strchr(id, ':');
} else {
filter->bus = strtoul(busp+1, &endptr, 0);
}
} else {
filter->bus = strtoul(busp+1, &endptr, 0);
}
- if (endptr != funcp) return "invalid pci device string";
+ if (endptr != funcp) return invalid_pci_device_string;
if (busp == devp) return NULL;
filter->domain = strtoul(id, &endptr, 0);
if (busp == devp) return NULL;
filter->domain = strtoul(id, &endptr, 0);
- if (endptr != busp) return "invalid pci device string";
+ if (endptr != busp) return invalid_pci_device_string;