173 */
174 int maxphys = 56 * 1024; /* XXX See vm_subr.c - max b_count in physio */
175 int klustsize = 56 * 1024;
176
177 caddr_t p0_va; /* Virtual address for accessing physical page 0 */
178
179 /*
180 * defined here, though unused on x86,
181 * to make kstat_fr.c happy.
182 */
183 int vac;
184
185 void debug_enter(char *);
186
187 extern void pm_cfb_check_and_powerup(void);
188 extern void pm_cfb_rele(void);
189
190 extern fastboot_info_t newkernel;
191
192 /*
193 * Machine dependent code to reboot.
194 * "mdep" is interpreted as a character pointer; if non-null, it is a pointer
195 * to a string to be used as the argument string when rebooting.
196 *
197 * "invoke_cb" is a boolean. It is set to true when mdboot() can safely
198 * invoke CB_CL_MDBOOT callbacks before shutting the system down, i.e. when
199 * we are in a normal shutdown sequence (interrupts are not blocked, the
200 * system is not panic'ing or being suspended).
201 */
202 /*ARGSUSED*/
203 void
204 mdboot(int cmd, int fcn, char *mdep, boolean_t invoke_cb)
205 {
206 processorid_t bootcpuid = 0;
207 static int is_first_quiesce = 1;
208 static int is_first_reset = 1;
209 int reset_status = 0;
210 static char fallback_str[] = "Falling back to regular reboot.\n";
211
212 if (fcn == AD_FASTREBOOT && !newkernel.fi_valid)
1437 {
1438 return (plat_dr_options & PLAT_DR_FEATURE_CPU);
1439 }
1440
1441 boolean_t
1442 plat_dr_support_memory(void)
1443 {
1444 return (plat_dr_options & PLAT_DR_FEATURE_MEMORY);
1445 }
1446
1447 void
1448 plat_dr_enable_capability(uint64_t features)
1449 {
1450 atomic_or_64(&plat_dr_options, features);
1451 }
1452
1453 void
1454 plat_dr_disable_capability(uint64_t features)
1455 {
1456 atomic_and_64(&plat_dr_options, ~features);
1457 }
|
173 */
174 int maxphys = 56 * 1024; /* XXX See vm_subr.c - max b_count in physio */
175 int klustsize = 56 * 1024;
176
177 caddr_t p0_va; /* Virtual address for accessing physical page 0 */
178
179 /*
180 * defined here, though unused on x86,
181 * to make kstat_fr.c happy.
182 */
183 int vac;
184
185 void debug_enter(char *);
186
187 extern void pm_cfb_check_and_powerup(void);
188 extern void pm_cfb_rele(void);
189
190 extern fastboot_info_t newkernel;
191
192 /*
193 * Instructions to enable or disable SMAP, respectively.
194 */
195 static const uint8_t clac_instr[3] = { 0x0f, 0x01, 0xca };
196 static const uint8_t stac_instr[3] = { 0x0f, 0x01, 0xcb };
197
198 /*
199 * Machine dependent code to reboot.
200 * "mdep" is interpreted as a character pointer; if non-null, it is a pointer
201 * to a string to be used as the argument string when rebooting.
202 *
203 * "invoke_cb" is a boolean. It is set to true when mdboot() can safely
204 * invoke CB_CL_MDBOOT callbacks before shutting the system down, i.e. when
205 * we are in a normal shutdown sequence (interrupts are not blocked, the
206 * system is not panic'ing or being suspended).
207 */
208 /*ARGSUSED*/
209 void
210 mdboot(int cmd, int fcn, char *mdep, boolean_t invoke_cb)
211 {
212 processorid_t bootcpuid = 0;
213 static int is_first_quiesce = 1;
214 static int is_first_reset = 1;
215 int reset_status = 0;
216 static char fallback_str[] = "Falling back to regular reboot.\n";
217
218 if (fcn == AD_FASTREBOOT && !newkernel.fi_valid)
1443 {
1444 return (plat_dr_options & PLAT_DR_FEATURE_CPU);
1445 }
1446
1447 boolean_t
1448 plat_dr_support_memory(void)
1449 {
1450 return (plat_dr_options & PLAT_DR_FEATURE_MEMORY);
1451 }
1452
1453 void
1454 plat_dr_enable_capability(uint64_t features)
1455 {
1456 atomic_or_64(&plat_dr_options, features);
1457 }
1458
1459 void
1460 plat_dr_disable_capability(uint64_t features)
1461 {
1462 atomic_and_64(&plat_dr_options, ~features);
1463 }
1464
1465 /*
1466 * If SMAP is supported, look through hi_calls and inline
1467 * calls to smap_enable() to clac and smap_disable() to stac.
1468 */
1469 void
1470 hotinline_smap(hotinline_desc_t *hid)
1471 {
1472 if (is_x86_feature(x86_featureset, X86FSET_SMAP) == B_FALSE)
1473 return;
1474
1475 if (strcmp(hid->hid_symname, "smap_enable") == 0) {
1476 bcopy(clac_instr, (void *)hid->hid_instr_offset,
1477 sizeof (clac_instr));
1478 } else if (strcmp(hid->hid_symname, "smap_disable") == 0) {
1479 bcopy(stac_instr, (void *)hid->hid_instr_offset,
1480 sizeof (stac_instr));
1481 }
1482 }
1483
1484 /*
1485 * Loop through hi_calls and hand off the inlining to
1486 * the appropriate calls.
1487 */
1488 void
1489 do_hotinlines(struct module *mp)
1490 {
1491 for (hotinline_desc_t *hid = mp->hi_calls; hid != NULL;
1492 hid = hid->hid_next) {
1493 #if !defined(__xpv)
1494 hotinline_smap(hid);
1495 #endif /* __xpv */
1496 }
1497 }
|