4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
30 * AMD Athlon64/Opteron Model-Specific Poller Implementation
33 #include <sys/types.h>
38 * Decide whether the caller should poll the NB. The decision is made
39 * and any poll is performed under protection of the chip-wide mutex
40 * enforced at the caller's level. That mutex already ensures that all
41 * pollers on a chip are serialized - the following is simply to
42 * avoid the NB poll ping-ponging between different detectors.
45 ao_ms_poll_ownermask(cmi_hdl_t hdl
, hrtime_t pintvl
)
47 ao_ms_data_t
*ao
= cms_hdl_getcmsdata(hdl
);
48 hrtime_t now
= gethrtime_waitfree();
49 hrtime_t last
= ao
->ao_ms_shared
->aos_nb_poll_timestamp
;
52 if (now
- last
> 2 * pintvl
|| last
== 0) {
54 * If no last value has been recorded assume ownership.
55 * Otherwise only take over if the current "owner" seems
56 * to be making little progress.
58 ao
->ao_ms_shared
->aos_nb_poll_owner
= hdl
;
60 } else if (ao
->ao_ms_shared
->aos_nb_poll_owner
== hdl
) {
62 * This is the current owner and it is making progress.
68 ao
->ao_ms_shared
->aos_nb_poll_timestamp
= now
;
70 return (dopoll
? -1ULL : ~(1 << AMD_MCA_BANK_NB
));