[coreboot-gerrit] New patch to review for coreboot: src/lib: Fix errors detected by checkpatch
Lee Leahy (leroy.p.leahy@intel.com)
gerrit at coreboot.org
Sun Mar 5 04:00:38 CET 2017
Lee Leahy (leroy.p.leahy at intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18572
-gerrit
commit c8c044ed6014487c453c92a241d98f214af35534
Author: Lee Leahy <leroy.p.leahy at intel.com>
Date: Sat Mar 4 15:34:03 2017 -0800
src/lib: Fix errors detected by checkpatch
Fix most of the errors detected by checkpatch. The errors and warnings
that remain are:
ERROR: open brace '{' following function declarations go on the next line
+const struct cbfs_locator __attribute__((weak)) cbfs_master_header_locator = {
ERROR: Macros with multiple statements should be enclosed in a do - while loop
#27: FILE: src/lib/gcc.c:27:
+#define WRAP_LIBGCC_CALL(type, name) \
+ asmlinkage type __real_##name(type a, type b); \
+ type __wrap_##name(type a, type b); \
+ type __wrap_##name(type a, type b) { return __real_##name(a, b); }
ERROR: Macros with complex values should be enclosed in parentheses
#273: FILE: src/lib/gcov-io.h:273:
+#define ATTRIBUTE_HIDDEN __attribute__ ((__visibility__("hidden")))
ERROR: "foo_16 bar" should be "foo _16 bar"
#101: FILE: src/lib/jpeg.c:101:
+static void col221111_16 __P((int *, unsigned char *, int));
ERROR: "foo_32 bar" should be "foo _32 bar"
#102: FILE: src/lib/jpeg.c:102:
+static void col221111_32 __P((int *, unsigned char *, int));
WARNING: break quoted strings at a space character
+static const char cd64[] = "|$$$}rstuvwxyz{$$$$$$$>?@ABCDEFGHIJKLMN"
+ "OPQRSTUVW$$$$$$XYZ[\\]^_`abcdefghijklmnopq";
WARNING: line over 80 characters
#375: FILE: src/lib/edid.c:375:
+ c->warning_excessive_dotclock_correction = 1;
WARNING: storage class should be at the beginning of the declaration
#225: FILE: src/lib/gcov-io.h:225:
+#define GCOV_LINKAGE static
WARNING: storage class should be at the beginning of the declaration
#285: FILE: src/lib/gcov-io.h:285:
+#define GCOV_LINKAGE extern
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
#248: FILE: src/lib/gcov-io.c:248:
+gcov_write_unsigned(gcov_unsigned_t value)
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
#358: FILE: src/lib/gcov-io.c:358:
+ gcov_write_unsigned(summary->checksum);
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
#360: FILE: src/lib/gcov-io.c:360:
+ gcov_write_unsigned(csum->num);
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
#361: FILE: src/lib/gcov-io.c:361:
+ gcov_write_unsigned(csum->runs);
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
#421: FILE: src/lib/gcov-io.c:421:
+gcov_read_unsigned(void)
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
#460: FILE: src/lib/gcov-io.c:460:
+ unsigned int length = gcov_read_unsigned();
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
#475: FILE: src/lib/gcov-io.c:475:
+ summary->checksum = gcov_read_unsigned();
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
#477: FILE: src/lib/gcov-io.c:477:
+ csum->num = gcov_read_unsigned();
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
#478: FILE: src/lib/gcov-io.c:478:
+ csum->runs = gcov_read_unsigned();
WARNING: Too many leading tabs - consider code refactoring
#463: FILE: src/lib/jpeg.c:463:
+ if (m == 0)
WARNING: Too many leading tabs - consider code refactoring
#623: FILE: src/lib/jpeg.c:623:
+ if (v && x < (1 << (v - 1)))
TEST=Run checkpatch, build and run on Galileo Gen2
Change-Id: Ieff824a3777d63c0a740799a5ca3e2934defb863
Signed-off-by: Lee Leahy <leroy.p.leahy at intel.com>
---
src/include/delay.h | 6 +-
src/lib/b64_decode.c | 4 +-
src/lib/bootblock.c | 2 +-
src/lib/cbfs.c | 2 +-
src/lib/cbmem_common.c | 6 +-
src/lib/compute_ip_checksum.c | 15 +-
src/lib/coreboot_table.c | 31 ++-
src/lib/debug.c | 6 +-
src/lib/delay.c | 10 +-
src/lib/edid.c | 635 ++++++++++++++++++++++++++----------------
src/lib/gcc.c | 2 +-
src/lib/gcov-glue.c | 19 +-
src/lib/gcov-io.c | 570 ++++++++++++++++++-------------------
src/lib/gcov-io.h | 300 ++++++++++----------
src/lib/generic_dump_spd.c | 17 +-
src/lib/generic_sdram.c | 9 +-
src/lib/gpio.c | 3 +-
src/lib/halt.c | 6 +-
src/lib/hardwaremain.c | 14 +-
src/lib/imd.c | 8 +-
src/lib/imd_cbmem.c | 14 +-
src/lib/jpeg.c | 333 +++++++++++-----------
src/lib/jpeg.h | 3 +-
23 files changed, 1097 insertions(+), 918 deletions(-)
diff --git a/src/include/delay.h b/src/include/delay.h
index b3d8ed9..8f894d2 100644
--- a/src/include/delay.h
+++ b/src/include/delay.h
@@ -3,7 +3,7 @@
void init_timer(void);
-void udelay(unsigned usecs);
-void mdelay(unsigned msecs);
-void delay(unsigned secs);
+void udelay(unsigned int usecs);
+void mdelay(unsigned int msecs);
+void delay(unsigned int secs);
#endif /* DELAY_H */
diff --git a/src/lib/b64_decode.c b/src/lib/b64_decode.c
index 85f43c0..696652c 100644
--- a/src/lib/b64_decode.c
+++ b/src/lib/b64_decode.c
@@ -84,10 +84,10 @@ size_t b64_decode(const uint8_t *input_data,
uint8_t *output_data)
{
struct buffer_descriptor bd;
- unsigned interim = 0;
+ unsigned int interim = 0;
size_t output_size = 0;
/* count of processed input bits, modulo log2(64) */
- unsigned bit_count = 0;
+ unsigned int bit_count = 0;
/*
* Keep the context on the stack to make things easier if this needs
diff --git a/src/lib/bootblock.c b/src/lib/bootblock.c
index a560152..b859e1e 100644
--- a/src/lib/bootblock.c
+++ b/src/lib/bootblock.c
@@ -30,7 +30,7 @@ __attribute__((weak)) void bootblock_soc_early_init(void) { /* do nothing */ }
__attribute__((weak)) void bootblock_soc_init(void) { /* do nothing */ }
__attribute__((weak)) void bootblock_mainboard_init(void) { /* do nothing */ }
-void asmlinkage bootblock_main_with_timestamp(uint64_t base_timestamp)
+asmlinkage void bootblock_main_with_timestamp(uint64_t base_timestamp)
{
/* Initialize timestamps if we have TIMESTAMP region in memlayout.ld. */
if (IS_ENABLED(CONFIG_COLLECT_TIMESTAMPS) && _timestamp_size > 0)
diff --git a/src/lib/cbfs.c b/src/lib/cbfs.c
index ff166d8..11bce2c 100644
--- a/src/lib/cbfs.c
+++ b/src/lib/cbfs.c
@@ -146,7 +146,7 @@ static inline int tohex4(unsigned int c)
return (c <= 9) ? (c + '0') : (c - 10 + 'a');
}
-static void tohex16(unsigned int val, char* dest)
+static void tohex16(unsigned int val, char *dest)
{
dest[0] = tohex4(val>>12);
dest[1] = tohex4((val>>8) & 0xf);
diff --git a/src/lib/cbmem_common.c b/src/lib/cbmem_common.c
index 2a057d6..63ade3a 100644
--- a/src/lib/cbmem_common.c
+++ b/src/lib/cbmem_common.c
@@ -23,8 +23,10 @@
void cbmem_run_init_hooks(int is_recovery)
{
- cbmem_init_hook_t *init_hook_ptr = (cbmem_init_hook_t*) &_cbmem_init_hooks;
- cbmem_init_hook_t *einit_hook_ptr = (cbmem_init_hook_t*) &_ecbmem_init_hooks;
+ cbmem_init_hook_t *init_hook_ptr = (cbmem_init_hook_t *)
+ &_cbmem_init_hooks;
+ cbmem_init_hook_t *einit_hook_ptr = (cbmem_init_hook_t *)
+ &_ecbmem_init_hooks;
if (_cbmem_init_hooks_size == 0)
return;
diff --git a/src/lib/compute_ip_checksum.c b/src/lib/compute_ip_checksum.c
index 347b83f..93518a3 100644
--- a/src/lib/compute_ip_checksum.c
+++ b/src/lib/compute_ip_checksum.c
@@ -15,25 +15,25 @@ unsigned long compute_ip_checksum(const void *addr, unsigned long length)
*/
sum = 0;
ptr = addr;
- for(i = 0; i < length; i++) {
+ for (i = 0; i < length; i++) {
unsigned long v;
v = ptr[i];
- if (i & 1) {
+ if (i & 1)
v <<= 8;
- }
+
/* Add the new value */
sum += v;
/* Wrap around the carry */
- if (sum > 0xFFFF) {
+ if (sum > 0xFFFF)
sum = (sum + (sum >> 16)) & 0xFFFF;
- }
}
value.byte[0] = sum & 0xff;
value.byte[1] = (sum >> 8) & 0xff;
return (~value.word) & 0xFFFF;
}
-unsigned long add_ip_checksums(unsigned long offset, unsigned long sum, unsigned long new)
+unsigned long add_ip_checksums(unsigned long offset, unsigned long sum,
+ unsigned long new)
{
unsigned long checksum;
sum = ~sum & 0xFFFF;
@@ -46,8 +46,7 @@ unsigned long add_ip_checksums(unsigned long offset, unsigned long sum, unsigned
new = ((new >> 8) & 0xff) | ((new << 8) & 0xff00);
}
checksum = sum + new;
- if (checksum > 0xFFFF) {
+ if (checksum > 0xFFFF)
checksum -= 0xFFFF;
- }
return (~checksum) & 0xFFFF;
}
diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c
index 332d1d5..ecefba5 100644
--- a/src/lib/coreboot_table.c
+++ b/src/lib/coreboot_table.c
@@ -79,7 +79,8 @@ static struct lb_record *lb_first_record(struct lb_header *header)
static struct lb_record *lb_last_record(struct lb_header *header)
{
struct lb_record *rec;
- rec = (void *)(((char *)header) + sizeof(*header) + header->table_bytes);
+ rec = (void *)(((char *)header) + sizeof(*header)
+ + header->table_bytes);
return rec;
}
@@ -87,9 +88,8 @@ struct lb_record *lb_new_record(struct lb_header *header)
{
struct lb_record *rec;
rec = lb_last_record(header);
- if (header->table_entries) {
+ if (header->table_entries)
header->table_bytes += rec->size;
- }
rec = lb_last_record(header);
header->table_entries++;
rec->tag = LB_TAG_UNUSED;
@@ -286,9 +286,8 @@ static void lb_boot_media_params(struct lb_header *header)
bmp->boot_media_size = region_device_sz(boot_dev);
bmp->fmap_offset = ~(uint64_t)0;
- if (find_fmap_directory(&fmrd) == 0) {
+ if (find_fmap_directory(&fmrd) == 0)
bmp->fmap_offset = region_device_offset(&fmrd);
- }
}
static void lb_ram_code(struct lb_header *header)
@@ -376,7 +375,7 @@ static struct cmos_checksum *lb_cmos_checksum(struct lb_header *header)
cmos_checksum->size = (sizeof(*cmos_checksum));
cmos_checksum->range_start = LB_CKS_RANGE_START * 8;
- cmos_checksum->range_end = ( LB_CKS_RANGE_END * 8 ) + 7;
+ cmos_checksum->range_end = (LB_CKS_RANGE_END * 8) + 7;
cmos_checksum->location = LB_CKS_LOC * 8;
cmos_checksum->type = CHECKSUM_PCBIOS;
@@ -396,7 +395,7 @@ static void lb_strings(struct lb_header *header)
{ LB_TAG_COMPILE_TIME, coreboot_compile_time, },
};
unsigned int i;
- for(i = 0; i < ARRAY_SIZE(strings); i++) {
+ for (i = 0; i < ARRAY_SIZE(strings); i++) {
struct lb_string *rec;
size_t len;
rec = (struct lb_string *)lb_new_record(header);
@@ -427,7 +426,8 @@ void __attribute__((weak)) lb_board(struct lb_header *header) { /* NOOP */ }
*/
void __attribute__((weak)) lb_spi_flash(struct lb_header *header) { /* NOOP */ }
-static struct lb_forward *lb_forward(struct lb_header *header, struct lb_header *next_header)
+static struct lb_forward *lb_forward(struct lb_header *header,
+ struct lb_header *next_header)
{
struct lb_record *rec;
struct lb_forward *forward;
@@ -443,12 +443,12 @@ static unsigned long lb_table_fini(struct lb_header *head)
{
struct lb_record *rec, *first_rec;
rec = lb_last_record(head);
- if (head->table_entries) {
+ if (head->table_entries)
head->table_bytes += rec->size;
- }
first_rec = lb_first_record(head);
- head->table_checksum = compute_ip_checksum(first_rec, head->table_bytes);
+ head->table_checksum = compute_ip_checksum(first_rec,
+ head->table_bytes);
head->header_checksum = 0;
head->header_checksum = compute_ip_checksum(head, sizeof(*head));
printk(BIOS_DEBUG,
@@ -465,7 +465,7 @@ size_t write_coreboot_forwarding_table(uintptr_t entry, uintptr_t target)
(void *)entry);
head = lb_table_init(entry);
- lb_forward(head, (struct lb_header*)target);
+ lb_forward(head, (struct lb_header *)target);
return (uintptr_t)lb_table_fini(head) - entry;
}
@@ -486,12 +486,15 @@ static uintptr_t write_coreboot_table(uintptr_t rom_table_end)
CBFS_COMPONENT_CMOS_LAYOUT, NULL);
if (option_table) {
struct lb_record *rec_dest = lb_new_record(head);
- /* Copy the option config table, it's already a lb_record... */
+ /* Copy the option config table, it's already a
+ * lb_record...
+ */
memcpy(rec_dest, option_table, option_table->size);
/* Create cmos checksum entry in coreboot table */
lb_cmos_checksum(head);
} else {
- printk(BIOS_ERR, "cmos_layout.bin could not be found!\n");
+ printk(BIOS_ERR,
+ "cmos_layout.bin could not be found!\n");
}
}
#endif
diff --git a/src/lib/debug.c b/src/lib/debug.c
index aa94bb0..6ae5985 100644
--- a/src/lib/debug.c
+++ b/src/lib/debug.c
@@ -14,7 +14,7 @@
* GNU General Public License for more details.
*/
-static void print_debug_pci_dev(unsigned dev)
+static void print_debug_pci_dev(unsigned int dev)
{
printk(BIOS_DEBUG, "PCI: %02x:%02x.%x",
(dev >> 16) & 0xff, (dev >> 11) & 0x1f, (dev >> 8) & 7);
@@ -37,7 +37,7 @@ static inline void print_pci_devices(void)
}
}
-static void dump_pci_device(unsigned dev)
+static void dump_pci_device(unsigned int dev)
{
int i;
print_debug_pci_dev(dev);
@@ -71,7 +71,7 @@ static inline void dump_pci_devices(void)
}
-static inline void dump_io_resources(unsigned port)
+static inline void dump_io_resources(unsigned int port)
{
int i;
printk(BIOS_DEBUG, "%04x:\n", port);
diff --git a/src/lib/delay.c b/src/lib/delay.c
index 207c629..1255cad 100644
--- a/src/lib/delay.c
+++ b/src/lib/delay.c
@@ -1,15 +1,13 @@
#include <delay.h>
-void mdelay(unsigned msecs)
+void mdelay(unsigned int msecs)
{
unsigned i;
- for(i = 0; i < msecs; i++) {
+ for (i = 0; i < msecs; i++)
udelay(1000);
- }
}
-void delay(unsigned secs)
+void delay(unsigned int secs)
{
unsigned i;
- for(i = 0; i < secs; i++) {
+ for (i = 0; i < secs; i++)
mdelay(1000);
- }
}
diff --git a/src/lib/edid.c b/src/lib/edid.c
index d1b9c9f..0b8ca0f 100644
--- a/src/lib/edid.c
+++ b/src/lib/edid.c
@@ -100,7 +100,8 @@ static struct lb_framebuffer edid_fb;
static char *manufacturer_name(unsigned char *x)
{
extra_info.manuf_name[0] = ((x[0] & 0x7C) >> 2) + '@';
- extra_info.manuf_name[1] = ((x[0] & 0x03) << 3) + ((x[1] & 0xE0) >> 5) + '@';
+ extra_info.manuf_name[1] = ((x[0] & 0x03) << 3) + ((x[1] & 0xE0) >> 5)
+ + '@';
extra_info.manuf_name[2] = (x[1] & 0x1F) + '@';
extra_info.manuf_name[3] = 0;
@@ -116,7 +117,7 @@ static int
detailed_cvt_descriptor(unsigned char *x, int first)
{
const unsigned char empty[3] = { 0, 0, 0 };
- const char *names[] = { "50", "60", "75", "85" };
+ static const char *const names[] = { "50", "60", "75", "85" };
int width = 0, height = 0;
int valid = 1;
int fifty = 0, sixty = 0, seventyfive = 0, eightyfive = 0, reduced = 0;
@@ -156,7 +157,8 @@ detailed_cvt_descriptor(unsigned char *x, int first)
if (!valid) {
printk(BIOS_SPEW, " (broken)\n");
} else {
- printk(BIOS_SPEW, " %dx%d @ ( %s%s%s%s%s) Hz (%s%s preferred)\n",
+ printk(BIOS_SPEW,
+ " %dx%d @ ( %s%s%s%s%s) Hz (%s%s preferred)\n",
width, height,
fifty ? "50 " : "",
sixty ? "60 " : "",
@@ -233,11 +235,13 @@ detailed_block(struct edid *result_edid, unsigned char *x, int in_extension,
c->seen_non_detailed_descriptor = 1;
if (x[3] <= 0xF) {
/*
- * in principle we can decode these, if we know what they are.
+ * in principle we can decode these, if we know what
+ * they are.
* 0x0f seems to be common in laptop panels.
* 0x0e is used by EPI: http://www.epi-standard.org/
*/
- printk(BIOS_SPEW, "Manufacturer-specified data, tag %d\n", x[3]);
+ printk(BIOS_SPEW,
+ "Manufacturer-specified data, tag %d\n", x[3]);
return 1;
}
switch (x[3]) {
@@ -260,7 +264,8 @@ detailed_block(struct edid *result_edid, unsigned char *x, int in_extension,
return 0;
}
for (i = 0; i < 4; i++)
- valid_cvt &= detailed_cvt_descriptor(x + 6 + (i * 3), (i == 0));
+ valid_cvt &= detailed_cvt_descriptor(x + 6
+ + (i * 3), (i == 0));
c->has_valid_cvt &= valid_cvt;
return 1;
}
@@ -291,20 +296,19 @@ detailed_block(struct edid *result_edid, unsigned char *x, int in_extension,
extra_info.range_class = "";
/*
* XXX todo: implement feature flags, vtd blocks
- * XXX check: ranges are well-formed; block termination if no vtd
+ * XXX check: ranges are well-formed; block termination
+ * if no vtd
*/
if (c->claims_one_point_four) {
if (x[4] & 0x02) {
v_max_offset = 255;
- if (x[4] & 0x01) {
+ if (x[4] & 0x01)
v_min_offset = 255;
- }
}
if (x[4] & 0x04) {
h_max_offset = 255;
- if (x[4] & 0x03) {
+ if (x[4] & 0x03)
h_min_offset = 255;
- }
}
} else if (x[4]) {
c->has_valid_range_descriptor = 0;
@@ -341,12 +345,14 @@ detailed_block(struct edid *result_edid, unsigned char *x, int in_extension,
c->has_valid_range_descriptor = 0;
if (x[7] + h_min_offset > x[8] + h_max_offset)
c->has_valid_range_descriptor = 0;
- printk(BIOS_SPEW, "Monitor ranges (%s): %d-%dHz V, %d-%dkHz H",
+ printk(BIOS_SPEW,
+ "Monitor ranges (%s): %d-%dHz V, %d-%dkHz H",
extra_info.range_class,
x[5] + v_min_offset, x[6] + v_max_offset,
x[7] + h_min_offset, x[8] + h_max_offset);
if (x[9])
- printk(BIOS_SPEW, ", max dotclock %dMHz\n", x[9] * 10);
+ printk(BIOS_SPEW, ", max dotclock %dMHz\n",
+ x[9] * 10);
else {
if (c->claims_one_point_four)
c->has_valid_max_dotclock = 0;
@@ -356,12 +362,15 @@ detailed_block(struct edid *result_edid, unsigned char *x, int in_extension,
if (is_cvt) {
int max_h_pixels = 0;
- printk(BIOS_SPEW, "CVT version %d.%d\n", x[11] & 0xf0 >> 4, x[11] & 0x0f);
+ printk(BIOS_SPEW, "CVT version %d.%d\n", x[11]
+ & 0xf0 >> 4, x[11] & 0x0f);
if (x[12] & 0xfc) {
int raw_offset = (x[12] & 0xfc) >> 2;
- printk(BIOS_SPEW, "Real max dotclock: %dKHz\n",
- (x[9] * 10000) - (raw_offset * 250));
+ printk(BIOS_SPEW,
+ "Real max dotclock: %dKHz\n",
+ (x[9] * 10000) - (raw_offset
+ * 250));
if (raw_offset >= 40)
c->warning_excessive_dotclock_correction = 1;
}
@@ -371,7 +380,8 @@ detailed_block(struct edid *result_edid, unsigned char *x, int in_extension,
max_h_pixels |= x[13];
max_h_pixels *= 8;
if (max_h_pixels)
- printk(BIOS_SPEW, "Max active pixels per line: %d\n", max_h_pixels);
+ printk(BIOS_SPEW, "Max active pixels per line: %d\n",
+ max_h_pixels);
printk(BIOS_SPEW, "Supported aspect ratios: %s %s %s %s %s\n",
x[14] & 0x80 ? "4:3" : "",
@@ -383,13 +393,30 @@ detailed_block(struct edid *result_edid, unsigned char *x, int in_extension,
c->has_valid_range_descriptor = 0;
printk(BIOS_SPEW, "Preferred aspect ratio: ");
- switch((x[15] & 0xe0) >> 5) {
- case 0x00: printk(BIOS_SPEW, "4:3"); break;
- case 0x01: printk(BIOS_SPEW, "16:9"); break;
- case 0x02: printk(BIOS_SPEW, "16:10"); break;
- case 0x03: printk(BIOS_SPEW, "5:4"); break;
- case 0x04: printk(BIOS_SPEW, "15:9"); break;
- default: printk(BIOS_SPEW, "(broken)"); break;
+ switch ((x[15] & 0xe0) >> 5) {
+ case 0x00:
+ printk(BIOS_SPEW, "4:3");
+ break;
+
+ case 0x01:
+ printk(BIOS_SPEW, "16:9");
+ break;
+
+ case 0x02:
+ printk(BIOS_SPEW, "16:10");
+ break;
+
+ case 0x03:
+ printk(BIOS_SPEW, "5:4");
+ break;
+
+ case 0x04:
+ printk(BIOS_SPEW, "15:9");
+ break;
+
+ default:
+ printk(BIOS_SPEW, "(broken)");
+ break;
}
printk(BIOS_SPEW, "\n");
@@ -402,7 +429,8 @@ detailed_block(struct edid *result_edid, unsigned char *x, int in_extension,
c->has_valid_range_descriptor = 0;
if (x[16] & 0xf0) {
- printk(BIOS_SPEW, "Supported display scaling:\n");
+ printk(BIOS_SPEW,
+ "Supported display scaling:\n");
if (x[16] & 0x80)
printk(BIOS_SPEW, " Horizontal shrink\n");
if (x[16] & 0x40)
@@ -417,41 +445,50 @@ detailed_block(struct edid *result_edid, unsigned char *x, int in_extension,
c->has_valid_range_descriptor = 0;
if (x[17])
- printk(BIOS_SPEW, "Preferred vertical refresh: %d Hz\n", x[17]);
+ printk(BIOS_SPEW, "Preferred vertical refresh: %d Hz\n",
+ x[17]);
else
c->warning_zero_preferred_refresh = 1;
}
/*
- * Slightly weird to return a global, but I've never seen any
- * EDID block wth two range descriptors, so it's harmless.
+ * Slightly weird to return a global, but I've never
+ * seen any EDID block wth two range descriptors, so
+ * it's harmless.
*/
return 1;
}
+
case 0xFE:
/*
- * TODO: Two of these in a row, in the third and fourth slots,
- * seems to be specified by SPWG: http://www.spwg.org/
+ * TODO: Two of these in a row, in the third and fourth
+ * slots, seems to be specified by SPWG:
+ * http://www.spwg.org/
*/
printk(BIOS_SPEW, "ASCII string: %s\n",
- extract_string(x + 5, &c->has_valid_string_termination, 13));
+ extract_string(x + 5,
+ &c->has_valid_string_termination, 13));
return 1;
+
case 0xFF:
printk(BIOS_SPEW, "Serial number: %s\n",
- extract_string(x + 5, &c->has_valid_string_termination, 13));
+ extract_string(x + 5,
+ &c->has_valid_string_termination, 13));
return 1;
+
default:
- printk(BIOS_SPEW, "Unknown monitor description type %d\n", x[3]);
+ printk(BIOS_SPEW,
+ "Unknown monitor description type %d\n", x[3]);
return 0;
}
}
- if (c->seen_non_detailed_descriptor && !in_extension) {
+ if (c->seen_non_detailed_descriptor && !in_extension)
c->has_valid_descriptor_ordering = 0;
- }
/* Edid contains pixel clock in terms of 10KHz */
out->mode.pixel_clock = (x[0] + (x[1] << 8)) * 10;
+
/*
LVDS supports following pixel clocks
25000...112000 kHz: single channel
@@ -494,12 +531,15 @@ detailed_block(struct edid *result_edid, unsigned char *x, int in_extension,
case 0x00:
extra_info.syncmethod = " analog composite";
break;
+
case 0x01:
extra_info.syncmethod = " bipolar analog composite";
break;
+
case 0x02:
extra_info.syncmethod = " digital composite";
break;
+
case 0x03:
extra_info.syncmethod = "";
break;
@@ -530,7 +570,8 @@ detailed_block(struct edid *result_edid, unsigned char *x, int in_extension,
break;
}
- printk(BIOS_SPEW, "Detailed mode (IN HEX): Clock %d KHz, %x mm x %x mm\n"
+ printk(BIOS_SPEW,
+ "Detailed mode (IN HEX): Clock %d KHz, %x mm x %x mm\n"
" %04x %04x %04x %04x hborder %x\n"
" %04x %04x %04x %04x vborder %x\n"
" %chsync %cvsync%s%s %s\n",
@@ -544,10 +585,10 @@ detailed_block(struct edid *result_edid, unsigned char *x, int in_extension,
out->mode.va + out->mode.vso + out->mode.vspw,
out->mode.va + out->mode.vbl, out->mode.vborder,
out->mode.phsync, out->mode.pvsync,
- extra_info.syncmethod, x[17] & 0x80 ?" interlaced" : "",
+ extra_info.syncmethod, x[17] & 0x80 ? " interlaced" : "",
extra_info.stereo);
- if (! c->did_detailed_timing) {
+ if (!c->did_detailed_timing) {
printk(BIOS_SPEW, "Did detailed timing\n");
c->did_detailed_timing = 1;
*result_edid = *out;
@@ -567,7 +608,8 @@ do_checksum(unsigned char *x)
for (i = 0; i < 128; i++)
sum += x[i];
if (sum) {
- printk(BIOS_SPEW, " (should be 0x%hhx)", (unsigned char)(x[0x7f] - sum));
+ printk(BIOS_SPEW, " (should be 0x%hhx)",
+ (unsigned char)(x[0x7f] - sum));
} else {
valid = 1;
printk(BIOS_SPEW, " (valid)");
@@ -617,9 +659,10 @@ cea_audio_block(unsigned char *x)
for (i = 1; i < length; i += 3) {
format = (x[i] & 0x78) >> 3;
- printk(BIOS_SPEW, " %s, max channels %d\n", audio_format(format),
- x[i] & 0x07);
- printk(BIOS_SPEW, " Supported sample rates (kHz):%s%s%s%s%s%s%s\n",
+ printk(BIOS_SPEW, " %s, max channels %d\n",
+ audio_format(format), x[i] & 0x07);
+ printk(BIOS_SPEW,
+ " Supported sample rates (kHz):%s%s%s%s%s%s%s\n",
(x[i+1] & 0x40) ? " 192" : "",
(x[i+1] & 0x20) ? " 176.4" : "",
(x[i+1] & 0x10) ? " 96" : "",
@@ -628,12 +671,14 @@ cea_audio_block(unsigned char *x)
(x[i+1] & 0x02) ? " 44.1" : "",
(x[i+1] & 0x01) ? " 32" : "");
if (format == 1) {
- printk(BIOS_SPEW, " Supported sample sizes (bits):%s%s%s\n",
+ printk(BIOS_SPEW,
+ " Supported sample sizes (bits):%s%s%s\n",
(x[2] & 0x04) ? " 24" : "",
(x[2] & 0x02) ? " 20" : "",
(x[2] & 0x01) ? " 16" : "");
} else if (format <= 8) {
- printk(BIOS_SPEW, " Maximum bit rate: %d kHz\n", x[2] * 8);
+ printk(BIOS_SPEW,
+ " Maximum bit rate: %d kHz\n", x[2] * 8);
}
}
}
@@ -645,13 +690,14 @@ cea_video_block(unsigned char *x)
int length = x[0] & 0x1f;
for (i = 1; i < length; i++)
- printk(BIOS_SPEW," VIC %02d %s\n", x[i] & 0x7f,
+ printk(BIOS_SPEW, " VIC %02d %s\n", x[i] & 0x7f,
x[i] & 0x80 ? "(native)" : "");
}
static void
cea_hdmi_block(struct edid *out, unsigned char *x)
{
+ int b = 0;
int length = x[0] & 0x1f;
out->hdmi_monitor_detected = 1;
@@ -681,91 +727,101 @@ cea_hdmi_block(struct edid *out, unsigned char *x)
printk(BIOS_SPEW, " Maximum TMDS clock: %dMHz\n", x[7] * 5);
/* XXX the walk here is really ugly, and needs to be length-checked */
- if (length > 7) {
- int b = 0;
+ if (length <= 7)
+ return;
+
+ if (x[8] & 0x80) {
+ printk(BIOS_SPEW, " Video latency: %d\n", x[9 + b]);
+ printk(BIOS_SPEW, " Audio latency: %d\n", x[10 + b]);
+ b += 2;
+ }
+
+ if (x[8] & 0x40) {
+ printk(BIOS_SPEW, " Interlaced video latency: %d\n",
+ x[9 + b]);
+ printk(BIOS_SPEW, " Interlaced audio latency: %d\n",
+ x[10 + b]);
+ b += 2;
+ }
- if (x[8] & 0x80) {
- printk(BIOS_SPEW, " Video latency: %d\n", x[9 + b]);
- printk(BIOS_SPEW, " Audio latency: %d\n", x[10 + b]);
- b += 2;
+ if (x[8] & 0x20) {
+ int mask = 0, formats = 0;
+ int len_xx, len_3d;
+ printk(BIOS_SPEW, " Extended HDMI video details:\n");
+ if (x[9 + b] & 0x80)
+ printk(BIOS_SPEW, " 3D present\n");
+ if ((x[9 + b] & 0x60) == 0x20) {
+ printk(BIOS_SPEW, " All advertised VICs are 3D-capable\n");
+ formats = 1;
+ }
+ if ((x[9 + b] & 0x60) == 0x40) {
+ printk(BIOS_SPEW,
+ " 3D-capable-VIC mask present\n");
+ formats = 1;
+ mask = 1;
}
+ switch (x[9 + b] & 0x18) {
+ case 0x00:
+ break;
- if (x[8] & 0x40) {
- printk(BIOS_SPEW, " Interlaced video latency: %d\n", x[9 + b]);
- printk(BIOS_SPEW, " Interlaced audio latency: %d\n", x[10 + b]);
- b += 2;
+ case 0x08:
+ printk(BIOS_SPEW, " Base EDID image size is aspect ratio\n");
+ break;
+
+ case 0x10:
+ printk(BIOS_SPEW, " Base EDID image size is in units of 1cm\n");
+ break;
+
+ case 0x18:
+ printk(BIOS_SPEW, " Base EDID image size is in units of 5cm\n");
+ break;
+ }
+ len_xx = (x[10 + b] & 0xe0) >> 5;
+ len_3d = (x[10 + b] & 0x1f) >> 0;
+ b += 2;
+
+ if (len_xx) {
+ printk(BIOS_SPEW, " Skipping %d bytes that HDMI refuses to publicly"
+ " document\n", len_xx);
+ b += len_xx;
}
- if (x[8] & 0x20) {
- int mask = 0, formats = 0;
- int len_xx, len_3d;
- printk(BIOS_SPEW, " Extended HDMI video details:\n");
- if (x[9 + b] & 0x80)
- printk(BIOS_SPEW, " 3D present\n");
- if ((x[9 + b] & 0x60) == 0x20) {
- printk(BIOS_SPEW, " All advertised VICs are 3D-capable\n");
- formats = 1;
+ if (len_3d) {
+ if (formats) {
+ if (x[9 + b] & 0x01)
+ printk(BIOS_SPEW, " Side-by-side 3D supported\n");
+ if (x[10 + b] & 0x40)
+ printk(BIOS_SPEW, " Top-and-bottom 3D supported\n");
+ if (x[10 + b] & 0x01)
+ printk(BIOS_SPEW, " Frame-packing 3D supported\n");
+ b += 2;
}
- if ((x[9 + b] & 0x60) == 0x40) {
- printk(BIOS_SPEW, " 3D-capable-VIC mask present\n");
- formats = 1;
- mask = 1;
- }
- switch (x[9 + b] & 0x18) {
- case 0x00: break;
- case 0x08:
- printk(BIOS_SPEW, " Base EDID image size is aspect ratio\n");
- break;
- case 0x10:
- printk(BIOS_SPEW, " Base EDID image size is in units of 1cm\n");
- break;
- case 0x18:
- printk(BIOS_SPEW, " Base EDID image size is in units of 5cm\n");
- break;
- }
- len_xx = (x[10 + b] & 0xe0) >> 5;
- len_3d = (x[10 + b] & 0x1f) >> 0;
- b += 2;
-
- if (len_xx) {
- printk(BIOS_SPEW, " Skipping %d bytes that HDMI refuses to publicly"
- " document\n", len_xx);
- b += len_xx;
- }
-
- if (len_3d) {
- if (formats) {
- if (x[9 + b] & 0x01)
- printk(BIOS_SPEW, " Side-by-side 3D supported\n");
- if (x[10 + b] & 0x40)
- printk(BIOS_SPEW, " Top-and-bottom 3D supported\n");
- if (x[10 + b] & 0x01)
- printk(BIOS_SPEW, " Frame-packing 3D supported\n");
- b += 2;
- }
- if (mask) {
- int i;
- printk(BIOS_SPEW, " 3D VIC indices:");
- /* worst bit ordering ever */
- for (i = 0; i < 8; i++)
- if (x[10 + b] & (1 << i))
- printk(BIOS_SPEW, " %d", i);
- for (i = 0; i < 8; i++)
- if (x[9 + b] & (1 << i))
- printk(BIOS_SPEW, " %d", i + 8);
- printk(BIOS_SPEW, "\n");
- b += 2;
- }
+ if (mask) {
+ int i;
- /*
- * XXX list of nibbles:
- * 2D_VIC_Order_X
- * 3D_Structure_X
- * (optionally: 3D_Detail_X and reserved)
- */
+ printk(BIOS_SPEW,
+ " 3D VIC indices:");
+ /* worst bit ordering ever */
+ for (i = 0; i < 8; i++)
+ if (x[10 + b] & (1 << i))
+ printk(BIOS_SPEW, " %d",
+ i);
+ for (i = 0; i < 8; i++)
+ if (x[9 + b] & (1 << i))
+ printk(BIOS_SPEW, " %d",
+ i + 8);
+ printk(BIOS_SPEW, "\n");
+ b += 2;
}
+ /*
+ * XXX list of nibbles:
+ * 2D_VIC_Order_X
+ * 3D_Structure_X
+ * (optionally: 3D_Detail_X and reserved)
+ */
}
+
}
}
@@ -786,7 +842,8 @@ cea_block(struct edid *out, unsigned char *x)
case 0x03:
/* yes really, endianness lols */
oui = (x[3] << 16) + (x[2] << 8) + x[1];
- printk(BIOS_SPEW, " Vendor-specific data block, OUI %06x", oui);
+ printk(BIOS_SPEW, " Vendor-specific data block, OUI %06x",
+ oui);
if (oui == 0x000c03)
cea_hdmi_block(out, x);
else
@@ -830,9 +887,11 @@ cea_block(struct edid *out, unsigned char *x)
break;
default:
if (x[1] >= 6 && x[1] <= 15)
- printk(BIOS_SPEW, "Reserved video block (%02x)\n", x[1]);
+ printk(BIOS_SPEW,
+ "Reserved video block (%02x)\n", x[1]);
else if (x[1] >= 19 && x[1] <= 31)
- printk(BIOS_SPEW, "Reserved audio block (%02x)\n", x[1]);
+ printk(BIOS_SPEW,
+ "Reserved audio block (%02x)\n", x[1]);
else
printk(BIOS_SPEW, "Unknown (%02x)\n", x[1]);
break;
@@ -843,7 +902,8 @@ cea_block(struct edid *out, unsigned char *x)
int tag = (*x & 0xe0) >> 5;
int length = *x & 0x1f;
printk(BIOS_SPEW,
- " Unknown tag %d, length %d (raw %02x)\n", tag, length, *x);
+ " Unknown tag %d, length %d (raw %02x)\n", tag, length,
+ *x);
break;
}
}
@@ -857,41 +917,50 @@ parse_cea(struct edid *out, unsigned char *x, struct edid_context *c)
int offset = x[2];
unsigned char *detailed;
- if (version >= 1) do {
- if (version == 1 && x[3] != 0)
- ret = 1;
+ do {
+ if (version < 1)
+ break;
+ if (version == 1 && x[3] != 0)
+ ret = 1;
- if (offset < 4)
- break;
+ if (offset < 4)
+ break;
- if (version < 3) {
- printk(BIOS_SPEW, "%d 8-byte timing descriptors\n", (offset - 4) / 8);
- if (offset - 4 > 0)
- /* do stuff */ ;
- } else if (version == 3) {
- int i;
- printk(BIOS_SPEW, "%d bytes of CEA data\n", offset - 4);
- for (i = 4; i < offset; i += (x[i] & 0x1f) + 1) {
- cea_block(out, x + i);
- }
- }
+ if (version < 3) {
+ printk(BIOS_SPEW,
+ "%d 8-byte timing descriptors\n",
+ (offset - 4) / 8);
+ } else if (version == 3) {
+ int i;
+
+ printk(BIOS_SPEW, "%d bytes of CEA data\n",
+ offset - 4);
+ for (i = 4; i < offset; i += (x[i] & 0x1f) + 1)
+ cea_block(out, x + i);
+ }
- if (version >= 2) {
- if (x[3] & 0x80)
- printk(BIOS_SPEW, "Underscans PC formats by default\n");
- if (x[3] & 0x40)
- printk(BIOS_SPEW, "Basic audio support\n");
- if (x[3] & 0x20)
- printk(BIOS_SPEW, "Supports YCbCr 4:4:4\n");
- if (x[3] & 0x10)
- printk(BIOS_SPEW, "Supports YCbCr 4:2:2\n");
- printk(BIOS_SPEW, "%d native detailed modes\n", x[3] & 0x0f);
- }
+ if (version >= 2) {
+ if (x[3] & 0x80)
+ printk(BIOS_SPEW,
+ "Underscans PC formats by default\n");
+ if (x[3] & 0x40)
+ printk(BIOS_SPEW,
+ "Basic audio support\n");
+ if (x[3] & 0x20)
+ printk(BIOS_SPEW,
+ "Supports YCbCr 4:4:4\n");
+ if (x[3] & 0x10)
+ printk(BIOS_SPEW,
+ "Supports YCbCr 4:2:2\n");
+ printk(BIOS_SPEW, "%d native detailed modes\n",
+ x[3] & 0x0f);
+ }
- for (detailed = x + offset; detailed + 18 < x + 127; detailed += 18)
- if (detailed[0])
- detailed_block(out, detailed, 1, c);
- } while (0);
+ for (detailed = x + offset; detailed + 18 < x + 127;
+ detailed += 18)
+ if (detailed[0])
+ detailed_block(out, detailed, 1, c);
+ } while (0);
c->has_valid_checksum &= do_checksum(x);
return ret;
@@ -911,18 +980,36 @@ parse_extension(struct edid *out, unsigned char *x, struct edid_context *c)
int conformant_extension = 0;
printk(BIOS_SPEW, "\n");
- switch(x[0]) {
+ switch (x[0]) {
case 0x02:
printk(BIOS_SPEW, "CEA extension block\n");
extension_version(out, x);
conformant_extension = parse_cea(out, x, c);
break;
- case 0x10: printk(BIOS_SPEW, "VTB extension block\n"); break;
- case 0x40: printk(BIOS_SPEW, "DI extension block\n"); break;
- case 0x50: printk(BIOS_SPEW, "LS extension block\n"); break;
- case 0x60: printk(BIOS_SPEW, "DPVL extension block\n"); break;
- case 0xF0: printk(BIOS_SPEW, "Block map\n"); break;
- case 0xFF: printk(BIOS_SPEW, "Manufacturer-specific extension block\n");
+
+ case 0x10:
+ printk(BIOS_SPEW, "VTB extension block\n");
+ break;
+
+ case 0x40:
+ printk(BIOS_SPEW, "DI extension block\n");
+ break;
+
+ case 0x50:
+ printk(BIOS_SPEW, "LS extension block\n");
+ break;
+
+ case 0x60:
+ printk(BIOS_SPEW, "DPVL extension block\n");
+ break;
+
+ case 0xF0:
+ printk(BIOS_SPEW, "Block map\n");
+ break;
+
+ case 0xFF:
+ printk(BIOS_SPEW, "Manufacturer-specific extension block\n");
+
default:
printk(BIOS_SPEW, "Unknown extension block\n");
break;
@@ -976,7 +1063,7 @@ static void dump_breakdown(unsigned char *edid)
printk(BIOS_SPEW, "Extracted contents:\n");
print_subsection("header", edid, 0, 7);
print_subsection("serial number", edid, 8, 17);
- print_subsection("version", edid,18, 19);
+ print_subsection("version", edid, 18, 19);
print_subsection("basic params", edid, 20, 24);
print_subsection("chroma info", edid, 25, 34);
print_subsection("established", edid, 35, 37);
@@ -1087,16 +1174,20 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
if (edid[0x11] > 0x0f) {
if (edid[0x10] == 0xff) {
c.has_valid_year = 1;
- printk(BIOS_SPEW, "Made week %hhd of model year %hhd\n", edid[0x10],
- edid[0x11]);
+ printk(BIOS_SPEW,
+ "Made week %hhd of model year %hhd\n",
+ edid[0x10], edid[0x11]);
extra_info.week = edid[0x10];
extra_info.year = edid[0x11];
} else {
- /* we know it's at least 2013, when this code was written */
+ /* we know it's at least 2013, when this code
+ * was written
+ */
if (edid[0x11] + 90 <= 2013) {
c.has_valid_year = 1;
- printk(BIOS_SPEW, "Made week %hhd of %d\n",
- edid[0x10], edid[0x11] + 1990);
+ printk(BIOS_SPEW,
+ "Made week %hhd of %d\n",
+ edid[0x10], edid[0x11] + 1990);
extra_info.week = edid[0x10];
extra_info.year = edid[0x11] + 1990;
}
@@ -1110,7 +1201,8 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
if (edid[0x12] == 1) {
if (edid[0x13] > 4) {
- printk(BIOS_SPEW, "Claims > 1.4, assuming 1.4 conformance\n");
+ printk(BIOS_SPEW,
+ "Claims > 1.4, assuming 1.4 conformance\n");
edid[0x13] = 4;
}
switch (edid[0x13]) {
@@ -1138,32 +1230,53 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
else if ((edid[0x14] & 0x70) == 0x70)
c.nonconformant_digital_display = 1;
else
- printk(BIOS_SPEW, "%d bits per primary color channel\n",
- ((edid[0x14] & 0x70) >> 3) + 4);
- out->panel_bits_per_color = ((edid[0x14] & 0x70) >> 3) + 4;
+ printk(BIOS_SPEW,
+ "%d bits per primary color channel\n",
+ ((edid[0x14] & 0x70) >> 3) + 4);
+ out->panel_bits_per_color = ((edid[0x14] & 0x70) >> 3)
+ + 4;
out->panel_bits_per_pixel = 3*out->panel_bits_per_color;
switch (edid[0x14] & 0x0f) {
- case 0x00: printk(BIOS_SPEW, "Digital interface is not defined\n"); break;
- case 0x01: printk(BIOS_SPEW, "DVI interface\n"); break;
- case 0x02: printk(BIOS_SPEW, "HDMI-a interface\n"); break;
- case 0x03: printk(BIOS_SPEW, "HDMI-b interface\n"); break;
- case 0x04: printk(BIOS_SPEW, "MDDI interface\n"); break;
- case 0x05: printk(BIOS_SPEW, "DisplayPort interface\n"); break;
+ case 0x00:
+ printk(BIOS_SPEW,
+ "Digital interface is not defined\n");
+ break;
+ case 0x01:
+ printk(BIOS_SPEW, "DVI interface\n");
+ break;
+
+ case 0x02:
+ printk(BIOS_SPEW, "HDMI-a interface\n");
+ break;
+
+ case 0x03:
+ printk(BIOS_SPEW, "HDMI-b interface\n");
+ break;
+
+ case 0x04:
+ printk(BIOS_SPEW, "MDDI interface\n");
+ break;
+
+ case 0x05:
+ printk(BIOS_SPEW, "DisplayPort interface\n");
+ break;
+
default:
- c.nonconformant_digital_display = 1;
+ c.nonconformant_digital_display = 1;
+ break;
}
extra_info.type = edid[0x14] & 0x0f;
- } else if (c.claims_one_point_two) {
+ } else if (c.claims_one_point_two) {
conformance_mask = 0x7E;
- if (edid[0x14] & 0x01) {
+ if (edid[0x14] & 0x01)
printk(BIOS_SPEW, "DFP 1.x compatible TMDS\n");
- }
} else
conformance_mask = 0x7F;
if (!c.nonconformant_digital_display)
- c.nonconformant_digital_display = edid[0x14] & conformance_mask;
+ c.nonconformant_digital_display = edid[0x14]
+ & conformance_mask;
extra_info.nonconformant = c.nonconformant_digital_display;
} else {
analog = 1;
@@ -1180,22 +1293,26 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
if (c.claims_one_point_four) {
if (edid[0x14] & 0x10)
- printk(BIOS_SPEW, "Blank-to-black setup/pedestal\n");
+ printk(BIOS_SPEW,
+ "Blank-to-black setup/pedestal\n");
else
- printk(BIOS_SPEW, "Blank level equals black level\n");
+ printk(BIOS_SPEW,
+ "Blank level equals black level\n");
} else if (edid[0x14] & 0x10) {
/*
- * XXX this is just the X text. 1.3 says "if set, display expects
- * a blank-to-black setup or pedestal per appropriate Signal
- * Level Standard". Whatever _that_ means.
+ * XXX this is just the X text. 1.3 says "if set,
+ * display expects a blank-to-black setup or pedestal
+ * per appropriate Signal Level Standard". Whatever
+ * _that_ means.
*/
printk(BIOS_SPEW, "Configurable signal levels\n");
}
- printk(BIOS_SPEW, "Sync: %s%s%s%s\n", sync & 0x08 ? "Separate " : "",
- sync & 0x04 ? "Composite " : "",
- sync & 0x02 ? "SyncOnGreen " : "",
- sync & 0x01 ? "Serration " : "");
+ printk(BIOS_SPEW, "Sync: %s%s%s%s\n", sync & 0x08
+ ? "Separate " : "",
+ sync & 0x04 ? "Composite " : "",
+ sync & 0x02 ? "SyncOnGreen " : "",
+ sync & 0x01 ? "Serration " : "");
}
@@ -1205,11 +1322,13 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
} else if (c.claims_one_point_four && (edid[0x15] || edid[0x16])) {
if (edid[0x15]) { /* edid[0x15] != 0 && edid[0x16] == 0 */
unsigned int ratio = 100000/(edid[0x15] + 99);
- printk(BIOS_SPEW, "Aspect ratio is %u.%03u (landscape)\n",
+ printk(BIOS_SPEW,
+ "Aspect ratio is %u.%03u (landscape)\n",
ratio / 1000, ratio % 1000);
} else { /* edid[0x15] == 0 && edid[0x16] != 0 */
unsigned int ratio = 100000/(edid[0x16] + 99);
- printk(BIOS_SPEW, "Aspect ratio is %u.%03u (portrait)\n",
+ printk(BIOS_SPEW,
+ "Aspect ratio is %u.%03u (portrait)\n",
ratio / 1000, ratio % 1000);
}
} else {
@@ -1219,27 +1338,45 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
if (edid[0x17] == 0xff) {
if (c.claims_one_point_four)
- printk(BIOS_SPEW, "Gamma is defined in an extension block\n");
+ printk(BIOS_SPEW,
+ "Gamma is defined in an extension block\n");
else
/* XXX Technically 1.3 doesn't say this... */
printk(BIOS_SPEW, "Gamma: 1.0\n");
- } else printk(BIOS_SPEW, "Gamma: %d%%\n", ((edid[0x17] + 100)));
+ } else
+ printk(BIOS_SPEW, "Gamma: %d%%\n", ((edid[0x17] + 100)));
printk(BIOS_SPEW, "Check DPMS levels\n");
if (edid[0x18] & 0xE0) {
printk(BIOS_SPEW, "DPMS levels:");
- if (edid[0x18] & 0x80) printk(BIOS_SPEW, " Standby");
- if (edid[0x18] & 0x40) printk(BIOS_SPEW, " Suspend");
- if (edid[0x18] & 0x20) printk(BIOS_SPEW, " Off");
+ if (edid[0x18] & 0x80)
+ printk(BIOS_SPEW, " Standby");
+ if (edid[0x18] & 0x40)
+ printk(BIOS_SPEW, " Suspend");
+ if (edid[0x18] & 0x20)
+ printk(BIOS_SPEW, " Off");
printk(BIOS_SPEW, "\n");
}
/* FIXME: this is from 1.4 spec, check earlier */
if (analog) {
switch (edid[0x18] & 0x18) {
- case 0x00: printk(BIOS_SPEW, "Monochrome or grayscale display\n"); break;
- case 0x08: printk(BIOS_SPEW, "RGB color display\n"); break;
- case 0x10: printk(BIOS_SPEW, "Non-RGB color display\n"); break;
- case 0x18: printk(BIOS_SPEW, "Undefined display color type\n");
+ case 0x00:
+ printk(BIOS_SPEW,
+ "Monochrome or grayscale display\n");
+ break;
+
+ case 0x08:
+ printk(BIOS_SPEW, "RGB color display\n");
+ break;
+
+ case 0x10:
+ printk(BIOS_SPEW, "Non-RGB color display\n");
+ break;
+
+ case 0x18:
+ printk(BIOS_SPEW,
+ "Undefined display color type\n");
+ break;
}
} else {
printk(BIOS_SPEW, "Supported color formats: RGB 4:4:4");
@@ -1251,13 +1388,16 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
}
if (edid[0x18] & 0x04)
- printk(BIOS_SPEW, "Default (sRGB) color space is primary color space\n");
+ printk(BIOS_SPEW,
+ "Default (sRGB) color space is primary color space\n");
if (edid[0x18] & 0x02) {
- printk(BIOS_SPEW, "First detailed timing is preferred timing\n");
+ printk(BIOS_SPEW,
+ "First detailed timing is preferred timing\n");
c.has_preferred_timing = 1;
}
if (edid[0x18] & 0x01)
- printk(BIOS_SPEW, "Supports GTF timings within operating range\n");
+ printk(BIOS_SPEW,
+ "Supports GTF timings within operating range\n");
/* XXX color section */
@@ -1267,13 +1407,18 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
*/
for (i = 0; i < 17; i++) {
if (edid[0x23 + i / 8] & (1 << (7 - i % 8))) {
- printk(BIOS_SPEW, " %dx%d@%dHz\n", established_timings[i].x,
- established_timings[i].y, established_timings[i].refresh);
+ printk(BIOS_SPEW, " %dx%d@%dHz\n",
+ established_timings[i].x,
+ established_timings[i].y,
+ established_timings[i].refresh);
for (j = 0; j < NUM_KNOWN_MODES; j++) {
- if (known_modes[j].ha == established_timings[i].x &&
- known_modes[j].va == established_timings[i].y &&
- known_modes[j].refresh == established_timings[i].refresh)
+ if (known_modes[j].ha ==
+ established_timings[i].x
+ && known_modes[j].va ==
+ established_timings[i].y
+ && known_modes[j].refresh ==
+ established_timings[i].refresh)
out->mode_is_supported[j] = 1;
}
}
@@ -1289,7 +1434,8 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
continue;
if (b1 == 0) {
- printk(BIOS_SPEW, "non-conformant standard timing (0 horiz)\n");
+ printk(BIOS_SPEW,
+ "non-conformant standard timing (0 horiz)\n");
continue;
}
x = (b1 + 31) * 8;
@@ -1300,12 +1446,15 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
else
y = x;
break;
+
case 0x01:
y = x * 3 / 4;
break;
+
case 0x02:
y = x * 4 / 5;
break;
+
case 0x03:
y = x * 9 / 16;
break;
@@ -1326,10 +1475,8 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
c.has_valid_detailed_blocks &= detailed_block(
out, edid + 0x36 + i * 18, 0, &c);
if (i == 0 && c.has_preferred_timing && !c.did_detailed_timing)
- {
/* not really accurate... */
c.has_preferred_timing = 0;
- }
}
/* check this, 1.4 verification guide says otherwise */
@@ -1338,9 +1485,8 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
/* 2 is impossible because of the block map */
if (edid[0x7e] != 2)
c.has_valid_extension_count = 1;
- } else {
+ } else
c.has_valid_extension_count = 1;
- }
printk(BIOS_SPEW, "Checksum\n");
c.has_valid_checksum = do_checksum(edid);
@@ -1350,7 +1496,7 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
* by v1.3 and we are unlikely to use any EDID 2.0 panels, we ignore
* that case now and can fix it when we need to use a real 2.0 panel.
*/
- for(i = 128; i < size; i += 128)
+ for (i = 128; i < size; i += 128)
c.nonconformant_extension +=
parse_extension(out, &edid[i], &c);
@@ -1361,14 +1507,17 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
!c.has_preferred_timing)
c.conformant = 0;
if (!c.conformant)
- printk(BIOS_ERR, "EDID block does NOT conform to EDID 1.4!\n");
+ printk(BIOS_ERR,
+ "EDID block does NOT conform to EDID 1.4!\n");
if (c.nonconformant_digital_display)
- printk(BIOS_ERR, "\tDigital display field contains garbage: %x\n",
+ printk(BIOS_ERR,
+ "\tDigital display field contains garbage: %x\n",
c.nonconformant_digital_display);
if (!c.has_valid_string_termination)
printk(BIOS_ERR, "\tDetailed block string not properly terminated\n");
if (!c.has_valid_descriptor_pad)
- printk(BIOS_ERR, "\tInvalid descriptor block padding\n");
+ printk(BIOS_ERR,
+ "\tInvalid descriptor block padding\n");
if (!c.has_preferred_timing)
printk(BIOS_ERR, "\tMissing preferred timing\n");
} else if (c.claims_one_point_three) {
@@ -1386,13 +1535,15 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
* messages.
*/
if (!c.conformant)
- printk(BIOS_ERR, "EDID block does NOT conform to EDID 1.3!\n");
+ printk(BIOS_ERR,
+ "EDID block does NOT conform to EDID 1.3!\n");
else if (!c.has_name_descriptor || !c.has_range_descriptor)
printk(BIOS_WARNING, "WARNING: EDID block does NOT "
"fully conform to EDID 1.3.\n");
if (c.nonconformant_digital_display)
- printk(BIOS_ERR, "\tDigital display field contains garbage: %x\n",
+ printk(BIOS_ERR,
+ "\tDigital display field contains garbage: %x\n",
c.nonconformant_digital_display);
if (!c.has_name_descriptor)
printk(BIOS_ERR, "\tMissing name descriptor\n");
@@ -1400,8 +1551,10 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
printk(BIOS_ERR, "\tMissing preferred timing\n");
if (!c.has_range_descriptor)
printk(BIOS_ERR, "\tMissing monitor ranges\n");
- if (!c.has_valid_descriptor_pad) /* Might be more than just 1.3 */
- printk(BIOS_ERR, "\tInvalid descriptor block padding\n");
+ /* Might be more than just 1.3 */
+ if (!c.has_valid_descriptor_pad)
+ printk(BIOS_ERR,
+ "\tInvalid descriptor block padding\n");
if (!c.has_valid_string_termination) /* Likewise */
printk(BIOS_ERR, "\tDetailed block string not properly terminated\n");
} else if (c.claims_one_point_two) {
@@ -1409,7 +1562,8 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
!c.has_valid_string_termination)
c.conformant = 0;
if (!c.conformant)
- printk(BIOS_ERR, "EDID block does NOT conform to EDID 1.2!\n");
+ printk(BIOS_ERR,
+ "EDID block does NOT conform to EDID 1.2!\n");
if (c.nonconformant_digital_display)
printk(BIOS_ERR, "\tDigital display field contains garbage: %x\n",
c.nonconformant_digital_display);
@@ -1419,7 +1573,8 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
if (c.seen_non_detailed_descriptor)
c.conformant = 0;
if (!c.conformant)
- printk(BIOS_ERR, "EDID block does NOT conform to EDID 1.0!\n");
+ printk(BIOS_ERR,
+ "EDID block does NOT conform to EDID 1.0!\n");
if (c.seen_non_detailed_descriptor)
printk(BIOS_ERR, "\tHas descriptor blocks other than detailed timings\n");
}
@@ -1438,8 +1593,9 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
c.conformant = 0;
printk(BIOS_ERR, "EDID block does not conform at all!\n");
if (c.nonconformant_extension)
- printk(BIOS_ERR, "\tHas %d nonconformant extension block(s)\n",
- c.nonconformant_extension);
+ printk(BIOS_ERR,
+ "\tHas %d nonconformant extension block(s)\n",
+ c.nonconformant_extension);
if (!c.has_valid_checksum)
printk(BIOS_ERR, "\tBlock has broken checksum\n");
if (!c.has_valid_cvt)
@@ -1449,19 +1605,24 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
if (!c.has_valid_week)
printk(BIOS_ERR, "\tBad week of manufacture\n");
if (!c.has_valid_detailed_blocks)
- printk(BIOS_ERR, "\tDetailed blocks filled with garbage\n");
+ printk(BIOS_ERR,
+ "\tDetailed blocks filled with garbage\n");
if (!c.has_valid_dummy_block)
printk(BIOS_ERR, "\tDummy block filled with garbage\n");
if (!c.has_valid_extension_count)
- printk(BIOS_ERR, "\tImpossible extension block count\n");
+ printk(BIOS_ERR,
+ "\tImpossible extension block count\n");
if (!c.manufacturer_name_well_formed)
- printk(BIOS_ERR, "\tManufacturer name field contains garbage\n");
+ printk(BIOS_ERR,
+ "\tManufacturer name field contains garbage\n");
if (!c.has_valid_descriptor_ordering)
printk(BIOS_ERR, "\tInvalid detailed timing descriptor ordering\n");
if (!c.has_valid_range_descriptor)
- printk(BIOS_ERR, "\tRange descriptor contains garbage\n");
+ printk(BIOS_ERR,
+ "\tRange descriptor contains garbage\n");
if (!c.has_valid_max_dotclock)
- printk(BIOS_ERR, "\tEDID 1.4 block does not set max dotclock\n");
+ printk(BIOS_ERR,
+ "\tEDID 1.4 block does not set max dotclock\n");
}
if (c.warning_excessive_dotclock_correction)
@@ -1553,8 +1714,8 @@ void set_vbe_mode_info_valid(const struct edid *edid, uintptr_t fb_addr)
edid_fb.x_resolution = edid->x_resolution;
edid_fb.y_resolution = edid->y_resolution;
edid_fb.bytes_per_line = edid->bytes_per_line;
- /* In the case of (e.g.) 24 framebuffer bits per pixel, the convention nowadays
- * seems to be to round it up to the nearest reasonable
+ /* In the case of (e.g.) 24 framebuffer bits per pixel, the convention
+ * nowadays seems to be to round it up to the nearest reasonable
* boundary, because otherwise the byte-packing is hideous.
* So, for example, in RGB with no alpha, the bytes are still
* packed into 32-bit words, the so-called 32bpp-no-alpha mode.
@@ -1567,7 +1728,7 @@ void set_vbe_mode_info_valid(const struct edid *edid, uintptr_t fb_addr)
edid_fb.bits_per_pixel = edid->framebuffer_bits_per_pixel;
edid_fb.reserved_mask_pos = 0;
edid_fb.reserved_mask_size = 0;
- switch(edid->framebuffer_bits_per_pixel){
+ switch (edid->framebuffer_bits_per_pixel) {
case 32:
case 24:
/* packed into 4-byte words */
@@ -1580,6 +1741,7 @@ void set_vbe_mode_info_valid(const struct edid *edid, uintptr_t fb_addr)
edid_fb.blue_mask_pos = 0;
edid_fb.blue_mask_size = 8;
break;
+
case 16:
/* packed into 2-byte words */
edid_fb.red_mask_pos = 11;
@@ -1589,6 +1751,7 @@ void set_vbe_mode_info_valid(const struct edid *edid, uintptr_t fb_addr)
edid_fb.blue_mask_pos = 0;
edid_fb.blue_mask_size = 5;
break;
+
default:
printk(BIOS_SPEW, "%s: unsupported BPP %d\n", __func__,
edid->framebuffer_bits_per_pixel);
diff --git a/src/lib/gcc.c b/src/lib/gcc.c
index a576a77..5a93f45 100644
--- a/src/lib/gcc.c
+++ b/src/lib/gcc.c
@@ -25,7 +25,7 @@
* specific implementations may vary
*/
#define WRAP_LIBGCC_CALL(type, name) \
- type __real_##name(type a, type b) asmlinkage; \
+ asmlinkage type __real_##name(type a, type b); \
type __wrap_##name(type a, type b); \
type __wrap_##name(type a, type b) { return __real_##name(a, b); }
diff --git a/src/lib/gcov-glue.c b/src/lib/gcov-glue.c
index 0e45247..bba8ecf 100644
--- a/src/lib/gcov-glue.c
+++ b/src/lib/gcov-glue.c
@@ -49,7 +49,9 @@ static FILE *fopen(const char *path, const char *mode)
current_file = cbmem_add(CBMEM_ID_COVERAGE, 32*1024);
} else {
previous_file = current_file;
- current_file = (FILE *)(ALIGN(((unsigned long)previous_file->data + previous_file->len), 16));
+ current_file =
+ (FILE *)(ALIGN(((unsigned long)previous_file->data
+ + previous_file->len), 16));
}
// TODO check if we're at the end of the CBMEM region (ENOMEM)
@@ -60,7 +62,9 @@ static FILE *fopen(const char *path, const char *mode)
previous_file->next = current_file;
current_file->filename = (char *)¤t_file[1];
strcpy(current_file->filename, path);
- current_file->data = (char *)ALIGN(((unsigned long)current_file->filename + strlen(path) + 1), 16);
+ current_file->data =
+ (char *)ALIGN(((unsigned long)current_file->filename
+ + strlen(path) + 1), 16);
current_file->offset = 0;
current_file->len = 0;
}
@@ -80,7 +84,7 @@ static int fseek(FILE *stream, long offset, int whence)
{
/* fseek should only be called with offset==0 and whence==SEEK_SET
* to a freshly opened file. */
- gcc_assert (offset == 0 && whence == SEEK_SET);
+ gcc_assert(offset == 0 && whence == SEEK_SET);
#if CONFIG_DEBUG_COVERAGE
printk(BIOS_DEBUG, "fseek %s offset=%ld whence=%d\n",
stream->filename, offset, whence);
@@ -110,7 +114,7 @@ static size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream)
static size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
{
#if CONFIG_DEBUG_COVERAGE
- printk(BIOS_DEBUG, "fwrite: %zd * 0x%zd bytes to file %s\n",
+ printk(BIOS_DEBUG, "fwrite: %zd * %zd bytes to file %s\n",
nmemb, size, stream->filename);
#endif
// TODO check if file is last opened file and fail otherwise.
@@ -129,14 +133,13 @@ static void setbuf(FILE *stream, char *buf)
static void coverage_init(void *unused)
{
extern long __CTOR_LIST__;
- typedef void (*func_ptr)(void) ;
- func_ptr *ctor = (func_ptr*) &__CTOR_LIST__;
+ typedef void (*func_ptr)(void);
+ func_ptr *ctor = (func_ptr *) &__CTOR_LIST__;
if (ctor == NULL)
return;
- for ( ; *ctor != (func_ptr) 0; ctor++) {
+ for ( ; *ctor != (func_ptr) 0; ctor++)
(*ctor)();
- }
}
void __gcov_flush(void);
diff --git a/src/lib/gcov-io.c b/src/lib/gcov-io.c
index aeb9d12..39c3f40 100644
--- a/src/lib/gcov-io.c
+++ b/src/lib/gcov-io.c
@@ -25,24 +25,23 @@ permissions described in the GCC Runtime Library Exception, version
another source file, after having #included gcov-io.h. */
#if !IN_GCOV
-static void gcov_write_block (unsigned);
-static gcov_unsigned_t *gcov_write_words (unsigned);
+static void gcov_write_block(unsigned int);
+static gcov_unsigned_t *gcov_write_words(unsigned int);
#endif
-static const gcov_unsigned_t *gcov_read_words (unsigned);
+static const gcov_unsigned_t *gcov_read_words(unsigned int);
#if !IN_LIBGCOV
-static void gcov_allocate (unsigned);
+static void gcov_allocate(unsigned int);
#endif
-static inline gcov_unsigned_t from_file (gcov_unsigned_t value)
+static inline gcov_unsigned_t from_file(gcov_unsigned_t value)
{
#if !IN_LIBGCOV
- if (gcov_var.endian)
- {
- value = (value >> 16) | (value << 16);
- value = ((value & 0xff00ff) << 8) | ((value >> 8) & 0xff00ff);
- }
+ if (gcov_var.endian) {
+ value = (value >> 16) | (value << 16);
+ value = ((value & 0xff00ff) << 8) | ((value >> 8) & 0xff00ff);
+ }
#endif
- return value;
+ return value;
}
/* Open a gcov file. NAME is the name of the file to open and MODE
@@ -57,122 +56,112 @@ static inline gcov_unsigned_t from_file (gcov_unsigned_t value)
GCOV_LINKAGE int
#if IN_LIBGCOV
-gcov_open (const char *name)
+gcov_open(const char *name)
#else
-gcov_open (const char *name, int mode)
+gcov_open(const char *name, int mode)
#endif
{
#if IN_LIBGCOV
- const int mode = 0;
+ const int mode = 0;
#endif
#if GCOV_LOCKED
- struct flock s_flock;
- int fd;
+ struct flock s_flock;
+ int fd;
- s_flock.l_whence = SEEK_SET;
- s_flock.l_start = 0;
- s_flock.l_len = 0; /* Until EOF. */
- s_flock.l_pid = getpid ();
+ s_flock.l_whence = SEEK_SET;
+ s_flock.l_start = 0;
+ s_flock.l_len = 0; /* Until EOF. */
+ s_flock.l_pid = getpid();
#endif
- gcc_assert (!gcov_var.file);
- gcov_var.start = 0;
- gcov_var.offset = gcov_var.length = 0;
- gcov_var.overread = -1u;
- gcov_var.error = 0;
+ gcc_assert(!gcov_var.file);
+ gcov_var.start = 0;
+ gcov_var.offset = gcov_var.length = 0;
+ gcov_var.overread = -1u;
+ gcov_var.error = 0;
#if !IN_LIBGCOV
- gcov_var.endian = 0;
+ gcov_var.endian = 0;
#endif
#if GCOV_LOCKED
- if (mode > 0)
- {
- /* Read-only mode - acquire a read-lock. */
- s_flock.l_type = F_RDLCK;
- fd = open (name, O_RDONLY);
- }
- else
- {
- /* Write mode - acquire a write-lock. */
- s_flock.l_type = F_WRLCK;
- fd = open (name, O_RDWR | O_CREAT, 0666);
- }
- if (fd < 0)
- return 0;
-
- while (fcntl (fd, F_SETLKW, &s_flock) && errno == EINTR)
- continue;
-
- gcov_var.file = fdopen (fd, (mode > 0) ? "rb" : "r+b");
-
- if (!gcov_var.file)
- {
- close (fd);
- return 0;
- }
-
- if (mode > 0)
- gcov_var.mode = 1;
- else if (mode == 0)
- {
- struct stat st;
-
- if (fstat (fd, &st) < 0)
- {
- fclose (gcov_var.file);
- gcov_var.file = 0;
- return 0;
+ if (mode > 0) {
+ /* Read-only mode - acquire a read-lock. */
+ s_flock.l_type = F_RDLCK;
+ fd = open(name, O_RDONLY);
+ } else {
+ /* Write mode - acquire a write-lock. */
+ s_flock.l_type = F_WRLCK;
+ fd = open(name, O_RDWR | O_CREAT, 0666);
+ }
+ if (fd < 0)
+ return 0;
+
+ while (fcntl(fd, F_SETLKW, &s_flock) && errno == EINTR)
+ continue;
+
+ gcov_var.file = fdopen(fd, (mode > 0) ? "rb" : "r+b");
+
+ if (!gcov_var.file) {
+ close(fd);
+ return 0;
}
- if (st.st_size != 0)
- gcov_var.mode = 1;
- else
- gcov_var.mode = mode * 2 + 1;
- }
- else
- gcov_var.mode = mode * 2 + 1;
+
+ if (mode > 0)
+ gcov_var.mode = 1;
+ else if (mode == 0) {
+ struct stat st;
+
+ if (fstat(fd, &st) < 0) {
+ fclose(gcov_var.file);
+ gcov_var.file = 0;
+ return 0;
+ }
+ if (st.st_size != 0)
+ gcov_var.mode = 1;
+ else
+ gcov_var.mode = mode * 2 + 1;
+ } else
+ gcov_var.mode = mode * 2 + 1;
#else
- if (mode >= 0)
- gcov_var.file = fopen (name, (mode > 0) ? "rb" : "r+b");
-
- if (gcov_var.file)
- gcov_var.mode = 1;
- else if (mode <= 0)
- {
- gcov_var.file = fopen (name, "w+b");
- if (gcov_var.file)
- gcov_var.mode = mode * 2 + 1;
- }
- if (!gcov_var.file)
- return 0;
+ if (mode >= 0)
+ gcov_var.file = fopen(name, (mode > 0) ? "rb" : "r+b");
+
+ if (gcov_var.file)
+ gcov_var.mode = 1;
+ else if (mode <= 0) {
+ gcov_var.file = fopen(name, "w+b");
+ if (gcov_var.file)
+ gcov_var.mode = mode * 2 + 1;
+ }
+ if (!gcov_var.file)
+ return 0;
#endif
- setbuf (gcov_var.file, (char *)0);
-
- return 1;
+ setbuf(gcov_var.file, (char *)0);
+ return 1;
}
/* Close the current gcov file. Flushes data to disk. Returns nonzero
on failure or error flag set. */
GCOV_LINKAGE int
-gcov_close (void)
+gcov_close(void)
{
- if (gcov_var.file)
- {
+ if (gcov_var.file) {
#if !IN_GCOV
- if (gcov_var.offset && gcov_var.mode < 0)
- gcov_write_block (gcov_var.offset);
+ if (gcov_var.offset && gcov_var.mode < 0)
+ gcov_write_block(gcov_var.offset);
#endif
- fclose (gcov_var.file);
- gcov_var.file = 0;
- gcov_var.length = 0;
- }
+ fclose(gcov_var.file);
+ gcov_var.file = 0;
+ gcov_var.length = 0;
+ }
#if !IN_LIBGCOV
- free (gcov_var.buffer);
- gcov_var.alloc = 0;
- gcov_var.buffer = 0;
+ free(gcov_var.buffer);
+ gcov_var.alloc = 0;
+ gcov_var.buffer = 0;
#endif
- gcov_var.mode = 0;
- return gcov_var.error;
+ gcov_var.mode = 0;
+ return gcov_var.error;
}
#if !IN_LIBGCOV
@@ -181,34 +170,34 @@ gcov_close (void)
not EXPECTED. */
GCOV_LINKAGE int
-gcov_magic (gcov_unsigned_t magic, gcov_unsigned_t expected)
+gcov_magic(gcov_unsigned_t magic, gcov_unsigned_t expected)
{
- if (magic == expected)
- return 1;
- magic = (magic >> 16) | (magic << 16);
- magic = ((magic & 0xff00ff) << 8) | ((magic >> 8) & 0xff00ff);
- if (magic == expected)
- {
- gcov_var.endian = 1;
- return -1;
- }
- return 0;
+ if (magic == expected)
+ return 1;
+ magic = (magic >> 16) | (magic << 16);
+ magic = ((magic & 0xff00ff) << 8) | ((magic >> 8) & 0xff00ff);
+ if (magic == expected) {
+ gcov_var.endian = 1;
+ return -1;
+ }
+ return 0;
}
#endif
#if !IN_LIBGCOV
static void
-gcov_allocate (unsigned length)
+gcov_allocate(unsigned int length)
{
- size_t new_size = gcov_var.alloc;
+ size_t new_size = gcov_var.alloc;
- if (!new_size)
- new_size = GCOV_BLOCK_SIZE;
- new_size += length;
- new_size *= 2;
+ if (!new_size)
+ new_size = GCOV_BLOCK_SIZE;
+ new_size += length;
+ new_size *= 2;
- gcov_var.alloc = new_size;
- gcov_var.buffer = XRESIZEVAR (gcov_unsigned_t, gcov_var.buffer, new_size << 2);
+ gcov_var.alloc = new_size;
+ gcov_var.buffer = XRESIZEVAR(gcov_unsigned_t, gcov_var.buffer,
+ new_size << 2);
}
#endif
@@ -216,52 +205,51 @@ gcov_allocate (unsigned length)
/* Write out the current block, if needs be. */
static void
-gcov_write_block (unsigned size)
+gcov_write_block(unsigned int size)
{
- if (fwrite (gcov_var.buffer, size << 2, 1, gcov_var.file) != 1)
- gcov_var.error = 1;
- gcov_var.start += size;
- gcov_var.offset -= size;
+ if (fwrite(gcov_var.buffer, size << 2, 1, gcov_var.file) != 1)
+ gcov_var.error = 1;
+ gcov_var.start += size;
+ gcov_var.offset -= size;
}
/* Allocate space to write BYTES bytes to the gcov file. Return a
pointer to those bytes, or NULL on failure. */
static gcov_unsigned_t *
-gcov_write_words (unsigned words)
+gcov_write_words(unsigned int words)
{
- gcov_unsigned_t *result;
+ gcov_unsigned_t *result;
- gcc_assert (gcov_var.mode < 0);
+ gcc_assert(gcov_var.mode < 0);
#if IN_LIBGCOV
- if (gcov_var.offset >= GCOV_BLOCK_SIZE)
- {
- gcov_write_block (GCOV_BLOCK_SIZE);
- if (gcov_var.offset)
- {
- gcc_assert (gcov_var.offset == 1);
- memcpy (gcov_var.buffer, gcov_var.buffer + GCOV_BLOCK_SIZE, 4);
+ if (gcov_var.offset >= GCOV_BLOCK_SIZE) {
+ gcov_write_block(GCOV_BLOCK_SIZE);
+ if (gcov_var.offset) {
+ gcc_assert(gcov_var.offset == 1);
+ memcpy(gcov_var.buffer, gcov_var.buffer
+ + GCOV_BLOCK_SIZE, 4);
+ }
}
- }
#else
- if (gcov_var.offset + words > gcov_var.alloc)
- gcov_allocate (gcov_var.offset + words);
+ if (gcov_var.offset + words > gcov_var.alloc)
+ gcov_allocate(gcov_var.offset + words);
#endif
- result = &gcov_var.buffer[gcov_var.offset];
- gcov_var.offset += words;
+ result = &gcov_var.buffer[gcov_var.offset];
+ gcov_var.offset += words;
- return result;
+ return result;
}
/* Write unsigned VALUE to coverage file. Sets error flag
appropriately. */
GCOV_LINKAGE void
-gcov_write_unsigned (gcov_unsigned_t value)
+gcov_write_unsigned(gcov_unsigned_t value)
{
- gcov_unsigned_t *buffer = gcov_write_words (1);
+ gcov_unsigned_t *buffer = gcov_write_words(1);
- buffer[0] = value;
+ buffer[0] = value;
}
/* Write counter VALUE to coverage file. Sets error flag
@@ -269,15 +257,15 @@ gcov_write_unsigned (gcov_unsigned_t value)
#if IN_LIBGCOV
GCOV_LINKAGE void
-gcov_write_counter (gcov_type value)
+gcov_write_counter(gcov_type value)
{
- gcov_unsigned_t *buffer = gcov_write_words (2);
+ gcov_unsigned_t *buffer = gcov_write_words(2);
- buffer[0] = (gcov_unsigned_t) value;
- if (sizeof (value) > sizeof (gcov_unsigned_t))
- buffer[1] = (gcov_unsigned_t) (value >> 32);
- else
- buffer[1] = 0;
+ buffer[0] = (gcov_unsigned_t)value;
+ if (sizeof(value) > sizeof(gcov_unsigned_t))
+ buffer[1] = (gcov_unsigned_t)(value >> 32);
+ else
+ buffer[1] = 0;
}
#endif /* IN_LIBGCOV */
@@ -286,23 +274,22 @@ gcov_write_counter (gcov_type value)
error, overflow flag on overflow */
GCOV_LINKAGE void
-gcov_write_string (const char *string)
+gcov_write_string(const char *string)
{
- unsigned length = 0;
- unsigned alloc = 0;
- gcov_unsigned_t *buffer;
+ unsigned int length = 0;
+ unsigned int alloc = 0;
+ gcov_unsigned_t *buffer;
- if (string)
- {
- length = strlen (string);
- alloc = (length + 4) >> 2;
- }
+ if (string) {
+ length = strlen(string);
+ alloc = (length + 4) >> 2;
+ }
- buffer = gcov_write_words (1 + alloc);
+ buffer = gcov_write_words(1 + alloc);
- buffer[0] = alloc;
- buffer[alloc] = 0;
- memcpy (&buffer[1], string, length);
+ buffer[0] = alloc;
+ buffer[alloc] = 0;
+ memcpy(&buffer[1], string, length);
}
#endif
@@ -311,15 +298,15 @@ gcov_write_string (const char *string)
value to be used for gcov_write_length. */
GCOV_LINKAGE gcov_position_t
-gcov_write_tag (gcov_unsigned_t tag)
+gcov_write_tag(gcov_unsigned_t tag)
{
- gcov_position_t result = gcov_var.start + gcov_var.offset;
- gcov_unsigned_t *buffer = gcov_write_words (2);
+ gcov_position_t result = gcov_var.start + gcov_var.offset;
+ gcov_unsigned_t *buffer = gcov_write_words(2);
- buffer[0] = tag;
- buffer[1] = 0;
+ buffer[0] = tag;
+ buffer[1] = 0;
- return result;
+ return result;
}
/* Write a record length using POSITION, which was returned by
@@ -328,21 +315,21 @@ gcov_write_tag (gcov_unsigned_t tag)
overflow. */
GCOV_LINKAGE void
-gcov_write_length (gcov_position_t position)
+gcov_write_length(gcov_position_t position)
{
- unsigned offset;
- gcov_unsigned_t length;
- gcov_unsigned_t *buffer;
-
- gcc_assert (gcov_var.mode < 0);
- gcc_assert (position + 2 <= gcov_var.start + gcov_var.offset);
- gcc_assert (position >= gcov_var.start);
- offset = position - gcov_var.start;
- length = gcov_var.offset - offset - 2;
- buffer = (gcov_unsigned_t *) &gcov_var.buffer[offset];
- buffer[1] = length;
- if (gcov_var.offset >= GCOV_BLOCK_SIZE)
- gcov_write_block (gcov_var.offset);
+ unsigned int offset;
+ gcov_unsigned_t length;
+ gcov_unsigned_t *buffer;
+
+ gcc_assert(gcov_var.mode < 0);
+ gcc_assert(position + 2 <= gcov_var.start + gcov_var.offset);
+ gcc_assert(position >= gcov_var.start);
+ offset = position - gcov_var.start;
+ length = gcov_var.offset - offset - 2;
+ buffer = (gcov_unsigned_t *) &gcov_var.buffer[offset];
+ buffer[1] = length;
+ if (gcov_var.offset >= GCOV_BLOCK_SIZE)
+ gcov_write_block(gcov_var.offset);
}
#else /* IN_LIBGCOV */
@@ -350,33 +337,32 @@ gcov_write_length (gcov_position_t position)
/* Write a tag TAG and length LENGTH. */
GCOV_LINKAGE void
-gcov_write_tag_length (gcov_unsigned_t tag, gcov_unsigned_t length)
+gcov_write_tag_length(gcov_unsigned_t tag, gcov_unsigned_t length)
{
- gcov_unsigned_t *buffer = gcov_write_words (2);
+ gcov_unsigned_t *buffer = gcov_write_words(2);
- buffer[0] = tag;
- buffer[1] = length;
+ buffer[0] = tag;
+ buffer[1] = length;
}
/* Write a summary structure to the gcov file. Return nonzero on
overflow. */
GCOV_LINKAGE void
-gcov_write_summary (gcov_unsigned_t tag, const struct gcov_summary *summary)
+gcov_write_summary(gcov_unsigned_t tag, const struct gcov_summary *summary)
{
- unsigned ix;
- const struct gcov_ctr_summary *csum;
-
- gcov_write_tag_length (tag, GCOV_TAG_SUMMARY_LENGTH);
- gcov_write_unsigned (summary->checksum);
- for (csum = summary->ctrs, ix = GCOV_COUNTERS_SUMMABLE; ix--; csum++)
- {
- gcov_write_unsigned (csum->num);
- gcov_write_unsigned (csum->runs);
- gcov_write_counter (csum->sum_all);
- gcov_write_counter (csum->run_max);
- gcov_write_counter (csum->sum_max);
- }
+ unsigned int ix;
+ const struct gcov_ctr_summary *csum;
+
+ gcov_write_tag_length(tag, GCOV_TAG_SUMMARY_LENGTH);
+ gcov_write_unsigned(summary->checksum);
+ for (csum = summary->ctrs, ix = GCOV_COUNTERS_SUMMABLE; ix--; csum++) {
+ gcov_write_unsigned(csum->num);
+ gcov_write_unsigned(csum->runs);
+ gcov_write_counter(csum->sum_all);
+ gcov_write_counter(csum->run_max);
+ gcov_write_counter(csum->sum_max);
+ }
}
#endif /* IN_LIBGCOV */
@@ -386,82 +372,81 @@ gcov_write_summary (gcov_unsigned_t tag, const struct gcov_summary *summary)
NULL on failure (read past EOF). */
static const gcov_unsigned_t *
-gcov_read_words (unsigned words)
+gcov_read_words(unsigned int words)
{
- const gcov_unsigned_t *result;
- unsigned excess = gcov_var.length - gcov_var.offset;
+ const gcov_unsigned_t *result;
+ unsigned int excess = gcov_var.length - gcov_var.offset;
- gcc_assert (gcov_var.mode > 0);
- if (excess < words)
- {
- gcov_var.start += gcov_var.offset;
+ gcc_assert(gcov_var.mode > 0);
+ if (excess < words) {
+ gcov_var.start += gcov_var.offset;
#if IN_LIBGCOV
- if (excess)
- {
- gcc_assert (excess == 1);
- memcpy (gcov_var.buffer, gcov_var.buffer + gcov_var.offset, 4);
- }
+ if (excess) {
+ gcc_assert(excess == 1);
+ memcpy(gcov_var.buffer, gcov_var.buffer
+ + gcov_var.offset, 4);
+ }
#else
- memmove (gcov_var.buffer, gcov_var.buffer + gcov_var.offset, excess * 4);
+ memmove(gcov_var.buffer, gcov_var.buffer + gcov_var.offset,
+ excess * 4);
#endif
- gcov_var.offset = 0;
- gcov_var.length = excess;
+ gcov_var.offset = 0;
+ gcov_var.length = excess;
#if IN_LIBGCOV
- gcc_assert (!gcov_var.length || gcov_var.length == 1);
- excess = GCOV_BLOCK_SIZE;
+ gcc_assert(!gcov_var.length || gcov_var.length == 1);
+ excess = GCOV_BLOCK_SIZE;
#else
- if (gcov_var.length + words > gcov_var.alloc)
- gcov_allocate (gcov_var.length + words);
- excess = gcov_var.alloc - gcov_var.length;
+ if (gcov_var.length + words > gcov_var.alloc)
+ gcov_allocate(gcov_var.length + words);
+ excess = gcov_var.alloc - gcov_var.length;
#endif
- excess = fread (gcov_var.buffer + gcov_var.length,
- 1, excess << 2, gcov_var.file) >> 2;
- gcov_var.length += excess;
- if (gcov_var.length < words)
- {
- gcov_var.overread += words - gcov_var.length;
- gcov_var.length = 0;
- return 0;
+ excess = fread(gcov_var.buffer + gcov_var.length,
+ 1, excess << 2, gcov_var.file) >> 2;
+ gcov_var.length += excess;
+ if (gcov_var.length < words) {
+ gcov_var.overread += words - gcov_var.length;
+ gcov_var.length = 0;
+ return 0;
+ }
}
- }
- result = &gcov_var.buffer[gcov_var.offset];
- gcov_var.offset += words;
- return result;
+ result = &gcov_var.buffer[gcov_var.offset];
+ gcov_var.offset += words;
+ return result;
}
/* Read unsigned value from a coverage file. Sets error flag on file
error, overflow flag on overflow */
GCOV_LINKAGE gcov_unsigned_t
-gcov_read_unsigned (void)
+gcov_read_unsigned(void)
{
- gcov_unsigned_t value;
- const gcov_unsigned_t *buffer = gcov_read_words (1);
+ gcov_unsigned_t value;
+ const gcov_unsigned_t *buffer = gcov_read_words(1);
- if (!buffer)
- return 0;
- value = from_file (buffer[0]);
- return value;
+ if (!buffer)
+ return 0;
+ value = from_file(buffer[0]);
+ return value;
}
/* Read counter value from a coverage file. Sets error flag on file
error, overflow flag on overflow */
GCOV_LINKAGE gcov_type
-gcov_read_counter (void)
+gcov_read_counter(void)
{
- gcov_type value;
- const gcov_unsigned_t *buffer = gcov_read_words (2);
-
- if (!buffer)
- return 0;
- value = from_file (buffer[0]);
- if (sizeof (value) > sizeof (gcov_unsigned_t))
- value |= ((gcov_type) from_file (buffer[1])) << 32;
- else if (buffer[1])
- gcov_var.error = -1;
-
- return value;
+ gcov_type value;
+ const gcov_unsigned_t *buffer = gcov_read_words(2);
+
+ if (!buffer)
+ return 0;
+ value = from_file(buffer[0]);
+ if (sizeof(value) > sizeof(gcov_unsigned_t))
+ value |= ((gcov_type) from_file(buffer[1])) << 32;
+ else if (buffer[1])
+ gcov_var.error = -1;
+
+ return value;
}
/* Read string from coverage file. Returns a pointer to a static
@@ -470,32 +455,31 @@ gcov_read_counter (void)
#if !IN_LIBGCOV
GCOV_LINKAGE const char *
-gcov_read_string (void)
+gcov_read_string(void)
{
- unsigned length = gcov_read_unsigned ();
+ unsigned int length = gcov_read_unsigned();
- if (!length)
- return 0;
+ if (!length)
+ return 0;
- return (const char *) gcov_read_words (length);
+ return (const char *) gcov_read_words(length);
}
#endif
GCOV_LINKAGE void
-gcov_read_summary (struct gcov_summary *summary)
+gcov_read_summary(struct gcov_summary *summary)
{
- unsigned ix;
- struct gcov_ctr_summary *csum;
-
- summary->checksum = gcov_read_unsigned ();
- for (csum = summary->ctrs, ix = GCOV_COUNTERS_SUMMABLE; ix--; csum++)
- {
- csum->num = gcov_read_unsigned ();
- csum->runs = gcov_read_unsigned ();
- csum->sum_all = gcov_read_counter ();
- csum->run_max = gcov_read_counter ();
- csum->sum_max = gcov_read_counter ();
- }
+ unsigned int ix;
+ struct gcov_ctr_summary *csum;
+
+ summary->checksum = gcov_read_unsigned();
+ for (csum = summary->ctrs, ix = GCOV_COUNTERS_SUMMABLE; ix--; csum++) {
+ csum->num = gcov_read_unsigned();
+ csum->runs = gcov_read_unsigned();
+ csum->sum_all = gcov_read_counter();
+ csum->run_max = gcov_read_counter();
+ csum->sum_max = gcov_read_counter();
+ }
}
#if !IN_LIBGCOV
@@ -503,18 +487,17 @@ gcov_read_summary (struct gcov_summary *summary)
gcov_position, LENGTH should be a record length. */
GCOV_LINKAGE void
-gcov_sync (gcov_position_t base, gcov_unsigned_t length)
+gcov_sync(gcov_position_t base, gcov_unsigned_t length)
{
- gcc_assert (gcov_var.mode > 0);
- base += length;
- if (base - gcov_var.start <= gcov_var.length)
- gcov_var.offset = base - gcov_var.start;
- else
- {
- gcov_var.offset = gcov_var.length = 0;
- fseek (gcov_var.file, base << 2, SEEK_SET);
- gcov_var.start = ftell (gcov_var.file) >> 2;
- }
+ gcc_assert(gcov_var.mode > 0);
+ base += length;
+ if (base - gcov_var.start <= gcov_var.length)
+ gcov_var.offset = base - gcov_var.start;
+ else {
+ gcov_var.offset = gcov_var.length = 0;
+ fseek(gcov_var.file, base << 2, SEEK_SET);
+ gcov_var.start = ftell(gcov_var.file) >> 2;
+ }
}
#endif
@@ -522,13 +505,13 @@ gcov_sync (gcov_position_t base, gcov_unsigned_t length)
/* Move to a given position in a gcov file. */
GCOV_LINKAGE void
-gcov_seek (gcov_position_t base)
+gcov_seek(gcov_position_t base)
{
- gcc_assert (gcov_var.mode < 0);
- if (gcov_var.offset)
- gcov_write_block (gcov_var.offset);
- fseek (gcov_var.file, base << 2, SEEK_SET);
- gcov_var.start = ftell (gcov_var.file) >> 2;
+ gcc_assert(gcov_var.mode < 0);
+ if (gcov_var.offset)
+ gcov_write_block(gcov_var.offset);
+ fseek(gcov_var.file, base << 2, SEEK_SET);
+ gcov_var.start = ftell(gcov_var.file) >> 2;
}
#endif
@@ -536,13 +519,12 @@ gcov_seek (gcov_position_t base)
/* Return the modification time of the current gcov file. */
GCOV_LINKAGE time_t
-gcov_time (void)
+gcov_time(void)
{
- struct stat status;
+ struct stat status;
- if (fstat (fileno (gcov_var.file), &status))
- return 0;
- else
- return status.st_mtime;
+ if (fstat(fileno(gcov_var.file), &status))
+ return 0;
+ return status.st_mtime;
}
#endif /* IN_GCOV */
diff --git a/src/lib/gcov-io.h b/src/lib/gcov-io.h
index f1df58a..2acb448 100644
--- a/src/lib/gcov-io.h
+++ b/src/lib/gcov-io.h
@@ -105,8 +105,8 @@ permissions described in the GCC Runtime Library Exception, version
basic_block: header int32:flags*
arcs: header int32:block_no arc*
arc: int32:dest_block int32:flags
- lines: header int32:block_no line*
- int32:0 string:NULL
+ lines: header int32:block_no line*
+ int32:0 string:NULL
line: int32:line_no | int32:0 string:filename
The BASIC_BLOCK record holds per-bb flags. The number of blocks
@@ -126,9 +126,9 @@ permissions described in the GCC Runtime Library Exception, version
blocks they are for.
The data file contains the following records.
- data: {unit summary:object summary:program* function-data*}*
+ data: {unit summary:object summary:program* function-data*}*
unit: header int32:checksum
- function-data: announce_function present counts
+ function-data: announce_function present counts
announce_function: header int32:ident
int32:lineno_checksum int32:cfg_checksum
present: header int32:present
@@ -181,35 +181,35 @@ permissions described in the GCC Runtime Library Exception, version
/* About the target */
#if BITS_PER_UNIT == 8
-typedef unsigned gcov_unsigned_t __attribute__ ((mode (SI)));
-typedef unsigned gcov_position_t __attribute__ ((mode (SI)));
+typedef unsigned int gcov_unsigned_t __attribute__ ((mode(SI)));
+typedef unsigned int gcov_position_t __attribute__ ((mode(SI)));
#if LONG_LONG_TYPE_SIZE > 32
-typedef signed gcov_type __attribute__ ((mode (DI)));
+typedef signed int gcov_type __attribute__ ((mode(DI)));
#else
-typedef signed gcov_type __attribute__ ((mode (SI)));
+typedef signed int gcov_type __attribute__ ((mode(SI)));
#endif
#else
#if BITS_PER_UNIT == 16
-typedef unsigned gcov_unsigned_t __attribute__ ((mode (HI)));
-typedef unsigned gcov_position_t __attribute__ ((mode (HI)));
+typedef unsigned int gcov_unsigned_t __attribute__ ((mode(HI)));
+typedef unsigned int gcov_position_t __attribute__ ((mode(HI)));
#if LONG_LONG_TYPE_SIZE > 32
-typedef signed gcov_type __attribute__ ((mode (SI)));
+typedef signed int gcov_type __attribute__ ((mode(SI)));
#else
-typedef signed gcov_type __attribute__ ((mode (HI)));
+typedef signed int gcov_type __attribute__ ((mode(HI)));
#endif
#else
-typedef unsigned gcov_unsigned_t __attribute__ ((mode (QI)));
-typedef unsigned gcov_position_t __attribute__ ((mode (QI)));
+typedef unsigned int gcov_unsigned_t __attribute__ ((mode(QI)));
+typedef unsigned int gcov_position_t __attribute__ ((mode(QI)));
#if LONG_LONG_TYPE_SIZE > 32
-typedef signed gcov_type __attribute__ ((mode (HI)));
+typedef signed int gcov_type __attribute__ ((mode(HI)));
#else
-typedef signed gcov_type __attribute__ ((mode (QI)));
+typedef signed int gcov_type __attribute__ ((mode(QI)));
#endif
#endif
#endif
-#if defined (TARGET_POSIX_IO)
+#if defined(TARGET_POSIX_IO)
#define GCOV_LOCKED 1
#else
#define GCOV_LOCKED 0
@@ -218,8 +218,8 @@ typedef signed gcov_type __attribute__ ((mode (QI)));
#else /* !IN_LIBGCOV */
/* About the host */
-typedef unsigned gcov_unsigned_t;
-typedef unsigned gcov_position_t;
+typedef unsigned int gcov_unsigned_t;
+typedef unsigned int gcov_position_t;
/* gcov_type is typedef'd elsewhere for the compiler */
#if IN_GCOV
#define GCOV_LINKAGE static
@@ -231,7 +231,7 @@ typedef HOST_WIDEST_INT gcov_type;
#define GCOV_TYPE_SIZE (LONG_LONG_TYPE_SIZE > 32 ? 64 : 32)
#endif
-#if defined (HOST_HAS_F_SETLKW)
+#if defined(HOST_HAS_F_SETLKW)
#define GCOV_LOCKED 1
#else
#define GCOV_LOCKED 0
@@ -270,7 +270,7 @@ typedef HOST_WIDEST_INT gcov_type;
#pragma GCC poison gcov_read_string gcov_sync gcov_time gcov_magic
#ifdef HAVE_GAS_HIDDEN
-#define ATTRIBUTE_HIDDEN __attribute__ ((__visibility__ ("hidden")))
+#define ATTRIBUTE_HIDDEN __attribute__ ((__visibility__("hidden")))
#else
#define ATTRIBUTE_HIDDEN
#endif
@@ -300,11 +300,11 @@ typedef HOST_WIDEST_INT gcov_type;
#include "gcov-iov.h"
/* Convert a magic or version number to a 4 character string. */
-#define GCOV_UNSIGNED2STRING(ARRAY,VALUE) \
- ((ARRAY)[0] = (char)((VALUE) >> 24), \
- (ARRAY)[1] = (char)((VALUE) >> 16), \
- (ARRAY)[2] = (char)((VALUE) >> 8), \
- (ARRAY)[3] = (char)((VALUE) >> 0))
+#define GCOV_UNSIGNED2STRING(ARRAY, VALUE) \
+ ((ARRAY)[0] = (char)((VALUE) >> 24), \
+ (ARRAY)[1] = (char)((VALUE) >> 16), \
+ (ARRAY)[2] = (char)((VALUE) >> 8), \
+ (ARRAY)[3] = (char)((VALUE) >> 0))
/* The record tags. Values [1..3f] are for tags which may be in either
file. Values [41..9f] for those in the note file and [a1..ff] for
@@ -320,7 +320,7 @@ typedef HOST_WIDEST_INT gcov_type;
#define GCOV_TAG_ARCS_LENGTH(NUM) (1 + (NUM) * 2)
#define GCOV_TAG_ARCS_NUM(LENGTH) (((LENGTH) - 1) / 2)
#define GCOV_TAG_LINES ((gcov_unsigned_t)0x01450000)
-#define GCOV_TAG_COUNTER_BASE ((gcov_unsigned_t)0x01a10000)
+#define GCOV_TAG_COUNTER_BASE ((gcov_unsigned_t)0x01a10000)
#define GCOV_TAG_COUNTER_LENGTH(NUM) ((NUM) * 2)
#define GCOV_TAG_COUNTER_NUM(LENGTH) ((LENGTH) / 2)
#define GCOV_TAG_OBJECT_SUMMARY ((gcov_unsigned_t)0xa1000000) /* Obsolete */
@@ -329,7 +329,7 @@ typedef HOST_WIDEST_INT gcov_type;
(1 + GCOV_COUNTERS_SUMMABLE * (2 + 3 * 2))
/* Counters that are collected. */
-#define GCOV_COUNTER_ARCS 0 /* Arc transitions. */
+#define GCOV_COUNTER_ARCS 0 /* Arc transitions. */
#define GCOV_COUNTERS_SUMMABLE 1 /* Counters which can be
summed. */
#define GCOV_FIRST_VALUE_COUNTER 1 /* The first of counters used for value
@@ -355,13 +355,13 @@ typedef HOST_WIDEST_INT gcov_type;
/* Number of counters used for value profiling. */
#define GCOV_N_VALUE_COUNTERS \
- (GCOV_LAST_VALUE_COUNTER - GCOV_FIRST_VALUE_COUNTER + 1)
+ (GCOV_LAST_VALUE_COUNTER - GCOV_FIRST_VALUE_COUNTER + 1)
- /* A list of human readable names of the counters */
+/* A list of human readable names of the counters */
#define GCOV_COUNTER_NAMES {"arcs", "interval", "pow2", "single", \
"delta", "indirect_call", "average", "ior"}
- /* Names of merge functions for counters. */
+/* Names of merge functions for counters. */
#define GCOV_MERGE_FUNCTIONS {"__gcov_merge_add", \
"__gcov_merge_add", \
"__gcov_merge_add", \
@@ -376,10 +376,10 @@ typedef HOST_WIDEST_INT gcov_type;
(GCOV_TAG_COUNTER_BASE + ((gcov_unsigned_t)(COUNT) << 17))
/* Convert a tag to a counter. */
#define GCOV_COUNTER_FOR_TAG(TAG) \
- ((unsigned)(((TAG) - GCOV_TAG_COUNTER_BASE) >> 17))
+ ((unsigned int)(((TAG) - GCOV_TAG_COUNTER_BASE) >> 17))
/* Check whether a tag is a counter tag. */
#define GCOV_TAG_IS_COUNTER(TAG) \
- (!((TAG) & 0xFFFF) && GCOV_COUNTER_FOR_TAG (TAG) < GCOV_COUNTERS)
+ (!((TAG) & 0xFFFF) && GCOV_COUNTER_FOR_TAG(TAG) < GCOV_COUNTERS)
/* The tag level mask has 1's in the position of the inner levels, &
the lsb of the current level, and zero on the current and outer
@@ -387,39 +387,37 @@ typedef HOST_WIDEST_INT gcov_type;
#define GCOV_TAG_MASK(TAG) (((TAG) - 1) ^ (TAG))
/* Return nonzero if SUB is an immediate subtag of TAG. */
-#define GCOV_TAG_IS_SUBTAG(TAG,SUB) \
- (GCOV_TAG_MASK (TAG) >> 8 == GCOV_TAG_MASK (SUB) \
+#define GCOV_TAG_IS_SUBTAG(TAG, SUB) \
+ (GCOV_TAG_MASK(TAG) >> 8 == GCOV_TAG_MASK(SUB) \
&& !(((SUB) ^ (TAG)) & ~GCOV_TAG_MASK(TAG)))
/* Return nonzero if SUB is at a sublevel to TAG. */
-#define GCOV_TAG_IS_SUBLEVEL(TAG,SUB) \
- (GCOV_TAG_MASK (TAG) > GCOV_TAG_MASK (SUB))
+#define GCOV_TAG_IS_SUBLEVEL(TAG, SUB) \
+ (GCOV_TAG_MASK(TAG) > GCOV_TAG_MASK(SUB))
/* Basic block flags. */
#define GCOV_BLOCK_UNEXPECTED (1 << 1)
/* Arc flags. */
-#define GCOV_ARC_ON_TREE (1 << 0)
+#define GCOV_ARC_ON_TREE (1 << 0)
#define GCOV_ARC_FAKE (1 << 1)
#define GCOV_ARC_FALLTHROUGH (1 << 2)
/* Structured records. */
/* Cumulative counter data. */
-struct gcov_ctr_summary
-{
- gcov_unsigned_t num; /* number of counters. */
- gcov_unsigned_t runs; /* number of program runs */
- gcov_type sum_all; /* sum of all counters accumulated. */
- gcov_type run_max; /* maximum value on a single run. */
- gcov_type sum_max; /* sum of individual run max values. */
+struct gcov_ctr_summary {
+ gcov_unsigned_t num; /* number of counters. */
+ gcov_unsigned_t runs; /* number of program runs */
+ gcov_type sum_all; /* sum of all counters accumulated. */
+ gcov_type run_max; /* maximum value on a single run. */
+ gcov_type sum_max; /* sum of individual run max values. */
};
/* Object & program summary record. */
-struct gcov_summary
-{
- gcov_unsigned_t checksum; /* checksum of program */
- struct gcov_ctr_summary ctrs[GCOV_COUNTERS_SUMMABLE];
+struct gcov_summary {
+ gcov_unsigned_t checksum; /* checksum of program */
+ struct gcov_ctr_summary ctrs[GCOV_COUNTERS_SUMMABLE];
};
/* Structures embedded in coverage program. The structures generated
@@ -427,10 +425,9 @@ struct gcov_summary
#if IN_LIBGCOV
/* Information about counters for a single function. */
-struct gcov_ctr_info
-{
- gcov_unsigned_t num; /* number of counters. */
- gcov_type *values; /* their values. */
+struct gcov_ctr_info {
+ gcov_unsigned_t num; /* number of counters. */
+ gcov_type *values; /* their values. */
};
/* Information about a single function. This uses the trailing array
@@ -439,74 +436,81 @@ struct gcov_ctr_info
comdat functions was selected -- it points to the gcov_info object
of the object file containing the selected comdat function. */
-struct gcov_fn_info
-{
- const struct gcov_info *key; /* comdat key */
- gcov_unsigned_t ident; /* unique ident of function */
- gcov_unsigned_t lineno_checksum; /* function lineo_checksum */
- gcov_unsigned_t cfg_checksum; /* function cfg checksum */
- struct gcov_ctr_info ctrs[0]; /* instrumented counters */
+struct gcov_fn_info {
+ const struct gcov_info *key; /* comdat key */
+ gcov_unsigned_t ident; /* unique ident of function */
+ gcov_unsigned_t lineno_checksum; /* function lineo_checksum */
+ gcov_unsigned_t cfg_checksum; /* function cfg checksum */
+ struct gcov_ctr_info ctrs[0]; /* instrumented counters */
};
/* Type of function used to merge counters. */
-typedef void (*gcov_merge_fn) (gcov_type *, gcov_unsigned_t);
+typedef void (*gcov_merge_fn)(gcov_type *, gcov_unsigned_t);
/* Information about a single object file. */
-struct gcov_info
-{
- gcov_unsigned_t version; /* expected version number */
- struct gcov_info *next; /* link to next, used by libgcov */
+struct gcov_info {
+ /* expected version number */
+ gcov_unsigned_t version;
- gcov_unsigned_t stamp; /* uniquifying time stamp */
- const char *filename; /* output file name */
+ /* link to next, used by libgcov */
+ struct gcov_info *next;
- gcov_merge_fn merge[GCOV_COUNTERS]; /* merge functions (null for
- unused) */
+ /* uniquifying time stamp */
+ gcov_unsigned_t stamp;
- unsigned n_functions; /* number of functions */
- const struct gcov_fn_info *const *functions; /* pointer to pointers
- to function information */
+ /* output file name */
+ const char *filename;
+
+ /* merge functions (null for unused) */
+ gcov_merge_fn merge[GCOV_COUNTERS];
+
+ /* number of functions */
+ unsigned int n_functions;
+
+ /* pointer to pointers to function information */
+ const struct gcov_fn_info *const *functions;
};
/* Register a new object file module. */
-extern void __gcov_init (struct gcov_info *) ATTRIBUTE_HIDDEN;
+extern void __gcov_init(struct gcov_info *) ATTRIBUTE_HIDDEN;
#ifndef __COREBOOT__
/* Called before fork, to avoid double counting. */
-extern void __gcov_flush (void) ATTRIBUTE_HIDDEN;
+extern void __gcov_flush(void) ATTRIBUTE_HIDDEN;
#endif
/* The merge function that just sums the counters. */
-extern void __gcov_merge_add (gcov_type *, unsigned) ATTRIBUTE_HIDDEN;
+extern void __gcov_merge_add(gcov_type *, unsigned int) ATTRIBUTE_HIDDEN;
/* The merge function to choose the most common value. */
-extern void __gcov_merge_single (gcov_type *, unsigned) ATTRIBUTE_HIDDEN;
+extern void __gcov_merge_single(gcov_type *, unsigned int) ATTRIBUTE_HIDDEN;
/* The merge function to choose the most common difference between
consecutive values. */
-extern void __gcov_merge_delta (gcov_type *, unsigned) ATTRIBUTE_HIDDEN;
+extern void __gcov_merge_delta(gcov_type *, unsigned int) ATTRIBUTE_HIDDEN;
/* The merge function that just ors the counters together. */
-extern void __gcov_merge_ior (gcov_type *, unsigned) ATTRIBUTE_HIDDEN;
+extern void __gcov_merge_ior(gcov_type *, unsigned int) ATTRIBUTE_HIDDEN;
/* The profiler functions. */
-extern void __gcov_interval_profiler (gcov_type *, gcov_type, int, unsigned);
-extern void __gcov_pow2_profiler (gcov_type *, gcov_type);
-extern void __gcov_one_value_profiler (gcov_type *, gcov_type);
-extern void __gcov_indirect_call_profiler (gcov_type *, gcov_type, void *, void *);
-extern void __gcov_average_profiler (gcov_type *, gcov_type);
-extern void __gcov_ior_profiler (gcov_type *, gcov_type);
+extern void __gcov_interval_profiler(gcov_type *, gcov_type, int, unsigned int);
+extern void __gcov_pow2_profiler(gcov_type *, gcov_type);
+extern void __gcov_one_value_profiler(gcov_type *, gcov_type);
+extern void __gcov_indirect_call_profiler(gcov_type *, gcov_type, void *,
+ void *);
+extern void __gcov_average_profiler(gcov_type *, gcov_type);
+extern void __gcov_ior_profiler(gcov_type *, gcov_type);
#ifndef inhibit_libc
/* The wrappers around some library functions.. */
-extern pid_t __gcov_fork (void) ATTRIBUTE_HIDDEN;
-extern int __gcov_execl (const char *, char *, ...) ATTRIBUTE_HIDDEN;
-extern int __gcov_execlp (const char *, char *, ...) ATTRIBUTE_HIDDEN;
-extern int __gcov_execle (const char *, char *, ...) ATTRIBUTE_HIDDEN;
-extern int __gcov_execv (const char *, char *const []) ATTRIBUTE_HIDDEN;
-extern int __gcov_execvp (const char *, char *const []) ATTRIBUTE_HIDDEN;
-extern int __gcov_execve (const char *, char *const [], char *const [])
- ATTRIBUTE_HIDDEN;
+extern pid_t __gcov_fork(void) ATTRIBUTE_HIDDEN;
+extern int __gcov_execl(const char *, char *, ...) ATTRIBUTE_HIDDEN;
+extern int __gcov_execlp(const char *, char *, ...) ATTRIBUTE_HIDDEN;
+extern int __gcov_execle(const char *, char *, ...) ATTRIBUTE_HIDDEN;
+extern int __gcov_execv(const char *, char *const []) ATTRIBUTE_HIDDEN;
+extern int __gcov_execvp(const char *, char *const []) ATTRIBUTE_HIDDEN;
+extern int __gcov_execve(const char *, char *const [], char *const [])
+ ATTRIBUTE_HIDDEN;
#endif
#endif /* IN_LIBGCOV */
@@ -516,27 +520,29 @@ extern int __gcov_execve (const char *, char *const [], char *const [])
/* Optimum number of gcov_unsigned_t's read from or written to disk. */
#define GCOV_BLOCK_SIZE (1 << 10)
-GCOV_LINKAGE struct gcov_var
-{
- FILE *file;
- gcov_position_t start; /* Position of first byte of block */
- unsigned offset; /* Read/write position within the block. */
- unsigned length; /* Read limit in the block. */
- unsigned overread; /* Number of words overread. */
- int error; /* < 0 overflow, > 0 disk error. */
- int mode; /* < 0 writing, > 0 reading */
+GCOV_LINKAGE struct gcov_var {
+ FILE *file;
+ gcov_position_t start; /* Position of first byte of block */
+ unsigned int offset; /* Read/write position within the block. */
+ unsigned int length; /* Read limit in the block. */
+ unsigned int overread; /* Number of words overread. */
+ int error; /* < 0 overflow, > 0 disk error. */
+ int mode; /* < 0 writing, > 0 reading */
#if IN_LIBGCOV
- /* Holds one block plus 4 bytes, thus all coverage reads & writes
- fit within this buffer and we always can transfer GCOV_BLOCK_SIZE
- to and from the disk. libgcov never backtracks and only writes 4
- or 8 byte objects. */
- gcov_unsigned_t buffer[GCOV_BLOCK_SIZE + 1];
+ /* Holds one block plus 4 bytes, thus all coverage reads & writes
+ * fit within this buffer and we always can transfer GCOV_BLOCK_SIZE
+ * to and from the disk. libgcov never backtracks and only writes 4
+ * or 8 byte objects.
+ */
+ gcov_unsigned_t buffer[GCOV_BLOCK_SIZE + 1];
#else
- int endian; /* Swap endianness. */
- /* Holds a variable length block, as the compiler can write
- strings and needs to backtrack. */
- size_t alloc;
- gcov_unsigned_t *buffer;
+ int endian; /* Swap endianness. */
+
+ /* Holds a variable length block, as the compiler can write
+ * strings and needs to backtrack.
+ */
+ size_t alloc;
+ gcov_unsigned_t *buffer;
#endif
} gcov_var ATTRIBUTE_HIDDEN;
@@ -550,83 +556,79 @@ GCOV_LINKAGE struct gcov_var
functions for writing. Your file may become corrupted if you break
these invariants. */
#if IN_LIBGCOV
-GCOV_LINKAGE int gcov_open (const char */*name*/) ATTRIBUTE_HIDDEN;
+GCOV_LINKAGE int gcov_open(const char */*name*/) ATTRIBUTE_HIDDEN;
#else
-GCOV_LINKAGE int gcov_open (const char */*name*/, int /*direction*/);
-GCOV_LINKAGE int gcov_magic (gcov_unsigned_t, gcov_unsigned_t);
+GCOV_LINKAGE int gcov_open(const char */*name*/, int /*direction*/);
+GCOV_LINKAGE int gcov_magic(gcov_unsigned_t, gcov_unsigned_t);
#endif
-GCOV_LINKAGE int gcov_close (void) ATTRIBUTE_HIDDEN;
+GCOV_LINKAGE int gcov_close(void) ATTRIBUTE_HIDDEN;
/* Available everywhere. */
-static gcov_position_t gcov_position (void);
-static int gcov_is_error (void);
+static gcov_position_t gcov_position(void);
+static int gcov_is_error(void);
-GCOV_LINKAGE gcov_unsigned_t gcov_read_unsigned (void) ATTRIBUTE_HIDDEN;
-GCOV_LINKAGE gcov_type gcov_read_counter (void) ATTRIBUTE_HIDDEN;
-GCOV_LINKAGE void gcov_read_summary (struct gcov_summary *) ATTRIBUTE_HIDDEN;
+GCOV_LINKAGE gcov_unsigned_t gcov_read_unsigned(void) ATTRIBUTE_HIDDEN;
+GCOV_LINKAGE gcov_type gcov_read_counter(void) ATTRIBUTE_HIDDEN;
+GCOV_LINKAGE void gcov_read_summary(struct gcov_summary *) ATTRIBUTE_HIDDEN;
#if IN_LIBGCOV
/* Available only in libgcov */
-GCOV_LINKAGE void gcov_write_counter (gcov_type) ATTRIBUTE_HIDDEN;
-GCOV_LINKAGE void gcov_write_tag_length (gcov_unsigned_t, gcov_unsigned_t)
- ATTRIBUTE_HIDDEN;
-GCOV_LINKAGE void gcov_write_summary (gcov_unsigned_t /*tag*/,
- const struct gcov_summary *)
- ATTRIBUTE_HIDDEN;
-static void gcov_rewrite (void);
-GCOV_LINKAGE void gcov_seek (gcov_position_t /*position*/) ATTRIBUTE_HIDDEN;
+GCOV_LINKAGE void gcov_write_counter(gcov_type) ATTRIBUTE_HIDDEN;
+GCOV_LINKAGE void gcov_write_tag_length(gcov_unsigned_t, gcov_unsigned_t)
+ ATTRIBUTE_HIDDEN;
+GCOV_LINKAGE void gcov_write_summary(gcov_unsigned_t /*tag*/,
+ const struct gcov_summary *) ATTRIBUTE_HIDDEN;
+static void gcov_rewrite(void);
+GCOV_LINKAGE void gcov_seek(gcov_position_t /*position*/) ATTRIBUTE_HIDDEN;
#else
/* Available outside libgcov */
-GCOV_LINKAGE const char *gcov_read_string (void);
-GCOV_LINKAGE void gcov_sync (gcov_position_t /*base*/,
+GCOV_LINKAGE const char *gcov_read_string(void);
+GCOV_LINKAGE void gcov_sync(gcov_position_t /*base*/,
gcov_unsigned_t /*length */);
#endif
#if !IN_GCOV
/* Available outside gcov */
-GCOV_LINKAGE void gcov_write_unsigned (gcov_unsigned_t) ATTRIBUTE_HIDDEN;
+GCOV_LINKAGE void gcov_write_unsigned(gcov_unsigned_t) ATTRIBUTE_HIDDEN;
#endif
#if !IN_GCOV && !IN_LIBGCOV
/* Available only in compiler */
-GCOV_LINKAGE void gcov_write_string (const char *);
-GCOV_LINKAGE gcov_position_t gcov_write_tag (gcov_unsigned_t);
-GCOV_LINKAGE void gcov_write_length (gcov_position_t /*position*/);
+GCOV_LINKAGE void gcov_write_string(const char *);
+GCOV_LINKAGE gcov_position_t gcov_write_tag(gcov_unsigned_t);
+GCOV_LINKAGE void gcov_write_length(gcov_position_t /*position*/);
#endif
#if IN_GCOV > 0
/* Available in gcov */
-GCOV_LINKAGE time_t gcov_time (void);
+GCOV_LINKAGE time_t gcov_time(void);
#endif
/* Save the current position in the gcov file. */
-static inline gcov_position_t
-gcov_position (void)
+static inline gcov_position_t gcov_position(void)
{
- gcc_assert (gcov_var.mode > 0);
- return gcov_var.start + gcov_var.offset;
+ gcc_assert(gcov_var.mode > 0);
+ return gcov_var.start + gcov_var.offset;
}
/* Return nonzero if the error flag is set. */
-static inline int
-gcov_is_error (void)
+static inline int gcov_is_error(void)
{
- return gcov_var.file ? gcov_var.error : 1;
+ return gcov_var.file ? gcov_var.error : 1;
}
#if IN_LIBGCOV
/* Move to beginning of file and initialize for writing. */
-static inline void
-gcov_rewrite (void)
+static inline void gcov_rewrite(void)
{
- gcc_assert (gcov_var.mode > 0);
- gcov_var.mode = -1;
- gcov_var.start = 0;
- gcov_var.offset = 0;
- fseek (gcov_var.file, 0L, SEEK_SET);
+ gcc_assert(gcov_var.mode > 0);
+ gcov_var.mode = -1;
+ gcov_var.start = 0;
+ gcov_var.offset = 0;
+ fseek(gcov_var.file, 0L, SEEK_SET);
}
#endif
diff --git a/src/lib/generic_dump_spd.c b/src/lib/generic_dump_spd.c
index d61ce1e..2e53a9d 100644
--- a/src/lib/generic_dump_spd.c
+++ b/src/lib/generic_dump_spd.c
@@ -7,13 +7,13 @@ static void dump_spd_registers(const struct mem_controller *ctrl)
{
int i;
printk(BIOS_DEBUG, "\n");
- for(i = 0; i < 4; i++) {
- unsigned device;
+ for (i = 0; i < 4; i++) {
+ unsigned int device;
device = ctrl->channel0[i];
if (device) {
int j;
printk(BIOS_DEBUG, "dimm: %02x.0: %02x", i, device);
- for(j = 0; j < 256; j++) {
+ for (j = 0; j < 256; j++) {
int status;
unsigned char byte;
if ((j & 0xf) == 0)
@@ -32,7 +32,7 @@ static void dump_spd_registers(const struct mem_controller *ctrl)
if (device) {
int j;
printk(BIOS_DEBUG, "dimm: %02x.1: %02x", i, device);
- for(j = 0; j < 256; j++) {
+ for (j = 0; j < 256; j++) {
int status;
unsigned char byte;
if ((j & 0xf) == 0)
@@ -53,18 +53,17 @@ static void dump_spd_registers(const struct mem_controller *ctrl)
#if 0
void dump_spd_registers(void)
{
- unsigned device;
+ unsigned int device;
device = SMBUS_MEM_DEVICE_START;
printk(BIOS_DEBUG, "\n");
- while(device <= SMBUS_MEM_DEVICE_END) {
+ while (device <= SMBUS_MEM_DEVICE_END) {
int status = 0;
int i;
printk(BIOS_DEBUG, "dimm %02x", device);
- for(i = 0; (i < 256) && (status == 0); i++) {
+ for (i = 0; (i < 256) && (status == 0); i++) {
unsigned char byte;
- if ((i % 20) == 0) {
+ if ((i % 20) == 0)
printk(BIOS_DEBUG, "\n%3d: ", i);
- }
status = smbus_read_byte(device, i, &byte);
if (status != 0) {
printk(BIOS_DEBUG, "bad device\n");
diff --git a/src/lib/generic_sdram.c b/src/lib/generic_sdram.c
index a79d822..801ae61 100644
--- a/src/lib/generic_sdram.c
+++ b/src/lib/generic_sdram.c
@@ -2,14 +2,15 @@
/* Setup SDRAM */
#if CONFIG_RAMINIT_SYSINFO
-void sdram_initialize(int controllers, const struct mem_controller *ctrl, void *sysinfo)
+void sdram_initialize(int controllers, const struct mem_controller *ctrl,
+ void *sysinfo)
#else
void sdram_initialize(int controllers, const struct mem_controller *ctrl)
#endif
{
int i;
/* Set the registers we can set once to reasonable values */
- for(i = 0; i < controllers; i++) {
+ for (i = 0; i < controllers; i++) {
printk(BIOS_DEBUG, "Ram1.%02x\n", i);
#if CONFIG_RAMINIT_SYSINFO
@@ -20,13 +21,13 @@ void sdram_initialize(int controllers, const struct mem_controller *ctrl)
}
/* Now setup those things we can auto detect */
- for(i = 0; i < controllers; i++) {
+ for (i = 0; i < controllers; i++) {
printk(BIOS_DEBUG, "Ram2.%02x\n", i);
#if CONFIG_RAMINIT_SYSINFO
sdram_set_spd_registers(ctrl + i, sysinfo);
#else
- sdram_set_spd_registers(ctrl + i);
+ sdram_set_spd_registers(ctrl + i);
#endif
}
diff --git a/src/lib/gpio.c b/src/lib/gpio.c
index 03cc455..9f472db 100644
--- a/src/lib/gpio.c
+++ b/src/lib/gpio.c
@@ -137,7 +137,7 @@ int _gpio_base3_value(gpio_t gpio[], int num_gpio, int binary_first)
* now. We know that there can be no binary numbers 1020-102X.
*/
if (binary_first && !has_z) {
- switch(temp) {
+ switch (temp) {
case 0: /* Ignore '0' digits. */
break;
case 1: /* Account for binaries 0 to 2^index - 1. */
@@ -146,6 +146,7 @@ int _gpio_base3_value(gpio_t gpio[], int num_gpio, int binary_first)
case 2: /* Account for binaries 0 to 2^(index+1) - 1. */
binary_below += 1 << (index + 1);
has_z = 1;
+ break;
}
}
}
diff --git a/src/lib/halt.c b/src/lib/halt.c
index 8482ef9..67ae2ee 100644
--- a/src/lib/halt.c
+++ b/src/lib/halt.c
@@ -17,8 +17,8 @@
#include <arch/hlt.h>
#include <halt.h>
-void halt(void) {
- while (1) {
+void halt(void)
+{
+ while (1)
hlt();
- }
}
diff --git a/src/lib/hardwaremain.c b/src/lib/hardwaremain.c
index 9c127ff..d15d413 100644
--- a/src/lib/hardwaremain.c
+++ b/src/lib/hardwaremain.c
@@ -283,7 +283,7 @@ static void bs_run_timers(int drain) {}
#endif
static void bs_call_callbacks(struct boot_state *state,
- boot_state_sequence_t seq)
+ boot_state_sequence_t seq)
{
struct boot_phase *phase = &state->phases[seq];
@@ -385,8 +385,8 @@ static void bs_walk_state_machine(void)
}
static int boot_state_sched_callback(struct boot_state *state,
- struct boot_state_callback *bscb,
- boot_state_sequence_t seq)
+ struct boot_state_callback *bscb,
+ boot_state_sequence_t seq)
{
if (state->complete) {
printk(BIOS_WARNING,
@@ -403,7 +403,7 @@ static int boot_state_sched_callback(struct boot_state *state,
}
int boot_state_sched_on_entry(struct boot_state_callback *bscb,
- boot_state_t state_id)
+ boot_state_t state_id)
{
struct boot_state *state = &boot_states[state_id];
@@ -411,7 +411,7 @@ int boot_state_sched_on_entry(struct boot_state_callback *bscb,
}
int boot_state_sched_on_exit(struct boot_state_callback *bscb,
- boot_state_t state_id)
+ boot_state_t state_id)
{
struct boot_state *state = &boot_states[state_id];
@@ -495,7 +495,7 @@ int boot_state_block(boot_state_t state, boot_state_sequence_t seq)
/* Blocking a previously ran state is not appropriate. */
if (current_phase.state_id > state ||
- (current_phase.state_id == state && current_phase.seq > seq) ) {
+ (current_phase.state_id == state && current_phase.seq > seq)) {
printk(BIOS_WARNING,
"BS: Completed state (%d, %d) block attempted.\n",
state, seq);
@@ -514,7 +514,7 @@ int boot_state_unblock(boot_state_t state, boot_state_sequence_t seq)
/* Blocking a previously ran state is not appropriate. */
if (current_phase.state_id > state ||
- (current_phase.state_id == state && current_phase.seq > seq) ) {
+ (current_phase.state_id == state && current_phase.seq > seq)) {
printk(BIOS_WARNING,
"BS: Completed state (%d, %d) unblock attempted.\n",
state, seq);
diff --git a/src/lib/imd.c b/src/lib/imd.c
index 2fc6fac..4e44247 100644
--- a/src/lib/imd.c
+++ b/src/lib/imd.c
@@ -166,7 +166,9 @@ static int imdr_create_empty(struct imdr *imdr, size_t root_size,
if (root_size < (sizeof(*rp) + sizeof(*r)))
return -1;
- /* For simplicity don't allow sizes or alignments to exceed LIMIT_ALIGN. */
+ /* For simplicity don't allow sizes or alignments to exceed
+ * LIMIT_ALIGN.
+ */
if (root_size > LIMIT_ALIGN || entry_align > LIMIT_ALIGN)
return -1;
@@ -438,7 +440,7 @@ int imd_create_tiered_empty(struct imd *imd,
size_t lg_root_size, size_t lg_entry_align,
size_t sm_root_size, size_t sm_entry_align)
{
- size_t sm_region_size;;
+ size_t sm_region_size;
const struct imd_entry *e;
struct imdr *imdr;
@@ -636,7 +638,7 @@ int imd_entry_remove(const struct imd *imd, const struct imd_entry *entry)
imdr = imd_entry_to_imdr(imd, entry);
if (imdr == NULL)
- return - 1;
+ return -1;
r = imdr_root(imdr);
diff --git a/src/lib/imd_cbmem.c b/src/lib/imd_cbmem.c
index b0273f4..5f1e5f8 100644
--- a/src/lib/imd_cbmem.c
+++ b/src/lib/imd_cbmem.c
@@ -62,14 +62,14 @@ static inline const struct imd_entry *cbmem_to_imd(const struct cbmem_entry *e)
/* These are the different situations to handle:
* CONFIG_EARLY_CBMEM_INIT:
- * In ramstage cbmem_initialize() attempts a recovery of the
- * cbmem region set up by romstage. It uses cbmem_top() as the
- * starting point of recovery.
+ * In ramstage cbmem_initialize() attempts a recovery of the
+ * cbmem region set up by romstage. It uses cbmem_top() as the
+ * starting point of recovery.
*
- * In romstage, similar to ramstage, cbmem_initialize() needs to
- * attempt recovery of the cbmem area using cbmem_top() as the limit.
- * cbmem_initialize_empty() initializes an empty cbmem area from
- * cbmem_top();
+ * In romstage, similar to ramstage, cbmem_initialize() needs to
+ * attempt recovery of the cbmem area using cbmem_top() as the limit.
+ * cbmem_initialize_empty() initializes an empty cbmem area from
+ * cbmem_top();
*
*/
static struct imd *imd_init_backing(struct imd *backing)
diff --git a/src/lib/jpeg.c b/src/lib/jpeg.c
index 511f63e..3dfbe72 100644
--- a/src/lib/jpeg.c
+++ b/src/lib/jpeg.c
@@ -166,7 +166,8 @@ static int readtables(int till)
for (;;) {
if (getbyte() != 0xff)
return -1;
- if ((m = getbyte()) == till)
+ m = getbyte();
+ if (m == till)
break;
switch (m) {
@@ -267,15 +268,15 @@ void jpeg_fetch_size(unsigned char *buf, int *width, int *height)
int jpeg_check_size(unsigned char *buf, int width, int height)
{
- datap = buf;
+ datap = buf;
getbyte();
getbyte();
readtables(M_SOF0);
getword();
getbyte();
- if (height != getword() || width != getword())
+ if (height != getword() || width != getword())
return 0;
- return 1;
+ return 1;
}
int jpeg_decode(unsigned char *buf, unsigned char *pic,
@@ -353,7 +354,8 @@ int jpeg_decode(unsigned char *buf, unsigned char *pic,
if (dscans[0].cid != 1 || dscans[1].cid != 2 || dscans[2].cid != 3)
return ERR_NOT_YCBCR_221111;
- if (dscans[0].hv != 0x22 || dscans[1].hv != 0x11 || dscans[2].hv != 0x11)
+ if (dscans[0].hv != 0x22 || dscans[1].hv != 0x11
+ || dscans[2].hv != 0x11)
return ERR_NOT_YCBCR_221111;
mcusx = width >> 4;
@@ -385,26 +387,35 @@ int jpeg_decode(unsigned char *buf, unsigned char *pic,
return ERR_WRONG_MARKER;
decode_mcus(&glob_in, decdata->dcts, 6, dscans, max);
- idct(decdata->dcts, decdata->out, decdata->dquant[0], IFIX(128.5), max[0]);
- idct(decdata->dcts + 64, decdata->out + 64, decdata->dquant[0], IFIX(128.5), max[1]);
- idct(decdata->dcts + 128, decdata->out + 128, decdata->dquant[0], IFIX(128.5), max[2]);
- idct(decdata->dcts + 192, decdata->out + 192, decdata->dquant[0], IFIX(128.5), max[3]);
- idct(decdata->dcts + 256, decdata->out + 256, decdata->dquant[1], IFIX(0.5), max[4]);
- idct(decdata->dcts + 320, decdata->out + 320, decdata->dquant[2], IFIX(0.5), max[5]);
+ idct(decdata->dcts, decdata->out, decdata->dquant[0],
+ IFIX(128.5), max[0]);
+ idct(decdata->dcts + 64, decdata->out + 64,
+ decdata->dquant[0], IFIX(128.5), max[1]);
+ idct(decdata->dcts + 128, decdata->out + 128,
+ decdata->dquant[0], IFIX(128.5), max[2]);
+ idct(decdata->dcts + 192, decdata->out + 192,
+ decdata->dquant[0], IFIX(128.5), max[3]);
+ idct(decdata->dcts + 256, decdata->out + 256,
+ decdata->dquant[1], IFIX(0.5), max[4]);
+ idct(decdata->dcts + 320, decdata->out + 320,
+ decdata->dquant[2], IFIX(0.5), max[5]);
switch (depth) {
case 32:
- col221111_32(decdata->out, pic + (my * 16 * mcusx + mx) * 16 * 4, mcusx * 16 * 4);
+ col221111_32(decdata->out, pic + (my * 16
+ * mcusx + mx) * 16 * 4, mcusx * 16 * 4);
break;
case 24:
- col221111(decdata->out, pic + (my * 16 * mcusx + mx) * 16 * 3, mcusx * 16 * 3);
+ col221111(decdata->out, pic + (my * 16
+ * mcusx + mx) * 16 * 3, mcusx * 16 * 3);
break;
case 16:
- col221111_16(decdata->out, pic + (my * 16 * mcusx + mx) * (16 * 2), mcusx * (16 * 2));
+ col221111_16(decdata->out, pic + (my * 16
+ * mcusx + mx) * (16 * 2), mcusx
+ * (16 * 2));
break;
default:
return ERR_DEPTH_MISMATCH;
- break;
}
}
}
@@ -443,15 +454,21 @@ static int fillbits(struct in *in, int le, unsigned int bi)
}
while (le <= 24) {
b = *in->p++;
- if (b == 0xff && (m = *in->p++) != 0) {
- if (m == M_EOF) {
- if (in->func && (m = in->func(in->data)) == 0)
- continue;
+ if (b == 0xff) {
+ m = *in->p++;
+ if (m != 0) {
+ if (m == M_EOF) {
+ if (in->func) {
+ m = in->func(in->data);
+ if (m == 0)
+ continue;
+ }
+ }
+ in->marker = m;
+ if (le <= 16)
+ bi = bi << 16, le += 16;
+ break;
}
- in->marker = m;
- if (le <= 16)
- bi = bi << 16, le += 16;
- break;
}
bi = bi << 8 | b;
le += 8;
@@ -465,7 +482,8 @@ static int dec_readmarker(struct in *in)
int m;
in->left = fillbits(in, in->left, in->bits);
- if ((m = in->marker) == 0)
+ m = in->marker;
+ if (m == 0)
return 0;
in->left = 0;
in->marker = 0;
@@ -476,14 +494,14 @@ static int dec_readmarker(struct in *in)
#define LEBI_GET(in) (le = in->left, bi = in->bits)
#define LEBI_PUT(in) (in->left = le, in->bits = bi)
-#define GETBITS(in, n) ( \
- (le < (n) ? le = fillbits(in, le, bi), bi = in->bits : 0), \
- (le -= (n)), \
- bi >> le & ((1 << (n)) - 1) \
+#define GETBITS(in, n) ( \
+ (le < (n) ? le = fillbits(in, le, bi), bi = in->bits : 0), \
+ (le -= (n)), \
+ bi >> le & ((1 << (n)) - 1) \
)
-#define UNGETBITS(in, n) ( \
- le += (n) \
+#define UNGETBITS(in, n) ( \
+ le += (n) \
)
@@ -498,7 +516,9 @@ static int dec_rec2(struct in *in, struct dec_hufftbl *hu, int *runp, int c,
*runp = i >> 8 & 15;
i >>= 16;
} else {
- for (i = DECBITS; (c = ((c << 1) | GETBITS(in, 1))) >= (hu->maxcode[i]); i++);
+ for (i = DECBITS; (c = ((c << 1) | GETBITS(in, 1)))
+ >= (hu->maxcode[i]); i++)
+ ;
if (i >= 16) {
in->marker = M_BADHUFF;
return 0;
@@ -519,25 +539,26 @@ static int dec_rec2(struct in *in, struct dec_hufftbl *hu, int *runp, int c,
return c;
}
-#define DEC_REC(in, hu, r, i) ( \
- r = GETBITS(in, DECBITS), \
- i = hu->llvals[r], \
- i & 128 ? \
- ( \
- UNGETBITS(in, i & 127), \
- r = i >> 8 & 15, \
- i >> 16 \
- ) \
- : \
- ( \
- LEBI_PUT(in), \
- i = dec_rec2(in, hu, &r, r, i), \
- LEBI_GET(in), \
- i \
- ) \
+#define DEC_REC(in, hu, r, i) ( \
+ r = GETBITS(in, DECBITS), \
+ i = hu->llvals[r], \
+ i & 128 ? \
+ ( \
+ UNGETBITS(in, i & 127), \
+ r = i >> 8 & 15, \
+ i >> 16 \
+ ) \
+ : \
+ ( \
+ LEBI_PUT(in), \
+ i = dec_rec2(in, hu, &r, r, i), \
+ LEBI_GET(in), \
+ i \
+ ) \
)
-static void decode_mcus(struct in *in, int *dct, int n, struct scan *sc, int *maxp)
+static void decode_mcus(struct in *in, int *dct, int n, struct scan *sc,
+ int *maxp)
{
struct dec_hufftbl *hu;
int i, r, t;
@@ -568,7 +589,8 @@ static void decode_mcus(struct in *in, int *dct, int n, struct scan *sc, int *ma
LEBI_PUT(in);
}
-static void dec_makehuff(struct dec_hufftbl *hu, int *hufflen, unsigned char *huffvals)
+static void dec_makehuff(struct dec_hufftbl *hu, int *hufflen,
+ unsigned char *huffvals)
{
int code, k, i, j, d, x, c, v;
for (i = 0; i < (1 << DECBITS); i++)
@@ -594,16 +616,20 @@ static void dec_makehuff(struct dec_hufftbl *hu, int *hufflen, unsigned char *hu
c = code << (DECBITS - 1 - i);
v = hu->vals[k] & 0x0f; /* size */
for (d = 1 << (DECBITS - 1 - i); --d >= 0;) {
- if (v + i < DECBITS) { /* both fit in table */
+ if (v + i < DECBITS) {
+ /* both fit in table */
x = d >> (DECBITS - 1 - v -
i);
if (v && x < (1 << (v - 1)))
x += (-1 << v) + 1;
- x = x << 16 | (hu-> vals[k] & 0xf0) << 4 |
- (DECBITS - (i + 1 + v)) | 128;
+ x = x << 16 | (hu->vals[k]
+ & 0xf0) << 4 |
+ (DECBITS - (i + 1 + v))
+ | 128;
} else
- x = v << 16 | (hu-> vals[k] & 0xf0) << 4 |
- (DECBITS - (i + 1));
+ x = v << 16 | (hu->vals[k]
+ & 0xf0) << 4 |
+ (DECBITS - (i + 1));
hu->llvals[c | d] = x;
}
}
@@ -632,33 +658,33 @@ static void dec_makehuff(struct dec_hufftbl *hu, int *hufflen, unsigned char *hu
#define C5IC1 ((PREC)IFIX(0.566454497)) /* c5/c1 */
#define C7IC1 ((PREC)IFIX(0.198912367)) /* c7/c1 */
-#define XPP(a,b) (t = a + b, b = a - b, a = t)
-#define XMP(a,b) (t = a - b, b = a + b, a = t)
-#define XPM(a,b) (t = a + b, b = b - a, a = t)
-
-#define ROT(a,b,s,c) ( t = IMULT(a + b, s), \
- a = IMULT(a, c - s) + t, \
- b = IMULT(b, c + s) - t)
-
-#define IDCT \
-( \
- XPP(t0, t1), \
- XMP(t2, t3), \
- t2 = IMULT(t2, IC4) - t3, \
- XPP(t0, t3), \
- XPP(t1, t2), \
- XMP(t4, t7), \
- XPP(t5, t6), \
- XMP(t5, t7), \
- t5 = IMULT(t5, IC4), \
- ROT(t4, t6, S22, C22),\
- t6 -= t7, \
- t5 -= t6, \
- t4 -= t5, \
- XPP(t0, t7), \
- XPP(t1, t6), \
- XPP(t2, t5), \
- XPP(t3, t4) \
+#define XPP(a, b) (t = a + b, b = a - b, a = t)
+#define XMP(a, b) (t = a - b, b = a + b, a = t)
+#define XPM(a, b) (t = a + b, b = b - a, a = t)
+
+#define ROT(a, b, s, c) (t = IMULT(a + b, s), \
+ a = IMULT(a, c - s) + t, \
+ b = IMULT(b, c + s) - t)
+
+#define IDCT \
+( \
+ XPP(t0, t1), \
+ XMP(t2, t3), \
+ t2 = IMULT(t2, IC4) - t3, \
+ XPP(t0, t3), \
+ XPP(t1, t2), \
+ XMP(t4, t7), \
+ XPP(t5, t6), \
+ XMP(t5, t7), \
+ t5 = IMULT(t5, IC4), \
+ ROT(t4, t6, S22, C22), \
+ t6 -= t7, \
+ t5 -= t6, \
+ t4 -= t5, \
+ XPP(t0, t7), \
+ XPP(t1, t6), \
+ XPP(t2, t5), \
+ XPP(t3, t4) \
)
static unsigned char zig2[64] = {
@@ -764,7 +790,7 @@ static void idctqtab(unsigned char *qin, PREC *qout)
for (i = 0; i < 8; i++)
for (j = 0; j < 8; j++)
qout[zig[i * 8 + j]] = qin[zig[i * 8 + j]] *
- IMULT(aaidct[i], aaidct[j]);
+ IMULT(aaidct[i], aaidct[j]);
}
static void scaleidctqtab(PREC *q, PREC sc)
@@ -809,13 +835,13 @@ static void initcol(PREC q[][64])
}
/* This is optimized for the stupid sun SUNWspro compiler. */
-#define STORECLAMP(a,x) \
+#define STORECLAMP(a, x) \
( \
- (a) = (x), \
- (unsigned int)(x) >= 256 ? \
- ((a) = (x) < 0 ? 0 : 255) \
- : \
- 0 \
+ (a) = (x), \
+ (unsigned int)(x) >= 256 ? \
+ ((a) = (x) < 0 ? 0 : 255) \
+ : \
+ 0 \
)
#define CLAMP(x) ((unsigned int)(x) >= 256 ? ((x) < 0 ? 0 : 255) : (x))
@@ -824,98 +850,98 @@ static void initcol(PREC q[][64])
#define CBCRCG(yin, xin) \
( \
- cb = outc[0 +yin*8+xin], \
- cr = outc[64+yin*8+xin], \
- cg = (50 * cb + 130 * cr + 128) >> 8 \
+ cb = outc[0 + yin * 8 + xin], \
+ cr = outc[64 + yin * 8 + xin], \
+ cg = (50 * cb + 130 * cr + 128) >> 8 \
)
#else
#define CBCRCG(yin, xin) \
( \
- cb = outc[0 +yin*8+xin], \
- cr = outc[64+yin*8+xin], \
- cg = (3 * cb + 8 * cr) >> 4 \
+ cb = outc[0 + yin * 8 + xin], \
+ cr = outc[64 + yin * 8 + xin], \
+ cg = (3 * cb + 8 * cr) >> 4 \
)
#endif
#define PIC(yin, xin, p, xout) \
( \
- y = outy[(yin) * 8 + xin], \
- STORECLAMP(p[(xout) * 3 + 0], y + cr), \
- STORECLAMP(p[(xout) * 3 + 1], y - cg), \
- STORECLAMP(p[(xout) * 3 + 2], y + cb) \
+ y = outy[(yin) * 8 + xin], \
+ STORECLAMP(p[(xout) * 3 + 0], y + cr), \
+ STORECLAMP(p[(xout) * 3 + 1], y - cg), \
+ STORECLAMP(p[(xout) * 3 + 2], y + cb) \
)
#ifdef __LITTLE_ENDIAN
-#define PIC_16(yin, xin, p, xout, add) \
-( \
- y = outy[(yin) * 8 + xin], \
- y = ((CLAMP(y + cr + add*2+1) & 0xf8) << 8) | \
- ((CLAMP(y - cg + add ) & 0xfc) << 3) | \
- ((CLAMP(y + cb + add*2+1) ) >> 3), \
- p[(xout) * 2 + 0] = y & 0xff, \
- p[(xout) * 2 + 1] = y >> 8 \
+#define PIC_16(yin, xin, p, xout, add) \
+( \
+ y = outy[(yin) * 8 + xin], \
+ y = ((CLAMP(y + cr + add*2+1) & 0xf8) << 8) | \
+ ((CLAMP(y - cg + add) & 0xfc) << 3) | \
+ ((CLAMP(y + cb + add*2+1)) >> 3), \
+ p[(xout) * 2 + 0] = y & 0xff, \
+ p[(xout) * 2 + 1] = y >> 8 \
)
#else
#ifdef CONFIG_PPC
-#define PIC_16(yin, xin, p, xout, add) \
-( \
- y = outy[(yin) * 8 + xin], \
- y = ((CLAMP(y + cr + add*2+1) & 0xf8) << 7) | \
- ((CLAMP(y - cg + add*2+1) & 0xf8) << 2) | \
- ((CLAMP(y + cb + add*2+1) ) >> 3), \
- p[(xout) * 2 + 0] = y >> 8, \
- p[(xout) * 2 + 1] = y & 0xff \
+#define PIC_16(yin, xin, p, xout, add) \
+( \
+ y = outy[(yin) * 8 + xin], \
+ y = ((CLAMP(y + cr + add*2+1) & 0xf8) << 7) | \
+ ((CLAMP(y - cg + add*2+1) & 0xf8) << 2) | \
+ ((CLAMP(y + cb + add*2+1)) >> 3), \
+ p[(xout) * 2 + 0] = y >> 8, \
+ p[(xout) * 2 + 1] = y & 0xff \
)
#else
-#define PIC_16(yin, xin, p, xout, add) \
-( \
- y = outy[(yin) * 8 + xin], \
- y = ((CLAMP(y + cr + add*2+1) & 0xf8) << 8) | \
- ((CLAMP(y - cg + add ) & 0xfc) << 3) | \
- ((CLAMP(y + cb + add*2+1) ) >> 3), \
- p[(xout) * 2 + 0] = y >> 8, \
- p[(xout) * 2 + 1] = y & 0xff \
+#define PIC_16(yin, xin, p, xout, add) \
+( \
+ y = outy[(yin) * 8 + xin], \
+ y = ((CLAMP(y + cr + add*2+1) & 0xf8) << 8) | \
+ ((CLAMP(y - cg + add) & 0xfc) << 3) | \
+ ((CLAMP(y + cb + add*2+1)) >> 3), \
+ p[(xout) * 2 + 0] = y >> 8, \
+ p[(xout) * 2 + 1] = y & 0xff \
)
#endif
#endif
#define PIC_32(yin, xin, p, xout) \
( \
- y = outy[(yin) * 8 + xin], \
- STORECLAMP(p[(xout) * 4 + 0], y + cr), \
- STORECLAMP(p[(xout) * 4 + 1], y - cg), \
- STORECLAMP(p[(xout) * 4 + 2], y + cb), \
- p[(xout) * 4 + 3] = 0 \
+ y = outy[(yin) * 8 + xin], \
+ STORECLAMP(p[(xout) * 4 + 0], y + cr), \
+ STORECLAMP(p[(xout) * 4 + 1], y - cg), \
+ STORECLAMP(p[(xout) * 4 + 2], y + cb), \
+ p[(xout) * 4 + 3] = 0 \
)
-#define PIC221111(xin) \
-( \
- CBCRCG(0, xin), \
- PIC(xin / 4 * 8 + 0, (xin & 3) * 2 + 0, pic0, xin * 2 + 0), \
- PIC(xin / 4 * 8 + 0, (xin & 3) * 2 + 1, pic0, xin * 2 + 1), \
- PIC(xin / 4 * 8 + 1, (xin & 3) * 2 + 0, pic1, xin * 2 + 0), \
- PIC(xin / 4 * 8 + 1, (xin & 3) * 2 + 1, pic1, xin * 2 + 1) \
+#define PIC221111(xin) \
+( \
+ CBCRCG(0, xin), \
+ PIC(xin / 4 * 8 + 0, (xin & 3) * 2 + 0, pic0, xin * 2 + 0), \
+ PIC(xin / 4 * 8 + 0, (xin & 3) * 2 + 1, pic0, xin * 2 + 1), \
+ PIC(xin / 4 * 8 + 1, (xin & 3) * 2 + 0, pic1, xin * 2 + 0), \
+ PIC(xin / 4 * 8 + 1, (xin & 3) * 2 + 1, pic1, xin * 2 + 1) \
)
-#define PIC221111_16(xin) \
-( \
- CBCRCG(0, xin), \
- PIC_16(xin / 4 * 8 + 0, (xin & 3) * 2 + 0, pic0, xin * 2 + 0, 3), \
- PIC_16(xin / 4 * 8 + 0, (xin & 3) * 2 + 1, pic0, xin * 2 + 1, 0), \
- PIC_16(xin / 4 * 8 + 1, (xin & 3) * 2 + 0, pic1, xin * 2 + 0, 1), \
- PIC_16(xin / 4 * 8 + 1, (xin & 3) * 2 + 1, pic1, xin * 2 + 1, 2) \
+#define PIC221111_16(xin) \
+( \
+ CBCRCG(0, xin), \
+ PIC_16(xin / 4 * 8 + 0, (xin & 3) * 2 + 0, pic0, xin * 2 + 0, 3), \
+ PIC_16(xin / 4 * 8 + 0, (xin & 3) * 2 + 1, pic0, xin * 2 + 1, 0), \
+ PIC_16(xin / 4 * 8 + 1, (xin & 3) * 2 + 0, pic1, xin * 2 + 0, 1), \
+ PIC_16(xin / 4 * 8 + 1, (xin & 3) * 2 + 1, pic1, xin * 2 + 1, 2) \
)
-#define PIC221111_32(xin) \
-( \
- CBCRCG(0, xin), \
- PIC_32(xin / 4 * 8 + 0, (xin & 3) * 2 + 0, pic0, xin * 2 + 0),\
- PIC_32(xin / 4 * 8 + 0, (xin & 3) * 2 + 1, pic0, xin * 2 + 1),\
- PIC_32(xin / 4 * 8 + 1, (xin & 3) * 2 + 0, pic1, xin * 2 + 0),\
- PIC_32(xin / 4 * 8 + 1, (xin & 3) * 2 + 1, pic1, xin * 2 + 1) \
+#define PIC221111_32(xin) \
+( \
+ CBCRCG(0, xin), \
+ PIC_32(xin / 4 * 8 + 0, (xin & 3) * 2 + 0, pic0, xin * 2 + 0), \
+ PIC_32(xin / 4 * 8 + 0, (xin & 3) * 2 + 1, pic0, xin * 2 + 1), \
+ PIC_32(xin / 4 * 8 + 1, (xin & 3) * 2 + 0, pic1, xin * 2 + 0), \
+ PIC_32(xin / 4 * 8 + 1, (xin & 3) * 2 + 1, pic1, xin * 2 + 1) \
)
static void col221111(int *out, unsigned char *pic, int width)
@@ -931,9 +957,8 @@ static void col221111(int *out, unsigned char *pic, int width)
outc = out + 64 * 4;
for (i = 2; i > 0; i--) {
for (j = 4; j > 0; j--) {
- for (k = 0; k < 8; k++) {
+ for (k = 0; k < 8; k++)
PIC221111(k);
- }
outc += 8;
outy += 16;
pic0 += 2 * width;
@@ -956,9 +981,8 @@ static void col221111_16(int *out, unsigned char *pic, int width)
outc = out + 64 * 4;
for (i = 2; i > 0; i--) {
for (j = 4; j > 0; j--) {
- for (k = 0; k < 8; k++) {
- PIC221111_16(k);
- }
+ for (k = 0; k < 8; k++)
+ PIC221111_16(k);
outc += 8;
outy += 16;
pic0 += 2 * width;
@@ -981,9 +1005,8 @@ static void col221111_32(int *out, unsigned char *pic, int width)
outc = out + 64 * 4;
for (i = 2; i > 0; i--) {
for (j = 4; j > 0; j--) {
- for (k = 0; k < 8; k++) {
+ for (k = 0; k < 8; k++)
PIC221111_32(k);
- }
outc += 8;
outy += 16;
pic0 += 2 * width;
diff --git a/src/lib/jpeg.h b/src/lib/jpeg.h
index ca9add9..cc2c65d 100644
--- a/src/lib/jpeg.h
+++ b/src/lib/jpeg.h
@@ -44,7 +44,8 @@ struct jpeg_decdata {
int dquant[3][64];
};
-int jpeg_decode(unsigned char *, unsigned char *, int, int, int, struct jpeg_decdata *);
+int jpeg_decode(unsigned char *, unsigned char *, int, int, int,
+ struct jpeg_decdata *);
void jpeg_fetch_size(unsigned char *buf, int *width, int *height);
int jpeg_check_size(unsigned char *, int, int);
More information about the coreboot-gerrit
mailing list