VirtualBox

source: vbox/trunk/src/VBox/Runtime/r0drv/solaris/vbi/mpnotification-r0drv-solaris.c@ 29284

Last change on this file since 29284 was 28800, checked in by vboxsync, 15 years ago

Automated rebranding to Oracle copyright/license strings via filemuncher

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
1/* $Id: mpnotification-r0drv-solaris.c 28800 2010-04-27 08:22:32Z vboxsync $ */
2/** @file
3 * IPRT - Multiprocessor Event Notifications, Ring-0 Driver, Solaris.
4 */
5
6/*
7 * Copyright (C) 2008 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 */
26
27/*******************************************************************************
28* Header Files *
29*******************************************************************************/
30#include "../the-solaris-kernel.h"
31#include "internal/iprt.h"
32
33#include <iprt/err.h>
34#include <iprt/mp.h>
35#include <iprt/cpuset.h>
36#include "r0drv/mp-r0drv.h"
37
38
39/*******************************************************************************
40* Global Variables *
41*******************************************************************************/
42/** CPU watch callback handle. */
43static vbi_cpu_watch_t *g_hVbiCpuWatch = NULL;
44/** Set of online cpus that is maintained by the MP callback.
45 * This avoids locking issues quering the set from the kernel as well as
46 * eliminating any uncertainty regarding the online status during the
47 * callback. */
48RTCPUSET g_rtMpSolarisCpuSet;
49
50
51static void rtMpNotificationSolarisCallback(void *pvUser, int iCpu, int online)
52{
53 NOREF(pvUser);
54
55 /* ASSUMES iCpu == RTCPUID */
56 if (online)
57 {
58 RTCpuSetAdd(&g_rtMpSolarisCpuSet, iCpu);
59 rtMpNotificationDoCallbacks(RTMPEVENT_ONLINE, iCpu);
60 }
61 else
62 {
63 RTCpuSetDel(&g_rtMpSolarisCpuSet, iCpu);
64 rtMpNotificationDoCallbacks(RTMPEVENT_OFFLINE, iCpu);
65 }
66}
67
68
69int rtR0MpNotificationNativeInit(void)
70{
71 if (vbi_revision_level < 2)
72 return VERR_NOT_SUPPORTED;
73 if (g_hVbiCpuWatch != NULL)
74 return VERR_WRONG_ORDER;
75
76 /*
77 * Register the callback building the online cpu set as we
78 * do so (current_too = 1).
79 */
80 RTCpuSetEmpty(&g_rtMpSolarisCpuSet);
81 g_hVbiCpuWatch = vbi_watch_cpus(rtMpNotificationSolarisCallback, NULL, 1 /*current_too*/);
82
83 return VINF_SUCCESS;
84}
85
86
87void rtR0MpNotificationNativeTerm(void)
88{
89 if (vbi_revision_level >= 2 && g_hVbiCpuWatch != NULL)
90 vbi_ignore_cpus(g_hVbiCpuWatch);
91 g_hVbiCpuWatch = NULL;
92}
93
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette