MsiCommon.h revision 4ef4ca335d8ad12329cb55f9f7e54648412f1ce4
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts/* $Id$ */
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts/** @file
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts * Header for MSI/MSI-X support routines.
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts */
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts/*
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts * Copyright (C) 2010 Oracle Corporation
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts *
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts * This file is part of VirtualBox Open Source Edition (OSE), as
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts * available from http://www.virtualbox.org. This file is free software;
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts * you can redistribute it and/or modify it under the terms of the GNU
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts * General Public License (GPL) as published by the Free Software
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts * Foundation, in version 2 as it comes in the "COPYING" file of the
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts */
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts/* Maybe belongs to types.h */
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts#ifdef IN_RING3
31efa30f058787c2c450472578e51d9f4760271aJames Phillpottstypedef PCPDMPCIHLPR3 PCPDMPCIHLP;
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts#endif
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts#ifdef IN_RING0
31efa30f058787c2c450472578e51d9f4760271aJames Phillpottstypedef PCPDMPCIHLPR0 PCPDMPCIHLP;
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts#endif
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts#ifdef IN_RC
31efa30f058787c2c450472578e51d9f4760271aJames Phillpottstypedef PCPDMPCIHLPRC PCPDMPCIHLP;
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts#endif
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts/* Init MSI support in the device. */
31efa30f058787c2c450472578e51d9f4760271aJames Phillpottsint MsiInit(PPCIDEVICE pDev, PPDMMSIREG pMsiReg);
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts/* If MSI is enabled, so that MSINotify() shall be used for notifications. */
31efa30f058787c2c450472578e51d9f4760271aJames Phillpottsbool MsiIsEnabled(PPCIDEVICE pDev);
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts/* Device notification (aka interrupt). */
31efa30f058787c2c450472578e51d9f4760271aJames Phillpottsvoid MsiNotify(PPDMDEVINS pDevIns, PCPDMPCIHLP pPciHlp, PPCIDEVICE pDev, int iVector, int iLevel);
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts/* PCI config space accessors for MSI registers */
31efa30f058787c2c450472578e51d9f4760271aJames Phillpottsvoid MsiPciConfigWrite(PPDMDEVINS pDevIns, PCPDMPCIHLP pPciHlp, PPCIDEVICE pDev, uint32_t u32Address, uint32_t val, unsigned len);
31efa30f058787c2c450472578e51d9f4760271aJames Phillpottsuint32_t MsiPciConfigRead (PPDMDEVINS pDevIns, PPCIDEVICE pDev, uint32_t u32Address, unsigned len);
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts/* Init MSI-X support in the device. */
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts#ifdef IN_RING3
31efa30f058787c2c450472578e51d9f4760271aJames Phillpottsint MsixInit(PCPDMPCIHLP pPciHlp, PPCIDEVICE pDev, PPDMMSIREG pMsiReg);
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts#endif
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts
31efa30f058787c2c450472578e51d9f4760271aJames Phillpotts/* If MSI-X is enabled, so that MSIXNotify() shall be used for notifications. */
31efa30f058787c2c450472578e51d9f4760271aJames Phillpottsbool MsixIsEnabled(PPCIDEVICE pDev);
/* Device notification (aka interrupt). */
void MsixNotify(PPDMDEVINS pDevIns, PCPDMPCIHLP pPciHlp, PPCIDEVICE pDev, int iVector, int iLevel);
/* 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);