1221828Sgrehan/*-
2221828Sgrehan * Copyright (c) 2011 NetApp, Inc.
3221828Sgrehan * All rights reserved.
4221828Sgrehan *
5221828Sgrehan * Redistribution and use in source and binary forms, with or without
6221828Sgrehan * modification, are permitted provided that the following conditions
7221828Sgrehan * are met:
8221828Sgrehan * 1. Redistributions of source code must retain the above copyright
9221828Sgrehan *    notice, this list of conditions and the following disclaimer.
10221828Sgrehan * 2. Redistributions in binary form must reproduce the above copyright
11221828Sgrehan *    notice, this list of conditions and the following disclaimer in the
12221828Sgrehan *    documentation and/or other materials provided with the distribution.
13221828Sgrehan *
14221828Sgrehan * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND
15221828Sgrehan * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16221828Sgrehan * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17221828Sgrehan * ARE DISCLAIMED.  IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE
18221828Sgrehan * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19221828Sgrehan * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20221828Sgrehan * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21221828Sgrehan * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22221828Sgrehan * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23221828Sgrehan * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24221828Sgrehan * SUCH DAMAGE.
25221828Sgrehan *
26221828Sgrehan * $FreeBSD: stable/11/sys/amd64/vmm/io/ppt.h 351753 2019-09-03 16:23:46Z emaste $
27221828Sgrehan */
28221828Sgrehan
29221828Sgrehan#ifndef _IO_PPT_H_
30221828Sgrehan#define	_IO_PPT_H_
31221828Sgrehan
32221828Sgrehanint	ppt_unassign_all(struct vm *vm);
33221828Sgrehanint	ppt_map_mmio(struct vm *vm, int bus, int slot, int func,
34221828Sgrehan		     vm_paddr_t gpa, size_t len, vm_paddr_t hpa);
35221828Sgrehanint	ppt_setup_msi(struct vm *vm, int vcpu, int bus, int slot, int func,
36259482Sneel		      uint64_t addr, uint64_t msg, int numvec);
37234761Sgrehanint	ppt_setup_msix(struct vm *vm, int vcpu, int bus, int slot, int func,
38259482Sneel		int idx, uint64_t addr, uint64_t msg, uint32_t vector_control);
39260972Sneelint	ppt_assigned_devices(struct vm *vm);
40351753Semastebool	ppt_is_mmio(struct vm *vm, vm_paddr_t gpa);
41256072Sneel
42256072Sneel/*
43260972Sneel * Returns the number of devices sequestered by the ppt driver for assignment
44260972Sneel * to virtual machines.
45260972Sneel */
46260972Sneelint	ppt_avail_devices(void);
47260972Sneel
48260972Sneel/*
49256072Sneel * The following functions should never be called directly.
50256072Sneel * Use 'vm_assign_pptdev()' and 'vm_unassign_pptdev()' instead.
51256072Sneel */
52256072Sneelint	ppt_assign_device(struct vm *vm, int bus, int slot, int func);
53256072Sneelint	ppt_unassign_device(struct vm *vm, int bus, int slot, int func);
54221828Sgrehan#endif
55