Changeset 3764
- Timestamp:
- 11/21/08 00:18:10 (7 weeks ago)
- Location:
- trunk/coreboot-v2/src
- Files:
-
- 6 modified
-
mainboard/asus/mew-am/auto.c (modified) (2 diffs)
-
mainboard/asus/mew-vm/auto.c (modified) (2 diffs)
-
mainboard/msi/ms6178/auto.c (modified) (3 diffs)
-
northbridge/intel/i82810/debug.c (modified) (1 diff)
-
northbridge/intel/i82810/raminit.c (modified) (12 diffs)
-
northbridge/intel/i82810/raminit.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/coreboot-v2/src/mainboard/asus/mew-am/auto.c
r3653 r3764 49 49 #include "northbridge/intel/i82810/raminit.c" 50 50 /* #include "northbridge/intel/i82810/debug.c" */ 51 #include "sdram/generic_sdram.c"52 51 53 52 static void main(unsigned long bist) 54 53 { 55 static const struct mem_controller memctrl[] = {56 {57 .d0 = PCI_DEV(0, 0, 0),58 .channel0 = {0x50, 0x51},59 }60 };61 62 54 if (bist == 0) 63 55 early_mtrr_init(); … … 68 60 report_bist_failure(bist); 69 61 enable_smbus(); 70 /* dump_spd_registers(&memctrl[0]); */ 71 sdram_initialize(ARRAY_SIZE(memctrl), memctrl); 62 /* dump_spd_registers(); */ 63 sdram_set_registers(); 64 sdram_set_spd_registers(); 65 sdram_enable(); 72 66 /* ram_check(0, 640 * 1024); */ 73 67 } -
trunk/coreboot-v2/src/mainboard/asus/mew-vm/auto.c
r3742 r3764 53 53 #include "northbridge/intel/i82810/raminit.c" 54 54 #include "northbridge/intel/i82810/debug.c" 55 #include "sdram/generic_sdram.c"56 55 57 56 static void main(unsigned long bist) 58 57 { 59 static const struct mem_controller memctrl[] = {60 {61 .d0 = PCI_DEV(0, 0, 0),62 .channel0 = {0x50, 0x51},63 }64 };65 66 58 if (bist == 0) 67 59 early_mtrr_init(); … … 76 68 report_bist_failure(bist); 77 69 78 /* dump_spd_registers( &memctrl[0]); */70 /* dump_spd_registers(); */ 79 71 80 /* sdram_initialize() runs out of registers. */ 81 /* sdram_initialize(ARRAY_SIZE(memctrl), memctrl); */ 82 83 sdram_set_registers(memctrl); 84 sdram_set_spd_registers(memctrl); 85 sdram_enable(0, memctrl); 72 sdram_set_registers(); 73 sdram_set_spd_registers(); 74 sdram_enable(); 86 75 87 76 /* Check RAM. */ -
trunk/coreboot-v2/src/mainboard/msi/ms6178/auto.c
r3742 r3764 38 38 #include "pc80/udelay_io.c" 39 39 #include "northbridge/intel/i82810/raminit.c" 40 #include "sdram/generic_sdram.c"41 40 42 41 #define SERIAL_DEV PNP_DEV(0x2e, W83627HF_SP1) … … 44 43 static void main(unsigned long bist) 45 44 { 46 static const struct mem_controller memctrl[] = {47 {48 .d0 = PCI_DEV(0, 0, 0),49 .channel0 = {0x50, 0x51},50 }51 };52 53 45 if (bist == 0) 54 46 early_mtrr_init(); … … 67 59 68 60 report_bist_failure(bist); 69 /* dump_spd_registers(&memctrl[0]); */ 70 sdram_initialize(ARRAY_SIZE(memctrl), memctrl); 61 62 /* dump_spd_registers(); */ 63 sdram_set_registers(); 64 sdram_set_spd_registers(); 65 sdram_enable(); 71 66 /* ram_check(0, 640 * 1024); */ 72 67 } -
trunk/coreboot-v2/src/northbridge/intel/i82810/debug.c
r2720 r3764 1 1 2 static void dump_spd_registers( const struct mem_controller *ctrl)2 static void dump_spd_registers(void) 3 3 { 4 4 int i; 5 5 print_debug("\r\n"); 6 for(i = 0; i < 4; i++) {6 for(i = 0; i < DIMM_SOCKETS; i++) { 7 7 unsigned device; 8 device = ctrl->channel0[i];8 device = DIMM_SPD_BASE + i; 9 9 if (device) { 10 10 int j; -
trunk/coreboot-v2/src/northbridge/intel/i82810/raminit.c
r3759 r3764 63 63 * Send the specified RAM command to all DIMMs. 64 64 * 65 * @param Memory controller66 65 * @param TODO 67 66 * @param TODO 68 67 */ 69 static void do_ram_command( const struct mem_controller *ctrl, uint32_t command,70 uint32_t addr_offset, uint32_trow_offset)68 static void do_ram_command(uint32_t command, uint32_t addr_offset, 69 uint32_t row_offset) 71 70 { 72 71 uint8_t reg; … … 75 74 76 75 /* Configure the RAM command. */ 77 reg = pci_read_config8( ctrl->d0, DRAMT);76 reg = pci_read_config8(PCI_DEV(0, 0, 0), DRAMT); 78 77 reg &= 0x1f; /* Clear bits 7-5. */ 79 78 reg |= command << 5; 80 pci_write_config8( ctrl->d0, DRAMT, reg);79 pci_write_config8(PCI_DEV(0, 0, 0), DRAMT, reg); 81 80 82 81 /* RAM_COMMAND_NORMAL affects only the memory controller and … … 102 101 * Set DRP - DRAM Row Population Register (Device 0). 103 102 */ 104 static void spd_set_dram_size(const struct mem_controller *ctrl, 105 uint32_t row_offset) 103 static void spd_set_dram_size(uint32_t row_offset) 106 104 { 107 105 /* The variables drp and dimm_size have to be ints since all the … … 114 112 for (i = 0; i < DIMM_SOCKETS; i++) { 115 113 /* First check if a DIMM is actually present. */ 116 if (smbus_read_byte( ctrl->channel0[i], 2) == 4) {114 if (smbus_read_byte(DIMM_SPD_BASE + i, 2) == 4) { 117 115 print_debug("Found DIMM in slot "); 118 116 print_debug_hex8(i); 119 117 print_debug("\r\n"); 120 118 121 dimm_size = smbus_read_byte( ctrl->channel0[i], 31);119 dimm_size = smbus_read_byte(DIMM_SPD_BASE + i, 31); 122 120 123 121 /* WISHLIST: would be nice to display it as decimal? */ … … 182 180 /* If the DIMM is dual-sided, the DRP value is +2 */ 183 181 /* TODO: Figure out asymetrical configurations. */ 184 if ((smbus_read_byte( ctrl->channel0[i], 127) | 0xf) ==182 if ((smbus_read_byte(DIMM_SPD_BASE + i, 127) | 0xf) == 185 183 0xff) { 186 184 print_debug("DIMM is dual-sided\r\n"); … … 204 202 print_debug("\r\n"); 205 203 206 pci_write_config8( ctrl->d0, DRP, drp);207 } 208 209 static void set_dram_timing( const struct mem_controller *ctrl)204 pci_write_config8(PCI_DEV(0, 0, 0), DRP, drp); 205 } 206 207 static void set_dram_timing(void) 210 208 { 211 209 /* TODO, for now using default, hopefully safe values. */ 212 // pci_write_config8( ctrl->d0, DRAMT, 0x00);210 // pci_write_config8(PCI_DEV(0, 0, 0), DRAMT, 0x00); 213 211 } 214 212 … … 240 238 * 0x0001 512MB 0xff 256MB dual-sided 256MB dual-sided 241 239 */ 242 static void set_dram_buffer_strength( const struct mem_controller *ctrl)243 { 244 pci_write_config16( ctrl->d0, BUFF_SC, 0x77da);240 static void set_dram_buffer_strength(void) 241 { 242 pci_write_config16(PCI_DEV(0, 0, 0), BUFF_SC, 0x77da); 245 243 } 246 244 … … 251 249 /** 252 250 * TODO. 253 * 254 * @param Memory controller 255 */ 256 static void sdram_set_registers(const struct mem_controller *ctrl) 251 */ 252 static void sdram_set_registers(void) 257 253 { 258 254 unsigned long val; 259 255 260 256 /* TODO */ 261 pci_write_config8( ctrl->d0, GMCHCFG, 0x60);257 pci_write_config8(PCI_DEV(0, 0, 0), GMCHCFG, 0x60); 262 258 263 259 /* PAMR: Programmable Attributes Register … … 276 272 277 273 /* Ideally, this should be R/W for as many ranges as possible. */ 278 pci_write_config8( ctrl->d0, PAM, 0xff);274 pci_write_config8(PCI_DEV(0, 0, 0), PAM, 0xff); 279 275 280 276 /* Enabling the VGA Framebuffer currently screws up the rest of the boot. … … 282 278 283 279 /* Enable 1MB framebuffer. */ 284 //pci_write_config8( ctrl->d0, SMRAM, 0xC0);285 286 //val = pci_read_config16( ctrl->d0, MISSC);280 //pci_write_config8(PCI_DEV(0, 0, 0), SMRAM, 0xC0); 281 282 //val = pci_read_config16(PCI_DEV(0, 0, 0), MISSC); 287 283 /* Preserve reserved bits. */ 288 284 //val &= 0xff06; 289 285 /* Set graphics cache window to 32MB, no power throttling. */ 290 286 //val |= 0x0001; 291 //pci_write_config16( ctrl->d0, MISSC, val);292 293 //val = pci_read_config8( ctrl->d0, MISSC2);287 //pci_write_config16(PCI_DEV(0, 0, 0), MISSC, val); 288 289 //val = pci_read_config8(PCI_DEV(0, 0, 0), MISSC2); 294 290 /* Enable graphics palettes and clock gating (not optional!) */ 295 291 //val |= 0x06; 296 //pci_write_config8( ctrl->d0, MISSC2, val);292 //pci_write_config8(PCI_DEV(0, 0, 0), MISSC2, val); 297 293 } 298 294 299 295 /** 300 296 * TODO. 301 * 302 * @param Memory controller 303 */ 304 static void sdram_set_spd_registers(const struct mem_controller *ctrl) 297 */ 298 static void sdram_set_spd_registers(void) 305 299 { 306 300 /* spd_set_dram_size() moved into sdram_enable() to prevent having 307 301 * to pass a variable between here and there. 308 302 */ 309 set_dram_buffer_strength( ctrl);310 311 set_dram_timing( ctrl);303 set_dram_buffer_strength(); 304 305 set_dram_timing(); 312 306 } 313 307 314 308 /** 315 309 * Enable SDRAM. 316 * 317 * @param Number of controllers 318 * @param Memory controller 319 */ 320 static void sdram_enable(int controllers, const struct mem_controller *ctrl) 310 */ 311 static void sdram_enable(void) 321 312 { 322 313 int i; … … 328 319 uint32_t row_offset; 329 320 330 spd_set_dram_size( ctrl,row_offset);321 spd_set_dram_size(row_offset); 331 322 332 323 /* 1. Apply NOP. */ 333 324 PRINT_DEBUG("RAM Enable 1: Apply NOP\r\n"); 334 do_ram_command( ctrl,RAM_COMMAND_NOP, 0, row_offset);325 do_ram_command(RAM_COMMAND_NOP, 0, row_offset); 335 326 udelay(200); 336 327 337 328 /* 2. Precharge all. Wait tRP. */ 338 329 PRINT_DEBUG("RAM Enable 2: Precharge all\r\n"); 339 do_ram_command( ctrl,RAM_COMMAND_PRECHARGE, 0, row_offset);330 do_ram_command(RAM_COMMAND_PRECHARGE, 0, row_offset); 340 331 udelay(1); 341 332 342 333 /* 3. Perform 8 refresh cycles. Wait tRC each time. */ 343 334 PRINT_DEBUG("RAM Enable 3: CBR\r\n"); 344 do_ram_command( ctrl,RAM_COMMAND_CBR, 0, row_offset);335 do_ram_command(RAM_COMMAND_CBR, 0, row_offset); 345 336 for (i = 0; i < 8; i++) { 346 337 read32(0); … … 351 342 /* 4. Mode register set. Wait two memory cycles. */ 352 343 PRINT_DEBUG("RAM Enable 4: Mode register set\r\n"); 353 do_ram_command( ctrl,RAM_COMMAND_MRS, 0x1d0, row_offset);344 do_ram_command(RAM_COMMAND_MRS, 0x1d0, row_offset); 354 345 udelay(2); 355 346 356 347 /* 5. Normal operation (enables refresh) */ 357 348 PRINT_DEBUG("RAM Enable 5: Normal operation\r\n"); 358 do_ram_command( ctrl,RAM_COMMAND_NORMAL, 0, row_offset);349 do_ram_command(RAM_COMMAND_NORMAL, 0, row_offset); 359 350 udelay(1); 360 351 -
trunk/coreboot-v2/src/northbridge/intel/i82810/raminit.h
r3052 r3764 25 25 #define DIMM_SOCKETS 2 26 26 27 struct mem_controller { 28 device_t d0; 29 uint16_t channel0[DIMM_SOCKETS]; 30 }; 27 /* DIMM0 is at 0x50, DIMM1 is at 0x51. */ 28 #define DIMM_SPD_BASE 0x50 31 29 32 30 /* The following table has been bumped over to this header to avoid clutter in
