Ejemplo n.º 1
0
/*
 * probeio:
 *
 * Probe and subsequently attach devices on the motherboard
 * and on any busses out there.
 *
 */
void
probeio(void)
{
	register struct	bus_device	*device;
	register struct	bus_ctlr	*master;
	int				i = 0;
	extern void pci_configure(void);

#if DEBUG
	printf("PowerMac is %sI/O-coherent\n",
		powermac_info.io_coherent == FALSE ? "NOT ": "");
#endif

	pci_configure();

	for (master = bus_master_init; master->driver; master++) {
#if DEBUG
		printf("configuring bus master : %s\n",master->name);
#endif /* DEBUG */
		if (configure_bus_master(master->name, master->address,
				master->phys_address, i, "motherboard"))
			i++;
	}

	for (device = bus_device_init; device->driver; device++) {
		/* ignore what we (should) have found already */
		if (device->alive || device->ctlr > -1)
			continue;
#if DEBUG
		printf("configuring bus device : %s\n",device->name);
#endif /* DEBUG */
		if (configure_bus_device(device->name, device->address,
				device->phys_address, i, "motherboard"))
			i++;
		else
			device->adaptor = ' ';	/* skip it next time */
	}
#if DEBUG
	printf("probeio() done.\n");
#endif
}
void cfe_main(int a,int b)
{

    /*
     * By the time this routine is called, the following things have
     * already been done:
     *
     * 1. The processor(s) is(are) initialized.
     * 2. The caches are initialized.
     * 3. The memory controller is initialized.
     * 4. BSS has been zeroed.
     * 5. The data has been moved to R/W space.
     * 6. The "C" Stack has been initialized.
     */

    cfe_bg_init();		       		/* init background processing */
    cfe_attach_init();
    cfe_timer_init();				/* Timer process */
    cfe_bg_add(cfe_device_poll,NULL);

    /*
     * Initialize the memory allocator
     */
        
    SETLEDS("KMEM");
    KMEMINIT((unsigned char *) (uintptr_t) mem_heapstart,
	     ((CFG_HEAP_SIZE)*1024));

    /*
     * Initialize the console.  It is done before the other devices
     * get turned on.  The console init also sets the variable that
     * contains the CPU speed.
     */

    SETLEDS("CONS");
    board_console_init();

    /*
     * Set up the exception vectors
     */

    cfe_setup_exceptions();

    /* 
     * Say hello.
     */

    SETLEDS("CIOK");
    cfe_say_hello();

    /*
     * Initialize the other devices.
     */

    SETLEDS("AREN");
#if CFG_XIP
	xprintf("CFE XIP\n");
#endif
    xprintf("Init Arena\n");
    cfe_arena_init();

#if CFG_PCI
    if (cfe_startflags & CFE_INIT_PCI) {
	pci_flags_t flags = PCI_FLG_NORMAL | PCI_FLG_LDT_PREFETCH;
#ifndef EB332
	char *str;
	extern cons_t pci_optnames[];

	flags = PCI_FLG_NORMAL | PCI_FLG_LDT_PREFETCH;
#if CFG_LDT_REV_017
	flags |= PCI_FLG_LDT_REV_017;
#endif
	str = env_getenv("PCI_OPTIONS");
	setoptions(pci_optnames,str,&flags);

	xprintf("Initializing PCI. [%s]\n",str ? str : "normal");
#endif
	pci_configure(flags);
	}
#endif

    SETLEDS("DEVI");
    xprintf("Init Devs.\n");
    board_device_init();

    cfe_startup_info();
    SETLEDS("ENVI");
    cfe_setup_default_env();

    xprintf("\n");

    cfe_init_ui();

    board_final_init();

    cfe_autostart();

    cfe_command_loop();
}