src/lib: Use tabs instead of spaces

Fix the following errors and warnings detected by checkpatch.pl:

ERROR: code indent should use tabs where possible
ERROR: switch and case should be at the same indent
WARNING: Statements should start on a tabstop
WARNING: please, no spaces at the start of a line
WARNING: please, no space before tabs
WARNING: suspect code indent for conditional statements
WARNING: labels should not be indented

TEST=Build and run on Galileo Gen2

Change-Id: Iebcff26ad41ab6eb0027b871a1c06f3b52dd207c
Signed-off-by: Lee Leahy <Leroy.P.Leahy@intel.com>
Reviewed-on: https://review.coreboot.org/18732
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
Lee Leahy
2017-03-09 16:21:34 -08:00
committed by Martin Roth
parent cdd7686a9d
commit e20a3191f5
20 changed files with 1462 additions and 1527 deletions

View File

@ -875,11 +875,9 @@ parse_cea(struct edid *out, unsigned char *x, struct edid_context *c)
if (offset < 4)
break;
if (version < 3) {
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) {
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)
@ -1188,7 +1186,7 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
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)
printk(BIOS_SPEW, "DFP 1.x compatible TMDS\n");
@ -1273,18 +1271,18 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
/* 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");
break;
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");

View File

@ -36,13 +36,12 @@ static void gcov_allocate(unsigned int);
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
@ -63,91 +62,83 @@ 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 (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 (fd < 0)
return 0;
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;
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 (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;
#endif
setbuf(gcov_var.file, (char *)0);
setbuf(gcov_var.file, (char *)0);
return 1;
return 1;
}
/* Close the current gcov file. Flushes data to disk. Returns nonzero
@ -156,23 +147,22 @@ gcov_open(const char *name, int mode)
GCOV_LINKAGE int
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
@ -183,16 +173,15 @@ gcov_close(void)
GCOV_LINKAGE int
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
@ -200,15 +189,16 @@ gcov_magic(gcov_unsigned_t magic, gcov_unsigned_t expected)
static void
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
@ -218,10 +208,10 @@ gcov_allocate(unsigned int length)
static void
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
@ -230,27 +220,26 @@ gcov_write_block(unsigned int size)
static gcov_unsigned_t *
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
@ -259,9 +248,9 @@ gcov_write_words(unsigned int words)
GCOV_LINKAGE void
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
@ -271,13 +260,13 @@ gcov_write_unsigned(gcov_unsigned_t value)
GCOV_LINKAGE void
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 */
@ -288,21 +277,20 @@ gcov_write_counter(gcov_type value)
GCOV_LINKAGE void
gcov_write_string(const char *string)
{
unsigned int length = 0;
unsigned int 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
@ -313,13 +301,13 @@ gcov_write_string(const char *string)
GCOV_LINKAGE gcov_position_t
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
@ -330,19 +318,19 @@ gcov_write_tag(gcov_unsigned_t tag)
GCOV_LINKAGE void
gcov_write_length(gcov_position_t position)
{
unsigned int offset;
gcov_unsigned_t length;
gcov_unsigned_t *buffer;
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);
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 */
@ -352,10 +340,10 @@ gcov_write_length(gcov_position_t position)
GCOV_LINKAGE void
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
@ -364,19 +352,18 @@ gcov_write_tag_length(gcov_unsigned_t tag, gcov_unsigned_t length)
GCOV_LINKAGE void
gcov_write_summary(gcov_unsigned_t tag, const struct gcov_summary *summary)
{
unsigned int ix;
const struct gcov_ctr_summary *csum;
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);
}
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 */
@ -388,45 +375,44 @@ gcov_write_summary(gcov_unsigned_t tag, const struct gcov_summary *summary)
static const gcov_unsigned_t *
gcov_read_words(unsigned int words)
{
const gcov_unsigned_t *result;
unsigned int 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
@ -435,13 +421,13 @@ gcov_read_words(unsigned int words)
GCOV_LINKAGE gcov_unsigned_t
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
@ -450,18 +436,18 @@ gcov_read_unsigned(void)
GCOV_LINKAGE gcov_type
gcov_read_counter(void)
{
gcov_type value;
const gcov_unsigned_t *buffer = gcov_read_words(2);
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;
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;
return value;
}
/* Read string from coverage file. Returns a pointer to a static
@ -472,30 +458,29 @@ gcov_read_counter(void)
GCOV_LINKAGE const char *
gcov_read_string(void)
{
unsigned int 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)
{
unsigned int ix;
struct gcov_ctr_summary *csum;
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();
}
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
@ -505,16 +490,15 @@ gcov_read_summary(struct gcov_summary *summary)
GCOV_LINKAGE void
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
@ -524,11 +508,11 @@ gcov_sync(gcov_position_t base, gcov_unsigned_t length)
GCOV_LINKAGE void
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
@ -538,11 +522,11 @@ gcov_seek(gcov_position_t base)
GCOV_LINKAGE time_t
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;
else
return status.st_mtime;
}
#endif /* IN_GCOV */

View File

@ -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
@ -301,10 +301,10 @@ typedef HOST_WIDEST_INT gcov_type;
/* 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))
((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,7 +355,7 @@ 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 */
#define GCOV_COUNTER_NAMES {"arcs", "interval", "pow2", "single", \
@ -399,7 +399,7 @@ typedef HOST_WIDEST_INT gcov_type;
#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)
@ -408,18 +408,18 @@ typedef HOST_WIDEST_INT gcov_type;
/* 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. */
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];
gcov_unsigned_t checksum; /* checksum of program */
struct gcov_ctr_summary ctrs[GCOV_COUNTERS_SUMMABLE];
};
/* Structures embedded in coverage program. The structures generated
@ -429,8 +429,8 @@ struct gcov_summary
/* Information about counters for a single function. */
struct gcov_ctr_info
{
gcov_unsigned_t num; /* number of counters. */
gcov_type *values; /* their values. */
gcov_unsigned_t num; /* number of counters. */
gcov_type *values; /* their values. */
};
/* Information about a single function. This uses the trailing array
@ -441,11 +441,11 @@ struct gcov_ctr_info
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 */
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. */
@ -454,18 +454,18 @@ 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 */
gcov_unsigned_t version; /* expected version number */
struct gcov_info *next; /* link to next, used by libgcov */
gcov_unsigned_t stamp; /* uniquifying time stamp */
const char *filename; /* output file name */
gcov_unsigned_t stamp; /* uniquifying time stamp */
const char *filename; /* output file name */
gcov_merge_fn merge[GCOV_COUNTERS]; /* merge functions (null for
unused) */
gcov_merge_fn merge[GCOV_COUNTERS]; /* merge functions (null for
unused) */
unsigned int n_functions; /* number of functions */
const struct gcov_fn_info *const *functions; /* pointer to pointers
to function information */
unsigned int n_functions; /* number of functions */
const struct gcov_fn_info *const *functions; /* pointer to pointers to
function information */
};
/* Register a new object file module. */
@ -506,7 +506,7 @@ 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;
ATTRIBUTE_HIDDEN;
#endif
#endif /* IN_LIBGCOV */
@ -518,25 +518,27 @@ extern int __gcov_execve(const char *, char *const [], char *const [])
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 */
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;
@ -569,10 +571,10 @@ GCOV_LINKAGE void gcov_read_summary(struct gcov_summary *) ATTRIBUTE_HIDDEN;
/* 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;
ATTRIBUTE_HIDDEN;
GCOV_LINKAGE void gcov_write_summary(gcov_unsigned_t /*tag*/,
const struct gcov_summary *)
ATTRIBUTE_HIDDEN;
ATTRIBUTE_HIDDEN;
static void gcov_rewrite(void);
GCOV_LINKAGE void gcov_seek(gcov_position_t /*position*/) ATTRIBUTE_HIDDEN;
#else
@ -604,8 +606,8 @@ GCOV_LINKAGE time_t gcov_time(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. */
@ -613,7 +615,7 @@ gcov_position(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
@ -622,11 +624,11 @@ gcov_is_error(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

View File

@ -26,7 +26,7 @@ void sdram_initialize(int controllers, const struct mem_controller *ctrl)
#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
}

View File

@ -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];

View File

@ -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)

