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>



git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5595 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Joseph Smith 2010-05-27 22:47:13 +00:00 committed by Stefan Reinauer
parent c56e5ad725
commit 7b2e2b9966
1 changed files with 10 additions and 8 deletions

View File

@ -196,7 +196,7 @@ static void mbi_call(u8 subf, banner_id_t *banner_id)
} }
mbi_header = (mbi_header_t *)&mbi[i]; 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) { if (obj_header->objnum == count) {
#ifdef DEBUG_SMI_I82830 #ifdef DEBUG_SMI_I82830
@ -205,7 +205,7 @@ static void mbi_call(u8 subf, banner_id_t *banner_id)
break; break;
} }
#endif #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 #ifdef DEBUG_SMI_I82830
printk(BIOS_DEBUG, "| |- headerlen = %d\n", headerlen); printk(BIOS_DEBUG, "| |- headerlen = %d\n", headerlen);
#endif #endif
@ -245,7 +245,7 @@ static void mbi_call(u8 subf, banner_id_t *banner_id)
getobj->banner.retsts = MSH_IF_NOT_FOUND; getobj->banner.retsts = MSH_IF_NOT_FOUND;
for (i=0; i< mbi_len;) { for (i=0; i< mbi_len;) {
int len; int headerlen, objectlen;
if (!(mbi[i] == 0xf0 && mbi [i+1] == 0xf6)) { if (!(mbi[i] == 0xf0 && mbi [i+1] == 0xf6)) {
i+=16; i+=16;
@ -253,21 +253,23 @@ static void mbi_call(u8 subf, banner_id_t *banner_id)
} }
mbi_header = (mbi_header_t *)&mbi[i]; 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) { 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), 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; getobj->banner.retsts = MSH_OK;
#ifdef DEBUG_SMI_I82830 #ifdef DEBUG_SMI_I82830
dump((u8 *)banner_id, sizeof(*getobj)); dump((u8 *)banner_id, sizeof(*getobj));
dump((u8 *)getobj->buffer + OBJ_OFFSET, len); dump((u8 *)getobj->buffer + OBJ_OFFSET, objectlen);
#endif #endif
break; break;
} }
i += len; i += (headerlen + objectlen);
count++; count++;
} }
if (getobj->banner.retsts == MSH_IF_NOT_FOUND) if (getobj->banner.retsts == MSH_IF_NOT_FOUND)