Skip to content

Commit 8f5fbd6

Browse files
author
Stefan Reinauer
committed
SUN OPB on the SPARC (Enterprise) platforms (especially):
M3000, M4000, M9000 expects a checksum algorithm that is not compliant with IEEE 1275-1994 section 5.2.2.5. Add flag "Sun-Style-Checksum" to switch to the other algorithm. git-svn-id: svn://coreboot.org/openbios/trunk/fcode-utils-devel@757 f158a5a8-5612-0410-a976-696ce0be7e32
1 parent e57ae06 commit 8f5fbd6

3 files changed

Lines changed: 25 additions & 7 deletions

File tree

toke/clflags.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* This program is part of a free implementation of the IEEE 1275-1994
66
* Standard for Boot (Initialization Configuration) Firmware.
77
*
8-
* Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
8+
* Copyright (C) 2001-2010 Stefan Reinauer <stepan@openbios.org>
99
*
1010
* This program is free software; you can redistribute it and/or modify
1111
* it under the terms of the GNU General Public License as published by
@@ -94,6 +94,7 @@ bool ibm_locals_legacy_separator = TRUE ;
9494
bool ibm_legacy_separator_message = TRUE ;
9595
bool enable_abort_quote = TRUE ;
9696
bool sun_style_abort_quote = TRUE ;
97+
bool sun_style_checksum = FALSE ;
9798
bool abort_quote_throw = TRUE ;
9899
bool string_remark_escape = TRUE ;
99100
bool hex_remark_escape = TRUE ;
@@ -181,6 +182,11 @@ static const cl_flag_t cl_flags_list[] = {
181182
"\t",
182183
"Use -2 THROW in an Abort\" phrase, rather than ABORT" } ,
183184

185+
{ "Sun-Style-Checksum",
186+
&sun_style_checksum,
187+
"\t\t",
188+
"Use this for SPARC (Enterprise) platforms (especially): M3000, M4000, M9000" } ,
189+
184190
{ "String-remark-escape",
185191
&string_remark_escape,
186192
"\t",
@@ -640,7 +646,7 @@ void cl_flags_help(void )
640646

641647
for ( indx = 0 ; indx < number_of_cl_flags ; indx++ )
642648
{
643-
printf(" %s %s%s%s\n",
649+
printf(" %s %s%s%s\n",
644650
*(cl_flags_list[indx].flag_var) ? " " : "no" ,
645651
cl_flags_list[indx].clflag_name,
646652
cl_flags_list[indx].clflag_tabs,

toke/clflags.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* This program is part of a free implementation of the IEEE 1275-1994
99
* Standard for Boot (Initialization Configuration) Firmware.
1010
*
11-
* Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
11+
* Copyright (C) 2001-2010 Stefan Reinauer <stepan@openbios.org>
1212
*
1313
* This program is free software; you can redistribute it and/or modify
1414
* it under the terms of the GNU General Public License as published by
@@ -56,6 +56,7 @@
5656
* ibm_legacy_separator_message
5757
* enable_abort_quote
5858
* sun_style_abort_quote
59+
* sun_style_checksum
5960
* string_remark_escape
6061
* hex_remark_escape
6162
* c_style_string_escape
@@ -111,6 +112,7 @@ extern bool ibm_locals_legacy_separator;
111112
extern bool ibm_legacy_separator_message;
112113
extern bool enable_abort_quote;
113114
extern bool sun_style_abort_quote;
115+
extern bool sun_style_checksum;
114116
extern bool abort_quote_throw;
115117
extern bool string_remark_escape;
116118
extern bool hex_remark_escape;

toke/emit.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* This program is part of a free implementation of the IEEE 1275-1994
88
* Standard for Boot (Initialization Configuration) Firmware.
99
*
10-
* Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
10+
* Copyright (C) 2001-2010 Stefan Reinauer <stepan@openbios.org>
1111
*
1212
* This program is free software; you can redistribute it and/or modify
1313
* it under the terms of the GNU General Public License as published by
@@ -317,7 +317,7 @@ void finish_fcodehdr(void)
317317
/* Calculate and place checksum and length, if haven't already */
318318
if ( fcode_start_ob_off != -1 )
319319
{
320-
u16 checksum;
320+
u32 checksum;
321321
int length;
322322

323323
u8 *fcode_body = ostart+fcode_body_ob_off;
@@ -331,13 +331,23 @@ void finish_fcodehdr(void)
331331
fcode_body < ob_end ;
332332
checksum += *(fcode_body++) ) ;
333333

334-
BIG_ENDIAN_WORD_STORE(fcode_hdr->checksum , checksum);
334+
if (sun_style_checksum) {
335+
/* SUN OPB on the SPARC (Enterprise) platforms (especially):
336+
* M3000, M4000, M9000 expects a checksum algorithm that is
337+
* not compliant with IEEE 1275-1994 section 5.2.2.5.
338+
*/
339+
checksum = (checksum & 0xffff) + (checksum >> 16);
340+
checksum = (checksum & 0xffff) + (checksum >> 16);
341+
}
342+
343+
BIG_ENDIAN_WORD_STORE(fcode_hdr->checksum,
344+
(u16)(checksum & 0xffff));
335345
BIG_ENDIAN_LONG_STORE(fcode_hdr->length , length);
336346

337347
if (verbose)
338348
{
339349
printf( "toke: checksum is 0x%04x (%d bytes). ",
340-
checksum, length);
350+
(u16)checksum, length);
341351
list_fcode_ranges( TRUE);
342352
}
343353
}

0 commit comments

Comments
 (0)