Deleted Added
full compact
pci_lpc.c (257347) pci_lpc.c (258075)
1/*-
2 * Copyright (c) 2013 Neel Natu <neel@freebsd.org>
3 * Copyright (c) 2013 Tycho Nightingale <tycho.nightingale@pluribusnetworks.com>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 10 unchanged lines hidden (view full) ---

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
1/*-
2 * Copyright (c) 2013 Neel Natu <neel@freebsd.org>
3 * Copyright (c) 2013 Tycho Nightingale <tycho.nightingale@pluribusnetworks.com>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 10 unchanged lines hidden (view full) ---

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * $FreeBSD: head/usr.sbin/bhyve/pci_lpc.c 257347 2013-10-29 17:31:16Z neel $
27 * $FreeBSD: head/usr.sbin/bhyve/pci_lpc.c 258075 2013-11-12 22:51:03Z neel $
28 */
29
30#include <sys/cdefs.h>
28 */
29
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: head/usr.sbin/bhyve/pci_lpc.c 257347 2013-10-29 17:31:16Z neel $");
31__FBSDID("$FreeBSD: head/usr.sbin/bhyve/pci_lpc.c 258075 2013-11-12 22:51:03Z neel $");
32
33#include <sys/types.h>
32
33#include <sys/types.h>
34#include <machine/vmm.h>
35#include <machine/vmm_dev.h>
34
35#include <stdio.h>
36#include <stdlib.h>
37#include <string.h>
38
36
37#include <stdio.h>
38#include <stdlib.h>
39#include <string.h>
40
41#include <vmmapi.h>
42
39#include "inout.h"
43#include "inout.h"
40#include "ioapic.h"
41#include "pci_emul.h"
42#include "uart_emul.h"
43
44static struct pci_devinst *lpc_bridge;
45
46#define LPC_UART_NUM 2
47static struct lpc_uart_softc {
48 struct uart_softc *uart_softc;

--- 37 unchanged lines hidden (view full) ---

86
87static void
88lpc_uart_intr_assert(void *arg)
89{
90 struct lpc_uart_softc *sc = arg;
91
92 assert(sc->irq >= 0);
93
44#include "pci_emul.h"
45#include "uart_emul.h"
46
47static struct pci_devinst *lpc_bridge;
48
49#define LPC_UART_NUM 2
50static struct lpc_uart_softc {
51 struct uart_softc *uart_softc;

--- 37 unchanged lines hidden (view full) ---

89
90static void
91lpc_uart_intr_assert(void *arg)
92{
93 struct lpc_uart_softc *sc = arg;
94
95 assert(sc->irq >= 0);
96
94 ioapic_assert_pin(lpc_bridge->pi_vmctx, sc->irq);
97 vm_ioapic_assert_irq(lpc_bridge->pi_vmctx, sc->irq);
95}
96
97static void
98lpc_uart_intr_deassert(void *arg)
99{
100 struct lpc_uart_softc *sc = arg;
101
102 assert(sc->irq >= 0);
103
98}
99
100static void
101lpc_uart_intr_deassert(void *arg)
102{
103 struct lpc_uart_softc *sc = arg;
104
105 assert(sc->irq >= 0);
106
104 ioapic_deassert_pin(lpc_bridge->pi_vmctx, sc->irq);
107 vm_ioapic_deassert_irq(lpc_bridge->pi_vmctx, sc->irq);
105}
106
107static int
108lpc_uart_io_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes,
109 uint32_t *eax, void *arg)
110{
111 int offset;
112 struct lpc_uart_softc *sc = arg;

--- 103 unchanged lines hidden ---
108}
109
110static int
111lpc_uart_io_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes,
112 uint32_t *eax, void *arg)
113{
114 int offset;
115 struct lpc_uart_softc *sc = arg;

--- 103 unchanged lines hidden ---