* Remove a breakpoint() I accidentally left in for debugging :-(.
* Make cpu_mp_probe() work before the VM system is available and initialise mp_maxid accordingly.
This commit is contained in:
parent
1bcf2f1a12
commit
fa45345e6e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=92318
@ -43,7 +43,7 @@ struct sapic *sapic_create(int, int, u_int64_t);
|
||||
|
||||
typedef struct /* Interrupt Source Override */
|
||||
{
|
||||
APIC_HEADER header;
|
||||
APIC_HEADER Header;
|
||||
UINT8 Bus;
|
||||
UINT8 Source;
|
||||
UINT32 GlobalSystemInterrupt;
|
||||
@ -52,7 +52,7 @@ typedef struct /* Interrupt Source Override */
|
||||
|
||||
typedef struct /* IO SAPIC */
|
||||
{
|
||||
APIC_HEADER header;
|
||||
APIC_HEADER Header;
|
||||
UINT8 IoSapicId; /* I/O SAPIC ID */
|
||||
UINT8 Reserved; /* reserved - must be zero */
|
||||
UINT32 Vector; /* interrupt base */
|
||||
@ -61,7 +61,7 @@ typedef struct /* IO SAPIC */
|
||||
|
||||
typedef struct /* LOCAL SAPIC */
|
||||
{
|
||||
APIC_HEADER header;
|
||||
APIC_HEADER Header;
|
||||
UINT8 ProcessorId; /* ACPI processor id */
|
||||
UINT8 LocalSapicId; /* Processor local SAPIC id */
|
||||
UINT8 LocalSapicEid; /* Processor local SAPIC eid */
|
||||
@ -72,7 +72,7 @@ typedef struct /* LOCAL SAPIC */
|
||||
|
||||
typedef struct /* PLATFORM INTERRUPT SOURCE */
|
||||
{
|
||||
APIC_HEADER header;
|
||||
APIC_HEADER Header;
|
||||
UINT16 Polarity : 2; /* Polarity of input signal */
|
||||
UINT16 TriggerMode: 2; /* Trigger mode of input signal */
|
||||
UINT16 Reserved1 : 12;
|
||||
@ -132,10 +132,11 @@ parse_platform_interrupt(PLATFORM_INTERRUPT_SOURCE *source)
|
||||
source->GlobalSystemInterrupt);
|
||||
}
|
||||
|
||||
static void
|
||||
parse_madt(APIC_TABLE *madt)
|
||||
static int
|
||||
parse_madt(APIC_TABLE *madt, int countcpus)
|
||||
{
|
||||
char *p, *end;
|
||||
int maxid = 0;
|
||||
|
||||
/*
|
||||
* MADT header is followed by a number of variable length
|
||||
@ -145,6 +146,17 @@ parse_madt(APIC_TABLE *madt)
|
||||
for (p = (char *) (madt + 1); p < end; ) {
|
||||
APIC_HEADER *head = (APIC_HEADER *) p;
|
||||
|
||||
if (countcpus) {
|
||||
if (head->Type == APIC_LOCAL_SAPIC) {
|
||||
LOCAL_SAPIC *sapic = (LOCAL_SAPIC *) head;
|
||||
if (sapic->ProcessorEnabled)
|
||||
if (sapic->ProcessorId > maxid)
|
||||
maxid = sapic->ProcessorId;
|
||||
}
|
||||
p = p + head->Length;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (bootverbose)
|
||||
printf("\t");
|
||||
switch (head->Type) {
|
||||
@ -208,10 +220,12 @@ parse_madt(APIC_TABLE *madt)
|
||||
|
||||
p = p + head->Length;
|
||||
}
|
||||
|
||||
return (maxid);
|
||||
}
|
||||
|
||||
void
|
||||
ia64_probe_sapics(void)
|
||||
static int
|
||||
parse_table(int countcpus)
|
||||
{
|
||||
ACPI_PHYSICAL_ADDRESS rsdp_phys;
|
||||
RSDP_DESCRIPTOR *rsdp;
|
||||
@ -220,7 +234,7 @@ ia64_probe_sapics(void)
|
||||
int i, count;
|
||||
|
||||
if (AcpiOsGetRootPointer(0, &rsdp_phys) != AE_OK)
|
||||
return;
|
||||
return 0;
|
||||
|
||||
rsdp = (RSDP_DESCRIPTOR *)IA64_PHYS_TO_RR7(rsdp_phys);
|
||||
xsdt = (XSDT_DESCRIPTOR *)IA64_PHYS_TO_RR7(rsdp->XsdtPhysicalAddress);
|
||||
@ -231,12 +245,29 @@ ia64_probe_sapics(void)
|
||||
table = (ACPI_TABLE_HEADER *)
|
||||
IA64_PHYS_TO_RR7(xsdt->TableOffsetEntry[i]);
|
||||
|
||||
if (bootverbose)
|
||||
if (bootverbose && !countcpus)
|
||||
printf("Table '%c%c%c%c' at %p\n", table->Signature[0],
|
||||
table->Signature[1], table->Signature[2],
|
||||
table->Signature[3], table);
|
||||
|
||||
if (!strncmp(table->Signature, APIC_SIG, 4))
|
||||
parse_madt((APIC_TABLE *) table);
|
||||
return (parse_madt((APIC_TABLE *) table, countcpus));
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
ia64_probe_sapics(void)
|
||||
{
|
||||
parse_table(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the maximum cpuid used by any cpu in the system. This will
|
||||
* return zero for systems with only one cpu.
|
||||
*/
|
||||
int
|
||||
ia64_count_aps(void)
|
||||
{
|
||||
return (parse_table(1));
|
||||
}
|
||||
|
@ -55,6 +55,7 @@
|
||||
void cpu_mp_add(uint, uint, uint);
|
||||
void ia64_ap_startup(void);
|
||||
void map_pal_code(void);
|
||||
int ia64_count_aps(void);
|
||||
|
||||
extern vm_offset_t vhpt_base, vhpt_size;
|
||||
|
||||
@ -115,7 +116,12 @@ cpu_mp_probe()
|
||||
* We've already discovered any APs when they're present.
|
||||
* Just return the result here.
|
||||
*/
|
||||
return (mp_hardware && mp_ncpus > 1);
|
||||
if (mp_hardware) {
|
||||
mp_maxid = ia64_count_aps();
|
||||
return (mp_maxid > 0);
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -233,8 +239,6 @@ cpu_mp_unleash(void *dummy)
|
||||
if (!mp_hardware)
|
||||
return;
|
||||
|
||||
breakpoint();
|
||||
|
||||
if (mp_ipi_test != 1)
|
||||
printf("SMP: WARNING: sending of a test IPI failed\n");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user