View File

@ -267,15 +267,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,
@ -476,14 +476,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) \
le += (n) \
)
@ -520,22 +520,22 @@ 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)
@ -604,7 +604,7 @@ static void dec_makehuff(struct dec_hufftbl *hu, int *hufflen, unsigned char *hu
(DECBITS - (i + 1 + v)) | 128;
} else
x = v << 16 | (hu-> vals[k] & 0xf0) << 4 |
(DECBITS - (i + 1));
(DECBITS - (i + 1));
hu->llvals[c | d] = x;
}
}
@ -641,25 +641,25 @@ static void dec_makehuff(struct dec_hufftbl *hu, int *hufflen, unsigned char *hu
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 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] = {
@ -765,7 +765,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)
@ -812,11 +812,11 @@ static void initcol(PREC q[][64])
/* This is optimized for the stupid sun SUNWspro compiler. */
#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))
@ -825,98 +825,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)
@ -957,7 +957,7 @@ static void col221111_16(int *out, unsigned char *pic, int width)
for (i = 2; i > 0; i--) {
for (j = 4; j > 0; j--) {
for (k = 0; k < 8; k++)
PIC221111_16(k);
PIC221111_16(k);
outc += 8;
outy += 16;
pic0 += 2 * width;

File diff suppressed because it is too large Load Diff

View File

@ -38,7 +38,8 @@
: ((look_ahead.dw = *(UInt32 *)Buffer), (Buffer += 4), (look_ahead_ptr = 1), look_ahead.raw[0])))
#define RC_INIT2 Code = 0; Range = 0xFFFFFFFF; \
{ int i; for (i = 0; i < 5; i++) { RC_TEST; Code = (Code << 8) | RC_READ_BYTE; }}
{ int i; for (i = 0; i < 5; i++) { RC_TEST; Code = (Code << 8) \
| RC_READ_BYTE; }}
#define RC_TEST { if (Buffer == BufferLim) return LZMA_RESULT_DATA_ERROR; }
@ -53,15 +54,22 @@
#define UpdateBit1(p) Range -= bound; Code -= bound; *(p) -= (*(p)) >> kNumMoveBits;
#define RC_GET_BIT2(p, mi, A0, A1) IfBit0(p) \
{ UpdateBit0(p); mi <<= 1; A0; } else \
{ UpdateBit1(p); mi = (mi + mi) + 1; A1; }
{ UpdateBit0(p); mi <<= 1; A0; } else \
{ UpdateBit1(p); mi = (mi + mi) + 1; A1; }
#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;)
#define RangeDecoderBitTreeDecode(probs, numLevels, res) \
{ int i = numLevels; res = 1; \
do { CProb *cp = probs + res; RC_GET_BIT(cp, res) } while (--i != 0); \
res -= (1 << numLevels); }
#define RangeDecoderBitTreeDecode(probs, numLevels, res) \
{ \
int i = numLevels; \
\
res = 1; \
do { \
CProb *cp = probs + res; \
RC_GET_BIT(cp, res) \
} while (--i != 0); \
res -= (1 << numLevels); \
}
#define kNumPosBitsMax 4
@ -116,301 +124,257 @@ StopCompilingDueBUG
int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size)
{
unsigned char prop0;
if (size < LZMA_PROPERTIES_SIZE)
return LZMA_RESULT_DATA_ERROR;
prop0 = propsData[0];
if (prop0 >= (9 * 5 * 5))
return LZMA_RESULT_DATA_ERROR;
{
for (propsRes->pb = 0; prop0 >= (9 * 5); propsRes->pb++, prop0 -= (9 * 5))
;
for (propsRes->lp = 0; prop0 >= 9; propsRes->lp++, prop0 -= 9)
;
propsRes->lc = prop0;
/*
unsigned char remainder = (unsigned char)(prop0 / 9);
propsRes->lc = prop0 % 9;
propsRes->pb = remainder / 5;
propsRes->lp = remainder % 5;
*/
}
unsigned char prop0;
if (size < LZMA_PROPERTIES_SIZE)
return LZMA_RESULT_DATA_ERROR;
prop0 = propsData[0];
if (prop0 >= (9 * 5 * 5))
return LZMA_RESULT_DATA_ERROR;
{
for (propsRes->pb = 0; prop0 >= (9 * 5);
propsRes->pb++, prop0 -= (9 * 5))
;
for (propsRes->lp = 0; prop0 >= 9; propsRes->lp++, prop0 -= 9)
;
propsRes->lc = prop0;
/*
* unsigned char remainder = (unsigned char)(prop0 / 9);
* propsRes->lc = prop0 % 9;
* propsRes->pb = remainder / 5;
* propsRes->lp = remainder % 5;
*/
}
return LZMA_RESULT_OK;
return LZMA_RESULT_OK;
}
#define kLzmaStreamWasFinishedId (-1)
int LzmaDecode(CLzmaDecoderState *vs,
const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed,
unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed)
const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed,
unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed)
{
CProb *p = vs->Probs;
SizeT nowPos = 0;
Byte previousByte = 0;
UInt32 posStateMask = (1 << (vs->Properties.pb)) - 1;
UInt32 literalPosMask = (1 << (vs->Properties.lp)) - 1;
int lc = vs->Properties.lc;
CProb *p = vs->Probs;
SizeT nowPos = 0;
Byte previousByte = 0;
UInt32 posStateMask = (1 << (vs->Properties.pb)) - 1;
UInt32 literalPosMask = (1 << (vs->Properties.lp)) - 1;
int lc = vs->Properties.lc;
int state = 0;
UInt32 rep0 = 1, rep1 = 1, rep2 = 1, rep3 = 1;
int len = 0;
const Byte *Buffer;
const Byte *BufferLim;
int look_ahead_ptr = 4;
union
{
Byte raw[4];
UInt32 dw;
} look_ahead;
UInt32 Range;
UInt32 Code;
int state = 0;
UInt32 rep0 = 1, rep1 = 1, rep2 = 1, rep3 = 1;
int len = 0;
const Byte *Buffer;
const Byte *BufferLim;
int look_ahead_ptr = 4;
union {
Byte raw[4];
UInt32 dw;
} look_ahead;
UInt32 Range;
UInt32 Code;
*inSizeProcessed = 0;
*outSizeProcessed = 0;
*inSizeProcessed = 0;
*outSizeProcessed = 0;
{
UInt32 i;
UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp));
for (i = 0; i < numProbs; i++)
p[i] = kBitModelTotal >> 1;
}
{
UInt32 i;
UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc
+ vs->Properties.lp));
for (i = 0; i < numProbs; i++)
p[i] = kBitModelTotal >> 1;
}
RC_INIT(inStream, inSize);
RC_INIT(inStream, inSize);
while (nowPos < outSize)
{
CProb *prob;
UInt32 bound;
int posState = (int)(
(nowPos
)
& posStateMask);
while (nowPos < outSize) {
CProb *prob;
UInt32 bound;
int posState = (int)((nowPos)& posStateMask);
prob = p + IsMatch + (state << kNumPosBitsMax) + posState;
IfBit0(prob)
{
int symbol = 1;
UpdateBit0(prob)
prob = p + Literal + (LZMA_LIT_SIZE *
(((
(nowPos
)
& literalPosMask) << lc) + (previousByte >> (8 - lc))));
prob = p + IsMatch + (state << kNumPosBitsMax) + posState;
IfBit0(prob) {
int symbol = 1;
UpdateBit0(prob)
prob = p + Literal + (LZMA_LIT_SIZE *
((((nowPos) & literalPosMask) << lc)
+ (previousByte >> (8 - lc))));
if (state >= kNumLitStates)
{
int matchByte;
matchByte = outStream[nowPos - rep0];
do
{
int bit;
CProb *probLit;
matchByte <<= 1;
bit = (matchByte & 0x100);
probLit = prob + 0x100 + bit + symbol;
RC_GET_BIT2(probLit, symbol, if (bit != 0) break, if (bit == 0) break)
}
while (symbol < 0x100);
}
while (symbol < 0x100)
{
CProb *probLit = prob + symbol;
RC_GET_BIT(probLit, symbol)
}
previousByte = (Byte)symbol;
if (state >= kNumLitStates) {
int matchByte;
matchByte = outStream[nowPos - rep0];
do {
int bit;
CProb *probLit;
matchByte <<= 1;
bit = (matchByte & 0x100);
probLit = prob + 0x100 + bit + symbol;
RC_GET_BIT2(probLit, symbol,
if (bit != 0)
break,
if (bit == 0)
break)
} while (symbol < 0x100);
}
while (symbol < 0x100) {
CProb *probLit = prob + symbol;
RC_GET_BIT(probLit, symbol)
}
previousByte = (Byte)symbol;
outStream[nowPos++] = previousByte;
if (state < 4)
state = 0;
else if (state < 10)
state -= 3;
else
state -= 6;
}
else
{
UpdateBit1(prob);
prob = p + IsRep + state;
IfBit0(prob)
{
UpdateBit0(prob);
rep3 = rep2;
rep2 = rep1;
rep1 = rep0;
state = state < kNumLitStates ? 0 : 3;
prob = p + LenCoder;
}
else
{
UpdateBit1(prob);
prob = p + IsRepG0 + state;
IfBit0(prob)
{
UpdateBit0(prob);
prob = p + IsRep0Long + (state << kNumPosBitsMax) + posState;
IfBit0(prob)
{
UpdateBit0(prob);
outStream[nowPos++] = previousByte;
if (state < 4)
state = 0;
else if (state < 10)
state -= 3;
else
state -= 6;
} else {
UpdateBit1(prob);
prob = p + IsRep + state;
IfBit0(prob) {
UpdateBit0(prob);
rep3 = rep2;
rep2 = rep1;
rep1 = rep0;
state = state < kNumLitStates ? 0 : 3;
prob = p + LenCoder;
} else {
UpdateBit1(prob);
prob = p + IsRepG0 + state;
IfBit0(prob) {
UpdateBit0(prob);
prob = p + IsRep0Long + (state << kNumPosBitsMax) + posState;
IfBit0(prob) {
UpdateBit0(prob);
if (nowPos == 0)
return LZMA_RESULT_DATA_ERROR;
if (nowPos == 0)
return LZMA_RESULT_DATA_ERROR;
state = state < kNumLitStates ? 9 : 11;
previousByte = outStream[nowPos - rep0];
outStream[nowPos++] = previousByte;
state = state < kNumLitStates ? 9 : 11;
previousByte = outStream[nowPos - rep0];
outStream[nowPos++] = previousByte;
continue;
}
else
{
UpdateBit1(prob);
}
}
else
{
UInt32 distance;
UpdateBit1(prob);
prob = p + IsRepG1 + state;
IfBit0(prob)
{
UpdateBit0(prob);
distance = rep1;
}
else
{
UpdateBit1(prob);
prob = p + IsRepG2 + state;
IfBit0(prob)
{
UpdateBit0(prob);
distance = rep2;
}
else
{
UpdateBit1(prob);
distance = rep3;
rep3 = rep2;
}
rep2 = rep1;
}
rep1 = rep0;
rep0 = distance;
}
state = state < kNumLitStates ? 8 : 11;
prob = p + RepLenCoder;
}
{
int numBits, offset;
CProb *probLen = prob + LenChoice;
IfBit0(probLen)
{
UpdateBit0(probLen);
probLen = prob + LenLow + (posState << kLenNumLowBits);
offset = 0;
numBits = kLenNumLowBits;
}
else
{
UpdateBit1(probLen);
probLen = prob + LenChoice2;
IfBit0(probLen)
{
UpdateBit0(probLen);
probLen = prob + LenMid + (posState << kLenNumMidBits);
offset = kLenNumLowSymbols;
numBits = kLenNumMidBits;
}
else
{
UpdateBit1(probLen);
probLen = prob + LenHigh;
offset = kLenNumLowSymbols + kLenNumMidSymbols;
numBits = kLenNumHighBits;
}
}
RangeDecoderBitTreeDecode(probLen, numBits, len);
len += offset;
}
continue;
} else
UpdateBit1(prob);
} else {
UInt32 distance;
UpdateBit1(prob);
prob = p + IsRepG1 + state;
IfBit0(prob) {
UpdateBit0(prob);
distance = rep1;
} else {
UpdateBit1(prob);
prob = p + IsRepG2 + state;
IfBit0(prob) {
UpdateBit0(prob);
distance = rep2;
} else {
UpdateBit1(prob);
distance = rep3;
rep3 = rep2;
}
rep2 = rep1;
}
rep1 = rep0;
rep0 = distance;
}
state = state < kNumLitStates ? 8 : 11;
prob = p + RepLenCoder;
}
{
int numBits, offset;
CProb *probLen = prob + LenChoice;
IfBit0(probLen) {
UpdateBit0(probLen);
probLen = prob + LenLow + (posState << kLenNumLowBits);
offset = 0;
numBits = kLenNumLowBits;
} else {
UpdateBit1(probLen);
probLen = prob + LenChoice2;
IfBit0(probLen) {
UpdateBit0(probLen);
probLen = prob + LenMid + (posState << kLenNumMidBits);
offset = kLenNumLowSymbols;
numBits = kLenNumMidBits;
} else {
UpdateBit1(probLen);
probLen = prob + LenHigh;
offset = kLenNumLowSymbols + kLenNumMidSymbols;
numBits = kLenNumHighBits;
}
}
RangeDecoderBitTreeDecode(probLen, numBits, len);
len += offset;
}
if (state < 4)
{
int posSlot;
state += kNumLitStates;
prob = p + PosSlot +
((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
kNumPosSlotBits);
RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot);
if (posSlot >= kStartPosModelIndex)
{
int numDirectBits = ((posSlot >> 1) - 1);
rep0 = (2 | ((UInt32)posSlot & 1));
if (posSlot < kEndPosModelIndex)
{
rep0 <<= numDirectBits;
prob = p + SpecPos + rep0 - posSlot - 1;
}
else
{
numDirectBits -= kNumAlignBits;
do
{
RC_NORMALIZE
Range >>= 1;
rep0 <<= 1;
if (Code >= Range)
{
Code -= Range;
rep0 |= 1;
}
}
while (--numDirectBits != 0);
prob = p + Align;
rep0 <<= kNumAlignBits;
numDirectBits = kNumAlignBits;
}
{
int i = 1;
int mi = 1;
do
{
CProb *prob3 = prob + mi;
RC_GET_BIT2(prob3, mi, ; , rep0 |= i);
i <<= 1;
}
while (--numDirectBits != 0);
}
}
else
rep0 = posSlot;
if (++rep0 == (UInt32)(0))
{
/* it's for stream version */
len = kLzmaStreamWasFinishedId;
break;
}
}
if (state < 4) {
int posSlot;
state += kNumLitStates;
prob = p + PosSlot +
((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
kNumPosSlotBits);
RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot);
if (posSlot >= kStartPosModelIndex) {
int numDirectBits = ((posSlot >> 1) - 1);
rep0 = (2 | ((UInt32)posSlot & 1));
if (posSlot < kEndPosModelIndex) {
rep0 <<= numDirectBits;
prob = p + SpecPos + rep0 - posSlot - 1;
} else {
numDirectBits -= kNumAlignBits;
do {
RC_NORMALIZE
Range >>= 1;
rep0 <<= 1;
if (Code >= Range) {
Code -= Range;
rep0 |= 1;
}
} while (--numDirectBits != 0);
prob = p + Align;
rep0 <<= kNumAlignBits;
numDirectBits = kNumAlignBits;
}
{
int i = 1;
int mi = 1;
do {
CProb *prob3 = prob + mi;
RC_GET_BIT2(prob3, mi, ; , rep0 |= i);
i <<= 1;
} while (--numDirectBits != 0);
}
} else
rep0 = posSlot;
if (++rep0 == (UInt32)(0)) {
/* it's for stream version */
len = kLzmaStreamWasFinishedId;
break;
}
}
len += kMatchMinLen;
if (rep0 > nowPos)
return LZMA_RESULT_DATA_ERROR;
len += kMatchMinLen;
if (rep0 > nowPos)
return LZMA_RESULT_DATA_ERROR;
do
{
previousByte = outStream[nowPos - rep0];
len--;
outStream[nowPos++] = previousByte;
}
while (len != 0 && nowPos < outSize);
}
}
RC_NORMALIZE;
do {
previousByte = outStream[nowPos - rep0];
len--;
outStream[nowPos++] = previousByte;
} while (len != 0 && nowPos < outSize);
}
}
RC_NORMALIZE;
*inSizeProcessed = (SizeT)(Buffer - inStream);
*outSizeProcessed = nowPos;
return LZMA_RESULT_OK;
*inSizeProcessed = (SizeT)(Buffer - inStream);
*outSizeProcessed = nowPos;
return LZMA_RESULT_OK;
}

