src/lib: Wrap lines at 80 columns
Fix the following warning detected by checkpatch.pl: WARNING: line over 80 characters TEST=Build and run on Galileo Gen2 Change-Id: I5fa3f8e950e2f0c60bd0e8f030342dc8c0469299 Signed-off-by: Lee Leahy <Leroy.P.Leahy@intel.com> Reviewed-on: https://review.coreboot.org/18758 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
parent
b1260553be
commit
7340217262
|
@ -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;
|
||||
|
|
|
@ -31,7 +31,8 @@ unsigned long compute_ip_checksum(const void *addr, unsigned long length)
|
|||
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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -425,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;
|
||||
|
@ -445,7 +447,8 @@ static unsigned long lb_table_fini(struct lb_header *head)
|
|||
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,
|
||||
|
@ -483,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
|
||||
|
|
339
src/lib/edid.c
339
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;
|
||||
|
||||
|
@ -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 " : "",
|
||||
|
@ -219,13 +221,15 @@ detailed_block(struct edid *result_edid, unsigned char *x, int in_extension,
|
|||
/* Monitor descriptor block, not detailed timing descriptor. */
|
||||
if (x[2] != 0) {
|
||||
/* 1.3, 3.10.3 */
|
||||
printk(BIOS_SPEW, "Monitor descriptor block has byte 2 nonzero (0x%02x)\n",
|
||||
printk(BIOS_SPEW,
|
||||
"Monitor descriptor block has byte 2 nonzero (0x%02x)\n",
|
||||
x[2]);
|
||||
c->has_valid_descriptor_pad = 0;
|
||||
}
|
||||
if (x[3] != 0xfd && x[4] != 0x00) {
|
||||
/* 1.3, 3.10.3 */
|
||||
printk(BIOS_SPEW, "Monitor descriptor block has byte 4 nonzero (0x%02x)\n",
|
||||
printk(BIOS_SPEW,
|
||||
"Monitor descriptor block has byte 4 nonzero (0x%02x)\n",
|
||||
x[4]);
|
||||
c->has_valid_descriptor_pad = 0;
|
||||
}
|
||||
|
@ -233,11 +237,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 +266,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,7 +298,8 @@ 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) {
|
||||
|
@ -339,12 +347,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;
|
||||
|
@ -354,12 +364,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;
|
||||
}
|
||||
|
@ -369,14 +382,17 @@ 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" : "",
|
||||
x[14] & 0x40 ? "16:9" : "",
|
||||
x[14] & 0x20 ? "16:10" : "",
|
||||
x[14] & 0x10 ? "5:4" : "",
|
||||
x[14] & 0x08 ? "15:9" : "");
|
||||
printk(BIOS_SPEW,
|
||||
"Supported aspect ratios: %s %s %s %s %s\n",
|
||||
x[14] & 0x80 ? "4:3" : "",
|
||||
x[14] & 0x40 ? "16:9" : "",
|
||||
x[14] & 0x20 ? "16:10" : "",
|
||||
x[14] & 0x10 ? "5:4" : "",
|
||||
x[14] & 0x08 ? "15:9" : "");
|
||||
if (x[14] & 0x07)
|
||||
c->has_valid_range_descriptor = 0;
|
||||
|
||||
|
@ -404,54 +420,69 @@ detailed_block(struct edid *result_edid, unsigned char *x, int in_extension,
|
|||
printk(BIOS_SPEW, "\n");
|
||||
|
||||
if (x[15] & 0x04)
|
||||
printk(BIOS_SPEW, "Supports CVT standard blanking\n");
|
||||
printk(BIOS_SPEW,
|
||||
"Supports CVT standard blanking\n");
|
||||
if (x[15] & 0x10)
|
||||
printk(BIOS_SPEW, "Supports CVT reduced blanking\n");
|
||||
printk(BIOS_SPEW,
|
||||
"Supports CVT reduced blanking\n");
|
||||
|
||||
if (x[15] & 0x07)
|
||||
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");
|
||||
printk(BIOS_SPEW,
|
||||
" Horizontal shrink\n");
|
||||
if (x[16] & 0x40)
|
||||
printk(BIOS_SPEW, " Horizontal stretch\n");
|
||||
printk(BIOS_SPEW,
|
||||
" Horizontal stretch\n");
|
||||
if (x[16] & 0x20)
|
||||
printk(BIOS_SPEW, " Vertical shrink\n");
|
||||
printk(BIOS_SPEW,
|
||||
" Vertical shrink\n");
|
||||
if (x[16] & 0x10)
|
||||
printk(BIOS_SPEW, " Vertical stretch\n");
|
||||
printk(BIOS_SPEW,
|
||||
" Vertical stretch\n");
|
||||
}
|
||||
|
||||
if (x[16] & 0x0f)
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -539,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",
|
||||
|
@ -576,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)");
|
||||
|
@ -626,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" : "",
|
||||
|
@ -637,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -700,8 +736,11 @@ cea_hdmi_block(struct edid *out, unsigned char *x)
|
|||
}
|
||||
|
||||
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]);
|
||||
printk(BIOS_SPEW,
|
||||
" Interlaced video latency: %d\n", x[9 + b]);
|
||||
printk(BIOS_SPEW,
|
||||
" Interlaced audio latency: %d\n",
|
||||
x[10 + b]);
|
||||
b += 2;
|
||||
}
|
||||
|
||||
|
@ -712,11 +751,13 @@ cea_hdmi_block(struct edid *out, unsigned char *x)
|
|||
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");
|
||||
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");
|
||||
printk(BIOS_SPEW,
|
||||
" 3D-capable-VIC mask present\n");
|
||||
formats = 1;
|
||||
mask = 1;
|
||||
}
|
||||
|
@ -755,14 +796,17 @@ cea_hdmi_block(struct edid *out, unsigned char *x)
|
|||
}
|
||||
if (mask) {
|
||||
int i;
|
||||
printk(BIOS_SPEW, " 3D VIC indices:");
|
||||
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);
|
||||
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,
|
||||
" %d", i + 8);
|
||||
printk(BIOS_SPEW, "\n");
|
||||
b += 2;
|
||||
}
|
||||
|
@ -796,7 +840,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
|
||||
|
@ -818,7 +863,8 @@ cea_block(struct edid *out, unsigned char *x)
|
|||
printk(BIOS_SPEW, "vendor-specific video data block\n");
|
||||
break;
|
||||
case 0x02:
|
||||
printk(BIOS_SPEW, "VESA video display device information data block\n");
|
||||
printk(BIOS_SPEW,
|
||||
"VESA video display device information data block\n");
|
||||
break;
|
||||
case 0x03:
|
||||
printk(BIOS_SPEW, "VESA video data block\n");
|
||||
|
@ -840,9 +886,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;
|
||||
|
@ -853,7 +901,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;
|
||||
}
|
||||
}
|
||||
|
@ -876,27 +925,37 @@ parse_cea(struct edid *out, unsigned char *x, struct edid_context *c)
|
|||
break;
|
||||
|
||||
if (version < 3)
|
||||
printk(BIOS_SPEW, "%d 8-byte timing descriptors\n", (offset - 4) / 8);
|
||||
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);
|
||||
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");
|
||||
printk(BIOS_SPEW,
|
||||
"Underscans PC formats by default\n");
|
||||
if (x[3] & 0x40)
|
||||
printk(BIOS_SPEW, "Basic audio support\n");
|
||||
printk(BIOS_SPEW,
|
||||
"Basic audio support\n");
|
||||
if (x[3] & 0x20)
|
||||
printk(BIOS_SPEW, "Supports YCbCr 4:4:4\n");
|
||||
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);
|
||||
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)
|
||||
for (detailed = x + offset; detailed + 18 < x + 127;
|
||||
detailed += 18)
|
||||
if (detailed[0])
|
||||
detailed_block(out, detailed, 1, c);
|
||||
} while (0);
|
||||
|
@ -1106,15 +1165,19 @@ 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",
|
||||
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;
|
||||
|
@ -1129,7 +1192,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]) {
|
||||
|
@ -1157,14 +1221,17 @@ 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",
|
||||
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_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");
|
||||
printk(BIOS_SPEW,
|
||||
"Digital interface is not defined\n");
|
||||
break;
|
||||
case 0x01:
|
||||
printk(BIOS_SPEW, "DVI interface\n");
|
||||
|
@ -1194,7 +1261,8 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
|
|||
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;
|
||||
|
@ -1211,22 +1279,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 " : "");
|
||||
}
|
||||
|
||||
|
||||
|
@ -1236,12 +1308,14 @@ 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",
|
||||
ratio / 1000, ratio % 1000);
|
||||
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",
|
||||
ratio / 1000, ratio % 1000);
|
||||
printk(BIOS_SPEW,
|
||||
"Aspect ratio is %u.%03u (portrait)\n",
|
||||
ratio / 1000, ratio % 1000);
|
||||
}
|
||||
} else {
|
||||
/* Either or both can be zero for 1.3 and before */
|
||||
|
@ -1250,7 +1324,8 @@ 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");
|
||||
|
@ -1294,13 +1369,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 */
|
||||
|
||||
|
@ -1310,13 +1388,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;
|
||||
}
|
||||
}
|
||||
|
@ -1332,7 +1415,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;
|
||||
|
@ -1404,14 +1488,18 @@ 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");
|
||||
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) {
|
||||
|
@ -1429,13 +1517,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");
|
||||
|
@ -1443,28 +1533,36 @@ 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");
|
||||
printk(BIOS_ERR,
|
||||
"\tDetailed block string not properly terminated\n");
|
||||
} else if (c.claims_one_point_two) {
|
||||
if (c.nonconformant_digital_display ||
|
||||
!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",
|
||||
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");
|
||||
printk(BIOS_ERR,
|
||||
"\tDetailed block string not properly terminated\n");
|
||||
} else if (c.claims_one_point_oh) {
|
||||
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");
|
||||
printk(BIOS_ERR,
|
||||
"\tHas descriptor blocks other than detailed timings\n");
|
||||
}
|
||||
|
||||
if (c.nonconformant_extension ||
|
||||
|
@ -1481,7 +1579,8 @@ 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",
|
||||
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");
|
||||
|
@ -1492,19 +1591,25 @@ 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");
|
||||
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)
|
||||
|
@ -1596,8 +1701,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.
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -493,7 +493,8 @@ extern void __gcov_merge_ior(gcov_type *, unsigned int) ATTRIBUTE_HIDDEN;
|
|||
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_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);
|
||||
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
/* 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
|
||||
|
|
|
@ -166,7 +166,8 @@ 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;
|
||||
|
||||
|
|
|
@ -353,7 +353,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,22 +386,34 @@ 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;
|
||||
|
@ -498,7 +511,8 @@ 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;
|
||||
|
@ -538,7 +552,8 @@ static int dec_rec2(struct in *in, struct dec_hufftbl *hu, int *runp, int c,
|
|||
) \
|
||||
)
|
||||
|
||||
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;
|
||||
|
@ -569,7 +584,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++)
|
||||
|
@ -595,15 +611,19 @@ 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 */
|
||||
/* both fit in table */
|
||||
if (v + i < DECBITS) {
|
||||
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 |
|
||||
x = v << 16 | (hu->vals[k]
|
||||
& 0xf0) << 4 |
|
||||
(DECBITS - (i + 1));
|
||||
hu->llvals[c | d] = x;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -633,7 +633,8 @@ rewrite:;
|
|||
if (!cs_all->runs && cs_prg->runs)
|
||||
memcpy(cs_all, cs_prg, sizeof(*cs_all));
|
||||
else if (!all_prg.checksum
|
||||
&& (!GCOV_LOCKED || cs_all->runs == cs_prg->runs)
|
||||
&& (!GCOV_LOCKED
|
||||
|| cs_all->runs == cs_prg->runs)
|
||||
&& memcmp(cs_all, cs_prg, sizeof(*cs_all))) {
|
||||
fprintf(stderr,
|
||||
"profiling:%s:Invocation mismatch - some data files may have been removed%s\n",
|
||||
|
@ -661,10 +662,12 @@ rewrite:;
|
|||
gcov_seek(eof_pos);
|
||||
|
||||
/* Write execution counts for each function. */
|
||||
for (f_ix = 0; (unsigned int)f_ix != gi_ptr->n_functions; f_ix++) {
|
||||
for (f_ix = 0; (unsigned int)f_ix != gi_ptr->n_functions;
|
||||
f_ix++) {
|
||||
unsigned int buffered = 0;
|
||||
|
||||
if (fn_buffer && fn_buffer->fn_ix == (unsigned int)f_ix) {
|
||||
if (fn_buffer && fn_buffer->fn_ix
|
||||
== (unsigned int)f_ix) {
|
||||
/* Buffered data from another program. */
|
||||
buffered = 1;
|
||||
gfi_ptr = &fn_buffer->info;
|
||||
|
@ -691,7 +694,8 @@ rewrite:;
|
|||
continue;
|
||||
|
||||
n_counts = ci_ptr->num;
|
||||
gcov_write_tag_length(GCOV_TAG_FOR_COUNTER(t_ix),
|
||||
gcov_write_tag_length(
|
||||
GCOV_TAG_FOR_COUNTER(t_ix),
|
||||
GCOV_TAG_COUNTER_LENGTH(n_counts));
|
||||
gcov_type *c_ptr = ci_ptr->values;
|
||||
while (n_counts--)
|
||||
|
@ -707,7 +711,8 @@ rewrite:;
|
|||
|
||||
read_fatal:;
|
||||
while (fn_buffer)
|
||||
fn_buffer = free_fn_data(gi_ptr, fn_buffer, GCOV_COUNTERS);
|
||||
fn_buffer = free_fn_data(gi_ptr, fn_buffer,
|
||||
GCOV_COUNTERS);
|
||||
|
||||
if ((error = gcov_close()))
|
||||
fprintf(stderr, error < 0 ?
|
||||
|
@ -1045,8 +1050,9 @@ __gcov_execl(const char *path, char *arg, ...)
|
|||
#endif
|
||||
|
||||
#ifdef L_gcov_execlp
|
||||
/* A wrapper for the execlp function. Flushes the accumulated profiling data, so
|
||||
that they are not lost. */
|
||||
/* A wrapper for the execlp function. Flushes the accumulated profiling data,
|
||||
* so that they are not lost.
|
||||
*/
|
||||
|
||||
int
|
||||
__gcov_execlp(const char *path, char *arg, ...)
|
||||
|
@ -1076,8 +1082,9 @@ __gcov_execlp(const char *path, char *arg, ...)
|
|||
#endif
|
||||
|
||||
#ifdef L_gcov_execle
|
||||
/* A wrapper for the execle function. Flushes the accumulated profiling data, so
|
||||
that they are not lost. */
|
||||
/* A wrapper for the execle function. Flushes the accumulated profiling data,
|
||||
* so that they are not lost.
|
||||
*/
|
||||
|
||||
int
|
||||
__gcov_execle(const char *path, char *arg, ...)
|
||||
|
@ -1121,8 +1128,9 @@ __gcov_execv(const char *path, char *const argv[])
|
|||
#endif
|
||||
|
||||
#ifdef L_gcov_execvp
|
||||
/* A wrapper for the execvp function. Flushes the accumulated profiling data, so
|
||||
that they are not lost. */
|
||||
/* A wrapper for the execvp function. Flushes the accumulated profiling data,
|
||||
* so that they are not lost.
|
||||
*/
|
||||
|
||||
int
|
||||
__gcov_execvp(const char *path, char *const argv[])
|
||||
|
@ -1133,8 +1141,9 @@ __gcov_execvp(const char *path, char *const argv[])
|
|||
#endif
|
||||
|
||||
#ifdef L_gcov_execve
|
||||
/* A wrapper for the execve function. Flushes the accumulated profiling data, so
|
||||
that they are not lost. */
|
||||
/* A wrapper for the execve function. Flushes the accumulated profiling data,
|
||||
* so that they are not lost.
|
||||
*/
|
||||
|
||||
int
|
||||
__gcov_execve(const char *path, char *const argv[], char *const envp[])
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
* Copyright (C) 2006 Carl-Daniel Hailfinger
|
||||
* Released under the GNU GPL v2 or later
|
||||
*
|
||||
* Parts of this file are based on C/7zip/Compress/LZMA_C/LzmaTest.c from the LZMA
|
||||
* SDK 4.42, which is written and distributed to public domain by Igor Pavlov.
|
||||
* Parts of this file are based on C/7zip/Compress/LZMA_C/LzmaTest.c from the
|
||||
* LZMA SDK 4.42, which is written and distributed to public domain by Igor
|
||||
* Pavlov.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -33,9 +33,12 @@
|
|||
* to byte reads for last 4 bytes since RC_TEST returns an error when BufferLim
|
||||
* is *reached* (not surpassed!), meaning we can't allow that to happen while
|
||||
* there are still bytes to decode from the algorithm's point of view. */
|
||||
#define RC_READ_BYTE (look_ahead_ptr < 4 ? look_ahead.raw[look_ahead_ptr++] \
|
||||
: ((((uintptr_t) Buffer & 3) || ((SizeT) (BufferLim - Buffer) <= 4)) ? (*Buffer++) \
|
||||
: ((look_ahead.dw = *(UInt32 *)Buffer), (Buffer += 4), (look_ahead_ptr = 1), look_ahead.raw[0])))
|
||||
#define RC_READ_BYTE \
|
||||
(look_ahead_ptr < 4 ? look_ahead.raw[look_ahead_ptr++] \
|
||||
: ((((uintptr_t) Buffer & 3) \
|
||||
|| ((SizeT) (BufferLim - Buffer) <= 4)) ? (*Buffer++) \
|
||||
: ((look_ahead.dw = *(UInt32 *)Buffer), (Buffer += 4), \
|
||||
(look_ahead_ptr = 1), look_ahead.raw[0])))
|
||||
|
||||
#define RC_INIT2 Code = 0; Range = 0xFFFFFFFF; \
|
||||
{ \
|
||||
|
@ -50,18 +53,41 @@
|
|||
|
||||
#define RC_TEST { if (Buffer == BufferLim) return LZMA_RESULT_DATA_ERROR; }
|
||||
|
||||
#define RC_INIT(buffer, bufferSize) Buffer = buffer; BufferLim = buffer + bufferSize; RC_INIT2
|
||||
#define RC_INIT(buffer, bufferSize) Buffer = buffer; \
|
||||
BufferLim = buffer + bufferSize; RC_INIT2
|
||||
|
||||
|
||||
#define RC_NORMALIZE if (Range < kTopValue) { RC_TEST; Range <<= 8; Code = (Code << 8) | RC_READ_BYTE; }
|
||||
#define RC_NORMALIZE \
|
||||
if (Range < kTopValue) { \
|
||||
RC_TEST; \
|
||||
Range <<= 8; \
|
||||
Code = (Code << 8) | RC_READ_BYTE; \
|
||||
}
|
||||
|
||||
#define IfBit0(p) RC_NORMALIZE; bound = (Range >> kNumBitModelTotalBits) * *(p); if (Code < bound)
|
||||
#define UpdateBit0(p) Range = bound; *(p) += (kBitModelTotal - *(p)) >> kNumMoveBits;
|
||||
#define UpdateBit1(p) Range -= bound; Code -= bound; *(p) -= (*(p)) >> kNumMoveBits;
|
||||
#define IfBit0(p) \
|
||||
RC_NORMALIZE; \
|
||||
bound = (Range >> kNumBitModelTotalBits) * *(p); \
|
||||
if (Code < bound)
|
||||
|
||||
#define RC_GET_BIT2(p, mi, A0, A1) IfBit0(p) \
|
||||
{ UpdateBit0(p); mi <<= 1; A0; } else \
|
||||
{ UpdateBit1(p); mi = (mi + mi) + 1; A1; }
|
||||
#define UpdateBit0(p) \
|
||||
Range = bound; \
|
||||
*(p) += (kBitModelTotal - *(p)) >> kNumMoveBits;
|
||||
|
||||
#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; \
|
||||
}
|
||||
|
||||
#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ;, ;)
|
||||
|
||||
|
@ -128,7 +154,8 @@
|
|||
StopCompilingDueBUG
|
||||
#endif
|
||||
|
||||
int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size)
|
||||
int LzmaDecodeProperties(CLzmaProperties *propsRes,
|
||||
const unsigned char *propsData, int size)
|
||||
{
|
||||
unsigned char prop0;
|
||||
if (size < LZMA_PROPERTIES_SIZE)
|
||||
|
@ -252,16 +279,21 @@ int LzmaDecode(CLzmaDecoderState *vs,
|
|||
prob = p + IsRepG0 + state;
|
||||
IfBit0(prob) {
|
||||
UpdateBit0(prob);
|
||||
prob = p + IsRep0Long + (state << kNumPosBitsMax) + posState;
|
||||
prob = p + IsRep0Long
|
||||
+ (state << kNumPosBitsMax)
|
||||
+ posState;
|
||||
IfBit0(prob) {
|
||||
UpdateBit0(prob);
|
||||
|
||||
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
|
||||
|
@ -297,7 +329,8 @@ int LzmaDecode(CLzmaDecoderState *vs,
|
|||
CProb *probLen = prob + LenChoice;
|
||||
IfBit0(probLen) {
|
||||
UpdateBit0(probLen);
|
||||
probLen = prob + LenLow + (posState << kLenNumLowBits);
|
||||
probLen = prob + LenLow
|
||||
+ (posState << kLenNumLowBits);
|
||||
offset = 0;
|
||||
numBits = kLenNumLowBits;
|
||||
} else {
|
||||
|
@ -305,17 +338,21 @@ int LzmaDecode(CLzmaDecoderState *vs,
|
|||
probLen = prob + LenChoice2;
|
||||
IfBit0(probLen) {
|
||||
UpdateBit0(probLen);
|
||||
probLen = prob + LenMid + (posState << kLenNumMidBits);
|
||||
probLen = prob + LenMid
|
||||
+ (posState <<
|
||||
kLenNumMidBits);
|
||||
offset = kLenNumLowSymbols;
|
||||
numBits = kLenNumMidBits;
|
||||
} else {
|
||||
UpdateBit1(probLen);
|
||||
probLen = prob + LenHigh;
|
||||
offset = kLenNumLowSymbols + kLenNumMidSymbols;
|
||||
offset = kLenNumLowSymbols
|
||||
+ kLenNumMidSymbols;
|
||||
numBits = kLenNumHighBits;
|
||||
}
|
||||
}
|
||||
RangeDecoderBitTreeDecode(probLen, numBits, len);
|
||||
RangeDecoderBitTreeDecode(probLen, numBits,
|
||||
len);
|
||||
len += offset;
|
||||
}
|
||||
|
||||
|
@ -323,15 +360,19 @@ int LzmaDecode(CLzmaDecoderState *vs,
|
|||
int posSlot;
|
||||
state += kNumLitStates;
|
||||
prob = p + PosSlot +
|
||||
((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
|
||||
((len < kNumLenToPosStates ? len :
|
||||
kNumLenToPosStates - 1) <<
|
||||
kNumPosSlotBits);
|
||||
RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot);
|
||||
RangeDecoderBitTreeDecode(prob, kNumPosSlotBits,
|
||||
posSlot);
|
||||
if (posSlot >= kStartPosModelIndex) {
|
||||
int numDirectBits = ((posSlot >> 1) - 1);
|
||||
int numDirectBits = ((posSlot >> 1)
|
||||
- 1);
|
||||
rep0 = (2 | ((UInt32)posSlot & 1));
|
||||
if (posSlot < kEndPosModelIndex) {
|
||||
rep0 <<= numDirectBits;
|
||||
prob = p + SpecPos + rep0 - posSlot - 1;
|
||||
prob = p + SpecPos + rep0
|
||||
- posSlot - 1;
|
||||
} else {
|
||||
numDirectBits -= kNumAlignBits;
|
||||
do {
|
||||
|
@ -351,8 +392,10 @@ int LzmaDecode(CLzmaDecoderState *vs,
|
|||
int i = 1;
|
||||
int mi = 1;
|
||||
do {
|
||||
CProb *prob3 = prob + mi;
|
||||
RC_GET_BIT2(prob3, mi, ;, rep0 |= i);
|
||||
CProb *prob3 = prob
|
||||
+ mi;
|
||||
RC_GET_BIT2(prob3, mi,
|
||||
;, rep0 |= i);
|
||||
i <<= 1;
|
||||
} while (--numDirectBits != 0);
|
||||
}
|
||||
|
|
|
@ -44,9 +44,11 @@ typedef struct _CLzmaProperties {
|
|||
int pb;
|
||||
} CLzmaProperties;
|
||||
|
||||
int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size);
|
||||
int LzmaDecodeProperties(CLzmaProperties *propsRes,
|
||||
const unsigned char *propsData, int size);
|
||||
|
||||
#define LzmaGetNumProbs(Properties) (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((Properties)->lc + (Properties)->lp)))
|
||||
#define LzmaGetNumProbs(Properties) (LZMA_BASE_SIZE + (LZMA_LIT_SIZE \
|
||||
<< ((Properties)->lc + (Properties)->lp)))
|
||||
|
||||
#define kLzmaNeedInitId (-2)
|
||||
|
||||
|
|
|
@ -170,7 +170,8 @@ static int relocate_segment(unsigned long buffer, struct segment *seg)
|
|||
/* compute the new value of start */
|
||||
start = seg->s_dstaddr;
|
||||
|
||||
printk(BIOS_SPEW, " early: [0x%016lx, 0x%016lx, 0x%016lx)\n",
|
||||
printk(BIOS_SPEW,
|
||||
" early: [0x%016lx, 0x%016lx, 0x%016lx)\n",
|
||||
new->s_dstaddr,
|
||||
new->s_dstaddr + new->s_filesz,
|
||||
new->s_dstaddr + new->s_memsz);
|
||||
|
@ -199,7 +200,8 @@ static int relocate_segment(unsigned long buffer, struct segment *seg)
|
|||
/* Order by stream offset */
|
||||
segment_insert_after(seg, new);
|
||||
|
||||
printk(BIOS_SPEW, " late: [0x%016lx, 0x%016lx, 0x%016lx)\n",
|
||||
printk(BIOS_SPEW,
|
||||
" late: [0x%016lx, 0x%016lx, 0x%016lx)\n",
|
||||
new->s_dstaddr,
|
||||
new->s_dstaddr + new->s_filesz,
|
||||
new->s_dstaddr + new->s_memsz);
|
||||
|
@ -274,8 +276,10 @@ static int build_self_segment_list(
|
|||
+ segment.offset;
|
||||
new->s_filesz = segment.len;
|
||||
|
||||
printk(BIOS_DEBUG, " New segment dstaddr 0x%lx memsize 0x%lx srcaddr 0x%lx filesize 0x%lx\n",
|
||||
new->s_dstaddr, new->s_memsz, new->s_srcaddr, new->s_filesz);
|
||||
printk(BIOS_DEBUG,
|
||||
" New segment dstaddr 0x%lx memsize 0x%lx srcaddr 0x%lx filesize 0x%lx\n",
|
||||
new->s_dstaddr, new->s_memsz, new->s_srcaddr,
|
||||
new->s_filesz);
|
||||
|
||||
/* Clean up the values */
|
||||
if (new->s_filesz > new->s_memsz) {
|
||||
|
@ -394,17 +398,20 @@ static int load_self_segments(struct segment *head, struct prog *payload,
|
|||
for (ptr = head->next; ptr != head; ptr = ptr->next) {
|
||||
unsigned char *dest, *src, *middle, *end;
|
||||
size_t len, memsz;
|
||||
printk(BIOS_DEBUG, "Loading Segment: addr: 0x%016lx memsz: 0x%016lx filesz: 0x%016lx\n",
|
||||
printk(BIOS_DEBUG,
|
||||
"Loading Segment: addr: 0x%016lx memsz: 0x%016lx filesz: 0x%016lx\n",
|
||||
ptr->s_dstaddr, ptr->s_memsz, ptr->s_filesz);
|
||||
|
||||
/* Modify the segment to load onto the bounce_buffer if necessary.
|
||||
/* Modify the segment to load onto the bounce_buffer if
|
||||
* necessary.
|
||||
*/
|
||||
if (relocate_segment(bounce_buffer, ptr)) {
|
||||
ptr = (ptr->prev)->prev;
|
||||
continue;
|
||||
}
|
||||
|
||||
printk(BIOS_DEBUG, "Post relocation: addr: 0x%016lx memsz: 0x%016lx filesz: 0x%016lx\n",
|
||||
printk(BIOS_DEBUG,
|
||||
"Post relocation: addr: 0x%016lx memsz: 0x%016lx filesz: 0x%016lx\n",
|
||||
ptr->s_dstaddr, ptr->s_memsz, ptr->s_filesz);
|
||||
|
||||
/* Compute the boundaries of the segment */
|
||||
|
@ -440,7 +447,8 @@ static int load_self_segments(struct segment *head, struct prog *payload,
|
|||
break;
|
||||
}
|
||||
default:
|
||||
printk(BIOS_INFO, "CBFS: Unknown compression type %d\n", ptr->compression);
|
||||
printk(BIOS_INFO, "CBFS: Unknown compression type %d\n",
|
||||
ptr->compression);
|
||||
return -1;
|
||||
}
|
||||
/* Calculate middle after any changes to len. */
|
||||
|
@ -453,28 +461,42 @@ static int load_self_segments(struct segment *head, struct prog *payload,
|
|||
|
||||
/* Zero the extra bytes between middle & end */
|
||||
if (middle < end) {
|
||||
printk(BIOS_DEBUG, "Clearing Segment: addr: 0x%016lx memsz: 0x%016lx\n",
|
||||
(unsigned long)middle, (unsigned long)(end - middle));
|
||||
printk(BIOS_DEBUG,
|
||||
"Clearing Segment: addr: 0x%016lx memsz: 0x%016lx\n",
|
||||
(unsigned long)middle,
|
||||
(unsigned long)(end - middle));
|
||||
|
||||
/* Zero the extra bytes */
|
||||
memset(middle, 0, end - middle);
|
||||
}
|
||||
|
||||
/* Copy the data that's outside the area that shadows ramstage */
|
||||
printk(BIOS_DEBUG, "dest %p, end %p, bouncebuffer %lx\n", dest, end, bounce_buffer);
|
||||
/* Copy the data that's outside the area that shadows ramstage
|
||||
*/
|
||||
printk(BIOS_DEBUG, "dest %p, end %p, bouncebuffer %lx\n", dest,
|
||||
end, bounce_buffer);
|
||||
if ((unsigned long)end > bounce_buffer) {
|
||||
if ((unsigned long)dest < bounce_buffer) {
|
||||
unsigned char *from = dest;
|
||||
unsigned char *to = (unsigned char *)(lb_start-(bounce_buffer-(unsigned long)dest));
|
||||
unsigned long amount = bounce_buffer-(unsigned long)dest;
|
||||
printk(BIOS_DEBUG, "move prefix around: from %p, to %p, amount: %lx\n", from, to, amount);
|
||||
unsigned char *to = (unsigned char *)
|
||||
(lb_start - (bounce_buffer
|
||||
- (unsigned long)dest));
|
||||
unsigned long amount = bounce_buffer
|
||||
- (unsigned long)dest;
|
||||
printk(BIOS_DEBUG,
|
||||
"move prefix around: from %p, to %p, amount: %lx\n",
|
||||
from, to, amount);
|
||||
memcpy(to, from, amount);
|
||||
}
|
||||
if ((unsigned long)end > bounce_buffer + (lb_end - lb_start)) {
|
||||
unsigned long from = bounce_buffer + (lb_end - lb_start);
|
||||
if ((unsigned long)end > bounce_buffer + (lb_end
|
||||
- lb_start)) {
|
||||
unsigned long from = bounce_buffer + (lb_end
|
||||
- lb_start);
|
||||
unsigned long to = lb_end;
|
||||
unsigned long amount = (unsigned long)end - from;
|
||||
printk(BIOS_DEBUG, "move suffix around: from %lx, to %lx, amount: %lx\n", from, to, amount);
|
||||
unsigned long amount =
|
||||
(unsigned long)end - from;
|
||||
printk(BIOS_DEBUG,
|
||||
"move suffix around: from %lx, to %lx, amount: %lx\n",
|
||||
from, to, amount);
|
||||
memcpy((char *)to, (char *)from, amount);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -185,14 +185,16 @@ int read_ddr3_spd_from_cbfs(u8 *buf, int idx)
|
|||
if (!spd_file || spd_file_len < min_len)
|
||||
return -1;
|
||||
|
||||
memcpy(buf, spd_file + (idx * CONFIG_DIMM_SPD_SIZE), CONFIG_DIMM_SPD_SIZE);
|
||||
memcpy(buf, spd_file + (idx * CONFIG_DIMM_SPD_SIZE),
|
||||
CONFIG_DIMM_SPD_SIZE);
|
||||
|
||||
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))) {
|
||||
printk(BIOS_WARNING, "SPD CRC %02x%02x is invalid, should be %04x\n",
|
||||
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;
|
||||
buf[SPD_CRC_HI] = crc >> 8;
|
||||
|
|
|
@ -18,7 +18,8 @@ it with the version available from LANL.
|
|||
*/
|
||||
/* Copyright 2000, Ron Minnich, Advanced Computing Lab, LANL
|
||||
* rminnich@lanl.gov
|
||||
* Copyright (C) 2015 Timothy Pearson <tpearson@raptorengineeringinc.com>, Raptor Engineering
|
||||
* Copyright (C) 2015 Timothy Pearson <tpearson@raptorengineeringinc.com>,
|
||||
* Raptor Engineering
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -34,7 +35,8 @@ int checkstack(void *top_of_stack, int core)
|
|||
u32 *stack = (u32 *) (top_of_stack - stack_size);
|
||||
|
||||
if (stack[0] != 0xDEADBEEF) {
|
||||
printk(BIOS_ERR, "Stack overrun on CPU%d (address %p overwritten). "
|
||||
printk(BIOS_ERR,
|
||||
"Stack overrun on CPU%d (address %p overwritten). "
|
||||
"Increase stack from current %zu bytes\n",
|
||||
core, stack, stack_size);
|
||||
BUG();
|
||||
|
|
|
@ -226,7 +226,8 @@ static void idle_thread_init(void)
|
|||
/* Don't inline this function so the timeout_callback won't have its storage
|
||||
* space on the stack cleaned up before the call to schedule(). */
|
||||
static int __attribute__((noinline))
|
||||
thread_yield_timed_callback(struct timeout_callback *tocb, unsigned int microsecs)
|
||||
thread_yield_timed_callback(struct timeout_callback *tocb,
|
||||
unsigned int microsecs)
|
||||
{
|
||||
tocb->priv = current_thread();
|
||||
tocb->callback = thread_resume_from_timeout;
|
||||
|
|
|
@ -15,39 +15,50 @@ const struct s_tpm_get_random_cmd{
|
|||
|
||||
const struct s_tpm_getownership_cmd{
|
||||
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, },
|
||||
} 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;
|
||||
} tpm_getpermissions_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x16, 0x0, 0x0, 0x0, 0x65, 0x0, 0x0, 0x0, 0x11, 0x0, 0x0, 0x0, 0x4, },
|
||||
} 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];
|
||||
} 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, },
|
||||
} 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];
|
||||
} 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, },
|
||||
} 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;
|
||||
} tpm_physicalsetdeactivated_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xb, 0x0, 0x0, 0x0, 0x72, },
|
||||
} tpm_physicalsetdeactivated_cmd = {
|
||||
{0x0, 0xc1, 0x0, 0x0, 0x0, 0xb, 0x0, 0x0, 0x0, 0x72, },
|
||||
10, };
|
||||
|
||||
const struct s_tpm_physicalenable_cmd{
|
||||
uint8_t buffer[10];
|
||||
} tpm_physicalenable_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x6f, },
|
||||
} tpm_physicalenable_cmd = {
|
||||
{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x6f, },
|
||||
};
|
||||
|
||||
const struct s_tpm_physicaldisable_cmd{
|
||||
uint8_t buffer[10];
|
||||
} tpm_physicaldisable_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x70, },
|
||||
} tpm_physicaldisable_cmd = {
|
||||
{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x70, },
|
||||
};
|
||||
|
||||
const struct s_tpm_forceclear_cmd{
|
||||
|
@ -62,17 +73,20 @@ const struct s_tpm_readpubek_cmd{
|
|||
|
||||
const struct s_tpm_continueselftest_cmd{
|
||||
uint8_t buffer[10];
|
||||
} tpm_continueselftest_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x53, },
|
||||
} tpm_continueselftest_cmd = {
|
||||
{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x53, },
|
||||
};
|
||||
|
||||
const struct s_tpm_selftestfull_cmd{
|
||||
uint8_t buffer[10];
|
||||
} tpm_selftestfull_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x50, },
|
||||
} tpm_selftestfull_cmd = {
|
||||
{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x50, },
|
||||
};
|
||||
|
||||
const struct s_tpm_resume_cmd{
|
||||
uint8_t buffer[12];
|
||||
} tpm_resume_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0, 0x99, 0x0, 0x2, },
|
||||
} tpm_resume_cmd = {
|
||||
{0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0, 0x99, 0x0, 0x2, },
|
||||
};
|
||||
|
||||
const struct s_tpm_savestate_cmd{
|
||||
|
@ -82,27 +96,32 @@ const struct s_tpm_savestate_cmd{
|
|||
|
||||
const struct s_tpm_startup_cmd{
|
||||
uint8_t buffer[12];
|
||||
} tpm_startup_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0, 0x99, 0x0, 0x1, },
|
||||
} 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];
|
||||
} tpm_finalizepp_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x40, 0x0, 0x0, 0xa, 0x2, 0xa0, },
|
||||
} 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];
|
||||
} tpm_pplock_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x40, 0x0, 0x0, 0xa, 0x0, 0x4, },
|
||||
} 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];
|
||||
} tpm_ppenable_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x40, 0x0, 0x0, 0xa, 0x0, 0x20, },
|
||||
} 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];
|
||||
} tpm_ppassert_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x40, 0x0, 0x0, 0xa, 0x0, 0x8, },
|
||||
} tpm_ppassert_cmd = {
|
||||
{0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x40, 0x0, 0x0, 0xa, 0x0, 0x8, },
|
||||
};
|
||||
|
||||
const struct s_tpm_pcr_read_cmd{
|
||||
|
@ -131,8 +150,15 @@ const struct s_tpm_nv_definespace_cmd{
|
|||
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, };
|
||||
} 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,
|
||||
};
|
||||
|
||||
const int kWriteInfoLength = 12;
|
||||
const int kNvDataPublicPermissionsOffset = 60;
|
||||
|
|
|
@ -347,7 +347,8 @@ uint32_t tlcl_define_space(uint32_t space_index, size_t space_size)
|
|||
* value has been extended from default.
|
||||
*/
|
||||
nvds_cmd.publicInfo.authPolicy.t.buffer = pcr0_unchanged_policy;
|
||||
nvds_cmd.publicInfo.authPolicy.t.size = sizeof(pcr0_unchanged_policy);
|
||||
nvds_cmd.publicInfo.authPolicy.t.size =
|
||||
sizeof(pcr0_unchanged_policy);
|
||||
} else {
|
||||
nvds_cmd.publicInfo.attributes = default_space_attributes;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,8 @@ physical access"},
|
|||
{"TPM_OWNER_SET", TPM_E_BASE + 20,
|
||||
"There is already an Owner"},
|
||||
{"TPM_RESOURCES", TPM_E_BASE + 21,
|
||||
"The TPM has insufficient internal resources to perform the requested action"},
|
||||
"The TPM has insufficient internal resources to perform the requested \
|
||||
action"},
|
||||
{"TPM_SHORTRANDOM", TPM_E_BASE + 22,
|
||||
"A random string was too short"},
|
||||
{"TPM_SIZE", TPM_E_BASE + 23,
|
||||
|
@ -133,16 +134,19 @@ was returning a failure code also"},
|
|||
"TPM audit construction failed and the underlying command\n\
|
||||
was returning success"},
|
||||
{"TPM_NOTRESETABLE", TPM_E_BASE + 50,
|
||||
"Attempt to reset a PCR register that does not have the resettable attribute"},
|
||||
"Attempt to reset a PCR register that does not have the resettable \
|
||||
attribute"},
|
||||
{"TPM_NOTLOCAL", TPM_E_BASE + 51,
|
||||
"Attempt to reset a PCR register that requires locality\n\
|
||||
and locality modifier not part of command transport"},
|
||||
{"TPM_BAD_TYPE", TPM_E_BASE + 52,
|
||||
"Make identity blob not properly typed"},
|
||||
{"TPM_INVALID_RESOURCE", TPM_E_BASE + 53,
|
||||
"When saving context identified resource type does not match actual resource"},
|
||||
"When saving context identified resource type does not match actual \
|
||||
resource"},
|
||||
{"TPM_NOTFIPS", TPM_E_BASE + 54,
|
||||
"The TPM is attempting to execute a command only available when in FIPS mode"},
|
||||
"The TPM is attempting to execute a command only available when in \
|
||||
FIPS mode"},
|
||||
{"TPM_INVALID_FAMILY", TPM_E_BASE + 55,
|
||||
"The command is attempting to use an invalid family ID"},
|
||||
{"TPM_NO_NV_PERMISSION", TPM_E_BASE + 56,
|
||||
|
@ -191,7 +195,8 @@ by the TPM Owner"},
|
|||
{"TPM_DELEGATE_ADMIN", TPM_E_BASE + 77,
|
||||
"Delegation table management not enabled"},
|
||||
{"TPM_TRANSPORT_NOTEXCLUSIVE", TPM_E_BASE + 78,
|
||||
"There was a command executed outside of an exclusive transport session"},
|
||||
"There was a command executed outside of an exclusive transport \
|
||||
session"},
|
||||
{"TPM_OWNER_CONTROL", TPM_E_BASE + 79,
|
||||
"Attempt to context save a owner evict controlled key"},
|
||||
{"TPM_DAA_RESOURCES", TPM_E_BASE + 80,
|
||||
|
|
Loading…
Reference in New Issue