diff options
author | Jacob Pan <jacob.jun.pan@linux.intel.com> | 2010-10-07 14:12:39 -0700 |
---|---|---|
committer | Patrick Tjin <pattjin@google.com> | 2014-07-21 20:22:39 -0700 |
commit | 9fc3341bd5a5dcfeb4980b75eed2a743c604b638 (patch) | |
tree | d396008c71fd9c4d061fdb888a0bf46b7a6f0db2 | |
parent | 683ef40c35d6ad235414236a68735ac86a4b20cc (diff) | |
download | bootstub-9fc3341bd5a5dcfeb4980b75eed2a743c604b638.tar.gz |
SFI: fix table alignment
SFI spec does not require any dword alignment of its tables
other than SYST base table. IA FW may produce byte aligned mmap
table that the current code cannot handle.
Also added __packed attribute for sfi structures.
Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
-rw-r--r-- | bootstub.c | 2 | ||||
-rw-r--r-- | sfi.c | 7 | ||||
-rw-r--r-- | sfi.h | 6 |
3 files changed, 8 insertions, 7 deletions
@@ -182,7 +182,7 @@ int bootstub(void) setup_idt(); setup_gdt(); setup_spi(); - bs_printk("Bootstub Version: 0.9 ...\n"); + bs_printk("Bootstub Version: 1.0 ...\n"); setup_boot_params((struct boot_params *)BOOT_PARAMS_OFFSET, (struct setup_header *)SETUP_HEADER_OFFSET); bs_printk("Jump to kernel 32bit entry ...\n"); @@ -33,7 +33,7 @@ static unsigned long sfi_search_mmap(unsigned long start, int len) unsigned long i = 0; char *pchar = (char *)start; - for (i = 0; i < len; i += 4, pchar += 4) { + for (i = 0; i < len; i++, pchar++) { if (pchar[0] == 'M' && pchar[1] == 'M' && pchar[2] == 'A' @@ -55,9 +55,10 @@ void sfi_setup_e820(struct boot_params *bp) /* search for sfi mmap table */ sb = (struct sfi_table *)sfi_search_mmap(SFI_BASE_ADDR, SFI_LENGTH); - if (!sb) + if (!sb) { + bs_printk("Bootstub: failed to locate SFI MMAP table\n"); return; - + } bs_printk("Bootstub: will use sfi mmap table for e820 table\n"); num = SFI_GET_ENTRY_NUM(sb, sfi_mem_entry); mentry = (struct sfi_mem_entry *)sb->pentry; @@ -26,7 +26,7 @@ struct sfi_mem_entry { u64 vir_start; u64 pages; u64 attrib; -}; +}__attribute__((packed)); struct sfi_table_header { char signature[4]; @@ -35,12 +35,12 @@ struct sfi_table_header { u8 checksum; char oem_id[6]; char oem_table_id[8]; -}; +}__attribute__((packed)); struct sfi_table { struct sfi_table_header header; u64 pentry[1]; -}; +}__attribute__((packed)); #define SFI_TBL_HEADER_LEN 24 |