View File

@ -38,11 +38,10 @@ typedef UInt32 SizeT;
#define LZMA_PROPERTIES_SIZE 5
typedef struct _CLzmaProperties
{
int lc;
int lp;
int pb;
typedef struct _CLzmaProperties {
int lc;
int lp;
int pb;
}CLzmaProperties;
int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size);
@ -51,17 +50,14 @@ int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsDa
#define kLzmaNeedInitId (-2)
typedef struct _CLzmaDecoderState
{
CLzmaProperties Properties;
CProb *Probs;
typedef struct _CLzmaDecoderState {
CLzmaProperties Properties;
CProb *Probs;
} CLzmaDecoderState;
int LzmaDecode(CLzmaDecoderState *vs,
const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed,
unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed);
const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed,
unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed);
#endif

View File

@ -17,22 +17,22 @@
#include <memrange.h>
static inline void range_entry_link(struct range_entry **prev_ptr,
struct range_entry *r)
struct range_entry *r)
{
r->next = *prev_ptr;
*prev_ptr = r;
}
static inline void range_entry_unlink(struct range_entry **prev_ptr,
struct range_entry *r)
struct range_entry *r)
{
*prev_ptr = r->next;
r->next = NULL;
}
static inline void range_entry_unlink_and_free(struct memranges *ranges,
struct range_entry **prev_ptr,
struct range_entry *r)
struct range_entry **prev_ptr,
struct range_entry *r)
{
range_entry_unlink(prev_ptr, r);
range_entry_link(&ranges->free_list, r);
@ -54,7 +54,7 @@ static struct range_entry *alloc_range(struct memranges *ranges)
static inline struct range_entry *
range_list_add(struct memranges *ranges, struct range_entry **prev_ptr,
resource_t begin, resource_t end, unsigned long tag)
resource_t begin, resource_t end, unsigned long tag)
{
struct range_entry *new_entry;
@ -102,8 +102,8 @@ static void merge_neighbor_entries(struct memranges *ranges)
}
static void remove_memranges(struct memranges *ranges,
resource_t begin, resource_t end,
unsigned long unused)
resource_t begin, resource_t end,
unsigned long unused)
{
struct range_entry *cur;
struct range_entry *next;
@ -136,7 +136,7 @@ static void remove_memranges(struct memranges *ranges,
if (end >= cur->end) {
begin = cur->end + 1;
range_entry_unlink_and_free(ranges, prev_ptr,
cur);
cur);
continue;
}
}
@ -152,7 +152,7 @@ static void remove_memranges(struct memranges *ranges,
/* Hole punched in middle of entry. */
if (begin > cur->begin && tmp_end < cur->end) {
range_list_add(ranges, &cur->next, end + 1, cur->end,
cur->tag);
cur->tag);
cur->end = begin - 1;
break;
}
@ -168,8 +168,8 @@ static void remove_memranges(struct memranges *ranges,
}
static void merge_add_memranges(struct memranges *ranges,
resource_t begin, resource_t end,
unsigned long tag)
resource_t begin, resource_t end,
unsigned long tag)
{
struct range_entry *cur;
struct range_entry **prev_ptr;
@ -202,7 +202,7 @@ static void merge_add_memranges(struct memranges *ranges,
}
void memranges_update_tag(struct memranges *ranges, unsigned long old_tag,
unsigned long new_tag)
unsigned long new_tag)
{
struct range_entry *r;
@ -215,12 +215,12 @@ void memranges_update_tag(struct memranges *ranges, unsigned long old_tag,
}
typedef void (*range_action_t)(struct memranges *ranges,
resource_t begin, resource_t end,
unsigned long tag);
resource_t begin, resource_t end,
unsigned long tag);
static void do_action(struct memranges *ranges,
resource_t base, resource_t size, unsigned long tag,
range_action_t action)
resource_t base, resource_t size, unsigned long tag,
range_action_t action)
{
resource_t end;
resource_t begin;
@ -238,13 +238,13 @@ static void do_action(struct memranges *ranges,
}
void memranges_create_hole(struct memranges *ranges,
resource_t base, resource_t size)
resource_t base, resource_t size)
{
do_action(ranges, base, size, -1, remove_memranges);
}
void memranges_insert(struct memranges *ranges,
resource_t base, resource_t size, unsigned long tag)
resource_t base, resource_t size, unsigned long tag)
{
do_action(ranges, base, size, tag, merge_add_memranges);
}
@ -267,9 +267,9 @@ static void collect_ranges(void *gp, struct device *dev, struct resource *res)
}
void memranges_add_resources_filter(struct memranges *ranges,
unsigned long mask, unsigned long match,
unsigned long tag,
memrange_filter_t filter)
unsigned long mask, unsigned long match,
unsigned long tag,
memrange_filter_t filter)
{
struct collect_context context;
@ -284,14 +284,14 @@ void memranges_add_resources_filter(struct memranges *ranges,
}
void memranges_add_resources(struct memranges *ranges,
unsigned long mask, unsigned long match,
unsigned long tag)
unsigned long mask, unsigned long match,
unsigned long tag)
{
memranges_add_resources_filter(ranges, mask, match, tag, NULL);
}
void memranges_init_empty(struct memranges *ranges, struct range_entry *to_free,
size_t num_free)
size_t num_free)
{
size_t i;
@ -303,8 +303,8 @@ void memranges_init_empty(struct memranges *ranges, struct range_entry *to_free,
}
void memranges_init(struct memranges *ranges,
unsigned long mask, unsigned long match,
unsigned long tag)
unsigned long mask, unsigned long match,
unsigned long tag)
{
memranges_init_empty(ranges, NULL, 0);
memranges_add_resources(ranges, mask, match, tag);
@ -314,12 +314,12 @@ void memranges_teardown(struct memranges *ranges)
{
while (ranges->entries != NULL) {
range_entry_unlink_and_free(ranges, &ranges->entries,
ranges->entries);
ranges->entries);
}
}
void memranges_fill_holes_up_to(struct memranges *ranges,
resource_t limit, unsigned long tag)
resource_t limit, unsigned long tag)
{
struct range_entry *cur;
struct range_entry *prev;
@ -341,7 +341,7 @@ void memranges_fill_holes_up_to(struct memranges *ranges,
if (end >= limit)
end = limit - 1;
range_list_add(ranges, &prev->next,
range_entry_end(prev), end, tag);
range_entry_end(prev), end, tag);
}
prev = cur;
@ -356,14 +356,14 @@ void memranges_fill_holes_up_to(struct memranges *ranges,
* to be added to cover the range up to the limit. */
if (prev != NULL && range_entry_end(prev) < limit)
range_list_add(ranges, &prev->next, range_entry_end(prev),
limit - 1, tag);
limit - 1, tag);
/* Merge all entries that were newly added. */
merge_neighbor_entries(ranges);
}
struct range_entry *memranges_next_entry(struct memranges *ranges,
const struct range_entry *r)
const struct range_entry *r)
{
return r->next;
}

