ao_poll.c revision 7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fe
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * CDDL HEADER START
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * The contents of this file are subject to the terms of the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Common Development and Distribution License, Version 1.0 only
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * (the "License"). You may not use this file except in compliance
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * with the License.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * See the License for the specific language governing permissions
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * and limitations under the License.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * When distributing Covered Code, include this CDDL HEADER in each
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * If applicable, add the following below this CDDL HEADER, with the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * fields enclosed by brackets "[]" replaced with your own identifying
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * information: Portions Copyright [yyyy] [name of copyright owner]
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * CDDL HEADER END
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Use is subject to license terms.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#pragma ident "%Z%%M% %I% %E% SMI"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * AMD Athlon64/Opteron CPU Module Machine-Check Poller
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * The AMD Opteron processor doesn't yet report correctable errors via #mc's.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Instead, it fixes the problem, silently updates the error state MSRs, and
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * resumes operation. In order to discover occurrances of correctable errors,
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * we have to poll in the background using the omni cyclics mechanism. The
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * error injector also has the ability to manually request an immediate poll.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Locking is fairly simple within the poller: the per-CPU mutex
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * ao->ao_mca.ao_mca_poll_lock ensures that only one poll request is active.
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulknerstatic uint_t ao_mca_poll_trace_always = 1;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstatic void
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinao_mca_poll_trace(ao_mca_t *mca, uint32_t what, uint32_t nerr)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin DTRACE_PROBE2(ao__poll__trace, uint32_t, what, uint32_t, nerr);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return; /* poll trace buffer is disabled */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin next = (mca->ao_mca_poll_curtrace + 1) % ao_mca_poll_trace_nent;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstatic void
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin ao_cpu_logout_t *acl = &mca->ao_mca_logout[AO_MCA_LOGOUT_POLLER];
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * On the first poll after re-enabling a faulty CPU we clear
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * the status registers; see ao_faulted_exit() for more info.
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner for (i = 0; i < AMD_MCA_BANK_COUNT; i++)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (ao != NULL && mutex_tryenter(&ao->ao_mca.ao_mca_poll_lock)) {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/*ARGSUSED*/
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstatic void
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinao_mca_poll_online(void *arg, cpu_t *cpu, cyc_handler_t *cyh, cyc_time_t *cyt)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * If the CPU coming on-line isn't supported by this CPU module, then
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * disable the cylic by cranking cyt_interval and setting arg to NULL.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/*ARGSUSED*/
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstatic void
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinao_mca_poll_offline(void *arg, cpu_t *cpu, void *cyh_arg)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin /* nothing to do here */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin mutex_init(&mca->ao_mca_poll_lock, NULL, MUTEX_DRIVER, NULL);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return; /* if manually tuned to zero, disable polling */