Пример #1
0
/**
 * EFI entry point
 *
 * @v image_handle	Image handle
 * @v systab		System table
 * @ret efirc		EFI return status code
 */
EFI_STATUS EFIAPI _efi_start ( EFI_HANDLE image_handle,
			       EFI_SYSTEM_TABLE *systab ) {
	EFI_STATUS efirc;
	int rc;

	/* Initialise EFI environment */
	if ( ( efirc = efi_init ( image_handle, systab ) ) != 0 )
		goto err_init;

	/* Record autoboot device (if any) */
	efi_set_autoboot();

	/* Claim SNP devices for use by iPXE */
	efi_snp_claim();

	/* Call to main() */
	if ( ( rc = main() ) != 0 ) {
		efirc = EFIRC ( rc );
		goto err_main;
	}

 err_main:
	efi_snp_release();
	efi_loaded_image->Unload ( image_handle );
	efi_driver_reconnect_all();
 err_init:
	return efirc;
}
Пример #2
0
void *bsp_get_rsdp(void)
{
	if (!efi_initialized) {
		efi_init();
	}

	return hpa2hva((uint64_t)efi_ctx.rsdp);
}
Пример #3
0
void init_bsp(void)
{
#ifndef CONFIG_CONSTANT_ACPI
	acpi_fixup();
#endif
	parse_hv_cmdline();

	if (!efi_initialized)
		efi_init();
}
Пример #4
0
/**
 * EFI entry point
 *
 * @v image_handle	Image handle
 * @v systab		System table
 * @ret efirc		EFI return status code
 */