View File

@ -112,7 +112,7 @@ uint32_t tlcl_get_permanent_flags(TPM_PERMANENT_FLAGS *pflags)
}
uint32_t tlcl_get_flags(uint8_t *disable, uint8_t *deactivated,
uint8_t *nvlocked)
uint8_t *nvlocked)
{
VBDEBUG("MOCK_TPM: %s\n", __func__);
return TPM_E_NO_DEVICE;
@ -125,7 +125,7 @@ uint32_t tlcl_set_global_lock(void)
}
uint32_t tlcl_extend(int pcr_num, const uint8_t *in_digest,
uint8_t *out_digest)
uint8_t *out_digest)
{
VBDEBUG("MOCK_TPM: %s\n", __func__);
return TPM_E_NO_DEVICE;

View File

@ -41,14 +41,14 @@
#endif
static inline void reg_script_set_dev(struct reg_script_context *ctx,
device_t dev)
device_t dev)
{
ctx->dev = dev;
ctx->res = NULL;
}
static inline void reg_script_set_step(struct reg_script_context *ctx,
const struct reg_script *step)
const struct reg_script *step)
{
ctx->step = step;
}
@ -603,7 +603,7 @@ static void reg_script_rxw(struct reg_script_context *ctx)
* as the previous one. That will run to completion and then move on to the
* next step of the previous context. */
static void reg_script_run_next(struct reg_script_context *ctx,
const struct reg_script *step);
const struct reg_script *step);
static void reg_script_run_step(struct reg_script_context *ctx,
@ -670,7 +670,7 @@ static void reg_script_run_with_context(struct reg_script_context *ctx)
}
static void reg_script_run_next(struct reg_script_context *prev_ctx,
const struct reg_script *step)
const struct reg_script *step)
{
struct reg_script_context ctx;

View File

@ -33,7 +33,7 @@ static inline int rmodule_is_loaded(const struct rmodule *module)
/* Calculate a loaded program address based on the blob address. */
static inline void *rmodule_load_addr(const struct rmodule *module,
uintptr_t blob_addr)
uintptr_t blob_addr)
{
char *loc = module->location;
return &loc[blob_addr - module->header->module_link_start_address];
@ -66,7 +66,7 @@ int rmodule_parse(void *ptr, struct rmodule *module)
/* The payload lives after the header. */
module->payload = &base[rhdr->payload_begin_offset];
module->payload_size = rhdr->payload_end_offset -
rhdr->payload_begin_offset;
rhdr->payload_begin_offset;
module->relocations = &base[rhdr->relocations_begin_offset];
return 0;
@ -204,7 +204,7 @@ int rmodule_load(void *base, struct rmodule *module)
}
int rmodule_calc_region(unsigned int region_alignment, size_t rmodule_size,
size_t *region_size, int *load_offset)
size_t *region_size, int *load_offset)
{
/* region_alignment must be a power of 2. */
if (region_alignment & (region_alignment - 1))
@ -270,7 +270,7 @@ int rmodule_stage_load(struct rmod_stage_load *rsl)
rmodule_offset =
rmodule_calc_region(DYN_CBMEM_ALIGN_SIZE,
stage.memlen, &region_size, &load_offset);
stage.memlen, &region_size, &load_offset);
stage_region = cbmem_add(rsl->cbmem_id, region_size);

