예제 #1
0
파일: hw.c 프로젝트: webcraft13/grub-1
/*
 * grub_uboot_probe_memory():
 *   Queries U-Boot for available memory regions.
 *
 *   Sets up heap near the image in memory and sets up "start_of_ram".
 */
void
grub_uboot_mm_init (void)
{
  struct sys_info *si = grub_uboot_get_sys_info ();

  grub_mm_init_region ((void *) grub_modules_get_end (),
		       GRUB_KERNEL_MACHINE_HEAP_SIZE);

  if (si && (si->mr_no != 0))
    {
      int i;
      start_of_ram = GRUB_UINT_MAX;

      // first, search for the start address
      for (i = 0; i < si->mr_no; i++)
	if ((si->mr[i].flags & MR_ATTR_MASK) == MR_ATTR_DRAM)
	  if (si->mr[i].start < start_of_ram)
	    start_of_ram = si->mr[i].start;

      // then init memory regions for the others
      for (i = 0; i < si->mr_no; i++)
	if ((si->mr[i].flags & MR_ATTR_MASK) == MR_ATTR_DRAM)
	  if (si->mr[i].start != start_of_ram)
	    grub_mm_init_region ((void *) si->mr[i].start, si->mr[i].size);
    }
}
예제 #2
0
파일: init.c 프로젝트: WenhuaChang/grub2
void
grub_machine_init (void)
{
  int ver;

  /* First of all - establish connection with U-Boot */
  ver = grub_uboot_api_init ();
  if (!ver)
    {
      /* Don't even have a console to log errors to... */
      grub_exit ();
    }
  else if (ver > API_SIG_VERSION)
    {
      /* Try to print an error message */
      grub_uboot_puts ("invalid U-Boot API version\n");
    }

  /* Initialize the console so that GRUB can display messages.  */
  grub_console_init_early ();

  /* Enumerate memory and initialize the memory management system. */
  grub_uboot_mm_init ();

  /* Should be earlier but it needs memalign.  */
#ifdef __arm__
  grub_arm_enable_caches_mmu ();
#endif

  grub_dprintf ("init", "__bss_start: %p\n", __bss_start);
  grub_dprintf ("init", "_end: %p\n", _end);
  grub_dprintf ("init", "grub_modbase: %p\n", (void *) grub_modbase);
  grub_dprintf ("init", "grub_modules_get_end(): %p\n",
		(void *) grub_modules_get_end ());

  /* Initialise full terminfo support */
  grub_console_init_lately ();

  /* Enumerate uboot devices */
  grub_uboot_probe_hardware ();

  /* Initialise timer */
#ifdef __arm__
  if (grub_uboot_get_machine_type () == GRUB_ARM_MACHINE_TYPE_RASPBERRY_PI)
    {
      grub_install_get_time_ms (rpi_timer_ms);
    }
  else
#endif
    {
      timer_start = grub_uboot_get_timer (0);
      grub_install_get_time_ms (uboot_timer_ms);
    }

  /* Initialize  */
  grub_ubootdisk_init ();
}
예제 #3
0
파일: init.c 프로젝트: Firef0x/burg-new
static void
grub_heap_init (void)
{
  grub_mm_init_region ((void *) (grub_modules_get_end ()
				 + GRUB_KERNEL_MACHINE_STACK_SIZE), 0x200000);
}