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