Пример #1
0
EFI_STATUS
main(int argc, CHAR16 *argv[])
{
	EFI_LOADED_IMAGE *img;
	int i;

	/* 
	 * XXX Chicken-and-egg problem; we want to have console output
	 * early, but some console attributes may depend on reading from
	 * eg. the boot device, which we can't do yet.  We can use
	 * printf() etc. once this is done.
	 */
	cons_probe();

	/*
	 * Initialise the block cache
	 */
	bcache_init(32, 512);		/* 16k XXX tune this */

	find_pal_proc();

	/*
	 * March through the device switch probing for things.
	 */
	for (i = 0; devsw[i] != NULL; i++)
		if (devsw[i]->dv_init != NULL)
			(devsw[i]->dv_init)();

	efinet_init_driver();

	/* Get our loaded image protocol interface structure. */
	BS->HandleProtocol(IH, &imgid, (VOID**)&img);

	printf("Image base: 0x%016lx\n", (u_long)img->ImageBase);

	printf("\n");
	printf("%s, Revision %s\n", bootprog_name, bootprog_rev);
	printf("(%s, %s)\n", bootprog_maker, bootprog_date);

	i = efifs_get_unit(img->DeviceHandle);
	if (i >= 0) {
		currdev.d_dev = devsw[0];		/* XXX disk */
		currdev.d_kind.efidisk.unit = i;
		/* XXX should be able to detect this, default to autoprobe */
		currdev.d_kind.efidisk.slice = -1;
		currdev.d_kind.efidisk.partition = 0;
	} else {
		currdev.d_dev = devsw[1];		/* XXX net */
		currdev.d_kind.netif.unit = 0;		/* XXX */
	}
	currdev.d_type = currdev.d_dev->dv_type;

	/*
	 * Disable the watchdog timer. By default the boot manager sets
	 * the timer to 5 minutes before invoking a boot option. If we
	 * want to return to the boot manager, we have to disable the
	 * watchdog timer and since we're an interactive program, we don't
	 * want to wait until the user types "quit". The timer may have
	 * fired by then. We don't care if this fails. It does not prevent
	 * normal functioning in any way...
	 */
	BS->SetWatchdogTimer(0, 0, 0, NULL);

	env_setenv("currdev", EV_VOLATILE, efi_fmtdev(&currdev),
	    efi_setcurrdev, env_nounset);
	env_setenv("loaddev", EV_VOLATILE, efi_fmtdev(&currdev), env_noset,
	    env_nounset);

	setenv("LINES", "24", 1);	/* optional */
    
	archsw.arch_autoload = efi_autoload;
	archsw.arch_getdev = efi_getdev;
	archsw.arch_copyin = efi_copyin;
	archsw.arch_copyout = efi_copyout;
	archsw.arch_readin = efi_readin;

	interact();			/* doesn't return */

	return (EFI_SUCCESS);		/* keep compiler happy */
}
Пример #2
0
EFI_STATUS
main(int argc, CHAR16 *argv[])
{
    struct devdesc currdev;
    EFI_LOADED_IMAGE *img;
    char *dev;
    int i;

    /*
     * XXX Chicken-and-egg problem; we want to have console output
     * early, but some console attributes may depend on reading from
     * eg. the boot device, which we can't do yet.  We can use
     * printf() etc. once this is done.
     */
    cons_probe();

    printf("\n%s, Revision %s\n", bootprog_name, bootprog_rev);

    find_pal_proc();

    /*
     * March through the device switch probing for things.
     */
    for (i = 0; devsw[i] != NULL; i++)
        if (devsw[i]->dv_init != NULL)
            (devsw[i]->dv_init)();

    /*
     * Disable the watchdog timer. By default the boot manager sets
     * the timer to 5 minutes before invoking a boot option. If we
     * want to return to the boot manager, we have to disable the
     * watchdog timer and since we're an interactive program, we don't
     * want to wait until the user types "quit". The timer may have
     * fired by then. We don't care if this fails. It does not prevent
     * normal functioning in any way...
     */
    BS->SetWatchdogTimer(0, 0, 0, NULL);

    /* Get our loaded image protocol interface structure. */
    BS->HandleProtocol(IH, &imgid, (VOID**)&img);

    bzero(&currdev, sizeof(currdev));
    efi_handle_lookup(img->DeviceHandle, &currdev.d_dev, &currdev.d_unit);
    currdev.d_type = currdev.d_dev->dv_type;

    env_setenv("loaddev", EV_VOLATILE, ia64_fmtdev(&currdev), env_noset,
               env_nounset);

    dev = get_dev_option(argc, argv);
    if (dev == NULL)
        dev = ia64_fmtdev(&currdev);

    env_setenv("currdev", EV_VOLATILE, dev, ia64_setcurrdev, env_nounset);

    setenv("LINES", "24", 1);	/* optional */

    archsw.arch_autoload = ia64_autoload;
    archsw.arch_copyin = ia64_copyin;
    archsw.arch_copyout = ia64_copyout;
    archsw.arch_getdev = ia64_getdev;
    archsw.arch_loadaddr = ia64_loadaddr;
    archsw.arch_loadseg = ia64_loadseg;
    archsw.arch_readin = ia64_readin;

    interact();			/* doesn't return */

    return (EFI_SUCCESS);		/* keep compiler happy */
}