First bunch of coding style and consistency cleanups for the
EPIA-M700 target. Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de> Acked-by: Uwe Hermann <uwe@hermann-uwe.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4349 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
parent
cff071ab0e
commit
0ffff3434e
@ -33,7 +33,7 @@ if HAVE_ACPI_TABLES
|
||||
# object ssdt.o
|
||||
object acpi_tables.o
|
||||
end
|
||||
# these lines maybe noused
|
||||
# These lines maybe noused.
|
||||
makerule ./failover.E
|
||||
depends "$(MAINBOARD)/../../../arch/i386/lib/failover.c ./romcc"
|
||||
action "./romcc -E -O --label-prefix=failover -I$(TOP)/src -I. $(CPPFLAGS) $(MAINBOARD)/../../../arch/i386/lib/failover.c -o $@"
|
||||
@ -74,8 +74,9 @@ else
|
||||
end
|
||||
|
||||
# mainboardinit arch/i386/lib/cpu_reset.inc
|
||||
#here cpu_reset.inc have label _cpu_reset, which is needed in failover,c, but cpu_reset.inc also has code to jump to __main() which is not included in cache_as_ram_auto_auto.c
|
||||
|
||||
# Here cpu_reset.inc have label _cpu_reset, which is needed in failover.c,
|
||||
# but cpu_reset.inc also has code to jump to __main() which is not included
|
||||
# in cache_as_ram_auto_auto.c.
|
||||
|
||||
mainboardinit arch/i386/lib/id.inc
|
||||
ldscript /arch/i386/lib/id.lds
|
||||
@ -86,13 +87,13 @@ end
|
||||
|
||||
if USE_FALLBACK_IMAGE
|
||||
ldscript /arch/i386/lib/failover.lds
|
||||
# failover.inc need defination in cpu_reset.inc, but we do not include cpu_reset.inc,so ...
|
||||
# failover.inc need definition in cpu_reset.inc, but we do not include
|
||||
# cpu_reset.inc,so ...
|
||||
# mainboardinit ./failover.inc
|
||||
end
|
||||
# mainboardinit cpu/x86/fpu/enable_fpu.inc
|
||||
# mainboardinit cpu/x86/mmx/enable_mmx.inc
|
||||
|
||||
|
||||
if USE_DCACHE_RAM
|
||||
if CONFIG_USE_INIT
|
||||
initobject cache_as_ram_auto.o
|
||||
@ -106,7 +107,6 @@ dir /pc80
|
||||
|
||||
config chip.h
|
||||
|
||||
|
||||
chip northbridge/via/vx800 # Northbridge
|
||||
device pci_domain 0 on
|
||||
device pci 0.0 on end # AGP Bridge
|
||||
@ -123,12 +123,11 @@ chip northbridge/via/vx800 # Northbridge
|
||||
# device pci 10.2 on end # USB 1.1
|
||||
# device pci 10.4 on end # USB 2.0
|
||||
# device pci 11.0 on # Southbridge LPC
|
||||
#end # pci 11.0
|
||||
|
||||
end # pci domain 0
|
||||
# end
|
||||
end
|
||||
device apic_cluster 0 on # APIC cluster
|
||||
chip cpu/via/model_c7 # VIA C7
|
||||
device apic 0 on end # APIC
|
||||
end
|
||||
end
|
||||
end # vx800
|
||||
end
|
||||
|
@ -33,7 +33,6 @@ static const u8 DDR2_DQSB_Driving_Table[2] = { 0xEE, 0xEE};
|
||||
static const u8 DDR2_DQA_Driving_Table[4] = { 0xAC, 0xAC, 0xAC, 0xAC };
|
||||
static const u8 DDR2_DQB_Driving_Table[2] = { 0xCA, 0xCA };
|
||||
|
||||
|
||||
// CS Driving
|
||||
// Reg0xE4, 0xE5
|
||||
// According to #Bank to set DRAM CS Driving
|
||||
@ -42,176 +41,170 @@ static const u8 DDR2_CSA_Driving_Table_x8[4] = { 0x44, 0x44, 0x44, 0x44 };
|
||||
static const u8 DDR2_CSB_Driving_Table_x8[2] = { 0x44, 0x44 };
|
||||
static const u8 DDR2_CSA_Driving_Table_x16[4] = { 0x44, 0x44, 0x44, 0x44 };
|
||||
static const u8 DDR2_CSB_Driving_Table_x16[2] = { 0x44, 0x44 };
|
||||
|
||||
// MAA Driving
|
||||
// Reg0xE8, Reg0xE9
|
||||
static const u8 DDR2_MAA_Driving_Table[MA_Table][5] =
|
||||
{
|
||||
static const u8 DDR2_MAA_Driving_Table[MA_Table][5] = {
|
||||
// Chip number, 400, 533, 667 800 ;(SRAS, SCAS, SWE)RxE8
|
||||
{6, 0x86, 0x86, 0x86, 0x86}, // total MAA chips = 00 ~ 06
|
||||
{18, 0x86, 0x86, 0x86, 0x86}, // total MAA chips = 06 ~ 18
|
||||
{255, 0xDB, 0xDB, 0xDB, 0xDB} // total MAA chips = 18 ~
|
||||
{255, 0xDB, 0xDB, 0xDB, 0xDB}, // total MAA chips = 18 ~
|
||||
};
|
||||
|
||||
static const u8 DDR2_MAB_Driving_Table[MA_Table][2] =
|
||||
{
|
||||
static const u8 DDR2_MAB_Driving_Table[MA_Table][2] = {
|
||||
// Chip number, Value ;(SRAS, SCAS, SWE)RxE9
|
||||
{6, 0x86}, // total MAB chips = 00 ~ 06
|
||||
{18, 0x86}, // total MAB chips = 06 ~ 18
|
||||
{255, 0xDB } // total MAB chips = 18 ~
|
||||
{255, 0xDB}, // total MAB chips = 18 ~
|
||||
};
|
||||
|
||||
// DCLK Driving
|
||||
// Reg0xE6, 0xE7
|
||||
// For DDR2: According to #Freq to set DRAM DCLK Driving
|
||||
// freq 400M, 533M, 667M, 800M
|
||||
|
||||
static const u8 DDR2_DCLKA_Driving_Table[4] = { 0xFF, 0xFF, 0xFF, 0xFF };
|
||||
static const u8 DDR2_DCLKB_Driving_Table[4] = { 0xFF, 0xFF, 0xFF, 0xFF };
|
||||
|
||||
/*
|
||||
Duty cycle
|
||||
Duty cycle Control for DQ/DQS/DDRCKG in ChA & ChB
|
||||
D0F3RxEC/D0F3RxED/D0F3RxEE/D0F3RxEF
|
||||
According to DRAM frequency to control Duty Cycle
|
||||
* Duty cycle
|
||||
* Duty cycle Control for DQ/DQS/DDRCKG in ChA & ChB
|
||||
* D0F3RxEC/D0F3RxED/D0F3RxEE/D0F3RxEF
|
||||
* According to DRAM frequency to control Duty Cycle
|
||||
*/
|
||||
static const u8 ChA_Duty_Control_DDR2[DUTY_CYCLE_REG_NUM][DUTY_CYCLE_FREQ_NUM] =
|
||||
{
|
||||
static const u8 ChA_Duty_Control_DDR2[DUTY_CYCLE_REG_NUM][DUTY_CYCLE_FREQ_NUM] = {
|
||||
// (And NOT) DDR800 DDR667 DDR533 DDR400
|
||||
//Reg Mask Value Value Value Value
|
||||
{0xEC, 0x00, 0x30, 0x30, 0x30, 0x30}, // 1Rank
|
||||
{0xEE, 0x0F, 0x40, 0x40, 0x00, 0x00},
|
||||
{0xEF, 0xCF, 0x00, 0x30, 0x30, 0x30}
|
||||
{0xEF, 0xCF, 0x00, 0x30, 0x30, 0x30},
|
||||
};
|
||||
|
||||
static const u8 ChB_Duty_Control_DDR2[DUTY_CYCLE_REG_NUM][DUTY_CYCLE_FREQ_NUM] =
|
||||
{
|
||||
static const u8 ChB_Duty_Control_DDR2[DUTY_CYCLE_REG_NUM][DUTY_CYCLE_FREQ_NUM] = {
|
||||
// (And NOT) DDR800 DDR667 DDR533 DDR400
|
||||
//Reg Mask Value Value Value Value
|
||||
{0xED, 0x00, 0x88, 0x88, 0x84, 0x88}, // 1Rank
|
||||
{0xEE, 0xF0, 0x00, 0x00, 0x00, 0x00},
|
||||
{0xEF, 0xFC, 0x00, 0x00, 0x00, 0x00 }
|
||||
{0xEF, 0xFC, 0x00, 0x00, 0x00, 0x00},
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
DRAM Clock Phase Control for FeedBack Mode
|
||||
Modify NB Reg: Rx90[7]/Rx91/Rx92/Rx93/Rx94
|
||||
Processing:
|
||||
1.Program VIA_NB3DRAM_REG90[7]=0b for FeedBack mode
|
||||
2.Program clock phase value with ChA/B DCLK enable, VIA_NB3DRAM_REG91[7:3]=00b
|
||||
3.Check ChB rank #, if 0, VIA_NB3DRAM_REG91[7]=1b, to disable ChB DCLKO
|
||||
ChA DCLKO can not be disable, so always program VIA_NB3DRAM_REG91[3]=0b
|
||||
* DRAM Clock Phase Control for FeedBack Mode
|
||||
* Modify NB Reg: Rx90[7]/Rx91/Rx92/Rx93/Rx94
|
||||
* Processing:
|
||||
* 1. Program VIA_NB3DRAM_REG90[7]=0b for FeedBack mode.
|
||||
* 2. Program clock phase value with ChA/B DCLK enable,
|
||||
* VIA_NB3DRAM_REG91[7:3]=00b
|
||||
* 3. Check ChB rank #, if 0, VIA_NB3DRAM_REG91[7]=1b, to disable ChB DCLKO
|
||||
* ChA DCLKO can't be disabled, so always program VIA_NB3DRAM_REG91[3]=0b.
|
||||
*/
|
||||
static const u8 DDR2_ChA_Clk_Phase_Table_1R[3][Clk_Phase_Table_DDR2_Width] =
|
||||
{
|
||||
static const u8 DDR2_ChA_Clk_Phase_Table_1R[3][Clk_Phase_Table_DDR2_Width] = {
|
||||
// (And NOT) DDR800 DDR667 DDR533 DDR400
|
||||
//Reg Mask Value Value Value Value
|
||||
{0x91, 0xF8, 0x02, 0x01, 0x00, 0x07}, // 1Rank
|
||||
{0x92, 0xF8, 0x04, 0x03, 0x03, 0x02},
|
||||
{0x93, 0xF8, 0x06, 0x05, 0x04, 0x03 }
|
||||
{0x93, 0xF8, 0x06, 0x05, 0x04, 0x03},
|
||||
};
|
||||
|
||||
static const u8 DDR2_ChB_Clk_Phase_Table_1R[3][Clk_Phase_Table_DDR2_Width] =
|
||||
{
|
||||
static const u8 DDR2_ChB_Clk_Phase_Table_1R[3][Clk_Phase_Table_DDR2_Width] = {
|
||||
// (And NOT) DDR800 DDR667 DDR533 DDR400
|
||||
//Reg Mask Value Value Value Value
|
||||
{0x91, 0x0F, 0x20, 0x10, 0x00, 0x70}, // 1Rank
|
||||
{0x92, 0x0F, 0x40, 0x30, 0x30, 0x20},
|
||||
{0x93, 0x0F, 0x60, 0x50, 0x40, 0x30 }
|
||||
{0x93, 0x0F, 0x60, 0x50, 0x40, 0x30},
|
||||
};
|
||||
|
||||
//vt6413c
|
||||
/*static const u8 DDR2_ChA_Clk_Phase_Table_2R[3][Clk_Phase_Table_DDR2_Width] =
|
||||
{
|
||||
/* vt6413c */
|
||||
#if 0
|
||||
static const u8 DDR2_ChA_Clk_Phase_Table_2R[3][Clk_Phase_Table_DDR2_Width] = {
|
||||
// (And NOT) DDR800 DDR667 DDR533 DDR400
|
||||
//Reg Mask Value Value Value Value
|
||||
{0x91, 0xF8, 0x04, 0x03, 0x04, 0x01 }, // 1Rank
|
||||
{0x92, 0xF8, 0x03, 0x06, 0x05, 0x04 },
|
||||
{0x93, 0xF8, 0x03, 0x07, 0x06, 0x05 }
|
||||
};*/
|
||||
{0x93, 0xF8, 0x03, 0x07, 0x06, 0x05 },
|
||||
};
|
||||
#endif
|
||||
|
||||
//vt6413d
|
||||
static const u8 DDR2_ChA_Clk_Phase_Table_2R[3][Clk_Phase_Table_DDR2_Width] =
|
||||
{
|
||||
/* vt6413d */
|
||||
static const u8 DDR2_ChA_Clk_Phase_Table_2R[3][Clk_Phase_Table_DDR2_Width] = {
|
||||
// (And NOT) DDR800 DDR667 DDR533 DDR400
|
||||
//Reg Mask Value Value Value Value
|
||||
{0x91, 0xF8, 0x02, 0x01, 0x00, 0x07}, // 1Rank
|
||||
{0x92, 0xF8, 0x04, 0x03, 0x03, 0x02},
|
||||
{0x93, 0xF8, 0x06, 0x05, 0x04, 0x03 }
|
||||
{0x93, 0xF8, 0x06, 0x05, 0x04, 0x03},
|
||||
};
|
||||
|
||||
/*
|
||||
DRAM Write Data phase control
|
||||
Modify NB Reg: Rx74/Rx75/Rx76
|
||||
* DRAM Write Data phase control
|
||||
* Modify NB Reg: Rx74/Rx75/Rx76
|
||||
*/
|
||||
//vt6413c
|
||||
/*static const u8 DDR2_ChA_WrtData_Phase_Table[WrtData_REG_NUM ][WrtData_FREQ_NUM] =
|
||||
{
|
||||
/* vt6413c */
|
||||
#if 0
|
||||
static const u8 DDR2_ChA_WrtData_Phase_Table[WrtData_REG_NUM ][WrtData_FREQ_NUM] = {
|
||||
// (And NOT) DDR800 DDR667 DDR533 DDR400
|
||||
//Reg Mask Value Value Value Value
|
||||
{0x74, 0xF8, 0x03, 0x04, 0x05, 0x02 }, // 1Rank
|
||||
{0x75, 0xF8, 0x03, 0x04, 0x05, 0x02 },
|
||||
{0x76, 0x00, 0x10, 0x80, 0x00, 0x07 }
|
||||
};*/
|
||||
{0x76, 0x00, 0x10, 0x80, 0x00, 0x07 },
|
||||
};
|
||||
#endif
|
||||
|
||||
//vt6413D
|
||||
static const u8 DDR2_ChA_WrtData_Phase_Table[WrtData_REG_NUM ][WrtData_FREQ_NUM] =
|
||||
{
|
||||
/* vt6413D */
|
||||
static const u8 DDR2_ChA_WrtData_Phase_Table[WrtData_REG_NUM][WrtData_FREQ_NUM] = {
|
||||
// (And NOT) DDR800 DDR667 DDR533 DDR400
|
||||
//Reg Mask Value Value Value Value
|
||||
{0x74, 0xF8, 0x01, 0x00, 0x00, 0x07}, // 1Rank
|
||||
{0x75, 0xF8, 0x01, 0x00, 0x00, 0x07},
|
||||
{0x76, 0x10, 0x80, 0x87, 0x07, 0x06},
|
||||
{0x8C, 0xFC, 0x03, 0x03, 0x03, 0x03 }
|
||||
{0x8C, 0xFC, 0x03, 0x03, 0x03, 0x03},
|
||||
};
|
||||
|
||||
/*static const u8 DDR2_ChB_WrtData_Phase_Table[WrtData_REG_NUM ][WrtData_FREQ_NUM] =
|
||||
{
|
||||
#if 0
|
||||
static const u8 DDR2_ChB_WrtData_Phase_Table[WrtData_REG_NUM ][WrtData_FREQ_NUM] = {
|
||||
// (And NOT) DDR800 DDR667 DDR533 DDR400
|
||||
//Reg Mask Value Value Value Value
|
||||
{0x74, 0x8F, 0x30, 0x40, 0x30, 0x20 }, // 1Rank
|
||||
{0x75, 0x8F, 0x30, 0x40, 0x30, 0x20 },
|
||||
{0x8A, 0x00, 0x10, 0x80, 0x07, 0x07 }
|
||||
{0x8A, 0x00, 0x10, 0x80, 0x07, 0x07 },
|
||||
};
|
||||
*/
|
||||
#endif
|
||||
|
||||
/*
|
||||
DQ/DQS Output Delay Control
|
||||
Modify NB D0F3: RxF0/RxF1/RxF2/RxF3
|
||||
* DQ/DQS Output Delay Control
|
||||
* Modify NB D0F3: RxF0/RxF1/RxF2/RxF3
|
||||
*/
|
||||
static const u8 DDR2_CHA_DQ_DQS_Delay_Table[4][DQ_DQS_Delay_Table_Width] =
|
||||
{
|
||||
static const u8 DDR2_CHA_DQ_DQS_Delay_Table[4][DQ_DQS_Delay_Table_Width] = {
|
||||
//RxF0 RxF1 RxF2 RxF3
|
||||
{ 0x00, 0x00, 0x00, 0x00 },// DDR400
|
||||
{ 0x00, 0x00, 0x00, 0x00 },// DDR533
|
||||
{ 0x00, 0x00, 0x00, 0x00 },// DDR667
|
||||
{ 0x00, 0x00, 0x00, 0x00 }// DDR800
|
||||
{0x00, 0x00, 0x00, 0x00}, /* DDR400 */
|
||||
{0x00, 0x00, 0x00, 0x00}, /* DDR533 */
|
||||
{0x00, 0x00, 0x00, 0x00}, /* DDR667 */
|
||||
{0x00, 0x00, 0x00, 0x00}, /* DDR800 */
|
||||
};
|
||||
static const u8 DDR2_CHB_DQ_DQS_Delay_Table[4][DQ_DQS_Delay_Table_Width] =
|
||||
{
|
||||
|
||||
static const u8 DDR2_CHB_DQ_DQS_Delay_Table[4][DQ_DQS_Delay_Table_Width] = {
|
||||
//RxF4 RxF5 RxF6 RxF7
|
||||
{ 0x00, 0x00, 0x00, 0x00 },// DDR400
|
||||
{ 0x00, 0x00, 0x00, 0x00 },// DDR533
|
||||
{ 0x00, 0x00, 0x00, 0x00 },// DDR667
|
||||
{ 0x00, 0x00, 0x00, 0x00 }// DDR800
|
||||
{0x00, 0x00, 0x00, 0x00}, /* DDR400 */
|
||||
{0x00, 0x00, 0x00, 0x00}, /* DDR533 */
|
||||
{0x00, 0x00, 0x00, 0x00}, /* DDR667 */
|
||||
{0x00, 0x00, 0x00, 0x00}, /* DDR800 */
|
||||
};
|
||||
|
||||
/*
|
||||
DQ/DQS input Capture Control
|
||||
modify NB D0F3_Reg:Rx78/Rx79/Rx7A/Rx7B
|
||||
* DQ/DQS input Capture Control
|
||||
* modify NB D0F3_Reg:Rx78/Rx79/Rx7A/Rx7B
|
||||
*/
|
||||
//vt6413C
|
||||
/*static const u8 DDR2_ChA_DQS_Input_Capture_Tbl[DQS_INPUT_CAPTURE_REG_NUM ][DQS_INPUT_CAPTURE_FREQ_NUM] =
|
||||
{
|
||||
/* vt6413C */
|
||||
#if 0
|
||||
static const u8 DDR2_ChA_DQS_Input_Capture_Tbl[DQS_INPUT_CAPTURE_REG_NUM ][DQS_INPUT_CAPTURE_FREQ_NUM] = {
|
||||
// (And NOT) DDR800 DDR667 DDR533 DDR400
|
||||
//Reg Mask Value Value Value Value
|
||||
{0x78, 0x00, 0x83, 0x8D, 0x87, 0x83 }, // 1Rank
|
||||
{0x7A, 0xF0, 0x00, 0x00, 0x00, 0x00 },
|
||||
{0x7B, 0x00, 0x10, 0x30, 0x20, 0x10 }
|
||||
};*/
|
||||
};
|
||||
#endif
|
||||
|
||||
//Vt6413D
|
||||
static const u8 DDR2_ChA_DQS_Input_Capture_Tbl[DQS_INPUT_CAPTURE_REG_NUM ][DQS_INPUT_CAPTURE_FREQ_NUM] =
|
||||
{
|
||||
/* vt6413D */
|
||||
static const u8DDR2_ChA_DQS_Input_Capture_Tbl[DQS_INPUT_CAPTURE_REG_NUM][DQS_INPUT_CAPTURE_FREQ_NUM] = {
|
||||
// (And NOT) DDR800 DDR667 DDR533 DDR400
|
||||
//Reg Mask Value Value Value Value
|
||||
{0x78, 0xC0, 0x0D, 0x07, 0x03, 0x01}, // 1Rank
|
||||
@ -219,8 +212,7 @@ static const u8 DDR2_ChA_DQS_Input_Capture_Tbl[DQS_INPUT_CAPTURE_REG_NUM ][DQS_
|
||||
{0x7B, 0x00, 0x34, 0x34, 0x20, 0x10}
|
||||
};
|
||||
|
||||
static const u8 DDR2_ChB_DQS_Input_Capture_Tbl[DQS_INPUT_CAPTURE_REG_NUM ][DQS_INPUT_CAPTURE_FREQ_NUM] =
|
||||
{
|
||||
static const u8 DDR2_ChB_DQS_Input_Capture_Tbl[DQS_INPUT_CAPTURE_REG_NUM][DQS_INPUT_CAPTURE_FREQ_NUM] = {
|
||||
// (And NOT) DDR800 DDR667 DDR533 DDR400
|
||||
//Reg Mask Value Value Value Value
|
||||
{0x79, 0x00, 0x89, 0x89, 0x87, 0x83}, // 1Rank
|
||||
@ -228,19 +220,18 @@ static const u8 DDR2_ChB_DQS_Input_Capture_Tbl[DQS_INPUT_CAPTURE_REG_NUM ][DQS_
|
||||
{0x8B, 0x00, 0x34, 0x34, 0x20, 0x10}
|
||||
};
|
||||
|
||||
static const u8 Fixed_DQSA_1_2_Rank_Table[4][2] =
|
||||
{
|
||||
static const u8 Fixed_DQSA_1_2_Rank_Table[4][2] = {
|
||||
//Rx70 Rx71
|
||||
{ 0x00, 0x05 }, // DDR800
|
||||
{ 0x00, 0x06 }, // DDR667
|
||||
{ 0x00, 0x04 }, // DDR533
|
||||
{ 0x00, 0x05 } // DDR400
|
||||
{0x00, 0x05}, /* DDR800 */
|
||||
{0x00, 0x06}, /* DDR667 */
|
||||
{0x00, 0x04}, /* DDR533 */
|
||||
{0x00, 0x05}, /* DDR400 */
|
||||
};
|
||||
static const u8 Fixed_DQSA_3_4_Rank_Table[4][2] =
|
||||
{
|
||||
|
||||
static const u8 Fixed_DQSA_3_4_Rank_Table[4][2] = {
|
||||
//Rx70 Rx71
|
||||
{0x00 , 0x04}, // DDR800
|
||||
{0x00 , 0x04}, // DDR667
|
||||
{0x00 , 0x03}, // DDR533
|
||||
{0x00 , 0x04} // DDR400
|
||||
{0x00, 0x04}, /* DDR800 */
|
||||
{0x00, 0x04}, /* DDR667 */
|
||||
{0x00, 0x03}, /* DDR533 */
|
||||
{0x00, 0x04}, /* DDR400 */
|
||||
};
|
||||
|
@ -67,11 +67,7 @@ uses TTYS0_BAUD
|
||||
uses CONFIG_VIDEO_MB
|
||||
uses CONFIG_IOAPIC
|
||||
|
||||
|
||||
|
||||
##
|
||||
## new options
|
||||
##
|
||||
## New options
|
||||
uses USE_DCACHE_RAM
|
||||
uses DCACHE_RAM_BASE
|
||||
uses DCACHE_RAM_SIZE
|
||||
@ -88,14 +84,12 @@ uses VIACONFIG_TOP_SM_SIZE_MB
|
||||
uses VIACONFIG_VGA_PCI_10
|
||||
uses VIACONFIG_VGA_PCI_14
|
||||
|
||||
##
|
||||
## new options
|
||||
##
|
||||
## New options
|
||||
default USE_DCACHE_RAM = 1
|
||||
default DCACHE_RAM_BASE = 0xffef0000
|
||||
# default DCACHE_RAM_BASE = 0xffbf0000
|
||||
#default DCACHE_RAM_BASE=0xfec00000 //hpet may use this
|
||||
default DCACHE_RAM_SIZE=0x2000
|
||||
# default DCACHE_RAM_BASE = 0xfec00000 # HPET may use this.
|
||||
default DCACHE_RAM_SIZE = 8 * 1024
|
||||
default CONFIG_USE_INIT = 0
|
||||
default MAX_RAM_SLOTS = 2
|
||||
default USB_ENABLE = 1
|
||||
@ -110,11 +104,11 @@ default VIACONFIG_TOP_SM_SIZE_MB=0
|
||||
default VIACONFIG_VGA_PCI_10 = 0xf8000008
|
||||
default VIACONFIG_VGA_PCI_14 = 0xfc000000
|
||||
|
||||
|
||||
default ROM_SIZE = 512 * 1024
|
||||
default CONFIG_IOAPIC = 1
|
||||
|
||||
#define framebuffer size of VX800's integrated graphics card. support 32 64 128 256
|
||||
# Define framebuffer size of VX800's integrated graphics card.
|
||||
# Supports: 32, 64, 128, 256.
|
||||
default CONFIG_VIDEO_MB = 64
|
||||
|
||||
default CONFIG_CONSOLE_SERIAL8250 = 1
|
||||
@ -126,7 +120,7 @@ default CONFIG_UDELAY_TSC = 1
|
||||
default CONFIG_TSC_X86RDTSC_CALIBRATE_WITH_TIMER2 = 1
|
||||
default HAVE_HARD_RESET = 0
|
||||
default HAVE_PIRQ_TABLE = 0
|
||||
default IRQ_SLOT_COUNT = 10
|
||||
default IRQ_SLOT_COUNT = 10 # FIXME. irq_table.c says 14.
|
||||
default HAVE_ACPI_TABLES = 1
|
||||
default HAVE_OPTION_TABLE = 1
|
||||
default ROM_IMAGE_SIZE = 128 * 1024
|
||||
@ -141,6 +135,7 @@ default CONFIG_ROM_PAYLOAD = 1
|
||||
default CROSS_COMPILE = ""
|
||||
default CC = "$(CROSS_COMPILE)gcc -m32"
|
||||
default HOSTCC = "gcc"
|
||||
default CONFIG_CBFS = 0
|
||||
|
||||
##
|
||||
## Set this to the max PCI bus number you would ever use for PCI config I/O.
|
||||
@ -148,11 +143,5 @@ default HOSTCC = "gcc"
|
||||
## time when it can't find a device.
|
||||
##
|
||||
default CONFIG_MAX_PCI_BUSES = 3
|
||||
end
|
||||
|
||||
#
|
||||
# CBFS
|
||||
#
|
||||
#
|
||||
default CONFIG_CBFS=0
|
||||
end
|
||||
|
@ -24,8 +24,8 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* most parts of this file copied from src\mainboard\asus\a8v-e_se\acpi_tables.c,
|
||||
* acpi_is_wakeup() is from Rudolf's S3 patch and SSDT was added
|
||||
* Most parts of this file copied from asus\a8v-e_se\acpi_tables.c,
|
||||
* acpi_is_wakeup() is from Rudolf's S3 patch and SSDT was added.
|
||||
*/
|
||||
|
||||
#include <console/console.h>
|
||||
@ -38,20 +38,24 @@
|
||||
extern unsigned char AmlCode_dsdt[];
|
||||
extern unsigned char AmlCode_ssdt[];
|
||||
|
||||
extern u32 wake_vec;
|
||||
extern u8 acpi_sleep_type;
|
||||
|
||||
/*
|
||||
These four macro copied from #include <arch/smp/mpspec.h>, I have to do this since "default HAVE_MP_TABLE = 0" in option.lb,
|
||||
and also since mainboard/via/*.* have no Mptable.c(so that I can not set HAVE_MP_TABLE = 1) as many other mainboard.
|
||||
So I have to copy these four to here. acpi_fill_madt() need this.
|
||||
* These four macros are copied from <arch/smp/mpspec.h>, I have to do this
|
||||
* since the "default HAVE_MP_TABLE = 0" in Options.lb, and also since
|
||||
* mainboard/via/... have no mptable.c (so that I can not set
|
||||
* HAVE_MP_TABLE = 1) as many other mainboards.
|
||||
* So I have to copy these four to here. acpi_fill_madt() needs this.
|
||||
*/
|
||||
#define MP_IRQ_POLARITY_HIGH 0x1
|
||||
#define MP_IRQ_POLARITY_LOW 0x3
|
||||
#define MP_IRQ_TRIGGER_EDGE 0x4
|
||||
#define MP_IRQ_TRIGGER_LEVEL 0xc
|
||||
|
||||
|
||||
unsigned long acpi_fill_mcfg(unsigned long current)
|
||||
{
|
||||
/* NO MCFG in VX855, no pci-e*/
|
||||
/* NO MCFG in VX855, no PCI-E. */
|
||||
return current;
|
||||
}
|
||||
|
||||
@ -65,16 +69,17 @@ unsigned long acpi_create_madt_lapics(unsigned long current)
|
||||
(cpu->bus->dev->path.type != DEVICE_PATH_APIC_CLUSTER)) {
|
||||
continue;
|
||||
}
|
||||
if (!cpu->enabled) {
|
||||
if (!cpu->enabled)
|
||||
continue;
|
||||
}
|
||||
current += acpi_create_madt_lapic((acpi_madt_lapic_t *)current, cpu_index, cpu->path.apic.apic_id);
|
||||
current += acpi_create_madt_lapic((acpi_madt_lapic_t *)current,
|
||||
cpu_index, cpu->path.apic.apic_id);
|
||||
cpu_index++;
|
||||
}
|
||||
return current;
|
||||
}
|
||||
|
||||
unsigned long acpi_create_madt_lapic_nmis(unsigned long current, u16 flags, u8 lint)
|
||||
unsigned long acpi_create_madt_lapic_nmis(unsigned long current, u16 flags,
|
||||
u8 lint)
|
||||
{
|
||||
device_t cpu;
|
||||
int cpu_index = 0;
|
||||
@ -84,10 +89,10 @@ unsigned long acpi_create_madt_lapic_nmis(unsigned long current, u16 flags, u8 l
|
||||
(cpu->bus->dev->path.type != DEVICE_PATH_APIC_CLUSTER)) {
|
||||
continue;
|
||||
}
|
||||
if (!cpu->enabled) {
|
||||
if (!cpu->enabled)
|
||||
continue;
|
||||
}
|
||||
current += acpi_create_madt_lapic_nmi((acpi_madt_lapic_nmi_t *)current, cpu_index, flags, lint);
|
||||
current += acpi_create_madt_lapic_nmi((acpi_madt_lapic_nmi_t *)
|
||||
current, cpu_index, flags, lint);
|
||||
cpu_index++;
|
||||
}
|
||||
return current;
|
||||
@ -121,13 +126,13 @@ unsigned long acpi_fill_madt(unsigned long current)
|
||||
|
||||
unsigned long acpi_fill_slit(unsigned long current)
|
||||
{
|
||||
// Not implemented
|
||||
/* Not implemented. */
|
||||
return current;
|
||||
}
|
||||
|
||||
unsigned long acpi_fill_srat(unsigned long current)
|
||||
{
|
||||
/* No NUMA, no SRAT */
|
||||
/* No NUMA, no SRAT. */
|
||||
}
|
||||
|
||||
#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1)
|
||||
@ -144,30 +149,27 @@ unsigned long write_acpi_tables(unsigned long start)
|
||||
acpi_madt_t *madt;
|
||||
acpi_fadt_t *fadt;
|
||||
acpi_facs_t *facs;
|
||||
acpi_header_t *dsdt;
|
||||
acpi_header_t *ssdt;
|
||||
acpi_header_t *dsdt, *ssdt;
|
||||
|
||||
/* Align ACPI tables to 16byte */
|
||||
/* Align ACPI tables to 16 byte. */
|
||||
start = (start + 0x0f) & -0x10;
|
||||
current = start;
|
||||
|
||||
printk_info("ACPI: Writing ACPI tables at %lx...\n", start);
|
||||
|
||||
/* We need at least an RSDP and an RSDT Table */
|
||||
/* We need at least an RSDP and an RSDT table. */
|
||||
rsdp = (acpi_rsdp_t *) current;
|
||||
current += sizeof(acpi_rsdp_t);
|
||||
rsdt = (acpi_rsdt_t *) current;
|
||||
current += sizeof(acpi_rsdt_t);
|
||||
|
||||
/* clear all table memory */
|
||||
/* Clear all table memory. */
|
||||
memset((void *)start, 0, current - start);
|
||||
|
||||
acpi_write_rsdp(rsdp, rsdt);
|
||||
acpi_write_rsdt(rsdt);
|
||||
|
||||
/*
|
||||
* We explicitly add these tables later on:
|
||||
*/
|
||||
/* We explicitly add these tables later on: */
|
||||
printk_debug("ACPI: * FACS\n");
|
||||
current = ALIGN(current, 64);
|
||||
facs = (acpi_facs_t *) current;
|
||||
@ -177,8 +179,9 @@ unsigned long write_acpi_tables(unsigned long start)
|
||||
printk_debug("ACPI: * DSDT\n");
|
||||
dsdt = (acpi_header_t *) current;
|
||||
current += ((acpi_header_t *) AmlCode_dsdt)->length;
|
||||
memcpy((void *)dsdt,(void *)AmlCode_dsdt, ((acpi_header_t *)AmlCode_dsdt)->length);
|
||||
dsdt->checksum = 0; /* don't trust intel iasl compiler to get this right. */
|
||||
memcpy((void *)dsdt, (void *)AmlCode_dsdt,
|
||||
((acpi_header_t *) AmlCode_dsdt)->length);
|
||||
dsdt->checksum = 0; /* Don't trust iasl to get this right. */
|
||||
dsdt->checksum = acpi_checksum(dsdt, dsdt->length);
|
||||
printk_debug("ACPI: * DSDT @ %08x Length %x\n", dsdt, dsdt->length);
|
||||
|
||||
@ -196,32 +199,30 @@ unsigned long write_acpi_tables(unsigned long start)
|
||||
current += madt->header.length;
|
||||
acpi_add_table(rsdt, madt);
|
||||
|
||||
/* NO MCFG in VX855, no pci-e*/
|
||||
/* NO MCFG in VX855, no PCI-E. */
|
||||
|
||||
printk_debug("ACPI: * HPET\n");
|
||||
hpet = (acpi_mcfg_t *) current;
|
||||
acpi_create_hpet(hpet);
|
||||
current += hpet->header.length;
|
||||
acpi_add_table(rsdt, hpet);
|
||||
/*
|
||||
|
||||
#if 0
|
||||
printk_debug("ACPI: * SSDT\n");
|
||||
ssdt = (acpi_header_t *) current;
|
||||
current += ((acpi_header_t *)AmlCode_ssdt)->length;
|
||||
memcpy((void *)ssdt,(void *)AmlCode_ssdt, ((acpi_header_t *)AmlCode_ssdt)->length);
|
||||
ssdt->checksum = 0; // don't trust intel iasl compiler to get this right
|
||||
ssdt->checksum = 0; /* Don't trust iasl to get this right. */
|
||||
ssdt->checksum = acpi_checksum(ssdt, ssdt->length);
|
||||
acpi_add_table(rsdt, ssdt);
|
||||
printk_debug("ACPI: * SSDT @ %08x Length %x\n", ssdt, ssdt->length);
|
||||
*/
|
||||
#endif
|
||||
|
||||
printk_info("ACPI: done.\n");
|
||||
return current;
|
||||
}
|
||||
|
||||
extern u32 wake_vec;
|
||||
extern u8 acpi_sleep_type;
|
||||
|
||||
int acpi_is_wakeup(void) {
|
||||
int acpi_is_wakeup(void)
|
||||
{
|
||||
return (acpi_sleep_type == 3);
|
||||
}
|
||||
|
||||
|
@ -18,8 +18,8 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* part of this file is from cx700 port, part of is from cn700 port,
|
||||
* and acpi_is_wakeup_early_via_VX800() is part of Rudolf's S3 patch
|
||||
* Part of this file is from cx700 port, part of is from cn700 port,
|
||||
* and acpi_is_wakeup_early_via_VX800() is part of Rudolf's S3 patch.
|
||||
*/
|
||||
|
||||
#define ASSEMBLY 1
|
||||
@ -47,7 +47,7 @@
|
||||
#endif
|
||||
#include "cpu/x86/lapic/boot_cpu.c"
|
||||
|
||||
/* this file contains the board-special SI value for raminit.c*/
|
||||
/* This file contains the board-special SI value for raminit.c. */
|
||||
#include "mainboard/via/6413e/DrivingClkPhaseData.c"
|
||||
|
||||
#include "northbridge/via/vx800/raminit.h"
|
||||
@ -55,21 +55,24 @@
|
||||
#include "cpu/x86/car/copy_and_run.c"
|
||||
#include "mainboard/via/6413e/wakeup.h"
|
||||
|
||||
/* this acpi_is_wakeup_early_via_VX800 is from Rudolf's patch post in maillist in 2008-9-8,
|
||||
http://www.coreboot.org/pipermail/coreboot/2008-January/028787.html.
|
||||
/*
|
||||
* This acpi_is_wakeup_early_via_VX800 is from Rudolf's patch on the list:
|
||||
* http://www.coreboot.org/pipermail/coreboot/2008-January/028787.html.
|
||||
*/
|
||||
|
||||
void jason_tsc_count_car(void)
|
||||
{/*
|
||||
{
|
||||
#if 0
|
||||
unsigned long long start;
|
||||
asm volatile ("rdtsc" : "=A" (start));
|
||||
start >>= 20;
|
||||
print_emerg("jason_tsc_count_car= ");
|
||||
print_emerg_hex32((unsigned long) start);
|
||||
print_emerg("\n");*/
|
||||
print_emerg("\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
int acpi_is_wakeup_early_via_vx800(void) {
|
||||
int acpi_is_wakeup_early_via_vx800(void)
|
||||
{
|
||||
device_t dev;
|
||||
u16 tmp, result;
|
||||
|
||||
@ -100,99 +103,125 @@ static inline int spd_read_byte(unsigned device, unsigned address)
|
||||
return smbus_read_byte(device, address);
|
||||
}
|
||||
|
||||
|
||||
/* all content of this function came from the cx700 port of coreboot.
|
||||
*/
|
||||
/* All content of this function came from the cx700 port of coreboot. */
|
||||
static void enable_mainboard_devices(void)
|
||||
{
|
||||
device_t dev;
|
||||
uint16_t values;
|
||||
|
||||
#if 0 // add and close this switch, since some line cause error, some written at elsewhere (stage1 stage2),
|
||||
#if 0
|
||||
/*
|
||||
* Add and close this switch, since some line cause error, some
|
||||
* written at elsewhere (stage1 stage2).
|
||||
*/
|
||||
u8 regdata;
|
||||
dev = pci_locate_device(PCI_ID(PCI_VENDOR_ID_VIA,
|
||||
PCI_DEVICE_ID_VIA_VX855_LPC), 0);
|
||||
|
||||
/* Disable GP3 */
|
||||
/* Disable GP3. */
|
||||
pci_write_config8(dev, 0x98, 0x00);
|
||||
|
||||
pci_write_config8(dev, 0x50, 0x80);//disable mc97
|
||||
//martin disable internal KBC Configuration
|
||||
pci_write_config8(dev, 0x51, 0x2d); //internal Config is needed to decide which key can be pressed to resume from s3
|
||||
pci_write_config8(dev, 0x50, 0x80); /* Disable mc97. */
|
||||
|
||||
// this cmd cause the irq0 can not be triggerd,since bit 5 was set to 0.
|
||||
//pci_write_config8(dev, 0x58, 0x42);
|
||||
/*
|
||||
* Martin: Disable internal KBC configuration.
|
||||
*
|
||||
* Internal Config is needed to decide which key can be pressed to
|
||||
* resume from s3.
|
||||
*/
|
||||
pci_write_config8(dev, 0x51, 0x2d);
|
||||
|
||||
//these writing may
|
||||
/* This causes irq0 can not be triggerd, since bit 5 was set to 0. */
|
||||
/* pci_write_config8(dev, 0x58, 0x42); */
|
||||
|
||||
/* These writing may... TODO */
|
||||
regdata = pci_read_config8(dev, 0x58);
|
||||
regdata |= 0x41;
|
||||
pci_write_config8(dev, 0x58, regdata);
|
||||
pci_write_config8(dev, 0x59, 0x80);
|
||||
pci_write_config8(dev, 0x5b, 0x01);
|
||||
#endif
|
||||
|
||||
print_debug("In enable_mainboard_devices \r\n");
|
||||
|
||||
/*--AUTHOR-NOTE--
|
||||
Enable P2P Bridge Header for External PCI BUS.
|
||||
--AUTHOR-NOTE--*/
|
||||
/* Enable P2P Bridge Header for external PCI bus. */
|
||||
dev = pci_locate_device(PCI_ID(0x1106, 0xa353), 0);
|
||||
pci_write_config8(dev, 0x4f, 0x41);
|
||||
|
||||
/* "5324" already is the default value of PCI ide device, cancel this pci write*/
|
||||
/*[william 20080124]: fix bug that can not boot ubuntu at the begnning time*/
|
||||
/* dev = 0;
|
||||
/*
|
||||
* "5324" already is the default value of the PCI IDE device, cancel
|
||||
* this PCI write.
|
||||
*
|
||||
* [william 20080124]: Fix bug that can not boot Ubuntu at the
|
||||
* beginning time.
|
||||
*/
|
||||
#if 0
|
||||
dev = 0;
|
||||
dev = pci_locate_device(PCI_ID(0x1106, PCI_DEVICE_ID_VIA_VX855_IDE), 0);
|
||||
values = pci_read_config16(dev, 0xBA);
|
||||
values &= ~0xffff;
|
||||
values |= 0x5324;
|
||||
pci_write_config16(dev, 0xBA, values);*/
|
||||
pci_write_config16(dev, 0xBA, values);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* most content of this function came from the cx700 port of coreboot.
|
||||
Turn on the shadow of E-seg.
|
||||
/*
|
||||
* Most content of this function came from the cx700 port of coreboot.
|
||||
* Turn on the shadow of E-seg.
|
||||
*/
|
||||
static void enable_shadow_ram(void)
|
||||
{
|
||||
uint8_t shadowreg;
|
||||
/*changed the value from 0x2a to 0x3f. "read only" may block "write"?
|
||||
and maybe in C-seg "write" will be needed?*/
|
||||
|
||||
/*
|
||||
* Changed the value from 0x2a to 0x3f. "read only" may block "write"?
|
||||
* and maybe in C-seg "write" will be needed?
|
||||
*/
|
||||
pci_write_config8(PCI_DEV(0, 0, 3), 0x80, 0xff);
|
||||
|
||||
/* 0xf0000-0xfffff - ACPI tables */
|
||||
shadowreg = pci_read_config8(PCI_DEV(0, 0, 3), 0x83);
|
||||
shadowreg |= 0x30;
|
||||
pci_write_config8(PCI_DEV(0, 0, 3), 0x83, shadowreg);
|
||||
|
||||
/* 0xe0000-0xeffff - elfload? */
|
||||
/*in s3 resume process, wakeup.c, I use E-seg to hold the code(which can not locate in the area to be covered) that will copy 0-A-seg and F-seg from TOP-mem back to their normal location.*/
|
||||
/*
|
||||
* In s3 resume process, wakeup.c, I use E-seg to hold the code
|
||||
* (which can not locate in the area to be covered) that will copy
|
||||
* 0-A-seg and F-seg from TOP-mem back to their normal location.
|
||||
*/
|
||||
pci_write_config8(PCI_DEV(0, 0, 3), 0x82, 0xff);
|
||||
|
||||
#if 0
|
||||
/* Enable shadow ram as normal dram */
|
||||
/* Enable shadow RAM as normal DRAM */
|
||||
/* 0xc0000-0xcffff - VGA BIOS */
|
||||
pci_write_config8(PCI_DEV(0, 0, 3), 0x80, 0x2a);
|
||||
pci_write_config8(PCI_DEV(0, 0, 7), 0x61, 0x00);
|
||||
/* 0xd0000-0xdffff - ?? */
|
||||
//pci_write_config8(PCI_DEV(0, 0, 3), 0x81, 0xff);
|
||||
//pci_write_config8(PCI_DEV(0, 0, 7), 0x62, 0xff);
|
||||
/* pci_write_config8(PCI_DEV(0, 0, 3), 0x81, 0xff); */
|
||||
/* pci_write_config8(PCI_DEV(0, 0, 7), 0x62, 0xff); */
|
||||
|
||||
/* Do it again for the vlink controller */
|
||||
/* Do it again for the vlink controller. */
|
||||
shadowreg = pci_read_config8(PCI_DEV(0, 0, 7), 0x63);
|
||||
shadowreg |= 0x30;
|
||||
pci_write_config8(PCI_DEV(0, 0, 7), 0x63, shadowreg);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*added this table 2008-11-28,
|
||||
this table contains the value needed to be set before begin to init dram.
|
||||
Note: REV_Bx should be checked for changes when porting a new board!!!!! */
|
||||
/*
|
||||
* Added this table 2008-11-28.
|
||||
* This table contains the value needed to be set before begin to init DRAM.
|
||||
* Note: REV_Bx should be checked for changes when porting a new board!
|
||||
*/
|
||||
static const struct VIA_PCI_REG_INIT_TABLE mNbStage1InitTbl[] = {
|
||||
//VT3409 no pcie
|
||||
/* VT3409 no PCI-E */
|
||||
0x00, 0xFF, NB_APIC_REG(0x61), 0xFF, 0x0E, // Set Exxxxxxx as pcie mmio config range
|
||||
0x00, 0xFF, NB_APIC_REG(0x60), 0xF4, 0x0B, // Support extended cfg address of pcie
|
||||
//0x00, 0xFF, NB_APIC_REG(0x42), 0xF9, 0x02, // APIC Interrupt((BT_INTR)) Control
|
||||
// Set ROMSIP value by software
|
||||
|
||||
/*0x00, 0xFF, NB_HOST_REG(0x70), 0x77, 0x33, // 2x Host Adr Strobe/Pad Pullup Driving = 3
|
||||
/*
|
||||
0x00, 0xFF, NB_HOST_REG(0x70), 0x77, 0x33, // 2x Host Adr Strobe/Pad Pullup Driving = 3
|
||||
0x00, 0xFF, NB_HOST_REG(0x71), 0x77, 0x33, // 2x Host Adr Strobe/Pad Pulldown Driving = 3
|
||||
0x00, 0xFF, NB_HOST_REG(0x72), 0x77, 0x33, // 4x Host Dat Strobe/Pad Pullup Driving = 3
|
||||
0x00, 0xFF, NB_HOST_REG(0x73), 0x77, 0x33, // 4x Host Dat Strobe/Pad Pulldown Driving = 3
|
||||
@ -221,7 +250,6 @@ static const struct VIA_PCI_REG_INIT_TABLE mNbStage1InitTbl[]= {
|
||||
0x00, 0xFF, NB_HOST_REG(0x86), 0xFF, 0x44, // Host Data / Strobe CKG Control (Group 2)
|
||||
0x00, 0xFF, NB_HOST_REG(0x87), 0xFF, 0x44, // Host Data / Strobe CKG Control (Group 3) */
|
||||
|
||||
|
||||
// CPU Host Bus Control
|
||||
0x00, 0xFF, NB_HOST_REG(0x50), 0x1F, 0x08, // Request phase ctrl: Dynamic Defer Snoop Stall Count = 8
|
||||
//0x00, 0xFF, NB_HOST_REG(0x51), 0xFF, 0x7F, // CPU I/F Ctrl-1: Disable Fast DRDY and RAW
|
||||
@ -244,30 +272,30 @@ static const struct VIA_PCI_REG_INIT_TABLE mNbStage1InitTbl[]= {
|
||||
0x00, 0xFF, NB_HOST_REG(0x98), 0xC1, 0x41, // CPU Miscellaneous Control 3
|
||||
0x00, 0xFF, NB_HOST_REG(0x99), 0x0E, 0x06, // CPU Miscellaneous Control 4
|
||||
|
||||
|
||||
// Set APIC and SMRAM
|
||||
0x00, 0xFF, NB_HOST_REG(0x97), 0xFF, 0x00, // APIC Related Control
|
||||
0x00, 0xFF, NB_DRAMC_REG(0x86), 0xD6, 0x29, // SMM and APIC Decoding: enable APIC, MSI and SMRAM A-Seg
|
||||
0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // End of the table
|
||||
};
|
||||
|
||||
#define USE_VCP 1//0 means use DVP
|
||||
#define USE_VCP 1 /* 0 means "use DVP". */
|
||||
#define USE_COM1 1
|
||||
#define USE_COM2 0
|
||||
|
||||
#define gCom1Base 0x3f8
|
||||
#define gCom2Base 0x2f8
|
||||
|
||||
void EmbedComInit()
|
||||
{
|
||||
u8 ByteVal;
|
||||
u16 ComBase;
|
||||
|
||||
//enable NB multiple function control
|
||||
/* Enable NB multiple function control. */
|
||||
ByteVal = pci_read_config8(PCI_DEV(0, 0, 0), 0x4f);
|
||||
ByteVal = ByteVal | 0x01;
|
||||
pci_write_config8(PCI_DEV(0, 0, 0), 0x4f, ByteVal);
|
||||
|
||||
//VGA Enable
|
||||
/* VGA enable. */
|
||||
ByteVal = pci_read_config8(PCI_DEV(0, 0, 3), 0xA1);
|
||||
ByteVal = ByteVal | 0x80;
|
||||
pci_write_config8(PCI_DEV(0, 0, 3), 0xA1, ByteVal);
|
||||
@ -276,44 +304,40 @@ void EmbedComInit()
|
||||
ByteVal = ByteVal | 0x08;
|
||||
pci_write_config8(PCI_DEV(0, 0, 3), 0xA7, ByteVal);
|
||||
|
||||
//Enable p2p IO/mem
|
||||
/* Enable P2P IO/mem. */
|
||||
ByteVal = pci_read_config8(PCI_DEV(0, 1, 0), 0x4);
|
||||
ByteVal = ByteVal | 0x07;
|
||||
pci_write_config8(PCI_DEV(0, 1, 0), 0x4, ByteVal);
|
||||
|
||||
//Turn on Graphic chip IO port port access
|
||||
/* Turn on graphic chip I/O port port access. */
|
||||
ByteVal = inb(0x3C3);
|
||||
ByteVal = ByteVal | 0x01;
|
||||
outb(ByteVal, 0x3C3);
|
||||
|
||||
//Turn off Graphic chip Register protection
|
||||
/* Turn off graphic chip register protection. */
|
||||
outb(0x10, 0x3C4);
|
||||
ByteVal = inb(0x3C5);
|
||||
ByteVal = ByteVal | 0x01;
|
||||
outb(ByteVal, 0x3C5);
|
||||
|
||||
//south module pad share enable 0x3C5.78[7]
|
||||
/* South module pad share enable 0x3C5.78[7]. */
|
||||
outb(0x78, 0x3C4);
|
||||
ByteVal = inb(0x3C5);
|
||||
ByteVal = ByteVal | 0x80;
|
||||
outb(ByteVal, 0x3C5);
|
||||
|
||||
//enable UART Function multiplex with DVP or VCP pad D17F0Rx46[7,6]
|
||||
/* Enable UART function multiplex with DVP or VCP pad D17F0Rx46[7,6]. */
|
||||
ByteVal = pci_read_config8(PCI_DEV(0, 17, 0), 0x46);
|
||||
//multiplex with VCP
|
||||
if (USE_VCP == 1)
|
||||
ByteVal = (ByteVal & 0x3F) | 0x40;
|
||||
//multiplex with DVP
|
||||
ByteVal = (ByteVal & 0x3F) | 0x40; /* Multiplex with VCP. */
|
||||
else
|
||||
ByteVal = (ByteVal & 0x3F) | 0xC0;
|
||||
ByteVal = (ByteVal & 0x3F) | 0xC0; /* Multiplex with DVP. */
|
||||
pci_write_config8(PCI_DEV(0, 17, 0), 0x46, ByteVal);
|
||||
|
||||
|
||||
|
||||
//enable embeded com1 and com2 D17F0RxB0[5,4]
|
||||
/* Enable embedded COM1 and COM2 D17F0RxB0[5,4]. */
|
||||
ByteVal = pci_read_config8(PCI_DEV(0, 17, 0), 0xB0);
|
||||
ByteVal = ByteVal & 0xcf;
|
||||
//multiplex with VCP
|
||||
/* Multiplex with VCP. */
|
||||
if (USE_COM1 == 1)
|
||||
ByteVal = ByteVal | 0x10;
|
||||
if (USE_COM2 == 1)
|
||||
@ -327,7 +351,7 @@ void EmbedComInit()
|
||||
|
||||
//noharddrive
|
||||
|
||||
//set embeded com1 IO base = 0x3E8
|
||||
/* Set embedded COM1 I/O base = 0x3E8 */
|
||||
//D17F0RB4
|
||||
//ByteVal = 0xFD;
|
||||
if (USE_COM1 == 1) {
|
||||
@ -338,7 +362,7 @@ void EmbedComInit()
|
||||
pci_write_config8(PCI_DEV(0, 17, 0), 0xB2, ByteVal);
|
||||
}
|
||||
|
||||
//set embeded com2 IO base = 0x2E8
|
||||
/* Set embedded COM2 I/O base = 0x2E8. */
|
||||
//D17F0RB5
|
||||
//ByteVal = 0xDD;
|
||||
if (USE_COM2 == 1) {
|
||||
@ -348,106 +372,119 @@ void EmbedComInit()
|
||||
ByteVal = (ByteVal & 0x0f) | 0x30;
|
||||
pci_write_config8(PCI_DEV(0, 17, 0), 0xB2, ByteVal);
|
||||
}
|
||||
/* No port 80 biger then 0x10. */
|
||||
|
||||
//no port 80 biger then 0x10
|
||||
|
||||
//disable interrupt
|
||||
/* Disable interrupt. */
|
||||
ByteVal = inb(ComBase + 3);
|
||||
outb(ByteVal & 0x7F, ComBase + 3);
|
||||
outb(0x00, ComBase + 1);
|
||||
|
||||
//set baudrate
|
||||
/* Set BAUD rate. */
|
||||
ByteVal = inb(ComBase + 3);
|
||||
outb(ByteVal | 0x80, ComBase + 3);
|
||||
outb(0x01, ComBase);
|
||||
outb(0x00, ComBase + 1);
|
||||
|
||||
//set frame fromat
|
||||
/* Set frame format. */
|
||||
ByteVal = inb(ComBase + 3);
|
||||
outb(ByteVal & 0x3F, ComBase + 3);
|
||||
outb(0x03, ComBase + 3);
|
||||
outb(0x00, ComBase + 2);
|
||||
outb(0x00, ComBase + 4);
|
||||
|
||||
//SOutput("Embeded com output\n");
|
||||
//while(1);
|
||||
/* SOutput("Embedded COM output\n"); */
|
||||
/* while(1); */
|
||||
}
|
||||
|
||||
/*cache_as_ram.inc jump to here
|
||||
*/
|
||||
/* cache_as_ram.inc jumps to here. */
|
||||
void amd64_main(unsigned long bist)
|
||||
{ unsigned cpu_reset = 0;
|
||||
{
|
||||
unsigned cpu_reset = 0;
|
||||
u16 boot_mode;
|
||||
u8 rambits;
|
||||
u8 rambits, Data8, Data;
|
||||
device_t device;
|
||||
/* device_t dev; */
|
||||
|
||||
//device_t dev;
|
||||
/* Enable multifunction for northbridge. These 4 lines(until console_init();) are the same with epia-cn port.*/
|
||||
/*
|
||||
* Enable multifunction for northbridge. These 4 lines (until
|
||||
* console_init()) are the same with epia-cn port.
|
||||
*/
|
||||
pci_write_config8(PCI_DEV(0, 0, 0), 0x4f, 0x01);
|
||||
EmbedComInit();
|
||||
//enable_vx800_serial();
|
||||
//uart_init();
|
||||
/* enable_vx800_serial(); */
|
||||
/* uart_init(); */
|
||||
|
||||
|
||||
/* 1. D15F0
|
||||
|
||||
a) RxBAh = 71h
|
||||
|
||||
b) RxBBh = 05h
|
||||
|
||||
c) RxBEh = 71h
|
||||
|
||||
d) RxBFh = 05h
|
||||
|
||||
2. D17F0
|
||||
|
||||
a) RxA0h = 06h
|
||||
|
||||
b) RxA1h = 11h
|
||||
|
||||
c) RxA2h = 27h
|
||||
|
||||
d) RxA3h = 32h
|
||||
|
||||
e) Rx79h = 40h
|
||||
|
||||
f) Rx72h = 27h
|
||||
|
||||
g) Rx73h = 32h
|
||||
/*
|
||||
* 1. D15F0
|
||||
* a) RxBAh = 71h
|
||||
* b) RxBBh = 05h
|
||||
* c) RxBEh = 71h
|
||||
* d) RxBFh = 05h
|
||||
*
|
||||
* 2. D17F0
|
||||
* a) RxA0h = 06h
|
||||
* b) RxA1h = 11h
|
||||
* c) RxA2h = 27h
|
||||
* d) RxA3h = 32h
|
||||
* e) Rx79h = 40h
|
||||
* f) Rx72h = 27h
|
||||
* g) Rx73h = 32h
|
||||
*/
|
||||
|
||||
u8 Data8;
|
||||
|
||||
jason_tsc_count_car();
|
||||
pci_write_config16(PCI_DEV(0, 0xf, 0), 0xBA, PCI_DEVICE_ID_VIA_VX855_IDE);
|
||||
pci_write_config16(PCI_DEV(0, 0xf, 0), 0xBE, PCI_DEVICE_ID_VIA_VX855_IDE);
|
||||
|
||||
pci_write_config16(PCI_DEV(0, 0xf, 0), 0xBA,
|
||||
PCI_DEVICE_ID_VIA_VX855_IDE);
|
||||
pci_write_config16(PCI_DEV(0, 0xf, 0), 0xBE,
|
||||
PCI_DEVICE_ID_VIA_VX855_IDE);
|
||||
pci_write_config16(PCI_DEV(0, 0x11, 0), 0xA0, PCI_VENDOR_ID_VIA);
|
||||
pci_write_config16(PCI_DEV(0, 0x11, 0), 0xA2, PCI_DEVICE_ID_VIA_VX855_LPC);
|
||||
pci_write_config16(PCI_DEV(0, 0x11, 0), 0xA2,
|
||||
PCI_DEVICE_ID_VIA_VX855_LPC);
|
||||
Data8 = pci_read_config8(PCI_DEV(0, 0x11, 0), 0x79);
|
||||
Data8 &= ~0x40;
|
||||
Data8 |= 0x40;
|
||||
pci_write_config8(PCI_DEV(0, 0x11, 0), 0x79, Data8);
|
||||
pci_write_config16(PCI_DEV(0, 0x11, 0), 0x72, PCI_DEVICE_ID_VIA_VX855_LPC);
|
||||
pci_write_config16(PCI_DEV(0, 0x11, 0), 0x72,
|
||||
PCI_DEVICE_ID_VIA_VX855_LPC);
|
||||
|
||||
console_init();//there are to function defination of console_init(), while the src/archi386/lib is the right one.
|
||||
/*
|
||||
* There are two function definitions of console_init(), while the
|
||||
* src/arch/i386/lib is the right one.
|
||||
*/
|
||||
console_init();
|
||||
|
||||
/* decide if this is a s3 wakeup or a normal boot*/
|
||||
/* Decide if this is a s3 wakeup or a normal boot. */
|
||||
boot_mode = acpi_is_wakeup_early_via_vx800();
|
||||
/* 2008-11-27 add this, to transfer "cpu restart" to "cold boot"
|
||||
When this boot is not a S3 resume, and PCI registers had been written,
|
||||
then this must be a cpu restart(result of os reboot cmd), so we need a real "cold boot".*/
|
||||
jason_tsc_count_car();
|
||||
if((boot_mode!=3)&&(pci_read_config8(PCI_DEV(0, 0, 3), 0x80)!=0))
|
||||
{outb(6, 0xcf9);} /*x86 cold boot I/O cmd*/
|
||||
|
||||
/* this 2 lines is the same with epia-cn port.*/
|
||||
/*
|
||||
* 2008-11-27 Add this, to transfer "cpu restart" to "cold boot".
|
||||
* When this boot is not a S3 resume, and PCI registers had been
|
||||
* written, then this must be a CPU restart (result of OS reboot cmd),
|
||||
* so we need a real "cold boot".
|
||||
*/
|
||||
jason_tsc_count_car();
|
||||
if ((boot_mode != 3)
|
||||
&& (pci_read_config8(PCI_DEV(0, 0, 3), 0x80) != 0)) {
|
||||
outb(6, 0xcf9);
|
||||
}
|
||||
|
||||
/* x86 cold boot I/O cmd. */
|
||||
/* These 2 lines are the same with epia-cn port. */
|
||||
enable_smbus();
|
||||
jason_tsc_count_car();
|
||||
//smbus_fixup(&ctrl);// this fix does help vx800!, but vx855 doesn't need this
|
||||
|
||||
/* This fix does help vx800!, but vx855 doesn't need this. */
|
||||
/* smbus_fixup(&ctrl); */
|
||||
|
||||
if (bist == 0) {
|
||||
//CAR need mtrr untill mem is ok, so i disable this early_mtrr_init();
|
||||
//print_debug("doing early_mtrr\r\n");
|
||||
//early_mtrr_init();
|
||||
/*
|
||||
* CAR needs MTRR until memory is ok, so disable this
|
||||
* early_mtrr_init() call.
|
||||
*/
|
||||
#if 0
|
||||
print_debug("doing early_mtrr\r\n");
|
||||
early_mtrr_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Halt if there was a built-in self test failure. */
|
||||
@ -456,32 +493,45 @@ g) Rx73h = 32h
|
||||
print_debug("Enabling mainboard devices\r\n");
|
||||
enable_mainboard_devices();
|
||||
|
||||
u8 Data;
|
||||
device_t device;
|
||||
/*2008-11-27 Get NB Chip revision from D0F4RxF6, revision will be used in via_pci_inittable*/
|
||||
/*
|
||||
* Get NB chip revision from D0F4RxF6, revision will be used in
|
||||
* via_pci_inittable.
|
||||
*/
|
||||
device = PCI_DEV(0, 0, 4);
|
||||
Data = pci_read_config8(device, 0xf6);
|
||||
print_debug("NB chip revision =");
|
||||
print_debug_hex8(Data);
|
||||
print_debug("\r\n");
|
||||
/*2008-11-27, make NB ready before draminit*/
|
||||
|
||||
/* Make NB ready before DRAM init. */
|
||||
via_pci_inittable(Data, mNbStage1InitTbl);
|
||||
|
||||
/*2008-11-27 add this.
|
||||
When resume from s3, draminit is skiped, so need to recovery any PCI register related to draminit. d0f3 didnt lose its Power during whole s3 time, so any register not belonging to d0f3 needs to be recovered .*/
|
||||
/*
|
||||
* When resume from s3, DRAM init is skipped, so need to recovery
|
||||
* any PCI register related to DRAM init. d0f3 didn't lose its power
|
||||
* during whole s3 time, so any register not belonging to d0f3 needs
|
||||
* to be recovered.
|
||||
*/
|
||||
#if 1
|
||||
if (boot_mode == 3) {
|
||||
u8 i;
|
||||
u8 ramregs[] = { 0x43, 0x42, 0x41, 0x40 };
|
||||
DRAM_SYS_ATTR DramAttr;
|
||||
|
||||
print_debug("This is a S3 wakeup\r\n");
|
||||
print_debug("This is an S3 wakeup\r\n");
|
||||
|
||||
memset(&DramAttr, 0, sizeof(DRAM_SYS_ATTR));
|
||||
/*Step1 DRAM Detection; DDR1 or DDR2; Get SPD Data; Rank Presence;64 or 128bit; Unbuffered or registered; 1T or 2T*/
|
||||
/*
|
||||
* Step 1: DRAM detection; DDR1 or DDR2; Get SPD Data;
|
||||
* Rank Presence; 64 or 128bit; Unbuffered or registered;
|
||||
* 1T or 2T.
|
||||
*/
|
||||
DRAMDetect(&DramAttr);
|
||||
|
||||
/*begin to get ram size, 43,42 41 40 contains the end address of last rank in ddr2-slot*/
|
||||
/*
|
||||
* Begin to get RAM size, 43,42 41 40 contains the end
|
||||
* address of last rank in DDR2 slot.
|
||||
*/
|
||||
device = PCI_DEV(0, 0, 3);
|
||||
for (rambits = 0, i = 0; i < ARRAY_SIZE(ramregs); i++) {
|
||||
rambits = pci_read_config8(device, ramregs[i]);
|
||||
@ -491,47 +541,65 @@ g) Rx73h = 32h
|
||||
|
||||
DRAMDRDYSetting(&DramAttr);
|
||||
|
||||
Data = 0x80;//this value is same with DevInit.c
|
||||
Data = 0x80; /* This value is same with DevInit.c. */
|
||||
pci_write_config8(PCI_DEV(0, 0, 4), 0xa3, Data);
|
||||
pci_write_config8(PCI_DEV(0, 17, 7), 0x60, rambits << 2);
|
||||
Data = pci_read_config8(MEMCTRL, 0x88);
|
||||
pci_write_config8(PCI_DEV(0, 17, 7), 0xE5, Data);
|
||||
|
||||
DRAMRegFinalValue(&DramAttr); //Just copy this function from draminit to here!
|
||||
SetUMARam();//Just copy this function from draminit to here!
|
||||
/* Just copy this function from draminit to here! */
|
||||
DRAMRegFinalValue(&DramAttr);
|
||||
|
||||
/* Just copy this function from draminit to here! */
|
||||
SetUMARam();
|
||||
|
||||
print_debug("Resume from S3, RAM init was ignored\r\n");
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
ddr2_ram_setup();
|
||||
ram_check(0, 640 * 1024);
|
||||
}
|
||||
#endif
|
||||
//ddr2_ram_setup();
|
||||
/*2008-11-27 this line is the same with cx700 port .*/
|
||||
|
||||
/* ddr2_ram_setup(); */
|
||||
/* This line is the same with cx700 port. */
|
||||
enable_shadow_ram();
|
||||
|
||||
jason_tsc_count_car();
|
||||
/*2008-11-27
|
||||
For coreboot most time of S3 resume is the same as normal boot, so some memory area under 1M become dirty,
|
||||
so before this happen, I need to backup the content of mem to top-mem.
|
||||
I will reserve the 1M top-men in LBIO table in coreboot_table.c and recovery the content of 1M-mem in wakeup.c
|
||||
|
||||
/*
|
||||
* For coreboot most time of S3 resume is the same as normal boot,
|
||||
* so some memory area under 1M become dirty, so before this happen,
|
||||
* I need to backup the content of mem to top-mem.
|
||||
*
|
||||
* I will reserve the 1M top-men in LBIO table in coreboot_table.c
|
||||
* and recovery the content of 1M-mem in wakeup.c.
|
||||
*/
|
||||
#if PAYLOAD_IS_SEABIOS==1 //
|
||||
#if PAYLOAD_IS_SEABIOS == 1
|
||||
if (boot_mode == 3) {
|
||||
/* An Idea of Libo.Feng at amd.com in http://www.coreboot.org/pipermail/coreboot/2008-December/043111.html
|
||||
I want move the 1M data, I have to set some MTRRs myself.*/
|
||||
/*Setting mtrr before back memoy save s3 resume time about 0.14 seconds*/
|
||||
/*!!!!!!!!Since CAR stack uses cache, and we are using cache here, we must be careful,
|
||||
1 during these mtrr code, must no function call, (after this mtrr, I think it should be ok to use function)
|
||||
2 before stack switch, no use variable that have value set before this
|
||||
3 due to 2, take care of "cpu_reset", I directlly set it to ZERO.
|
||||
/* An idea of Libo.Feng at amd.com in http://www.coreboot.org/pipermail/coreboot/2008-December/043111.html
|
||||
*
|
||||
* I want move the 1M data, I have to set some MTRRs myself.
|
||||
* Setting MTRR before back memory save s3 resume time about
|
||||
* 0.14 seconds.
|
||||
*
|
||||
* !!! Since CAR stack uses cache, and we are using cache
|
||||
* here, we must be careful:
|
||||
*
|
||||
* 1. during this MTRR code, must no function call (after
|
||||
* this MTRR, I think it should be OK to use function).
|
||||
* 2. Before stack switch, no use variable that have value
|
||||
* set before this.
|
||||
* 3. Due to 2, take care of "cpu_reset", I directlly set it
|
||||
* to ZERO.
|
||||
*/
|
||||
u32 memtop = *(u32 *) WAKE_MEM_INFO;
|
||||
u32 memtop1 = *(u32 *) WAKE_MEM_INFO - 0x100000;
|
||||
u32 memtop2 = *(u32 *) WAKE_MEM_INFO - 0x200000;
|
||||
u32 memtop3 = *(u32 *) WAKE_MEM_INFO - 64 * 1024 - 0x100000;
|
||||
u32 memtop4=*(u32*)WAKE_MEM_INFO- 64*1024-0x100000+0xe0000;
|
||||
/* __asm__ volatile (
|
||||
u32 memtop4 =
|
||||
*(u32 *) WAKE_MEM_INFO - 64 * 1024 - 0x100000 + 0xe0000;
|
||||
#if 0
|
||||
__asm__ volatile (
|
||||
"movl $0x204, %%ecx\n\t"
|
||||
"xorl %%edx, %%edx\n\t"
|
||||
"movl %0,%%eax\n\t"
|
||||
@ -547,6 +615,7 @@ g) Rx73h = 32h
|
||||
"wrmsr\n\t"
|
||||
::"g"(memtop2)
|
||||
);
|
||||
|
||||
__asm__ volatile (
|
||||
"movl $0x206, %%ecx\n\t"
|
||||
"xorl %%edx, %%edx\n\t"
|
||||
@ -563,6 +632,7 @@ g) Rx73h = 32h
|
||||
"wrmsr\n\t"
|
||||
::"g"(memtop1)
|
||||
);
|
||||
|
||||
__asm__ volatile (
|
||||
"movl $0x208, %ecx\n\t"
|
||||
"xorl %edx, %edx\n\t"
|
||||
@ -578,10 +648,15 @@ g) Rx73h = 32h
|
||||
"orl $(0 | 0x800), %eax\n\t"
|
||||
"wrmsr\n\t"
|
||||
);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* WAKE_MEM_INFO is inited in get_set_top_available_mem()
|
||||
* in tables.c these two memcpy() not not be enabled if set
|
||||
* the MTRR around this two lines.
|
||||
*/
|
||||
// WAKE_MEM_INFO is inited in get_set_top_available_mem in tables.c
|
||||
// these two memcpy not not be enabled if set the MTRR around this two lines.
|
||||
/*__asm__ volatile (
|
||||
#if 0
|
||||
__asm__ volatile (
|
||||
"movl $0, %%esi\n\t"
|
||||
"movl %0, %%edi\n\t"
|
||||
"movl $0xa0000, %%ecx\n\t"
|
||||
@ -589,6 +664,7 @@ g) Rx73h = 32h
|
||||
"rep movsd\n\t"
|
||||
::"g"(memtop3)
|
||||
);
|
||||
|
||||
__asm__ volatile (
|
||||
"movl $0xe0000, %%esi\n\t"
|
||||
"movl %0, %%edi\n\t"
|
||||
@ -596,13 +672,18 @@ g) Rx73h = 32h
|
||||
"shrl $2, %%ecx\n\t"
|
||||
"rep movsd\n\t"
|
||||
::"g"(memtop4)
|
||||
);*/
|
||||
print_debug("copy memory to high memory to protect s3 wakeup vector code \r\n");//this can have function call, because no variable used before this
|
||||
memcpy((unsigned char *)((*(u32*)WAKE_MEM_INFO) - 64*1024-0x100000),(unsigned char *)0,0xa0000);
|
||||
memcpy((unsigned char *)((*(u32*)WAKE_MEM_INFO) - 64*1024-0x100000+0xe0000),(unsigned char *)0xe0000,0x20000);
|
||||
);
|
||||
#endif
|
||||
/* This can have function call, because no variable used before this. */
|
||||
print_debug("Copy memory to high memory to protect s3 wakeup vector code \r\n");
|
||||
memcpy((unsigned char *)((*(u32 *) WAKE_MEM_INFO) - 64 * 1024 -
|
||||
0x100000), (unsigned char *)0, 0xa0000);
|
||||
memcpy((unsigned char *)((*(u32 *) WAKE_MEM_INFO) - 64 * 1024 -
|
||||
0x100000 + 0xe0000), (unsigned char *)0xe0000, 0x20000);
|
||||
|
||||
/* restore the MTRR previously modified. */
|
||||
/* __asm__ volatile (
|
||||
/* Restore the MTRR previously modified. */
|
||||
#if 0
|
||||
__asm__ volatile (
|
||||
"wbinvd\n\t"
|
||||
"xorl %edx, %edx\n\t"
|
||||
"xorl %eax, %eax\n\t"
|
||||
@ -618,107 +699,114 @@ g) Rx73h = 32h
|
||||
"wrmsr\n\t"
|
||||
"movl $0x209, %ecx\n\t"
|
||||
"wrmsr\n\t"
|
||||
);*/
|
||||
}
|
||||
);
|
||||
#endif
|
||||
/*2008-11-27
|
||||
the following code is copied from src\mainboard\tyan\s2735\cache_as_ram_auto.c
|
||||
Only the code around CLEAR_FIRST_1M_RAM is changed.
|
||||
Removed all the code around CLEAR_FIRST_1M_RAM and #include "cpu/x86/car/cache_as_ram_post.c"
|
||||
the CLEAR_FIRST_1M_RAM seems to make cpu/x86/car/cache_as_ram_post.c stop at somewhere,
|
||||
and cpu/x86/car/cache_as_ram_post.c do not cache my $XIP_ROM_BASE+SIZE area.
|
||||
}
|
||||
|
||||
Uuse: #include "cpu/via/car/cache_as_ram_post.c". this version post.c have some diff withx86-version
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The following code is copied from tyan\s2735\cache_as_ram_auto.c.
|
||||
* Only the code around CLEAR_FIRST_1M_RAM is changed. Removed all the code
|
||||
* around CLEAR_FIRST_1M_RAM and #include "cpu/x86/car/cache_as_ram_post.c".
|
||||
* The CLEAR_FIRST_1M_RAM seems to make cpu/x86/car/cache_as_ram_post.c stop
|
||||
* at somewhere, and cpu/x86/car/cache_as_ram_post.c do not cache my
|
||||
* $XIP_ROM_BASE+SIZE area.
|
||||
*
|
||||
* Use #include "cpu/via/car/cache_as_ram_post.c". This version post.c have
|
||||
* some diff with x86-version.
|
||||
*/
|
||||
#if 1
|
||||
{
|
||||
/* Check value of esp to verify if we have enough rom for stack in Cache as RAM */
|
||||
/*
|
||||
* Check value of esp to verify if we have enough ROM for
|
||||
* stack in Cache as RAM.
|
||||
*/
|
||||
unsigned v_esp;
|
||||
__asm__ volatile (
|
||||
"movl %%esp, %0\n\t"
|
||||
: "=a" (v_esp)
|
||||
);
|
||||
__asm__ volatile ("movl %%esp, %0\n\t":"=a" (v_esp));
|
||||
#if CONFIG_USE_INIT
|
||||
printk_debug("v_esp=%08x\r\n", v_esp);
|
||||
#else
|
||||
print_debug("v_esp="); print_debug_hex32(v_esp); print_debug("\r\n");
|
||||
print_debug("v_esp=");
|
||||
print_debug_hex32(v_esp);
|
||||
print_debug("\r\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
#if 1
|
||||
|
||||
#if 1
|
||||
cpu_reset_x:
|
||||
// it seems that cpu_reset is not used before this, so I just reset it, (this is because the s3 resume, setting in mtrr and copy data may destroy
|
||||
//stack
|
||||
|
||||
/* It seems that cpu_reset is not used before this, so I just reset
|
||||
* it, (this is because the s3 resume, setting in MTRR and copy data
|
||||
* may destroy stack.
|
||||
*/
|
||||
cpu_reset = 0;
|
||||
|
||||
#if CONFIG_USE_INIT
|
||||
printk_debug("cpu_reset = %08x\r\n", cpu_reset);
|
||||
#else
|
||||
print_debug("cpu_reset = "); print_debug_hex32(cpu_reset); print_debug("\r\n");
|
||||
print_debug("cpu_reset = ");
|
||||
print_debug_hex32(cpu_reset);
|
||||
print_debug("\r\n");
|
||||
#endif
|
||||
|
||||
if(cpu_reset == 0) {
|
||||
if (cpu_reset == 0)
|
||||
print_debug("Clearing initial memory region: ");
|
||||
}
|
||||
print_debug("No cache as ram now - ");
|
||||
|
||||
/* store cpu_reset to ebx */
|
||||
__asm__ volatile (
|
||||
"movl %0, %%ebx\n\t"
|
||||
::"a" (cpu_reset)
|
||||
);
|
||||
|
||||
|
||||
/* Cancel these lines, CLEAR_FIRST_1M_RAM cause the cpu/x86/car/cache_as_ram_post.c stop at somewhere
|
||||
/* Store cpu_reset to ebx. */
|
||||
__asm__ volatile ("movl %0, %%ebx\n\t"::"a" (cpu_reset));
|
||||
|
||||
/*
|
||||
* Cancel these lines, CLEAR_FIRST_1M_RAM cause the
|
||||
* cpu/x86/car/cache_as_ram_post.c stop at somewhere.
|
||||
*/
|
||||
#if 0
|
||||
if (cpu_reset == 0) {
|
||||
#define CLEAR_FIRST_1M_RAM 1
|
||||
#include "cpu/via/car/cache_as_ram_post.c"
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
#undef CLEAR_FIRST_1M_RAM
|
||||
#include "cpu/via/car/cache_as_ram_post.c"
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
#include "cpu/via/car/cache_as_ram_post.c"
|
||||
//#include "cpu/x86/car/cache_as_ram_post.c"
|
||||
/* #include "cpu/x86/car/cache_as_ram_post.c" */
|
||||
__asm__ volatile (
|
||||
/* set new esp */ /* before _RAMBASE */
|
||||
/* Set new esp *//* before _RAMBASE */
|
||||
"subl %0, %%ebp\n\t"
|
||||
"subl %0, %%esp\n\t"
|
||||
::"a"( (DCACHE_RAM_BASE + DCACHE_RAM_SIZE)- _RAMBASE)
|
||||
"subl %0, %%esp\n\t"::
|
||||
"a" ((DCACHE_RAM_BASE + DCACHE_RAM_SIZE) - _RAMBASE)
|
||||
);
|
||||
|
||||
{
|
||||
unsigned new_cpu_reset;
|
||||
|
||||
/* get back cpu_reset from ebx */
|
||||
__asm__ volatile (
|
||||
"movl %%ebx, %0\n\t"
|
||||
:"=a" (new_cpu_reset)
|
||||
);
|
||||
/* Get back cpu_reset from ebx. */
|
||||
__asm__ volatile ("movl %%ebx, %0\n\t":"=a" (new_cpu_reset));
|
||||
|
||||
/* We can not go back any more, we lost old stack data in cache as ram*/
|
||||
if(new_cpu_reset==0) {
|
||||
/* We can't go back anymore, we lost old stack data in CAR. */
|
||||
if (new_cpu_reset == 0)
|
||||
print_debug("Use Ram as Stack now - done\r\n");
|
||||
} else
|
||||
{
|
||||
else
|
||||
print_debug("Use Ram as Stack now - \r\n");
|
||||
}
|
||||
|
||||
#if CONFIG_USE_INIT
|
||||
printk_debug("new_cpu_reset = %08x\r\n", new_cpu_reset);
|
||||
#else
|
||||
print_debug("new_cpu_reset = "); print_debug_hex32(new_cpu_reset); print_debug("\r\n");
|
||||
#endif
|
||||
jason_tsc_count_car();
|
||||
/*copy and execute coreboot_ram */
|
||||
copy_and_run(new_cpu_reset);
|
||||
/* We will not return */
|
||||
}
|
||||
print_debug("new_cpu_reset = ");
|
||||
print_debug_hex32(new_cpu_reset);
|
||||
print_debug("\r\n");
|
||||
#endif
|
||||
|
||||
jason_tsc_count_car();
|
||||
/* Copy and execute coreboot_ram. */
|
||||
copy_and_run(new_cpu_reset);
|
||||
/* We will not return. */
|
||||
}
|
||||
#endif
|
||||
|
||||
print_debug("should not be here -\r\n");
|
||||
|
||||
}
|
||||
|
@ -18,8 +18,7 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
unsigned char AmlCode_dsdt[] =
|
||||
{
|
||||
unsigned char AmlCode_dsdt[] = {
|
||||
0x44, 0x53, 0x44, 0x54, 0x0F, 0x3C, 0x00, 0x00,
|
||||
/* Removed for lincense issue. See get_dsdt script. */
|
||||
};
|
||||
|
@ -23,7 +23,8 @@
|
||||
#include <arch/acpi.h>
|
||||
#include <../../../northbridge/via/vx800/vx800.h>
|
||||
|
||||
void acpi_create_fadt(acpi_fadt_t *fadt,acpi_facs_t *facs,void *dsdt){
|
||||
void acpi_create_fadt(acpi_fadt_t * fadt, acpi_facs_t * facs, void *dsdt)
|
||||
{
|
||||
acpi_header_t *header = &(fadt->header);
|
||||
|
||||
memset((void *)fadt, 0, sizeof(acpi_fadt_t));
|
||||
@ -44,10 +45,11 @@ void acpi_create_fadt(acpi_fadt_t *fadt,acpi_facs_t *facs,void *dsdt){
|
||||
fadt->acpi_enable = 0xA1;
|
||||
fadt->acpi_disable = 0xA0;
|
||||
|
||||
/* value 42F,A1,A0, if we dont want SMI, then set them to zero.
|
||||
fadt->smi_cmd = 0x0;
|
||||
fadt->acpi_enable = 0x0;
|
||||
fadt->acpi_disable = 0x0;
|
||||
/*
|
||||
* Value 42F,A1,A0, if we don't want SMI, then set them to zero.
|
||||
* fadt->smi_cmd = 0x0;
|
||||
* fadt->acpi_enable = 0x0;
|
||||
* fadt->acpi_disable = 0x0;
|
||||
*/
|
||||
|
||||
fadt->s4bios_req = 0x0;
|
||||
@ -57,16 +59,16 @@ void acpi_create_fadt(acpi_fadt_t *fadt,acpi_facs_t *facs,void *dsdt){
|
||||
fadt->pm1b_evt_blk = 0x0;
|
||||
fadt->pm1a_cnt_blk = VX800_ACPI_IO_BASE + 0x4;
|
||||
fadt->pm1b_cnt_blk = 0x0;
|
||||
fadt->pm2_cnt_blk = 0x22;//to support cpu-c3
|
||||
// fadt->pm2_cnt_blk = 0x0;
|
||||
fadt->pm2_cnt_blk = 0x22; /* To support cpu-c3. */
|
||||
/* fadt->pm2_cnt_blk = 0x0; */
|
||||
fadt->pm_tmr_blk = VX800_ACPI_IO_BASE + 0x8;
|
||||
fadt->gpe0_blk = VX800_ACPI_IO_BASE + 0x20;
|
||||
fadt->gpe1_blk = VX800_ACPI_IO_BASE + 0x50;
|
||||
|
||||
fadt->pm1_evt_len = 4;
|
||||
fadt->pm1_cnt_len = 2;
|
||||
fadt->pm2_cnt_len = 1;//to support cpu-c3
|
||||
// fadt->pm2_cnt_len = 0;
|
||||
fadt->pm2_cnt_len = 1; /* To support cpu-c3. */
|
||||
/* fadt->pm2_cnt_len = 0; */
|
||||
|
||||
fadt->pm_tmr_len = 4;
|
||||
fadt->gpe0_blk_len = 4;
|
||||
@ -74,20 +76,20 @@ void acpi_create_fadt(acpi_fadt_t *fadt,acpi_facs_t *facs,void *dsdt){
|
||||
fadt->gpe1_base = 0x10;
|
||||
fadt->cst_cnt = 0;
|
||||
|
||||
fadt->p_lvl2_lat = 0x50; //this is the coreboot source
|
||||
fadt->p_lvl3_lat = 0x320;//
|
||||
// fadt->p_lvl2_lat = 0x80; //
|
||||
// fadt->p_lvl3_lat = 0x800;//
|
||||
// fadt->p_lvl2_lat = 0x1; //
|
||||
// fadt->p_lvl3_lat = 0x23;
|
||||
fadt->p_lvl2_lat = 0x50; /* This is the coreboot source. */
|
||||
fadt->p_lvl3_lat = 0x320;
|
||||
/* fadt->p_lvl2_lat = 0x80; */
|
||||
/* fadt->p_lvl3_lat = 0x800; */
|
||||
/* fadt->p_lvl2_lat = 0x1; */
|
||||
/* fadt->p_lvl3_lat = 0x23; */
|
||||
|
||||
// fadt->p_lvl2_lat = 0x200; //disable
|
||||
// fadt->p_lvl3_lat = 0x2000;
|
||||
/* fadt->p_lvl2_lat = 0x200; */ /* Disable. */
|
||||
/* fadt->p_lvl3_lat = 0x2000; */
|
||||
|
||||
fadt->flush_size = 0;
|
||||
fadt->flush_stride = 0;
|
||||
fadt->duty_offset = 0;
|
||||
// fadt->duty_width = 1;
|
||||
/* fadt->duty_width = 1; */
|
||||
fadt->duty_width = 4;
|
||||
fadt->day_alrm = 0x7d;
|
||||
fadt->mon_alrm = 0x7e;
|
||||
@ -136,8 +138,7 @@ void acpi_create_fadt(acpi_fadt_t *fadt,acpi_facs_t *facs,void *dsdt){
|
||||
fadt->x_pm1b_cnt_blk.addrl = 0x0;
|
||||
fadt->x_pm1b_cnt_blk.addrh = 0x0;
|
||||
|
||||
|
||||
// fadt->x_pm2_cnt_blk.space_id = 1;
|
||||
/* fadt->x_pm2_cnt_blk.space_id = 1; */
|
||||
fadt->x_pm2_cnt_blk.space_id = 0;
|
||||
fadt->x_pm2_cnt_blk.bit_width = 0;
|
||||
fadt->x_pm2_cnt_blk.bit_offset = 0;
|
||||
|
@ -19,25 +19,25 @@
|
||||
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
##
|
||||
|
||||
# Simple script to dump the factory ACPI DSDT and convert it to C
|
||||
# Needs to be run as root on some systems, and always run on the target machine
|
||||
# Simple script to dump the factory ACPI DSDT and convert it to C.
|
||||
# Must be run as root on some systems, and always run on the target machine.
|
||||
|
||||
if [ ! iasl ]
|
||||
then echo "Intel ASL Compiler required to recompile DSDT table"
|
||||
if [ ! iasl ]; then
|
||||
echo "Intel ASL Compiler required to recompile DSDT table."
|
||||
fi
|
||||
|
||||
if [ ! -f /proc/acpi/dsdt ]
|
||||
then echo "Cannot find DSDT table, check that your kernel supports and uses ACPI"
|
||||
if [ ! -f /proc/acpi/dsdt ]; then
|
||||
echo "Cannot find DSDT table, check that your kernel supports and uses ACPI."
|
||||
fi
|
||||
|
||||
cat /proc/acpi/dsdt > dsdt
|
||||
if [ ! -f dsdt ]
|
||||
then echo "Failed copying DSDT, please check your permissions"
|
||||
if [ ! -f dsdt ]; then
|
||||
echo "Failed copying DSDT, please check your permissions."
|
||||
fi
|
||||
|
||||
iasl -d -vr -vs dsdt
|
||||
iasl -tc -vr -vs dsdt.dsl
|
||||
mv dsdt.hex dsdt.c
|
||||
echo "Done, cleaning up"
|
||||
echo "Done, cleaning up."
|
||||
rm -f dsdt dsdt.dsl dsdt.aml dsdt.hex
|
||||
exit
|
||||
|
@ -18,11 +18,7 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifdef GETPIR
|
||||
#include "pirq_routing.h"
|
||||
#else
|
||||
#include <arch/pirq_routing.h>
|
||||
#endif
|
||||
|
||||
const struct irq_routing_table intel_irq_routing_table = {
|
||||
PIRQ_SIGNATURE, /* u32 signature */
|
||||
@ -33,11 +29,9 @@ const struct irq_routing_table intel_irq_routing_table = {
|
||||
0xc20, /* IRQs devoted exclusively to PCI usage */
|
||||
0x1106, /* Vendor */
|
||||
0x8409, /* Device */
|
||||
0, /* Crap (miniport) */
|
||||
0, /* Miniport */
|
||||
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* u8 rfu[11] */
|
||||
0xc6, /* u8 checksum. This has to be set to some
|
||||
//0xa0?? value that would give 0 after the sum of all
|
||||
bytes for this structure (including checksum) */
|
||||
0xc6, /* Checksum. 0xa0? */
|
||||
{
|
||||
/* bus, dev | fn, {link, bitmap}, {link, bitmap}, {link, bitmap}, {link, bitmap}, slot, rfu */
|
||||
{0x00, (0x01 << 3) | 0x0, {{0x01, 0xdeb8}, {0x00, 0xdeb8}, {0x00, 0xdeb8}, {0x00, 0x0deb8}}, 0x0, 0x0},
|
||||
|
@ -18,8 +18,7 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
unsigned char AmlCode_ssdt[] =
|
||||
{
|
||||
0x53,0x53,0x44,0x54,0xA7,0x01,0x00,0x00, /* 00000000 "SSDT...." */
|
||||
unsigned char AmlCode_ssdt[] = {
|
||||
0x53, 0x53, 0x44, 0x54, 0xA7, 0x01, 0x00, 0x00,
|
||||
/* Removed for licese issue. */
|
||||
};
|
||||
|
@ -19,31 +19,33 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
//reboot.c from linux
|
||||
/*this file mostly copied from Rudolf's S3 patch, some changes in acpi_jump_wake()*/
|
||||
/* reboot.c from Linux. */
|
||||
|
||||
/*
|
||||
* This file mostly copied from Rudolf's S3 patch, some changes in
|
||||
* acpi_jump_wake().
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <arch/io.h>
|
||||
#include <console/console.h>
|
||||
#include <delay.h>
|
||||
#include <part/init_timer.h>//for jaon_tsc_count_end
|
||||
#include <part/init_timer.h> /* for jason_tsc_count_end */
|
||||
#include "wakeup.h"
|
||||
|
||||
|
||||
|
||||
|
||||
int enable_a20(void);
|
||||
|
||||
/* The following code and data reboots the machine by switching to real
|
||||
mode and jumping to the BIOS reset entry point, as if the CPU has
|
||||
really been reset. The previous version asked the keyboard
|
||||
controller to pulse the CPU reset line, which is more thorough, but
|
||||
doesn't work with at least one type of 486 motherboard. It is easy
|
||||
to stop this code working; hence the copious comments. */
|
||||
/*
|
||||
* The following code and data reboots the machine by switching to real
|
||||
* mode and jumping to the BIOS reset entry point, as if the CPU has
|
||||
* really been reset. The previous version asked the keyboard
|
||||
* controller to pulse the CPU reset line, which is more thorough, but
|
||||
* doesn't work with at least one type of 486 motherboard. It is easy
|
||||
* to stop this code working; hence the copious comments.
|
||||
*/
|
||||
|
||||
static unsigned long long
|
||||
real_mode_gdt_entries [3] =
|
||||
{
|
||||
static unsigned long long real_mode_gdt_entries[3] = {
|
||||
0x0000000000000000ULL, /* Null descriptor */
|
||||
0x00009a000000ffffULL, /* 16-bit real-mode 64k code at 0x00000000 */
|
||||
0x000092000100ffffULL /* 16-bit real-mode 64k data at 0x00000100 */
|
||||
@ -56,41 +58,42 @@ struct Xgt_desc_struct {
|
||||
} __attribute__ ((packed));
|
||||
|
||||
static struct Xgt_desc_struct
|
||||
real_mode_gdt = { sizeof (real_mode_gdt_entries) - 1, (long)real_mode_gdt_entries },
|
||||
real_mode_idt = { 0x3ff, 0 },
|
||||
no_idt = { 0, 0 };
|
||||
|
||||
|
||||
/* This is 16-bit protected mode code to disable paging and the cache,
|
||||
switch to real mode and jump to the BIOS reset code.
|
||||
|
||||
The instruction that switches to real mode by writing to CR0 must be
|
||||
followed immediately by a far jump instruction, which set CS to a
|
||||
valid value for real mode, and flushes the prefetch queue to avoid
|
||||
running instructions that have already been decoded in protected
|
||||
mode.
|
||||
|
||||
Clears all the flags except ET, especially PG (paging), PE
|
||||
(protected-mode enable) and TS (task switch for coprocessor state
|
||||
save). Flushes the TLB after paging has been disabled. Sets CD and
|
||||
NW, to disable the cache on a 486, and invalidates the cache. This
|
||||
is more like the state of a 486 after reset. I don't know if
|
||||
something else should be done for other chips.
|
||||
|
||||
More could be done here to set up the registers as if a CPU reset had
|
||||
occurred; hopefully real BIOSs don't assume much. */
|
||||
real_mode_gdt =
|
||||
{ sizeof(real_mode_gdt_entries) - 1, (long)real_mode_gdt_entries },
|
||||
real_mode_idt = {
|
||||
0x3ff, 0}, no_idt = {
|
||||
0, 0};
|
||||
|
||||
/*
|
||||
* This is 16-bit protected mode code to disable paging and the cache,
|
||||
* switch to real mode and jump to the BIOS reset code.
|
||||
*
|
||||
* The instruction that switches to real mode by writing to CR0 must be
|
||||
* followed immediately by a far jump instruction, which set CS to a
|
||||
* valid value for real mode, and flushes the prefetch queue to avoid
|
||||
* running instructions that have already been decoded in protected
|
||||
* mode.
|
||||
*
|
||||
* Clears all the flags except ET, especially PG (paging), PE
|
||||
* (protected-mode enable) and TS (task switch for coprocessor state
|
||||
* save). Flushes the TLB after paging has been disabled. Sets CD and
|
||||
* NW, to disable the cache on a 486, and invalidates the cache. This
|
||||
* is more like the state of a 486 after reset. I don't know if
|
||||
* something else should be done for other chips.
|
||||
*
|
||||
* More could be done here to set up the registers as if a CPU reset had
|
||||
* occurred; hopefully real BIOSs don't assume much.
|
||||
*/
|
||||
|
||||
// 0x66, 0x0d, 0x00, 0x00, 0x00, 0x60, /* orl $0x60000000,%eax */
|
||||
|
||||
static unsigned char real_mode_switch [] =
|
||||
{
|
||||
static unsigned char real_mode_switch[] = {
|
||||
0x66, 0x0f, 0x20, 0xc0, /* movl %cr0,%eax */
|
||||
0x24, 0xfe, /* andb $0xfe,al */
|
||||
0x66, 0x0f, 0x22, 0xc0 /* movl %eax,%cr0 */
|
||||
};
|
||||
static unsigned char jump_to_wakeup [] =
|
||||
{
|
||||
|
||||
static unsigned char jump_to_wakeup[] = {
|
||||
0xea, 0x00, 0x00, 0x00, 0xe0 /* ljmp $0xffff, $0x0000 */
|
||||
};
|
||||
|
||||
@ -99,14 +102,14 @@ static unsigned char jump_to_wakeup [] =
|
||||
* specified by the code and length parameters.
|
||||
* We assume that length will aways be less that 100!
|
||||
*/
|
||||
static unsigned char show31 [6] =
|
||||
{
|
||||
static unsigned char show31[6] = {
|
||||
0xb0, 0x31, 0xe6, 0x80, 0xeb, 0xFA /* ljmp $0xffff,$0x0000 */
|
||||
};
|
||||
static unsigned char show32 [6] =
|
||||
{
|
||||
|
||||
static unsigned char show32[6] = {
|
||||
0xb0, 0x32, 0xe6, 0x80, 0xeb, 0xFA /* ljmp $0xffff,$0x0000 */
|
||||
};
|
||||
|
||||
void acpi_jump_wake(u32 vector)
|
||||
{
|
||||
u32 tmp;
|
||||
@ -121,17 +124,18 @@ struct Xgt_desc_struct * wake_thunk16_Xgt_desc;
|
||||
printk_debug("IN ACPI JUMP WAKE TO 3 %x\n", vector);
|
||||
|
||||
*((u16 *) (jump_to_wakeup + 3)) = (u16) (vector >> 4);
|
||||
printk_debug("%x %x %x %x %x\n", jump_to_wakeup[0], jump_to_wakeup[1], jump_to_wakeup[2], jump_to_wakeup[3],jump_to_wakeup[4]);
|
||||
printk_debug("%x %x %x %x %x\n", jump_to_wakeup[0], jump_to_wakeup[1],
|
||||
jump_to_wakeup[2], jump_to_wakeup[3], jump_to_wakeup[4]);
|
||||
|
||||
memcpy((void *)(WAKE_THUNK16_ADDR - sizeof(real_mode_switch) - 100),
|
||||
real_mode_switch, sizeof(real_mode_switch));
|
||||
memcpy ((void *) (WAKE_THUNK16_ADDR - 100), jump_to_wakeup, sizeof(jump_to_wakeup));
|
||||
memcpy((void *)(WAKE_THUNK16_ADDR - 100), jump_to_wakeup,
|
||||
sizeof(jump_to_wakeup));
|
||||
|
||||
jason_tsc_count();
|
||||
printk_emerg("file '%s', line %d\n\n", __FILE__, __LINE__);
|
||||
jason_tsc_count_end();
|
||||
|
||||
|
||||
unsigned long long *real_mode_gdt_entries_at_eseg;
|
||||
real_mode_gdt_entries_at_eseg = WAKE_THUNK16_GDT; //copy from real_mode_gdt_entries and change limition to 1M and data base to 0;
|
||||
real_mode_gdt_entries_at_eseg[0] = 0x0000000000000000ULL; /* Null descriptor */
|
||||
@ -148,11 +152,8 @@ struct Xgt_desc_struct * wake_thunk16_Xgt_desc;
|
||||
|
||||
/*added this code to get current value of EIP
|
||||
*/
|
||||
__asm__ volatile (
|
||||
"calll geip\n\t"
|
||||
"geip: \n\t"
|
||||
"popl %0\n\t"
|
||||
:"=a"(dwEip)
|
||||
__asm__ volatile ("calll geip\n\t"
|
||||
"geip: \n\t" "popl %0\n\t":"=a" (dwEip)
|
||||
);
|
||||
|
||||
unsigned char *dest;
|
||||
@ -164,8 +165,7 @@ struct Xgt_desc_struct * wake_thunk16_Xgt_desc;
|
||||
dest[i] = src[i];
|
||||
|
||||
__asm__ __volatile__("ljmp $0x0010,%0" //08 error
|
||||
:
|
||||
: "i" ((void *) (WAKE_RECOVER1M_CODE+0x20)));
|
||||
::"i"((void *)(WAKE_RECOVER1M_CODE + 0x20)));
|
||||
|
||||
/*added 0x20 "nop" to make sure the ljmp will not jump then halt */
|
||||
asm volatile ("nop");
|
||||
@ -201,24 +201,22 @@ struct Xgt_desc_struct * wake_thunk16_Xgt_desc;
|
||||
asm volatile ("nop");
|
||||
asm volatile ("nop");
|
||||
|
||||
|
||||
__asm__ volatile (
|
||||
/* set new esp, maybe ebp should not equal to esp?,
|
||||
due to the variable in acpi_jump_wake?, anyway, this may be not a big problem.
|
||||
and I didnt clear the area (ef000+-0x200) to zero.
|
||||
*/
|
||||
"movl %0, %%ebp\n\t"
|
||||
"movl %0, %%esp\n\t"
|
||||
::"a"(WAKE_THUNK16_STACK)
|
||||
"movl %0, %%esp\n\t"::"a" (WAKE_THUNK16_STACK)
|
||||
);
|
||||
|
||||
|
||||
/* added this
|
||||
only "src" and "dest" use the new stack, and the esp maybe also used in resumevector
|
||||
*/
|
||||
#if PAYLOAD_IS_SEABIOS==1
|
||||
// WAKE_MEM_INFO inited in get_set_top_available_mem in tables.c
|
||||
src = (unsigned char *)((* (u32*)WAKE_MEM_INFO)- 64*1024-0x100000);
|
||||
src =
|
||||
(unsigned char *)((*(u32 *) WAKE_MEM_INFO) - 64 * 1024 - 0x100000);
|
||||
dest = 0;
|
||||
for (i = 0; i < 0xa0000; i++) //if recovered 0-e0000, then when resume, before winxp turn on the desktop screen ,there is gray background which last 1sec.
|
||||
dest[i] = src[i];
|
||||
@ -230,7 +228,9 @@ struct Xgt_desc_struct * wake_thunk16_Xgt_desc;
|
||||
"rep movsd\n\t"
|
||||
::"a"(src)
|
||||
);*/
|
||||
src = (unsigned char *)((* (u32*)WAKE_MEM_INFO)- 64*1024-0x100000+0xc0000);
|
||||
src =
|
||||
(unsigned char *)((*(u32 *) WAKE_MEM_INFO) - 64 * 1024 - 0x100000 +
|
||||
0xc0000);
|
||||
//dest = 0xc0000;
|
||||
//for (i = 0; i < 0x20000; i++)
|
||||
// dest[i] = src[i];
|
||||
@ -243,31 +243,31 @@ struct Xgt_desc_struct * wake_thunk16_Xgt_desc;
|
||||
::"a"(src)
|
||||
); */
|
||||
|
||||
|
||||
src = (unsigned char *)((* (u32*)WAKE_MEM_INFO)- 64*1024-0x100000+0xe0000+WAKE_SPECIAL_SIZE);
|
||||
src =
|
||||
(unsigned char *)((*(u32 *) WAKE_MEM_INFO) - 64 * 1024 - 0x100000 +
|
||||
0xe0000 + WAKE_SPECIAL_SIZE);
|
||||
//dest = 0xf0000;
|
||||
//for (i = 0; i < 0x10000; i++)
|
||||
// dest[i] = src[i];
|
||||
__asm__ volatile (
|
||||
"movl %0, %%esi\n\t"
|
||||
__asm__ volatile ("movl %0, %%esi\n\t"
|
||||
"movl %1, %%edi\n\t"
|
||||
"movl %2, %%ecx\n\t"
|
||||
"shrl $2, %%ecx\n\t"
|
||||
"rep movsd\n\t"
|
||||
::"r"(src),"r"(0xe0000+WAKE_SPECIAL_SIZE), "r"(0x10000-WAKE_SPECIAL_SIZE)
|
||||
"rep movsd\n\t"::"r" (src),
|
||||
"r"(0xe0000 + WAKE_SPECIAL_SIZE),
|
||||
"r"(0x10000 - WAKE_SPECIAL_SIZE)
|
||||
);
|
||||
|
||||
src = (unsigned char *)((* (u32*)WAKE_MEM_INFO)- 64*1024-0x100000+0xf0000);
|
||||
src =
|
||||
(unsigned char *)((*(u32 *) WAKE_MEM_INFO) - 64 * 1024 - 0x100000 +
|
||||
0xf0000);
|
||||
//dest = 0xf0000;
|
||||
//for (i = 0; i < 0x10000; i++)
|
||||
// dest[i] = src[i];
|
||||
__asm__ volatile (
|
||||
"movl %0, %%esi\n\t"
|
||||
__asm__ volatile ("movl %0, %%esi\n\t"
|
||||
"movl $0xf0000, %%edi\n\t"
|
||||
"movl $0x10000, %%ecx\n\t"
|
||||
"shrl $2, %%ecx\n\t"
|
||||
"rep movsd\n\t"
|
||||
::"a"(src)
|
||||
"shrl $2, %%ecx\n\t" "rep movsd\n\t"::"a" (src)
|
||||
);
|
||||
|
||||
asm volatile ("wbinvd");
|
||||
@ -290,19 +290,18 @@ struct Xgt_desc_struct * wake_thunk16_Xgt_desc;
|
||||
"\tmovl %%eax,%%ds\n"
|
||||
"\tmovl %%eax,%%es\n"
|
||||
"\tmovl %%eax,%%fs\n"
|
||||
"\tmovl %%eax,%%gs\n"
|
||||
"\tmovl %%eax,%%ss" : : : "eax");
|
||||
"\tmovl %%eax,%%gs\n" "\tmovl %%eax,%%ss":::"eax");
|
||||
|
||||
/* Jump to the 16-bit code that we copied earlier. It disables paging
|
||||
and the cache, switches to real mode, and jumps to the BIOS reset
|
||||
entry point. */
|
||||
|
||||
__asm__ __volatile__ ("ljmp $0x0008,%0"
|
||||
:
|
||||
: "i" ((void *) (WAKE_THUNK16_ADDR - sizeof (real_mode_switch) - 100)));
|
||||
__asm__
|
||||
__volatile__("ljmp $0x0008,%0"::"i"
|
||||
((void *)(WAKE_THUNK16_ADDR -
|
||||
sizeof(real_mode_switch) - 100)));
|
||||
}
|
||||
|
||||
|
||||
/* -*- linux-c -*- ------------------------------------------------------- *
|
||||
*
|
||||
* Copyright (C) 1991, 1992 Linus Torvalds
|
||||
|
@ -30,4 +30,4 @@
|
||||
#define WAKE_RECOVER1M_CODE (WAKE_SPECIAL_AREA + 0x500)
|
||||
#define WAKE_THUNK16_STACK (WAKE_SPECIAL_AREA + 0xf00)
|
||||
|
||||
#endif /* WAKEUP_H */
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user