* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
-static boolean_t mca_initialized = FALSE;
-static boolean_t mca_MCE_present = FALSE;
-static boolean_t mca_MCA_present = FALSE;
-static uint32_t mca_family = 0;
-static unsigned int mca_error_bank_count = 0;
-static boolean_t mca_control_MSR_present = FALSE;
-static boolean_t mca_cmci_present = FALSE;
-static ia32_mcg_cap_t ia32_mcg_cap;
+static boolean_t mca_initialized = FALSE;
+static boolean_t mca_MCE_present = FALSE;
+static boolean_t mca_MCA_present = FALSE;
+static uint32_t mca_family = 0;
+static unsigned int mca_error_bank_count = 0;
+static boolean_t mca_control_MSR_present = FALSE;
+static boolean_t mca_cmci_present = FALSE;
+static ia32_mcg_cap_t ia32_mcg_cap;
- ia32_mci_ctl_t mca_mci_ctl;
- ia32_mci_status_t mca_mci_status;
- ia32_mci_misc_t mca_mci_misc;
- ia32_mci_addr_t mca_mci_addr;
+ ia32_mci_ctl_t mca_mci_ctl;
+ ia32_mci_status_t mca_mci_status;
+ ia32_mci_misc_t mca_mci_misc;
+ ia32_mci_addr_t mca_mci_addr;
- boolean_t mca_is_saved;
- boolean_t mca_is_valid; /* some state is valid */
- ia32_mcg_ctl_t mca_mcg_ctl;
- ia32_mcg_status_t mca_mcg_status;
- mca_mci_bank_t mca_error_bank[0];
+ boolean_t mca_is_saved;
+ boolean_t mca_is_valid; /* some state is valid */
+ ia32_mcg_ctl_t mca_mcg_ctl;
+ ia32_mcg_status_t mca_mcg_status;
+ mca_mci_bank_t mca_error_bank[0];
- uint64_t features = cpuid_info()->cpuid_features;
- uint32_t family = cpuid_info()->cpuid_family;
- uint32_t model = cpuid_info()->cpuid_model;
- uint32_t stepping = cpuid_info()->cpuid_stepping;
+ uint64_t features = cpuid_info()->cpuid_features;
+ uint32_t family = cpuid_info()->cpuid_family;
+ uint32_t model = cpuid_info()->cpuid_model;
+ uint32_t stepping = cpuid_info()->cpuid_stepping;
mca_MCE_present = (features & CPUID_FEATURE_MCE) != 0;
mca_MCA_present = (features & CPUID_FEATURE_MCA) != 0;
mca_MCE_present = (features & CPUID_FEATURE_MCE) != 0;
mca_MCA_present = (features & CPUID_FEATURE_MCA) != 0;
- for (i = 1; i < mca_error_bank_count; i++)
- wrmsr64(IA32_MCi_CTL(i),0xFFFFFFFFFFFFFFFFULL);
-
+ for (i = 1; i < mca_error_bank_count; i++) {
+ wrmsr64(IA32_MCi_CTL(i), 0xFFFFFFFFFFFFFFFFULL);
+ }
+
- for (i = 0; i < mca_error_bank_count; i++)
- wrmsr64(IA32_MCi_CTL(i),0xFFFFFFFFFFFFFFFFULL);
-
+ for (i = 0; i < mca_error_bank_count; i++) {
+ wrmsr64(IA32_MCi_CTL(i), 0xFFFFFFFFFFFFFFFFULL);
+ }
+
- sizeof(mca_mci_bank_t) * mca_error_bank_count;
- cdp->cpu_mca_state = kalloc(mca_state_size);
+ sizeof(mca_mci_bank_t) * mca_error_bank_count;
+ cdp->cpu_mca_state = zalloc_permanent(mca_state_size, ZALIGN_PTR);
if (cdp->cpu_mca_state == NULL) {
printf("mca_cpu_alloc() failed for cpu %d\n", cdp->cpu_number);
return;
}
if (cdp->cpu_mca_state == NULL) {
printf("mca_cpu_alloc() failed for cpu %d\n", cdp->cpu_number);
return;
}
- bank->mca_mci_ctl = rdmsr64(IA32_MCi_CTL(i));
- bank->mca_mci_status.u64 = rdmsr64(IA32_MCi_STATUS(i));
- if (!bank->mca_mci_status.bits.val)
+ bank->mca_mci_ctl = rdmsr64(IA32_MCi_CTL(i));
+ bank->mca_mci_status.u64 = rdmsr64(IA32_MCi_STATUS(i));
+ if (!bank->mca_mci_status.bits.val) {
/*
* If we're the first thread with MCA state, point our package to it
* and don't care about races
*/
/*
* If we're the first thread with MCA state, point our package to it
* and don't care about races
*/
i386_cpu_info_t *infop = cpuid_info();
paniclog_append_noflush(" family: %d model: %d stepping: %d microcode: %d\n",
i386_cpu_info_t *infop = cpuid_info();
paniclog_append_noflush(" family: %d model: %d stepping: %d microcode: %d\n",
* Serialize: the first caller controls dumping MCA registers,
* other threads spin meantime.
*/
* Serialize: the first caller controls dumping MCA registers,
* other threads spin meantime.
*/
}
status = mcsp->mca_mcg_status;
paniclog_append_noflush("Processor %d: IA32_MCG_STATUS: 0x%016qx\n",
}
status = mcsp->mca_mcg_status;
paniclog_append_noflush("Processor %d: IA32_MCG_STATUS: 0x%016qx\n",