local_apic.c (215001) | local_apic.c (215009) |
---|---|
1/*- 2 * Copyright (c) 2003 John Baldwin <jhb@FreeBSD.org> 3 * Copyright (c) 1996, by Steve Passe 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 18 unchanged lines hidden (view full) --- 27 * SUCH DAMAGE. 28 */ 29 30/* 31 * Local APIC support on Pentium and later processors. 32 */ 33 34#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2003 John Baldwin <jhb@FreeBSD.org> 3 * Copyright (c) 1996, by Steve Passe 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 18 unchanged lines hidden (view full) --- 27 * SUCH DAMAGE. 28 */ 29 30/* 31 * Local APIC support on Pentium and later processors. 32 */ 33 34#include <sys/cdefs.h> |
35__FBSDID("$FreeBSD: head/sys/x86/x86/local_apic.c 215001 2010-11-08 20:03:51Z jhb $"); | 35__FBSDID("$FreeBSD: head/sys/x86/x86/local_apic.c 215009 2010-11-08 20:35:09Z jhb $"); |
36 37#include "opt_hwpmc_hooks.h" 38#include "opt_kdtrace.h" 39 40#include "opt_ddb.h" 41 42#include <sys/param.h> 43#include <sys/systm.h> --- 1236 unchanged lines hidden (view full) --- 1280 /* We only support built in local APICs. */ 1281 if (!(cpu_feature & CPUID_APIC)) 1282 return; 1283 1284 /* Don't probe if APIC mode is disabled. */ 1285 if (resource_disabled("apic", 0)) 1286 return; 1287 | 36 37#include "opt_hwpmc_hooks.h" 38#include "opt_kdtrace.h" 39 40#include "opt_ddb.h" 41 42#include <sys/param.h> 43#include <sys/systm.h> --- 1236 unchanged lines hidden (view full) --- 1280 /* We only support built in local APICs. */ 1281 if (!(cpu_feature & CPUID_APIC)) 1282 return; 1283 1284 /* Don't probe if APIC mode is disabled. */ 1285 if (resource_disabled("apic", 0)) 1286 return; 1287 |
1288 /* First, probe all the enumerators to find the best match. */ | 1288 /* Probe all the enumerators to find the best match. */ |
1289 best_enum = NULL; 1290 best = 0; 1291 SLIST_FOREACH(enumerator, &enumerators, apic_next) { 1292 retval = enumerator->apic_probe(); 1293 if (retval > 0) 1294 continue; 1295 if (best_enum == NULL || best < retval) { 1296 best_enum = enumerator; --- 19 unchanged lines hidden (view full) --- 1316 if (cpu == CPU_686 && cpu_vendor_id == CPU_VENDOR_INTEL && 1317 (cpu_id & 0xff0) == 0x610) { 1318 apic_base = rdmsr(MSR_APICBASE); 1319 apic_base |= APICBASE_ENABLED; 1320 wrmsr(MSR_APICBASE, apic_base); 1321 } 1322#endif 1323 | 1289 best_enum = NULL; 1290 best = 0; 1291 SLIST_FOREACH(enumerator, &enumerators, apic_next) { 1292 retval = enumerator->apic_probe(); 1293 if (retval > 0) 1294 continue; 1295 if (best_enum == NULL || best < retval) { 1296 best_enum = enumerator; --- 19 unchanged lines hidden (view full) --- 1316 if (cpu == CPU_686 && cpu_vendor_id == CPU_VENDOR_INTEL && 1317 (cpu_id & 0xff0) == 0x610) { 1318 apic_base = rdmsr(MSR_APICBASE); 1319 apic_base |= APICBASE_ENABLED; 1320 wrmsr(MSR_APICBASE, apic_base); 1321 } 1322#endif 1323 |
1324 /* Second, probe the CPU's in the system. */ | 1324 /* Probe the CPU's in the system. */ |
1325 retval = best_enum->apic_probe_cpus(); 1326 if (retval != 0) 1327 printf("%s: Failed to probe CPUs: returned %d\n", 1328 best_enum->apic_name, retval); 1329 | 1325 retval = best_enum->apic_probe_cpus(); 1326 if (retval != 0) 1327 printf("%s: Failed to probe CPUs: returned %d\n", 1328 best_enum->apic_name, retval); 1329 |
1330#ifdef __amd64__ | |
1331} 1332SYSINIT(apic_init, SI_SUB_TUNABLES - 1, SI_ORDER_SECOND, apic_init, NULL); 1333 1334/* 1335 * Setup the local APIC. We have to do this prior to starting up the APs 1336 * in the SMP case. 1337 */ 1338static void 1339apic_setup_local(void *dummy __unused) 1340{ 1341 int retval; 1342 1343 if (best_enum == NULL) 1344 return; | 1330} 1331SYSINIT(apic_init, SI_SUB_TUNABLES - 1, SI_ORDER_SECOND, apic_init, NULL); 1332 1333/* 1334 * Setup the local APIC. We have to do this prior to starting up the APs 1335 * in the SMP case. 1336 */ 1337static void 1338apic_setup_local(void *dummy __unused) 1339{ 1340 int retval; 1341 1342 if (best_enum == NULL) 1343 return; |
1345#endif 1346 /* Third, initialize the local APIC. */ | 1344 1345 /* Initialize the local APIC. */ |
1347 retval = best_enum->apic_setup_local(); 1348 if (retval != 0) 1349 printf("%s: Failed to setup the local APIC: returned %d\n", 1350 best_enum->apic_name, retval); 1351} | 1346 retval = best_enum->apic_setup_local(); 1347 if (retval != 0) 1348 printf("%s: Failed to setup the local APIC: returned %d\n", 1349 best_enum->apic_name, retval); 1350} |
1352#ifdef __amd64__ 1353SYSINIT(apic_setup_local, SI_SUB_CPU, SI_ORDER_SECOND, apic_setup_local, 1354 NULL); 1355#else 1356SYSINIT(apic_init, SI_SUB_CPU, SI_ORDER_SECOND, apic_init, NULL); 1357#endif | 1351SYSINIT(apic_setup_local, SI_SUB_CPU, SI_ORDER_SECOND, apic_setup_local, NULL); |
1358 1359/* 1360 * Setup the I/O APICs. 1361 */ 1362static void 1363apic_setup_io(void *dummy __unused) 1364{ 1365 int retval; --- 163 unchanged lines hidden --- | 1352 1353/* 1354 * Setup the I/O APICs. 1355 */ 1356static void 1357apic_setup_io(void *dummy __unused) 1358{ 1359 int retval; --- 163 unchanged lines hidden --- |