On 5/27/10 7:20 AM, Joseph Smith wrote:
> Hello,
> Let's try this again. This way is as dynamic as possibly possible.
>
> This patch improves the i82830 MBI SMI Handler. It is now able to load
> Intel vbios VBT and Flexaim modules. Build and boot tested.
Ok, I tried to understand what's wrong from reading your patch and it
seems the name fields need to be properly aligned.
I created this patch. Can you try and see if it helps, please?

Stefan




MBI name field alignment

Signed-off-by: Stefan Reinauer <[email protected]>

Index: src/northbridge/intel/i82830/i82830_smihandler.c
===================================================================
--- src/northbridge/intel/i82830/i82830_smihandler.c    (revision 5594)
+++ src/northbridge/intel/i82830/i82830_smihandler.c    (working copy)
@@ -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,17 +253,19 @@
                        }
 
                        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;
                        }
-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to