示例#1
0
文件: hmi.c 项目: open-power/skiboot
static int queue_hmi_event(struct OpalHMIEvent *hmi_evt, int recover, uint64_t *out_flags)
{
	size_t size;

	/* Don't queue up event if recover == -1 */
	if (recover == -1)
		return 0;

	/* set disposition */
	if (recover == 1)
		hmi_evt->disposition = OpalHMI_DISPOSITION_RECOVERED;
	else if (recover == 0)
		hmi_evt->disposition = OpalHMI_DISPOSITION_NOT_RECOVERED;

	/*
	 * V2 of struct OpalHMIEvent is of (5 * 64 bits) size and well packed
	 * structure. Hence use uint64_t pointer to pass entire structure
	 * using 5 params in generic message format. Instead of hard coding
	 * num_params divide the struct size by 8 bytes to get exact
	 * num_params value.
	 */
	size = ALIGN_UP(sizeof(*hmi_evt), sizeof(u64));

	*out_flags |= OPAL_HMI_FLAGS_NEW_EVENT;

	/* queue up for delivery to host. */
	return _opal_queue_msg(OPAL_MSG_HMI_EVT, NULL, NULL,
				size, hmi_evt);
}
示例#2
0
文件: prd.c 项目: sharkcz/skiboot
static int queue_prd_msg_hbrt(struct opal_prd_msg *msg,
		void (*consumed)(void *data))
{
	uint64_t *buf;

	BUILD_ASSERT(sizeof(*msg) / sizeof(uint64_t) == 4);

	buf = (uint64_t *)msg;

	return _opal_queue_msg(OPAL_MSG_PRD, msg, consumed, 4, buf);
}