Deleted Added
full compact
pm.c (268891) pm.c (268972)
1/*-
2 * Copyright (c) 2013 Advanced Computing Technologies LLC
3 * Written by: John H. Baldwin <jhb@FreeBSD.org>
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:

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

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
28#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2013 Advanced Computing Technologies LLC
3 * Written by: John H. Baldwin <jhb@FreeBSD.org>
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:

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

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
28#include <sys/cdefs.h>
29__FBSDID("$FreeBSD: stable/10/usr.sbin/bhyve/pm.c 268891 2014-07-19 22:06:46Z jhb $");
29__FBSDID("$FreeBSD: stable/10/usr.sbin/bhyve/pm.c 268972 2014-07-22 03:14:37Z jhb $");
30
31#include <sys/types.h>
32#include <machine/vmm.h>
33
34#include <assert.h>
35#include <pthread.h>
36#include <signal.h>
37#include <vmmapi.h>
38
39#include "acpi.h"
40#include "inout.h"
41#include "mevent.h"
30
31#include <sys/types.h>
32#include <machine/vmm.h>
33
34#include <assert.h>
35#include <pthread.h>
36#include <signal.h>
37#include <vmmapi.h>
38
39#include "acpi.h"
40#include "inout.h"
41#include "mevent.h"
42#include "pci_irq.h"
42#include "pci_lpc.h"
43
44static pthread_mutex_t pm_lock = PTHREAD_MUTEX_INITIALIZER;
45static struct mevent *power_button;
46static sig_t old_power_handler;
47
48/*
49 * Reset Control register at I/O port 0xcf9. Bit 2 forces a system

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

284 }
285 break;
286 }
287 pthread_mutex_unlock(&pm_lock);
288 return (0);
289}
290INOUT_PORT(smi_cmd, SMI_CMD, IOPORT_F_OUT, smi_cmd_handler);
291SYSRES_IO(SMI_CMD, 1);
43#include "pci_lpc.h"
44
45static pthread_mutex_t pm_lock = PTHREAD_MUTEX_INITIALIZER;
46static struct mevent *power_button;
47static sig_t old_power_handler;
48
49/*
50 * Reset Control register at I/O port 0xcf9. Bit 2 forces a system

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

285 }
286 break;
287 }
288 pthread_mutex_unlock(&pm_lock);
289 return (0);
290}
291INOUT_PORT(smi_cmd, SMI_CMD, IOPORT_F_OUT, smi_cmd_handler);
292SYSRES_IO(SMI_CMD, 1);
293
294void
295sci_init(struct vmctx *ctx)
296{
297
298 /*
299 * Mark ACPI's SCI as level trigger and bump its use count
300 * in the PIRQ router.
301 */
302 pci_irq_use(SCI_INT);
303 vm_isa_set_irq_trigger(ctx, SCI_INT, LEVEL_TRIGGER);
304}