mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
stage0 code for K8 and i586 has lots of mostly identical parts even in
CAR code. Reduce the diff of the mostly identical parts to zero. That involves changing comments, whitespace and instruction order. Now we can split out the common parts more easily and concentrate on the differences. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> git-svn-id: svn://coreboot.org/repository/coreboot-v3@907 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
parent
662895f5a2
commit
96fcf12785
3 changed files with 45 additions and 34 deletions
|
@ -17,8 +17,14 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/* Init code - Switch CPU to protected mode and enable Cache-as-Ram (CAR). */
|
||||
|
||||
#define ASSEMBLY
|
||||
#include <macros.h>
|
||||
#include <mtrr.h>
|
||||
#include <amd/k8/k8.h>
|
||||
|
||||
#define CacheSize CONFIG_CARSIZE
|
||||
#define CacheBase CONFIG_CARBASE
|
||||
#define MEM_TOPK 2048
|
||||
|
@ -32,9 +38,6 @@
|
|||
#define CacheSizeAPStack 0x400 /* 1K */
|
||||
#endif
|
||||
|
||||
#include <mtrr.h>
|
||||
#include <amd/k8/k8.h>
|
||||
|
||||
.code16
|
||||
.globl _stage0
|
||||
_stage0:
|
||||
|
@ -239,13 +242,13 @@ enable_fixed_mtrr_dram_modify:
|
|||
clear_fixed_var_mtrr:
|
||||
lodsl (%esi), %eax
|
||||
testl %eax, %eax
|
||||
jz clear_fixed_var_mtrr_out
|
||||
jz clear_fixed_var_mtrr_out
|
||||
|
||||
movl %eax, %ecx
|
||||
xorl %eax, %eax
|
||||
wrmsr
|
||||
|
||||
jmp clear_fixed_var_mtrr
|
||||
jmp clear_fixed_var_mtrr
|
||||
clear_fixed_var_mtrr_out:
|
||||
|
||||
/* 0x06 is the WB IO type for a given 4k segment.
|
||||
|
@ -304,14 +307,14 @@ clear_fixed_var_mtrr_out:
|
|||
#endif
|
||||
|
||||
#if CacheSize > 0x8000
|
||||
/* enable caching for 32K-64K using fixed mtrr */
|
||||
movl $0x268, %ecx /* fix4k_c0000*/
|
||||
/* enable caching for 32K-64K using fixed mtrr */
|
||||
movl $0x268, %ecx /* fix4k_c0000*/
|
||||
simplemask CacheSize, 0x8000
|
||||
wrmsr
|
||||
wrmsr
|
||||
#endif
|
||||
|
||||
/* enable caching for 0-32K using fixed mtrr */
|
||||
movl $0x269, %ecx /* fix4k_c8000*/
|
||||
/* enable caching for 0-32K using fixed mtrr */
|
||||
movl $0x269, %ecx /* fix4k_c8000*/
|
||||
simplemask CacheSize, 0
|
||||
wrmsr
|
||||
|
||||
|
@ -436,12 +439,15 @@ CAR_FAM10_ap_out:
|
|||
/* Restore the BIST result. */
|
||||
movl %ebp, %eax
|
||||
|
||||
/* We need to set ebp ? No need */
|
||||
/* We need to set ebp? No need. */
|
||||
movl %esp, %ebp
|
||||
pushl %ebx /* init detected */
|
||||
pushl %eax /* bist */
|
||||
|
||||
/* Second parameter: init_detected */
|
||||
pushl %ebx
|
||||
/* First parameter: bist */
|
||||
pushl %eax
|
||||
call stage1_main
|
||||
/* We will not go back */
|
||||
/* We will not go back. */
|
||||
|
||||
movb $0xAF, %al /* Should never see this postcode */
|
||||
outb %al, $0x80
|
||||
|
@ -462,7 +468,6 @@ mem_top:
|
|||
.long 0xC001001A, 0xC001001D
|
||||
.long 0x000 /* NULL, end of table */
|
||||
|
||||
cache_as_ram_setup_out:
|
||||
/* Reset vector. */
|
||||
|
||||
/*
|
||||
|
|
|
@ -92,7 +92,7 @@ gdt16x:
|
|||
.byte 0x00, 0x93, 0xcf, 0x00
|
||||
gdt16xend:
|
||||
|
||||
/* From now on we are 32bit. */
|
||||
/* From now on we are 32 bit. */
|
||||
.code32
|
||||
|
||||
/* We have two gdts where we could have one. That is ok.
|
||||
|
@ -365,15 +365,17 @@ lout:
|
|||
movl $0, %eax
|
||||
pushl %eax
|
||||
|
||||
/* Store zero for the unused init_detected parameter. */
|
||||
pushl %eax
|
||||
|
||||
/* Restore the BIST result. */
|
||||
movl %ebp, %eax
|
||||
|
||||
/* We need to set ebp? No need. */
|
||||
movl %esp, %ebp
|
||||
pushl %eax /* BIST */
|
||||
|
||||
/* Second parameter: init_detected */
|
||||
/* Store zero for the unused init_detected parameter. */
|
||||
pushl $0
|
||||
/* First parameter: bist */
|
||||
pushl %eax
|
||||
jmp stage1_main
|
||||
/* We will not go back. */
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
# init code - switch cpu to pmode and enable cache as ram.
|
||||
/* Init code - Switch CPU to protected mode and enable Cache-as-Ram (CAR). */
|
||||
|
||||
#include <macros.h>
|
||||
|
||||
|
@ -277,7 +277,7 @@ NotHtProcessor:
|
|||
movl $0x00000c00, %eax
|
||||
wrmsr
|
||||
|
||||
/*Clear all MTRRs */
|
||||
/* Clear all MTRRs */
|
||||
xorl %edx, %edx
|
||||
movl $fixed_mtrr_msr, %esi
|
||||
clear_fixed_var_mtrr:
|
||||
|
@ -289,7 +289,7 @@ clear_fixed_var_mtrr:
|
|||
xorl %eax, %eax
|
||||
wrmsr
|
||||
|
||||
jmp clear_fixed_var_mtrr
|
||||
jmp clear_fixed_var_mtrr
|
||||
clear_fixed_var_mtrr_out:
|
||||
|
||||
/* 0x06 is the WB IO type for a given 4k segment.
|
||||
|
@ -305,13 +305,13 @@ clear_fixed_var_mtrr_out:
|
|||
*/
|
||||
xorl \reg, \reg
|
||||
.elseif \segs == 1
|
||||
movl $0x06000000, \reg
|
||||
movl $0x06000000, \reg /* WB IO type */
|
||||
.elseif \segs == 2
|
||||
movl $0x06060000, \reg
|
||||
movl $0x06060000, \reg /* WB IO type */
|
||||
.elseif \segs == 3
|
||||
movl $0x06060600, \reg
|
||||
movl $0x06060600, \reg /* WB IO type */
|
||||
.elseif \segs >= 4
|
||||
movl $0x06060606, \reg
|
||||
movl $0x06060606, \reg /* WB IO type */
|
||||
.endif
|
||||
.endm
|
||||
|
||||
|
@ -439,16 +439,20 @@ lout:
|
|||
movl $0, %eax
|
||||
pushl %eax
|
||||
|
||||
/* Store zero for the unused init_detected parameter. */
|
||||
pushl %eax
|
||||
|
||||
/* Restore the BIST result. */
|
||||
movl %ebp, %eax
|
||||
/* We need to set ebp ? No need */
|
||||
|
||||
/* We need to set ebp? No need. */
|
||||
movl %esp, %ebp
|
||||
pushl %eax /* bist */
|
||||
call stage1_main
|
||||
/* We will not go back */
|
||||
|
||||
/* Second parameter: init_detected */
|
||||
/* Store zero for the unused init_detected parameter. */
|
||||
pushl $0
|
||||
/* First parameter: bist */
|
||||
pushl %eax
|
||||
call stage1_main
|
||||
/* We will not go back. */
|
||||
|
||||
fixed_mtrr_msr:
|
||||
.long 0x250, 0x258, 0x259
|
||||
.long 0x268, 0x269, 0x26A
|
||||
|
|
Loading…
Add table
Reference in a new issue