usr/src/uts/i86pc/os/cpuid.c
changeset 13498 e702644ca141
parent 13425 8640246a3548
child 13651 af464d8d3a31
equal deleted inserted replaced
13497:205481e35e49 13498:e702644ca141
    18  *
    18  *
    19  * CDDL HEADER END
    19  * CDDL HEADER END
    20  */
    20  */
    21 /*
    21 /*
    22  * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
    22  * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
       
    23  * Copyright (c) 2011 by Delphix. All rights reserved.
    23  */
    24  */
    24 /*
    25 /*
    25  * Copyright (c) 2010, Intel Corporation.
    26  * Copyright (c) 2010, Intel Corporation.
    26  * All rights reserved.
    27  * All rights reserved.
    27  */
    28  */
   588 	cpu->cpu_m.mcpu_cpi = NULL;
   589 	cpu->cpu_m.mcpu_cpi = NULL;
   589 }
   590 }
   590 
   591 
   591 #if !defined(__xpv)
   592 #if !defined(__xpv)
   592 
   593 
   593 static void
   594 /*
   594 determine_platform()
   595  * Determine the type of the underlying platform. This is used to customize
       
   596  * initialization of various subsystems (e.g. TSC). determine_platform() must
       
   597  * only ever be called once to prevent two processors from seeing different
       
   598  * values of platform_type, it must be called before cpuid_pass1(), the
       
   599  * earliest consumer to execute.
       
   600  */
       
   601 void
       
   602 determine_platform(void)
   595 {
   603 {
   596 	struct cpuid_regs cp;
   604 	struct cpuid_regs cp;
   597 	char *xen_str;
   605 	char *xen_str;
   598 	uint32_t xen_signature[4], base;
   606 	uint32_t xen_signature[4], base;
       
   607 
       
   608 	ASSERT(platform_type == -1);
   599 
   609 
   600 	platform_type = HW_NATIVE;
   610 	platform_type = HW_NATIVE;
   601 
   611 
   602 	if (!enable_platform_detection)
   612 	if (!enable_platform_detection)
   603 		return;
   613 		return;
   631 }
   641 }
   632 
   642 
   633 int
   643 int
   634 get_hwenv(void)
   644 get_hwenv(void)
   635 {
   645 {
   636 	if (platform_type == -1)
   646 	ASSERT(platform_type != -1);
   637 		determine_platform();
       
   638 
       
   639 	return (platform_type);
   647 	return (platform_type);
   640 }
   648 }
   641 
   649 
   642 int
   650 int
   643 is_controldom(void)
   651 is_controldom(void)
   868 	int xcpuid;
   876 	int xcpuid;
   869 #if !defined(__xpv)
   877 #if !defined(__xpv)
   870 	extern int idle_cpu_prefer_mwait;
   878 	extern int idle_cpu_prefer_mwait;
   871 #endif
   879 #endif
   872 
   880 
   873 #if !defined(__xpv)
       
   874 	determine_platform();
       
   875 #endif
       
   876 	/*
   881 	/*
   877 	 * Space statically allocated for BSP, ensure pointer is set
   882 	 * Space statically allocated for BSP, ensure pointer is set
   878 	 */
   883 	 */
   879 	if (cpu->cpu_id == 0) {
   884 	if (cpu->cpu_id == 0) {
   880 		if (cpu->cpu_m.mcpu_cpi == NULL)
   885 		if (cpu->cpu_m.mcpu_cpi == NULL)