Example #1
0
/**
 * hub_set_piomode  -  set pio mode for a given hub
 *
 * @nasid:	physical node ID for the hub in question
 *
 * Put the hub into either "PIO conveyor belt" mode or "fire-and-forget" mode.
 * To do this, we have to make absolutely sure that no PIOs are in progress
 * so we turn off access to all widgets for the duration of the function.
 *
 * XXX - This code should really check what kind of widget we're talking
 * to.  Bridges can only handle three requests, but XG will do more.
 * How many can crossbow handle to widget 0?  We're assuming 1.
 *
 * XXX - There is a bug in the crossbow that link reset PIOs do not
 * return write responses.  The easiest solution to this problem is to
 * leave widget 0 (xbow) in fire-and-forget mode at all times.  This
 * only affects pio's to xbow registers, which should be rare.
 **/
static void hub_set_piomode(nasid_t nasid)
{
	hubreg_t ii_iowa;
	hubii_wcr_t ii_wcr;
	unsigned i;

	ii_iowa = REMOTE_HUB_L(nasid, IIO_OUTWIDGET_ACCESS);
	REMOTE_HUB_S(nasid, IIO_OUTWIDGET_ACCESS, 0);

	ii_wcr.wcr_reg_value = REMOTE_HUB_L(nasid, IIO_WCR);

	if (ii_wcr.iwcr_dir_con) {
		/*
		 * Assume a bridge here.
		 */
		hub_setup_prb(nasid, 0, 3);
	} else {
		/*
		 * Assume a crossbow here.
		 */
		hub_setup_prb(nasid, 0, 1);
	}

	/*
	 * XXX - Here's where we should take the widget type into
	 * when account assigning credits.
	 */
	for (i = HUB_WIDGET_ID_MIN; i <= HUB_WIDGET_ID_MAX; i++)
		hub_setup_prb(nasid, i, 3);

	REMOTE_HUB_S(nasid, IIO_OUTWIDGET_ACCESS, ii_iowa);
}
Example #2
0
/*
 * hub_set_piomode()
 *
 * 	Put the hub into either "PIO conveyor belt" mode or "fire-and-forget"
 * 	mode.  To do this, we have to make absolutely sure that no PIOs
 *	are in progress so we turn off access to all widgets for the duration
 *	of the function.
 *
 * XXX - This code should really check what kind of widget we're talking
 * to.  Bridges can only handle three requests, but XG will do more.
 * How many can crossbow handle to widget 0?  We're assuming 1.
 *
 * XXX - There is a bug in the crossbow that link reset PIOs do not
 * return write responses.  The easiest solution to this problem is to
 * leave widget 0 (xbow) in fire-and-forget mode at all times.  This
 * only affects pio's to xbow registers, which should be rare.
 */
void
hub_set_piomode(nasid_t nasid, int conveyor)
{
    hubreg_t ii_iowa;
    int direct_connect;
    hubii_wcr_t ii_wcr;
    int prbnum;
    int s, cons_lock = 0;

    ASSERT(NASID_TO_COMPACT_NODEID(nasid) != INVALID_CNODEID);
    if (nasid == get_console_nasid()) {
        PUTBUF_LOCK(s);
        cons_lock = 1;
    }

    ii_iowa = REMOTE_HUB_L(nasid, IIO_OUTWIDGET_ACCESS);
    REMOTE_HUB_S(nasid, IIO_OUTWIDGET_ACCESS, 0);

    ii_wcr.wcr_reg_value = REMOTE_HUB_L(nasid, IIO_WCR);
    direct_connect = ii_wcr.iwcr_dir_con;

    if (direct_connect) {
        /*
         * Assume a bridge here.
         */
        hub_setup_prb(nasid, 0, 3, conveyor);
    } else {
        /*
         * Assume a crossbow here.
         */
        hub_setup_prb(nasid, 0, 1, conveyor);
    }

    for (prbnum = HUB_WIDGET_ID_MIN; prbnum <= HUB_WIDGET_ID_MAX; prbnum++) {
        /*
         * XXX - Here's where we should take the widget type into
         * when account assigning credits.
         */
        /* Always set the PRBs in fire-and-forget mode */
        hub_setup_prb(nasid, prbnum, 3, conveyor);
    }

#ifdef IRIX
    /*
     * In direct connect mode, disable access to all widgets but 0.
     * Later, the prom will do this for us.
     */
    if (direct_connect)
        ii_iowa = 1;
#endif

    REMOTE_HUB_S(nasid, IIO_OUTWIDGET_ACCESS, ii_iowa);

    if (cons_lock)
        PUTBUF_UNLOCK(s);
}
Example #3
0
/* Interface to allow special drivers to set hub specific
 * device flags.
 * Return 0 on failure , 1 on success
 */
int
hub_widget_flags_set(nasid_t		nasid,
                     xwidgetnum_t	widget_num,
                     hub_widget_flags_t	flags)
{

    ASSERT((flags & HUB_WIDGET_FLAGS) == flags);

    if (flags & HUB_PIO_CONVEYOR) {
        hub_setup_prb(nasid,widget_num,
                      3,HUB_PIO_CONVEYOR); /* set the PRB in conveyor
						    * belt mode with 3 credits
						    */
    } else if (flags & HUB_PIO_FIRE_N_FORGET) {
        hub_setup_prb(nasid,widget_num,
                      3,HUB_PIO_FIRE_N_FORGET); /* set the PRB in fire
							 *  and forget mode
							 */
    }

    return 1;
}