View File

@ -416,32 +416,32 @@ static int load_self_segments(struct segment *head, struct prog *payload,
/* Copy data from the initial buffer */
switch (ptr->compression) {
case CBFS_COMPRESS_LZMA: {
printk(BIOS_DEBUG, "using LZMA\n");
timestamp_add_now(TS_START_ULZMA);
len = ulzman(src, len, dest, memsz);
timestamp_add_now(TS_END_ULZMA);
if (!len) /* Decompression Error. */
return 0;
break;
}
case CBFS_COMPRESS_LZ4: {
printk(BIOS_DEBUG, "using LZ4\n");
timestamp_add_now(TS_START_ULZ4F);
len = ulz4fn(src, len, dest, memsz);
timestamp_add_now(TS_END_ULZ4F);
if (!len) /* Decompression Error. */
return 0;
break;
}
case CBFS_COMPRESS_NONE: {
printk(BIOS_DEBUG, "it's not compressed!\n");
memcpy(dest, src, len);
break;
}
default:
printk(BIOS_INFO, "CBFS: Unknown compression type %d\n", ptr->compression);
return -1;
case CBFS_COMPRESS_LZMA: {
printk(BIOS_DEBUG, "using LZMA\n");
timestamp_add_now(TS_START_ULZMA);
len = ulzman(src, len, dest, memsz);
timestamp_add_now(TS_END_ULZMA);
if (!len) /* Decompression Error. */
return 0;
break;
}
case CBFS_COMPRESS_LZ4: {
printk(BIOS_DEBUG, "using LZ4\n");
timestamp_add_now(TS_START_ULZ4F);
len = ulz4fn(src, len, dest, memsz);
timestamp_add_now(TS_END_ULZ4F);
if (!len) /* Decompression Error. */
return 0;
break;
}
case CBFS_COMPRESS_NONE: {
printk(BIOS_DEBUG, "it's not compressed!\n");
memcpy(dest, src, len);
break;
}
default:
printk(BIOS_INFO, "CBFS: Unknown compression type %d\n", ptr->compression);
return -1;
}
/* Calculate middle after any changes to len. */
middle = dest + len;

View File

@ -190,8 +190,8 @@ int read_ddr3_spd_from_cbfs(u8 *buf, int idx)
u16 crc = spd_ddr3_calc_crc(buf, CONFIG_DIMM_SPD_SIZE);
if (((buf[SPD_CRC_LO] == 0) && (buf[SPD_CRC_HI] == 0))
|| (buf[SPD_CRC_LO] != (crc & 0xff))
|| (buf[SPD_CRC_HI] != (crc >> 8))) {
|| (buf[SPD_CRC_LO] != (crc & 0xff))
|| (buf[SPD_CRC_HI] != (crc >> 8))) {
printk(BIOS_WARNING, "SPD CRC %02x%02x is invalid, should be %04x\n",
buf[SPD_CRC_HI], buf[SPD_CRC_LO], crc);
buf[SPD_CRC_LO] = crc & 0xff;
@ -204,7 +204,7 @@ int read_ddr3_spd_from_cbfs(u8 *buf, int idx)
printk(BIOS_WARNING, "%02x ", buf[i]);
}
printk(BIOS_WARNING, "\n");
}
return 0;
}
return 0;
}
#endif

