5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync/* $Id$ */
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync/** @file
5b281ba489ca18f0380d7efc7a5108b606cce449vboxsync * IPRT - Multiprocessor, Ring-0 Driver, Internal Header.
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync */
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync/*
c7814cf6e1240a519cbec0441e033d0e2470ed00vboxsync * Copyright (C) 2008-2011 Oracle Corporation
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync *
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync * available from http://www.virtualbox.org. This file is free software;
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync * you can redistribute it and/or modify it under the terms of the GNU
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync * General Public License (GPL) as published by the Free Software
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync *
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync * The contents of this file may alternatively be used under the terms
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync * of the Common Development and Distribution License Version 1.0
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync * VirtualBox OSE distribution, in which case the provisions of the
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync * CDDL are applicable instead of those of the GPL.
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync *
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync * You may elect to license modified versions of this file under the
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync * terms and conditions of either the GPL or the CDDL or both.
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync */
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync#ifndef ___r0drv_mp_r0drv_h
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync#define ___r0drv_mp_r0drv_h
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync#include <iprt/mp.h>
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync
590bfe12ce22cd3716448fbb9f4dc51664bfe5e2vboxsyncRT_C_DECLS_BEGIN
35103e3fc3e204aa31add87bd33a0361871c0e70vboxsync
6c182be3b4c0409b4562cec9998d87084c8ee02avboxsync/**
6c182be3b4c0409b4562cec9998d87084c8ee02avboxsync * MP callback
6c182be3b4c0409b4562cec9998d87084c8ee02avboxsync *
6c182be3b4c0409b4562cec9998d87084c8ee02avboxsync * @param idCpu CPU id
6c182be3b4c0409b4562cec9998d87084c8ee02avboxsync * @param pvUser1 The first user argument.
6c182be3b4c0409b4562cec9998d87084c8ee02avboxsync * @param pvUser2 The second user argument.
6c182be3b4c0409b4562cec9998d87084c8ee02avboxsync */
6c182be3b4c0409b4562cec9998d87084c8ee02avboxsynctypedef DECLCALLBACK(void) FNMPWORKER(RTCPUID idCpu, void *pvUser1, void *pvUser2);
6c182be3b4c0409b4562cec9998d87084c8ee02avboxsync/** Pointer to a FNMPWORKER(). */
6c182be3b4c0409b4562cec9998d87084c8ee02avboxsynctypedef FNMPWORKER *PFNMPWORKER;
6c182be3b4c0409b4562cec9998d87084c8ee02avboxsync
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync/**
0aaf889969ebdaba8a310db13adcec8c10174796vboxsync * RTMpOn* argument packet used by the host specific callback
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync * wrapper functions.
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync */
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsynctypedef struct RTMPARGS
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync{
6c182be3b4c0409b4562cec9998d87084c8ee02avboxsync PFNMPWORKER pfnWorker;
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync void *pvUser1;
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync void *pvUser2;
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync RTCPUID idCpu;
3cc72184bf4115d7bdd99e87712705f022a21de8vboxsync RTCPUID idCpu2;
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync uint32_t volatile cHits;
849739f7d746a399a1bc0dd6d1e2ea48ec6659c0vboxsync#ifdef RT_OS_WINDOWS
849739f7d746a399a1bc0dd6d1e2ea48ec6659c0vboxsync /** Turns out that KeFlushQueuedDpcs doesn't necessarily wait till all
849739f7d746a399a1bc0dd6d1e2ea48ec6659c0vboxsync * callbacks are done. So, do reference counting to make sure we don't free
849739f7d746a399a1bc0dd6d1e2ea48ec6659c0vboxsync * this structure befor all CPUs have completely handled their requests. */
849739f7d746a399a1bc0dd6d1e2ea48ec6659c0vboxsync int32_t volatile cRefs;
849739f7d746a399a1bc0dd6d1e2ea48ec6659c0vboxsync#endif
76829bbc7b41f9046084392bd1db9ee8f11e2fb5vboxsync#ifdef RT_OS_LINUX
76829bbc7b41f9046084392bd1db9ee8f11e2fb5vboxsync PRTCPUSET pWorkerSet;
76829bbc7b41f9046084392bd1db9ee8f11e2fb5vboxsync#endif
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync} RTMPARGS;
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync/** Pointer to a RTMpOn* argument packet. */
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsynctypedef RTMPARGS *PRTMPARGS;
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync
fc85d12482b4d79dd2dfd0989b9730433c7a45cbvboxsync/* Called from initterm-r0drv.cpp: */
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsyncDECLHIDDEN(int) rtR0MpNotificationInit(void);
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsyncDECLHIDDEN(void) rtR0MpNotificationTerm(void);
fc85d12482b4d79dd2dfd0989b9730433c7a45cbvboxsync
fc85d12482b4d79dd2dfd0989b9730433c7a45cbvboxsync/* The following is only relevant when using mpnotifcation-r0drv.cpp: */
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsyncDECLHIDDEN(int) rtR0MpNotificationNativeInit(void);
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsyncDECLHIDDEN(void) rtR0MpNotificationNativeTerm(void);
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsyncDECLHIDDEN(void) rtMpNotificationDoCallbacks(RTMPEVENT enmEvent, RTCPUID idCpu);
0aaf889969ebdaba8a310db13adcec8c10174796vboxsync
590bfe12ce22cd3716448fbb9f4dc51664bfe5e2vboxsyncRT_C_DECLS_END
35103e3fc3e204aa31add87bd33a0361871c0e70vboxsync
5e91fc5e5ea9cccb7a40636f73253d489fbe340bvboxsync#endif
fc85d12482b4d79dd2dfd0989b9730433c7a45cbvboxsync