init_helpers.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /*
  2. * (C) Copyright 2011
  3. * Graeme Russ, <graeme.russ@gmail.com>
  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 <command.h>
  25. #include <stdio_dev.h>
  26. #include <version.h>
  27. #include <malloc.h>
  28. #include <net.h>
  29. #include <ide.h>
  30. #include <serial.h>
  31. #include <status_led.h>
  32. #include <asm/u-boot-x86.h>
  33. #include <asm/init_helpers.h>
  34. DECLARE_GLOBAL_DATA_PTR;
  35. /************************************************************************
  36. * Init Utilities *
  37. ************************************************************************
  38. * Some of this code should be moved into the core functions,
  39. * or dropped completely,
  40. * but let's get it working (again) first...
  41. */
  42. int display_banner(void)
  43. {
  44. printf("\n\n%s\n\n", version_string);
  45. return 0;
  46. }
  47. int display_dram_config(void)
  48. {
  49. int i;
  50. puts("DRAM Configuration:\n");
  51. for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
  52. printf("Bank #%d: %08lx ", i, gd->bd->bi_dram[i].start);
  53. print_size(gd->bd->bi_dram[i].size, "\n");
  54. }
  55. return 0;
  56. }
  57. int init_baudrate_f(void)
  58. {
  59. gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE);
  60. return 0;
  61. }
  62. int mem_malloc_init_r(void)
  63. {
  64. mem_malloc_init(((gd->relocaddr - CONFIG_SYS_MALLOC_LEN)+3)&~3,
  65. CONFIG_SYS_MALLOC_LEN);
  66. return 0;
  67. }
  68. bd_t bd_data;
  69. int init_bd_struct_r(void)
  70. {
  71. gd->bd = &bd_data;
  72. memset(gd->bd, 0, sizeof(bd_t));
  73. return 0;
  74. }
  75. #ifndef CONFIG_SYS_NO_FLASH
  76. int flash_init_r(void)
  77. {
  78. ulong size;
  79. puts("Flash: ");
  80. /* configure available FLASH banks */
  81. size = flash_init();
  82. print_size(size, "\n");
  83. return 0;
  84. }
  85. #endif
  86. int init_ip_address_r(void)
  87. {
  88. /* IP Address */
  89. bd_data.bi_ip_addr = getenv_IPaddr("ipaddr");
  90. return 0;
  91. }
  92. #ifdef CONFIG_STATUS_LED
  93. int status_led_set_r(void)
  94. {
  95. status_led_set(STATUS_LED_BOOT, STATUS_LED_BLINKING);
  96. return 0;
  97. }
  98. #endif
  99. int set_bootfile_r(void)
  100. {
  101. char *s;
  102. s = getenv("bootfile");
  103. if (s != NULL)
  104. copy_filename(BootFile, s, sizeof(BootFile));
  105. return 0;
  106. }
  107. int set_load_addr_r(void)
  108. {
  109. /* Initialize from environment */
  110. load_addr = getenv_ulong("loadaddr", 16, load_addr);
  111. return 0;
  112. }