EFI_STATUS EFIAPI _efidrv_start ( EFI_HANDLE image_handle,
				  EFI_SYSTEM_TABLE *systab ) {
	EFI_STATUS efirc;

	/* Initialise EFI environment */
	if ( ( efirc = efi_init ( image_handle, systab ) ) != 0 )
		return efirc;

	/* Initialise iPXE environment */
	initialise();
	startup();

	/* Release network devices for use via SNP */
	efi_snp_release();

	return 0;
}
Пример #5
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QDialog w;
    w.setWindowTitle("Reboot into:");
    QVBoxLayout layout;
    efi_init();
    reboot_init();
    uint16_t *data;
    int l = boot_entry_list(&data);
    for (int i = 0; i < l; i++) {
        QPushButton *button = new QPushButton(QString(boot_entry_name(data[i])));
        layout.addWidget(button);
        button->connect(button, &QPushButton::clicked, [=]() {
            set_boot_next(data[i]);
            do_reboot();
        });
    }
    w.setLayout(&layout);
    w.show();
    return a.exec();
}
Пример #6
0
int main()
{    
    uint16_t *data;
    int l, i, c;
    data = NULL;
    efi_init(); // Perform all tasks needed to access EFI functions
    reboot_init(); // Perform all tasks needed to access Reboot functions
    l = boot_entry_list(&data);
    for (i = 0; i < l; i++) {
        printf("%d: %s\n", i, boot_entry_name(data[i]));
    }
    printf("Input your choice: ");
    scanf("%d", &c);
    if (c < 0 || c >= l) {
        printf("ERROR: Invalid choice\n");
        exit(-1);
    }
    set_boot_next(data[c]);
    printf("Set next boot target to: %s\n", boot_entry_name(data[c]));
    do_reboot();

    return 0;
}
Пример #7
0
void __init
setup_arch (char **cmdline_p)
{
	unw_init();

	ia64_patch_vtop((u64) __start___vtop_patchlist, (u64) __end___vtop_patchlist);

	*cmdline_p = __va(ia64_boot_param->command_line);
	strlcpy(saved_command_line, *cmdline_p, COMMAND_LINE_SIZE);

	efi_init();
	io_port_init();

#ifdef CONFIG_IA64_GENERIC
	machvec_init(acpi_get_sysname());
#endif

	if (early_console_setup(*cmdline_p) == 0)
		mark_bsp_online();

#ifdef CONFIG_ACPI_BOOT
	/* Initialize the ACPI boot-time table parser */
	acpi_table_init();
# ifdef CONFIG_ACPI_NUMA
	acpi_numa_init();
# endif
#else
# ifdef CONFIG_SMP
	smp_build_cpu_map();	/* happens, e.g., with the Ski simulator */
# endif
#endif /* CONFIG_APCI_BOOT */

	find_memory();

	/* process SAL system table: */
	ia64_sal_init(efi.sal_systab);

#ifdef CONFIG_SMP
	cpu_physical_id(0) = hard_smp_processor_id();
#endif

	cpu_init();	/* initialize the bootstrap CPU */

#ifdef CONFIG_ACPI_BOOT
	acpi_boot_init();
#endif

#ifdef CONFIG_VT
	if (!conswitchp) {
# if defined(CONFIG_DUMMY_CONSOLE)
		conswitchp = &dummy_con;
# endif
# if defined(CONFIG_VGA_CONSOLE)
		/*
		 * Non-legacy systems may route legacy VGA MMIO range to system
		 * memory.  vga_con probes the MMIO hole, so memory looks like
		 * a VGA device to it.  The EFI memory map can tell us if it's
		 * memory so we can avoid this problem.
		 */
		if (efi_mem_type(0xA0000) != EFI_CONVENTIONAL_MEMORY)
			conswitchp = &vga_con;
# endif
	}
#endif

	/* enable IA-64 Machine Check Abort Handling unless disabled */
	if (!strstr(saved_command_line, "nomca"))
		ia64_mca_init();
	
	platform_setup(cmdline_p);
	paging_init();
}
Пример #8
0
main(int argc, char *argv[]) {
	char *pgm;
	char *server;
	int   i, j;
	int   id, nc;
	int   nstep   = 10;
	int   nmodule = 5;
	int   running[MAX_MODULES], runstate[MAX_MODULES], nrunning;

	pgm = argv[0];
	++argv; --argc;

	if (!argc) {
		fprintf(stderr, "usage: %s server [nstep] [nmodule]\n", pgm);
		exit(1);
	}
	server = argv[0];
	++argv; --argc;

	if (argc) {
		nstep = atoi(argv[0]);
		++argv; --argc;
	}

	if (argc) {
		nmodule = atoi(argv[0]);
		++argv; --argc;
	}

	if (argc) {
		fprintf(stderr, "usage: %s server [nstep] [nmodule]\n", pgm);
		exit(1);
	}

	event_verbose(0);
	efi_init();

	id = event_join(server, &nc);
	if (!id) {
		fprintf(stderr, "%s: couldn't join server %s\n", pgm, server);
		exit(1);
	}
	fprintf(stderr, "%s: Joined %s as client id %d (%d clients)\n",
		pgm, server, id, nc);

	/* Don't receive any events */
	event_select_type(0, 0, ET_MAX);
	event_receive_enable(0);

	/* Send loaded messages */
	for (i = 0; i < nmodule; ++i) {
		send_state(i, 2);
		event_sleep(irand(100, 1000));
	}

	/* Send an idle messages */
	for (i = 0; i < nmodule; ++i) {
		send_state(i, 3);
		event_sleep(irand(100, 1000));
	}

	/* Cycle run-send-idle for each step */
	for (i = 0; i < nstep; ++i) {
		/* Set all modules to IDLE */
		for (j = 0; j < nmodule; ++j) {
			running[j]  = j;
			runstate[j] = 3;
		}
		nrunning = nmodule;

		/* Randomly cycle a module */
		while (nrunning) {
			j = irand(0, nrunning-1);

			if (runstate[j] == 5) runstate[j] = 3;
			else ++runstate[j];

			send_state(running[j], runstate[j]);

			/* Remove modules that have gone idle */
			if (runstate[j] == 3) {
				running[j]  = running[nrunning-1];
				runstate[j] = runstate[nrunning-1];
				nrunning--;
			}

			event_sleep(irand(100, 2000));
		}
		send_frame(i+1, nstep);
		printf("Finished frame %d\n", i);
	}

	/* Send an unload messages */
	for (i = 0; i < nmodule; ++i) {
		send_state(i, 1);
		event_sleep(irand(100, 1000));
	}

}
Пример #9
0
void __init
setup_arch (char **cmdline_p)
{
	unw_init();

	ia64_patch_vtop((u64) __start___vtop_patchlist, (u64) __end___vtop_patchlist);

	*cmdline_p = __va(ia64_boot_param->command_line);
	strlcpy(saved_command_line, *cmdline_p, COMMAND_LINE_SIZE);

	efi_init();
	io_port_init();

	parse_early_param();

#ifdef CONFIG_IA64_GENERIC
	machvec_init(NULL);
#endif

	if (early_console_setup(*cmdline_p) == 0)
		mark_bsp_online();

#ifdef CONFIG_ACPI
	/* Initialize the ACPI boot-time table parser */
	acpi_table_init();
# ifdef CONFIG_ACPI_NUMA
	acpi_numa_init();
# endif
#else
# ifdef CONFIG_SMP
	smp_build_cpu_map();	/* happens, e.g., with the Ski simulator */
# endif
#endif /* CONFIG_APCI_BOOT */

	find_memory();

	/* process SAL system table: */
	ia64_sal_init(__va(efi.sal_systab));

	ia64_setup_printk_clock();

#ifdef CONFIG_SMP
	cpu_physical_id(0) = hard_smp_processor_id();

	cpu_set(0, cpu_sibling_map[0]);
	cpu_set(0, cpu_core_map[0]);

	check_for_logical_procs();
	if (smp_num_cpucores > 1)
		printk(KERN_INFO
		       "cpu package is Multi-Core capable: number of cores=%d\n",
		       smp_num_cpucores);
	if (smp_num_siblings > 1)
		printk(KERN_INFO
		       "cpu package is Multi-Threading capable: number of siblings=%d\n",
		       smp_num_siblings);
#endif

	cpu_init();	/* initialize the bootstrap CPU */
	mmu_context_init();	/* initialize context_id bitmap */

#ifdef CONFIG_ACPI
	acpi_boot_init();
#endif

#ifdef CONFIG_VT
	if (!conswitchp) {
# if defined(CONFIG_DUMMY_CONSOLE)
		conswitchp = &dummy_con;
# endif
# if defined(CONFIG_VGA_CONSOLE)
		/*
		 * Non-legacy systems may route legacy VGA MMIO range to system
		 * memory.  vga_con probes the MMIO hole, so memory looks like
		 * a VGA device to it.  The EFI memory map can tell us if it's
		 * memory so we can avoid this problem.
		 */
		if (efi_mem_type(0xA0000) != EFI_CONVENTIONAL_MEMORY)
			conswitchp = &vga_con;
# endif
	}
#endif

	/* enable IA-64 Machine Check Abort Handling unless disabled */
	if (!nomca)
		ia64_mca_init();

	platform_setup(cmdline_p);
	paging_init();
}
Пример #10
0
void __init
setup_arch (char **cmdline_p)
{
	extern unsigned long ia64_iobase;
	unsigned long phys_iobase;

	unw_init();

	ia64_patch_vtop((u64) __start___vtop_patchlist, (u64) __end___vtop_patchlist);

	*cmdline_p = __va(ia64_boot_param->command_line);
	strlcpy(saved_command_line, *cmdline_p, sizeof(saved_command_line));

	efi_init();

#ifdef CONFIG_ACPI_BOOT
	/* Initialize the ACPI boot-time table parser */
	acpi_table_init();
# ifdef CONFIG_ACPI_NUMA
	acpi_numa_init();
# endif
#else
# ifdef CONFIG_SMP
	smp_build_cpu_map();	/* happens, e.g., with the Ski simulator */
# endif
#endif /* CONFIG_APCI_BOOT */

	find_memory();

	/* process SAL system table: */
	ia64_sal_init(efi.sal_systab);

#ifdef CONFIG_IA64_GENERIC
	machvec_init(acpi_get_sysname());
#endif

	/*
	 *  Set `iobase' to the appropriate address in region 6 (uncached access range).
	 *
	 *  The EFI memory map is the "preferred" location to get the I/O port space base,
	 *  rather the relying on AR.KR0. This should become more clear in future SAL
	 *  specs. We'll fall back to getting it out of AR.KR0 if no appropriate entry is
	 *  found in the memory map.
	 */
	phys_iobase = efi_get_iobase();
	if (phys_iobase)
		/* set AR.KR0 since this is all we use it for anyway */
		ia64_set_kr(IA64_KR_IO_BASE, phys_iobase);
	else {
		phys_iobase = ia64_get_kr(IA64_KR_IO_BASE);
		printk(KERN_INFO "No I/O port range found in EFI memory map, falling back "
		       "to AR.KR0\n");
		printk(KERN_INFO "I/O port base = 0x%lx\n", phys_iobase);
	}
	ia64_iobase = (unsigned long) ioremap(phys_iobase, 0);

	/* setup legacy IO port space */
	io_space[0].mmio_base = ia64_iobase;
	io_space[0].sparse = 1;
	num_io_spaces = 1;

#ifdef CONFIG_SMP
	cpu_physical_id(0) = hard_smp_processor_id();
#endif

	cpu_init();	/* initialize the bootstrap CPU */

#ifdef CONFIG_ACPI_BOOT
	acpi_boot_init();
#endif
#ifdef CONFIG_SERIAL_8250_HCDP
	if (efi.hcdp) {
		void setup_serial_hcdp(void *);
		setup_serial_hcdp(efi.hcdp);
	}
#endif
#ifdef CONFIG_SERIAL_8250_CONSOLE
	/*
	 * Without HCDP, we won't discover any serial ports until the serial driver looks
	 * in the ACPI namespace.  If ACPI claims there are some legacy devices, register
	 * the legacy COM ports so serial console works earlier.  This is slightly dangerous
	 * because we don't *really* know whether there's anything there, but we hope that
	 * all new boxes will implement HCDP.
	 */
	{
		extern unsigned char acpi_legacy_devices;
		if (!efi.hcdp && acpi_legacy_devices)
			setup_serial_legacy();
	}
#endif

#ifdef CONFIG_VT
# if defined(CONFIG_DUMMY_CONSOLE)
	conswitchp = &dummy_con;
# endif
# if defined(CONFIG_VGA_CONSOLE)
	/*
	 * Non-legacy systems may route legacy VGA MMIO range to system
	 * memory.  vga_con probes the MMIO hole, so memory looks like
	 * a VGA device to it.  The EFI memory map can tell us if it's
	 * memory so we can avoid this problem.
	 */
	if (efi_mem_type(0xA0000) != EFI_CONVENTIONAL_MEMORY)
		conswitchp = &vga_con;
# endif
#endif

#ifdef CONFIG_IA64_MCA
	/* enable IA-64 Machine Check Abort Handling */
	ia64_mca_init();
#endif

	platform_setup(cmdline_p);
	paging_init();
}
Пример #11
0
INTERNAL void
setprobe(char *spec) {
	char server[100];
	char instname[100];
	char *s, *t;
	int  param;
	int  id, nc;
	int  clientid = 0;
	ECLIENT_LIST  clients[MAX_CLIENT];
	EVENT_EFI_CTL eprobe;

	s = spec;

	if (substr(PREFIX, s)) s += strlen(PREFIX);
	if (substr("//", s))   s += 2;

	t = server;
	while (*s && *s != '/') *t++ = *s++;
	*t = '\0';

	if (*s++ != '/') probe_error(spec);
	if (*s == '/') ++s;

	t = instname;
	while (*s != '.') *t++ = *s++;
	*t = '\0';

	if (*s++ != '.') probe_error(spec);

	if (isdigit(instname[0])) clientid = atoi(instname);

	param = atoi(s);
	if (!param) probe_error(spec);

	printf("setprobe: setting probe daffie://%s/%s.%d\n",
		server, instname, param);

	efi_init();
	event_select_type(0, ET_MIN, ET_MAX);

	id = event_join(server, &nc);
	if (!id) {
		fprintf(stderr, "%s: couldn't join server \"%s\"\n", Pgm, server);
		exit(4);
	}
	printf("%s: joined %s as client id %d (%d clients)\n", Pgm, server, id, nc);

	event_register("earlab", "control", Pgm);

	event_callback(ET_EFI_WAVEDATA,  receive_wavedata);
	event_callback(ET_EFI_SPIKEDATA, receive_spikedata);
	event_select_type(1, ET_EFI_WAVEDATA,  ET_EFI_WAVEDATA);
	event_select_type(1, ET_EFI_SPIKEDATA, ET_EFI_SPIKEDATA);
	event_receive_enable(0);
	event_flush(0);

	eclient_monitor();
	if (!clientid)
	   nc = eclient_match(clients, "*", "earlab", "*", instname);
	else
	   nc = eclient_match_id(clients, clientid);

	if (nc < 1) {
		fprintf(stderr, "%s: couldn't find match for %s\n",
			Pgm, instname);
		event_leave();
		exit(1);
	}
	if (nc > 1) {
		fprintf(stderr, "%s: %s matched multiple (%d) clients\n",
			Pgm, instname, nc);
		event_leave();
		exit(1);
	}

	eprobe.type     = EFI_CTL_PROBE;
	eprobe.clientid = id;
	eprobe.tag      = getpid();
	eprobe.param    = param - 1;
	eprobe.flag     = 1;
	eprobe.value    = 0;

	SEND(clients[0].id, EFI_CTL, eprobe);

}