Beispiel #1
0
void __cpuinit per_cpu_init(void)
{
	int cpu = smp_processor_id();
	int slice = LOCAL_HUB_L(PI_CPU_NUM);
	cnodeid_t cnode = get_compact_nodeid();
	struct hub_data *hub = hub_data(cnode);
	struct slice_data *si = hub->slice + slice;
	int i;

	if (test_and_set_bit(slice, &hub->slice_map))
		return;

	clear_c0_status(ST0_IM);

	per_hub_init(cnode);

	for (i = 0; i < LEVELS_PER_SLICE; i++)
		si->level_to_irq[i] = -1;

	/*
	 * We use this so we can find the local hub's data as fast as only
	 * possible.
	 */
	cpu_data[cpu].data = si;

	cpu_time_init();
	install_ipi();

	/* Install our NMI handler if symmon hasn't installed one. */
	install_cpu_nmi_handler(cputoslice(cpu));

	set_c0_status(SRB_DEV0 | SRB_DEV1);
}
void __cpuinit per_cpu_init(void)
{
	int cpu = smp_processor_id();
	int slice = LOCAL_HUB_L(PI_CPU_NUM);
	cnodeid_t cnode = get_compact_nodeid();
	struct hub_data *hub = hub_data(cnode);
	struct slice_data *si = hub->slice + slice;
	int i;

	if (test_and_set_bit(slice, &hub->slice_map))
		return;

	clear_c0_status(ST0_IM);

	per_hub_init(cnode);

	for (i = 0; i < LEVELS_PER_SLICE; i++)
		si->level_to_irq[i] = -1;

	/*
                                                                   
             
  */
	cpu_data[cpu].data = si;

	cpu_time_init();
	install_ipi();

	/*                                                         */
	install_cpu_nmi_handler(cputoslice(cpu));

	set_c0_status(SRB_DEV0 | SRB_DEV1);
}
Beispiel #3
0
static void __cpuinit per_hub_init(cnodeid_t cnode)
{
	struct hub_data *hub = hub_data(cnode);
	nasid_t nasid = COMPACT_TO_NASID_NODEID(cnode);
	int i;

	cpu_set(smp_processor_id(), hub->h_cpus);

	if (test_and_set_bit(cnode, hub_init_mask))
		return;
	/*
	 * Set CRB timeout at 5ms, (< PI timeout of 10ms)
	 */
	REMOTE_HUB_S(nasid, IIO_ICTP, 0x800);
	REMOTE_HUB_S(nasid, IIO_ICTO, 0xff);

	hub_rtc_init(cnode);
	xtalk_probe_node(cnode);

#ifdef CONFIG_REPLICATE_EXHANDLERS
	/*
	 * If this is not a headless node initialization,
	 * copy over the caliased exception handlers.
	 */
	if (get_compact_nodeid() == cnode) {
		extern char except_vec2_generic, except_vec3_generic;
		extern void build_tlb_refill_handler(void);

		memcpy((void *)(CKSEG0 + 0x100), &except_vec2_generic, 0x80);
		memcpy((void *)(CKSEG0 + 0x180), &except_vec3_generic, 0x80);
		build_tlb_refill_handler();
		memcpy((void *)(CKSEG0 + 0x100), (void *) CKSEG0, 0x80);
		memcpy((void *)(CKSEG0 + 0x180), &except_vec3_generic, 0x100);
		__flush_cache_all();
	}
#endif

	/*
	 * Some interrupts are reserved by hardware or by software convention.
	 * Mark these as reserved right away so they won't be used accidently
	 * later.
	 */
	for (i = 0; i <= BASE_PCI_IRQ; i++) {
		__set_bit(i, hub->irq_alloc_mask);
		LOCAL_HUB_CLR_INTR(INT_PEND0_BASELVL + i);
	}

	__set_bit(IP_PEND0_6_63, hub->irq_alloc_mask);
	LOCAL_HUB_S(PI_INT_PEND_MOD, IP_PEND0_6_63);

	for (i = NI_BRDCAST_ERR_A; i <= MSC_PANIC_INTR; i++) {
		__set_bit(i, hub->irq_alloc_mask);
		LOCAL_HUB_CLR_INTR(INT_PEND1_BASELVL + i);
	}
}
static void __cpuinit per_hub_init(cnodeid_t cnode)
{
	struct hub_data *hub = hub_data(cnode);
	nasid_t nasid = COMPACT_TO_NASID_NODEID(cnode);
	int i;

	cpu_set(smp_processor_id(), hub->h_cpus);

	if (test_and_set_bit(cnode, hub_init_mask))
		return;
	/*
                                                  
  */
	REMOTE_HUB_S(nasid, IIO_ICTP, 0x800);
	REMOTE_HUB_S(nasid, IIO_ICTO, 0xff);

	hub_rtc_init(cnode);
	xtalk_probe_node(cnode);

#ifdef CONFIG_REPLICATE_EXHANDLERS
	/*
                                                  
                                              
  */
	if (get_compact_nodeid() == cnode) {
		extern char except_vec2_generic, except_vec3_generic;
		extern void build_tlb_refill_handler(void);

		memcpy((void *)(CKSEG0 + 0x100), &except_vec2_generic, 0x80);
		memcpy((void *)(CKSEG0 + 0x180), &except_vec3_generic, 0x80);
		build_tlb_refill_handler();
		memcpy((void *)(CKSEG0 + 0x100), (void *) CKSEG0, 0x80);
		memcpy((void *)(CKSEG0 + 0x180), &except_vec3_generic, 0x100);
		__flush_cache_all();
	}
#endif

	/*
                                                                       
                                                                        
          
  */
	for (i = 0; i <= BASE_PCI_IRQ; i++) {
		__set_bit(i, hub->irq_alloc_mask);
		LOCAL_HUB_CLR_INTR(INT_PEND0_BASELVL + i);
	}

	__set_bit(IP_PEND0_6_63, hub->irq_alloc_mask);
	LOCAL_HUB_S(PI_INT_PEND_MOD, IP_PEND0_6_63);

	for (i = NI_BRDCAST_ERR_A; i <= MSC_PANIC_INTR; i++) {
		__set_bit(i, hub->irq_alloc_mask);
		LOCAL_HUB_CLR_INTR(INT_PEND1_BASELVL + i);
	}
}
Beispiel #5
0
void __init per_cpu_init(void)
{
	int cpu = smp_processor_id();
	int slice = LOCAL_HUB_L(PI_CPU_NUM);
	cnodeid_t cnode = get_compact_nodeid();
	struct hub_data *hub = hub_data(cnode);
	struct slice_data *si = hub->slice + slice;
	int i;

	if (test_and_set_bit(slice, &hub->slice_map))
		return;

	clear_c0_status(ST0_IM);

	for (i = 0; i < LEVELS_PER_SLICE; i++)
		si->level_to_irq[i] = -1;

	/*
	 * Some interrupts are reserved by hardware or by software convention.
	 * Mark these as reserved right away so they won't be used accidently
	 * later.
	 */
	for (i = 0; i <= BASE_PCI_IRQ; i++) {
		__set_bit(i, si->irq_alloc_mask);
		LOCAL_HUB_S(PI_INT_PEND_MOD, i);
	}

	__set_bit(IP_PEND0_6_63, si->irq_alloc_mask);
	LOCAL_HUB_S(PI_INT_PEND_MOD, IP_PEND0_6_63);

	for (i = NI_BRDCAST_ERR_A; i <= MSC_PANIC_INTR; i++) {
		__set_bit(i, si->irq_alloc_mask + 1);
		LOCAL_HUB_S(PI_INT_PEND_MOD, i);
	}

	LOCAL_HUB_L(PI_INT_PEND0);

	/*
	 * We use this so we can find the local hub's data as fast as only
	 * possible.
	 */
	cpu_data[cpu].data = si;

	cpu_time_init();
	install_ipi();

	/* Install our NMI handler if symmon hasn't installed one. */
	install_cpu_nmi_handler(cputoslice(cpu));

	set_c0_status(SRB_DEV0 | SRB_DEV1);

	per_hub_init(cnode);
}
Beispiel #6
0
void __init hub_rtc_init(cnodeid_t cnode)
{
	/*
	 * We only need to initialize the current node.
	 * If this is not the current node then it is a cpuless
	 * node and timeouts will not happen there.
	 */
	if (get_compact_nodeid() == cnode) {
		LOCAL_HUB_S(PI_RT_EN_A, 1);
		LOCAL_HUB_S(PI_RT_EN_B, 1);
		LOCAL_HUB_S(PI_PROF_EN_A, 0);
		LOCAL_HUB_S(PI_PROF_EN_B, 0);
		LOCAL_HUB_S(PI_RT_COUNT, 0);
		LOCAL_HUB_S(PI_RT_PEND_A, 0);
		LOCAL_HUB_S(PI_RT_PEND_B, 0);
	}
}
Beispiel #7
0
void __init hub_rtc_init(cnodeid_t cnode)
{
	/*
	 * We only need to initialize the current node.
	 * If this is not the current node then it is a cpuless
	 * node and timeouts will not happen there.
	 */
	if (get_compact_nodeid() == cnode) {
		int cpu = smp_processor_id();
		LOCAL_HUB_S(PI_RT_EN_A, 1);
		LOCAL_HUB_S(PI_RT_EN_B, 1);
		LOCAL_HUB_S(PI_PROF_EN_A, 0);
		LOCAL_HUB_S(PI_PROF_EN_B, 0);
		ct_cur[cpu] = CYCLES_PER_JIFFY;
		LOCAL_HUB_S(PI_RT_COMPARE_A, ct_cur[cpu]);
		LOCAL_HUB_S(PI_RT_COUNT, 0);
		LOCAL_HUB_S(PI_RT_PEND_A, 0);
		LOCAL_HUB_S(PI_RT_COMPARE_B, ct_cur[cpu]);
		LOCAL_HUB_S(PI_RT_COUNT, 0);
		LOCAL_HUB_S(PI_RT_PEND_B, 0);
	}
}
Beispiel #8
0
static void __init per_hub_init(cnodeid_t cnode)
{
	struct hub_data *hub = hub_data(cnode);
	nasid_t nasid = COMPACT_TO_NASID_NODEID(cnode);

	cpu_set(smp_processor_id(), hub->h_cpus);

	if (test_and_set_bit(cnode, hub_init_mask))
		return;

	/*
	 * Set CRB timeout at 5ms, (< PI timeout of 10ms)
	 */
	REMOTE_HUB_S(nasid, IIO_ICTP, 0x800);
	REMOTE_HUB_S(nasid, IIO_ICTO, 0xff);

	hub_rtc_init(cnode);
	xtalk_probe_node(cnode);

#ifdef CONFIG_REPLICATE_EXHANDLERS
	/*
	 * If this is not a headless node initialization,
	 * copy over the caliased exception handlers.
	 */
	if (get_compact_nodeid() == cnode) {
		extern char except_vec2_generic, except_vec3_generic;
		extern void build_tlb_refill_handler(void);

		memcpy((void *)(CKSEG0 + 0x100), &except_vec2_generic, 0x80);
		memcpy((void *)(CKSEG0 + 0x180), &except_vec3_generic, 0x80);
		build_tlb_refill_handler();
		memcpy((void *)(CKSEG0 + 0x100), (void *) CKSEG0, 0x80);
		memcpy((void *)(CKSEG0 + 0x180), &except_vec3_generic, 0x100);
		__flush_cache_all();
	}
#endif
}
void __init pcibr_setup(cnodeid_t nid)
{
    int 			i, start, num;
    unsigned long		masterwid;
    bridge_t 		*bridge;
    volatile u64 		hubreg;
    nasid_t	 		nasid, masternasid;
    xwidget_part_num_t	partnum;
    widgetreg_t 		widget_id;
    static spinlock_t	pcibr_setup_lock = SPIN_LOCK_UNLOCKED;

    /*
     * If the master is doing this for headless node, nothing to do.
     * This is because currently we require at least one of the hubs
     * (master hub) connected to the xbow to have at least one enabled
     * cpu to receive intrs. Else we need an array bus_to_intrnasid[]
     * that bridge_startup() needs to use to target intrs. All dma is
     * routed thru the widget of the master hub. The master hub wid
     * is selectable by WIDGET_A below.
     */
    if (nid != get_compact_nodeid())
        return;
    /*
     * find what's on our local node
     */
    spin_lock(&pcibr_setup_lock);
    start = num_bridges;		/* Remember where we start from */
    nasid = COMPACT_TO_NASID_NODEID(nid);
    hubreg = REMOTE_HUB_L(nasid, IIO_LLP_CSR);
    if (hubreg & IIO_LLP_CSR_IS_UP) {
        /* link is up */
        widget_id = *(volatile widgetreg_t *)
                    (RAW_NODE_SWIN_BASE(nasid, 0x0) + WIDGET_ID);
        partnum = XWIDGET_PART_NUM(widget_id);
        printk("Cpu %d, Nasid 0x%x, pcibr_setup(): found partnum= 0x%x",
               smp_processor_id(), nasid, partnum);
        if (partnum == BRIDGE_WIDGET_PART_NUM) {
            /*
             * found direct connected bridge so must be Origin200
             */
            printk("...is bridge\n");
            num_bridges = 1;
            bus_to_wid[0] = 0x8;
            bus_to_nid[0] = 0;
            masterwid = 0xa;
            bus_to_baddr[0] = 0xa100000000000000UL;
        } else if (partnum == XBOW_WIDGET_PART_NUM) {
            lboard_t *brd;
            klxbow_t *xbow_p;
            /*
             * found xbow, so may have multiple bridges
             * need to probe xbow
             */
            printk("...is xbow\n");

            if ((brd = find_lboard((lboard_t *)KL_CONFIG_INFO(nasid),
                                   KLTYPE_MIDPLANE8)) == NULL)
                printk("argh\n");
            else
                printk("brd = 0x%lx\n", (unsigned long) brd);
            if ((xbow_p = (klxbow_t *)
                          find_component(brd, NULL, KLSTRUCT_XBOW)) == NULL)
                printk("argh\n");
            else {
                /*
                 * Okay, here's a xbow. Lets arbitrate and find
                 * out if we should initialize it. Set enabled
                 * hub connected at highest or lowest widget as
                 * master.
                 */
#ifdef WIDGET_A
                i = HUB_WIDGET_ID_MAX + 1;
                do {
                    i--;
                } while ((!XBOW_PORT_TYPE_HUB(xbow_p, i)) ||
                         (!XBOW_PORT_IS_ENABLED(xbow_p, i)));
#else
                i = HUB_WIDGET_ID_MIN - 1;
                do {
                    i++;
                } while ((!XBOW_PORT_TYPE_HUB(xbow_p, i)) ||
                         (!XBOW_PORT_IS_ENABLED(xbow_p, i)));
#endif
                masterwid = i;
                masternasid = XBOW_PORT_NASID(xbow_p, i);
                if (nasid == masternasid)
                    for (i=HUB_WIDGET_ID_MIN; i<=HUB_WIDGET_ID_MAX; i++) {
                        if (!XBOW_PORT_IS_ENABLED(xbow_p, i))
                            continue;
                        if (XBOW_PORT_TYPE_IO(xbow_p, i)) {
                            widget_id = *(volatile widgetreg_t *)
                                        (RAW_NODE_SWIN_BASE(nasid, i) + WIDGET_ID);
                            partnum = XWIDGET_PART_NUM(widget_id);
                            if (partnum == BRIDGE_WIDGET_PART_NUM) {
                                printk("widget 0x%x is a bridge\n", i);
                                bus_to_wid[num_bridges] = i;
                                bus_to_nid[num_bridges] = nasid;
                                bus_to_baddr[num_bridges] = ((masterwid << 60) | (1UL << 56));	/* Barrier set */
                                num_bridges++;
                            }
                        }
                    }
            }
        } else if (partnum == XXBOW_WIDGET_PART_NUM) {
            /*
             * found xbridge, assume ibrick for now
             */
            printk("...is xbridge\n");
            bus_to_wid[0] = 0xb;
            bus_to_wid[1] = 0xe;
            bus_to_wid[2] = 0xf;

            bus_to_nid[0] = 0;
            bus_to_nid[1] = 0;
            bus_to_nid[2] = 0;

            bus_to_baddr[0] = 0xa100000000000000UL;
            bus_to_baddr[1] = 0xa100000000000000UL;
            bus_to_baddr[2] = 0xa100000000000000UL;
            masterwid = 0xa;
            num_bridges = 3;
        }
    }
    num = num_bridges - start;
    spin_unlock(&pcibr_setup_lock);
    /*
         * set bridge registers
         */
    for (i = start; i < (start + num); i++) {

        DBG("pcibr_setup: bus= %d  bus_to_wid[%2d]= %d  bus_to_nid[%2d]= %d\n",
            i, i, bus_to_wid[i], i, bus_to_nid[i]);

        bus_to_cpu[i] = smp_processor_id();
        /*
         * point to this bridge
         */
        bridge = (bridge_t *) NODE_SWIN_BASE(bus_to_nid[i],bus_to_wid[i]);
        /*
         * Clear all pending interrupts.
         */
        bridge->b_int_rst_stat = (BRIDGE_IRR_ALL_CLR);
        /*
         * Until otherwise set up, assume all interrupts are from slot 0
         */
        bridge->b_int_device = (u32) 0x0;
        /*
         * swap pio's to pci mem and io space (big windows)
         */
        bridge->b_wid_control |= BRIDGE_CTRL_IO_SWAP;
        bridge->b_wid_control |= BRIDGE_CTRL_MEM_SWAP;

        /*
         * Hmm...  IRIX sets additional bits in the address which
         * are documented as reserved in the bridge docs.
         */
        bridge->b_int_mode = 0x0;		/* Don't clear ints */
        bridge->b_wid_int_upper = 0x8000 | (masterwid << 16);
        bridge->b_wid_int_lower = 0x01800090;	/* PI_INT_PEND_MOD off*/
        bridge->b_dir_map = (masterwid << 20);	/* DMA */
        bridge->b_int_enable = 0;

        bridge->b_wid_tflush;     /* wait until Bridge PIO complete */
    }
}