summaryrefslogtreecommitdiff
path: root/src/VBox/Devices/Bus/MsiCommon.h
blob: 73ddda46fa6b72ae752e01de761e68ef48932986 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* $Id: MsiCommon.h $ */
/** @file
 * Header for MSI/MSI-X support routines.
 */
/*
 * Copyright (C) 2010-2012 Oracle Corporation
 *
 * This file is part of VirtualBox Open Source Edition (OSE), as
 * available from http://www.virtualbox.org. This file is free software;
 * you can redistribute it and/or modify it under the terms of the GNU
 * General Public License (GPL) as published by the Free Software
 * Foundation, in version 2 as it comes in the "COPYING" file of the
 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
 */

/* Maybe belongs to types.h */
#ifdef IN_RING3
typedef PCPDMPCIHLPR3 PCPDMPCIHLP;
#endif

#ifdef IN_RING0
typedef PCPDMPCIHLPR0 PCPDMPCIHLP;
#endif

#ifdef IN_RC
typedef PCPDMPCIHLPRC PCPDMPCIHLP;
#endif

#ifdef IN_RING3
/* Init MSI support in the device. */
int      MsiInit(PPCIDEVICE pDev, PPDMMSIREG pMsiReg);
#endif

/* If MSI is enabled, so that MSINotify() shall be used for notifications.  */
bool     MsiIsEnabled(PPCIDEVICE pDev);

/* Device notification (aka interrupt). */
void     MsiNotify(PPDMDEVINS pDevIns, PCPDMPCIHLP pPciHlp, PPCIDEVICE pDev, int iVector, int iLevel, uint32_t uTagSrc);

#ifdef IN_RING3
/* PCI config space accessors for MSI registers */
void     MsiPciConfigWrite(PPDMDEVINS pDevIns, PCPDMPCIHLP pPciHlp, PPCIDEVICE pDev, uint32_t u32Address, uint32_t val, unsigned len);
uint32_t MsiPciConfigRead (PPDMDEVINS pDevIns, PPCIDEVICE pDev, uint32_t u32Address, unsigned len);
#endif

#ifdef IN_RING3
/* Init MSI-X support in the device. */
int      MsixInit(PCPDMPCIHLP pPciHlp, PPCIDEVICE pDev, PPDMMSIREG pMsiReg);
#endif

/* If MSI-X is enabled, so that MSIXNotify() shall be used for notifications.  */
bool     MsixIsEnabled(PPCIDEVICE pDev);

/* Device notification (aka interrupt). */
void     MsixNotify(PPDMDEVINS pDevIns, PCPDMPCIHLP pPciHlp, PPCIDEVICE pDev, int iVector, int iLevel, uint32_t uTagSrc);

#ifdef IN_RING3
/* PCI config space accessors for MSI-X */
void     MsixPciConfigWrite(PPDMDEVINS pDevIns, PCPDMPCIHLP pPciHlp, PPCIDEVICE pDev, uint32_t u32Address, uint32_t val, unsigned len);
uint32_t MsixPciConfigRead (PPDMDEVINS pDevIns, PPCIDEVICE pDev, uint32_t u32Address, unsigned len);
#endif