예제 #1
0
int
nge_nd_init(nge_t *ngep)
{
	dev_info_t *dip;
	int duplex;
	int speed;

	NGE_TRACE(("nge_nd_init($%p)", (void *)ngep));

	/*
	 * initialize from .conf file, if appropriate.
	 */
	nge_nd_param_init(ngep);

	/*
	 * The link speed may be forced to 10, 100 or 1000 Mbps using
	 * the property "transfer-speed". This may be done in OBP by
	 * using the command "apply transfer-speed=<speed> <device>".
	 * The speed may be 10, 100 or 1000 - any other value will be
	 * ignored.  Note that this does *enables* autonegotiation, but
	 * restricts it to the speed specified by the property.
	 */
	dip = ngep->devinfo;
	if (NGE_PROP_EXISTS(dip, transfer_speed_propname)) {

		speed = NGE_PROP_GET_INT(dip, transfer_speed_propname);
		nge_log(ngep, "%s property is %d",
		    transfer_speed_propname, speed);

		switch (speed) {
		case 1000:
			ngep->param_adv_autoneg = 1;
			ngep->param_adv_1000fdx = 1;
			ngep->param_adv_1000hdx = 0;
			ngep->param_adv_100fdx = 0;
			ngep->param_adv_100hdx = 0;
			ngep->param_adv_10fdx = 0;
			ngep->param_adv_10hdx = 0;
			break;

		case 100:
			ngep->param_adv_autoneg = 1;
			ngep->param_adv_1000fdx = 0;
			ngep->param_adv_1000hdx = 0;
			ngep->param_adv_100fdx = 1;
			ngep->param_adv_100hdx = 1;
			ngep->param_adv_10fdx = 0;
			ngep->param_adv_10hdx = 0;
			break;

		case 10:
			ngep->param_adv_autoneg = 1;
			ngep->param_adv_1000fdx = 0;
			ngep->param_adv_1000hdx = 0;
			ngep->param_adv_100fdx = 0;
			ngep->param_adv_100hdx = 0;
			ngep->param_adv_10fdx = 1;
			ngep->param_adv_10hdx = 1;
			break;

		default:
			break;
		}
	}

	/*
	 * Also check the "speed" and "full-duplex" properties.  Setting
	 * these properties will override all other settings and *disable*
	 * autonegotiation, so both should be specified if either one is.
	 * Otherwise, the unspecified parameter will be set to a default
	 * value (1000Mb/s, full-duplex).
	 */
	if (NGE_PROP_EXISTS(dip, speed_propname) ||
	    NGE_PROP_EXISTS(dip, duplex_propname)) {

		ngep->param_adv_autoneg = 0;
		ngep->param_adv_1000fdx = 1;
		ngep->param_adv_1000hdx = 0;
		ngep->param_adv_100fdx = 1;
		ngep->param_adv_100hdx = 1;
		ngep->param_adv_10fdx = 1;
		ngep->param_adv_10hdx = 1;

		speed = NGE_PROP_GET_INT(dip, speed_propname);
		duplex = NGE_PROP_GET_INT(dip, duplex_propname);
		nge_log(ngep, "%s property is %d",
		    speed_propname, speed);
		nge_log(ngep, "%s property is %d",
		    duplex_propname, duplex);

		switch (speed) {
		case 1000:
		default:
			ngep->param_adv_100fdx = 0;
			ngep->param_adv_100hdx = 0;
			ngep->param_adv_10fdx = 0;
			ngep->param_adv_10hdx = 0;
			break;

		case 100:
			ngep->param_adv_1000fdx = 0;
			ngep->param_adv_1000hdx = 0;
			ngep->param_adv_10fdx = 0;
			ngep->param_adv_10hdx = 0;
			break;

		case 10:
			ngep->param_adv_1000fdx = 0;
			ngep->param_adv_1000hdx = 0;
			ngep->param_adv_100fdx = 0;
			ngep->param_adv_100hdx = 0;
			break;
		}

		switch (duplex) {
		default:
		case 1:
			ngep->param_adv_1000hdx = 0;
			ngep->param_adv_100hdx = 0;
			ngep->param_adv_10hdx = 0;
			break;

		case 0:
			ngep->param_adv_1000fdx = 0;
			ngep->param_adv_100fdx = 0;
			ngep->param_adv_10fdx = 0;
			break;
		}
	}


	nge_param_sync(ngep);

	return (0);
}
예제 #2
0
int io_dir_travel(const char* directory, file_travel_cb callback,void* user_data)
{
	nge_log("%s not support!\n");
	return 0;
}