xref: /freebsd/sys/dev/vmd/vmd.h (revision 76c678688634e9e2ea5f6369fb979aabddbfe426)
1f2521a76SDoug Ambrisko /*-
2f2521a76SDoug Ambrisko  * SPDX-License-Identifier: BSD-2-Clause
3f2521a76SDoug Ambrisko  *
47af4475aSAlexander Motin  * Copyright (c) 2021 Alexander Motin <mav@FreeBSD.org>
5f2521a76SDoug Ambrisko  * Copyright 2019 Cisco Systems, Inc.
6f2521a76SDoug Ambrisko  * All rights reserved.
7f2521a76SDoug Ambrisko  *
8f2521a76SDoug Ambrisko  * Redistribution and use in source and binary forms, with or without
9f2521a76SDoug Ambrisko  * modification, are permitted provided that the following conditions
10f2521a76SDoug Ambrisko  * are met:
11f2521a76SDoug Ambrisko  * 1. Redistributions of source code must retain the above copyright
12f2521a76SDoug Ambrisko  *    notice, this list of conditions and the following disclaimer.
13f2521a76SDoug Ambrisko  * 2. Redistributions in binary form must reproduce the above copyright
14f2521a76SDoug Ambrisko  *    notice, this list of conditions and the following disclaimer in the
15f2521a76SDoug Ambrisko  *    documentation and/or other materials provided with the distribution.
16f2521a76SDoug Ambrisko  *
17f2521a76SDoug Ambrisko  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18f2521a76SDoug Ambrisko  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19f2521a76SDoug Ambrisko  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20f2521a76SDoug Ambrisko  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21f2521a76SDoug Ambrisko  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22f2521a76SDoug Ambrisko  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23f2521a76SDoug Ambrisko  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24f2521a76SDoug Ambrisko  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25f2521a76SDoug Ambrisko  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26f2521a76SDoug Ambrisko  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27f2521a76SDoug Ambrisko  * SUCH DAMAGE.
28f2521a76SDoug Ambrisko  *
29f2521a76SDoug Ambrisko  */
30f2521a76SDoug Ambrisko 
31f2521a76SDoug Ambrisko #ifndef __VMD_PRIVATE_H__
32f2521a76SDoug Ambrisko #define	__VMD_PRIVATE_H__
33f2521a76SDoug Ambrisko 
347af4475aSAlexander Motin #include <dev/pci/pcib_private.h>
357af4475aSAlexander Motin 
367af4475aSAlexander Motin struct vmd_irq_user {
377af4475aSAlexander Motin 	LIST_ENTRY(vmd_irq_user)	viu_link;
387af4475aSAlexander Motin 	device_t			viu_child;
397af4475aSAlexander Motin 	int				viu_vector;
40f2521a76SDoug Ambrisko };
41f2521a76SDoug Ambrisko 
42f2521a76SDoug Ambrisko struct vmd_irq {
437af4475aSAlexander Motin 	struct resource			*vi_res;
447af4475aSAlexander Motin 	int				vi_rid;
457af4475aSAlexander Motin 	int				vi_irq;
467af4475aSAlexander Motin 	void				*vi_handle;
477af4475aSAlexander Motin 	int				vi_nusers;
48f2521a76SDoug Ambrisko };
49f2521a76SDoug Ambrisko 
507af4475aSAlexander Motin struct vmd_softc {
517af4475aSAlexander Motin 	struct pcib_softc		psc;
52f2521a76SDoug Ambrisko 
53f2521a76SDoug Ambrisko #define VMD_MAX_BAR		3
54f2521a76SDoug Ambrisko 	int				vmd_regs_rid[VMD_MAX_BAR];
557af4475aSAlexander Motin 	struct resource			*vmd_regs_res[VMD_MAX_BAR];
56f2521a76SDoug Ambrisko 	struct vmd_irq			*vmd_irq;
577af4475aSAlexander Motin 	LIST_HEAD(,vmd_irq_user)	vmd_users;
587af4475aSAlexander Motin 	int				vmd_fist_vector;
59f2521a76SDoug Ambrisko 	int				vmd_msix_count;
600c852bb9SDoug Ambrisko 	uint8_t				vmd_bus_start;
617af4475aSAlexander Motin 	uint8_t				vmd_bus_end;
62*5d9e5a7eSAlexander Motin 	bus_dma_tag_t			vmd_dma_tag;
63f2521a76SDoug Ambrisko };
64f2521a76SDoug Ambrisko 
65f2521a76SDoug Ambrisko #endif
66