Author: stepan Date: Mon Apr 26 17:43:25 2010 New Revision: 757 URL: http://tracker.coreboot.org/trac/openbios/changeset/757
Log: 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.
Modified: trunk/fcode-utils-devel/toke/clflags.c trunk/fcode-utils-devel/toke/clflags.h trunk/fcode-utils-devel/toke/emit.c
Modified: trunk/fcode-utils-devel/toke/clflags.c ============================================================================== --- trunk/fcode-utils-devel/toke/clflags.c Mon Apr 26 17:40:54 2010 (r756) +++ trunk/fcode-utils-devel/toke/clflags.c Mon Apr 26 17:43:25 2010 (r757) @@ -5,7 +5,7 @@ * This program is part of a free implementation of the IEEE 1275-1994 * Standard for Boot (Initialization Configuration) Firmware. * - * Copyright (C) 2001-2005 Stefan Reinauer, stepan@openbios.org + * Copyright (C) 2001-2010 Stefan Reinauer stepan@openbios.org * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -94,6 +94,7 @@ bool ibm_legacy_separator_message = TRUE ; bool enable_abort_quote = TRUE ; bool sun_style_abort_quote = TRUE ; +bool sun_style_checksum = FALSE ; bool abort_quote_throw = TRUE ; bool string_remark_escape = TRUE ; bool hex_remark_escape = TRUE ; @@ -181,6 +182,11 @@ "\t", "Use -2 THROW in an Abort" phrase, rather than ABORT" } ,
+ { "Sun-Style-Checksum", + &sun_style_checksum, + "\t\t", + "Use this for SPARC (Enterprise) platforms (especially): M3000, M4000, M9000" } , + { "String-remark-escape", &string_remark_escape, "\t", @@ -640,7 +646,7 @@
for ( indx = 0 ; indx < number_of_cl_flags ; indx++ ) { - printf(" %s %s%s%s\n", + printf(" %s %s%s%s\n", *(cl_flags_list[indx].flag_var) ? " " : "no" , cl_flags_list[indx].clflag_name, cl_flags_list[indx].clflag_tabs,
Modified: trunk/fcode-utils-devel/toke/clflags.h ============================================================================== --- trunk/fcode-utils-devel/toke/clflags.h Mon Apr 26 17:40:54 2010 (r756) +++ trunk/fcode-utils-devel/toke/clflags.h Mon Apr 26 17:43:25 2010 (r757) @@ -8,7 +8,7 @@ * This program is part of a free implementation of the IEEE 1275-1994 * Standard for Boot (Initialization Configuration) Firmware. * - * Copyright (C) 2001-2005 Stefan Reinauer, stepan@openbios.org + * Copyright (C) 2001-2010 Stefan Reinauer stepan@openbios.org * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -56,6 +56,7 @@ * ibm_legacy_separator_message * enable_abort_quote * sun_style_abort_quote + * sun_style_checksum * string_remark_escape * hex_remark_escape * c_style_string_escape @@ -111,6 +112,7 @@ extern bool ibm_legacy_separator_message; extern bool enable_abort_quote; extern bool sun_style_abort_quote; +extern bool sun_style_checksum; extern bool abort_quote_throw; extern bool string_remark_escape; extern bool hex_remark_escape;
Modified: trunk/fcode-utils-devel/toke/emit.c ============================================================================== --- trunk/fcode-utils-devel/toke/emit.c Mon Apr 26 17:40:54 2010 (r756) +++ trunk/fcode-utils-devel/toke/emit.c Mon Apr 26 17:43:25 2010 (r757) @@ -7,7 +7,7 @@ * This program is part of a free implementation of the IEEE 1275-1994 * Standard for Boot (Initialization Configuration) Firmware. * - * Copyright (C) 2001-2005 Stefan Reinauer, stepan@openbios.org + * Copyright (C) 2001-2010 Stefan Reinauer stepan@openbios.org * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -317,7 +317,7 @@ /* Calculate and place checksum and length, if haven't already */ if ( fcode_start_ob_off != -1 ) { - u16 checksum; + u32 checksum; int length;
u8 *fcode_body = ostart+fcode_body_ob_off; @@ -331,13 +331,23 @@ fcode_body < ob_end ; checksum += *(fcode_body++) ) ;
- BIG_ENDIAN_WORD_STORE(fcode_hdr->checksum , checksum); + if (sun_style_checksum) { + /* 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. + */ + checksum = (checksum & 0xffff) + (checksum >> 16); + checksum = (checksum & 0xffff) + (checksum >> 16); + } + + BIG_ENDIAN_WORD_STORE(fcode_hdr->checksum, + (u16)(checksum & 0xffff)); BIG_ENDIAN_LONG_STORE(fcode_hdr->length , length);
if (verbose) { printf( "toke: checksum is 0x%04x (%d bytes). ", - checksum, length); + (u16)checksum, length); list_fcode_ranges( TRUE); } }