Author: stepan Date: Fri May 28 00:47:13 2010 New Revision: 5595 URL: https://tracker.coreboot.org/trac/coreboot/changeset/5595
Log: Fix MBI walker.
Signed-off-by: Joseph Smith joe@settoplinux.org Signed-off-by: Stefan Reinauer stepan@coresystems.de Acked-by: Joseph Smith joe@settoplinux.org Acked-by: Stefan Reinauer stepan@coresystems.de
Modified: trunk/src/northbridge/intel/i82830/i82830_smihandler.c
Modified: trunk/src/northbridge/intel/i82830/i82830_smihandler.c ============================================================================== --- trunk/src/northbridge/intel/i82830/i82830_smihandler.c Thu May 27 17:41:15 2010 (r5594) +++ trunk/src/northbridge/intel/i82830/i82830_smihandler.c Fri May 28 00:47:13 2010 (r5595) @@ -196,7 +196,7 @@ }
mbi_header = (mbi_header_t *)&mbi[i]; - len = ALIGN((mbi_header->size * 16) + sizeof(mbi_header) + mbi_header->name_len, 16); + len = ALIGN((mbi_header->size * 16) + sizeof(mbi_header) + ALIGN(mbi_header->name_len, 16), 16);
if (obj_header->objnum == count) { #ifdef DEBUG_SMI_I82830 @@ -205,7 +205,7 @@ break; } #endif - int headerlen = ALIGN(sizeof(mbi_header) + mbi_header->name_len + 15, 16); + int headerlen = ALIGN(sizeof(mbi_header) + ALIGN(mbi_header->name_len, 16), 16); #ifdef DEBUG_SMI_I82830 printk(BIOS_DEBUG, "| |- headerlen = %d\n", headerlen); #endif @@ -245,7 +245,7 @@ getobj->banner.retsts = MSH_IF_NOT_FOUND;
for (i=0; i< mbi_len;) { - int len; + int headerlen, objectlen;
if (!(mbi[i] == 0xf0 && mbi [i+1] == 0xf6)) { i+=16; @@ -253,21 +253,23 @@ }
mbi_header = (mbi_header_t *)&mbi[i]; - len = ALIGN((mbi_header->size * 16) + sizeof(mbi_header) + mbi_header->name_len, 16); + headerlen = ALIGN(sizeof(mbi_header) + ALIGN(mbi_header->name_len, 16), 16); + objectlen = ALIGN((mbi_header->size * 16), 16);
if (getobj->objnum == count) { - printk(BIOS_DEBUG, "| |- len = %x\n", len); + printk(BIOS_DEBUG, "| |- len = %x\n", headerlen + objectlen); + memcpy((void *)(getobj->buffer + OBJ_OFFSET), - ((char *)mbi_header) + 0x20 , (len > getobj->buflen) ? getobj->buflen : len); + ((char *)mbi_header) + headerlen, (objectlen > getobj->buflen) ? getobj->buflen : objectlen);
getobj->banner.retsts = MSH_OK; #ifdef DEBUG_SMI_I82830 dump((u8 *)banner_id, sizeof(*getobj)); - dump((u8 *)getobj->buffer + OBJ_OFFSET, len); + dump((u8 *)getobj->buffer + OBJ_OFFSET, objectlen); #endif break; } - i += len; + i += (headerlen + objectlen); count++; } if (getobj->banner.retsts == MSH_IF_NOT_FOUND)