From fad8c2bd7ca3605fdae3548b8a932aa309871931 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Fri, 11 Apr 2008 18:01:50 +0000 Subject: Various small consistency fixes (trivial): - Use _FOO_H include guard format everywhere. - Add missing speaker.c prototypes to libpayload.h. - Consistently use short form u8/u16/u32 instead of uint8_t et. al. - kcofig: Use 'depends on' instead of 'depends', which seems deprecated. Signed-off-by: Uwe Hermann Acked-by: Uwe Hermann git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3234 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- payloads/libpayload/Config.in | 6 +-- payloads/libpayload/curses/local.h | 6 +-- payloads/libpayload/drivers/video/font8x16.h | 4 +- payloads/libpayload/i386/coreboot.c | 4 +- payloads/libpayload/include/arch/io.h | 4 +- payloads/libpayload/include/arch/msr.h | 4 +- payloads/libpayload/include/arch/rdtsc.h | 4 +- payloads/libpayload/include/arch/types.h | 4 +- payloads/libpayload/include/coreboot_tables.h | 68 +++++++++++++-------------- payloads/libpayload/include/curses.h | 6 +-- payloads/libpayload/include/curses.priv.h | 4 +- payloads/libpayload/include/libpayload.h | 9 +++- payloads/libpayload/include/pci.h | 4 +- payloads/libpayload/include/sysinfo.h | 4 +- payloads/libpayload/include/video_console.h | 4 +- 15 files changed, 70 insertions(+), 65 deletions(-) (limited to 'payloads/libpayload') diff --git a/payloads/libpayload/Config.in b/payloads/libpayload/Config.in index 43f7b5e34f..ea869a5bdc 100644 --- a/payloads/libpayload/Config.in +++ b/payloads/libpayload/Config.in @@ -46,17 +46,17 @@ config SERIAL_CONSOLE config SERIAL_IOBASE hex "I/O base for the serial port (default 0x3f8)" - depends SERIAL_CONSOLE + depends on SERIAL_CONSOLE default 0x3f8 config SERIAL_SET_SPEED bool "Override the serial console baud rate" default n - depends SERIAL_CONSOLE + depends on SERIAL_CONSOLE config SERIAL_BAUD_RATE int "Serial console baud rate (default 115200)" - depends SERIAL_SET_SPEED + depends on SERIAL_SET_SPEED default 115200 config VIDEO_CONSOLE diff --git a/payloads/libpayload/curses/local.h b/payloads/libpayload/curses/local.h index 7e1fb64b93..0a861ceed8 100644 --- a/payloads/libpayload/curses/local.h +++ b/payloads/libpayload/curses/local.h @@ -27,8 +27,8 @@ * SUCH DAMAGE. */ -#ifndef TINYCURSES_H -#define TINYCURSES_H +#ifndef _CURSES_LOCAL_H +#define _CURSES_LOCAL_H /* For curses.priv.h: */ #define USE_RCS_IDS 0 @@ -91,4 +91,4 @@ void speaker_enable(u16 freq); void speaker_disable(void); void speaker_tone(u16 freq, unsigned int duration); -#endif /* TINYCURSES_H */ +#endif diff --git a/payloads/libpayload/drivers/video/font8x16.h b/payloads/libpayload/drivers/video/font8x16.h index 02f40de537..33b0319642 100644 --- a/payloads/libpayload/drivers/video/font8x16.h +++ b/payloads/libpayload/drivers/video/font8x16.h @@ -27,8 +27,8 @@ * SUCH DAMAGE. */ -#ifndef FONT_8X16_H_ -#define FONT_8X16_H_ +#ifndef _DRIVERS_VIDEO_FONT8X16_H +#define _DRIVERS_VIDEO_FONT8X16_H #ifdef HAVE_CONSOLE_FONT #error "You have already defined a console font!" diff --git a/payloads/libpayload/i386/coreboot.c b/payloads/libpayload/i386/coreboot.c index 8e4a19a5ee..e9bc40fc41 100644 --- a/payloads/libpayload/i386/coreboot.c +++ b/payloads/libpayload/i386/coreboot.c @@ -95,10 +95,10 @@ static int cb_parse_header(void *addr, int len, struct sysinfo_t *info) return 0; /* Make sure the checksums match. */ - if (ipchksum((uint16_t *) header, sizeof(*header)) != 0) + if (ipchksum((u16 *) header, sizeof(*header)) != 0) return -1; - if (ipchksum((uint16_t *) (ptr + sizeof(*header)), + if (ipchksum((u16 *) (ptr + sizeof(*header)), header->table_bytes) != header->table_checksum) return -1; diff --git a/payloads/libpayload/include/arch/io.h b/payloads/libpayload/include/arch/io.h index dcf5bd97ea..538b296a11 100644 --- a/payloads/libpayload/include/arch/io.h +++ b/payloads/libpayload/include/arch/io.h @@ -27,8 +27,8 @@ * SUCH DAMAGE. */ -#ifndef _X86_ARCH_IO_H_ -#define _X86_ARCH_IO_H_ +#ifndef _ARCH_IO_H +#define _ARCH_IO_H #define readb(_a) (*(volatile unsigned char *) (_a)) #define readw(_a) (*(volatile unsigned short *) (_a)) diff --git a/payloads/libpayload/include/arch/msr.h b/payloads/libpayload/include/arch/msr.h index 5985ab81d8..c28b56cde1 100644 --- a/payloads/libpayload/include/arch/msr.h +++ b/payloads/libpayload/include/arch/msr.h @@ -27,8 +27,8 @@ * SUCH DAMAGE. */ -#ifndef _ARCH_MSR_H_ -#define _ARCH_MSR_H_ +#ifndef _ARCH_MSR_H +#define _ARCH_MSR_H static inline unsigned long long _rdmsr(unsigned int msr) { diff --git a/payloads/libpayload/include/arch/rdtsc.h b/payloads/libpayload/include/arch/rdtsc.h index 1addedafc8..da7949d808 100644 --- a/payloads/libpayload/include/arch/rdtsc.h +++ b/payloads/libpayload/include/arch/rdtsc.h @@ -27,8 +27,8 @@ * SUCH DAMAGE. */ -#ifndef _RDTSC_H_ -#define _RDTSC_H_ +#ifndef _ARCH_RDTSC_H +#define _ARCH_RDTSC_H static inline unsigned long long rdtsc(void) { diff --git a/payloads/libpayload/include/arch/types.h b/payloads/libpayload/include/arch/types.h index d1f3acda5b..641fb0aef8 100644 --- a/payloads/libpayload/include/arch/types.h +++ b/payloads/libpayload/include/arch/types.h @@ -27,8 +27,8 @@ * SUCH DAMAGE. */ -#ifndef _ARCH_X86_TYPES_H -#define _ARCH_X86_TYPES_H +#ifndef _ARCH_TYPES_H +#define _ARCH_TYPES_H typedef unsigned char uint8_t; typedef unsigned char u8; diff --git a/payloads/libpayload/include/coreboot_tables.h b/payloads/libpayload/include/coreboot_tables.h index f156383862..88dc251cd8 100644 --- a/payloads/libpayload/include/coreboot_tables.h +++ b/payloads/libpayload/include/coreboot_tables.h @@ -27,28 +27,28 @@ * SUCH DAMAGE. */ -#ifndef _COREBOOT_TABLES_H_ -#define _COREBOOT_TABLES_H_ +#ifndef _COREBOOT_TABLES_H +#define _COREBOOT_TABLES_H #include struct cbuint64 { - uint32_t lo; - uint32_t hi; + u32 lo; + u32 hi; }; struct cb_header { - uint8_t signature[4]; - uint32_t header_bytes; - uint32_t header_checksum; - uint32_t table_bytes; - uint32_t table_checksum; - uint32_t table_entries; + u8 signature[4]; + u32 header_bytes; + u32 header_checksum; + u32 table_bytes; + u32 table_checksum; + u32 table_entries; }; struct cb_record { - uint32_t tag; - uint32_t size; + u32 tag; + u32 size; }; #define CB_TAG_UNUSED 0x0000 @@ -57,7 +57,7 @@ struct cb_record { struct cb_memory_range { struct cbuint64 start; struct cbuint64 size; - uint32_t type; + u32 type; }; #define CB_MEM_RAM 1 @@ -65,27 +65,27 @@ struct cb_memory_range { #define CB_MEM_TABLE 16 struct cb_memory { - uint32_t tag; - uint32_t size; + u32 tag; + u32 size; struct cb_memory_range map[0]; }; #define CB_TAG_HWRPB 0x0002 struct cb_hwrpb { - uint32_t tag; - uint32_t size; - uint64_t hwrpb; + u32 tag; + u32 size; + u64 hwrpb; }; #define CB_TAG_MAINBOARD 0x0003 struct cb_mainboard { - uint32_t tag; - uint32_t size; - uint8_t vendor_idx; - uint8_t part_number_idx; - uint8_t strings[0]; + u32 tag; + u32 size; + u8 vendor_idx; + u8 part_number_idx; + u8 strings[0]; }; #define CB_TAG_VERSION 0x0004 @@ -100,25 +100,25 @@ struct cb_mainboard { #define CB_TAG_ASSEMBLER 0x000d struct cb_string { - uint32_t tag; - uint32_t size; - uint8_t string[0]; + u32 tag; + u32 size; + u8 string[0]; }; #define CB_TAG_SERIAL 0x000f struct cb_serial { - uint32_t tag; - uint32_t size; - uint16_t ioport; + u32 tag; + u32 size; + u16 ioport; }; #define CB_TAG_CONSOLE 0x00010 struct cb_console { - uint32_t tag; - uint32_t size; - uint16_t type; + u32 tag; + u32 size; + u16 type; }; #define CB_TAG_CONSOLE_SERIAL8250 0 @@ -136,7 +136,7 @@ struct cb_console { (((_rec)->size - sizeof(*(_rec))) / sizeof((_rec)->map[0])) #define MEM_RANGE_PTR(_rec, _idx) \ - (((uint8_t *) (_rec)) + sizeof(*(_rec)) \ + (((u8 *) (_rec)) + sizeof(*(_rec)) \ + (sizeof((_rec)->map[0]) * (_idx))) #define MB_VENDOR_STRING(_mb) \ @@ -146,6 +146,6 @@ struct cb_console { (((unsigned char *) ((_mb)->strings)) + (_mb)->part_number_idx) #define UNPACK_CB64(_in) \ - ( (((uint64_t) _in.hi) << 32) | _in.lo ) + ( (((u64) _in.hi) << 32) | _in.lo ) #endif diff --git a/payloads/libpayload/include/curses.h b/payloads/libpayload/include/curses.h index dc64ad36af..993bb3c962 100644 --- a/payloads/libpayload/include/curses.h +++ b/payloads/libpayload/include/curses.h @@ -34,8 +34,8 @@ /* $Id: curses.h.in,v 1.167 2006/11/26 01:14:54 tom Exp $ */ -#ifndef __NCURSES_H -#define __NCURSES_H +#ifndef _CURSES_H +#define _CURSES_H #define CURSES 1 #define CURSES_H 1 @@ -1673,4 +1673,4 @@ extern NCURSES_EXPORT(const char *) _nc_visbuf (const char *); void curses_enable_vga(int); void curses_enable_serial(int); -#endif /* __NCURSES_H */ +#endif /* _CURSES_H */ diff --git a/payloads/libpayload/include/curses.priv.h b/payloads/libpayload/include/curses.priv.h index 72d9e82db1..720e678922 100644 --- a/payloads/libpayload/include/curses.priv.h +++ b/payloads/libpayload/include/curses.priv.h @@ -43,8 +43,8 @@ * */ -#ifndef CURSES_PRIV_H -#define CURSES_PRIV_H 1 +#ifndef _CURSES_PRIV_H +#define _CURSES_PRIV_H 1 //// XXX extern void *memset(void *s, int c, size_t len); diff --git a/payloads/libpayload/include/libpayload.h b/payloads/libpayload/include/libpayload.h index 32deabf2b3..e197e430fd 100644 --- a/payloads/libpayload/include/libpayload.h +++ b/payloads/libpayload/include/libpayload.h @@ -27,8 +27,8 @@ * SUCH DAMAGE. */ -#ifndef LIBPAYLOAD_H -#define LIBPAYLOAD_H +#ifndef _LIBPAYLOAD_H +#define _LIBPAYLOAD_H #include #include @@ -78,6 +78,11 @@ void serial_putchar(unsigned char c); int serial_havechar(void); int serial_getchar(void); +/* drivers/speaker.c */ +void speaker_enable(u16 freq); +void speaker_disable(void); +void speaker_tone(u16 freq, unsigned int duration); + /* video/video.c */ int video_console_init(void); void video_console_putchar(unsigned int ch); diff --git a/payloads/libpayload/include/pci.h b/payloads/libpayload/include/pci.h index 32ad3fb96d..df88e098ab 100644 --- a/payloads/libpayload/include/pci.h +++ b/payloads/libpayload/include/pci.h @@ -27,8 +27,8 @@ * SUCH DAMAGE. */ -#ifndef _PCI_H_ -#define _PCI_H_ +#ifndef _PCI_H +#define _PCI_H typedef unsigned short pcidev_t; diff --git a/payloads/libpayload/include/sysinfo.h b/payloads/libpayload/include/sysinfo.h index 50d331a043..aebbff6481 100644 --- a/payloads/libpayload/include/sysinfo.h +++ b/payloads/libpayload/include/sysinfo.h @@ -27,8 +27,8 @@ * SUCH DAMAGE. */ -#ifndef SYSINFO_H -#define SYSINFO_H +#ifndef _SYSINFO_H +#define _SYSINFO_H /* Allow a maximum of 16 memory range definitions. */ #define SYSINFO_MAX_MEM_RANGES 16 diff --git a/payloads/libpayload/include/video_console.h b/payloads/libpayload/include/video_console.h index 55deedf65f..1646ec6056 100644 --- a/payloads/libpayload/include/video_console.h +++ b/payloads/libpayload/include/video_console.h @@ -27,8 +27,8 @@ * SUCH DAMAGE. */ -#ifndef VIDEO_CONSOLE_H_ -#define VIDEO_CONSOLE_H_ +#ifndef _VIDEO_CONSOLE_H +#define _VIDEO_CONSOLE_H #define VIDEO_ROWS 25 #define VIDEO_COLS 80 -- cgit v1.2.3