Whitespace and style cleanup. (trivial)
Signed-off-by: Marc Jones <marc.jones@amd.com> Acked-by: Marc Jones <marc.jones@amd.com> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3586 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
parent
8d183c5846
commit
c4128cfbec
|
@ -68,7 +68,8 @@ static inline void print_t(const char *strval)
|
||||||
#include "amdk8_f_pci.c"
|
#include "amdk8_f_pci.c"
|
||||||
|
|
||||||
|
|
||||||
// for PCI_ADDR(0, 0x18, 2, 0x98) index, and PCI_ADDR(0x, 0x18, 2, 0x9c) data
|
/* for PCI_ADDR(0, 0x18, 2, 0x98) index,
|
||||||
|
and PCI_ADDR(0x, 0x18, 2, 0x9c) data */
|
||||||
/*
|
/*
|
||||||
index:
|
index:
|
||||||
[29: 0] DctOffset (Dram Controller Offset)
|
[29: 0] DctOffset (Dram Controller Offset)
|
||||||
|
@ -83,14 +84,14 @@ static inline void print_t(const char *strval)
|
||||||
[31: 0] DctOffsetData (Dram Controller Offset Data)
|
[31: 0] DctOffsetData (Dram Controller Offset Data)
|
||||||
|
|
||||||
Read:
|
Read:
|
||||||
- Write the register num to DctOffset with DctAccessWrite = 0
|
- Write the register num to DctOffset with
|
||||||
|
DctAccessWrite = 0
|
||||||
- poll the DctAccessDone until it = 1
|
- poll the DctAccessDone until it = 1
|
||||||
- Read the data from DctOffsetData
|
- Read the data from DctOffsetData
|
||||||
Write:
|
Write:
|
||||||
- Write the data to DctOffsetData
|
- Write the data to DctOffsetData
|
||||||
- Write register num to DctOffset with DctAccessWrite = 1
|
- Write register num to DctOffset with DctAccessWrite = 1
|
||||||
- poll the DctAccessDone untio it = 1
|
- poll the DctAccessDone untio it = 1
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -119,7 +120,8 @@ static void sdram_set_registers(const struct mem_controller *ctrl, struct sys_in
|
||||||
{
|
{
|
||||||
static const unsigned int register_values[] = {
|
static const unsigned int register_values[] = {
|
||||||
|
|
||||||
/* Careful set limit registers before base registers which contain the enables */
|
/* Careful set limit registers before base registers which
|
||||||
|
contain the enables */
|
||||||
/* DRAM Limit i Registers
|
/* DRAM Limit i Registers
|
||||||
* F1:0x44 i = 0
|
* F1:0x44 i = 0
|
||||||
* F1:0x4C i = 1
|
* F1:0x4C i = 1
|
||||||
|
@ -260,7 +262,9 @@ static void sdram_set_registers(const struct mem_controller *ctrl, struct sys_in
|
||||||
* 111 = Reseved
|
* 111 = Reseved
|
||||||
* [15: 7] Reserved
|
* [15: 7] Reserved
|
||||||
* [16:16] AltVidC3MemClkTriEn (AltVID Memory Clock Tristate Enable)
|
* [16:16] AltVidC3MemClkTriEn (AltVID Memory Clock Tristate Enable)
|
||||||
* Enables the DDR memory clocks to be tristated when alternate VID mode is enabled. This bit has no effect if the DisNbClkRamp bit (F3, 0x88) is set
|
* Enables the DDR memory clocks to be tristated when alternate VID
|
||||||
|
* mode is enabled. This bit has no effect if the DisNbClkRamp bit
|
||||||
|
* (F3, 0x88) is set
|
||||||
* [17:17] DllTempAdjTime (DLL Temperature Adjust Cycle Time)
|
* [17:17] DllTempAdjTime (DLL Temperature Adjust Cycle Time)
|
||||||
* 0 = 5 ms
|
* 0 = 5 ms
|
||||||
* 1 = 1 ms
|
* 1 = 1 ms
|
||||||
|
@ -274,23 +278,36 @@ static void sdram_set_registers(const struct mem_controller *ctrl, struct sys_in
|
||||||
/* DRAM Initialization Register
|
/* DRAM Initialization Register
|
||||||
* F2:0x7C
|
* F2:0x7C
|
||||||
* [15: 0] MrsAddress (Address for MRS/EMRS Commands)
|
* [15: 0] MrsAddress (Address for MRS/EMRS Commands)
|
||||||
* this field specifies the dsata driven on the DRAM address pins 15-0 for MRS and EMRS commands
|
* this field specifies the dsata driven on the DRAM address pins
|
||||||
|
* 15-0 for MRS and EMRS commands
|
||||||
* [18:16] MrsBank (Bank Address for MRS/EMRS Commands)
|
* [18:16] MrsBank (Bank Address for MRS/EMRS Commands)
|
||||||
* this files specifies the data driven on the DRAM bank pins for the MRS and EMRS commands
|
* this files specifies the data driven on the DRAM bank pins for
|
||||||
|
* the MRS and EMRS commands
|
||||||
* [23:19] reverved
|
* [23:19] reverved
|
||||||
* [24:24] SendPchgAll (Send Precharge All Command)
|
* [24:24] SendPchgAll (Send Precharge All Command)
|
||||||
* Setting this bit causes the DRAM controller to send a precharge all command. This bit is cleared by the hardware after the command completes
|
* Setting this bit causes the DRAM controller to send a precharge
|
||||||
|
* all command. This bit is cleared by the hardware after the
|
||||||
|
* command completes
|
||||||
* [25:25] SendAutoRefresh (Send Auto Refresh Command)
|
* [25:25] SendAutoRefresh (Send Auto Refresh Command)
|
||||||
* Setting this bit causes the DRAM controller to send an auto refresh command. This bit is cleared by the hardware after the command completes
|
* Setting this bit causes the DRAM controller to send an auto
|
||||||
|
* refresh command. This bit is cleared by the hardware after the
|
||||||
|
* command completes
|
||||||
* [26:26] SendMrsCmd (Send MRS/EMRS Command)
|
* [26:26] SendMrsCmd (Send MRS/EMRS Command)
|
||||||
* Setting this bit causes the DRAM controller to send the MRS or EMRS command defined by the MrsAddress and MrsBank fields. This bit is cleared by the hardware adter the commmand completes
|
* Setting this bit causes the DRAM controller to send the MRS or
|
||||||
|
* EMRS command defined by the MrsAddress and MrsBank fields. This
|
||||||
|
* bit is cleared by the hardware adter the commmand completes
|
||||||
* [27:27] DeassertMemRstX (De-assert Memory Reset)
|
* [27:27] DeassertMemRstX (De-assert Memory Reset)
|
||||||
* Setting this bit causes the DRAM controller to de-assert the memory reset pin. This bit cannot be used to assert the memory reset pin
|
* Setting this bit causes the DRAM controller to de-assert the
|
||||||
|
* memory reset pin. This bit cannot be used to assert the memory
|
||||||
|
* reset pin
|
||||||
* [28:28] AssertCke (Assert CKE)
|
* [28:28] AssertCke (Assert CKE)
|
||||||
* setting this bit causes the DRAM controller to assert the CKE pins. This bit cannot be used to de-assert the CKE pins
|
* setting this bit causes the DRAM controller to assert the CKE
|
||||||
|
* pins. This bit cannot be used to de-assert the CKE pins
|
||||||
* [30:29] reverved
|
* [30:29] reverved
|
||||||
* [31:31] EnDramInit (Enable DRAM Initialization)
|
* [31:31] EnDramInit (Enable DRAM Initialization)
|
||||||
* Setting this bit puts the DRAM controller in a BIOS controlled DRAM initialization mode. BIOS must clear this bit aster DRAM initialization is complete.
|
* Setting this bit puts the DRAM controller in a BIOS controlled
|
||||||
|
* DRAM initialization mode. BIOS must clear this bit aster DRAM
|
||||||
|
* initialization is complete.
|
||||||
*/
|
*/
|
||||||
// PCI_ADDR(0, 0x18, 2, 0x7C), 0x60f80000, 0,
|
// PCI_ADDR(0, 0x18, 2, 0x7C), 0x60f80000, 0,
|
||||||
|
|
||||||
|
@ -353,13 +370,15 @@ static void sdram_set_registers(const struct mem_controller *ctrl, struct sys_in
|
||||||
* 0010 = 5 bus clocks
|
* 0010 = 5 bus clocks
|
||||||
* ...
|
* ...
|
||||||
* 1111 = 18 bus clocks
|
* 1111 = 18 bus clocks
|
||||||
* [19:16] Trc (Row Cycle Time, Ras#-active to Ras#-active or auto refresh of the same bank)
|
* [19:16] Trc (Row Cycle Time, Ras#-active to Ras#-active or auto
|
||||||
|
* refresh of the same bank)
|
||||||
* 0000 = 11 bus clocks
|
* 0000 = 11 bus clocks
|
||||||
* 0010 = 12 bus clocks
|
* 0010 = 12 bus clocks
|
||||||
* ...
|
* ...
|
||||||
* 1110 = 25 bus clocks
|
* 1110 = 25 bus clocks
|
||||||
* 1111 = 26 bus clocks
|
* 1111 = 26 bus clocks
|
||||||
* [21:20] Twr (Write Recovery Time, From the last data to precharge, writes can go back-to-back)
|
* [21:20] Twr (Write Recovery Time, From the last data to precharge,
|
||||||
|
* writes can go back-to-back)
|
||||||
* 00 = 3 bus clocks
|
* 00 = 3 bus clocks
|
||||||
* 01 = 4 bus clocks
|
* 01 = 4 bus clocks
|
||||||
* 10 = 5 bus clocks
|
* 10 = 5 bus clocks
|
||||||
|
@ -369,7 +388,8 @@ static void sdram_set_registers(const struct mem_controller *ctrl, struct sys_in
|
||||||
* 01 = 3 bus clocks
|
* 01 = 3 bus clocks
|
||||||
* 10 = 4 bus clocks
|
* 10 = 4 bus clocks
|
||||||
* 11 = 5 bus clocks
|
* 11 = 5 bus clocks
|
||||||
* [31:24] MemClkDis ( Disable the MEMCLK outputs for DRAM channel A, BIOS should set it to reduce the power consumption)
|
* [31:24] MemClkDis ( Disable the MEMCLK outputs for DRAM channel A,
|
||||||
|
* BIOS should set it to reduce the power consumption)
|
||||||
* Bit F(1207) M2 Package S1g1 Package
|
* Bit F(1207) M2 Package S1g1 Package
|
||||||
* 0 N/A MA1_CLK1 N/A
|
* 0 N/A MA1_CLK1 N/A
|
||||||
* 1 N/A MA0_CLK1 MA0_CLK1
|
* 1 N/A MA0_CLK1 MA0_CLK1
|
||||||
|
@ -394,12 +414,14 @@ static void sdram_set_registers(const struct mem_controller *ctrl, struct sys_in
|
||||||
* 110 = 8 bus clocks
|
* 110 = 8 bus clocks
|
||||||
* 111 = 9 bus clocks
|
* 111 = 9 bus clocks
|
||||||
* [ 7: 7] Reserved
|
* [ 7: 7] Reserved
|
||||||
* [ 9: 8] Twtr (Internal DRAM Write-to-Read Command Delay, minium write-to-read delay when both access the same chip select)
|
* [ 9: 8] Twtr (Internal DRAM Write-to-Read Command Delay,
|
||||||
|
* minium write-to-read delay when both access the same chip select)
|
||||||
* 00 = Reserved
|
* 00 = Reserved
|
||||||
* 01 = 1 bus clocks
|
* 01 = 1 bus clocks
|
||||||
* 10 = 2 bus clocks
|
* 10 = 2 bus clocks
|
||||||
* 11 = 3 bus clocks
|
* 11 = 3 bus clocks
|
||||||
* [11:10] Twrrd (Write to Read DIMM Termination Turnaround, minimum write-to-read delay when accessing two different DIMMs)
|
* [11:10] Twrrd (Write to Read DIMM Termination Turnaround, minimum
|
||||||
|
* write-to-read delay when accessing two different DIMMs)
|
||||||
* 00 = 0 bus clocks
|
* 00 = 0 bus clocks
|
||||||
* 01 = 1 bus clocks
|
* 01 = 1 bus clocks
|
||||||
* 10 = 2 bus clocks
|
* 10 = 2 bus clocks
|
||||||
|
@ -420,7 +442,8 @@ static void sdram_set_registers(const struct mem_controller *ctrl, struct sys_in
|
||||||
* 10 = Refresh interval of 7.8 microseconds
|
* 10 = Refresh interval of 7.8 microseconds
|
||||||
* 11 = Refresh interval of 3.9 microseconds
|
* 11 = Refresh interval of 3.9 microseconds
|
||||||
* [19:18] Reserved
|
* [19:18] Reserved
|
||||||
* [22:20] Trfc0 ( Auto-Refresh Row Cycle Time for the Logical DIMM0, based on DRAM density and speed)
|
* [22:20] Trfc0 ( Auto-Refresh Row Cycle Time for the Logical DIMM0,
|
||||||
|
* based on DRAM density and speed)
|
||||||
* 000 = 75 ns (all speeds, 256Mbit)
|
* 000 = 75 ns (all speeds, 256Mbit)
|
||||||
* 001 = 105 ns (all speeds, 512Mbit)
|
* 001 = 105 ns (all speeds, 512Mbit)
|
||||||
* 010 = 127.5 ns (all speeds, 1Gbit)
|
* 010 = 127.5 ns (all speeds, 1Gbit)
|
||||||
|
@ -429,17 +452,22 @@ static void sdram_set_registers(const struct mem_controller *ctrl, struct sys_in
|
||||||
* 101 = reserved
|
* 101 = reserved
|
||||||
* 110 = reserved
|
* 110 = reserved
|
||||||
* 111 = reserved
|
* 111 = reserved
|
||||||
* [25:23] Trfc1 ( Auto-Refresh Row Cycle Time for the Logical DIMM1, based on DRAM density and speed)
|
* [25:23] Trfc1 ( Auto-Refresh Row Cycle Time for the Logical DIMM1,
|
||||||
* [28:26] Trfc2 ( Auto-Refresh Row Cycle Time for the Logical DIMM2, based on DRAM density and speed)
|
* based on DRAM density and speed)
|
||||||
* [31:29] Trfc3 ( Auto-Refresh Row Cycle Time for the Logical DIMM3, based on DRAM density and speed)
|
* [28:26] Trfc2 ( Auto-Refresh Row Cycle Time for the Logical DIMM2,
|
||||||
|
* based on DRAM density and speed)
|
||||||
|
* [31:29] Trfc3 ( Auto-Refresh Row Cycle Time for the Logical DIMM3,
|
||||||
|
* based on DRAM density and speed)
|
||||||
*/
|
*/
|
||||||
PCI_ADDR(0, 0x18, 2, 0x8c), 0x000c008f, (2 << 16)|(1 << 8),
|
PCI_ADDR(0, 0x18, 2, 0x8c), 0x000c008f, (2 << 16)|(1 << 8),
|
||||||
/* DRAM Config Low Register
|
/* DRAM Config Low Register
|
||||||
* F2:0x90
|
* F2:0x90
|
||||||
* [ 0: 0] InitDram (Initialize DRAM)
|
* [ 0: 0] InitDram (Initialize DRAM)
|
||||||
* 1 = write 1 cause DRAM controller to execute the DRAM initialization, when done it read to 0
|
* 1 = write 1 cause DRAM controller to execute the DRAM
|
||||||
|
* initialization, when done it read to 0
|
||||||
* [ 1: 1] ExitSelfRef ( Exit Self Refresh Command )
|
* [ 1: 1] ExitSelfRef ( Exit Self Refresh Command )
|
||||||
* 1 = write 1 causes the DRAM controller to bring the DRAMs out fo self refresh mode
|
* 1 = write 1 causes the DRAM controller to bring the DRAMs out
|
||||||
|
* for self refresh mode
|
||||||
* [ 3: 2] Reserved
|
* [ 3: 2] Reserved
|
||||||
* [ 5: 4] DramTerm (DRAM Termination)
|
* [ 5: 4] DramTerm (DRAM Termination)
|
||||||
* 00 = On die termination disabled
|
* 00 = On die termination disabled
|
||||||
|
@ -451,9 +479,11 @@ static void sdram_set_registers(const struct mem_controller *ctrl, struct sys_in
|
||||||
* 0 = Normal drive strength mode.
|
* 0 = Normal drive strength mode.
|
||||||
* 1 = Weak drive strength mode
|
* 1 = Weak drive strength mode
|
||||||
* [ 8: 8] ParEn (Parity Enable)
|
* [ 8: 8] ParEn (Parity Enable)
|
||||||
* 1 = Enable address parity computation output, PAR, and enables the parity error input, ERR
|
* 1 = Enable address parity computation output, PAR,
|
||||||
|
* and enables the parity error input, ERR
|
||||||
* [ 9: 9] SelfRefRateEn (Faster Self Refresh Rate Enable)
|
* [ 9: 9] SelfRefRateEn (Faster Self Refresh Rate Enable)
|
||||||
* 1 = Enable high temperature ( two times normal ) self refresh rate
|
* 1 = Enable high temperature ( two times normal )
|
||||||
|
* self refresh rate
|
||||||
* [10:10] BurstLength32 ( DRAM Burst Length Set for 32 Bytes)
|
* [10:10] BurstLength32 ( DRAM Burst Length Set for 32 Bytes)
|
||||||
* 0 = 64-byte mode
|
* 0 = 64-byte mode
|
||||||
* 1 = 32-byte mode
|
* 1 = 32-byte mode
|
||||||
|
@ -471,7 +501,8 @@ static void sdram_set_registers(const struct mem_controller *ctrl, struct sys_in
|
||||||
* 1 = Unbuffered DIMMs
|
* 1 = Unbuffered DIMMs
|
||||||
* [18:17] Reserved
|
* [18:17] Reserved
|
||||||
* [19:19] DimmEccEn ( DIMM ECC Enable )
|
* [19:19] DimmEccEn ( DIMM ECC Enable )
|
||||||
1 = ECC checking is being enabled for all DIMMs on the DRAM controller ( Through F3 0x44[EccEn])
|
* 1 = ECC checking is being enabled for all DIMMs on the DRAM
|
||||||
|
* controller ( Through F3 0x44[EccEn])
|
||||||
* [31:20] Reserved
|
* [31:20] Reserved
|
||||||
*/
|
*/
|
||||||
PCI_ADDR(0, 0x18, 2, 0x90), 0xfff6004c, 0x00000010,
|
PCI_ADDR(0, 0x18, 2, 0x90), 0xfff6004c, 0x00000010,
|
||||||
|
@ -484,17 +515,21 @@ static void sdram_set_registers(const struct mem_controller *ctrl, struct sys_in
|
||||||
* 011 = reserved
|
* 011 = reserved
|
||||||
* 1xx = reserved
|
* 1xx = reserved
|
||||||
* [ 3: 3] MemClkFreqVal (Memory Clock Freqency Valid)
|
* [ 3: 3] MemClkFreqVal (Memory Clock Freqency Valid)
|
||||||
* 1 = BIOS need to set the bit when setting up MemClkFreq to the proper value
|
* 1 = BIOS need to set the bit when setting up MemClkFreq to
|
||||||
|
* the proper value
|
||||||
* [ 7: 4] MaxAsyncLat ( Maximum Asynchronous Latency)
|
* [ 7: 4] MaxAsyncLat ( Maximum Asynchronous Latency)
|
||||||
* 0000 = 0 ns
|
* 0000 = 0 ns
|
||||||
* ...
|
* ...
|
||||||
* 1111 = 15 ns
|
* 1111 = 15 ns
|
||||||
* [11: 8] Reserved
|
* [11: 8] Reserved
|
||||||
* [12:12] RDqsEn ( Read DQS Enable) This bit is only be set if x8 registered DIMMs are present in the system
|
* [12:12] RDqsEn ( Read DQS Enable) This bit is only be set if x8
|
||||||
|
* registered DIMMs are present in the system
|
||||||
* 0 = DM pins function as data mask pins
|
* 0 = DM pins function as data mask pins
|
||||||
* 1 = DM pins function as read DQS pins
|
* 1 = DM pins function as read DQS pins
|
||||||
* [13:13] Reserved
|
* [13:13] Reserved
|
||||||
* [14:14] DisDramInterface ( Disable the DRAM interface ) When this bit is set, the DRAM controller is disabled, and interface in low power state
|
* [14:14] DisDramInterface ( Disable the DRAM interface ) When this bit
|
||||||
|
* is set, the DRAM controller is disabled, and interface in low power
|
||||||
|
* state
|
||||||
* 0 = Enabled (default)
|
* 0 = Enabled (default)
|
||||||
* 1 = Disabled
|
* 1 = Disabled
|
||||||
* [15:15] PowerDownEn ( Power Down Mode Enable )
|
* [15:15] PowerDownEn ( Power Down Mode Enable )
|
||||||
|
@ -504,13 +539,19 @@ static void sdram_set_registers(const struct mem_controller *ctrl, struct sys_in
|
||||||
* 0 = Channel CKE Control
|
* 0 = Channel CKE Control
|
||||||
* 1 = Chip Select CKE Control
|
* 1 = Chip Select CKE Control
|
||||||
* [17:17] FourRankSODimm (Four Rank SO-DIMM)
|
* [17:17] FourRankSODimm (Four Rank SO-DIMM)
|
||||||
* 1 = this bit is set by BIOS to indicate that a four rank SO-DIMM is present
|
* 1 = this bit is set by BIOS to indicate that a four rank
|
||||||
|
* SO-DIMM is present
|
||||||
* [18:18] FourRankRDimm (Four Rank Registered DIMM)
|
* [18:18] FourRankRDimm (Four Rank Registered DIMM)
|
||||||
* 1 = this bit is set by BIOS to indicate that a four rank registered DIMM is present
|
* 1 = this bit is set by BIOS to indicate that a four rank
|
||||||
|
* registered DIMM is present
|
||||||
* [19:19] Reserved
|
* [19:19] Reserved
|
||||||
* [20:20] SlowAccessMode (Slow Access Mode (2T Mode))
|
* [20:20] SlowAccessMode (Slow Access Mode (2T Mode))
|
||||||
* 0 = DRAM address and control signals are driven for one MEMCLK cycle
|
* 0 = DRAM address and control signals are driven for one
|
||||||
* 1 = One additional MEMCLK of setup time is provided on all DRAM address and control signals except CS, CKE, and ODT; i.e., these signals are drivern for two MEMCLK cycles rather than one
|
* MEMCLK cycle
|
||||||
|
* 1 = One additional MEMCLK of setup time is provided on all
|
||||||
|
* DRAM address and control signals except CS, CKE, and ODT;
|
||||||
|
* i.e., these signals are drivern for two MEMCLK cycles
|
||||||
|
* rather than one
|
||||||
* [21:21] Reserved
|
* [21:21] Reserved
|
||||||
* [22:22] BankSwizzleMode ( Bank Swizzle Mode),
|
* [22:22] BankSwizzleMode ( Bank Swizzle Mode),
|
||||||
* 0 = Disabled (default)
|
* 0 = Disabled (default)
|
||||||
|
@ -520,8 +561,10 @@ static void sdram_set_registers(const struct mem_controller *ctrl, struct sys_in
|
||||||
* 0000 = No bypass; the oldest request is never bypassed
|
* 0000 = No bypass; the oldest request is never bypassed
|
||||||
* 0001 = The oldest request may be bypassed no more than 1 time
|
* 0001 = The oldest request may be bypassed no more than 1 time
|
||||||
* ...
|
* ...
|
||||||
* 1111 = The oldest request may be bypassed no more than 15 times
|
* 1111 = The oldest request may be bypassed no more than 15\
|
||||||
* [31:28] FourActWindow ( Four Bank Activate Window) , not more than 4 banks in a 8 bank device are activated
|
* times
|
||||||
|
* [31:28] FourActWindow ( Four Bank Activate Window) , not more than
|
||||||
|
* 4 banks in a 8 bank device are activated
|
||||||
* 0000 = No tFAW window restriction
|
* 0000 = No tFAW window restriction
|
||||||
* 0001 = 8 MEMCLK cycles
|
* 0001 = 8 MEMCLK cycles
|
||||||
* 0010 = 9 MEMCLK cycles
|
* 0010 = 9 MEMCLK cycles
|
||||||
|
@ -532,19 +575,27 @@ static void sdram_set_registers(const struct mem_controller *ctrl, struct sys_in
|
||||||
PCI_ADDR(0, 0x18, 2, 0x94), 0x00a82f00,0x00008000,
|
PCI_ADDR(0, 0x18, 2, 0x94), 0x00a82f00,0x00008000,
|
||||||
/* DRAM Delay Line Register
|
/* DRAM Delay Line Register
|
||||||
* F2:0xa0
|
* F2:0xa0
|
||||||
* [ 0: 0] MemClrStatus (Memory Clear Status) : ---------Readonly
|
* [ 0: 0] MemClrStatus (Memory Clear Status) : Readonly
|
||||||
* when set, this bit indicates that the memory clear function is complete. Only clear by reset. BIOS should not write or read the DRAM until this bit is set by hardware
|
* when set, this bit indicates that the memory clear function
|
||||||
|
* is complete. Only clear by reset. BIOS should not write or
|
||||||
|
* read the DRAM until this bit is set by hardware
|
||||||
* [ 1: 1] DisableJitter ( Disable Jitter)
|
* [ 1: 1] DisableJitter ( Disable Jitter)
|
||||||
* When set the DDR compensation circuit will not change the values unless the change is more than one step from the current value
|
* When set the DDR compensation circuit will not change the
|
||||||
|
* values unless the change is more than one step from the
|
||||||
|
* current value
|
||||||
* [ 3: 2] RdWrQByp ( Read/Write Queue Bypass Count)
|
* [ 3: 2] RdWrQByp ( Read/Write Queue Bypass Count)
|
||||||
* 00 = 2
|
* 00 = 2
|
||||||
* 01 = 4
|
* 01 = 4
|
||||||
* 10 = 8
|
* 10 = 8
|
||||||
* 11 = 16
|
* 11 = 16
|
||||||
* [ 4: 4] Mode64BitMux (Mismatched DIMM Support Enable)
|
* [ 4: 4] Mode64BitMux (Mismatched DIMM Support Enable)
|
||||||
* 1 When bit enables support for mismatched DIMMs when using 128-bit DRAM interface, the Width128 no effect, only for M2 and s1g1
|
* 1 When bit enables support for mismatched DIMMs when using
|
||||||
|
* 128-bit DRAM interface, the Width128 no effect, only for
|
||||||
|
* AM2 and s1g1
|
||||||
* [ 5: 5] DCC_EN ( Dynamica Idle Cycle Counter Enable)
|
* [ 5: 5] DCC_EN ( Dynamica Idle Cycle Counter Enable)
|
||||||
* When set to 1, indicates that each entry in the page tables dynamically adjusts the idle cycle limit based on page Conflict/Page Miss (PC/PM) traffic
|
* When set to 1, indicates that each entry in the page tables
|
||||||
|
* dynamically adjusts the idle cycle limit based on page
|
||||||
|
* Conflict/Page Miss (PC/PM) traffic
|
||||||
* [ 8: 6] ILD_lmt ( Idle Cycle Limit)
|
* [ 8: 6] ILD_lmt ( Idle Cycle Limit)
|
||||||
* 000 = 0 cycles
|
* 000 = 0 cycles
|
||||||
* 001 = 4 cycles
|
* 001 = 4 cycles
|
||||||
|
@ -555,11 +606,16 @@ static void sdram_set_registers(const struct mem_controller *ctrl, struct sys_in
|
||||||
* 110 = 128 cycles
|
* 110 = 128 cycles
|
||||||
* 111 = 256 cycles
|
* 111 = 256 cycles
|
||||||
* [ 9: 9] DramEnabled ( DRAM Enabled)
|
* [ 9: 9] DramEnabled ( DRAM Enabled)
|
||||||
* When Set, this bit indicates that the DRAM is enabled, this bit is set by hardware after DRAM initialization or on an exit from self refresh. The DRAM controller is intialized after the
|
* When Set, this bit indicates that the DRAM is enabled, this
|
||||||
* hardware-controlled initialization process ( initiated by the F2 0x90[DramInit]) completes or when the BIOS-controlled initialization process completes (F2 0x7c(EnDramInit] is
|
* bit is set by hardware after DRAM initialization or on an exit
|
||||||
|
* from self refresh. The DRAM controller is intialized after the
|
||||||
|
* hardware-controlled initialization process ( initiated by the
|
||||||
|
* F2 0x90[DramInit]) completes or when the BIOS-controlled
|
||||||
|
* initialization process completes (F2 0x7c(EnDramInit] is
|
||||||
* written from 1 to 0)
|
* written from 1 to 0)
|
||||||
* [23:10] Reserved
|
* [23:10] Reserved
|
||||||
* [31:24] MemClkDis ( Disable the MEMCLK outputs for DRAM channel B, BIOS should set it to reduce the power consumption)
|
* [31:24] MemClkDis ( Disable the MEMCLK outputs for DRAM channel B,
|
||||||
|
* BIOS should set it to reduce the power consumption)
|
||||||
* Bit F(1207) M2 Package S1g1 Package
|
* Bit F(1207) M2 Package S1g1 Package
|
||||||
* 0 N/A MA1_CLK1 N/A
|
* 0 N/A MA1_CLK1 N/A
|
||||||
* 1 N/A MA0_CLK1 MA0_CLK1
|
* 1 N/A MA0_CLK1 MA0_CLK1
|
||||||
|
@ -622,7 +678,8 @@ static void sdram_set_registers(const struct mem_controller *ctrl, struct sys_in
|
||||||
*/
|
*/
|
||||||
PCI_ADDR(0, 0x18, 3, 0x60), 0xffffff00, 0x00000000,
|
PCI_ADDR(0, 0x18, 3, 0x60), 0xffffff00, 0x00000000,
|
||||||
};
|
};
|
||||||
// for PCI_ADDR(0, 0x18, 2, 0x98) index, and PCI_ADDR(0x, 0x18, 2, 0x9c) data
|
/* for PCI_ADDR(0, 0x18, 2, 0x98) index,
|
||||||
|
and PCI_ADDR(0x, 0x18, 2, 0x9c) data */
|
||||||
/*
|
/*
|
||||||
index:
|
index:
|
||||||
[29: 0] DctOffset (Dram Controller Offset)
|
[29: 0] DctOffset (Dram Controller Offset)
|
||||||
|
@ -674,6 +731,7 @@ static void sdram_set_registers(const struct mem_controller *ctrl, struct sys_in
|
||||||
print_spew("done.\r\n");
|
print_spew("done.\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int is_dual_channel(const struct mem_controller *ctrl)
|
static int is_dual_channel(const struct mem_controller *ctrl)
|
||||||
{
|
{
|
||||||
uint32_t dcl;
|
uint32_t dcl;
|
||||||
|
@ -681,6 +739,7 @@ static int is_dual_channel(const struct mem_controller *ctrl)
|
||||||
return dcl & DCL_Width128;
|
return dcl & DCL_Width128;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int is_opteron(const struct mem_controller *ctrl)
|
static int is_opteron(const struct mem_controller *ctrl)
|
||||||
{
|
{
|
||||||
/* Test to see if I am an Opteron.
|
/* Test to see if I am an Opteron.
|
||||||
|
@ -694,6 +753,7 @@ static int is_opteron(const struct mem_controller *ctrl)
|
||||||
return !!(nbcap & NBCAP_128Bit);
|
return !!(nbcap & NBCAP_128Bit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int is_registered(const struct mem_controller *ctrl)
|
static int is_registered(const struct mem_controller *ctrl)
|
||||||
{
|
{
|
||||||
/* Test to see if we are dealing with registered SDRAM.
|
/* Test to see if we are dealing with registered SDRAM.
|
||||||
|
@ -705,6 +765,7 @@ static int is_registered(const struct mem_controller *ctrl)
|
||||||
return !(dcl & DCL_UnBuffDimm);
|
return !(dcl & DCL_UnBuffDimm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void spd_get_dimm_size(unsigned device, struct dimm_size *sz)
|
static void spd_get_dimm_size(unsigned device, struct dimm_size *sz)
|
||||||
{
|
{
|
||||||
/* Calculate the log base 2 size of a DIMM in bits */
|
/* Calculate the log base 2 size of a DIMM in bits */
|
||||||
|
@ -716,13 +777,13 @@ static void spd_get_dimm_size(unsigned device, struct dimm_size *sz)
|
||||||
|
|
||||||
value = spd_read_byte(device, SPD_ROW_NUM); /* rows */
|
value = spd_read_byte(device, SPD_ROW_NUM); /* rows */
|
||||||
if (value < 0) goto hw_err;
|
if (value < 0) goto hw_err;
|
||||||
if ((value & 0xff) == 0) goto val_err; // max is 16 ?
|
if ((value & 0xff) == 0) goto val_err; /* max is 16 ? */
|
||||||
sz->per_rank += value & 0xff;
|
sz->per_rank += value & 0xff;
|
||||||
sz->rows = value & 0xff;
|
sz->rows = value & 0xff;
|
||||||
|
|
||||||
value = spd_read_byte(device, SPD_COL_NUM); /* columns */
|
value = spd_read_byte(device, SPD_COL_NUM); /* columns */
|
||||||
if (value < 0) goto hw_err;
|
if (value < 0) goto hw_err;
|
||||||
if ((value & 0xff) == 0) goto val_err; //max is 11
|
if ((value & 0xff) == 0) goto val_err; /* max is 11 */
|
||||||
sz->per_rank += value & 0xff;
|
sz->per_rank += value & 0xff;
|
||||||
sz->col = value & 0xff;
|
sz->col = value & 0xff;
|
||||||
|
|
||||||
|
@ -740,9 +801,10 @@ static void spd_get_dimm_size(unsigned device, struct dimm_size *sz)
|
||||||
sz->per_rank += log2(value) - 3; //64 bit So another 3 lines
|
sz->per_rank += log2(value) - 3; //64 bit So another 3 lines
|
||||||
|
|
||||||
/* How many ranks? */
|
/* How many ranks? */
|
||||||
value = spd_read_byte(device, SPD_MOD_ATTRIB_RANK); /* number of physical banks */
|
/* number of physical banks */
|
||||||
|
value = spd_read_byte(device, SPD_MOD_ATTRIB_RANK);
|
||||||
if (value < 0) goto hw_err;
|
if (value < 0) goto hw_err;
|
||||||
// value >>= SPD_MOD_ATTRIB_RANK_NUM_SHIFT;
|
/* value >>= SPD_MOD_ATTRIB_RANK_NUM_SHIFT; */
|
||||||
value &= SPD_MOD_ATTRIB_RANK_NUM_MASK;
|
value &= SPD_MOD_ATTRIB_RANK_NUM_MASK;
|
||||||
value += SPD_MOD_ATTRIB_RANK_NUM_BASE; // 0-->1, 1-->2, 3-->4
|
value += SPD_MOD_ATTRIB_RANK_NUM_BASE; // 0-->1, 1-->2, 3-->4
|
||||||
/*
|
/*
|
||||||
|
@ -785,11 +847,12 @@ hw_err:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_dimm_size(const struct mem_controller *ctrl, struct dimm_size *sz, unsigned index, int is_Width128)
|
|
||||||
|
static void set_dimm_size(const struct mem_controller *ctrl,
|
||||||
|
struct dimm_size *sz, unsigned index, int is_Width128)
|
||||||
{
|
{
|
||||||
uint32_t base0, base1;
|
uint32_t base0, base1;
|
||||||
|
|
||||||
|
|
||||||
/* For each base register.
|
/* For each base register.
|
||||||
* Place the dimm size in 32 MB quantities in the bits 31 - 21.
|
* Place the dimm size in 32 MB quantities in the bits 31 - 21.
|
||||||
* The initialize dimm size is in bits.
|
* The initialize dimm size is in bits.
|
||||||
|
@ -878,7 +941,9 @@ static void set_dimm_size(const struct mem_controller *ctrl, struct dimm_size *s
|
||||||
11: 16 11 3 :8G
|
11: 16 11 3 :8G
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void set_dimm_cs_map(const struct mem_controller *ctrl, struct dimm_size *sz, unsigned index)
|
|
||||||
|
static void set_dimm_cs_map(const struct mem_controller *ctrl,
|
||||||
|
struct dimm_size *sz, unsigned index)
|
||||||
{
|
{
|
||||||
static const uint8_t cs_map_aaa[24] = {
|
static const uint8_t cs_map_aaa[24] = {
|
||||||
/* (bank=2, row=13, col=9)(3, 16, 11) ---> (0, 0, 0) (1, 3, 2) */
|
/* (bank=2, row=13, col=9)(3, 16, 11) ---> (0, 0, 0) (1, 3, 2) */
|
||||||
|
@ -920,7 +985,9 @@ static void set_dimm_cs_map(const struct mem_controller *ctrl, struct dimm_size
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static long spd_set_ram_size(const struct mem_controller *ctrl, long dimm_mask, struct mem_info *meminfo)
|
|
||||||
|
static long spd_set_ram_size(const struct mem_controller *ctrl, long dimm_mask,
|
||||||
|
struct mem_info *meminfo)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -939,6 +1006,7 @@ static long spd_set_ram_size(const struct mem_controller *ctrl, long dimm_mask,
|
||||||
return dimm_mask;
|
return dimm_mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void route_dram_accesses(const struct mem_controller *ctrl,
|
static void route_dram_accesses(const struct mem_controller *ctrl,
|
||||||
unsigned long base_k, unsigned long limit_k)
|
unsigned long base_k, unsigned long limit_k)
|
||||||
{
|
{
|
||||||
|
@ -962,12 +1030,14 @@ static void route_dram_accesses(const struct mem_controller *ctrl,
|
||||||
|
|
||||||
limit_reg = 0x44 + index;
|
limit_reg = 0x44 + index;
|
||||||
base_reg = 0x40 + index;
|
base_reg = 0x40 + index;
|
||||||
for(device = PCI_DEV(0, 0x18, 1); device <= PCI_DEV(0, 0x1f, 1); device += PCI_DEV(0, 1, 0)) {
|
for (device = PCI_DEV(0, 0x18, 1); device <= PCI_DEV(0, 0x1f, 1);
|
||||||
|
device += PCI_DEV(0, 1, 0)) {
|
||||||
pci_write_config32(device, limit_reg, limit);
|
pci_write_config32(device, limit_reg, limit);
|
||||||
pci_write_config32(device, base_reg, base);
|
pci_write_config32(device, base_reg, base);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void set_top_mem(unsigned tom_k, unsigned hole_startk)
|
static void set_top_mem(unsigned tom_k, unsigned hole_startk)
|
||||||
{
|
{
|
||||||
/* Error if I don't have memory */
|
/* Error if I don't have memory */
|
||||||
|
@ -1074,7 +1144,8 @@ static unsigned long interleave_chip_selects(const struct mem_controller *ctrl,
|
||||||
* more than one and their is a power of two of them.
|
* more than one and their is a power of two of them.
|
||||||
*/
|
*/
|
||||||
bits = log2(chip_selects);
|
bits = log2(chip_selects);
|
||||||
if (((1 << bits) != chip_selects) || (bits < 1) || (bits > 3)) { //chip_selects max = 8
|
if (((1 << bits) != chip_selects) || (bits < 1) || (bits > 3)) {
|
||||||
|
//chip_selects max = 8
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1147,6 +1218,7 @@ static unsigned long order_chip_selects(const struct mem_controller *ctrl)
|
||||||
csbase = value;
|
csbase = value;
|
||||||
canidate = index;
|
canidate = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See if I have found a new canidate */
|
/* See if I have found a new canidate */
|
||||||
if (csbase == 0) {
|
if (csbase == 0) {
|
||||||
break;
|
break;
|
||||||
|
@ -1200,19 +1272,24 @@ unsigned long memory_end_k(const struct mem_controller *ctrl, int max_node_id)
|
||||||
return end_k;
|
return end_k;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void order_dimms(const struct mem_controller *ctrl, struct mem_info *meminfo)
|
|
||||||
|
static void order_dimms(const struct mem_controller *ctrl,
|
||||||
|
struct mem_info *meminfo)
|
||||||
{
|
{
|
||||||
unsigned long tom_k, base_k;
|
unsigned long tom_k, base_k;
|
||||||
|
|
||||||
if (read_option(CMOS_VSTART_interleave_chip_selects, CMOS_VLEN_interleave_chip_selects, 1) != 0) {
|
if (read_option(CMOS_VSTART_interleave_chip_selects,
|
||||||
|
CMOS_VLEN_interleave_chip_selects, 1) != 0) {
|
||||||
tom_k = interleave_chip_selects(ctrl, meminfo->is_Width128);
|
tom_k = interleave_chip_selects(ctrl, meminfo->is_Width128);
|
||||||
} else {
|
} else {
|
||||||
print_debug("Interleaving disabled\r\n");
|
print_debug("Interleaving disabled\r\n");
|
||||||
tom_k = 0;
|
tom_k = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tom_k) {
|
if (!tom_k) {
|
||||||
tom_k = order_chip_selects(ctrl);
|
tom_k = order_chip_selects(ctrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compute the memory base address */
|
/* Compute the memory base address */
|
||||||
base_k = memory_end_k(ctrl, ctrl->node_id);
|
base_k = memory_end_k(ctrl, ctrl->node_id);
|
||||||
tom_k += base_k;
|
tom_k += base_k;
|
||||||
|
@ -1220,7 +1297,9 @@ static void order_dimms(const struct mem_controller *ctrl, struct mem_info *memi
|
||||||
set_top_mem(tom_k, 0);
|
set_top_mem(tom_k, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static long disable_dimm(const struct mem_controller *ctrl, unsigned index, long dimm_mask, struct mem_info *meminfo)
|
|
||||||
|
static long disable_dimm(const struct mem_controller *ctrl, unsigned index,
|
||||||
|
long dimm_mask, struct mem_info *meminfo)
|
||||||
{
|
{
|
||||||
print_debug("disabling dimm");
|
print_debug("disabling dimm");
|
||||||
print_debug_hex8(index);
|
print_debug_hex8(index);
|
||||||
|
@ -1238,7 +1317,9 @@ static long disable_dimm(const struct mem_controller *ctrl, unsigned index, long
|
||||||
return dimm_mask;
|
return dimm_mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
static long spd_handle_unbuffered_dimms(const struct mem_controller *ctrl, long dimm_mask, struct mem_info *meminfo)
|
|
||||||
|
static long spd_handle_unbuffered_dimms(const struct mem_controller *ctrl,
|
||||||
|
long dimm_mask, struct mem_info *meminfo)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
uint32_t registered;
|
uint32_t registered;
|
||||||
|
@ -1249,14 +1330,18 @@ static long spd_handle_unbuffered_dimms(const struct mem_controller *ctrl, long
|
||||||
if (!(dimm_mask & (1 << i))) {
|
if (!(dimm_mask & (1 << i))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
value = spd_read_byte(ctrl->channel0[i], SPD_DIMM_TYPE);
|
value = spd_read_byte(ctrl->channel0[i], SPD_DIMM_TYPE);
|
||||||
if (value < 0) {
|
if (value < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Registered dimm ? */
|
/* Registered dimm ? */
|
||||||
value &= 0x3f;
|
value &= 0x3f;
|
||||||
if ((value == SPD_DIMM_TYPE_RDIMM) || (value == SPD_DIMM_TYPE_mRDIMM)) {
|
if ((value == SPD_DIMM_TYPE_RDIMM) ||
|
||||||
//check SPD_MOD_ATTRIB to verify it is SPD_MOD_ATTRIB_REGADC (0x11)?
|
(value == SPD_DIMM_TYPE_mRDIMM)) {
|
||||||
|
/* check SPD_MOD_ATTRIB to verify it is
|
||||||
|
SPD_MOD_ATTRIB_REGADC (0x11)? */
|
||||||
registered |= (1<<i);
|
registered |= (1<<i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1294,6 +1379,7 @@ static long spd_handle_unbuffered_dimms(const struct mem_controller *ctrl, long
|
||||||
return dimm_mask;
|
return dimm_mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static unsigned int spd_detect_dimms(const struct mem_controller *ctrl)
|
static unsigned int spd_detect_dimms(const struct mem_controller *ctrl)
|
||||||
{
|
{
|
||||||
unsigned dimm_mask;
|
unsigned dimm_mask;
|
||||||
|
@ -1320,6 +1406,7 @@ static unsigned int spd_detect_dimms(const struct mem_controller *ctrl)
|
||||||
return dimm_mask;
|
return dimm_mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static long spd_enable_2channels(const struct mem_controller *ctrl, long dimm_mask, struct mem_info *meminfo)
|
static long spd_enable_2channels(const struct mem_controller *ctrl, long dimm_mask, struct mem_info *meminfo)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -1356,7 +1443,8 @@ static long spd_enable_2channels(const struct mem_controller *ctrl, long dimm_ma
|
||||||
((dimm_mask >> DIMM_SOCKETS) & ((1 << DIMM_SOCKETS) - 1))) {
|
((dimm_mask >> DIMM_SOCKETS) & ((1 << DIMM_SOCKETS) - 1))) {
|
||||||
goto single_channel;
|
goto single_channel;
|
||||||
}
|
}
|
||||||
/* If the cpu is not capable of doing dual channels don't do dual channels */
|
/* If the cpu is not capable of doing dual channels
|
||||||
|
don't do dual channels */
|
||||||
nbcap = pci_read_config32(ctrl->f3, NORTHBRIDGE_CAP);
|
nbcap = pci_read_config32(ctrl->f3, NORTHBRIDGE_CAP);
|
||||||
if (!(nbcap & NBCAP_128Bit)) {
|
if (!(nbcap & NBCAP_128Bit)) {
|
||||||
goto single_channel;
|
goto single_channel;
|
||||||
|
@ -1523,11 +1611,13 @@ static uint8_t get_exact_divisor(int i, uint8_t divisor)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct spd_set_memclk_result {
|
struct spd_set_memclk_result {
|
||||||
const struct mem_param *param;
|
const struct mem_param *param;
|
||||||
long dimm_mask;
|
long dimm_mask;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static unsigned convert_to_linear(unsigned value)
|
static unsigned convert_to_linear(unsigned value)
|
||||||
{
|
{
|
||||||
static const unsigned fraction[] = { 0x25, 0x33, 0x66, 0x75 };
|
static const unsigned fraction[] = { 0x25, 0x33, 0x66, 0x75 };
|
||||||
|
@ -1614,6 +1704,7 @@ static struct spd_set_memclk_result spd_set_memclk(const struct mem_controller *
|
||||||
if (value < 0) {
|
if (value < 0) {
|
||||||
goto hw_error;
|
goto hw_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
print_tx("\tindex:", index);
|
print_tx("\tindex:", index);
|
||||||
print_tx("\t\tlatency:", latency);
|
print_tx("\t\tlatency:", latency);
|
||||||
print_tx("\t\tvalue1:", value);
|
print_tx("\t\tvalue1:", value);
|
||||||
|
@ -1637,13 +1728,16 @@ static struct spd_set_memclk_result spd_set_memclk(const struct mem_controller *
|
||||||
print_tx("\t\tnew_latency:", new_latency);
|
print_tx("\t\tnew_latency:", new_latency);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new_latency > 6){
|
if (new_latency > 6){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Does min_latency need to be increased? */
|
/* Does min_latency need to be increased? */
|
||||||
if (new_cycle_time > min_cycle_time) {
|
if (new_cycle_time > min_cycle_time) {
|
||||||
min_cycle_time = new_cycle_time;
|
min_cycle_time = new_cycle_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Does min_cycle_time need to be increased? */
|
/* Does min_cycle_time need to be increased? */
|
||||||
if (new_latency > min_latency) {
|
if (new_latency > min_latency) {
|
||||||
min_latency = new_latency;
|
min_latency = new_latency;
|
||||||
|
@ -1667,6 +1761,7 @@ static struct spd_set_memclk_result spd_set_memclk(const struct mem_controller *
|
||||||
if (!(dimm_mask & (1 << i))) {
|
if (!(dimm_mask & (1 << i))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
latencies = spd_read_byte(ctrl->channel0[i], SPD_CAS_LAT);
|
latencies = spd_read_byte(ctrl->channel0[i], SPD_CAS_LAT);
|
||||||
if (latencies < 0) goto hw_error;
|
if (latencies < 0) goto hw_error;
|
||||||
if (latencies == 0) {
|
if (latencies == 0) {
|
||||||
|
@ -1820,9 +1915,11 @@ static int update_dimm_TT_1_4(const struct mem_controller *ctrl, const struct me
|
||||||
if (clocks < TT_MIN) {
|
if (clocks < TT_MIN) {
|
||||||
clocks = TT_MIN;
|
clocks = TT_MIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clocks > TT_MAX) {
|
if (clocks > TT_MAX) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
dtl = pci_read_config32(ctrl->f2, TT_REG);
|
dtl = pci_read_config32(ctrl->f2, TT_REG);
|
||||||
|
|
||||||
old_clocks = ((dtl >> TT_SHIFT) & TT_MASK) + TT_BASE;
|
old_clocks = ((dtl >> TT_SHIFT) & TT_MASK) + TT_BASE;
|
||||||
|
@ -1836,16 +1933,20 @@ static int update_dimm_TT_1_4(const struct mem_controller *ctrl, const struct me
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int update_dimm_Trcd(const struct mem_controller *ctrl, const struct mem_param *param, int i)
|
|
||||||
|
static int update_dimm_Trcd(const struct mem_controller *ctrl,
|
||||||
|
const struct mem_param *param, int i)
|
||||||
{
|
{
|
||||||
return update_dimm_TT_1_4(ctrl, param, i, DRAM_TIMING_LOW, SPD_TRCD, DTL_TRCD_SHIFT, DTL_TRCD_MASK, DTL_TRCD_BASE, DTL_TRCD_MIN, DTL_TRCD_MAX);
|
return update_dimm_TT_1_4(ctrl, param, i, DRAM_TIMING_LOW, SPD_TRCD, DTL_TRCD_SHIFT, DTL_TRCD_MASK, DTL_TRCD_BASE, DTL_TRCD_MIN, DTL_TRCD_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int update_dimm_Trrd(const struct mem_controller *ctrl, const struct mem_param *param, int i)
|
static int update_dimm_Trrd(const struct mem_controller *ctrl, const struct mem_param *param, int i)
|
||||||
{
|
{
|
||||||
return update_dimm_TT_1_4(ctrl, param, i, DRAM_TIMING_LOW, SPD_TRRD, DTL_TRRD_SHIFT, DTL_TRRD_MASK, DTL_TRRD_BASE, DTL_TRRD_MIN, DTL_TRRD_MAX);
|
return update_dimm_TT_1_4(ctrl, param, i, DRAM_TIMING_LOW, SPD_TRRD, DTL_TRRD_SHIFT, DTL_TRRD_MASK, DTL_TRRD_BASE, DTL_TRRD_MIN, DTL_TRRD_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int update_dimm_Tras(const struct mem_controller *ctrl, const struct mem_param *param, int i)
|
static int update_dimm_Tras(const struct mem_controller *ctrl, const struct mem_param *param, int i)
|
||||||
{
|
{
|
||||||
unsigned clocks, old_clocks;
|
unsigned clocks, old_clocks;
|
||||||
|
@ -1866,28 +1967,34 @@ static int update_dimm_Tras(const struct mem_controller *ctrl, const struct mem_
|
||||||
if (clocks < DTL_TRAS_MIN) {
|
if (clocks < DTL_TRAS_MIN) {
|
||||||
clocks = DTL_TRAS_MIN;
|
clocks = DTL_TRAS_MIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clocks > DTL_TRAS_MAX) {
|
if (clocks > DTL_TRAS_MAX) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
dtl = pci_read_config32(ctrl->f2, DRAM_TIMING_LOW);
|
dtl = pci_read_config32(ctrl->f2, DRAM_TIMING_LOW);
|
||||||
old_clocks = ((dtl >> DTL_TRAS_SHIFT) & DTL_TRAS_MASK) + DTL_TRAS_BASE;
|
old_clocks = ((dtl >> DTL_TRAS_SHIFT) & DTL_TRAS_MASK) + DTL_TRAS_BASE;
|
||||||
if (old_clocks >= clocks) { // someone did it?
|
if (old_clocks >= clocks) { // someone did it?
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
dtl &= ~(DTL_TRAS_MASK << DTL_TRAS_SHIFT);
|
dtl &= ~(DTL_TRAS_MASK << DTL_TRAS_SHIFT);
|
||||||
dtl |= ((clocks - DTL_TRAS_BASE) << DTL_TRAS_SHIFT);
|
dtl |= ((clocks - DTL_TRAS_BASE) << DTL_TRAS_SHIFT);
|
||||||
pci_write_config32(ctrl->f2, DRAM_TIMING_LOW, dtl);
|
pci_write_config32(ctrl->f2, DRAM_TIMING_LOW, dtl);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int update_dimm_Trp(const struct mem_controller *ctrl, const struct mem_param *param, int i)
|
static int update_dimm_Trp(const struct mem_controller *ctrl,
|
||||||
|
const struct mem_param *param, int i)
|
||||||
{
|
{
|
||||||
return update_dimm_TT_1_4(ctrl, param, i, DRAM_TIMING_LOW, SPD_TRP, DTL_TRP_SHIFT, DTL_TRP_MASK, DTL_TRP_BASE, DTL_TRP_MIN, DTL_TRP_MAX);
|
return update_dimm_TT_1_4(ctrl, param, i, DRAM_TIMING_LOW, SPD_TRP, DTL_TRP_SHIFT, DTL_TRP_MASK, DTL_TRP_BASE, DTL_TRP_MIN, DTL_TRP_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int update_dimm_Trtp(const struct mem_controller *ctrl, const struct mem_param *param, int i, struct mem_info *meminfo)
|
|
||||||
|
static int update_dimm_Trtp(const struct mem_controller *ctrl,
|
||||||
|
const struct mem_param *param, int i, struct mem_info *meminfo)
|
||||||
{
|
{
|
||||||
//need to figure if it is 32 byte burst or 64 bytes burst
|
/* need to figure if it is 32 byte burst or 64 bytes burst */
|
||||||
int offset = 2;
|
int offset = 2;
|
||||||
if (!meminfo->is_Width128) {
|
if (!meminfo->is_Width128) {
|
||||||
uint32_t dword;
|
uint32_t dword;
|
||||||
|
@ -1904,7 +2011,8 @@ static int update_dimm_Twr(const struct mem_controller *ctrl, const struct mem_p
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int update_dimm_Tref(const struct mem_controller *ctrl, const struct mem_param *param, int i)
|
static int update_dimm_Tref(const struct mem_controller *ctrl,
|
||||||
|
const struct mem_param *param, int i)
|
||||||
{
|
{
|
||||||
uint32_t dth, dth_old;
|
uint32_t dth, dth_old;
|
||||||
int value;
|
int value;
|
||||||
|
@ -1928,7 +2036,9 @@ static int update_dimm_Tref(const struct mem_controller *ctrl, const struct mem_
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_4RankRDimm(const struct mem_controller *ctrl, const struct mem_param *param, struct mem_info *meminfo)
|
|
||||||
|
static void set_4RankRDimm(const struct mem_controller *ctrl,
|
||||||
|
const struct mem_param *param, struct mem_info *meminfo)
|
||||||
{
|
{
|
||||||
#if QRANK_DIMM_SUPPRT == 1
|
#if QRANK_DIMM_SUPPRT == 1
|
||||||
int value;
|
int value;
|
||||||
|
@ -1960,7 +2070,8 @@ static void set_4RankRDimm(const struct mem_controller *ctrl, const struct mem_p
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static uint32_t get_extra_dimm_mask(const struct mem_controller *ctrl, struct mem_info *meminfo)
|
static uint32_t get_extra_dimm_mask(const struct mem_controller *ctrl,
|
||||||
|
struct mem_info *meminfo)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -1982,7 +2093,6 @@ static uint32_t get_extra_dimm_mask(const struct mem_controller *ctrl, struct me
|
||||||
mask_page_1k = 0;
|
mask_page_1k = 0;
|
||||||
|
|
||||||
for (i = 0; i < DIMM_SOCKETS; i++) {
|
for (i = 0; i < DIMM_SOCKETS; i++) {
|
||||||
|
|
||||||
if (!(dimm_mask & (1 << i))) {
|
if (!(dimm_mask & (1 << i))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -2040,6 +2150,7 @@ static void set_dimm_x4(const struct mem_controller *ctrl, const struct mem_para
|
||||||
pci_write_config32(ctrl->f2, DRAM_CONFIG_LOW, dcl);
|
pci_write_config32(ctrl->f2, DRAM_CONFIG_LOW, dcl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int count_ones(uint32_t dimm_mask)
|
static int count_ones(uint32_t dimm_mask)
|
||||||
{
|
{
|
||||||
int dimms;
|
int dimms;
|
||||||
|
@ -2054,7 +2165,8 @@ static int count_ones(uint32_t dimm_mask)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void set_DramTerm(const struct mem_controller *ctrl, const struct mem_param *param, struct mem_info *meminfo)
|
static void set_DramTerm(const struct mem_controller *ctrl,
|
||||||
|
const struct mem_param *param, struct mem_info *meminfo)
|
||||||
{
|
{
|
||||||
uint32_t dcl;
|
uint32_t dcl;
|
||||||
unsigned odt;
|
unsigned odt;
|
||||||
|
@ -2081,7 +2193,8 @@ static void set_DramTerm(const struct mem_controller *ctrl, const struct mem_par
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void set_ecc(const struct mem_controller *ctrl,const struct mem_param *param, long dimm_mask, struct mem_info *meminfo)
|
static void set_ecc(const struct mem_controller *ctrl,
|
||||||
|
const struct mem_param *param, long dimm_mask, struct mem_info *meminfo)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int value;
|
int value;
|
||||||
|
@ -2122,15 +2235,19 @@ static void set_ecc(const struct mem_controller *ctrl,const struct mem_param *pa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int update_dimm_Twtr(const struct mem_controller *ctrl, const struct mem_param *param, int i)
|
|
||||||
|
static int update_dimm_Twtr(const struct mem_controller *ctrl,
|
||||||
|
const struct mem_param *param, int i)
|
||||||
{
|
{
|
||||||
|
|
||||||
return update_dimm_TT_1_4(ctrl, param, i, DRAM_TIMING_HIGH, SPD_TWTR, DTH_TWTR_SHIFT, DTH_TWTR_MASK, DTH_TWTR_BASE, DTH_TWTR_MIN, DTH_TWTR_MAX);
|
return update_dimm_TT_1_4(ctrl, param, i, DRAM_TIMING_HIGH, SPD_TWTR, DTH_TWTR_SHIFT, DTH_TWTR_MASK, DTH_TWTR_BASE, DTH_TWTR_MIN, DTH_TWTR_MAX);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_TT(const struct mem_controller *ctrl, const struct mem_param *param, unsigned TT_REG,
|
|
||||||
unsigned TT_SHIFT, unsigned TT_MASK, unsigned TT_BASE, unsigned TT_MIN, unsigned TT_MAX, unsigned val, const char *str)
|
static void set_TT(const struct mem_controller *ctrl,
|
||||||
|
const struct mem_param *param, unsigned TT_REG, unsigned TT_SHIFT,
|
||||||
|
unsigned TT_MASK, unsigned TT_BASE, unsigned TT_MIN, unsigned TT_MAX,
|
||||||
|
unsigned val, const char *str)
|
||||||
{
|
{
|
||||||
uint32_t reg;
|
uint32_t reg;
|
||||||
|
|
||||||
|
@ -2146,31 +2263,38 @@ static void set_TT(const struct mem_controller *ctrl, const struct mem_param *pa
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_TrwtTO(const struct mem_controller *ctrl, const struct mem_param *param)
|
|
||||||
|
static void set_TrwtTO(const struct mem_controller *ctrl,
|
||||||
|
const struct mem_param *param)
|
||||||
{
|
{
|
||||||
set_TT(ctrl, param, DRAM_TIMING_HIGH, DTH_TRWTTO_SHIFT, DTH_TRWTTO_MASK,DTH_TRWTTO_BASE, DTH_TRWTTO_MIN, DTH_TRWTTO_MAX, param->TrwtTO, "TrwtTO");
|
set_TT(ctrl, param, DRAM_TIMING_HIGH, DTH_TRWTTO_SHIFT, DTH_TRWTTO_MASK,DTH_TRWTTO_BASE, DTH_TRWTTO_MIN, DTH_TRWTTO_MAX, param->TrwtTO, "TrwtTO");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void set_Twrrd(const struct mem_controller *ctrl, const struct mem_param *param)
|
static void set_Twrrd(const struct mem_controller *ctrl, const struct mem_param *param)
|
||||||
{
|
{
|
||||||
set_TT(ctrl, param, DRAM_TIMING_HIGH, DTH_TWRRD_SHIFT, DTH_TWRRD_MASK,DTH_TWRRD_BASE, DTH_TWRRD_MIN, DTH_TWRRD_MAX, param->Twrrd, "Twrrd");
|
set_TT(ctrl, param, DRAM_TIMING_HIGH, DTH_TWRRD_SHIFT, DTH_TWRRD_MASK,DTH_TWRRD_BASE, DTH_TWRRD_MIN, DTH_TWRRD_MAX, param->Twrrd, "Twrrd");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void set_Twrwr(const struct mem_controller *ctrl, const struct mem_param *param)
|
static void set_Twrwr(const struct mem_controller *ctrl, const struct mem_param *param)
|
||||||
{
|
{
|
||||||
set_TT(ctrl, param, DRAM_TIMING_HIGH, DTH_TWRWR_SHIFT, DTH_TWRWR_MASK,DTH_TWRWR_BASE, DTH_TWRWR_MIN, DTH_TWRWR_MAX, param->Twrwr, "Twrwr");
|
set_TT(ctrl, param, DRAM_TIMING_HIGH, DTH_TWRWR_SHIFT, DTH_TWRWR_MASK,DTH_TWRWR_BASE, DTH_TWRWR_MIN, DTH_TWRWR_MAX, param->Twrwr, "Twrwr");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void set_Trdrd(const struct mem_controller *ctrl, const struct mem_param *param)
|
static void set_Trdrd(const struct mem_controller *ctrl, const struct mem_param *param)
|
||||||
{
|
{
|
||||||
set_TT(ctrl, param, DRAM_TIMING_HIGH, DTH_TRDRD_SHIFT, DTH_TRDRD_MASK,DTH_TRDRD_BASE, DTH_TRDRD_MIN, DTH_TRDRD_MAX, param->Trdrd, "Trdrd");
|
set_TT(ctrl, param, DRAM_TIMING_HIGH, DTH_TRDRD_SHIFT, DTH_TRDRD_MASK,DTH_TRDRD_BASE, DTH_TRDRD_MIN, DTH_TRDRD_MAX, param->Trdrd, "Trdrd");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void set_DcqBypassMax(const struct mem_controller *ctrl, const struct mem_param *param)
|
static void set_DcqBypassMax(const struct mem_controller *ctrl, const struct mem_param *param)
|
||||||
{
|
{
|
||||||
set_TT(ctrl, param, DRAM_CONFIG_HIGH, DCH_DcqBypassMax_SHIFT, DCH_DcqBypassMax_MASK,DCH_DcqBypassMax_BASE, DCH_DcqBypassMax_MIN, DCH_DcqBypassMax_MAX, param->DcqByPassMax, "DcqBypassMax"); // value need to be in CMOS
|
set_TT(ctrl, param, DRAM_CONFIG_HIGH, DCH_DcqBypassMax_SHIFT, DCH_DcqBypassMax_MASK,DCH_DcqBypassMax_BASE, DCH_DcqBypassMax_MIN, DCH_DcqBypassMax_MAX, param->DcqByPassMax, "DcqBypassMax"); // value need to be in CMOS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void set_Tfaw(const struct mem_controller *ctrl, const struct mem_param *param, struct mem_info *meminfo)
|
static void set_Tfaw(const struct mem_controller *ctrl, const struct mem_param *param, struct mem_info *meminfo)
|
||||||
{
|
{
|
||||||
static const uint8_t faw_1k[] = {8, 10, 13, 14};
|
static const uint8_t faw_1k[] = {8, 10, 13, 14};
|
||||||
|
@ -2183,8 +2307,7 @@ static void set_Tfaw(const struct mem_controller *ctrl, const struct mem_param *
|
||||||
|
|
||||||
if (meminfo->page_1k_mask != 0) { //1k page
|
if (meminfo->page_1k_mask != 0) { //1k page
|
||||||
faw = faw_1k[memclkfreq_index];
|
faw = faw_1k[memclkfreq_index];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
faw = faw_2k[memclkfreq_index];
|
faw = faw_2k[memclkfreq_index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2210,6 +2333,7 @@ static void set_max_async_latency(const struct mem_controller *ctrl, const struc
|
||||||
pci_write_config32(ctrl->f2, DRAM_CONFIG_HIGH, dch);
|
pci_write_config32(ctrl->f2, DRAM_CONFIG_HIGH, dch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void set_SlowAccessMode(const struct mem_controller *ctrl)
|
static void set_SlowAccessMode(const struct mem_controller *ctrl)
|
||||||
{
|
{
|
||||||
uint32_t dch;
|
uint32_t dch;
|
||||||
|
@ -2330,8 +2454,7 @@ static void set_misc_timing(const struct mem_controller *ctrl, struct mem_info *
|
||||||
dwordx = 0x00382f00; //x16 single Rank and x8 double Rank mixed
|
dwordx = 0x00382f00; //x16 single Rank and x8 double Rank mixed
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if ((meminfo->x4_mask == 0 ) && (meminfo->x16_mask == 0x00) && ((meminfo->single_rank_mask == 0x01)||(meminfo->single_rank_mask == 0x02))) { //x8 single rank
|
if ((meminfo->x4_mask == 0 ) && (meminfo->x16_mask == 0x00) && ((meminfo->single_rank_mask == 0x01)||(meminfo->single_rank_mask == 0x02))) { //x8 single rank
|
||||||
dwordx = 0x002f2f00;
|
dwordx = 0x002f2f00;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2402,7 +2525,8 @@ static void set_misc_timing(const struct mem_controller *ctrl, struct mem_info *
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void set_RDqsEn(const struct mem_controller *ctrl, const struct mem_param *param, struct mem_info *meminfo)
|
static void set_RDqsEn(const struct mem_controller *ctrl,
|
||||||
|
const struct mem_param *param, struct mem_info *meminfo)
|
||||||
{
|
{
|
||||||
#if CPU_SOCKET_TYPE==0x10
|
#if CPU_SOCKET_TYPE==0x10
|
||||||
//only need to set for reg and x8
|
//only need to set for reg and x8
|
||||||
|
@ -2420,7 +2544,8 @@ static void set_RDqsEn(const struct mem_controller *ctrl, const struct mem_param
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void set_idle_cycle_limit(const struct mem_controller *ctrl, const struct mem_param *param)
|
static void set_idle_cycle_limit(const struct mem_controller *ctrl,
|
||||||
|
const struct mem_param *param)
|
||||||
{
|
{
|
||||||
uint32_t dcm;
|
uint32_t dcm;
|
||||||
/* AMD says to Hardcode this */
|
/* AMD says to Hardcode this */
|
||||||
|
@ -2431,13 +2556,14 @@ static void set_idle_cycle_limit(const struct mem_controller *ctrl, const struct
|
||||||
pci_write_config32(ctrl->f2, DRAM_CTRL_MISC, dcm);
|
pci_write_config32(ctrl->f2, DRAM_CTRL_MISC, dcm);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_RdWrQByp(const struct mem_controller *ctrl, const struct mem_param *param)
|
|
||||||
|
static void set_RdWrQByp(const struct mem_controller *ctrl,
|
||||||
|
const struct mem_param *param)
|
||||||
{
|
{
|
||||||
set_TT(ctrl, param, DRAM_CTRL_MISC, DCM_RdWrQByp_SHIFT, DCM_RdWrQByp_MASK,0, 0, 3, 2, "RdWrQByp");
|
set_TT(ctrl, param, DRAM_CTRL_MISC, DCM_RdWrQByp_SHIFT, DCM_RdWrQByp_MASK,0, 0, 3, 2, "RdWrQByp");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static long spd_set_dram_timing(const struct mem_controller *ctrl, const struct mem_param *param, long dimm_mask, struct mem_info *meminfo)
|
static long spd_set_dram_timing(const struct mem_controller *ctrl, const struct mem_param *param, long dimm_mask, struct mem_info *meminfo)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -2521,7 +2647,8 @@ static long spd_set_dram_timing(const struct mem_controller *ctrl, const struct
|
||||||
return dimm_mask;
|
return dimm_mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sdram_set_spd_registers(const struct mem_controller *ctrl, struct sys_info *sysinfo)
|
static void sdram_set_spd_registers(const struct mem_controller *ctrl,
|
||||||
|
struct sys_info *sysinfo)
|
||||||
{
|
{
|
||||||
struct spd_set_memclk_result result;
|
struct spd_set_memclk_result result;
|
||||||
const struct mem_param *param;
|
const struct mem_param *param;
|
||||||
|
@ -2625,9 +2752,7 @@ static uint32_t hoist_memory(int controllers, const struct mem_controller *ctrl,
|
||||||
for (j = 0; j < controllers; j++) {
|
for (j = 0; j < controllers; j++) {
|
||||||
pci_write_config32(ctrl[j].f1, 0x40 + (i<<3), base);
|
pci_write_config32(ctrl[j].f1, 0x40 + (i<<3), base);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
hoist = /* hole start address */
|
hoist = /* hole start address */
|
||||||
((hole_startk << 10) & 0xff000000) +
|
((hole_startk << 10) & 0xff000000) +
|
||||||
/* hole address to memory controller address */
|
/* hole address to memory controller address */
|
||||||
|
@ -2649,7 +2774,8 @@ static void set_hw_mem_hole(int controllers, const struct mem_controller *ctrl)
|
||||||
hole_startk = 4*1024*1024 - HW_MEM_HOLE_SIZEK;
|
hole_startk = 4*1024*1024 - HW_MEM_HOLE_SIZEK;
|
||||||
|
|
||||||
#if HW_MEM_HOLE_SIZE_AUTO_INC == 1
|
#if HW_MEM_HOLE_SIZE_AUTO_INC == 1
|
||||||
//We need to double check if the hole_startk is valid, if it is equal to basek, we need to decrease it some
|
/* We need to double check if the hole_startk is valid, if it is equal
|
||||||
|
to basek, we need to decrease it some */
|
||||||
uint32_t basek_pri;
|
uint32_t basek_pri;
|
||||||
for (i=0; i<controllers; i++) {
|
for (i=0; i<controllers; i++) {
|
||||||
uint32_t base;
|
uint32_t base;
|
||||||
|
@ -2660,13 +2786,15 @@ static void set_hw_mem_hole(int controllers, const struct mem_controller *ctrl)
|
||||||
}
|
}
|
||||||
base_k = (base & 0xffff0000) >> 2;
|
base_k = (base & 0xffff0000) >> 2;
|
||||||
if (base_k == hole_startk) {
|
if (base_k == hole_startk) {
|
||||||
hole_startk -= (base_k - basek_pri)>>1; // decrease mem hole startk to make sure it is on middle of previous node
|
/* decrease mem hole startk to make sure it is
|
||||||
|
on middle of previous node */
|
||||||
|
hole_startk -= (base_k - basek_pri) >> 1;
|
||||||
break; //only one hole
|
break; //only one hole
|
||||||
}
|
}
|
||||||
basek_pri = base_k;
|
basek_pri = base_k;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
//find node index that need do set hole
|
/* find node index that need do set hole */
|
||||||
for (i=0; i < controllers; i++) {
|
for (i=0; i < controllers; i++) {
|
||||||
uint32_t base, limit;
|
uint32_t base, limit;
|
||||||
unsigned base_k, limit_k;
|
unsigned base_k, limit_k;
|
||||||
|
@ -2687,14 +2815,14 @@ static void set_hw_mem_hole(int controllers, const struct mem_controller *ctrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void sdram_enable(int controllers, const struct mem_controller *ctrl, struct sys_info *sysinfo)
|
|
||||||
|
static void sdram_enable(int controllers, const struct mem_controller *ctrl,
|
||||||
|
struct sys_info *sysinfo)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
||||||
#if K8_REV_F_SUPPORT_F0_F1_WORKAROUND == 1
|
#if K8_REV_F_SUPPORT_F0_F1_WORKAROUND == 1
|
||||||
unsigned cpu_f0_f1[8];
|
unsigned cpu_f0_f1[8];
|
||||||
/* FIXME: How about 32 node machine later? */
|
/* FIXME: How about 32 node machine later? */
|
||||||
|
@ -2716,13 +2844,12 @@ static void sdram_enable(int controllers, const struct mem_controller *ctrl, str
|
||||||
continue;
|
continue;
|
||||||
dch = pci_read_config32(ctrl[i].f2, DRAM_CONFIG_HIGH);
|
dch = pci_read_config32(ctrl[i].f2, DRAM_CONFIG_HIGH);
|
||||||
|
|
||||||
// if no memory installed, disabled the interface
|
/* if no memory installed, disabled the interface */
|
||||||
if (sysinfo->meminfo[i].dimm_mask==0x00){
|
if (sysinfo->meminfo[i].dimm_mask==0x00){
|
||||||
dch |= DCH_DisDramInterface;
|
dch |= DCH_DisDramInterface;
|
||||||
pci_write_config32(ctrl[i].f2, DRAM_CONFIG_HIGH, dch);
|
pci_write_config32(ctrl[i].f2, DRAM_CONFIG_HIGH, dch);
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
dch |= DCH_MemClkFreqVal;
|
dch |= DCH_MemClkFreqVal;
|
||||||
pci_write_config32(ctrl[i].f2, DRAM_CONFIG_HIGH, dch);
|
pci_write_config32(ctrl[i].f2, DRAM_CONFIG_HIGH, dch);
|
||||||
/* address timing and Output driver comp Control */
|
/* address timing and Output driver comp Control */
|
||||||
|
@ -2788,7 +2915,6 @@ static void sdram_enable(int controllers, const struct mem_controller *ctrl, str
|
||||||
pci_write_config32(ctrl[i].f2, DRAM_CONFIG_LOW, dcl);
|
pci_write_config32(ctrl[i].f2, DRAM_CONFIG_LOW, dcl);
|
||||||
dcl |= DCL_InitDram;
|
dcl |= DCL_InitDram;
|
||||||
pci_write_config32(ctrl[i].f2, DRAM_CONFIG_LOW, dcl);
|
pci_write_config32(ctrl[i].f2, DRAM_CONFIG_LOW, dcl);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < controllers; i++) {
|
for (i = 0; i < controllers; i++) {
|
||||||
|
@ -2840,12 +2966,12 @@ static void sdram_enable(int controllers, const struct mem_controller *ctrl, str
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HW_MEM_HOLE_SIZEK != 0
|
#if HW_MEM_HOLE_SIZEK != 0
|
||||||
// init hw mem hole here
|
/* init hw mem hole here */
|
||||||
/* DramHoleValid bit only can be set after MemClrStatus is set by Hardware */
|
/* DramHoleValid bit only can be set after MemClrStatus is set by Hardware */
|
||||||
set_hw_mem_hole(controllers, ctrl);
|
set_hw_mem_hole(controllers, ctrl);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//store tom to sysinfo, and it will be used by dqs_timing
|
/* store tom to sysinfo, and it will be used by dqs_timing */
|
||||||
{
|
{
|
||||||
msr_t msr;
|
msr_t msr;
|
||||||
//[1M, TOM)
|
//[1M, TOM)
|
||||||
|
@ -2880,7 +3006,7 @@ static void sdram_enable(int controllers, const struct mem_controller *ctrl, str
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#if MEM_TRAIN_SEQ == 2
|
#if MEM_TRAIN_SEQ == 2
|
||||||
//need to enable mtrr, so dqs training could access the test address
|
/* need to enable mtrr, so dqs training could access the test address */
|
||||||
setup_mtrr_dqs(sysinfo->tom_k, sysinfo->tom2_k);
|
setup_mtrr_dqs(sysinfo->tom_k, sysinfo->tom2_k);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2907,7 +3033,10 @@ static void sdram_enable(int controllers, const struct mem_controller *ctrl, str
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
static void fill_mem_ctrl(int controllers, struct mem_controller *ctrl_a, const uint16_t *spd_addr)
|
|
||||||
|
|
||||||
|
static void fill_mem_ctrl(int controllers, struct mem_controller *ctrl_a,
|
||||||
|
const uint16_t *spd_addr)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
|
|
Loading…
Reference in New Issue