mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04:00
o move cpu_reset() from vm_machdep.c to machdep.c.
o reorder cpu_boot(), cpu_halt() and identifycpu(). No functional change.
This commit is contained in:
parent
3e85d47c46
commit
425963bb80
2 changed files with 68 additions and 79 deletions
|
|
@ -139,10 +139,55 @@ vm_offset_t phys_avail[100];
|
|||
|
||||
void mi_startup(void); /* XXX should be in a MI header */
|
||||
|
||||
static void identifycpu(void);
|
||||
|
||||
struct kva_md_info kmi;
|
||||
|
||||
static void
|
||||
identifycpu(void)
|
||||
{
|
||||
char vendor[17];
|
||||
u_int64_t t;
|
||||
int number, revision, model, family, archrev;
|
||||
u_int64_t features;
|
||||
|
||||
/*
|
||||
* Assumes little-endian.
|
||||
*/
|
||||
*(u_int64_t *) &vendor[0] = ia64_get_cpuid(0);
|
||||
*(u_int64_t *) &vendor[8] = ia64_get_cpuid(1);
|
||||
vendor[16] = '\0';
|
||||
|
||||
t = ia64_get_cpuid(3);
|
||||
number = (t >> 0) & 0xff;
|
||||
revision = (t >> 8) & 0xff;
|
||||
model = (t >> 16) & 0xff;
|
||||
family = (t >> 24) & 0xff;
|
||||
archrev = (t >> 32) & 0xff;
|
||||
|
||||
if (family == 0x7)
|
||||
strcpy(cpu_model, "Itanium");
|
||||
else if (family == 0x1f)
|
||||
strcpy(cpu_model, "Itanium 2"); /* McKinley */
|
||||
else
|
||||
snprintf(cpu_model, sizeof(cpu_model), "Family=%d", family);
|
||||
|
||||
features = ia64_get_cpuid(4);
|
||||
|
||||
printf("CPU: %s", cpu_model);
|
||||
if (processor_frequency)
|
||||
printf(" (%ld.%02ld-Mhz)\n",
|
||||
(processor_frequency + 4999) / 1000000,
|
||||
((processor_frequency + 4999) / 10000) % 100);
|
||||
else
|
||||
printf("\n");
|
||||
printf(" Origin = \"%s\" Model = %d Revision = %d\n",
|
||||
vendor, model, revision);
|
||||
printf(" Features = 0x%b\n", (u_int32_t) features,
|
||||
"\020"
|
||||
"\001LB" /* long branch (brl) instruction. */
|
||||
"\002SD" /* Spontaneous deferral. */
|
||||
"\003AO" /* 16-byte atomic operations (ld, st, cmpxchg). */ );
|
||||
}
|
||||
|
||||
static void
|
||||
cpu_startup(dummy)
|
||||
void *dummy;
|
||||
|
|
@ -201,6 +246,27 @@ cpu_startup(dummy)
|
|||
ia64_mca_init();
|
||||
}
|
||||
|
||||
void
|
||||
cpu_boot(int howto)
|
||||
{
|
||||
|
||||
ia64_efi_runtime->ResetSystem(EfiResetWarm, EFI_SUCCESS, 0, 0);
|
||||
}
|
||||
|
||||
void
|
||||
cpu_halt(void)
|
||||
{
|
||||
|
||||
ia64_efi_runtime->ResetSystem(EfiResetWarm, EFI_SUCCESS, 0, 0);
|
||||
}
|
||||
|
||||
void
|
||||
cpu_reset()
|
||||
{
|
||||
|
||||
cpu_boot(0);
|
||||
}
|
||||
|
||||
void
|
||||
cpu_switch(struct thread *old, struct thread *new)
|
||||
{
|
||||
|
|
@ -258,53 +324,6 @@ cpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t size)
|
|||
pcpu->pc_pcb = (struct pcb *)((char*)pcpu + pcpusz);
|
||||
}
|
||||
|
||||
static void
|
||||
identifycpu(void)
|
||||
{
|
||||
char vendor[17];
|
||||
u_int64_t t;
|
||||
int number, revision, model, family, archrev;
|
||||
u_int64_t features;
|
||||
|
||||
/*
|
||||
* Assumes little-endian.
|
||||
*/
|
||||
*(u_int64_t *) &vendor[0] = ia64_get_cpuid(0);
|
||||
*(u_int64_t *) &vendor[8] = ia64_get_cpuid(1);
|
||||
vendor[16] = '\0';
|
||||
|
||||
t = ia64_get_cpuid(3);
|
||||
number = (t >> 0) & 0xff;
|
||||
revision = (t >> 8) & 0xff;
|
||||
model = (t >> 16) & 0xff;
|
||||
family = (t >> 24) & 0xff;
|
||||
archrev = (t >> 32) & 0xff;
|
||||
|
||||
if (family == 0x7)
|
||||
strcpy(cpu_model, "Itanium");
|
||||
else if (family == 0x1f)
|
||||
strcpy(cpu_model, "Itanium 2"); /* McKinley */
|
||||
else
|
||||
snprintf(cpu_model, sizeof(cpu_model), "Family=%d", family);
|
||||
|
||||
features = ia64_get_cpuid(4);
|
||||
|
||||
printf("CPU: %s", cpu_model);
|
||||
if (processor_frequency)
|
||||
printf(" (%ld.%02ld-Mhz)\n",
|
||||
(processor_frequency + 4999) / 1000000,
|
||||
((processor_frequency + 4999) / 10000) % 100);
|
||||
else
|
||||
printf("\n");
|
||||
printf(" Origin = \"%s\" Model = %d Revision = %d\n",
|
||||
vendor, model, revision);
|
||||
printf(" Features = 0x%b\n", (u_int32_t) features,
|
||||
"\020"
|
||||
"\001LB" /* long branch (brl) instruction. */
|
||||
"\002SD" /* Spontaneous deferral. */
|
||||
"\003AO" /* 16-byte atomic operations (ld, st, cmpxchg). */ );
|
||||
}
|
||||
|
||||
void
|
||||
map_pal_code(void)
|
||||
{
|
||||
|
|
@ -1150,26 +1169,6 @@ set_mcontext(struct thread *td, const mcontext_t *mc)
|
|||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Machine dependent boot() routine
|
||||
*/
|
||||
void
|
||||
cpu_boot(int howto)
|
||||
{
|
||||
|
||||
ia64_efi_runtime->ResetSystem(EfiResetWarm, EFI_SUCCESS, 0, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Shutdown the CPU as much as possible
|
||||
*/
|
||||
void
|
||||
cpu_halt(void)
|
||||
{
|
||||
|
||||
ia64_efi_runtime->ResetSystem(EfiResetWarm, EFI_SUCCESS, 0, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear registers on exec.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -296,16 +296,6 @@ cpu_sched_exit(td)
|
|||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Force reset the processor by invalidating the entire address space!
|
||||
*/
|
||||
void
|
||||
cpu_reset()
|
||||
{
|
||||
|
||||
cpu_boot(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Software interrupt handler for queued VM system processing.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue