Changeset 5157


Ignore:
Timestamp:
Feb 24, 2010 2:58:23 PM (3 years ago)
Author:
oxygene
Message:

Enable user selectable bootblocks, and provide a bootblock that
selects between "fallback" and "normal", in addition to the
already present "fallback"-only bootblock.

Signed-off-by: Patrick Georgi <patrick.georgi@…>
Acked-by: Stefan Reinauer <stepan@…>

Location:
trunk/src/arch/i386
Files:
2 edited
2 copied
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/src/arch/i386/Kconfig

    r5103 r5157  
    5050        default y 
    5151 
     52choice 
     53        prompt "Bootblock behaviour" 
     54        default BOOTBLOCK_SIMPLE 
     55        depends on TINY_BOOTBLOCK 
     56 
     57config BOOTBLOCK_SIMPLE 
     58        bool "Always load fallback" 
     59 
     60config BOOTBLOCK_NORMAL 
     61        bool "Switch to normal if CMOS says so" 
     62 
     63endchoice 
     64 
     65config BOOTBLOCK_SOURCE 
     66        string 
     67        default "bootblock_simple.c" if BOOTBLOCK_SIMPLE 
     68        default "bootblock_normal.c" if BOOTBLOCK_NORMAL 
     69 
    5270config UPDATE_IMAGE 
    5371        bool "Update existing coreboot.rom image" 
  • trunk/src/arch/i386/Makefile.bootblock.inc

    r5156 r5157  
    6464        $(CC) -x assembler-with-cpp -DASSEMBLY -E -I$(src)/include -I$(src)/arch/i386/include -I$(obj) -I$(obj)/bootblock -include $(obj)/config.h -I. -I$(src) $< > $@.new && mv $@.new $@ 
    6565 
    66 $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.inc: $(src)/arch/i386/init/bootblock.c $(obj)/romcc 
     66$(obj)/mainboard/$(MAINBOARDDIR)/bootblock.inc: $(src)/arch/i386/init/$(subst ",,$(CONFIG_BOOTBLOCK_SOURCE)) $(obj)/romcc 
    6767        $(obj)/romcc $(bootblock_romccflags) -O2 $(ROMCCFLAGS) $(INCLUDES) $< -o $@ 
    6868 
  • trunk/src/arch/i386/Makefile.inc

    r5119 r5157  
    9696 
    9797ifeq ($(CONFIG_TINY_BOOTBLOCK),y) 
    98 include $(src)/arch/i386/Makefile.tinybootblock.inc 
     98include $(src)/arch/i386/Makefile.bootblock.inc 
    9999else 
    100100include $(src)/arch/i386/Makefile.bigbootblock.inc 
  • trunk/src/arch/i386/include/bootblock_common.h

    r5156 r5157  
    3232        asm volatile ("jmp *%0\n\t" : : "r" (addr), "a" (bist)); 
    3333} 
    34  
    35 static void main(unsigned long bist) 
    36 { 
    37         if (boot_cpu()) { 
    38                 bootblock_northbridge_init(); 
    39                 bootblock_southbridge_init(); 
    40         } 
    41         const char* target1 = "fallback/romstage"; 
    42         unsigned long entry; 
    43         entry = findstage(target1); 
    44         if (entry) call(entry, bist); 
    45         asm volatile ("1:\n\thlt\n\tjmp 1b\n\t"); 
    46 } 
    47  
  • trunk/src/arch/i386/init/bootblock_normal.c

    r5156 r5157  
    1 #define __PRE_RAM__ 
    2 #if CONFIG_LOGICAL_CPUS && \ 
    3  (defined(CONFIG_BOOTBLOCK_NORTHBRIDGE_INIT) || defined(CONFIG_BOOTBLOCK_SOUTHBRIDGE_INIT)) 
    4 #include <cpu/x86/lapic/boot_cpu.c> 
    5 #else 
    6 #define boot_cpu(x) 1 
    7 #endif 
     1#include <bootblock_common.h> 
    82 
    9 #ifdef CONFIG_BOOTBLOCK_NORTHBRIDGE_INIT 
    10 #include CONFIG_BOOTBLOCK_NORTHBRIDGE_INIT 
    11 #else 
    12 static void bootblock_northbridge_init(void) { } 
    13 #endif 
    14 #ifdef CONFIG_BOOTBLOCK_SOUTHBRIDGE_INIT 
    15 #include CONFIG_BOOTBLOCK_SOUTHBRIDGE_INIT 
    16 #else 
    17 static void bootblock_southbridge_init(void) { } 
    18 #endif 
    19  
    20 static unsigned long findstage(char* target) 
    21 { 
    22         unsigned long entry; 
    23         asm volatile ( 
    24                 "mov $1f, %%esp\n\t" 
    25                 "jmp walkcbfs\n\t" 
    26                 "1:\n\t" : "=a" (entry) : "S" (target) : "ebx", "ecx", "edi", "esp"); 
    27         return entry; 
    28 } 
    29  
    30 static void call(unsigned long addr, unsigned long bist) 
    31 { 
    32         asm volatile ("jmp *%0\n\t" : : "r" (addr), "a" (bist)); 
    33 } 
     3#include <arch/io.h> 
     4#include "arch/romcc_io.h" 
     5#include "pc80/mc146818rtc_early.c" 
    346 
    357static void main(unsigned long bist) 
     
    3911                bootblock_southbridge_init(); 
    4012        } 
    41         const char* target1 = "fallback/romstage"; 
     13 
    4214        unsigned long entry; 
    43         entry = findstage(target1); 
     15        if (do_normal_boot()) 
     16                entry = findstage("normal/romstage"); 
     17        else 
     18                entry = findstage("fallback/romstage"); 
     19 
    4420        if (entry) call(entry, bist); 
     21 
     22        /* run fallback if normal can't be found */ 
     23        entry = findstage("fallback/romstage"); 
     24        if (entry) call(entry, bist); 
     25 
     26        /* duh. we're stuck */ 
    4527        asm volatile ("1:\n\thlt\n\tjmp 1b\n\t"); 
    4628} 
  • trunk/src/arch/i386/init/bootblock_simple.c

    r5156 r5157  
    1 #define __PRE_RAM__ 
    2 #if CONFIG_LOGICAL_CPUS && \ 
    3  (defined(CONFIG_BOOTBLOCK_NORTHBRIDGE_INIT) || defined(CONFIG_BOOTBLOCK_SOUTHBRIDGE_INIT)) 
    4 #include <cpu/x86/lapic/boot_cpu.c> 
    5 #else 
    6 #define boot_cpu(x) 1 
    7 #endif 
    8  
    9 #ifdef CONFIG_BOOTBLOCK_NORTHBRIDGE_INIT 
    10 #include CONFIG_BOOTBLOCK_NORTHBRIDGE_INIT 
    11 #else 
    12 static void bootblock_northbridge_init(void) { } 
    13 #endif 
    14 #ifdef CONFIG_BOOTBLOCK_SOUTHBRIDGE_INIT 
    15 #include CONFIG_BOOTBLOCK_SOUTHBRIDGE_INIT 
    16 #else 
    17 static void bootblock_southbridge_init(void) { } 
    18 #endif 
    19  
    20 static unsigned long findstage(char* target) 
    21 { 
    22         unsigned long entry; 
    23         asm volatile ( 
    24                 "mov $1f, %%esp\n\t" 
    25                 "jmp walkcbfs\n\t" 
    26                 "1:\n\t" : "=a" (entry) : "S" (target) : "ebx", "ecx", "edi", "esp"); 
    27         return entry; 
    28 } 
    29  
    30 static void call(unsigned long addr, unsigned long bist) 
    31 { 
    32         asm volatile ("jmp *%0\n\t" : : "r" (addr), "a" (bist)); 
    33 } 
     1#include <bootblock_common.h> 
    342 
    353static void main(unsigned long bist) 
Note: See TracChangeset for help on using the changeset viewer.