Exemplo n.º 1
0
/*
 * The default OPAL console.
 *
 * In the absence of a "real" OPAL console driver we handle the OPAL_CONSOLE_*
 * calls by writing into the skiboot log buffer. Reads are a little more
 * complicated since they can come from the in-memory console (BML) or from the
 * internal skiboot console driver.
 */
static int64_t dummy_console_write(int64_t term_number, int64_t *length,
				   const uint8_t *buffer)
{
	if (term_number != 0)
		return OPAL_PARAMETER;

	if (!opal_addr_valid(length) || !opal_addr_valid(buffer))
		return OPAL_PARAMETER;

	write(0, buffer, *length);

	return OPAL_SUCCESS;
}
Exemplo n.º 2
0
static int64_t dummy_console_read(int64_t term_number, int64_t *length,
				  uint8_t *buffer)
{
	if (term_number != 0)
		return OPAL_PARAMETER;

	if (!opal_addr_valid(length) || !opal_addr_valid(buffer))
		return OPAL_PARAMETER;

	*length = read(0, buffer, *length);
	opal_update_pending_evt(OPAL_EVENT_CONSOLE_INPUT, 0);

	return OPAL_SUCCESS;
}
Exemplo n.º 3
0
static int64_t opal_flash_write(uint64_t id, uint64_t offset, uint64_t buf,
		uint64_t size, uint64_t token)
{
	if (!opal_addr_valid((void *)buf))
		return OPAL_PARAMETER;

	return opal_flash_op(FLASH_OP_WRITE, id, offset, buf, size, token);
}
Exemplo n.º 4
0
static int64_t dummy_console_write_buffer_space(int64_t term_number,
						int64_t *length)
{
	if (term_number != 0)
		return OPAL_PARAMETER;

	if (!opal_addr_valid(length))
		return OPAL_PARAMETER;

	if (length)
		*length = INMEM_CON_OUT_LEN;

	return OPAL_SUCCESS;
}
Exemplo n.º 5
0
static int64_t opal_pci_get_hub_diag_data(uint64_t hub_id,
					  void *diag_buffer,
					  uint64_t diag_buffer_len)
{
	struct io_hub *hub = cec_get_hub_by_id(hub_id);

	if (!opal_addr_valid(diag_buffer))
		return OPAL_PARAMETER;

	if (!hub)
		return OPAL_PARAMETER;

	if (!hub->ops->get_diag_data)
		return OPAL_UNSUPPORTED;

	return hub->ops->get_diag_data(hub, diag_buffer, diag_buffer_len);
}