1283670Sjhb/*-
2283670Sjhb * Copyright (c) 2013-2015 Sandvine Inc.
3283670Sjhb * All rights reserved.
4283670Sjhb *
5283670Sjhb * Redistribution and use in source and binary forms, with or without
6283670Sjhb * modification, are permitted provided that the following conditions
7283670Sjhb * are met:
8283670Sjhb * 1. Redistributions of source code must retain the above copyright
9283670Sjhb *    notice, this list of conditions and the following disclaimer.
10283670Sjhb * 2. Redistributions in binary form must reproduce the above copyright
11283670Sjhb *    notice, this list of conditions and the following disclaimer in the
12283670Sjhb *    documentation and/or other materials provided with the distribution.
13283670Sjhb *
14283670Sjhb * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15283670Sjhb * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16283670Sjhb * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17283670Sjhb * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18283670Sjhb * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19283670Sjhb * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20283670Sjhb * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21283670Sjhb * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22283670Sjhb * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23283670Sjhb * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24283670Sjhb * SUCH DAMAGE.
25283670Sjhb *
26283670Sjhb * $FreeBSD: stable/11/sys/dev/pci/pci_iov.h 306461 2016-09-29 22:52:24Z jhb $
27283670Sjhb */
28283670Sjhb
29283670Sjhb#ifndef _PCI_IOV_H_
30283670Sjhb#define	_PCI_IOV_H_
31283670Sjhb
32283670Sjhb#include "pci_iov_if.h"
33283670Sjhb
34283670Sjhbstruct nvlist;
35283670Sjhb
36306461Sjhbint	pci_iov_attach_name(device_t dev, struct nvlist *pf_schema,
37306461Sjhb	    struct nvlist *vf_schema, const char *fmt, ...) __printflike(4, 5);
38306461Sjhb
39283670Sjhbstatic __inline int
40283670Sjhbpci_iov_attach(device_t dev, struct nvlist *pf_schema, struct nvlist *vf_schema)
41283670Sjhb{
42306461Sjhb	return (PCI_IOV_ATTACH_NAME(device_get_parent(dev), dev, pf_schema,
43306461Sjhb	    vf_schema, device_get_nameunit(dev)));
44283670Sjhb}
45283670Sjhb
46283670Sjhbstatic __inline int
47283670Sjhbpci_iov_detach(device_t dev)
48283670Sjhb{
49283670Sjhb	return (PCI_IOV_DETACH(device_get_parent(dev), dev));
50283670Sjhb}
51283670Sjhb
52283670Sjhb#endif /* !_PCI_IOV_H_ */
53