1257293Sneel/*-
2257293Sneel * Copyright (c) 2013 Neel Natu <neel@freebsd.org>
3257293Sneel * All rights reserved.
4257293Sneel *
5257293Sneel * Redistribution and use in source and binary forms, with or without
6257293Sneel * modification, are permitted provided that the following conditions
7257293Sneel * are met:
8257293Sneel * 1. Redistributions of source code must retain the above copyright
9257293Sneel *    notice, this list of conditions and the following disclaimer.
10257293Sneel * 2. Redistributions in binary form must reproduce the above copyright
11257293Sneel *    notice, this list of conditions and the following disclaimer in the
12257293Sneel *    documentation and/or other materials provided with the distribution.
13257293Sneel *
14257293Sneel * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND
15257293Sneel * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16257293Sneel * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17257293Sneel * ARE DISCLAIMED.  IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE
18257293Sneel * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19257293Sneel * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20257293Sneel * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21257293Sneel * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22257293Sneel * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23257293Sneel * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24257293Sneel * SUCH DAMAGE.
25257293Sneel *
26257293Sneel * $FreeBSD: releng/11.0/usr.sbin/bhyve/uart_emul.h 257293 2013-10-29 00:18:11Z neel $
27257293Sneel */
28257293Sneel
29257293Sneel#ifndef _UART_EMUL_H_
30257293Sneel#define	_UART_EMUL_H_
31257293Sneel
32257293Sneel
33257293Sneel#define	UART_IO_BAR_SIZE	8
34257293Sneel
35257293Sneelstruct uart_softc;
36257293Sneel
37257293Sneeltypedef void (*uart_intr_func_t)(void *arg);
38257293Sneelstruct uart_softc *uart_init(uart_intr_func_t intr_assert,
39257293Sneel		uart_intr_func_t intr_deassert, void *arg);
40257293Sneel
41257293Sneelint	uart_legacy_alloc(int unit, int *ioaddr, int *irq);
42257293Sneeluint8_t	uart_read(struct uart_softc *sc, int offset);
43257293Sneelvoid	uart_write(struct uart_softc *sc, int offset, uint8_t value);
44257293Sneelint	uart_set_backend(struct uart_softc *sc, const char *opt);
45257293Sneel#endif
46