コード例 #1
0
ファイル: wd.c プロジェクト: Kirill2013/kasan
/**
 * mei_wd_send - sends watch dog message to fw.
 *
 * @dev: the device structure
 *
 * Return: 0 if success,
 *	-EIO when message send fails
 *	-EINVAL when invalid message is to be sent
 *	-ENODEV on flow control failure
 */
int mei_wd_send(struct mei_device *dev)
{
	struct mei_cl *cl = &dev->wd_cl;
	struct mei_msg_hdr hdr;
	int ret;

	hdr.host_addr = cl->host_client_id;
	hdr.me_addr = mei_cl_me_id(cl);
	hdr.msg_complete = 1;
	hdr.reserved = 0;
	hdr.internal = 0;

	if (!memcmp(dev->wd_data, mei_start_wd_params, MEI_WD_HDR_SIZE))
		hdr.length = MEI_WD_START_MSG_SIZE;
	else if (!memcmp(dev->wd_data, mei_stop_wd_params, MEI_WD_HDR_SIZE))
		hdr.length = MEI_WD_STOP_MSG_SIZE;
	else {
		dev_err(dev->dev, "wd: invalid message is to be sent, aborting\n");
		return -EINVAL;
	}

	ret = mei_write_message(dev, &hdr, dev->wd_data);
	if (ret) {
		dev_err(dev->dev, "wd: write message failed\n");
		return ret;
	}

	ret = mei_cl_flow_ctrl_reduce(cl);
	if (ret) {
		dev_err(dev->dev, "wd: flow_ctrl_reduce failed.\n");
		return ret;
	}

	return 0;
}
コード例 #2
0
/**
 * mei_wd_send - sends watch dog message to fw.
 *
 * @dev: the device structure
 *
 * returns 0 if success,
 *	-EIO when message send fails
 *	-EINVAL when invalid message is to be sent
 */
int mei_wd_send(struct mei_device *dev)
{
	struct mei_msg_hdr hdr;

	hdr.host_addr = dev->wd_cl.host_client_id;
	hdr.me_addr = dev->wd_cl.me_client_id;
	hdr.msg_complete = 1;
	hdr.reserved = 0;

	if (!memcmp(dev->wd_data, mei_start_wd_params, MEI_WD_HDR_SIZE))
		hdr.length = MEI_WD_START_MSG_SIZE;
	else if (!memcmp(dev->wd_data, mei_stop_wd_params, MEI_WD_HDR_SIZE))
		hdr.length = MEI_WD_STOP_MSG_SIZE;
	else
		return -EINVAL;

	return mei_write_message(dev, &hdr, dev->wd_data);
}
コード例 #3
0
ファイル: wd.c プロジェクト: AsherBond/ceph-client
/**
 * mei_wd_send - sends watch dog message to fw.
 *
 * @dev: the device structure
 *
 * returns 0 if success,
 *	-EIO when message send fails
 *	-EINVAL when invalid message is to be sent
 */
int mei_wd_send(struct mei_device *dev)
{
	struct mei_msg_hdr *mei_hdr;

	mei_hdr = (struct mei_msg_hdr *) &dev->wr_msg_buf[0];
	mei_hdr->host_addr = dev->wd_cl.host_client_id;
	mei_hdr->me_addr = dev->wd_cl.me_client_id;
	mei_hdr->msg_complete = 1;
	mei_hdr->reserved = 0;

	if (!memcmp(dev->wd_data, mei_start_wd_params, MEI_WD_PARAMS_SIZE))
		mei_hdr->length = MEI_START_WD_DATA_SIZE;
	else if (!memcmp(dev->wd_data, mei_stop_wd_params, MEI_WD_PARAMS_SIZE))
		mei_hdr->length = MEI_WD_PARAMS_SIZE;
	else
		return -EINVAL;

	return mei_write_message(dev, mei_hdr, dev->wd_data, mei_hdr->length);
}