コード例 #1
0
ファイル: rge_log.c プロジェクト: mikess/illumos-gate
void
rge_pkt_dump(rge_t *rgep, rge_bd_t *hrbdp, sw_rbd_t *srbdp, const char *msg)
{
    rge_problem(rgep, "driver-detected hardware error: %s", msg);

    minidump(rgep, "hardware descriptor", hrbdp, sizeof (*hrbdp));

    rge_log(rgep, "PCI address %lx flags_len 0x%x"
            "vlan_tag 0x%x",
            hrbdp->host_buf_addr,
            hrbdp->flags_len,
            hrbdp->vlan_tag);

    if (srbdp != NULL) {
        minidump(rgep, "software descriptor", srbdp, sizeof (*srbdp));

        rge_log(rgep, "PCI address %llx buffer len 0x%x token 0x%x",
                srbdp->rx_buf->pbuf.cookie.dmac_laddress,
                srbdp->rx_buf->pbuf.alength,
                srbdp->rx_buf->pbuf.token);

        minidump(rgep, "packet data", srbdp->rx_buf->pbuf.mem_va,
                 hrbdp->flags_len & RBD_LEN_MASK);
    }
}
コード例 #2
0
ファイル: rge_log.c プロジェクト: mikess/illumos-gate
/*
 * Dump a chunk of memory, 16 bytes at a time
 */
static void
minidump(rge_t *rgep, const char *caption, void *dp, uint_t len)
{
    uint32_t buf[4];
    uint32_t nbytes;

    rge_log(rgep, "%d bytes of %s at address %p:-", len, caption, dp);

    for (len = MIN(len, rgep->rxbuf_size); len != 0; len -= nbytes) {
        nbytes = MIN(len, sizeof (buf));
        bzero(buf, sizeof (buf));
        bcopy(dp, buf, nbytes);
        rge_log(rgep, "%08x %08x %08x %08x",
                buf[0], buf[1], buf[2], buf[3]);
        dp = (caddr_t)dp + nbytes;
    }
}
コード例 #3
0
int
rge_nd_init(rge_t *rgep)
{
	dev_info_t *dip;
	int duplex;
	int speed;

	/*
	 * Register all the per-instance properties, initialising
	 * them from the table above or from driver properties set
	 * in the .conf file
	 */
	if (rge_param_register(rgep) != DDI_SUCCESS)
		return (-1);

	/*
	 * 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 = rgep->devinfo;
	if (RGE_PROP_EXISTS(dip, transfer_speed_propname)) {

		speed = RGE_PROP_GET_INT(dip, transfer_speed_propname);
		rge_log(rgep, "%s property is %d",
		    transfer_speed_propname, speed);

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

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

		case 10:
			rgep->param_adv_autoneg = 1;
			rgep->param_adv_1000fdx = 0;
			rgep->param_adv_1000hdx = 0;
			rgep->param_adv_100fdx = 0;
			rgep->param_adv_100hdx = 0;
			rgep->param_adv_10fdx = 1;
			rgep->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 (RGE_PROP_EXISTS(dip, speed_propname) ||
	    RGE_PROP_EXISTS(dip, duplex_propname)) {

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

		speed = RGE_PROP_GET_INT(dip, speed_propname);
		duplex = RGE_PROP_GET_INT(dip, duplex_propname);
		rge_log(rgep, "%s property is %d",
		    speed_propname, speed);
		rge_log(rgep, "%s property is %d",
		    duplex_propname, duplex);

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

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

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

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

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

	RGE_DEBUG(("rge_nd_init: autoneg %d"
	    "pause %d asym_pause %d "
	    "1000fdx %d 1000hdx %d "
	    "100fdx %d 100hdx %d "
	    "10fdx %d 10hdx %d ",
	    rgep->param_adv_autoneg,
	    rgep->param_adv_pause, rgep->param_adv_asym_pause,
	    rgep->param_adv_1000fdx, rgep->param_adv_1000hdx,
	    rgep->param_adv_100fdx, rgep->param_adv_100hdx,
	    rgep->param_adv_10fdx, rgep->param_adv_10hdx));

	return (0);
}