board.c 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252
  1. /*
  2. * (C) Copyright 2000-2006
  3. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  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. #include <common.h>
  24. #include <watchdog.h>
  25. #include <command.h>
  26. #include <malloc.h>
  27. #include <devices.h>
  28. #ifdef CONFIG_8xx
  29. #include <mpc8xx.h>
  30. #endif
  31. #ifdef CONFIG_5xx
  32. #include <mpc5xx.h>
  33. #endif
  34. #ifdef CONFIG_MPC5xxx
  35. #include <mpc5xxx.h>
  36. #endif
  37. #if defined(CONFIG_CMD_IDE)
  38. #include <ide.h>
  39. #endif
  40. #if defined(CONFIG_CMD_SCSI)
  41. #include <scsi.h>
  42. #endif
  43. #if defined(CONFIG_CMD_KGDB)
  44. #include <kgdb.h>
  45. #endif
  46. #ifdef CONFIG_STATUS_LED
  47. #include <status_led.h>
  48. #endif
  49. #include <net.h>
  50. #ifdef CONFIG_GENERIC_MMC
  51. #include <mmc.h>
  52. #endif
  53. #include <serial.h>
  54. #ifdef CONFIG_SYS_ALLOC_DPRAM
  55. #if !defined(CONFIG_CPM2)
  56. #include <commproc.h>
  57. #endif
  58. #endif
  59. #include <version.h>
  60. #if defined(CONFIG_BAB7xx)
  61. #include <w83c553f.h>
  62. #endif
  63. #include <dtt.h>
  64. #if defined(CONFIG_POST)
  65. #include <post.h>
  66. #endif
  67. #if defined(CONFIG_LOGBUFFER)
  68. #include <logbuff.h>
  69. #endif
  70. #if defined(CONFIG_SYS_INIT_RAM_LOCK) && defined(CONFIG_E500)
  71. #include <asm/cache.h>
  72. #endif
  73. #ifdef CONFIG_PS2KBD
  74. #include <keyboard.h>
  75. #endif
  76. #ifdef CONFIG_ADDR_MAP
  77. #include <asm/mmu.h>
  78. #endif
  79. #ifdef CONFIG_SYS_UPDATE_FLASH_SIZE
  80. extern int update_flash_size (int flash_size);
  81. #endif
  82. #if defined(CONFIG_SC3)
  83. extern void sc3_read_eeprom(void);
  84. #endif
  85. #if defined(CONFIG_CMD_DOC)
  86. void doc_init (void);
  87. #endif
  88. #if defined(CONFIG_HARD_I2C) || \
  89. defined(CONFIG_SOFT_I2C)
  90. #include <i2c.h>
  91. #endif
  92. #include <spi.h>
  93. #include <nand.h>
  94. static char *failed = "*** failed ***\n";
  95. #if defined(CONFIG_OXC) || defined(CONFIG_PCU_E) || defined(CONFIG_RMU)
  96. extern flash_info_t flash_info[];
  97. #endif
  98. #if defined(CONFIG_START_IDE)
  99. extern int board_start_ide(void);
  100. #endif
  101. #include <environment.h>
  102. DECLARE_GLOBAL_DATA_PTR;
  103. #if defined(CONFIG_ENV_IS_EMBEDDED)
  104. #define TOTAL_MALLOC_LEN CONFIG_SYS_MALLOC_LEN
  105. #elif ( ((CONFIG_ENV_ADDR+CONFIG_ENV_SIZE) < CONFIG_SYS_MONITOR_BASE) || \
  106. (CONFIG_ENV_ADDR >= (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN)) ) || \
  107. defined(CONFIG_ENV_IS_IN_NVRAM)
  108. #define TOTAL_MALLOC_LEN (CONFIG_SYS_MALLOC_LEN + CONFIG_ENV_SIZE)
  109. #else
  110. #define TOTAL_MALLOC_LEN CONFIG_SYS_MALLOC_LEN
  111. #endif
  112. #if !defined(CONFIG_SYS_MEM_TOP_HIDE)
  113. #define CONFIG_SYS_MEM_TOP_HIDE 0
  114. #endif
  115. extern ulong __init_end;
  116. extern ulong _end;
  117. ulong monitor_flash_len;
  118. #if defined(CONFIG_CMD_BEDBUG)
  119. #include <bedbug/type.h>
  120. #endif
  121. /*
  122. * Begin and End of memory area for malloc(), and current "brk"
  123. */
  124. static ulong mem_malloc_start = 0;
  125. static ulong mem_malloc_end = 0;
  126. static ulong mem_malloc_brk = 0;
  127. /************************************************************************
  128. * Utilities *
  129. ************************************************************************
  130. */
  131. /*
  132. * The Malloc area is immediately below the monitor copy in DRAM
  133. */
  134. static void mem_malloc_init (void)
  135. {
  136. #if !defined(CONFIG_RELOC_FIXUP_WORKS)
  137. mem_malloc_end = CONFIG_SYS_MONITOR_BASE + gd->reloc_off;
  138. #endif
  139. mem_malloc_start = mem_malloc_end - TOTAL_MALLOC_LEN;
  140. mem_malloc_brk = mem_malloc_start;
  141. memset ((void *) mem_malloc_start,
  142. 0,
  143. mem_malloc_end - mem_malloc_start);
  144. }
  145. void *sbrk (ptrdiff_t increment)
  146. {
  147. ulong old = mem_malloc_brk;
  148. ulong new = old + increment;
  149. if ((new < mem_malloc_start) || (new > mem_malloc_end)) {
  150. return (NULL);
  151. }
  152. mem_malloc_brk = new;
  153. return ((void *) old);
  154. }
  155. /*
  156. * All attempts to come up with a "common" initialization sequence
  157. * that works for all boards and architectures failed: some of the
  158. * requirements are just _too_ different. To get rid of the resulting
  159. * mess of board dependend #ifdef'ed code we now make the whole
  160. * initialization sequence configurable to the user.
  161. *
  162. * The requirements for any new initalization function is simple: it
  163. * receives a pointer to the "global data" structure as it's only
  164. * argument, and returns an integer return code, where 0 means
  165. * "continue" and != 0 means "fatal error, hang the system".
  166. */
  167. typedef int (init_fnc_t) (void);
  168. /************************************************************************
  169. * Init Utilities *
  170. ************************************************************************
  171. * Some of this code should be moved into the core functions,
  172. * but let's get it working (again) first...
  173. */
  174. static int init_baudrate (void)
  175. {
  176. char tmp[64]; /* long enough for environment variables */
  177. int i = getenv_r ("baudrate", tmp, sizeof (tmp));
  178. gd->baudrate = (i > 0)
  179. ? (int) simple_strtoul (tmp, NULL, 10)
  180. : CONFIG_BAUDRATE;
  181. return (0);
  182. }
  183. /***********************************************************************/
  184. void __board_add_ram_info(int use_default)
  185. {
  186. /* please define platform specific board_add_ram_info() */
  187. }
  188. void board_add_ram_info(int) __attribute__((weak, alias("__board_add_ram_info")));
  189. static int init_func_ram (void)
  190. {
  191. #ifdef CONFIG_BOARD_TYPES
  192. int board_type = gd->board_type;
  193. #else
  194. int board_type = 0; /* use dummy arg */
  195. #endif
  196. puts ("DRAM: ");
  197. if ((gd->ram_size = initdram (board_type)) > 0) {
  198. print_size (gd->ram_size, "");
  199. board_add_ram_info(0);
  200. putc('\n');
  201. return (0);
  202. }
  203. puts (failed);
  204. return (1);
  205. }
  206. /***********************************************************************/
  207. #if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
  208. static int init_func_i2c (void)
  209. {
  210. puts ("I2C: ");
  211. i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
  212. puts ("ready\n");
  213. return (0);
  214. }
  215. #endif
  216. #if defined(CONFIG_HARD_SPI)
  217. static int init_func_spi (void)
  218. {
  219. puts ("SPI: ");
  220. spi_init ();
  221. puts ("ready\n");
  222. return (0);
  223. }
  224. #endif
  225. /***********************************************************************/
  226. #if defined(CONFIG_WATCHDOG)
  227. static int init_func_watchdog_init (void)
  228. {
  229. puts (" Watchdog enabled\n");
  230. WATCHDOG_RESET ();
  231. return (0);
  232. }
  233. # define INIT_FUNC_WATCHDOG_INIT init_func_watchdog_init,
  234. static int init_func_watchdog_reset (void)
  235. {
  236. WATCHDOG_RESET ();
  237. return (0);
  238. }
  239. # define INIT_FUNC_WATCHDOG_RESET init_func_watchdog_reset,
  240. #else
  241. # define INIT_FUNC_WATCHDOG_INIT /* undef */
  242. # define INIT_FUNC_WATCHDOG_RESET /* undef */
  243. #endif /* CONFIG_WATCHDOG */
  244. /************************************************************************
  245. * Initialization sequence *
  246. ************************************************************************
  247. */
  248. init_fnc_t *init_sequence[] = {
  249. #if defined(CONFIG_BOARD_EARLY_INIT_F)
  250. board_early_init_f,
  251. #endif
  252. #if !defined(CONFIG_8xx_CPUCLK_DEFAULT)
  253. get_clocks, /* get CPU and bus clocks (etc.) */
  254. #if defined(CONFIG_TQM8xxL) && !defined(CONFIG_TQM866M) \
  255. && !defined(CONFIG_TQM885D)
  256. adjust_sdram_tbs_8xx,
  257. #endif
  258. init_timebase,
  259. #endif
  260. #ifdef CONFIG_SYS_ALLOC_DPRAM
  261. #if !defined(CONFIG_CPM2)
  262. dpram_init,
  263. #endif
  264. #endif
  265. #if defined(CONFIG_BOARD_POSTCLK_INIT)
  266. board_postclk_init,
  267. #endif
  268. env_init,
  269. #if defined(CONFIG_8xx_CPUCLK_DEFAULT)
  270. get_clocks_866, /* get CPU and bus clocks according to the environment variable */
  271. sdram_adjust_866, /* adjust sdram refresh rate according to the new clock */
  272. init_timebase,
  273. #endif
  274. init_baudrate,
  275. serial_init,
  276. console_init_f,
  277. display_options,
  278. #if defined(CONFIG_8260)
  279. prt_8260_rsr,
  280. prt_8260_clks,
  281. #endif /* CONFIG_8260 */
  282. #if defined(CONFIG_MPC83XX)
  283. prt_83xx_rsr,
  284. #endif
  285. checkcpu,
  286. #if defined(CONFIG_MPC5xxx)
  287. prt_mpc5xxx_clks,
  288. #endif /* CONFIG_MPC5xxx */
  289. #if defined(CONFIG_MPC8220)
  290. prt_mpc8220_clks,
  291. #endif
  292. checkboard,
  293. INIT_FUNC_WATCHDOG_INIT
  294. #if defined(CONFIG_MISC_INIT_F)
  295. misc_init_f,
  296. #endif
  297. INIT_FUNC_WATCHDOG_RESET
  298. #if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
  299. init_func_i2c,
  300. #endif
  301. #if defined(CONFIG_HARD_SPI)
  302. init_func_spi,
  303. #endif
  304. #ifdef CONFIG_POST
  305. post_init_f,
  306. #endif
  307. INIT_FUNC_WATCHDOG_RESET
  308. init_func_ram,
  309. #if defined(CONFIG_SYS_DRAM_TEST)
  310. testdram,
  311. #endif /* CONFIG_SYS_DRAM_TEST */
  312. INIT_FUNC_WATCHDOG_RESET
  313. NULL, /* Terminate this list */
  314. };
  315. ulong get_effective_memsize(void)
  316. {
  317. #ifndef CONFIG_VERY_BIG_RAM
  318. return gd->ram_size;
  319. #else
  320. /* limit stack to what we can reasonable map */
  321. return ((gd->ram_size > CONFIG_MAX_MEM_MAPPED) ?
  322. CONFIG_MAX_MEM_MAPPED : gd->ram_size);
  323. #endif
  324. }
  325. /************************************************************************
  326. *
  327. * This is the first part of the initialization sequence that is
  328. * implemented in C, but still running from ROM.
  329. *
  330. * The main purpose is to provide a (serial) console interface as
  331. * soon as possible (so we can see any error messages), and to
  332. * initialize the RAM so that we can relocate the monitor code to
  333. * RAM.
  334. *
  335. * Be aware of the restrictions: global data is read-only, BSS is not
  336. * initialized, and stack space is limited to a few kB.
  337. *
  338. ************************************************************************
  339. */
  340. #ifdef CONFIG_LOGBUFFER
  341. unsigned long logbuffer_base(void)
  342. {
  343. return CONFIG_SYS_SDRAM_BASE + get_effective_memsize() - LOGBUFF_LEN;
  344. }
  345. #endif
  346. void board_init_f (ulong bootflag)
  347. {
  348. bd_t *bd;
  349. ulong len, addr, addr_sp;
  350. ulong *s;
  351. gd_t *id;
  352. init_fnc_t **init_fnc_ptr;
  353. #ifdef CONFIG_PRAM
  354. int i;
  355. ulong reg;
  356. uchar tmp[64]; /* long enough for environment variables */
  357. #endif
  358. /* Pointer is writable since we allocated a register for it */
  359. gd = (gd_t *) (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_GBL_DATA_OFFSET);
  360. /* compiler optimization barrier needed for GCC >= 3.4 */
  361. __asm__ __volatile__("": : :"memory");
  362. #if !defined(CONFIG_CPM2) && !defined(CONFIG_MPC83XX) && \
  363. !defined(CONFIG_MPC85xx) && !defined(CONFIG_MPC86xx)
  364. /* Clear initial global data */
  365. memset ((void *) gd, 0, sizeof (gd_t));
  366. #endif
  367. for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
  368. if ((*init_fnc_ptr) () != 0) {
  369. hang ();
  370. }
  371. }
  372. /*
  373. * Now that we have DRAM mapped and working, we can
  374. * relocate the code and continue running from DRAM.
  375. *
  376. * Reserve memory at end of RAM for (top down in that order):
  377. * - area that won't get touched by U-Boot and Linux (optional)
  378. * - kernel log buffer
  379. * - protected RAM
  380. * - LCD framebuffer
  381. * - monitor code
  382. * - board info struct
  383. */
  384. len = (ulong)&_end - CONFIG_SYS_MONITOR_BASE;
  385. /*
  386. * Subtract specified amount of memory to hide so that it won't
  387. * get "touched" at all by U-Boot. By fixing up gd->ram_size
  388. * the Linux kernel should now get passed the now "corrected"
  389. * memory size and won't touch it either. This should work
  390. * for arch/ppc and arch/powerpc. Only Linux board ports in
  391. * arch/powerpc with bootwrapper support, that recalculate the
  392. * memory size from the SDRAM controller setup will have to
  393. * get fixed.
  394. */
  395. gd->ram_size -= CONFIG_SYS_MEM_TOP_HIDE;
  396. addr = CONFIG_SYS_SDRAM_BASE + get_effective_memsize();
  397. #ifdef CONFIG_LOGBUFFER
  398. #ifndef CONFIG_ALT_LB_ADDR
  399. /* reserve kernel log buffer */
  400. addr -= (LOGBUFF_RESERVE);
  401. debug ("Reserving %dk for kernel logbuffer at %08lx\n", LOGBUFF_LEN, addr);
  402. #endif
  403. #endif
  404. #ifdef CONFIG_PRAM
  405. /*
  406. * reserve protected RAM
  407. */
  408. i = getenv_r ("pram", (char *)tmp, sizeof (tmp));
  409. reg = (i > 0) ? simple_strtoul ((const char *)tmp, NULL, 10) : CONFIG_PRAM;
  410. addr -= (reg << 10); /* size is in kB */
  411. debug ("Reserving %ldk for protected RAM at %08lx\n", reg, addr);
  412. #endif /* CONFIG_PRAM */
  413. /* round down to next 4 kB limit */
  414. addr &= ~(4096 - 1);
  415. debug ("Top of RAM usable for U-Boot at: %08lx\n", addr);
  416. #ifdef CONFIG_LCD
  417. /* reserve memory for LCD display (always full pages) */
  418. addr = lcd_setmem (addr);
  419. gd->fb_base = addr;
  420. #endif /* CONFIG_LCD */
  421. #if defined(CONFIG_VIDEO) && defined(CONFIG_8xx)
  422. /* reserve memory for video display (always full pages) */
  423. addr = video_setmem (addr);
  424. gd->fb_base = addr;
  425. #endif /* CONFIG_VIDEO */
  426. /*
  427. * reserve memory for U-Boot code, data & bss
  428. * round down to next 4 kB limit
  429. */
  430. addr -= len;
  431. addr &= ~(4096 - 1);
  432. #ifdef CONFIG_E500
  433. /* round down to next 64 kB limit so that IVPR stays aligned */
  434. addr &= ~(65536 - 1);
  435. #endif
  436. debug ("Reserving %ldk for U-Boot at: %08lx\n", len >> 10, addr);
  437. #ifdef CONFIG_AMIGAONEG3SE
  438. gd->relocaddr = addr;
  439. #endif
  440. /*
  441. * reserve memory for malloc() arena
  442. */
  443. addr_sp = addr - TOTAL_MALLOC_LEN;
  444. debug ("Reserving %dk for malloc() at: %08lx\n",
  445. TOTAL_MALLOC_LEN >> 10, addr_sp);
  446. /*
  447. * (permanently) allocate a Board Info struct
  448. * and a permanent copy of the "global" data
  449. */
  450. addr_sp -= sizeof (bd_t);
  451. bd = (bd_t *) addr_sp;
  452. gd->bd = bd;
  453. debug ("Reserving %zu Bytes for Board Info at: %08lx\n",
  454. sizeof (bd_t), addr_sp);
  455. addr_sp -= sizeof (gd_t);
  456. id = (gd_t *) addr_sp;
  457. debug ("Reserving %zu Bytes for Global Data at: %08lx\n",
  458. sizeof (gd_t), addr_sp);
  459. /*
  460. * Finally, we set up a new (bigger) stack.
  461. *
  462. * Leave some safety gap for SP, force alignment on 16 byte boundary
  463. * Clear initial stack frame
  464. */
  465. addr_sp -= 16;
  466. addr_sp &= ~0xF;
  467. s = (ulong *)addr_sp;
  468. *s-- = 0;
  469. *s-- = 0;
  470. addr_sp = (ulong)s;
  471. debug ("Stack Pointer at: %08lx\n", addr_sp);
  472. /*
  473. * Save local variables to board info struct
  474. */
  475. bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; /* start of DRAM memory */
  476. bd->bi_memsize = gd->ram_size; /* size of DRAM memory in bytes */
  477. #ifdef CONFIG_IP860
  478. bd->bi_sramstart = SRAM_BASE; /* start of SRAM memory */
  479. bd->bi_sramsize = SRAM_SIZE; /* size of SRAM memory */
  480. #elif defined CONFIG_MPC8220
  481. bd->bi_sramstart = CONFIG_SYS_SRAM_BASE; /* start of SRAM memory */
  482. bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE; /* size of SRAM memory */
  483. #else
  484. bd->bi_sramstart = 0; /* FIXME */ /* start of SRAM memory */
  485. bd->bi_sramsize = 0; /* FIXME */ /* size of SRAM memory */
  486. #endif
  487. #if defined(CONFIG_8xx) || defined(CONFIG_8260) || defined(CONFIG_5xx) || \
  488. defined(CONFIG_E500) || defined(CONFIG_MPC86xx)
  489. bd->bi_immr_base = CONFIG_SYS_IMMR; /* base of IMMR register */
  490. #endif
  491. #if defined(CONFIG_MPC5xxx)
  492. bd->bi_mbar_base = CONFIG_SYS_MBAR; /* base of internal registers */
  493. #endif
  494. #if defined(CONFIG_MPC83XX)
  495. bd->bi_immrbar = CONFIG_SYS_IMMR;
  496. #endif
  497. #if defined(CONFIG_MPC8220)
  498. bd->bi_mbar_base = CONFIG_SYS_MBAR; /* base of internal registers */
  499. bd->bi_inpfreq = gd->inp_clk;
  500. bd->bi_pcifreq = gd->pci_clk;
  501. bd->bi_vcofreq = gd->vco_clk;
  502. bd->bi_pevfreq = gd->pev_clk;
  503. bd->bi_flbfreq = gd->flb_clk;
  504. /* store bootparam to sram (backward compatible), here? */
  505. {
  506. u32 *sram = (u32 *)CONFIG_SYS_SRAM_BASE;
  507. *sram++ = gd->ram_size;
  508. *sram++ = gd->bus_clk;
  509. *sram++ = gd->inp_clk;
  510. *sram++ = gd->cpu_clk;
  511. *sram++ = gd->vco_clk;
  512. *sram++ = gd->flb_clk;
  513. *sram++ = 0xb8c3ba11; /* boot signature */
  514. }
  515. #endif
  516. bd->bi_bootflags = bootflag; /* boot / reboot flag (for LynxOS) */
  517. WATCHDOG_RESET ();
  518. bd->bi_intfreq = gd->cpu_clk; /* Internal Freq, in Hz */
  519. bd->bi_busfreq = gd->bus_clk; /* Bus Freq, in Hz */
  520. #if defined(CONFIG_CPM2)
  521. bd->bi_cpmfreq = gd->cpm_clk;
  522. bd->bi_brgfreq = gd->brg_clk;
  523. bd->bi_sccfreq = gd->scc_clk;
  524. bd->bi_vco = gd->vco_out;
  525. #endif /* CONFIG_CPM2 */
  526. #if defined(CONFIG_MPC512X)
  527. bd->bi_ipsfreq = gd->ips_clk;
  528. #endif /* CONFIG_MPC512X */
  529. #if defined(CONFIG_MPC5xxx)
  530. bd->bi_ipbfreq = gd->ipb_clk;
  531. bd->bi_pcifreq = gd->pci_clk;
  532. #endif /* CONFIG_MPC5xxx */
  533. bd->bi_baudrate = gd->baudrate; /* Console Baudrate */
  534. #ifdef CONFIG_SYS_EXTBDINFO
  535. strncpy ((char *)bd->bi_s_version, "1.2", sizeof (bd->bi_s_version));
  536. strncpy ((char *)bd->bi_r_version, U_BOOT_VERSION, sizeof (bd->bi_r_version));
  537. bd->bi_procfreq = gd->cpu_clk; /* Processor Speed, In Hz */
  538. bd->bi_plb_busfreq = gd->bus_clk;
  539. #if defined(CONFIG_405GP) || defined(CONFIG_405EP) || \
  540. defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
  541. defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
  542. bd->bi_pci_busfreq = get_PCI_freq ();
  543. bd->bi_opbfreq = get_OPB_freq ();
  544. #elif defined(CONFIG_XILINX_405)
  545. bd->bi_pci_busfreq = get_PCI_freq ();
  546. #endif
  547. #endif
  548. debug ("New Stack Pointer is: %08lx\n", addr_sp);
  549. WATCHDOG_RESET ();
  550. #ifdef CONFIG_POST
  551. post_bootmode_init();
  552. post_run (NULL, POST_ROM | post_bootmode_get(0));
  553. #endif
  554. WATCHDOG_RESET();
  555. memcpy (id, (void *)gd, sizeof (gd_t));
  556. relocate_code (addr_sp, id, addr);
  557. /* NOTREACHED - relocate_code() does not return */
  558. }
  559. /************************************************************************
  560. *
  561. * This is the next part if the initialization sequence: we are now
  562. * running from RAM and have a "normal" C environment, i. e. global
  563. * data can be written, BSS has been cleared, the stack size in not
  564. * that critical any more, etc.
  565. *
  566. ************************************************************************
  567. */
  568. void board_init_r (gd_t *id, ulong dest_addr)
  569. {
  570. cmd_tbl_t *cmdtp;
  571. char *s;
  572. bd_t *bd;
  573. extern void malloc_bin_reloc (void);
  574. #ifndef CONFIG_ENV_IS_NOWHERE
  575. extern char * env_name_spec;
  576. #endif
  577. #ifndef CONFIG_SYS_NO_FLASH
  578. ulong flash_size;
  579. #endif
  580. gd = id; /* initialize RAM version of global data */
  581. bd = gd->bd;
  582. gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */
  583. #if defined(CONFIG_RELOC_FIXUP_WORKS)
  584. gd->reloc_off = 0;
  585. mem_malloc_end = dest_addr;
  586. #else
  587. gd->reloc_off = dest_addr - CONFIG_SYS_MONITOR_BASE;
  588. #endif
  589. #ifdef CONFIG_SERIAL_MULTI
  590. serial_initialize();
  591. #endif
  592. debug ("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
  593. WATCHDOG_RESET ();
  594. /*
  595. * Setup trap handlers
  596. */
  597. trap_init (dest_addr);
  598. #ifdef CONFIG_ADDR_MAP
  599. init_addr_map();
  600. #endif
  601. #if defined(CONFIG_BOARD_EARLY_INIT_R)
  602. board_early_init_r ();
  603. #endif
  604. monitor_flash_len = (ulong)&__init_end - dest_addr;
  605. /*
  606. * We have to relocate the command table manually
  607. */
  608. for (cmdtp = &__u_boot_cmd_start; cmdtp != &__u_boot_cmd_end; cmdtp++) {
  609. ulong addr;
  610. addr = (ulong) (cmdtp->cmd) + gd->reloc_off;
  611. #if 0
  612. printf ("Command \"%s\": 0x%08lx => 0x%08lx\n",
  613. cmdtp->name, (ulong) (cmdtp->cmd), addr);
  614. #endif
  615. cmdtp->cmd =
  616. (int (*)(struct cmd_tbl_s *, int, int, char *[]))addr;
  617. addr = (ulong)(cmdtp->name) + gd->reloc_off;
  618. cmdtp->name = (char *)addr;
  619. if (cmdtp->usage) {
  620. addr = (ulong)(cmdtp->usage) + gd->reloc_off;
  621. cmdtp->usage = (char *)addr;
  622. }
  623. #ifdef CONFIG_SYS_LONGHELP
  624. if (cmdtp->help) {
  625. addr = (ulong)(cmdtp->help) + gd->reloc_off;
  626. cmdtp->help = (char *)addr;
  627. }
  628. #endif
  629. }
  630. /* there are some other pointer constants we must deal with */
  631. #ifndef CONFIG_ENV_IS_NOWHERE
  632. env_name_spec += gd->reloc_off;
  633. #endif
  634. WATCHDOG_RESET ();
  635. #ifdef CONFIG_LOGBUFFER
  636. logbuff_init_ptrs ();
  637. #endif
  638. #ifdef CONFIG_POST
  639. post_output_backlog ();
  640. post_reloc ();
  641. #endif
  642. WATCHDOG_RESET();
  643. #if defined(CONFIG_SYS_DELAYED_ICACHE) || defined(CONFIG_MPC83XX)
  644. icache_enable (); /* it's time to enable the instruction cache */
  645. #endif
  646. #if defined(CONFIG_SYS_INIT_RAM_LOCK) && defined(CONFIG_E500)
  647. unlock_ram_in_cache(); /* it's time to unlock D-cache in e500 */
  648. #endif
  649. #if defined(CONFIG_BAB7xx) || defined(CONFIG_CPC45)
  650. /*
  651. * Do PCI configuration on BAB7xx and CPC45 _before_ the flash
  652. * gets initialised, because we need the ISA resp. PCI_to_LOCAL bus
  653. * bridge there.
  654. */
  655. pci_init ();
  656. #endif
  657. #if defined(CONFIG_BAB7xx)
  658. /*
  659. * Initialise the ISA bridge
  660. */
  661. initialise_w83c553f ();
  662. #endif
  663. asm ("sync ; isync");
  664. #if !defined(CONFIG_SYS_NO_FLASH)
  665. puts ("FLASH: ");
  666. if ((flash_size = flash_init ()) > 0) {
  667. # ifdef CONFIG_SYS_FLASH_CHECKSUM
  668. print_size (flash_size, "");
  669. /*
  670. * Compute and print flash CRC if flashchecksum is set to 'y'
  671. *
  672. * NOTE: Maybe we should add some WATCHDOG_RESET()? XXX
  673. */
  674. s = getenv ("flashchecksum");
  675. if (s && (*s == 'y')) {
  676. printf (" CRC: %08X",
  677. crc32 (0, (const unsigned char *) CONFIG_SYS_FLASH_BASE, flash_size)
  678. );
  679. }
  680. putc ('\n');
  681. # else /* !CONFIG_SYS_FLASH_CHECKSUM */
  682. print_size (flash_size, "\n");
  683. # endif /* CONFIG_SYS_FLASH_CHECKSUM */
  684. } else {
  685. puts (failed);
  686. hang ();
  687. }
  688. bd->bi_flashstart = CONFIG_SYS_FLASH_BASE; /* update start of FLASH memory */
  689. bd->bi_flashsize = flash_size; /* size of FLASH memory (final value) */
  690. #if defined(CONFIG_SYS_UPDATE_FLASH_SIZE)
  691. /* Make a update of the Memctrl. */
  692. update_flash_size (flash_size);
  693. #endif
  694. # if defined(CONFIG_PCU_E) || defined(CONFIG_OXC) || defined(CONFIG_RMU)
  695. /* flash mapped at end of memory map */
  696. bd->bi_flashoffset = TEXT_BASE + flash_size;
  697. # elif CONFIG_SYS_MONITOR_BASE == CONFIG_SYS_FLASH_BASE
  698. bd->bi_flashoffset = monitor_flash_len; /* reserved area for startup monitor */
  699. # else
  700. bd->bi_flashoffset = 0;
  701. # endif
  702. #else /* CONFIG_SYS_NO_FLASH */
  703. bd->bi_flashsize = 0;
  704. bd->bi_flashstart = 0;
  705. bd->bi_flashoffset = 0;
  706. #endif /* !CONFIG_SYS_NO_FLASH */
  707. WATCHDOG_RESET ();
  708. /* initialize higher level parts of CPU like time base and timers */
  709. cpu_init_r ();
  710. WATCHDOG_RESET ();
  711. /* initialize malloc() area */
  712. mem_malloc_init ();
  713. malloc_bin_reloc ();
  714. #ifdef CONFIG_SPI
  715. # if !defined(CONFIG_ENV_IS_IN_EEPROM)
  716. spi_init_f ();
  717. # endif
  718. spi_init_r ();
  719. #endif
  720. #if defined(CONFIG_CMD_NAND)
  721. WATCHDOG_RESET ();
  722. puts ("NAND: ");
  723. nand_init(); /* go init the NAND */
  724. #endif
  725. /* relocate environment function pointers etc. */
  726. env_relocate ();
  727. /*
  728. * Fill in missing fields of bd_info.
  729. * We do this here, where we have "normal" access to the
  730. * environment; we used to do this still running from ROM,
  731. * where had to use getenv_r(), which can be pretty slow when
  732. * the environment is in EEPROM.
  733. */
  734. #if defined(CONFIG_SYS_EXTBDINFO)
  735. #if defined(CONFIG_405GP) || defined(CONFIG_405EP)
  736. #if defined(CONFIG_I2CFAST)
  737. /*
  738. * set bi_iic_fast for linux taking environment variable
  739. * "i2cfast" into account
  740. */
  741. {
  742. char *s = getenv ("i2cfast");
  743. if (s && ((*s == 'y') || (*s == 'Y'))) {
  744. bd->bi_iic_fast[0] = 1;
  745. bd->bi_iic_fast[1] = 1;
  746. } else {
  747. bd->bi_iic_fast[0] = 0;
  748. bd->bi_iic_fast[1] = 0;
  749. }
  750. }
  751. #else
  752. bd->bi_iic_fast[0] = 0;
  753. bd->bi_iic_fast[1] = 0;
  754. #endif /* CONFIG_I2CFAST */
  755. #endif /* CONFIG_405GP, CONFIG_405EP */
  756. #endif /* CONFIG_SYS_EXTBDINFO */
  757. #if defined(CONFIG_SC3)
  758. sc3_read_eeprom();
  759. #endif
  760. #if defined (CONFIG_ID_EEPROM) || defined (CONFIG_SYS_I2C_MAC_OFFSET)
  761. mac_read_from_eeprom();
  762. #endif
  763. #ifdef CONFIG_HERMES
  764. if ((gd->board_type >> 16) == 2)
  765. bd->bi_ethspeed = gd->board_type & 0xFFFF;
  766. else
  767. bd->bi_ethspeed = 0xFFFF;
  768. #endif
  769. /* kept around for legacy kernels only ... ignore the next section */
  770. eth_getenv_enetaddr("ethaddr", bd->bi_enetaddr);
  771. #ifdef CONFIG_HAS_ETH1
  772. eth_getenv_enetaddr("eth1addr", bd->bi_enet1addr);
  773. #endif
  774. #ifdef CONFIG_HAS_ETH2
  775. eth_getenv_enetaddr("eth2addr", bd->bi_enet2addr);
  776. #endif
  777. #ifdef CONFIG_HAS_ETH3
  778. eth_getenv_enetaddr("eth3addr", bd->bi_enet3addr);
  779. #endif
  780. #ifdef CONFIG_HAS_ETH4
  781. eth_getenv_enetaddr("eth4addr", bd->bi_enet4addr);
  782. #endif
  783. #ifdef CONFIG_HAS_ETH5
  784. eth_getenv_enetaddr("eth5addr", bd->bi_enet5addr);
  785. #endif
  786. /* IP Address */
  787. bd->bi_ip_addr = getenv_IPaddr ("ipaddr");
  788. WATCHDOG_RESET ();
  789. #if defined(CONFIG_PCI) && !defined(CONFIG_BAB7xx) && !defined(CONFIG_CPC45)
  790. /*
  791. * Do pci configuration
  792. */
  793. pci_init ();
  794. #endif
  795. /** leave this here (after malloc(), environment and PCI are working) **/
  796. /* Initialize devices */
  797. devices_init ();
  798. /* Initialize the jump table for applications */
  799. jumptable_init ();
  800. #if defined(CONFIG_API)
  801. /* Initialize API */
  802. api_init ();
  803. #endif
  804. /* Initialize the console (after the relocation and devices init) */
  805. console_init_r ();
  806. #if defined(CONFIG_CCM) || \
  807. defined(CONFIG_COGENT) || \
  808. defined(CONFIG_CPCI405) || \
  809. defined(CONFIG_EVB64260) || \
  810. defined(CONFIG_KUP4K) || \
  811. defined(CONFIG_KUP4X) || \
  812. defined(CONFIG_LWMON) || \
  813. defined(CONFIG_PCU_E) || \
  814. defined(CONFIG_SC3) || \
  815. defined(CONFIG_W7O) || \
  816. defined(CONFIG_MISC_INIT_R)
  817. /* miscellaneous platform dependent initialisations */
  818. misc_init_r ();
  819. #endif
  820. #ifdef CONFIG_HERMES
  821. if (bd->bi_ethspeed != 0xFFFF)
  822. hermes_start_lxt980 ((int) bd->bi_ethspeed);
  823. #endif
  824. #if defined(CONFIG_CMD_KGDB)
  825. WATCHDOG_RESET ();
  826. puts ("KGDB: ");
  827. kgdb_init ();
  828. #endif
  829. debug ("U-Boot relocated to %08lx\n", dest_addr);
  830. /*
  831. * Enable Interrupts
  832. */
  833. interrupt_init ();
  834. /* Must happen after interrupts are initialized since
  835. * an irq handler gets installed
  836. */
  837. #ifdef CONFIG_SERIAL_SOFTWARE_FIFO
  838. serial_buffered_init();
  839. #endif
  840. #if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
  841. status_led_set (STATUS_LED_BOOT, STATUS_LED_BLINKING);
  842. #endif
  843. udelay (20);
  844. set_timer (0);
  845. /* Initialize from environment */
  846. if ((s = getenv ("loadaddr")) != NULL) {
  847. load_addr = simple_strtoul (s, NULL, 16);
  848. }
  849. #if defined(CONFIG_CMD_NET)
  850. if ((s = getenv ("bootfile")) != NULL) {
  851. copy_filename (BootFile, s, sizeof (BootFile));
  852. }
  853. #endif
  854. WATCHDOG_RESET ();
  855. #if defined(CONFIG_DTT) /* Digital Thermometers and Thermostats */
  856. dtt_init ();
  857. #endif
  858. #if defined(CONFIG_CMD_SCSI)
  859. WATCHDOG_RESET ();
  860. puts ("SCSI: ");
  861. scsi_init ();
  862. #endif
  863. #ifdef CONFIG_GENERIC_MMC
  864. WATCHDOG_RESET ();
  865. puts ("MMC: ");
  866. mmc_initialize (bd);
  867. #endif
  868. #if defined(CONFIG_CMD_DOC)
  869. WATCHDOG_RESET ();
  870. puts ("DOC: ");
  871. doc_init ();
  872. #endif
  873. #if defined(CONFIG_CMD_NET)
  874. #if defined(CONFIG_NET_MULTI)
  875. WATCHDOG_RESET ();
  876. puts ("Net: ");
  877. #endif
  878. eth_initialize (bd);
  879. #endif
  880. #if defined(CONFIG_CMD_NET) && ( \
  881. defined(CONFIG_CCM) || \
  882. defined(CONFIG_ELPT860) || \
  883. defined(CONFIG_EP8260) || \
  884. defined(CONFIG_IP860) || \
  885. defined(CONFIG_IVML24) || \
  886. defined(CONFIG_IVMS8) || \
  887. defined(CONFIG_MPC8260ADS) || \
  888. defined(CONFIG_MPC8266ADS) || \
  889. defined(CONFIG_MPC8560ADS) || \
  890. defined(CONFIG_PCU_E) || \
  891. defined(CONFIG_RPXSUPER) || \
  892. defined(CONFIG_STXGP3) || \
  893. defined(CONFIG_SPD823TS) || \
  894. defined(CONFIG_RESET_PHY_R) )
  895. WATCHDOG_RESET ();
  896. debug ("Reset Ethernet PHY\n");
  897. reset_phy ();
  898. #endif
  899. #ifdef CONFIG_POST
  900. post_run (NULL, POST_RAM | post_bootmode_get(0));
  901. #endif
  902. #if defined(CONFIG_CMD_PCMCIA) \
  903. && !defined(CONFIG_CMD_IDE)
  904. WATCHDOG_RESET ();
  905. puts ("PCMCIA:");
  906. pcmcia_init ();
  907. #endif
  908. #if defined(CONFIG_CMD_IDE)
  909. WATCHDOG_RESET ();
  910. # ifdef CONFIG_IDE_8xx_PCCARD
  911. puts ("PCMCIA:");
  912. # else
  913. puts ("IDE: ");
  914. #endif
  915. #if defined(CONFIG_START_IDE)
  916. if (board_start_ide())
  917. ide_init ();
  918. #else
  919. ide_init ();
  920. #endif
  921. #endif
  922. #ifdef CONFIG_LAST_STAGE_INIT
  923. WATCHDOG_RESET ();
  924. /*
  925. * Some parts can be only initialized if all others (like
  926. * Interrupts) are up and running (i.e. the PC-style ISA
  927. * keyboard).
  928. */
  929. last_stage_init ();
  930. #endif
  931. #if defined(CONFIG_CMD_BEDBUG)
  932. WATCHDOG_RESET ();
  933. bedbug_init ();
  934. #endif
  935. #if defined(CONFIG_PRAM) || defined(CONFIG_LOGBUFFER)
  936. /*
  937. * Export available size of memory for Linux,
  938. * taking into account the protected RAM at top of memory
  939. */
  940. {
  941. ulong pram;
  942. uchar memsz[32];
  943. #ifdef CONFIG_PRAM
  944. char *s;
  945. if ((s = getenv ("pram")) != NULL) {
  946. pram = simple_strtoul (s, NULL, 10);
  947. } else {
  948. pram = CONFIG_PRAM;
  949. }
  950. #else
  951. pram=0;
  952. #endif
  953. #ifdef CONFIG_LOGBUFFER
  954. #ifndef CONFIG_ALT_LB_ADDR
  955. /* Also take the logbuffer into account (pram is in kB) */
  956. pram += (LOGBUFF_LEN+LOGBUFF_OVERHEAD)/1024;
  957. #endif
  958. #endif
  959. sprintf ((char *)memsz, "%ldk", (bd->bi_memsize / 1024) - pram);
  960. setenv ("mem", (char *)memsz);
  961. }
  962. #endif
  963. #ifdef CONFIG_PS2KBD
  964. puts ("PS/2: ");
  965. kbd_init();
  966. #endif
  967. #ifdef CONFIG_MODEM_SUPPORT
  968. {
  969. extern int do_mdm_init;
  970. do_mdm_init = gd->do_mdm_init;
  971. }
  972. #endif
  973. /* Initialization complete - start the monitor */
  974. /* main_loop() can return to retry autoboot, if so just run it again. */
  975. for (;;) {
  976. WATCHDOG_RESET ();
  977. main_loop ();
  978. }
  979. /* NOTREACHED - no way out of command loop except booting */
  980. }
  981. void hang (void)
  982. {
  983. puts ("### ERROR ### Please RESET the board ###\n");
  984. show_boot_progress(-30);
  985. for (;;);
  986. }
  987. #ifdef CONFIG_MODEM_SUPPORT
  988. /* called from main loop (common/main.c) */
  989. /* 'inline' - We have to do it fast */
  990. static inline void mdm_readline(char *buf, int bufsiz)
  991. {
  992. char c;
  993. char *p;
  994. int n;
  995. n = 0;
  996. p = buf;
  997. for(;;) {
  998. c = serial_getc();
  999. /* dbg("(%c)", c); */
  1000. switch(c) {
  1001. case '\r':
  1002. break;
  1003. case '\n':
  1004. *p = '\0';
  1005. return;
  1006. default:
  1007. if(n++ > bufsiz) {
  1008. *p = '\0';
  1009. return; /* sanity check */
  1010. }
  1011. *p = c;
  1012. p++;
  1013. break;
  1014. }
  1015. }
  1016. }
  1017. extern void dbg(const char *fmt, ...);
  1018. int mdm_init (void)
  1019. {
  1020. char env_str[16];
  1021. char *init_str;
  1022. int i;
  1023. extern char console_buffer[];
  1024. extern void enable_putc(void);
  1025. extern int hwflow_onoff(int);
  1026. enable_putc(); /* enable serial_putc() */
  1027. #ifdef CONFIG_HWFLOW
  1028. init_str = getenv("mdm_flow_control");
  1029. if (init_str && (strcmp(init_str, "rts/cts") == 0))
  1030. hwflow_onoff (1);
  1031. else
  1032. hwflow_onoff(-1);
  1033. #endif
  1034. for (i = 1;;i++) {
  1035. sprintf(env_str, "mdm_init%d", i);
  1036. if ((init_str = getenv(env_str)) != NULL) {
  1037. serial_puts(init_str);
  1038. serial_puts("\n");
  1039. for(;;) {
  1040. mdm_readline(console_buffer, CONFIG_SYS_CBSIZE);
  1041. dbg("ini%d: [%s]", i, console_buffer);
  1042. if ((strcmp(console_buffer, "OK") == 0) ||
  1043. (strcmp(console_buffer, "ERROR") == 0)) {
  1044. dbg("ini%d: cmd done", i);
  1045. break;
  1046. } else /* in case we are originating call ... */
  1047. if (strncmp(console_buffer, "CONNECT", 7) == 0) {
  1048. dbg("ini%d: connect", i);
  1049. return 0;
  1050. }
  1051. }
  1052. } else
  1053. break; /* no init string - stop modem init */
  1054. udelay(100000);
  1055. }
  1056. udelay(100000);
  1057. /* final stage - wait for connect */
  1058. for(;i > 1;) { /* if 'i' > 1 - wait for connection
  1059. message from modem */
  1060. mdm_readline(console_buffer, CONFIG_SYS_CBSIZE);
  1061. dbg("ini_f: [%s]", console_buffer);
  1062. if (strncmp(console_buffer, "CONNECT", 7) == 0) {
  1063. dbg("ini_f: connected");
  1064. return 0;
  1065. }
  1066. }
  1067. return 0;
  1068. }
  1069. #endif
  1070. #if 0 /* We could use plain global data, but the resulting code is bigger */
  1071. /*
  1072. * Pointer to initial global data area
  1073. *
  1074. * Here we initialize it.
  1075. */
  1076. #undef XTRN_DECLARE_GLOBAL_DATA_PTR
  1077. #define XTRN_DECLARE_GLOBAL_DATA_PTR /* empty = allocate here */
  1078. DECLARE_GLOBAL_DATA_PTR = (gd_t *) (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_GBL_DATA_OFFSET);
  1079. #endif /* 0 */
  1080. /************************************************************************/