60 #include <sys/archsystm.h>
61 #include <sys/promif.h>
62 #include <sys/pci_cfgspace.h>
63 #ifdef __xpv
64 #include <sys/hypervisor.h>
65 #else
66 #include <sys/xpv_support.h>
67 #endif
68
69 /*
70 * some globals for patching the result of cpuid
71 * to solve problems w/ creative cpu vendors
72 */
73
74 extern uint32_t cpuid_feature_ecx_include;
75 extern uint32_t cpuid_feature_ecx_exclude;
76 extern uint32_t cpuid_feature_edx_include;
77 extern uint32_t cpuid_feature_edx_exclude;
78
79 /*
80 * Dummy spl priority masks
81 */
82 static unsigned char dummy_cpu_pri[MAXIPL + 1] = {
83 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf,
84 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf
85 };
86
87 /*
88 * Set console mode
89 */
90 static void
91 set_console_mode(uint8_t val)
92 {
93 struct bop_regs rp = {0};
94
95 rp.eax.byte.ah = 0x0;
96 rp.eax.byte.al = val;
97 rp.ebx.word.bx = 0x0;
98
99 BOP_DOINT(bootops, 0x10, &rp);
100 }
101
102
103 /*
104 * Setup routine called right before main(). Interposing this function
105 * before main() allows us to call it in a machine-independent fashion.
106 */
107 void
112 extern disp_t cpu0_disp;
113 extern char t0stack[];
114 extern int post_fastreboot;
115 extern uint64_t plat_dr_options;
116
117 ASSERT_STACK_ALIGNED();
118
119 /*
120 * initialize cpu_self
121 */
122 cpu[0]->cpu_self = cpu[0];
123
124 #if defined(__xpv)
125 /*
126 * Point at the hypervisor's virtual cpu structure
127 */
128 cpu[0]->cpu_m.mcpu_vcpu_info = &HYPERVISOR_shared_info->vcpu_info[0];
129 #endif
130
131 /*
132 * Set up dummy cpu_pri_data values till psm spl code is
133 * installed. This allows splx() to work on amd64.
134 */
135
136 cpu[0]->cpu_pri_data = dummy_cpu_pri;
137
138 /*
139 * check if we've got special bits to clear or set
140 * when checking cpu features
141 */
142
143 if (bootprop_getval("cpuid_feature_ecx_include", &prop_value) != 0)
144 cpuid_feature_ecx_include = 0;
145 else
146 cpuid_feature_ecx_include = (uint32_t)prop_value;
147
148 if (bootprop_getval("cpuid_feature_ecx_exclude", &prop_value) != 0)
149 cpuid_feature_ecx_exclude = 0;
150 else
151 cpuid_feature_ecx_exclude = (uint32_t)prop_value;
152
153 if (bootprop_getval("cpuid_feature_edx_include", &prop_value) != 0)
154 cpuid_feature_edx_include = 0;
155 else
156 cpuid_feature_edx_include = (uint32_t)prop_value;
157
158 if (bootprop_getval("cpuid_feature_edx_exclude", &prop_value) != 0)
|
60 #include <sys/archsystm.h>
61 #include <sys/promif.h>
62 #include <sys/pci_cfgspace.h>
63 #ifdef __xpv
64 #include <sys/hypervisor.h>
65 #else
66 #include <sys/xpv_support.h>
67 #endif
68
69 /*
70 * some globals for patching the result of cpuid
71 * to solve problems w/ creative cpu vendors
72 */
73
74 extern uint32_t cpuid_feature_ecx_include;
75 extern uint32_t cpuid_feature_ecx_exclude;
76 extern uint32_t cpuid_feature_edx_include;
77 extern uint32_t cpuid_feature_edx_exclude;
78
79 /*
80 * Set console mode
81 */
82 static void
83 set_console_mode(uint8_t val)
84 {
85 struct bop_regs rp = {0};
86
87 rp.eax.byte.ah = 0x0;
88 rp.eax.byte.al = val;
89 rp.ebx.word.bx = 0x0;
90
91 BOP_DOINT(bootops, 0x10, &rp);
92 }
93
94
95 /*
96 * Setup routine called right before main(). Interposing this function
97 * before main() allows us to call it in a machine-independent fashion.
98 */
99 void
104 extern disp_t cpu0_disp;
105 extern char t0stack[];
106 extern int post_fastreboot;
107 extern uint64_t plat_dr_options;
108
109 ASSERT_STACK_ALIGNED();
110
111 /*
112 * initialize cpu_self
113 */
114 cpu[0]->cpu_self = cpu[0];
115
116 #if defined(__xpv)
117 /*
118 * Point at the hypervisor's virtual cpu structure
119 */
120 cpu[0]->cpu_m.mcpu_vcpu_info = &HYPERVISOR_shared_info->vcpu_info[0];
121 #endif
122
123 /*
124 * check if we've got special bits to clear or set
125 * when checking cpu features
126 */
127
128 if (bootprop_getval("cpuid_feature_ecx_include", &prop_value) != 0)
129 cpuid_feature_ecx_include = 0;
130 else
131 cpuid_feature_ecx_include = (uint32_t)prop_value;
132
133 if (bootprop_getval("cpuid_feature_ecx_exclude", &prop_value) != 0)
134 cpuid_feature_ecx_exclude = 0;
135 else
136 cpuid_feature_ecx_exclude = (uint32_t)prop_value;
137
138 if (bootprop_getval("cpuid_feature_edx_include", &prop_value) != 0)
139 cpuid_feature_edx_include = 0;
140 else
141 cpuid_feature_edx_include = (uint32_t)prop_value;
142
143 if (bootprop_getval("cpuid_feature_edx_exclude", &prop_value) != 0)
|