Changeset View
Changeset View
Standalone View
Standalone View
head/sys/x86/x86/mptable.c
Show First 20 Lines • Show All 185 Lines • ▼ Show 20 Lines | |||||
static void mptable_parse_io_int(int_entry_ptr intr); | static void mptable_parse_io_int(int_entry_ptr intr); | ||||
static void mptable_parse_local_int(int_entry_ptr intr); | static void mptable_parse_local_int(int_entry_ptr intr); | ||||
static void mptable_pci_probe_table_handler(u_char *entry, void *arg); | static void mptable_pci_probe_table_handler(u_char *entry, void *arg); | ||||
static void mptable_pci_route_interrupt_handler(u_char *entry, void *arg); | static void mptable_pci_route_interrupt_handler(u_char *entry, void *arg); | ||||
static void mptable_pci_setup(void); | static void mptable_pci_setup(void); | ||||
static int mptable_probe(void); | static int mptable_probe(void); | ||||
static int mptable_probe_cpus(void); | static int mptable_probe_cpus(void); | ||||
static void mptable_probe_cpus_handler(u_char *entry, void *arg __unused); | static void mptable_probe_cpus_handler(u_char *entry, void *arg __unused); | ||||
static void mptable_setup_cpus_handler(u_char *entry, void *arg __unused); | |||||
static void mptable_register(void *dummy); | static void mptable_register(void *dummy); | ||||
static int mptable_setup_local(void); | static int mptable_setup_local(void); | ||||
static int mptable_setup_io(void); | static int mptable_setup_io(void); | ||||
#ifdef NEW_PCIB | #ifdef NEW_PCIB | ||||
static void mptable_walk_extended_table( | static void mptable_walk_extended_table( | ||||
mptable_extended_entry_handler *handler, void *arg); | mptable_extended_entry_handler *handler, void *arg); | ||||
#endif | #endif | ||||
static void mptable_walk_table(mptable_entry_handler *handler, void *arg); | static void mptable_walk_table(mptable_entry_handler *handler, void *arg); | ||||
▲ Show 20 Lines • Show All 122 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
static int | static int | ||||
mptable_probe_cpus(void) | mptable_probe_cpus(void) | ||||
{ | { | ||||
u_int cpu_mask; | u_int cpu_mask; | ||||
/* Is this a pre-defined config? */ | /* Is this a pre-defined config? */ | ||||
if (mpfps->config_type != 0) { | if (mpfps->config_type != 0) { | ||||
lapic_create(0, 1); | mp_ncpus = 2; | ||||
lapic_create(1, 0); | mp_maxid = 1; | ||||
max_apic_id = 1; | |||||
} else { | } else { | ||||
cpu_mask = 0; | |||||
mptable_walk_table(mptable_probe_cpus_handler, &cpu_mask); | mptable_walk_table(mptable_probe_cpus_handler, &cpu_mask); | ||||
#ifdef MPTABLE_FORCE_HTT | |||||
mptable_hyperthread_fixup(cpu_mask); | |||||
#endif | |||||
} | } | ||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
* Initialize the local APIC on the BSP. | * Initialize the local APIC on the BSP. | ||||
*/ | */ | ||||
static int | static int | ||||
mptable_setup_local(void) | mptable_setup_local(void) | ||||
{ | { | ||||
vm_paddr_t addr; | vm_paddr_t addr; | ||||
/* Is this a pre-defined config? */ | /* Is this a pre-defined config? */ | ||||
printf("MPTable: <"); | printf("MPTable: <"); | ||||
if (mpfps->config_type != 0) { | if (mpfps->config_type != 0) { | ||||
lapic_create(0, 1); | |||||
lapic_create(1, 0); | |||||
addr = DEFAULT_APIC_BASE; | addr = DEFAULT_APIC_BASE; | ||||
printf("Default Configuration %d", mpfps->config_type); | printf("Default Configuration %d", mpfps->config_type); | ||||
} else { | } else { | ||||
cpu_mask = 0; | |||||
mptable_walk_table(mptable_setup_cpus_handler, &cpu_mask); | |||||
#ifdef MPTABLE_FORCE_HTT | |||||
mptable_hyperthread_fixup(cpu_mask); | |||||
#endif | |||||
addr = mpct->apic_address; | addr = mpct->apic_address; | ||||
printf("%.*s %.*s", (int)sizeof(mpct->oem_id), mpct->oem_id, | printf("%.*s %.*s", (int)sizeof(mpct->oem_id), mpct->oem_id, | ||||
(int)sizeof(mpct->product_id), mpct->product_id); | (int)sizeof(mpct->product_id), mpct->product_id); | ||||
} | } | ||||
printf(">\n"); | printf(">\n"); | ||||
lapic_init(addr); | lapic_init(addr); | ||||
return (0); | return (0); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 93 Lines • ▼ Show 20 Lines | while (entry < end) { | ||||
handler(entry, arg); | handler(entry, arg); | ||||
entry = (ext_entry_ptr)((char *)entry + entry->length); | entry = (ext_entry_ptr)((char *)entry + entry->length); | ||||
} | } | ||||
} | } | ||||
#endif | #endif | ||||
static void | static void | ||||
mptable_probe_cpus_handler(u_char *entry, void *arg) | mptable_probe_cpus_handler(u_char *entry, void *arg) | ||||
{ | |||||
proc_entry_ptr proc; | |||||
switch (*entry) { | |||||
case MPCT_ENTRY_PROCESSOR: | |||||
proc = (proc_entry_ptr)entry; | |||||
if (proc->cpu_flags & PROCENTRY_FLAG_EN && | |||||
proc->apic_id < MAX_LAPIC_ID && mp_ncpus < MAXCPU) { | |||||
mp_ncpus++; | |||||
mp_maxid = mp_ncpus - 1; | |||||
max_apic_id = max(max_apic_id, proc->apic_id); | |||||
} | |||||
break; | |||||
} | |||||
} | |||||
static void | |||||
mptable_setup_cpus_handler(u_char *entry, void *arg) | |||||
{ | { | ||||
proc_entry_ptr proc; | proc_entry_ptr proc; | ||||
u_int *cpu_mask; | u_int *cpu_mask; | ||||
switch (*entry) { | switch (*entry) { | ||||
case MPCT_ENTRY_PROCESSOR: | case MPCT_ENTRY_PROCESSOR: | ||||
proc = (proc_entry_ptr)entry; | proc = (proc_entry_ptr)entry; | ||||
if (proc->cpu_flags & PROCENTRY_FLAG_EN) { | if (proc->cpu_flags & PROCENTRY_FLAG_EN) { | ||||
▲ Show 20 Lines • Show All 753 Lines • Show Last 20 Lines |