View File

@ -186,8 +186,8 @@ static void asmlinkage call_wrapper_block_state(void *arg)
/* Prepare a thread so that it starts by executing thread_entry(thread_arg).
* Within thread_entry() it will call func(arg). */
static void prepare_thread(struct thread *t, void *func, void *arg,
asmlinkage void(*thread_entry)(void *),
void *thread_arg)
asmlinkage void(*thread_entry)(void *),
void *thread_arg)
{
/* Stash the function and argument to run. */
t->entry = func;
@ -305,7 +305,7 @@ int thread_run(void (*func)(void *), void *arg)
}
int thread_run_until(void (*func)(void *), void *arg,
boot_state_t state, boot_state_sequence_t seq)
boot_state_t state, boot_state_sequence_t seq)
{
struct thread *current;
struct thread *t;

View File

@ -49,7 +49,7 @@ static inline struct timeout_callback *timer_queue_head(struct timer_queue *tq)
}
static int timer_queue_insert(struct timer_queue *tq,
struct timeout_callback *tocb)
struct timeout_callback *tocb)
{
int index;
@ -99,7 +99,7 @@ static int timer_queue_min_child_index(struct timer_queue *tq, int index)
return left_child_index;
if (mono_time_cmp(&tq->queue[left_child_index]->expiration,
&tq->queue[right_child_index]->expiration) < 0) {
&tq->queue[right_child_index]->expiration) < 0) {
return left_child_index;
}
return right_child_index;

