-void
-lapic_dump(void)
-{
- int i;
-
-#define BOOL(a) ((a)?' ':'!')
-
- kprintf("LAPIC %d at 0x%x version 0x%x\n",
- (LAPIC_REG(ID)>>LAPIC_ID_SHIFT)&LAPIC_ID_MASK,
- lapic_start,
- LAPIC_REG(VERSION)&LAPIC_VERSION_MASK);
- kprintf("Priorities: Task 0x%x Arbitration 0x%x Processor 0x%x\n",
- LAPIC_REG(TPR)&LAPIC_TPR_MASK,
- LAPIC_REG(APR)&LAPIC_APR_MASK,
- LAPIC_REG(PPR)&LAPIC_PPR_MASK);
- kprintf("Destination Format 0x%x Logical Destination 0x%x\n",
- LAPIC_REG(DFR)>>LAPIC_DFR_SHIFT,
- LAPIC_REG(LDR)>>LAPIC_LDR_SHIFT);
- kprintf("%cEnabled %cFocusChecking SV 0x%x\n",
- BOOL(LAPIC_REG(SVR)&LAPIC_SVR_ENABLE),
- BOOL(!(LAPIC_REG(SVR)&LAPIC_SVR_FOCUS_OFF)),
- LAPIC_REG(SVR) & LAPIC_SVR_MASK);
- kprintf("LVT_TIMER: Vector 0x%02x %s %cmasked %s\n",
- LAPIC_REG(LVT_TIMER)&LAPIC_LVT_VECTOR_MASK,
- (LAPIC_REG(LVT_TIMER)&LAPIC_LVT_DS_PENDING)?"SendPending":"Idle",
- BOOL(LAPIC_REG(LVT_TIMER)&LAPIC_LVT_MASKED),
- (LAPIC_REG(LVT_TIMER)&LAPIC_LVT_PERIODIC)?"Periodic":"OneShot");
- kprintf(" Initial Count: 0x%08x \n", LAPIC_REG(TIMER_INITIAL_COUNT));
- kprintf(" Current Count: 0x%08x \n", LAPIC_REG(TIMER_CURRENT_COUNT));
- kprintf(" Divide Config: 0x%08x \n", LAPIC_REG(TIMER_DIVIDE_CONFIG));
- kprintf("LVT_PERFCNT: Vector 0x%02x [%s] %s %cmasked\n",
- LAPIC_REG(LVT_PERFCNT)&LAPIC_LVT_VECTOR_MASK,
- DM[(LAPIC_REG(LVT_PERFCNT)>>LAPIC_LVT_DM_SHIFT)&LAPIC_LVT_DM_MASK],
- (LAPIC_REG(LVT_PERFCNT)&LAPIC_LVT_DS_PENDING)?"SendPending":"Idle",
- BOOL(LAPIC_REG(LVT_PERFCNT)&LAPIC_LVT_MASKED));
- kprintf("LVT_THERMAL: Vector 0x%02x [%s] %s %cmasked\n",
- LAPIC_REG(LVT_THERMAL)&LAPIC_LVT_VECTOR_MASK,
- DM[(LAPIC_REG(LVT_THERMAL)>>LAPIC_LVT_DM_SHIFT)&LAPIC_LVT_DM_MASK],
- (LAPIC_REG(LVT_THERMAL)&LAPIC_LVT_DS_PENDING)?"SendPending":"Idle",
- BOOL(LAPIC_REG(LVT_THERMAL)&LAPIC_LVT_MASKED));
- kprintf("LVT_LINT0: Vector 0x%02x [%s][%s][%s] %s %cmasked\n",
- LAPIC_REG(LVT_LINT0)&LAPIC_LVT_VECTOR_MASK,
- DM[(LAPIC_REG(LVT_LINT0)>>LAPIC_LVT_DM_SHIFT)&LAPIC_LVT_DM_MASK],
- (LAPIC_REG(LVT_LINT0)&LAPIC_LVT_TM_LEVEL)?"Level":"Edge ",
- (LAPIC_REG(LVT_LINT0)&LAPIC_LVT_IP_PLRITY_LOW)?"Low ":"High",
- (LAPIC_REG(LVT_LINT0)&LAPIC_LVT_DS_PENDING)?"SendPending":"Idle",
- BOOL(LAPIC_REG(LVT_LINT0)&LAPIC_LVT_MASKED));
- kprintf("LVT_LINT1: Vector 0x%02x [%s][%s][%s] %s %cmasked\n",
- LAPIC_REG(LVT_LINT1)&LAPIC_LVT_VECTOR_MASK,
- DM[(LAPIC_REG(LVT_LINT1)>>LAPIC_LVT_DM_SHIFT)&LAPIC_LVT_DM_MASK],
- (LAPIC_REG(LVT_LINT1)&LAPIC_LVT_TM_LEVEL)?"Level":"Edge ",
- (LAPIC_REG(LVT_LINT1)&LAPIC_LVT_IP_PLRITY_LOW)?"Low ":"High",
- (LAPIC_REG(LVT_LINT1)&LAPIC_LVT_DS_PENDING)?"SendPending":"Idle",
- BOOL(LAPIC_REG(LVT_LINT1)&LAPIC_LVT_MASKED));
- kprintf("LVT_ERROR: Vector 0x%02x %s %cmasked\n",
- LAPIC_REG(LVT_ERROR)&LAPIC_LVT_VECTOR_MASK,
- (LAPIC_REG(LVT_ERROR)&LAPIC_LVT_DS_PENDING)?"SendPending":"Idle",
- BOOL(LAPIC_REG(LVT_ERROR)&LAPIC_LVT_MASKED));
- kprintf("ESR: %08x \n", lapic_esr_read());
- kprintf(" ");
- for(i=0xf; i>=0; i--)
- kprintf("%x%x%x%x",i,i,i,i);
- kprintf("\n");
- kprintf("TMR: 0x");
- for(i=7; i>=0; i--)
- kprintf("%08x",LAPIC_REG_OFFSET(TMR_BASE, i*0x10));
- kprintf("\n");
- kprintf("IRR: 0x");
- for(i=7; i>=0; i--)
- kprintf("%08x",LAPIC_REG_OFFSET(IRR_BASE, i*0x10));
- kprintf("\n");
- kprintf("ISR: 0x");
- for(i=7; i >= 0; i--)
- kprintf("%08x",LAPIC_REG_OFFSET(ISR_BASE, i*0x10));
- kprintf("\n");
-}