sdram_init.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. /*
  2. * (C) Copyright 2001
  3. * Josh Huber <huber@mclx.com>, Mission Critical Linux, Inc.
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. /* sdram_init.c - automatic memory sizing */
  24. #include <common.h>
  25. #include <74xx_7xx.h>
  26. #include <galileo/memory.h>
  27. #include <galileo/pci.h>
  28. #include <galileo/gt64260R.h>
  29. #include <net.h>
  30. #include "eth.h"
  31. #include "mpsc.h"
  32. #include "i2c.h"
  33. #include "64260.h"
  34. /* #define DEBUG */
  35. #define MAP_PCI
  36. #ifdef DEBUG
  37. #define DP(x) x
  38. #else
  39. #define DP(x)
  40. #endif
  41. #define GB (1 << 30)
  42. /* structure to store the relevant information about an sdram bank */
  43. typedef struct sdram_info {
  44. uchar drb_size;
  45. uchar registered, ecc;
  46. uchar tpar;
  47. uchar tras_clocks;
  48. uchar burst_len;
  49. uchar banks, slot;
  50. int size; /* detected size, not from I2C but from dram_size() */
  51. } sdram_info_t;
  52. #ifdef DEBUG
  53. void dump_dimm_info (struct sdram_info *d)
  54. {
  55. static const char *ecc_legend[] = { "", " Parity", " ECC" };
  56. printf ("dimm%s %sDRAM: %dMibytes:\n",
  57. ecc_legend[d->ecc],
  58. d->registered ? "R" : "", (d->size >> 20));
  59. printf (" drb=%d tpar=%d tras=%d burstlen=%d banks=%d slot=%d\n",
  60. d->drb_size, d->tpar, d->tras_clocks, d->burst_len,
  61. d->banks, d->slot);
  62. }
  63. #endif
  64. static int
  65. memory_map_bank (unsigned int bankNo,
  66. unsigned int bankBase, unsigned int bankLength)
  67. {
  68. #ifdef DEBUG
  69. if (bankLength > 0) {
  70. printf ("mapping bank %d at %08x - %08x\n",
  71. bankNo, bankBase, bankBase + bankLength - 1);
  72. } else {
  73. printf ("unmapping bank %d\n", bankNo);
  74. }
  75. #endif
  76. memoryMapBank (bankNo, bankBase, bankLength);
  77. return 0;
  78. }
  79. #ifdef MAP_PCI
  80. static int
  81. memory_map_bank_pci (unsigned int bankNo,
  82. unsigned int bankBase, unsigned int bankLength)
  83. {
  84. PCI_HOST host;
  85. for (host = PCI_HOST0; host <= PCI_HOST1; host++) {
  86. const int features =
  87. PREFETCH_ENABLE |
  88. DELAYED_READ_ENABLE |
  89. AGGRESSIVE_PREFETCH |
  90. READ_LINE_AGGRESSIVE_PREFETCH |
  91. READ_MULTI_AGGRESSIVE_PREFETCH |
  92. MAX_BURST_4 | PCI_NO_SWAP;
  93. pciMapMemoryBank (host, bankNo, bankBase, bankLength);
  94. pciSetRegionSnoopMode (host, bankNo, PCI_SNOOP_WB, bankBase,
  95. bankLength);
  96. pciSetRegionFeatures (host, bankNo, features, bankBase,
  97. bankLength);
  98. }
  99. return 0;
  100. }
  101. #endif
  102. /* ------------------------------------------------------------------------- */
  103. /* much of this code is based on (or is) the code in the pip405 port */
  104. /* thanks go to the authors of said port - Josh */
  105. /*
  106. * translate ns.ns/10 coding of SPD timing values
  107. * into 10 ps unit values
  108. */
  109. static inline unsigned short NS10to10PS (unsigned char spd_byte)
  110. {
  111. unsigned short ns, ns10;
  112. /* isolate upper nibble */
  113. ns = (spd_byte >> 4) & 0x0F;
  114. /* isolate lower nibble */
  115. ns10 = (spd_byte & 0x0F);
  116. return (ns * 100 + ns10 * 10);
  117. }
  118. /*
  119. * translate ns coding of SPD timing values
  120. * into 10 ps unit values
  121. */
  122. static inline unsigned short NSto10PS (unsigned char spd_byte)
  123. {
  124. return (spd_byte * 100);
  125. }
  126. #ifdef CONFIG_ZUMA_V2
  127. static int check_dimm (uchar slot, sdram_info_t * info)
  128. {
  129. /* assume 2 dimms, 2 banks each 256M - we dont have an
  130. * dimm i2c so rely on the detection routines later */
  131. memset (info, 0, sizeof (*info));
  132. info->slot = slot;
  133. info->banks = 2; /* Detect later */
  134. info->registered = 0;
  135. info->drb_size = 32; /* 16 - 256MBit, 32 - 512MBit
  136. but doesn't matter, both do same
  137. thing in setup_sdram() */
  138. info->tpar = 3;
  139. info->tras_clocks = 5;
  140. info->burst_len = 4;
  141. #ifdef CONFIG_ECC
  142. info->ecc = 0; /* Detect later */
  143. #endif /* CONFIG_ECC */
  144. return 0;
  145. }
  146. #elif defined(CONFIG_P3G4)
  147. static int check_dimm (uchar slot, sdram_info_t * info)
  148. {
  149. memset (info, 0, sizeof (*info));
  150. if (slot)
  151. return 0;
  152. info->slot = slot;
  153. info->banks = 1;
  154. info->registered = 0;
  155. info->drb_size = 4;
  156. info->tpar = 3;
  157. info->tras_clocks = 6;
  158. info->burst_len = 4;
  159. #ifdef CONFIG_ECC
  160. info->ecc = 2;
  161. #endif
  162. return 0;
  163. }
  164. #else /* ! CONFIG_ZUMA_V2 && ! CONFIG_P3G4 */
  165. /* This code reads the SPD chip on the sdram and populates
  166. * the array which is passed in with the relevant information */
  167. static int check_dimm (uchar slot, sdram_info_t * info)
  168. {
  169. DECLARE_GLOBAL_DATA_PTR;
  170. uchar addr = slot == 0 ? DIMM0_I2C_ADDR : DIMM1_I2C_ADDR;
  171. int ret;
  172. uchar rows, cols, sdram_banks, supp_cal, width, cal_val;
  173. ulong tmemclk;
  174. uchar trp_clocks, trcd_clocks;
  175. uchar data[128];
  176. get_clocks ();
  177. tmemclk = 1000000000 / (gd->bus_clk / 100); /* in 10 ps units */
  178. #ifdef CONFIG_EVB64260_750CX
  179. if (0 != slot) {
  180. printf ("check_dimm: The EVB-64260-750CX only has 1 DIMM,");
  181. printf (" called with slot=%d insetad!\n", slot);
  182. return 0;
  183. }
  184. #endif
  185. DP (puts ("before i2c read\n"));
  186. ret = i2c_read (addr, 0, 128, data, 0);
  187. DP (puts ("after i2c read\n"));
  188. /* zero all the values */
  189. memset (info, 0, sizeof (*info));
  190. if (ret) {
  191. DP (printf ("No DIMM in slot %d [err = %x]\n", slot, ret));
  192. return 0;
  193. }
  194. /* first, do some sanity checks */
  195. if (data[2] != 0x4) {
  196. printf ("Not SDRAM in slot %d\n", slot);
  197. return 0;
  198. }
  199. /* get various information */
  200. rows = data[3];
  201. cols = data[4];
  202. info->banks = data[5];
  203. sdram_banks = data[17];
  204. width = data[13] & 0x7f;
  205. DP (printf
  206. ("sdram_banks: %d, banks: %d\n", sdram_banks, info->banks));
  207. /* check if the memory is registered */
  208. if (data[21] & (BIT1 | BIT4))
  209. info->registered = 1;
  210. #ifdef CONFIG_ECC
  211. /* check for ECC/parity [0 = none, 1 = parity, 2 = ecc] */
  212. info->ecc = (data[11] & 2) >> 1;
  213. #endif
  214. /* bit 1 is CL2, bit 2 is CL3 */
  215. supp_cal = (data[18] & 0x6) >> 1;
  216. /* compute the relevant clock values */
  217. trp_clocks = (NSto10PS (data[27]) + (tmemclk - 1)) / tmemclk;
  218. trcd_clocks = (NSto10PS (data[29]) + (tmemclk - 1)) / tmemclk;
  219. info->tras_clocks = (NSto10PS (data[30]) + (tmemclk - 1)) / tmemclk;
  220. DP (printf ("trp = %d\ntrcd_clocks = %d\ntras_clocks = %d\n",
  221. trp_clocks, trcd_clocks, info->tras_clocks));
  222. /* try a CAS latency of 3 first... */
  223. cal_val = 0;
  224. if (supp_cal & 3) {
  225. if (NS10to10PS (data[9]) <= tmemclk)
  226. cal_val = 3;
  227. }
  228. /* then 2... */
  229. if (supp_cal & 2) {
  230. if (NS10to10PS (data[23]) <= tmemclk)
  231. cal_val = 2;
  232. }
  233. DP (printf ("cal_val = %d\n", cal_val));
  234. /* bummer, did't work... */
  235. if (cal_val == 0) {
  236. DP (printf ("Couldn't find a good CAS latency\n"));
  237. return 0;
  238. }
  239. /* get the largest delay -- these values need to all be the same
  240. * see Res#6 */
  241. info->tpar = cal_val;
  242. if (trp_clocks > info->tpar)
  243. info->tpar = trp_clocks;
  244. if (trcd_clocks > info->tpar)
  245. info->tpar = trcd_clocks;
  246. DP (printf ("tpar set to: %d\n", info->tpar));
  247. #ifdef CFG_BROKEN_CL2
  248. if (info->tpar == 2) {
  249. info->tpar = 3;
  250. DP (printf ("tpar fixed-up to: %d\n", info->tpar));
  251. }
  252. #endif
  253. /* compute the module DRB size */
  254. info->drb_size =
  255. (((1 << (rows + cols)) * sdram_banks) * width) / _16M;
  256. DP (printf ("drb_size set to: %d\n", info->drb_size));
  257. /* find the burst len */
  258. info->burst_len = data[16] & 0xf;
  259. if ((info->burst_len & 8) == 8) {
  260. info->burst_len = 1;
  261. } else if ((info->burst_len & 4) == 4) {
  262. info->burst_len = 0;
  263. } else {
  264. return 0;
  265. }
  266. info->slot = slot;
  267. return 0;
  268. }
  269. #endif /* ! CONFIG_ZUMA_V2 */
  270. static int setup_sdram_common (sdram_info_t info[2])
  271. {
  272. ulong tmp;
  273. int tpar = 2, tras_clocks = 5, registered = 1, ecc = 2;
  274. if (!info[0].banks && !info[1].banks)
  275. return 0;
  276. if (info[0].banks) {
  277. if (info[0].tpar > tpar)
  278. tpar = info[0].tpar;
  279. if (info[0].tras_clocks > tras_clocks)
  280. tras_clocks = info[0].tras_clocks;
  281. if (!info[0].registered)
  282. registered = 0;
  283. if (info[0].ecc != 2indent: Standard input:491: Warning:old style assignment ambiguity in "=*". Assuming "= *"
  284. indent: Standard input:492: Warning:old style assignment ambiguity in "=*". Assuming "= *"
  285. )
  286. ecc = 0;
  287. }
  288. if (info[1].banks) {
  289. if (info[1].tpar > tpar)
  290. tpar = info[1].tpar;
  291. if (info[1].tras_clocks > tras_clocks)
  292. tras_clocks = info[1].tras_clocks;
  293. if (!info[1].registered)
  294. registered = 0;
  295. if (info[1].ecc != 2)
  296. ecc = 0;
  297. }
  298. /* SDRAM configuration */
  299. tmp = GTREGREAD (SDRAM_CONFIGURATION);
  300. /* Turn on physical interleave if both DIMMs
  301. * have even numbers of banks. */
  302. if ((info[0].banks == 0 || info[0].banks == 2) &&
  303. (info[1].banks == 0 || info[1].banks == 2)) {
  304. /* physical interleave on */
  305. tmp &= ~(1 << 15);
  306. } else {
  307. /* physical interleave off */
  308. tmp |= (1 << 15);
  309. }
  310. tmp |= (registered << 17);
  311. /* Use buffer 1 to return read data to the CPU
  312. * See Res #12 */
  313. tmp |= (1 << 26);
  314. GT_REG_WRITE (SDRAM_CONFIGURATION, tmp);
  315. DP (printf ("SDRAM config: %08x\n", GTREGREAD (SDRAM_CONFIGURATION)));
  316. /* SDRAM timing */
  317. tmp = (((tpar == 3) ? 2 : 1) |
  318. (((tpar == 3) ? 2 : 1) << 2) |
  319. (((tpar == 3) ? 2 : 1) << 4) | (tras_clocks << 8));
  320. #ifdef CONFIG_ECC
  321. /* Setup ECC */
  322. if (ecc == 2)
  323. tmp |= 1 << 13;
  324. #endif /* CONFIG_ECC */
  325. GT_REG_WRITE (SDRAM_TIMING, tmp);
  326. DP (printf ("SDRAM timing: %08x (%d,%d,%d,%d)\n",
  327. GTREGREAD (SDRAM_TIMING), tpar, tpar, tpar, tras_clocks));
  328. /* SDRAM address decode register */
  329. /* program this with the default value */
  330. GT_REG_WRITE (SDRAM_ADDRESS_DECODE, 0x2);
  331. DP (printf ("SDRAM decode: %08x\n",
  332. GTREGREAD (SDRAM_ADDRESS_DECODE)));
  333. return 0;
  334. }
  335. /* sets up the GT properly with information passed in */
  336. static int setup_sdram (sdram_info_t * info)
  337. {
  338. ulong tmp, check;
  339. ulong *addr = 0;
  340. int i;
  341. /* sanity checking */
  342. if (!info->banks)
  343. return 0;
  344. /* ---------------------------- */
  345. /* Program the GT with the discovered data */
  346. /* bank parameters */
  347. tmp = (0xf << 16); /* leave all virt bank pages open */
  348. DP (printf ("drb_size: %d\n", info->drb_size));
  349. switch (info->drb_size) {
  350. case 1:
  351. tmp |= (1 << 14);
  352. break;
  353. case 4:
  354. case 8:
  355. tmp |= (2 << 14);
  356. break;
  357. case 16:
  358. case 32:
  359. tmp |= (3 << 14);
  360. break;
  361. default:
  362. printf ("Error in dram size calculation\n");
  363. return 1;
  364. }
  365. /* SDRAM bank parameters */
  366. /* the param registers for slot 1 (banks 2+3) are offset by 0x8 */
  367. GT_REG_WRITE (SDRAM_BANK0PARAMETERS + (info->slot * 0x8), tmp);
  368. GT_REG_WRITE (SDRAM_BANK1PARAMETERS + (info->slot * 0x8), tmp);
  369. DP (printf
  370. ("SDRAM bankparam slot %d (bank %d+%d): %08lx\n", info->slot,
  371. info->slot * 2, (info->slot * 2) + 1, tmp));
  372. /* set the SDRAM configuration for each bank */
  373. for (i = info->slot * 2; i < ((info->slot * 2) + info->banks); i++) {
  374. DP (printf ("*** Running a MRS cycle for bank %d ***\n", i));
  375. /* map the bank */
  376. memory_map_bank (i, 0, GB / 4);
  377. /* set SDRAM mode */
  378. GT_REG_WRITE (SDRAM_OPERATION_MODE, 0x3);
  379. check = GTREGREAD (SDRAM_OPERATION_MODE);
  380. /* dummy write */
  381. *addr = 0;
  382. /* wait for the command to complete */
  383. while ((GTREGREAD (SDRAM_OPERATION_MODE) & (1 << 31)) == 0);
  384. /* switch back to normal operation mode */
  385. GT_REG_WRITE (SDRAM_OPERATION_MODE, 0);
  386. check = GTREGREAD (SDRAM_OPERATION_MODE);
  387. /* unmap the bank */
  388. memory_map_bank (i, 0, 0);
  389. DP (printf ("*** MRS cycle for bank %d done ***\n", i));
  390. }
  391. return 0;
  392. }
  393. /*
  394. * Check memory range for valid RAM. A simple memory test determines
  395. * the actually available RAM size between addresses `base' and
  396. * `base + maxsize'. Some (not all) hardware errors are detected:
  397. * - short between address lines
  398. * - short between data lines
  399. */
  400. static long int dram_size (long int *base, long int maxsize)
  401. {
  402. volatile long int *addr, *b = base;
  403. long int cnt, val, save1, save2;
  404. #define STARTVAL (1<<20) /* start test at 1M */
  405. for (cnt = STARTVAL / sizeof (long); cnt < maxsize / sizeof (long);
  406. cnt <<= 1) {
  407. addr = base + cnt; /* pointer arith! */
  408. save1 = *addr; /* save contents of addr */
  409. save2 = *b; /* save contents of base */
  410. *addr = cnt; /* write cnt to addr */
  411. *b = 0; /* put null at base */
  412. /* check at base address */
  413. if ((*b) != 0) {
  414. *addr = save1; /* restore *addr */
  415. *b = save2; /* restore *b */
  416. return (0);
  417. }
  418. val = *addr; /* read *addr */
  419. *addr = save1;
  420. *b = save2;
  421. if (val != cnt) {
  422. /* fix boundary condition.. STARTVAL means zero */
  423. if (cnt == STARTVAL / sizeof (long))
  424. cnt = 0;
  425. return (cnt * sizeof (long));
  426. }
  427. }
  428. return maxsize;
  429. }
  430. /* ------------------------------------------------------------------------- */
  431. /* U-Boot interface function to SDRAM init - this is where all the
  432. * controlling logic happens */
  433. long int initdram (int board_type)
  434. {
  435. ulong checkbank[4] = {[0 ... 3] = 0 };
  436. int bank_no;
  437. ulong total;
  438. int nhr;
  439. sdram_info_t dimm_info[2];
  440. /* first, use the SPD to get info about the SDRAM */
  441. /* check the NHR bit and skip mem init if it's already done */
  442. nhr = get_hid0 () & (1 << 16);
  443. if (nhr) {
  444. printf ("Skipping SDRAM setup due to NHR bit being set\n");
  445. } else {
  446. /* DIMM0 */
  447. check_dimm (0, &dimm_info[0]);
  448. /* DIMM1 */
  449. #ifndef CONFIG_EVB64260_750CX /* EVB64260_750CX has only 1 DIMM */
  450. check_dimm (1, &dimm_info[1]);
  451. #else /* CONFIG_EVB64260_750CX */
  452. memset (&dimm_info[1], 0, sizeof (sdram_info_t));
  453. #endif
  454. /* unmap all banks */
  455. memory_map_bank (0, 0, 0);
  456. memory_map_bank (1, 0, 0);
  457. memory_map_bank (2, 0, 0);
  458. memory_map_bank (3, 0, 0);
  459. /* Now, program the GT with the correct values */
  460. if (setup_sdram_common (dimm_info)) {
  461. printf ("Setup common failed.\n");
  462. }
  463. if (setup_sdram (&dimm_info[0])) {
  464. printf ("Setup for DIMM1 failed.\n");
  465. }
  466. if (setup_sdram (&dimm_info[1])) {
  467. printf ("Setup for DIMM2 failed.\n");
  468. }
  469. /* set the NHR bit */
  470. set_hid0 (get_hid0 () | (1 << 16));
  471. }
  472. /* next, size the SDRAM banks */
  473. total = 0;
  474. if (dimm_info[0].banks > 0)
  475. checkbank[0] = 1;
  476. if (dimm_info[0].banks > 1)
  477. checkbank[1] = 1;
  478. if (dimm_info[0].banks > 2)
  479. printf ("Error, SPD claims DIMM1 has >2 banks\n");
  480. if (dimm_info[1].banks > 0)
  481. checkbank[2] = 1;
  482. if (dimm_info[1].banks > 1)
  483. checkbank[3] = 1;
  484. if (dimm_info[1].banks > 2)
  485. printf ("Error, SPD claims DIMM2 has >2 banks\n");
  486. /* Generic dram sizer: works even if we don't have i2c DIMMs,
  487. * as long as the timing settings are more or less correct */
  488. /*
  489. * pass 1: size all the banks, using first bat (0-256M)
  490. * limitation: we only support 256M per bank due to
  491. * us only having 1 BAT for all DRAM
  492. */
  493. for (bank_no = 0; bank_no < CFG_DRAM_BANKS; bank_no++) {
  494. /* skip over banks that are not populated */
  495. if (!checkbank[bank_no])
  496. continue;
  497. DP (printf ("checking bank %d\n", bank_no));
  498. memory_map_bank (bank_no, 0, GB / 4);
  499. checkbank[bank_no] = dram_size (NULL, GB / 4);
  500. memory_map_bank (bank_no, 0, 0);
  501. DP (printf ("bank %d %08lx\n", bank_no, checkbank[bank_no]));
  502. }
  503. /*
  504. * pass 2: contiguously map each bank into physical address
  505. * space.
  506. */
  507. dimm_info[0].banks = dimm_info[1].banks = 0;
  508. for (bank_no = 0; bank_no < CFG_DRAM_BANKS; bank_no++) {
  509. if (!checkbank[bank_no])
  510. continue;
  511. dimm_info[bank_no / 2].banks++;
  512. dimm_info[bank_no / 2].size += checkbank[bank_no];
  513. memory_map_bank (bank_no, total, checkbank[bank_no]);
  514. #ifdef MAP_PCI
  515. memory_map_bank_pci (bank_no, total, checkbank[bank_no]);
  516. #endif
  517. total += checkbank[bank_no];
  518. }
  519. #ifdef CONFIG_ECC
  520. #ifdef CONFIG_ZUMA_V2
  521. /*
  522. * We always enable ECC when bank 2 and 3 are unpopulated
  523. * If we 2 or 3 are populated, we CAN'T support ECC.
  524. * (Zuma boards only support ECC in banks 0 and 1; assume that
  525. * in that configuration, ECC chips are mounted, even for stacked
  526. * chips)
  527. */
  528. if (checkbank[2] == 0 && checkbank[3] == 0) {
  529. dimm_info[0].ecc = 2;
  530. GT_REG_WRITE (SDRAM_TIMING,
  531. GTREGREAD (SDRAM_TIMING) | (1 << 13));
  532. /* TODO: do we have to run MRS cycles again? */
  533. }
  534. #endif /* CONFIG_ZUMA_V2 */
  535. if (GTREGREAD (SDRAM_TIMING) & (1 << 13)) {
  536. puts ("[ECC] ");
  537. }
  538. #endif /* CONFIG_ECC */
  539. #ifdef DEBUG
  540. dump_dimm_info (&dimm_info[0]);
  541. dump_dimm_info (&dimm_info[1]);
  542. #endif
  543. /* TODO: return at MOST 256M? */
  544. /* return total > GB/4 ? GB/4 : total; */
  545. return total;
  546. }