View File

@ -75,7 +75,7 @@ static inline int tpm_return_code(const uint8_t *buffer) {
* DOING_SELFTEST errors are returned.
*/
static uint32_t tlcl_send_receive_no_retry(const uint8_t *request,
uint8_t *response, int max_length) {
uint8_t *response, int max_length) {
uint32_t response_length = max_length;
uint32_t result;
@ -116,7 +116,7 @@ uint32_t tlcl_send_receive(const uint8_t *request, uint8_t *response,
#if defined(TPM_BLOCKING_CONTINUESELFTEST) || defined(VB_RECOVERY_MODE)
/* Retry only once */
result = tlcl_send_receive_no_retry(request, response,
max_length);
max_length);
#else
/* This needs serious testing. The TPM specification says: "iii.
* The caller MUST wait for the actions of TPM_ContinueSelfTest
@ -125,7 +125,7 @@ uint32_t tlcl_send_receive(const uint8_t *request, uint8_t *response,
* actions have completed other than trying again? */
do {
result = tlcl_send_receive_no_retry(request, response,
max_length);
max_length);
} while (result == TPM_E_DOING_SELFTEST);
#endif
}
@ -163,8 +163,8 @@ uint32_t tlcl_startup(void) {
}
uint32_t tlcl_resume(void) {
VBDEBUG("TPM: Resume\n");
return send(tpm_resume_cmd.buffer);
VBDEBUG("TPM: Resume\n");
return send(tpm_resume_cmd.buffer);
}
uint32_t tlcl_self_test_full(void)
@ -179,7 +179,7 @@ uint32_t tlcl_continue_self_test(void)
VBDEBUG("TPM: Continue self test\n");
/* Call the No Retry version of SendReceive to avoid recursion. */
return tlcl_send_receive_no_retry(tpm_continueselftest_cmd.buffer,
response, sizeof(response));
response, sizeof(response));
}
uint32_t tlcl_define_space(uint32_t index, uint32_t perm, uint32_t size)
@ -280,7 +280,7 @@ uint32_t tlcl_get_permanent_flags(TPM_PERMANENT_FLAGS *pflags)
uint8_t response[TPM_LARGE_ENOUGH_COMMAND_SIZE];
uint32_t size;
uint32_t result = tlcl_send_receive(tpm_getflags_cmd.buffer, response,
sizeof(response));
sizeof(response));
if (result != TPM_SUCCESS)
return result;
from_tpm_uint32(response + kTpmResponseHeaderLength, &size);
@ -291,7 +291,7 @@ uint32_t tlcl_get_permanent_flags(TPM_PERMANENT_FLAGS *pflags)
}
uint32_t tlcl_get_flags(uint8_t *disable, uint8_t *deactivated,
uint8_t *nvlocked)
uint8_t *nvlocked)
{
TPM_PERMANENT_FLAGS pflags;
uint32_t result = tlcl_get_permanent_flags(&pflags);
@ -316,7 +316,7 @@ uint32_t tlcl_set_global_lock(void)
}
uint32_t tlcl_extend(int pcr_num, const uint8_t *in_digest,
uint8_t *out_digest)
uint8_t *out_digest)
{
struct s_tpm_extend_cmd cmd;
uint8_t response[kTpmResponseHeaderLength + kPcrDigestLength];

View File

@ -1,136 +1,136 @@
/* This file is automatically generated */
const struct s_tpm_extend_cmd{
uint8_t buffer[34];
uint16_t pcrNum;
uint16_t inDigest;
uint8_t buffer[34];
uint16_t pcrNum;
uint16_t inDigest;
} tpm_extend_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x22, 0x0, 0x0, 0x0, 0x14, },
10, 14, };
const struct s_tpm_get_random_cmd{
uint8_t buffer[14];
uint16_t bytesRequested;
uint8_t buffer[14];
uint16_t bytesRequested;
} tpm_get_random_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xe, 0x0, 0x0, 0x0, 0x46, },
10, };
const struct s_tpm_getownership_cmd{
uint8_t buffer[22];
uint8_t buffer[22];
} tpm_getownership_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x16, 0x0, 0x0, 0x0, 0x65, 0x0, 0x0, 0x0, 0x5, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x1, 0x11, },
};
const struct s_tpm_getpermissions_cmd{
uint8_t buffer[22];
uint16_t index;
uint8_t buffer[22];
uint16_t index;
} tpm_getpermissions_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x16, 0x0, 0x0, 0x0, 0x65, 0x0, 0x0, 0x0, 0x11, 0x0, 0x0, 0x0, 0x4, },
18, };
const struct s_tpm_getstclearflags_cmd{
uint8_t buffer[22];
uint8_t buffer[22];
} tpm_getstclearflags_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x16, 0x0, 0x0, 0x0, 0x65, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x1, 0x9, },
};
const struct s_tpm_getflags_cmd{
uint8_t buffer[22];
uint8_t buffer[22];
} tpm_getflags_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x16, 0x0, 0x0, 0x0, 0x65, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x1, 0x8, },
};
const struct s_tpm_physicalsetdeactivated_cmd{
uint8_t buffer[11];
uint16_t deactivated;
uint8_t buffer[11];
uint16_t deactivated;
} tpm_physicalsetdeactivated_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xb, 0x0, 0x0, 0x0, 0x72, },
10, };
const struct s_tpm_physicalenable_cmd{
uint8_t buffer[10];
uint8_t buffer[10];
} tpm_physicalenable_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x6f, },
};
const struct s_tpm_physicaldisable_cmd{
uint8_t buffer[10];
uint8_t buffer[10];
} tpm_physicaldisable_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x70, },
};
const struct s_tpm_forceclear_cmd{
uint8_t buffer[10];
uint8_t buffer[10];
} tpm_forceclear_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x5d, },
};
const struct s_tpm_readpubek_cmd{
uint8_t buffer[30];
uint8_t buffer[30];
} tpm_readpubek_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x1e, 0x0, 0x0, 0x0, 0x7c, },
};
const struct s_tpm_continueselftest_cmd{
uint8_t buffer[10];
uint8_t buffer[10];
} tpm_continueselftest_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x53, },
};
const struct s_tpm_selftestfull_cmd{
uint8_t buffer[10];
uint8_t buffer[10];
} tpm_selftestfull_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x50, },
};
const struct s_tpm_resume_cmd{
uint8_t buffer[12];
uint8_t buffer[12];
} tpm_resume_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0, 0x99, 0x0, 0x2, },
};
const struct s_tpm_savestate_cmd{
uint8_t buffer[10];
uint8_t buffer[10];
} tpm_savestate_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x98, },
};
const struct s_tpm_startup_cmd{
uint8_t buffer[12];
uint8_t buffer[12];
} tpm_startup_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0, 0x99, 0x0, 0x1, },
};
const struct s_tpm_finalizepp_cmd{
uint8_t buffer[12];
uint8_t buffer[12];
} tpm_finalizepp_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x40, 0x0, 0x0, 0xa, 0x2, 0xa0, },
};
const struct s_tpm_pplock_cmd{
uint8_t buffer[12];
uint8_t buffer[12];
} tpm_pplock_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x40, 0x0, 0x0, 0xa, 0x0, 0x4, },
};
const struct s_tpm_ppenable_cmd{
uint8_t buffer[12];
uint8_t buffer[12];
} tpm_ppenable_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x40, 0x0, 0x0, 0xa, 0x0, 0x20, },
};
const struct s_tpm_ppassert_cmd{
uint8_t buffer[12];
uint8_t buffer[12];
} tpm_ppassert_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x40, 0x0, 0x0, 0xa, 0x0, 0x8, },
};
const struct s_tpm_pcr_read_cmd{
uint8_t buffer[14];
uint16_t pcrNum;
uint8_t buffer[14];
uint16_t pcrNum;
} tpm_pcr_read_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xe, 0x0, 0x0, 0x0, 0x15, },
10, };
const struct s_tpm_nv_read_cmd{
uint8_t buffer[22];
uint16_t index;
uint16_t length;
uint8_t buffer[22];
uint16_t index;
uint16_t length;
} tpm_nv_read_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x16, 0x0, 0x0, 0x0, 0xcf, },
10, 18, };
const struct s_tpm_nv_write_cmd{
uint8_t buffer[256];
uint16_t index;
uint16_t length;
uint16_t data;
uint8_t buffer[256];
uint16_t index;
uint16_t length;
uint16_t data;
} tpm_nv_write_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xcd, },
10, 18, 22, };
const struct s_tpm_nv_definespace_cmd{
uint8_t buffer[101];
uint16_t index;
uint16_t perm;
uint16_t size;
uint8_t buffer[101];
uint16_t index;
uint16_t perm;
uint16_t size;
} tpm_nv_definespace_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x65, 0x0, 0x0, 0x0, 0xcc, 0x0, 0x18, 0, 0, 0, 0, 0x0, 0x3, 0, 0, 0, 0x1f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0, 0x3, 0, 0, 0, 0x1f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0, 0x17, },
12, 70, 77, };