vmd.h (0c852bb9b9282b30fd047ac1de398358f33777f4) vmd.h (7af4475a6e31202a865b1dd3727018659b44470f)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause
3 *
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause
3 *
4 * Copyright (c) 2021 Alexander Motin <mav@FreeBSD.org>
4 * Copyright 2019 Cisco Systems, Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.

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

27 *
28 * $FreeBSD$
29 *
30 */
31
32#ifndef __VMD_PRIVATE_H__
33#define __VMD_PRIVATE_H__
34
5 * Copyright 2019 Cisco Systems, Inc.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.

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

28 *
29 * $FreeBSD$
30 *
31 */
32
33#ifndef __VMD_PRIVATE_H__
34#define __VMD_PRIVATE_H__
35
35struct vmd_irq_handler {
36 TAILQ_ENTRY(vmd_irq_handler) vmd_link;
37 device_t vmd_child;
38 driver_intr_t *vmd_intr;
39 void *vmd_arg;
40 int vmd_rid;
36#include <dev/pci/pcib_private.h>
37
38struct vmd_irq_user {
39 LIST_ENTRY(vmd_irq_user) viu_link;
40 device_t viu_child;
41 int viu_vector;
41};
42
43struct vmd_irq {
42};
43
44struct vmd_irq {
44 struct resource *vmd_res;
45 int vmd_rid;
46 void *vmd_handle;
47 struct vmd_softc *vmd_sc;
48 int vmd_instance;
49 TAILQ_HEAD(,vmd_irq_handler) vmd_list;
45 struct resource *vi_res;
46 int vi_rid;
47 int vi_irq;
48 void *vi_handle;
49 int vi_nusers;
50};
51
50};
51
52/*
53 * VMD specific data.
54 */
55struct vmd_softc
56{
57 device_t vmd_dev;
58 device_t vmd_child;
59 uint32_t vmd_flags; /* flags */
60#define PCIB_SUBTRACTIVE 0x1
61#define PCIB_DISABLE_MSI 0x2
62#define PCIB_DISABLE_MSIX 0x4
63#define PCIB_ENABLE_ARI 0x8
64#define PCIB_HOTPLUG 0x10
65#define PCIB_HOTPLUG_CMD_PENDING 0x20
66#define PCIB_DETACH_PENDING 0x40
67#define PCIB_DETACHING 0x80
68 u_int vmd_domain; /* domain number */
69 struct pcib_secbus vmd_bus; /* secondary bus numbers */
52struct vmd_softc {
53 struct pcib_softc psc;
70
54
71#define VMD_MAX_BAR 3
72 struct resource *vmd_regs_resource[VMD_MAX_BAR];
73 int vmd_regs_rid[VMD_MAX_BAR];
74 bus_space_handle_t vmd_bhandle;
75 bus_space_tag_t vmd_btag;
76 int vmd_io_rid;
77 struct resource *vmd_io_resource;
78 void *vmd_intr;
79 struct vmd_irq *vmd_irq;
80 int vmd_msix_count;
81 uint8_t vmd_bus_start;
82#ifdef TASK_QUEUE_INTR
83 struct taskqueue *vmd_irq_tq;
84 struct task vmd_irq_task;
85#else
86 struct mtx vmd_irq_lock;
87#endif
55#define VMD_MAX_BAR 3
56 int vmd_regs_rid[VMD_MAX_BAR];
57 struct resource *vmd_regs_res[VMD_MAX_BAR];
58 bus_space_handle_t vmd_bhandle;
59 bus_space_tag_t vmd_btag;
60 struct vmd_irq *vmd_irq;
61 LIST_HEAD(,vmd_irq_user) vmd_users;
62 int vmd_fist_vector;
63 int vmd_msix_count;
64 uint8_t vmd_bus_start;
65 uint8_t vmd_bus_end;
88};
89
90#endif
66};
67
68#endif