#ifndef CONFIG_DEBUG_APIC
#undef PrintDebug
#define PrintDebug(fmt, args...)
-
-#endif
-
+#else
+
-#ifdef CONFIG_DEBUG_APIC
static char * shorthand_str[] = {
"(no shorthand)",
"(self)",
"(Start Up)",
"(ExtInt)",
};
-#endif
-
-// Temporary removal of locking
-#define v3_lock(p) p=p
-#define v3_unlock(p) p=p
+#endif
-
typedef enum { APIC_TMR_INT, APIC_THERM_INT, APIC_PERF_INT,
APIC_LINT0_INT, APIC_LINT1_INT, APIC_ERR_INT } apic_irq_type_t;
icr->dst,
icr->val);
-#if 0
- if (icr->vec!=48) {
- V3_Print("apic: IPI %s %u from apic %p to %s %s %u (icr=0x%llx)\n",
- deliverymode_str[icr->del_mode],
- icr->vec,
- src_apic,
- (icr->dst_mode == 0) ? "(physical)" : "(logical)",
- shorthand_str[icr->dst_shorthand],
- icr->dst,
- icr->val);
- }
-
-#endif
-
+
switch (icr->dst_shorthand) {
case APIC_SHORTHAND_NONE: // no shorthand
if (icr->dst_mode == APIC_DEST_PHYSICAL) {
- if (icr->dst >= apic_dev->num_apics) {
+ dest_apic=find_physical_apic(apic_dev,icr);
+
+ if (dest_apic==NULL) {
PrintError("apic: Attempted send to unregistered apic id=%u\n", icr->dst);
- goto route_ipi_out_bad;
+ return -1;
}
+
-
- //V3_Print("apic: phsyical destination of %u (apic %u at 0x%p)\n", icr->dst,dest_apic->lapic_id.val,dest_apic);
+ dest_apic = &(apic_dev->apics[icr->dst]);
+
- V3_Print("apic: phsyical destination of %u (apic %u at 0x%p)\n", icr->dst,dest_apic->lapic_id.val,dest_apic);
+
- v3_lock(dest_apic->lock);
if (deliver_ipi(src_apic, dest_apic,
icr->vec, icr->del_mode) == -1) {
PrintError("apic: Could not deliver IPI\n");
- v3_unlock(dest_apic->lock);
- goto route_ipi_out_bad;
+ return -1;
}
- v3_unlock(dest_apic->lock);
+
- //V3_Print("apic: done\n");
+ V3_Print("apic: done\n");
+
+
} else if (icr->dst_mode == APIC_DEST_LOGICAL) {
if (icr->del_mode!=APIC_LOWEST_DELIVERY ) {